From patchwork Tue Jul 7 09:40:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 73416 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66380A00BE; Tue, 7 Jul 2020 12:06:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C5121DD7C; Tue, 7 Jul 2020 12:05:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 479AF1DD2A for ; Tue, 7 Jul 2020 12:05:55 +0200 (CEST) IronPort-SDR: hdvJ2XAxZFpT3a0G9wPpCVGSXignvE9M/PDKIMIKgqR/T0rzZNPv8mz0TQVvTc82hK9RMxfOyR gG+c9VX+jPLQ== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="149075708" X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="149075708" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 03:05:54 -0700 IronPort-SDR: WgdpHmCljbheSkkMoRqhXKRz5adIs29AFh9Qsx1kHMgZsUa0ZontCPafi2ek7GEYcBeAM+Hx3n lIfLUJdX5Lfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="268159340" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by fmsmga008.fm.intel.com with ESMTP; 07 Jul 2020 03:05:53 -0700 From: Wei Zhao To: dev@dpdk.org Cc: qi.z.zhang@intel.com, nannan.lu@intel.com, Wei Zhao Date: Tue, 7 Jul 2020 17:40:47 +0800 Message-Id: <20200707094048.17690-2-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200707094048.17690-1-wei.zhao1@intel.com> References: <20200707094048.17690-1-wei.zhao1@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/2] net/ice/base: fix tunnel type check for PPPoE X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fix tunnel type check for PPPoE type of recipe when search for recipe which has been created before, and also fix a bug of typo. Fixes: 418d2563d10b ("net/ice/base: get tunnel type for recipe") Signed-off-by: Wei Zhao --- drivers/net/ice/base/ice_switch.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 0e220580a..caa080da2 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -1086,15 +1086,11 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid) tun_type = ICE_SW_TUN_PPPOE; else if (!non_tun_valid && gtp_valid) tun_type = ICE_SW_TUN_GTP; - else if ((non_tun_valid && vxlan_valid) || - (non_tun_valid && gre_valid) || - (non_tun_valid && gtp_valid) || - (non_tun_valid && pppoe_valid)) + else if (non_tun_valid && + (vxlan_valid || gre_valid || gtp_valid || pppoe_valid)) tun_type = ICE_SW_TUN_AND_NON_TUN; - else if ((non_tun_valid && !vxlan_valid) || - (non_tun_valid && !gre_valid) || - (non_tun_valid && !gtp_valid) || - (non_tun_valid && !pppoe_valid)) + else if (non_tun_valid && !vxlan_valid && !gre_valid && !gtp_valid && + !pppoe_valid) tun_type = ICE_NON_TUN; if (profile_num > 1 && tun_type == ICE_SW_TUN_PPPOE) { @@ -1108,7 +1104,7 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid) tun_type = ICE_SW_TUN_PPPOE_IPV6; } - if (profile_num == 1 && (flag_valid || non_tun_valid)) { + if (profile_num == 1 && (flag_valid || non_tun_valid || pppoe_valid)) { for (j = 0; j < ICE_MAX_NUM_PROFILES; j++) { if (ice_is_bit_set(recipe_to_profile[rid], j)) { switch (j) { From patchwork Tue Jul 7 09:40:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 73417 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 dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B8C9A00BE; Tue, 7 Jul 2020 12:06:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0E58D1DDAC; Tue, 7 Jul 2020 12:06:00 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AA30E1DD92; Tue, 7 Jul 2020 12:05:57 +0200 (CEST) IronPort-SDR: eOvxBRx5F+RVtzO1UhsyqJY7As0Zi3jCROVg8G521pE2gE61HCzHzL9FqR9MDVJwKKewTUT1E7 EM6ldAvxvGOA== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="149075715" X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="149075715" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 03:05:57 -0700 IronPort-SDR: Z419xhmxMbhm3erLNcjZ2ErYUYJFv9Us+SSrfjip+BgKV0rvyRyc7TKjTemZsFYvOBghlzSRW5 aDEgGCuRl04g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,323,1589266800"; d="scan'208";a="268159352" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by fmsmga008.fm.intel.com with ESMTP; 07 Jul 2020 03:05:55 -0700 From: Wei Zhao To: dev@dpdk.org Cc: qi.z.zhang@intel.com, nannan.lu@intel.com, stable@dpdk.org, Wei Zhao Date: Tue, 7 Jul 2020 17:40:48 +0800 Message-Id: <20200707094048.17690-3-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200707094048.17690-1-wei.zhao1@intel.com> References: <20200707094048.17690-1-wei.zhao1@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/2] net/ice/base: fix add special words for tunnel rule X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" if we download a NVGRE rule like "eth / ipv4 / nvgre / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions queue index 3 / end" the special word will not be added because of rm->n_grp_count = 1, so we have to change the ice_add_special_words() function before ice_create_recipe_group(), then the special words will be add into rm->rg_list, btw the flag match_tun_mask is useless now and no need to add special words in function ice_add_sw_recipe() duplicatly. Fixes: eda40e22b858 ("net/ice/base: improve switch chained recipe") Cc: stable@dpdk.org Signed-off-by: Wei Zhao --- drivers/net/ice/base/ice_switch.c | 38 ++++++++----------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index caa080da2..296aa5484 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -5993,12 +5993,11 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles, * ice_add_sw_recipe - function to call AQ calls to create switch recipe * @hw: pointer to hardware structure * @rm: recipe management list entry - * @match_tun_mask: tunnel mask that needs to be programmed * @profiles: bitmap of profiles that will be associated. */ static enum ice_status ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, - u16 match_tun_mask, ice_bitmap_t *profiles) + ice_bitmap_t *profiles) { ice_declare_bitmap(result_idx_bm, ICE_MAX_FV_WORDS); struct ice_aqc_recipe_data_elem *tmp; @@ -6213,15 +6212,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, } buf[recps].content.act_ctrl_fwd_priority = rm->priority; - /* To differentiate among different UDP tunnels, a meta data ID - * flag is used. - */ - if (match_tun_mask) { - buf[recps].content.lkup_indx[i] = ICE_TUN_FLAG_FV_IND; - buf[recps].content.mask[i] = - CPU_TO_LE16(match_tun_mask); - } - recps++; rm->root_rid = (u8)rid; } @@ -6596,8 +6586,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, struct ice_sw_fv_list_entry *tmp; enum ice_status status = ICE_SUCCESS; struct ice_sw_recipe *rm; - u16 match_tun_mask = 0; - u16 mask; u8 i; if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt) @@ -6648,6 +6636,13 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, if (status) goto err_unroll; + /* Create any special protocol/offset pairs, such as looking at tunnel + * bits by extracting metadata + */ + status = ice_add_special_words(rinfo, lkup_exts); + if (status) + goto err_free_lkup_exts; + /* Group match words into recipes using preferred recipe grouping * criteria. */ @@ -6655,14 +6650,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, if (status) goto err_unroll; - /* For certain tunnel types it is necessary to use a metadata ID flag to - * differentiate different tunnel types. A separate recipe needs to be - * used for the metadata. - */ - if (ice_tun_type_match_word(rinfo->tun_type, &mask) && - rm->n_grp_count > 1) - match_tun_mask = mask; - /* set the recipe priority if specified */ rm->priority = (u8)rinfo->priority; @@ -6701,13 +6688,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, ice_set_bit((u16)fvit->profile_id, profiles); } - /* Create any special protocol/offset pairs, such as looking at tunnel - * bits by extracting metadata - */ - status = ice_add_special_words(rinfo, lkup_exts); - if (status) - goto err_free_lkup_exts; - /* Look for a recipe which matches our requested fv / mask list */ *rid = ice_find_recp(hw, lkup_exts, rinfo->tun_type); if (*rid < ICE_MAX_NUM_RECIPES) @@ -6716,7 +6696,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, rm->tun_type = rinfo->tun_type; /* Recipe we need does not exist, add a recipe */ - status = ice_add_sw_recipe(hw, rm, match_tun_mask, profiles); + status = ice_add_sw_recipe(hw, rm, profiles); if (status) goto err_unroll;