From patchwork Thu May 12 07:42:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yuying" X-Patchwork-Id: 111044 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 5D307A0032; Thu, 12 May 2022 09:43:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A03340E64; Thu, 12 May 2022 09:43:18 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 0A53C4014F; Thu, 12 May 2022 09:43:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652341396; x=1683877396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+3Ln+42YzY25Ulx2+vi0rfcZIx5tIo/OeFi8bbGFZrc=; b=lClvlxI5BcgyXXZNOaDdoczQmTf4bg80hBt1LBMhRTwS1WMP9sHVT5Ho A/UEpfHZGAZu+CeLgYk/vQ8QjWpdUwIX8lVFN7FB9OMiaYKx04rfJz+Go IlCptRcSvqxUDIZcTym8+/l81hV2Y2V0zVi/f9rAF0vME0hDWUBnhD1cZ PJkSbUV5K5N9mcFX4luPxsanpK2QIA91CI+W0RcNoha1ocBlfwEfoEL2i qOE6hFstsnKeBVB9AvL6RGALhyXAcKOznmu3Msysei5+Uq9mhwUK3mPq5 b1P1l8pfDFNIsl/ypTseg2Cd/uwEyAQgpGeAloLPIrAu3L+gRlNcPpZiN Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="251976453" X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="251976453" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 00:43:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="520850132" Received: from dpdk-yuyingzh-icelake.sh.intel.com ([10.67.116.229]) by orsmga003.jf.intel.com with ESMTP; 12 May 2022 00:43:07 -0700 From: Yuying Zhang To: dev@dpdk.org, qi.z.zhang@intel.com, qiming.yang@intel.com Cc: Yuying Zhang , stable@dpdk.org Subject: [PATCH v2] net/ice/base: fix direction match of flow that matches any Date: Thu, 12 May 2022 07:42:00 +0000 Message-Id: <20220512074200.3070317-1-yuying.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220511090218.3019859-1-yuying.zhang@intel.com> References: <20220511090218.3019859-1-yuying.zhang@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 The tx/rx packets were dropped when creating drop any rule since the recipe didn't contain direction flag matching. This patch adds the packet flag which represents the direction of source interface to slove the issue. Fixes: 92317961a731 ("net/ice: support drop any and steer all to queue") Cc: stable@dpdk.org Signed-off-by: Yuying Zhang Acked-by: Qi Zhang --- drivers/net/ice/base/ice_protocol_type.h | 6 +++-- drivers/net/ice/base/ice_switch.c | 31 ++++++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 83867418c6..8fb95a8a8d 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -54,6 +54,7 @@ enum ice_protocol_type { ICE_GTP_NO_PAY, ICE_VLAN_EX, ICE_VLAN_IN, + ICE_FLG_DIR, ICE_PROTOCOL_LAST }; @@ -219,9 +220,10 @@ enum ice_prot_id { #define ICE_META_DATA_ID_HW 255 /* this is used for tunnel type */ #define ICE_MDID_SIZE 2 -#define ICE_TUN_FLAG_MDID 21 -#define ICE_TUN_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_TUN_FLAG_MDID) +#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_DIR_FLAG_MASK 0x10 #define ICE_TUN_FLAG_VLAN_MASK 0x01 #define ICE_TUN_FLAG_FV_IND 2 diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index d4cc664ad7..c0df3a1815 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -2303,7 +2303,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, lkup_exts->field_mask[fv_word_idx] = rg_entry->fv_mask[i]; if (prot == ICE_META_DATA_ID_HW && - off == ICE_TUN_FLAG_MDID_OFF) + off == ICE_TUN_FLAG_MDID_OFF(1)) vlan = true; fv_word_idx++; } @@ -6770,6 +6770,7 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = { { ICE_GTP_NO_PAY, ICE_UDP_ILOS_HW }, { ICE_VLAN_EX, ICE_VLAN_OF_HW }, { ICE_VLAN_IN, ICE_VLAN_OL_HW }, + { ICE_FLG_DIR, ICE_META_DATA_ID_HW}, }; /** @@ -7488,9 +7489,10 @@ ice_get_fv(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, /** * ice_tun_type_match_word - determine if tun type needs a match mask * @tun_type: tunnel type + * @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 *mask) +static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off, u16 *mask) { switch (tun_type) { case ICE_SW_TUN_VXLAN_GPE: @@ -7506,15 +7508,23 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *mask) case ICE_SW_TUN_PPPOE_IPV4_QINQ: case ICE_SW_TUN_PPPOE_IPV6_QINQ: *mask = ICE_TUN_FLAG_MASK; + *off = ICE_TUN_FLAG_MDID_OFF(1); + return true; + + case ICE_SW_TUN_AND_NON_TUN: + *mask = ICE_DIR_FLAG_MASK; + *off = ICE_TUN_FLAG_MDID_OFF(0); return true; case ICE_SW_TUN_GENEVE_VLAN: case ICE_SW_TUN_VXLAN_VLAN: *mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK; + *off = ICE_TUN_FLAG_MDID_OFF(1); return true; default: *mask = 0; + *off = 0; return false; } } @@ -7529,16 +7539,18 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo, struct ice_prot_lkup_ext *lkup_exts) { u16 mask; + u16 off; /* If this is a tunneled packet, then add recipe index to match the - * tunnel bit in the packet metadata flags. + * 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, &mask)) { + if (ice_tun_type_match_word(rinfo->tun_type, &off, &mask)) { 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; + lkup_exts->fv_words[word].off = off; lkup_exts->field_mask[word] = mask; } else { return ICE_ERR_MAX_LIMIT; @@ -7864,6 +7876,15 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, */ ice_get_compat_fv_bitmap(hw, rinfo, fv_bitmap); + /* If it is a packet to match any, add a lookup element to match direction + * flag of source interface. + */ + if (rinfo->tun_type == ICE_SW_TUN_AND_NON_TUN && + lkups_cnt < ICE_MAX_CHAIN_WORDS) { + lkups[lkups_cnt].type = ICE_FLG_DIR; + lkups_cnt++; + } + status = ice_get_fv(hw, lkups, lkups_cnt, fv_bitmap, &rm->fv_list); if (status) goto err_unroll;