Skip to content

Commit 5de1fce

Browse files
Pavan Chebbikuba-moo
authored andcommitted
bnxt_en: Add support for user configured RSS key
Store the user configured or generated Toeplitz key in bp->rss_hash_key. The key stays constant across ifdown/ifup unless updated by the user. 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 44af4b6 commit 5de1fce

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,9 +4246,23 @@ static void bnxt_init_vnics(struct bnxt *bp)
42464246
u8 *key = (void *)vnic->rss_hash_key;
42474247
int k;
42484248

4249+
if (!bp->rss_hash_key_valid &&
4250+
!bp->rss_hash_key_updated) {
4251+
get_random_bytes(bp->rss_hash_key,
4252+
HW_HASH_KEY_SIZE);
4253+
bp->rss_hash_key_updated = true;
4254+
}
4255+
4256+
memcpy(vnic->rss_hash_key, bp->rss_hash_key,
4257+
HW_HASH_KEY_SIZE);
4258+
4259+
if (!bp->rss_hash_key_updated)
4260+
continue;
4261+
4262+
bp->rss_hash_key_updated = false;
4263+
bp->rss_hash_key_valid = true;
4264+
42494265
bp->toeplitz_prefix = 0;
4250-
get_random_bytes(vnic->rss_hash_key,
4251-
HW_HASH_KEY_SIZE);
42524266
for (k = 0; k < 8; k++) {
42534267
bp->toeplitz_prefix <<= 8;
42544268
bp->toeplitz_prefix |= key[k];

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,10 @@ struct bnxt {
22222222
#define BNXT_RSS_CAP_NEW_RSS_CAP BIT(2)
22232223
#define BNXT_RSS_CAP_RSS_TCAM BIT(3)
22242224

2225+
u8 rss_hash_key[HW_HASH_KEY_SIZE];
2226+
u8 rss_hash_key_valid:1;
2227+
u8 rss_hash_key_updated:1;
2228+
22252229
u16 max_mtu;
22262230
u8 max_tc;
22272231
u8 max_lltc; /* lossless TCs */

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,8 +1755,10 @@ static int bnxt_set_rxfh(struct net_device *dev,
17551755
if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP)
17561756
return -EOPNOTSUPP;
17571757

1758-
if (rxfh->key)
1759-
return -EOPNOTSUPP;
1758+
if (rxfh->key) {
1759+
memcpy(bp->rss_hash_key, rxfh->key, HW_HASH_KEY_SIZE);
1760+
bp->rss_hash_key_updated = true;
1761+
}
17601762

17611763
if (rxfh->indir) {
17621764
u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(dev);

0 commit comments

Comments
 (0)