From 54d86ca5870748b29f1b2416a03ad48227264112 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Wed, 26 Aug 2020 20:24:29 +0800 Subject: [PATCH] net/ice/base: move a function 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 500db0c35e..cd75e1c175 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 0ecf384965..02a1dd34f1 100644 --- a/drivers/net/ice/base/ice_acl_ctrl.c +++ b/drivers/net/ice/base/ice_acl_ctrl.c @@ -841,6 +841,51 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, return status; } +/** + * 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; -} -- 2.20.1