Skip to content

Commit

Permalink
net/bnxt: fix VNIC RSS configure function
Browse files Browse the repository at this point in the history
[ upstream commit 5f0f9a4 ]

1. Moved invalid VNIC id check to the beginning of the function.
2. Removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709 ("net/bnxt: delete and flush L2 filters cleanly")

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>
  • Loading branch information
Kalesh AP authored and cpaelzer committed Feb 2, 2021
1 parent 69eb5f9 commit 5e20d2d
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions drivers/net/bnxt/bnxt_hwrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4464,37 +4464,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_THOR(bp))
return bnxt_vnic_rss_configure_thor(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,
Expand Down

0 comments on commit 5e20d2d

Please sign in to comment.