Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: expand NETDEV_RSS_KEY_LEN to 256 bytes

NETDEV_RSS_KEY_LEN has been set to 52 bytes in 2014, until now.

Jakub suggested we bump the size to 128 bytes or more.

Some drivers (like idpf) were already working around the core limit.

Since this change might cause some issues in admin scripts,
bump it directly to 256 in one go.

tjbp26:~# cat /proc/sys/net/core/netdev_rss_key | wc -c
768

tjbp26:~# ethtool -x eth1
RX flow hash indirection table for eth1 with 32 RX ring(s):
...
RSS hash key:
fe:16:5b:2f:93:85:c2:c9:c1:ef:bd:60:c6:e0:2b:99:4d:bf:b7:14:c8:1e:8d:cb:31:17:51:da:55:eb:91:d9:9e:f9:89:9b:44:a1:dc:08:72:3a:b3:d6:31:86:9a:fe:02:3a:0d:eb:a1:7c:f5:a3:51:3b:08:56:c9:3f:71:69:01:ba:70:38
RSS hash function:
toeplitz: on
xor: off
crc32: off

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/netdev/20260122075206.504ec591@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260122190349.2771064-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
37b0ea8f a113a8ac

+16 -10
+7 -6
Documentation/admin-guide/sysctl/net.rst
··· 314 314 netdev_rss_key 315 315 -------------- 316 316 317 - RSS (Receive Side Scaling) enabled drivers use a 40 bytes host key that is 318 - randomly generated. 317 + RSS (Receive Side Scaling) enabled drivers use a host key that 318 + is randomly generated. 319 319 Some user space might need to gather its content even if drivers do not 320 320 provide ethtool -x support yet. 321 321 322 322 :: 323 323 324 324 myhost:~# cat /proc/sys/net/core/netdev_rss_key 325 - 84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8: ... (52 bytes total) 325 + 84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8: ... (256 bytes total) 326 326 327 - File contains nul bytes if no driver ever called netdev_rss_key_fill() function. 327 + File contains all nul bytes if no driver ever called netdev_rss_key_fill() 328 + function. 328 329 329 330 Note: 330 - /proc/sys/net/core/netdev_rss_key contains 52 bytes of key, 331 - but most drivers only use 40 bytes of it. 331 + /proc/sys/net/core/netdev_rss_key contains 256 bytes of key, 332 + but many drivers only use 40 or 52 bytes of it. 332 333 333 334 :: 334 335
+1 -2
include/linux/netdevice.h
··· 5166 5166 void netdev_lower_state_changed(struct net_device *lower_dev, 5167 5167 void *lower_state_info); 5168 5168 5169 - /* RSS keys are 40 or 52 bytes long */ 5170 - #define NETDEV_RSS_KEY_LEN 52 5169 + #define NETDEV_RSS_KEY_LEN 256 5171 5170 extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly; 5172 5171 void netdev_rss_key_fill(void *buffer, size_t len); 5173 5172
+8 -2
net/core/sysctl_net_core.c
··· 325 325 static int proc_do_rss_key(const struct ctl_table *table, int write, 326 326 void *buffer, size_t *lenp, loff_t *ppos) 327 327 { 328 - struct ctl_table fake_table; 329 328 char buf[NETDEV_RSS_KEY_LEN * 3]; 329 + struct ctl_table fake_table; 330 + char *pos = buf; 330 331 331 - snprintf(buf, sizeof(buf), "%*phC", NETDEV_RSS_KEY_LEN, netdev_rss_key); 332 + for (int i = 0; i < NETDEV_RSS_KEY_LEN; i++) { 333 + pos = hex_byte_pack(pos, netdev_rss_key[i]); 334 + *pos++ = ':'; 335 + } 336 + *(--pos) = 0; 337 + 332 338 fake_table.data = buf; 333 339 fake_table.maxlen = sizeof(buf); 334 340 return proc_dostring(&fake_table, write, buffer, lenp, ppos);