iavf: enhance the duplicated FDIR list scan handling
authorHaiyue Wang <haiyue.wang@intel.com>
Wed, 31 Mar 2021 02:08:36 +0000 (10:08 +0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 23 Apr 2021 16:03:56 +0000 (09:03 -0700)
When the FDIR entry is found, just return the result directly to break
the loop.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/iavf/iavf_fdir.c

index 3e68718..af872ea 100644 (file)
@@ -713,7 +713,6 @@ void iavf_print_fdir_fltr(struct iavf_adapter *adapter, struct iavf_fdir_fltr *f
 bool iavf_fdir_is_dup_fltr(struct iavf_adapter *adapter, struct iavf_fdir_fltr *fltr)
 {
        struct iavf_fdir_fltr *tmp;
-       bool ret = false;
 
        list_for_each_entry(tmp, &adapter->fdir_list_head, list) {
                if (tmp->flow_type != fltr->flow_type)
@@ -724,13 +723,11 @@ bool iavf_fdir_is_dup_fltr(struct iavf_adapter *adapter, struct iavf_fdir_fltr *
                    !memcmp(&tmp->ip_data, &fltr->ip_data,
                            sizeof(fltr->ip_data)) &&
                    !memcmp(&tmp->ext_data, &fltr->ext_data,
-                           sizeof(fltr->ext_data))) {
-                       ret = true;
-                       break;
-               }
+                           sizeof(fltr->ext_data)))
+                       return true;
        }
 
-       return ret;
+       return false;
 }
 
 /**