[v2,23/40] net/ice/base: move a function
diff mbox series

Message ID 20200911131954.15999-24-qi.z.zhang@intel.com
State Accepted, archived
Headers show
Series
  • ice base code update
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Zhang, Qi Z Sept. 11, 2020, 1:19 p.m. UTC
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 <anthony.l.nguyen@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/base/ice_acl.h      |  1 -
 drivers/net/ice/base/ice_acl_ctrl.c | 93 ++++++++++++++++++-------------------
 2 files changed, 45 insertions(+), 49 deletions(-)

Patch
diff mbox series

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;
-}