Commit 0895926f authored by Pavan Chebbi's avatar Pavan Chebbi Committed by Jakub Kicinski
Browse files

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: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240325222902.220712-9-michael.chan@broadcom.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b0935343
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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;
		}
+1 −0
Original line number Diff line number Diff line
@@ -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);