Commit 73afb518 authored by Jakub Kicinski's avatar Jakub Kicinski

eth: bnxt: bump the entry size in indir tables to u32

Ethtool core stores indirection table with u32 entries, "just to be safe".
Switch the type in the driver, so that it's easier to swap local tables
for the core ones. Memory allocations already use sizeof(*entry), switch
the memset()s as well.
Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20240711220713.283778-11-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9c34c6c2
...@@ -6225,7 +6225,7 @@ static u16 bnxt_cp_ring_for_tx(struct bnxt *bp, struct bnxt_tx_ring_info *txr) ...@@ -6225,7 +6225,7 @@ static u16 bnxt_cp_ring_for_tx(struct bnxt *bp, struct bnxt_tx_ring_info *txr)
int bnxt_alloc_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx) int bnxt_alloc_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx)
{ {
int entries; int entries;
u16 *tbl; u32 *tbl;
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
entries = BNXT_MAX_RSS_TABLE_ENTRIES_P5; entries = BNXT_MAX_RSS_TABLE_ENTRIES_P5;
...@@ -6248,7 +6248,7 @@ int bnxt_alloc_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx) ...@@ -6248,7 +6248,7 @@ int bnxt_alloc_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx)
void bnxt_set_dflt_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx) void bnxt_set_dflt_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx)
{ {
u16 max_rings, max_entries, pad, i; u16 max_rings, max_entries, pad, i;
u16 *rss_indir_tbl; u32 *rss_indir_tbl;
if (!bp->rx_nr_rings) if (!bp->rx_nr_rings)
return; return;
...@@ -6269,12 +6269,12 @@ void bnxt_set_dflt_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx) ...@@ -6269,12 +6269,12 @@ void bnxt_set_dflt_rss_indir_tbl(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx)
pad = bp->rss_indir_tbl_entries - max_entries; pad = bp->rss_indir_tbl_entries - max_entries;
if (pad) if (pad)
memset(&rss_indir_tbl[i], 0, pad * sizeof(u16)); memset(&rss_indir_tbl[i], 0, pad * sizeof(*rss_indir_tbl));
} }
static u16 bnxt_get_max_rss_ring(struct bnxt *bp) static u16 bnxt_get_max_rss_ring(struct bnxt *bp)
{ {
u16 i, tbl_size, max_ring = 0; u32 i, tbl_size, max_ring = 0;
if (!bp->rss_indir_tbl) if (!bp->rss_indir_tbl)
return 0; return 0;
......
...@@ -1292,7 +1292,7 @@ struct bnxt_vnic_info { ...@@ -1292,7 +1292,7 @@ struct bnxt_vnic_info {
struct bnxt_rss_ctx { struct bnxt_rss_ctx {
struct bnxt_vnic_info vnic; struct bnxt_vnic_info vnic;
u16 *rss_indir_tbl; u32 *rss_indir_tbl;
u8 index; u8 index;
}; };
...@@ -2331,7 +2331,7 @@ struct bnxt { ...@@ -2331,7 +2331,7 @@ struct bnxt {
struct bnxt_vnic_info *vnic_info; struct bnxt_vnic_info *vnic_info;
u32 num_rss_ctx; u32 num_rss_ctx;
int nr_vnics; int nr_vnics;
u16 *rss_indir_tbl; u32 *rss_indir_tbl;
u16 rss_indir_tbl_entries; u16 rss_indir_tbl_entries;
u32 rss_hash_cfg; u32 rss_hash_cfg;
u32 rss_hash_delta; u32 rss_hash_delta;
......
...@@ -1804,7 +1804,7 @@ static int bnxt_get_rxfh(struct net_device *dev, ...@@ -1804,7 +1804,7 @@ static int bnxt_get_rxfh(struct net_device *dev,
u32 rss_context = rxfh->rss_context; u32 rss_context = rxfh->rss_context;
struct bnxt_rss_ctx *rss_ctx = NULL; struct bnxt_rss_ctx *rss_ctx = NULL;
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
u16 *indir_tbl = bp->rss_indir_tbl; u32 *indir_tbl = bp->rss_indir_tbl;
struct bnxt_vnic_info *vnic; struct bnxt_vnic_info *vnic;
u32 i, tbl_size; u32 i, tbl_size;
...@@ -1848,7 +1848,7 @@ static void bnxt_modify_rss(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, ...@@ -1848,7 +1848,7 @@ static void bnxt_modify_rss(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx,
} }
if (rxfh->indir) { if (rxfh->indir) {
u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(bp->dev); u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(bp->dev);
u16 *indir_tbl = bp->rss_indir_tbl; u32 *indir_tbl = bp->rss_indir_tbl;
if (rss_ctx) if (rss_ctx)
indir_tbl = rss_ctx->rss_indir_tbl; indir_tbl = rss_ctx->rss_indir_tbl;
...@@ -1856,7 +1856,7 @@ static void bnxt_modify_rss(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, ...@@ -1856,7 +1856,7 @@ static void bnxt_modify_rss(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx,
indir_tbl[i] = rxfh->indir[i]; indir_tbl[i] = rxfh->indir[i];
pad = bp->rss_indir_tbl_entries - tbl_size; pad = bp->rss_indir_tbl_entries - tbl_size;
if (pad) if (pad)
memset(&indir_tbl[i], 0, pad * sizeof(u16)); memset(&indir_tbl[i], 0, pad * sizeof(*indir_tbl));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment