Skip to content

Commit c1b27f0

Browse files
committed
netlink: specs: define input-xfrm enum in the spec
Help YNL decode the values for input-xfrm by defining the possible values in the spec. Don't define "no change" as it's an IOCTL artifact with no use in Netlink. With this change on mlx5 input-xfrm gets decoded: # ynl --family ethtool --dump rss-get [{'header': {'dev-index': 2, 'dev-name': 'eth0'}, 'hfunc': 1, 'hkey': b'V\xa8\xf9\x9 ...', 'indir': [0, 1, ... ], 'input-xfrm': {'sym-or-xor'}, <<< 'flow-hash': {'ah4': {'ip-dst', 'ip-src'}, 'ah6': {'ip-dst', 'ip-src'}, 'esp4': {'ip-dst', 'ip-src'}, 'esp6': {'ip-dst', 'ip-src'}, 'ip4': {'ip-dst', 'ip-src'}, 'ip6': {'ip-dst', 'ip-src'}, 'tcp4': {'l4-b-0-1', 'ip-dst', 'l4-b-2-3', 'ip-src'}, 'tcp6': {'l4-b-0-1', 'ip-dst', 'l4-b-2-3', 'ip-src'}, 'udp4': {'l4-b-0-1', 'ip-dst', 'l4-b-2-3', 'ip-src'}, 'udp6': {'l4-b-0-1', 'ip-dst', 'l4-b-2-3', 'ip-src'}} }] Reviewed-by: Gal Pressman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 169b262 commit c1b27f0

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

Documentation/netlink/specs/ethtool.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ definitions:
158158
-
159159
name: pse-event-sw-pw-control-error
160160
doc: PSE faced an error managing the power control from software
161+
-
162+
name: input-xfrm
163+
doc: RSS hash function transformations.
164+
type: flags
165+
enum-name:
166+
name-prefix: rxh-xfrm-
167+
header: linux/ethtool.h
168+
entries:
169+
-
170+
name: sym-xor
171+
doc: >-
172+
XOR the corresponding source and destination fields of each specified
173+
protocol. Both copies of the XOR'ed fields are fed into the RSS and
174+
RXHASH calculation. Note that this XORing reduces the input set
175+
entropy and could be exploited to reduce the RSS queue spread.
176+
-
177+
name: sym-or-xor
178+
doc: >-
179+
Similar to SYM_XOR, except that one copy of the XOR'ed fields is
180+
replaced by an OR of the same fields.
161181
-
162182
name: rxfh-fields
163183
name-prefix: rxh-
@@ -1621,6 +1641,7 @@ attribute-sets:
16211641
-
16221642
name: input-xfrm
16231643
type: u32
1644+
enum: input-xfrm
16241645
-
16251646
name: start-context
16261647
type: u32

tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def test_rss_input_xfrm(cfg, ipver):
3737
if not hasattr(socket, "SO_INCOMING_CPU"):
3838
raise KsftSkipEx("socket.SO_INCOMING_CPU was added in Python 3.11")
3939

40-
input_xfrm = cfg.ethnl.rss_get(
41-
{'header': {'dev-name': cfg.ifname}}).get('input-xfrm')
40+
rss = cfg.ethnl.rss_get({'header': {'dev-name': cfg.ifname}})
41+
input_xfrm = set(filter(lambda x: 'sym' in x, rss.get('input-xfrm', {})))
4242

4343
# Check for symmetric xor/or-xor
44-
if not input_xfrm or (input_xfrm != 1 and input_xfrm != 2):
44+
if not input_xfrm:
4545
raise KsftSkipEx("Symmetric RSS hash not requested")
4646

4747
cpus = set()

0 commit comments

Comments
 (0)