net/ice/base: cleanup flow director functions
authorQi Zhang <qi.z.zhang@intel.com>
Mon, 23 Mar 2020 07:17:56 +0000 (15:17 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:05 +0000 (13:57 +0200)
Cleanup some things found while doing code review:

- Remove unnecessary initializations, parenthesis, and braces
- Fix a couple of function headers

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@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_fdir.c
drivers/net/ice/base/ice_flex_pipe.c
drivers/net/ice/base/ice_flow.c

index ae82c4d..6dc8d54 100644 (file)
@@ -916,7 +916,7 @@ bool ice_fdir_has_frag(enum ice_fltr_ptype flow)
 struct ice_fdir_fltr *
 ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx)
 {
-       struct ice_fdir_fltr *rule = NULL;
+       struct ice_fdir_fltr *rule;
 
        LIST_FOR_EACH_ENTRY(rule, &hw->fdir_list_head, ice_fdir_fltr,
                            fltr_node) {
@@ -965,7 +965,7 @@ ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow,
 {
        int incr;
 
-       incr = (add) ? 1 : -1;
+       incr = add ? 1 : -1;
        hw->fdir_active_fltr += incr;
        if (flow == ICE_FLTR_PTYPE_NONF_NONE || flow >= ICE_FLTR_PTYPE_MAX) {
                ice_debug(hw, ICE_DBG_SW, "Unknown filter type %d\n", flow);
@@ -990,7 +990,7 @@ static int ice_cmp_ipv6_addr(__be32 *a, __be32 *b)
 }
 
 /**
- * ice_fdir_comp_ipv6_rules - compare 2 filters
+ * ice_fdir_comp_rules - compare 2 filters
  * @a: a Flow Director filter data structure
  * @b: a Flow Director filter data structure
  * @v6: bool true if v6 filter
@@ -1053,30 +1053,30 @@ ice_fdir_comp_rules(struct ice_fdir_fltr *a,  struct ice_fdir_fltr *b, bool v6)
  */
 bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input)
 {
-       enum ice_fltr_ptype flow_type;
        struct ice_fdir_fltr *rule;
        bool ret = false;
 
-       rule = NULL;
-
        LIST_FOR_EACH_ENTRY(rule, &hw->fdir_list_head, ice_fdir_fltr,
                            fltr_node) {
-               if (rule->flow_type == input->flow_type) {
-                       flow_type = input->flow_type;
-                       if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP ||
-                           flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP ||
-                           flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP ||
-                           flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER)
-                               ret = ice_fdir_comp_rules(rule, input, false);
+               enum ice_fltr_ptype flow_type;
+
+               if (rule->flow_type != input->flow_type)
+                       continue;
+
+               flow_type = input->flow_type;
+               if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP ||
+                   flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP ||
+                   flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP ||
+                   flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER)
+                       ret = ice_fdir_comp_rules(rule, input, false);
+               else
+                       ret = ice_fdir_comp_rules(rule, input, true);
+               if (ret) {
+                       if (rule->fltr_id == input->fltr_id &&
+                           rule->q_index != input->q_index)
+                               ret = false;
                        else
-                               ret = ice_fdir_comp_rules(rule, input, true);
-                       if (ret) {
-                               if (rule->fltr_id == input->fltr_id &&
-                                   rule->q_index != input->q_index)
-                                       ret = false;
-                               else
-                                       break;
-                       }
+                               break;
                }
        }
 
index 851f027..213acee 100644 (file)
@@ -1953,7 +1953,7 @@ ice_find_free_tunnel_entry(struct ice_hw *hw, enum ice_tunnel_type type,
 }
 
 /**
- * ice_get_tunnel_port - retrieve an open tunnel port
+ * ice_get_open_tunnel_port - retrieve an open tunnel port
  * @hw: pointer to the HW structure
  * @type: tunnel type (TNL_ALL will return any open port)
  * @port: returns open port
index cdb4b00..e523b8f 100644 (file)
@@ -2656,8 +2656,8 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
                   void *data, struct ice_flow_action *acts, u8 acts_cnt,
                   u64 *entry_h)
 {
-       struct ice_flow_prof *prof = NULL;
        struct ice_flow_entry *e = NULL;
+       struct ice_flow_prof *prof;
        enum ice_status status = ICE_SUCCESS;
 
        /* ACL entries must indicate an action */