From patchwork Fri Sep 11 13:19:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 77410 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 6E230A04B7; Fri, 11 Sep 2020 15:20:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1AE0F1C1E7; Fri, 11 Sep 2020 15:16:44 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 6FD9B1C1BC for ; Fri, 11 Sep 2020 15:16:35 +0200 (CEST) IronPort-SDR: RVmQm976EDMT7Lr1RFAp7EvTySOcvcBgSIpkg0Y1SZqW3inz4n6dCMbPnrPujtemMHYAUBUWXC DM7rAadaxx0Q== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="146482303" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="146482303" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 06:16:35 -0700 IronPort-SDR: aIPra0Megbu6ZNl6Ad8dNqWefl1BLJskgTsY3JoKOtMv0/IHxnPk0B5qMDsSkW8HuCfZIl/mkL 1DDJeWhwTaiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="342296663" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2020 06:16:33 -0700 From: Qi Zhang To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Qi Zhang , Tony Nguyen Date: Fri, 11 Sep 2020 21:19:37 +0800 Message-Id: <20200911131954.15999-24-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200911131954.15999-1-qi.z.zhang@intel.com> References: <20200907112826.48493-1-qi.z.zhang@intel.com> <20200911131954.15999-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 23/40] net/ice/base: move a function 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" The only caller of this function is within the file so mark it as static and move it up in the file to avoid a forward declaration. Signed-off-by: Tony Nguyen Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_acl.h | 1 - drivers/net/ice/base/ice_acl_ctrl.c | 93 ++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 49 deletions(-) diff --git a/drivers/net/ice/base/ice_acl.h b/drivers/net/ice/base/ice_acl.h index 500db0c35..cd75e1c17 100644 --- a/drivers/net/ice/base/ice_acl.h +++ b/drivers/net/ice/base/ice_acl.h @@ -132,7 +132,6 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw); enum ice_status ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, u16 *scen_id); -enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id); enum ice_status ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl, struct ice_sq_cd *cd); diff --git a/drivers/net/ice/base/ice_acl_ctrl.c b/drivers/net/ice/base/ice_acl_ctrl.c index 0ecf38496..02a1dd34f 100644 --- a/drivers/net/ice/base/ice_acl_ctrl.c +++ b/drivers/net/ice/base/ice_acl_ctrl.c @@ -842,6 +842,51 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, } /** + * ice_acl_destroy_scen - Destroy an ACL scenario + * @hw: pointer to the HW struct + * @scen_id: ID of the remove scenario + */ +static enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id) +{ + struct ice_acl_scen *scen, *tmp_scen; + struct ice_flow_prof *p, *tmp; + enum ice_status status; + + if (!hw->acl_tbl) + return ICE_ERR_DOES_NOT_EXIST; + + /* Remove profiles that use "scen_id" scenario */ + LIST_FOR_EACH_ENTRY_SAFE(p, tmp, &hw->fl_profs[ICE_BLK_ACL], + ice_flow_prof, l_entry) + if (p->cfg.scen && p->cfg.scen->id == scen_id) { + status = ice_flow_rem_prof(hw, ICE_BLK_ACL, p->id); + if (status) { + ice_debug(hw, ICE_DBG_ACL, "ice_flow_rem_prof failed. status: %d\n", + status); + return status; + } + } + + /* Call the AQ command to destroy the targeted scenario */ + status = ice_aq_dealloc_acl_scen(hw, scen_id, NULL); + if (status) { + ice_debug(hw, ICE_DBG_ACL, "AQ de-allocation of scenario failed. status: %d\n", + status); + return status; + } + + /* Remove scenario from hw->acl_tbl->scens */ + LIST_FOR_EACH_ENTRY_SAFE(scen, tmp_scen, &hw->acl_tbl->scens, + ice_acl_scen, list_entry) + if (scen->id == scen_id) { + LIST_DEL(&scen->list_entry); + ice_free(hw, scen); + } + + return ICE_SUCCESS; +} + +/** * ice_acl_destroy_tbl - Destroy a previously created LEM table for ACL * @hw: pointer to the HW struct */ @@ -1118,51 +1163,3 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) return status; } - -/** - * ice_acl_destroy_scen - Destroy an ACL scenario - * @hw: pointer to the HW struct - * @scen_id: ID of the remove scenario - */ -enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id) -{ - struct ice_acl_scen *scen, *tmp_scen; - struct ice_flow_prof *p, *tmp; - enum ice_status status; - - if (!hw->acl_tbl) - return ICE_ERR_DOES_NOT_EXIST; - - /* Remove profiles that use "scen_id" scenario */ - LIST_FOR_EACH_ENTRY_SAFE(p, tmp, &hw->fl_profs[ICE_BLK_ACL], - ice_flow_prof, l_entry) - if (p->cfg.scen && p->cfg.scen->id == scen_id) { - status = ice_flow_rem_prof(hw, ICE_BLK_ACL, p->id); - if (status) { - ice_debug(hw, ICE_DBG_ACL, - "ice_flow_rem_prof failed. status: %d\n", - status); - goto exit; - } - } - - /* Call the AQ command to destroy the targeted scenario */ - status = ice_aq_dealloc_acl_scen(hw, scen_id, NULL); - - if (status) { - ice_debug(hw, ICE_DBG_ACL, - "AQ de-allocation of scenario failed. status: %d\n", - status); - goto exit; - } - - /* Remove scenario from hw->acl_tbl->scens */ - LIST_FOR_EACH_ENTRY_SAFE(scen, tmp_scen, &hw->acl_tbl->scens, - ice_acl_scen, list_entry) - if (scen->id == scen_id) { - LIST_DEL(&scen->list_entry); - ice_free(hw, scen); - } -exit: - return status; -}