Skip to contentSkip to conversation

ethtool: rss: small fixes to spec and GET

PATCH Applied Jakub Kicinski 5 participants 8 messages Jul 24, 2024 – Aug 11, 2024

Subsystems (5)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover ethtool: rss: small fixes to spec and GET

Two small fixes to the ethtool RSS_GET over Netlink. Spec is a bit inaccurate and responses miss an identifier.

Jakub Kicinski (2):
netlink: specs: correct the spec of ethtool
ethtool: rss: echo the context number back

 Documentation/netlink/specs/ethtool.yaml     | 2 +-
 Documentation/networking/ethtool-netlink.rst | 1 +
 net/ethtool/rss.c                            | 8 +++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH 1/2 netlink: specs: correct the spec of ethtool

The spec for Ethtool is a bit inaccurate. We don't currently support dump. Context is only accepted as input and not echoed to output (which is a separate bug).

Fixes a353318ebf24 ("tools: ynl: populate most of the ethtool spec")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 Documentation/netlink/specs/ethtool.yaml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Documentation/netlink/specs/ethtool.yaml +1 -2
index 495e35fcfb21..ebbd8dd96b5c 100644
@@ -1753,15 +1753,14 @@ doc: Partial family for Ethtool Netlink.
         request:
           attributes:
             - header
+            - context
         reply:
           attributes:
             - header
-            - context
             - hfunc
             - indir
             - hkey
             - input_xfrm
-      dump: *rss-get-op
     -
       name: plca-get-cfg
       doc: Get PLCA params.
Signature · 1 line
2.45.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH net 1/2] netlink: specs: correct the spec of ethtool

Quoted 6 lines · On Wed, 24 Jul 2024 16:42:48 -0700 Jakub Kicinski <[email protected]> wrote:

The spec for Ethtool is a bit inaccurate. We don't currently support dump. Context is only accepted as input and not echoed to output (which is a separate bug).

Fixes a353318ebf24 ("tools: ynl: populate most of the ethtool spec")
Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#3 lore raw

PATCH 2/2 ethtool: rss: echo the context number back

In reply to Jakub Kicinski

The response to a GET request in Netlink should fully identify the queried object. RSS_GET accepts context id as an input, so it must echo that attribute back to the response.

