Commit 5de1fce3 authored by Pavan Chebbi's avatar Pavan Chebbi Committed by Jakub Kicinski

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: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240205223202.25341-12-michael.chan@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 44af4b62
......@@ -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);
......
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