[v2,33/36] net/ice/base: misc cleanups for Flow Director

Message ID 20200323071759.13075-34-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series update ice base code |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang March 23, 2020, 7:17 a.m. UTC
  Cleanup some things found while doing code review:

- Remove unnececcary 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>
---
 drivers/net/ice/base/ice_fdir.c      | 42 ++++++++++++++++++------------------
 drivers/net/ice/base/ice_flex_pipe.c |  2 +-
 drivers/net/ice/base/ice_flow.c      |  2 +-
 3 files changed, 23 insertions(+), 23 deletions(-)
  

Patch

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index ae82c4d99..6dc8d54da 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -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;
 		}
 	}
 
diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 851f0273b..213aceef5 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -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
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index cdb4b004f..e523b8f45 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -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 */