After (assuming context 1 has been created):

  $ ./cli.py --spec netlink/specs/ethtool.yaml \
             --do rss-get \
	     --json '{"header": {"dev-index": 2}, "context": 1}'
  {'context': 1,
   'header': {'dev-index': 2, 'dev-name': 'eth0'},
  [...]
Fixes 7112a04664bf ("ethtool: add netlink based get rss support")

---
Calling this a fix may be a bit up to interpretation. For dumps missing ID would be really bad, but personally I also lean towards fixing it for do already.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 Documentation/netlink/specs/ethtool.yaml     | 1 +
 Documentation/networking/ethtool-netlink.rst | 1 +
 net/ethtool/rss.c                            | 8 +++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
Documentation/netlink/specs/ethtool.yaml +1 -0
index ebbd8dd96b5c..ea21fe135b97 100644
@@ -1757,6 +1757,7 @@ doc: Partial family for Ethtool Netlink.
         reply:
           attributes:
             - header
+            - context
             - hfunc
             - indir
             - hkey
Documentation/networking/ethtool-netlink.rst +1 -0
index 3ab423b80e91..d5f246aceb9f 100644
@@ -1875,6 +1875,7 @@ RSS context of an interface similar to ``ETHTOOL_GRSSH`` ioctl request.
 
 =====================================  ======  ==========================
   ``ETHTOOL_A_RSS_HEADER``             nested  reply header
+  ``ETHTOOL_A_RSS_CONTEXT``            u32     context number
   ``ETHTOOL_A_RSS_HFUNC``              u32     RSS hash func
   ``ETHTOOL_A_RSS_INDIR``              binary  Indir table bytes
   ``ETHTOOL_A_RSS_HKEY``               binary  Hash key bytes
net/ethtool/rss.c +7 -1
index 71679137eff2..5c4c4505ab9a 100644
@@ -111,7 +111,8 @@ rss_reply_size(const struct ethnl_req_info *req_base,
 	const struct rss_reply_data *data = RSS_REPDATA(reply_base);
 	int len;
 
-	len = nla_total_size(sizeof(u32)) +	/* _RSS_HFUNC */
+	len = nla_total_size(sizeof(u32)) +	/* _RSS_CONTEXT */
+	      nla_total_size(sizeof(u32)) +	/* _RSS_HFUNC */
 	      nla_total_size(sizeof(u32)) +	/* _RSS_INPUT_XFRM */
 	      nla_total_size(sizeof(u32) * data->indir_size) + /* _RSS_INDIR */
 	      nla_total_size(data->hkey_size);	/* _RSS_HKEY */
@@ -124,6 +125,11 @@ rss_fill_reply(struct sk_buff *skb, const struct ethnl_req_info *req_base,
 	       const struct ethnl_reply_data *reply_base)
 {
 	const struct rss_reply_data *data = RSS_REPDATA(reply_base);
+	struct rss_req_info *request = RSS_REQINFO(req_base);
+
+	if (request->rss_context &&
+	    nla_put_u32(skb, ETHTOOL_A_RSS_CONTEXT, request->rss_context))
+		return -EMSGSIZE;
 
 	if ((data->hfunc &&
 	     nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc)) ||
Signature · 1 line
2.45.2
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH net 2/2] ethtool: rss: echo the context number back

Quoted 4 lines · On Wed, 24 Jul 2024 16:42:49 -0700 Jakub Kicinski <[email protected]> wrote:

The response to a GET request in Netlink should fully identify the queried object. RSS_GET accepts context id as an input, so it must echo that attribute back to the response.

Quoted 8 lines

After (assuming context 1 has been created):

  $ ./cli.py --spec netlink/specs/ethtool.yaml \
             --do rss-get \
	     --json '{"header": {"dev-index": 2}, "context": 1}'
  {'context': 1,
   'header': {'dev-index': 2, 'dev-name': 'eth0'},
  [...]
Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer Acked-by on the v1 series
#5 lore raw
In reply to Jakub Kicinski
Quoted 11 lines · Jakub Kicinski

Two small fixes to the ethtool RSS_GET over Netlink. Spec is a bit inaccurate and responses miss an identifier.

Jakub Kicinski (2):
netlink: specs: correct the spec of ethtool
ethtool: rss: echo the context number back

  Documentation/netlink/specs/ethtool.yaml     | 2 +-
  Documentation/networking/ethtool-netlink.rst | 1 +
  net/ethtool/rss.c                            | 8 +++++++-
  3 files changed, 9 insertions(+), 2 deletions(-)
Reviewed-by on the v1 series
#6 lore raw
In reply to Jakub Kicinski
Quoted 11 lines · Jakub Kicinski

Two small fixes to the ethtool RSS_GET over Netlink. Spec is a bit inaccurate and responses miss an identifier.

Jakub Kicinski (2):
netlink: specs: correct the spec of ethtool
ethtool: rss: echo the context number back

 Documentation/netlink/specs/ethtool.yaml     | 2 +-
 Documentation/networking/ethtool-netlink.rst | 1 +
 net/ethtool/rss.c                            | 8 +++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)

Thanks for fixing this.

#7 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 24 Jul 2024 16:42:47 -0700 you wrote:

Two small fixes to the ethtool RSS_GET over Netlink. Spec is a bit inaccurate and responses miss an identifier.

Jakub Kicinski (2):
netlink: specs: correct the spec of ethtool
ethtool: rss: echo the context number back

[...]

Here is the summary with links:
- [net,1/2] netlink: specs: correct the spec of ethtool

    https://git.kernel.org/netdev/net/c/a40c7a24f97e
  - [net,2/2] ethtool: rss: echo the context number back
    https://git.kernel.org/netdev/net/c/f96aae91b0d2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html