Skip to content

Commit

Permalink
net/bnxt: fix Rx rings in RSS redirection table
Browse files Browse the repository at this point in the history
[ upstream commit d424af4 ]

This commit introduces a limit on the number of RX rings included in
the RSS redirection table to a value no larger than the size supported
by Thor as defined by BNXT_RSS_TBL_SIZE_THOR.

Fixes: d819382 ("net/bnxt: add RSS redirection table operations")

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
  • Loading branch information
sg-sray authored and bluca committed Feb 2, 2021
1 parent 87c6bb6 commit 906f23c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ struct bnxt_coal {
#define DBR_TYPE_NQ (0xaULL << 60)
#define DBR_TYPE_NQ_ARM (0xbULL << 60)

#define BNXT_RSS_TBL_SIZE_THOR 512
#define BNXT_RSS_TBL_SIZE_THOR 512U
#define BNXT_RSS_ENTRIES_PER_CTX_THOR 64
#define BNXT_MAX_RSS_CTXTS_THOR \
(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
Expand Down
15 changes: 13 additions & 2 deletions drivers/net/bnxt/bnxt_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,15 @@ int is_bnxt_in_error(struct bnxt *bp)

static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
{
unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
BNXT_RSS_TBL_SIZE_THOR);

if (!BNXT_CHIP_THOR(bp))
return 1;

return RTE_ALIGN_MUL_CEIL(bp->rx_nr_rings,
return RTE_ALIGN_MUL_CEIL(num_rss_rings,
BNXT_RSS_ENTRIES_PER_CTX_THOR) /
BNXT_RSS_ENTRIES_PER_CTX_THOR;
BNXT_RSS_ENTRIES_PER_CTX_THOR;
}

uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
Expand Down Expand Up @@ -424,6 +427,14 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
int j, nr_ctxs = bnxt_rss_ctxts(bp);

if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
PMD_DRV_LOG(ERR,
"Only queues 0-%d will be in RSS table\n",
BNXT_RSS_TBL_SIZE_THOR - 1);
}

rc = 0;
for (j = 0; j < nr_ctxs; j++) {
rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, j);
Expand Down

0 comments on commit 906f23c

Please sign in to comment.