net/ice/base: move a function
authorQi Zhang <qi.z.zhang@intel.com>
Wed, 26 Aug 2020 12:24:29 +0000 (20:24 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:09 +0000 (18:55 +0200)
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
drivers/net/ice/base/ice_acl_ctrl.c

index 500db0c..cd75e1c 100644 (file)
@@ -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);
index 0ecf384..02a1dd3 100644 (file)
@@ -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;
-}