bnxt_en: Add a new_rss_ctx parameter to bnxt_rfs_capable()
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Mon, 25 Mar 2024 22:28:58 +0000 (15:28 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Mar 2024 05:34:40 +0000 (22:34 -0700)
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 <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240325222902.220712-9-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index e968684ccb1d6bcf71f1f039625d6c5c3658e525..c5f3b97d258d8744af4ba05a56e0b75600603516 100644 (file)
@@ -7360,7 +7360,7 @@ static int bnxt_get_total_vnics(struct bnxt *bp, int rx_rings)
 {
        if (bp->flags & BNXT_FLAG_RFS) {
                if (BNXT_SUPPORTS_NTUPLE_VNIC(bp))
-                       return 2;
+                       return 2 + bp->num_rss_ctx;
                if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS))
                        return rx_rings + 1;
        }
@@ -12474,7 +12474,7 @@ static bool bnxt_rfs_supported(struct bnxt *bp)
 }
 
 /* If runtime conditions support RFS */
-static bool bnxt_rfs_capable(struct bnxt *bp)
+bool bnxt_rfs_capable(struct bnxt *bp, bool new_rss_ctx)
 {
        struct bnxt_hw_rings hwr = {0};
        int max_vnics, max_rss_ctxs;
@@ -12488,6 +12488,8 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
 
        hwr.grp = bp->rx_nr_rings;
        hwr.vnic = bnxt_get_total_vnics(bp, bp->rx_nr_rings);
+       if (new_rss_ctx)
+               hwr.vnic++;
        hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr);
        max_vnics = bnxt_get_max_func_vnics(bp);
        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,
        struct bnxt *bp = netdev_priv(dev);
        netdev_features_t vlan_features;
 
-       if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
+       if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp, false))
                features &= ~NETIF_F_NTUPLE;
 
        if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
@@ -13661,7 +13663,7 @@ static void bnxt_set_dflt_rfs(struct bnxt *bp)
        bp->flags &= ~BNXT_FLAG_RFS;
        if (bnxt_rfs_supported(bp)) {
                dev->hw_features |= NETIF_F_NTUPLE;
-               if (bnxt_rfs_capable(bp)) {
+               if (bnxt_rfs_capable(bp, false)) {
                        bp->flags |= BNXT_FLAG_RFS;
                        dev->features |= NETIF_F_NTUPLE;
                }
index 181758f6892aeb4af5dbfa988f75f6befb35bae2..d5fbb63a0e0ce390c916b8cbfba45d250e689acc 100644 (file)
@@ -2756,6 +2756,7 @@ void bnxt_reenable_sriov(struct bnxt *bp);
 void bnxt_close_nic(struct bnxt *, bool, bool);
 void bnxt_get_ring_err_stats(struct bnxt *bp,
                             struct bnxt_total_ring_err_stats *stats);
+bool bnxt_rfs_capable(struct bnxt *bp, bool new_rss_ctx);
 int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words,
                         u32 *reg_buf);
 void bnxt_fw_exception(struct bnxt *bp);