From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78EC04404F; Wed, 12 Jun 2024 17:11:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84B13427E4; Wed, 12 Jun 2024 17:04:31 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 52BCA427CE for ; Wed, 12 Jun 2024 17:04:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204666; x=1749740666; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ewy1aS0T6f0wq+3ct1gpcCzLB9PMiYiBWRZcv6NMZBY=; b=kGiwPAlewPqWmHzMRzCmGqCRn9F6m0yIz+UH0nkuETKu1LANBbnJAhqG BxM1oeaiwlsnHhaqqBssAiWSG+CBbl6ncBmY59icB/InUYyWrPy/fy1LA hn0Hbe9ai7xulNTYpu8HSu+cRrrjpLoDGA+cXOLPlcmzWCESQFzfmoqs2 eKF7/pzZ7J1YHzzo8c4VU+ucHXw5T9RfOUPyF8QFewdAcWNL1A+2ea5r0 Skv5SpAvbMHb9CejBvfzJT9AExjNfdzkujhXY8K850dQ6zLlK84E3Cv48 YB+2+NI4oiu9/iL300R0D0g90vCAiNEIoS7yOGSrRydJv5FDHEoXJQDTn g==; X-CSE-ConnectionGUID: MQk8xdxvQkyP7bXZLg4YXA== X-CSE-MsgGUID: bL+pnKuqR3md3E9dHa9aDg== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459398" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459398" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:04:24 -0700 X-CSE-ConnectionGUID: 89cEUmpoS2OW0exMj9LKXQ== X-CSE-MsgGUID: G26tFH/SQMq1rso5PWA9lg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925150" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:04:23 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Marcin Szycik Subject: [PATCH v2 041/148] net/ice/base: add direction metadata Date: Wed, 12 Jun 2024 16:00:35 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ian Stokes Currently it is possible to create a filter which breaks TX traffic, e.g.: tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp dst_port $PORT action mirred egress redirect dev $VF1_PR This adds a rule which might match both TX and RX traffic, and in TX path the PF will actually receive the traffic, which breaks communication. To fix this, always add a direction flag. Currently it is possible to create a filter which breaks TX traffic, e.g.: tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp dst_port $PORT action mirred egress redirect dev $VF1_PR This adds a rule which might match both TX and RX traffic, and in TX path the PF will actually receive the traffic, which breaks communication. To fix this, always add a direction flag. Signed-off-by: Marcin Szycik Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_protocol_type.h | 1 + drivers/net/ice/base/ice_switch.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index d2d3f75fc2..9f17b5d0f5 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -225,6 +225,7 @@ enum ice_prot_id { #define ICE_TUN_FLAG_MDID 20 #define ICE_TUN_FLAG_MDID_OFF(word) (ICE_MDID_SIZE * (ICE_TUN_FLAG_MDID + (word))) #define ICE_TUN_FLAG_MASK 0xFF +#define ICE_FROM_NETWORK_FLAG_MASK 0x8 #define ICE_DIR_FLAG_MASK 0x10 #define ICE_TUN_FLAG_IN_VLAN_MASK 0x80 /* VLAN inside tunneled header */ #define ICE_TUN_FLAG_VLAN_MASK 0x01 diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index cf1ab35f26..ba8d2eb4b1 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -7872,6 +7872,17 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo, u16 mask; u16 off; + /* Always add direction flag */ + if (lkup_exts->n_val_words < ICE_MAX_CHAIN_WORDS) { + u8 word = lkup_exts->n_val_words++; + + lkup_exts->fv_words[word].prot_id = ICE_META_DATA_ID_HW; + lkup_exts->fv_words[word].off = ICE_TUN_FLAG_MDID_OFF(0); + lkup_exts->field_mask[word] = ICE_FROM_NETWORK_FLAG_MASK; + } else { + return ICE_ERR_MAX_LIMIT; + } + /* If this is a tunneled packet, then add recipe index to match the * tunnel bit in the packet metadata flags. If this is a tun_and_non_tun * packet, then add recipe index to match the direction bit in the flag. -- 2.43.0