net/bnxt: fix VNIC RSS configure function
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Wed, 7 Oct 2020 03:41:50 +0000 (09:11 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:05 +0000 (16:03 +0100)
1. Moved invalid VNIC id check to the beginning of the function.
2. Removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709b257f ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c

index 6f54020..cee2656 100644 (file)
@@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
        unsigned int rss_idx, fw_idx, i;
 
+       if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+               return 0;
+
        if (!(vnic->rss_table && vnic->hash_type))
                return 0;
 
        if (BNXT_CHIP_P5(bp))
                return bnxt_vnic_rss_configure_p5(bp, vnic);
 
-       if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
-               return 0;
-
-       if (vnic->rss_table && vnic->hash_type) {
-               /*
-                * Fill the RSS hash & redirection table with
-                * ring group ids for all VNICs
-                */
-               for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
-                       rss_idx++, fw_idx++) {
-                       for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-                               fw_idx %= bp->rx_cp_nr_rings;
-                               if (vnic->fw_grp_ids[fw_idx] !=
-                                   INVALID_HW_RING_ID)
-                                       break;
-                               fw_idx++;
-                       }
-                       if (i == bp->rx_cp_nr_rings)
-                               return 0;
-                       vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
+       /*
+        * Fill the RSS hash & redirection table with
+        * ring group ids for all VNICs
+        */
+       for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+            rss_idx++, fw_idx++) {
+               for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+                       fw_idx %= bp->rx_cp_nr_rings;
+                       if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID)
+                               break;
+                       fw_idx++;
                }
-               return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+               if (i == bp->rx_cp_nr_rings)
+                       return 0;
+
+               vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
        }
 
-       return 0;
+       return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 }
 
 static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,