Skip to content

Commit b093534

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Simplify bnxt_rfs_capable()
bnxt_rfs_capable() determines the number of VNICs and RSS_CTXs required to support aRFS and then reserves the resources. We already have functions bnxt_get_total_vnics() and bnxt_get_total_rss_ctxs() to do that. Simplify the code by calling these functions. It is also more correct to do the resource reservation after bnxt_can_reserve_rings() returns true. Signed-off-by: Michael Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ecb342b commit b093534

File tree

1 file changed

+6
-15
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+6
-15
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12479,28 +12479,19 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
1247912479
struct bnxt_hw_rings hwr = {0};
1248012480
int max_vnics, max_rss_ctxs;
1248112481

12482-
hwr.rss_ctx = 1;
12483-
if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) {
12484-
/* 2 VNICS: default + Ntuple */
12485-
hwr.vnic = 2;
12486-
hwr.rss_ctx = bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) *
12487-
hwr.vnic;
12488-
goto check_reserve_vnic;
12489-
}
12490-
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
12482+
if ((bp->flags & BNXT_FLAG_CHIP_P5_PLUS) &&
12483+
!BNXT_SUPPORTS_NTUPLE_VNIC(bp))
1249112484
return bnxt_rfs_supported(bp);
12485+
1249212486
if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp) || !bp->rx_nr_rings)
1249312487
return false;
1249412488

12495-
hwr.vnic = 1 + bp->rx_nr_rings;
12496-
check_reserve_vnic:
12489+
hwr.grp = bp->rx_nr_rings;
12490+
hwr.vnic = bnxt_get_total_vnics(bp, bp->rx_nr_rings);
12491+
hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr);
1249712492
max_vnics = bnxt_get_max_func_vnics(bp);
1249812493
max_rss_ctxs = bnxt_get_max_func_rss_ctxs(bp);
1249912494

12500-
if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS) &&
12501-
!(bp->rss_cap & BNXT_RSS_CAP_NEW_RSS_CAP))
12502-
hwr.rss_ctx = hwr.vnic;
12503-
1250412495
if (hwr.vnic > max_vnics || hwr.rss_ctx > max_rss_ctxs) {
1250512496
if (bp->rx_nr_rings > 1)
1250612497
netdev_warn(bp->dev,

0 commit comments

Comments
 (0)