summaryrefslogtreecommitdiffstats
path: root/src/plugins/avf/device.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-09-09 16:27:37 +0200
committerDamjan Marion <dmarion@me.com>2021-09-16 14:23:53 +0000
commit895def45c82ea5d901987bc3049c8d1cc1c1da66 (patch)
tree33a2d494b84e33b85807c879666a88ff4e49652c /src/plugins/avf/device.c
parent1a9e2f96d48e346311bbc584510a14e3f721b41c (diff)
avf: fix RSS hash key
Toeplitz hash key must respect certain properties, it cannot be purely random. Use the default one from i40e. Type: fix Change-Id: Ic8e67a0426de8adfecc1fcdaa99879e13ae38cc9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/avf/device.c')
-rw-r--r--src/plugins/avf/device.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index dbaf4a4a7f2..cc2415a9293 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -610,18 +610,25 @@ avf_op_config_rss_lut (vlib_main_t * vm, avf_device_t * ad)
clib_error_t *
avf_op_config_rss_key (vlib_main_t * vm, avf_device_t * ad)
{
+ /* from DPDK i40e... */
+ static uint32_t rss_key_default[] = { 0x6b793944, 0x23504cb5, 0x5bea75b6,
+ 0x309f4f12, 0x3dc0a2b8, 0x024ddcdf,
+ 0x339b8ca0, 0x4c4af64a, 0x34fac605,
+ 0x55d85839, 0x3a58997d, 0x2ec938e1,
+ 0x66031581 };
int msg_len = sizeof (virtchnl_rss_key_t) + ad->rss_key_size - 1;
- int i;
u8 msg[msg_len];
virtchnl_rss_key_t *rk;
+ if (sizeof (rss_key_default) != ad->rss_key_size)
+ return clib_error_create ("unsupported RSS key size (expected %d, got %d)",
+ sizeof (rss_key_default), ad->rss_key_size);
+
clib_memset (msg, 0, msg_len);
rk = (virtchnl_rss_key_t *) msg;
rk->vsi_id = ad->vsi_id;
rk->key_len = ad->rss_key_size;
- u32 seed = random_default_seed ();
- for (i = 0; i < ad->rss_key_size; i++)
- rk->key[i] = (u8) random_u32 (&seed);
+ memcpy_s (rk->key, rk->key_len, rss_key_default, sizeof (rss_key_default));
avf_log_debug (ad, "config_rss_key: vsi_id %u rss_key_size %u key 0x%U",
rk->vsi_id, rk->key_len, format_hex_bytes_no_wrap, rk->key,