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 <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240205223202.25341-12-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Pavan Chebbi
2024-02-05 14:32:00 -08:00
committed by Jakub Kicinski
parent 44af4b622a
commit 5de1fce336
3 changed files with 24 additions and 4 deletions
+16 -2
View File
@@ -4246,9 +4246,23 @@ static void bnxt_init_vnics(struct bnxt *bp)
u8 *key = (void *)vnic->rss_hash_key;
int k;
if (!bp->rss_hash_key_valid &&
!bp->rss_hash_key_updated) {
get_random_bytes(bp->rss_hash_key,
HW_HASH_KEY_SIZE);
bp->rss_hash_key_updated = true;
}
memcpy(vnic->rss_hash_key, bp->rss_hash_key,
HW_HASH_KEY_SIZE);
if (!bp->rss_hash_key_updated)
continue;
bp->rss_hash_key_updated = false;
bp->rss_hash_key_valid = true;
bp->toeplitz_prefix = 0;
get_random_bytes(vnic->rss_hash_key,
HW_HASH_KEY_SIZE);
for (k = 0; k < 8; k++) {
bp->toeplitz_prefix <<= 8;
bp->toeplitz_prefix |= key[k];
@@ -2222,6 +2222,10 @@ struct bnxt {
#define BNXT_RSS_CAP_NEW_RSS_CAP BIT(2)
#define BNXT_RSS_CAP_RSS_TCAM BIT(3)
u8 rss_hash_key[HW_HASH_KEY_SIZE];
u8 rss_hash_key_valid:1;
u8 rss_hash_key_updated:1;
u16 max_mtu;
u8 max_tc;
u8 max_lltc; /* lossless TCs */
@@ -1755,8 +1755,10 @@ static int bnxt_set_rxfh(struct net_device *dev,
if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
if (rxfh->key)
return -EOPNOTSUPP;
if (rxfh->key) {
memcpy(bp->rss_hash_key, rxfh->key, HW_HASH_KEY_SIZE);
bp->rss_hash_key_updated = true;
}
if (rxfh->indir) {
u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(dev);