From patchwork Thu Aug 29 02:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 58203 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 97B2E1E8E1; Thu, 29 Aug 2019 04:37:06 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B486F1D17C for ; Thu, 29 Aug 2019 04:36:08 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2019 19:36:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,442,1559545200"; d="scan'208";a="332364021" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2019 19:36:06 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Dan Nowlin , Paul M Stillwell Jr Date: Thu, 29 Aug 2019 10:36:55 +0800 Message-Id: <20190829023656.8220-63-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190829023656.8220-1-qi.z.zhang@intel.com> References: <20190826105105.19121-1-qi.z.zhang@intel.com> <20190829023656.8220-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 62/63] net/ice/base: update profile to recipe bitmap array 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" Correctly update profile to recipe bitmap array after adding and associating recipes. This fixes an issue where determining unused recipe result index slots was incorrect. Signed-off-by: Dan Nowlin Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 8f20b9ed6..59da7eaa8 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -594,11 +594,14 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, /* Propagate some data to the recipe database */ recps[idx].is_root = is_root; recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority; - if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) + ice_zero_bitmap(recps[idx].res_idxs, ICE_MAX_FV_WORDS); + if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) { recps[idx].chain_idx = root_bufs.content.result_indx & ~ICE_AQ_RECIPE_RESULT_EN; - else + ice_set_bit(recps[idx].chain_idx, recps[idx].res_idxs); + } else { recps[idx].chain_idx = ICE_INVAL_CHAIN_IND; + } if (!is_root) continue; @@ -609,11 +612,11 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, recps[idx].root_rid = root_bufs.content.rid & ~ICE_AQ_RECIPE_ID_IS_ROOT; recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority; - recps[idx].big_recp = (recps[rid].n_grp_count > 1); } /* Complete initialization of the root recipe entry */ lkup_exts->n_val_words = fv_word_idx; + recps[rid].big_recp = (num_recps > 1); recps[rid].n_grp_count = num_recps; recps[rid].root_buf = (struct ice_aqc_recipe_data_elem *) ice_calloc(hw, recps[rid].n_grp_count, @@ -5287,6 +5290,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, recp->n_ext_words = entry->r_group.n_val_pairs; recp->chain_idx = entry->chain_idx; recp->priority = buf[buf_idx].content.act_ctrl_fwd_priority; + recp->n_grp_count = rm->n_grp_count; recp->tun_type = rm->tun_type; recp->recp_created = true; recp->adv_rule = 1; @@ -5568,6 +5572,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, LIST_FOR_EACH_ENTRY(fvit, &rm->fv_list, ice_sw_fv_list_entry, list_entry) { ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES); + u16 j; status = ice_aq_get_recipe_to_profile(hw, fvit->profile_id, (u8 *)r_bitmap, NULL); @@ -5587,6 +5592,16 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, if (status) goto err_unroll; + + /* Update profile to recipe bitmap array */ + ice_memcpy(profile_to_recipe[fvit->profile_id], rm->r_bitmap, + sizeof(rm->r_bitmap), ICE_NONDMA_TO_NONDMA); + + /* Update recipe to profile bitmap array */ + for (j = 0; j < ICE_MAX_NUM_RECIPES; j++) + if (ice_is_bit_set(rm->r_bitmap, j)) + ice_set_bit((u16)fvit->profile_id, + recipe_to_profile[j]); } *rid = rm->root_rid;