From patchwork Tue Jun 11 15:52:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leyi Rong X-Patchwork-Id: 54723 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 187211CFF6; Tue, 11 Jun 2019 17:55:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id BDF091C571 for ; Tue, 11 Jun 2019 17:55:01 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2019 08:55:01 -0700 X-ExtLoop1: 1 Received: from lrong-srv-03.sh.intel.com ([10.67.119.177]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2019 08:55:00 -0700 From: Leyi Rong To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Leyi Rong , Shivanshu Shukla , Paul M Stillwell Jr Date: Tue, 11 Jun 2019 23:52:21 +0800 Message-Id: <20190611155221.2703-67-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190611155221.2703-1-leyi.rong@intel.com> References: <20190604054248.68510-1-leyi.rong@intel.com> <20190611155221.2703-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v2 66/66] net/ice/base: reduce calls to get profile associations 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" Added refresh_required flag to determine if we need to update the recipe to profile mapping cache. This will reduce the number of calls made to refresh the profile map. Signed-off-by: Shivanshu Shukla Signed-off-by: Paul M Stillwell Jr Signed-off-by: Leyi Rong --- drivers/net/ice/base/ice_switch.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 636b43d69..7f4edd274 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -175,13 +175,15 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw); * @hw: pointer to hardware structure * @recps: struct that we need to populate * @rid: recipe ID that we are populating + * @refresh_required: true if we should get recipe to profile mapping from FW * * This function is used to populate all the necessary entries into our * bookkeeping so that we have a current list of all the recipes that are * programmed in the firmware. */ static enum ice_status -ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid) +ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, + bool *refresh_required) { u16 i, sub_recps, fv_word_idx = 0, result_idx = 0; ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_PROFILES); @@ -191,10 +193,6 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid) struct ice_prot_lkup_ext *lkup_exts; enum ice_status status; - /* Get recipe to profile map so that we can get the fv from - * lkups that we read for a recipe from FW. - */ - ice_get_recp_to_prof_map(hw); /* we need a buffer big enough to accommodate all the recipes */ tmp = (struct ice_aqc_recipe_data_elem *)ice_calloc(hw, ICE_MAX_NUM_RECIPES, sizeof(*tmp)); @@ -206,6 +204,19 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid) /* non-zero status meaning recipe doesn't exist */ if (status) goto err_unroll; + + /* Get recipe to profile map so that we can get the fv from lkups that + * we read for a recipe from FW. Since we want to minimize the number of + * times we make this FW call, just make one call and cache the copy + * until a new recipe is added. This operation is only required the + * first time to get the changes from FW. Then to search existing + * entries we don't need to update the cache again until another recipe + * gets added. + */ + if (*refresh_required) { + ice_get_recp_to_prof_map(hw); + *refresh_required = false; + } lkup_exts = &recps[rid].lkup_exts; /* start populating all the entries for recps[rid] based on lkups from * firmware @@ -4358,6 +4369,7 @@ static const struct ice_protocol_entry ice_prot_id_tbl[] = { */ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts) { + bool refresh_required = true; struct ice_sw_recipe *recp; u16 i; @@ -4376,7 +4388,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts) */ if (!recp[i].recp_created) if (ice_get_recp_frm_fw(hw, - hw->switch_info->recp_list, i)) + hw->switch_info->recp_list, i, + &refresh_required)) continue; /* if number of words we are looking for match */