From patchwork Fri Mar 15 11:08:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 1912448 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=5Jl/JrxL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tx1b56JS7z1yX0 for ; Fri, 15 Mar 2024 22:04:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2119C415EF; Fri, 15 Mar 2024 11:03:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yqa4-oZ2-V6Y; Fri, 15 Mar 2024 11:03:58 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4B1EE415F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1710500638; bh=rgvo10RhEKywtV81zIUn4e5QCCWhacBbOrCKwgYMw84=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=5Jl/JrxLkWntMDLdIECAe1Palg++PHU2Sm+G93GhT7D2f0Un/WwrdV2Qzp4rJrm1/ ldM5Zd6PfUNsp2TAnmvGkTQfbsGqa+mMghj4g1L4RIzd4VxuqvrCQRMYl5zsPtNGve 1CIWRwg4aw4sJsFwh0qxJBCSp1KzFmZlbIbPznwQQsNdGYs07Ds4nNr7OWTpSCw/8C xzJlHdhZ1YUGUSochyo6kCRbatcZrNDvticUTD4rTjo7Z8YzG7yOVGlvM4VSKKCBcO 2M0BikoVu1FMiOmJaGUUfMmZkS6xG2Qd71yKjb2Jzq/gwsOMTnlc2B4h/CRHpkgEEx X0eAqnRnEmP7Q== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 4B1EE415F5; Fri, 15 Mar 2024 11:03:58 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 90DAF1BF976 for ; Fri, 15 Mar 2024 11:03:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7D4C360E61 for ; Fri, 15 Mar 2024 11:03:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DBYkHSUp9E77 for ; Fri, 15 Mar 2024 11:03:54 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=michal.swiatkowski@linux.intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 69E6D60E5D DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 69E6D60E5D Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp3.osuosl.org (Postfix) with ESMTPS id 69E6D60E5D for ; Fri, 15 Mar 2024 11:03:54 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,11013"; a="5549435" X-IronPort-AV: E=Sophos;i="6.07,128,1708416000"; d="scan'208";a="5549435" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2024 04:03:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,128,1708416000"; d="scan'208";a="35761198" Received: from wasp.igk.intel.com (HELO GK3153-DR2-R750-36946.localdomain.com) ([10.102.20.192]) by fmviesa002.fm.intel.com with ESMTP; 15 Mar 2024 04:03:53 -0700 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Date: Fri, 15 Mar 2024 12:08:20 +0100 Message-ID: <20240315110821.511321-2-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240315110821.511321-1-michal.swiatkowski@linux.intel.com> References: <20240315110821.511321-1-michal.swiatkowski@linux.intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710500634; x=1742036634; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AvbcYVh7P8usqtvRRQTYnk/im19ZFQWqAoxQs2bqYZs=; b=ch8K0deevhygVX1TO8l10P1JEl3UcXl36ATpF9ffztsTw4/lfSFBU7Jh E8fQrz0RNT9tNqNi+mcX5mxNhu7sEcE9G8JE0nJLoX9lwUE4vD0oOMYXr XqZ0IfiCTbwqoRhEcPWQTeCf+nAqJWAkUPohPc1Cj0EBqrjfmEeaIkbiy fRJp6W/cyS55oJ4kz6pOl9qloyBdBLjDgXPflFzZzQLGKxu9PIzAPwN+6 +vbE59NcSoowYe5tyxylcIsy0SoXVIaOkg4nuktQ+VzWNX+qsM2LvSISc 91uM8vU5IvPYUr/nofMFQv6jWfrobdZ6W6s9Chp+Myeol3OEoFnQNrHso g==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=linux.intel.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ch8K0dee Subject: [Intel-wired-lan] [iwl-net v1 1/2] ice: tc: check src_vsi in case of traffic from VF X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sridhar Samudrala , netdev@vger.kernel.org, Jedrzej Jagielski , Michal Swiatkowski Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" In case of traffic going from the VF (so ingress for port representor) source VSI should be consider during packet classification. It is needed for hardware to not match packets from different ports with filters added on other port. It is only for "from VF" traffic, because other traffic direction doesn't have source VSI. Set correct ::src_vsi in rule_info to pass it to the hardware filter. For example this rule should drop only ipv4 packets from eth10, not from the others VF PRs. It is needed to check source VSI in this case. $tc filter add dev eth10 ingress protocol ip flower skip_sw action drop Fixes: 0d08a441fb1a ("ice: ndo_setup_tc implementation for PF") Reviewed-by: Jedrzej Jagielski Reviewed-by: Sridhar Samudrala Signed-off-by: Michal Swiatkowski Reviewed-by: Simon Horman Tested-by: Sujai Buvaneswaran --- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c index 47f28cd576c6..a8c686ecd1a0 100644 --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c @@ -28,6 +28,8 @@ ice_tc_count_lkups(u32 flags, struct ice_tc_flower_lyr_2_4_hdrs *headers, * - ICE_TC_FLWR_FIELD_VLAN_TPID (present if specified) * - Tunnel flag (present if tunnel) */ + if (fltr->direction == ICE_ESWITCH_FLTR_EGRESS) + lkups_cnt++; if (flags & ICE_TC_FLWR_FIELD_TENANT_ID) lkups_cnt++; @@ -363,6 +365,11 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags, /* Always add direction metadata */ ice_rule_add_direction_metadata(&list[ICE_TC_METADATA_LKUP_IDX]); + if (tc_fltr->direction == ICE_ESWITCH_FLTR_EGRESS) { + ice_rule_add_src_vsi_metadata(&list[i]); + i++; + } + rule_info->tun_type = ice_sw_type_from_tunnel(tc_fltr->tunnel_type); if (tc_fltr->tunnel_type != TNL_LAST) { i = ice_tc_fill_tunnel_outer(flags, tc_fltr, list, i); @@ -820,6 +827,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) /* specify the cookie as filter_rule_id */ rule_info.fltr_rule_id = fltr->cookie; + rule_info.src_vsi = vsi->idx; ret = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info, &rule_added); if (ret == -EEXIST) { From patchwork Fri Mar 15 11:08:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 1912449 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=lC8sY+SF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tx1b85qsXz1yX0 for ; Fri, 15 Mar 2024 22:04:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6EDD1415F8; Fri, 15 Mar 2024 11:04:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YPIirLfQVury; Fri, 15 Mar 2024 11:04:00 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9B89C415EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1710500640; bh=fOXM9NCushZKVFN8ORyprERB7Dtzo/jt+PAY2hYk38U=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=lC8sY+SF7VNxa4xXW0By4j/zDiNkiNzzwqXpVuRETxlyZUPITcLm8wCvzv4b+hjzj 9bE2eNy7iDsLhoObbRld4+KzOoVtv0MrsMWFE5Lay00z+m4ULrz8sylS7q20Zu+Dn4 CuX6wYg6cqhKIU8VgS/naamtlrWiyVjEshvpJ9ywMn/TTa942C5ToWurLTJ7mno0Tn mchjE7Og0/gw7op/kpzEKRFbUlEuJYUYkJuvCDcIohzijDl0wfh7fVDXPeBVURlz6O R7YsQFG3e9Y1/Q0HaeV2/kkK1En5GijQSmqyrASx8onwlcJriqar8SIXjqui/VZzlJ iYbmWSKgTSFVw== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 9B89C415EC; Fri, 15 Mar 2024 11:04:00 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 950F71BF976 for ; Fri, 15 Mar 2024 11:03:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7DCE060E6B for ; Fri, 15 Mar 2024 11:03:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MYgLLW6GuGxQ for ; Fri, 15 Mar 2024 11:03:56 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=192.198.163.15; helo=mgamail.intel.com; envelope-from=michal.swiatkowski@linux.intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org BA61360E5D DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BA61360E5D Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by smtp3.osuosl.org (Postfix) with ESMTPS id BA61360E5D for ; Fri, 15 Mar 2024 11:03:55 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,11013"; a="5549445" X-IronPort-AV: E=Sophos;i="6.07,128,1708416000"; d="scan'208";a="5549445" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2024 04:03:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,128,1708416000"; d="scan'208";a="35761201" Received: from wasp.igk.intel.com (HELO GK3153-DR2-R750-36946.localdomain.com) ([10.102.20.192]) by fmviesa002.fm.intel.com with ESMTP; 15 Mar 2024 04:03:54 -0700 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Date: Fri, 15 Mar 2024 12:08:21 +0100 Message-ID: <20240315110821.511321-3-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240315110821.511321-1-michal.swiatkowski@linux.intel.com> References: <20240315110821.511321-1-michal.swiatkowski@linux.intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710500636; x=1742036636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=f1y5+s38KG4eul9EBArMIcDOgPDGpTwExT1UYJ9aTiM=; b=JxzKeDRqj6+xo7dvnYzzKLYdLHliQkfSz/koKgcRYQQ9JDZr6wkRM8re lPleCHEfMXohvun7H5k+MwxudicRJg3g0ZZ5sA7QiFAVPi9vOeMgwrJyj iKL49u/bKjG2R+tstdVV/SqfiiJfYW33dRhNQJbFsDfnVwba/qEGd9di6 b/Ztr5EHEWlUaXuFfEtNkSrAvl8zF0aMksKaqUTeY0RJGeeVZv/Yi8FXb ltqWWQs/9ZN8z5qCa08+jHKnkc+I51S8EhSiFztmjcZ1c5VX21NFo71vk ST7sgoKdyXGPVFEqywTSy1KGrK7mZbVeGaqs/ykZ8gkQyi4hfyTFo244v A==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=linux.intel.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JxzKeDRq Subject: [Intel-wired-lan] [iwl-net v1 2/2] ice: tc: allow zero flags in parsing tc flower X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Wojciech Drewek , Michal Swiatkowski Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" The check for flags is done to not pass empty lookups to adding switch rule functions. Since metadata is always added to lookups there is no need to check against the flag. It is also fixing the problem with such rule: $ tc filter add dev gtp_dev ingress protocol ip prio 0 flower \ enc_dst_port 2123 action drop Switch block in case of GTP can't parse the destination port, because it should always be set to GTP specific value. The same with ethertype. The result is that there is no other matching criteria than GTP tunnel. In this case flags is 0, rule can't be added only because of defensive check against flags. Fixes: 9a225f81f540 ("ice: Support GTP-U and GTP-C offload in switchdev") Reviewed-by: Wojciech Drewek Signed-off-by: Michal Swiatkowski Reviewed-by: Simon Horman Tested-by: Sujai Buvaneswaran --- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c index a8c686ecd1a0..f8df93e1a9de 100644 --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c @@ -779,7 +779,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) int ret; int i; - if (!flags || (flags & ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT)) { + if (flags & ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT) { NL_SET_ERR_MSG_MOD(fltr->extack, "Unsupported encap field(s)"); return -EOPNOTSUPP; }