From patchwork Thu May 18 15:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiming Yang X-Patchwork-Id: 127003 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3C4642AF1; Thu, 18 May 2023 17:35:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2398542D69; Thu, 18 May 2023 17:34:36 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 98AD44014F for ; Thu, 18 May 2023 17:34:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684424074; x=1715960074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=to6zhHg0jRoT+E/JoMbGJ6b85GGWHkpT1jAR+svra+4=; b=Umn4DIRjzA09t2zYXRR6b3jmlg7VDnBugmrNZFaHgLxit453unCD4zxe Y9hfZTT8FQvO4P5v4SoVcFqJjUfVt77S6+Ce8dJNj5XI1cT6rL/wS+Jcb IosIpVeZXI9B0UKatRYS7Saoe6M/s7Cpts2Ga3JQ3Am1AI/gEUveVx/So lapL/qqviyKmQju/ZKzyFiwWlXK9LQ1vPAQyzUI+XpeGWTeUvEzeJMczS tb8YEcWmC5KK5yv3kO2EkTFTJuZCFiL/wbtInD5x6dhwyXJmdkWVYbRIa hMgiC27KZRhVcvVeyPBUTvzdBHpOqY8A9o0kG+7GSJjZZ3dL5Jt2ukgg2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="341527694" X-IronPort-AV: E=Sophos;i="5.99,285,1677571200"; d="scan'208";a="341527694" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 08:34:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="705235115" X-IronPort-AV: E=Sophos;i="5.99,285,1677571200"; d="scan'208";a="705235115" Received: from dpdk-qiming3.sh.intel.com ([10.67.111.4]) by fmsmga007.fm.intel.com with ESMTP; 18 May 2023 08:34:32 -0700 From: Qiming Yang To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Qiming Yang , Marcin Szycik Subject: [PATCH v2 09/20] net/ice/base: remove direction metadata for switchdev Date: Thu, 18 May 2023 15:16:27 +0000 Message-Id: <20230518151638.1207021-10-qiming.yang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518151638.1207021-1-qiming.yang@intel.com> References: <20230427062001.478032-1-qiming.yang@intel.com> <20230518151638.1207021-1-qiming.yang@intel.com> MIME-Version: 1.0 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 ICE_SW_TUN_AND_NON_TUN tunnel type is used by switchdev for default MAC rules. Currently a "special word" is added to recipes for such tunnels, specifying that rule should work only in ingress direction. Because of this, all egress traffic from VF is being dropped. To fix that, add a field add_dir_lkup to ice_adv_rule_info struct (will be set in CORE before calling ice_add_adv_rule()). Signed-off-by: Marcin Szycik Signed-off-by: Qiming Yang --- drivers/net/ice/base/ice_switch.c | 20 +++++++++++++------- drivers/net/ice/base/ice_switch.h | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index e290a845bc..c5951b5d40 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -7754,13 +7754,14 @@ ice_get_fv(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups, /** * ice_tun_type_match_word - determine if tun type needs a match mask - * @tun_type: tunnel type + * @rinfo: other information regarding the rule e.g. priority and action info * @off: offset of packet flag * @mask: mask to be used for the tunnel */ -static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off, u16 *mask) +static bool +ice_tun_type_match_word(struct ice_adv_rule_info *rinfo, u16 *off, u16 *mask) { - switch (tun_type) { + switch (rinfo->tun_type) { case ICE_SW_TUN_VXLAN_GPE: case ICE_SW_TUN_GENEVE: case ICE_SW_TUN_VXLAN: @@ -7778,9 +7779,14 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off, return true; case ICE_SW_TUN_AND_NON_TUN: - *mask = ICE_DIR_FLAG_MASK; - *off = ICE_TUN_FLAG_MDID_OFF(0); - return true; + if (rinfo->add_dir_lkup) { + *mask = ICE_DIR_FLAG_MASK; + *off = ICE_TUN_FLAG_MDID_OFF(0); + return true; + } + *mask = 0; + *off = 0; + return false; case ICE_SW_TUN_GENEVE_VLAN: case ICE_SW_TUN_VXLAN_VLAN: @@ -7811,7 +7817,7 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo, * 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. */ - if (ice_tun_type_match_word(rinfo->tun_type, &off, &mask)) { + if (ice_tun_type_match_word(rinfo, &off, &mask)) { if (lkup_exts->n_val_words < ICE_MAX_CHAIN_WORDS) { u8 word = lkup_exts->n_val_words++; diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 7a12619459..7421e02466 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -311,6 +311,7 @@ struct ice_adv_rule_info { struct ice_sw_act_ctrl sw_act; u32 priority; u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */ + u8 add_dir_lkup; u16 fltr_rule_id; u16 lg_id; struct ice_adv_rule_flags_info flags_info;