Skip to content

Commit 0895926

Browse files
Pavan Chebbikuba-moo
authored andcommitted
bnxt_en: Add a new_rss_ctx parameter to bnxt_rfs_capable()
Modify bnxt_rfs_capable() to check that there are enough resources to support aRFS/ntuple filters for a new RSS context requested by the user. Existing use cases in the driver will always set the new parameter to false. Reviewed-by: Kalesh AP <[email protected]> Signed-off-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b093534 commit 0895926

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7360,7 +7360,7 @@ static int bnxt_get_total_vnics(struct bnxt *bp, int rx_rings)
73607360
{
73617361
if (bp->flags & BNXT_FLAG_RFS) {
73627362
if (BNXT_SUPPORTS_NTUPLE_VNIC(bp))
7363-
return 2;
7363+
return 2 + bp->num_rss_ctx;
73647364
if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS))
73657365
return rx_rings + 1;
73667366
}
@@ -12474,7 +12474,7 @@ static bool bnxt_rfs_supported(struct bnxt *bp)
1247412474
}
1247512475

1247612476
/* If runtime conditions support RFS */
12477-
static bool bnxt_rfs_capable(struct bnxt *bp)
12477+
bool bnxt_rfs_capable(struct bnxt *bp, bool new_rss_ctx)
1247812478
{
1247912479
struct bnxt_hw_rings hwr = {0};
1248012480
int max_vnics, max_rss_ctxs;
@@ -12488,6 +12488,8 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
1248812488

1248912489
hwr.grp = bp->rx_nr_rings;
1249012490
hwr.vnic = bnxt_get_total_vnics(bp, bp->rx_nr_rings);
12491+
if (new_rss_ctx)
12492+
hwr.vnic++;
1249112493
hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr);
1249212494
max_vnics = bnxt_get_max_func_vnics(bp);
1249312495
max_rss_ctxs = bnxt_get_max_func_rss_ctxs(bp);
@@ -12525,7 +12527,7 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
1252512527
struct bnxt *bp = netdev_priv(dev);
1252612528
netdev_features_t vlan_features;
1252712529

12528-
if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
12530+
if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp, false))
1252912531
features &= ~NETIF_F_NTUPLE;
1253012532

1253112533
if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
@@ -13661,7 +13663,7 @@ static void bnxt_set_dflt_rfs(struct bnxt *bp)
1366113663
bp->flags &= ~BNXT_FLAG_RFS;
1366213664
if (bnxt_rfs_supported(bp)) {
1366313665
dev->hw_features |= NETIF_F_NTUPLE;
13664-
if (bnxt_rfs_capable(bp)) {
13666+
if (bnxt_rfs_capable(bp, false)) {
1366513667
bp->flags |= BNXT_FLAG_RFS;
1366613668
dev->features |= NETIF_F_NTUPLE;
1366713669
}

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2756,6 +2756,7 @@ void bnxt_reenable_sriov(struct bnxt *bp);
27562756
void bnxt_close_nic(struct bnxt *, bool, bool);
27572757
void bnxt_get_ring_err_stats(struct bnxt *bp,
27582758
struct bnxt_total_ring_err_stats *stats);
2759+
bool bnxt_rfs_capable(struct bnxt *bp, bool new_rss_ctx);
27592760
int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words,
27602761
u32 *reg_buf);
27612762
void bnxt_fw_exception(struct bnxt *bp);

0 commit comments

Comments
 (0)