Skip to content

Commit f96aae9

Browse files
committed
ethtool: rss: echo the context number back
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: 7112a04 ("ethtool: add netlink based get rss support") Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Joe Damato <jdamato@fastly.com> Link: https://patch.msgid.link/20240724234249.2621109-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a40c7a2 commit f96aae9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Documentation/netlink/specs/ethtool.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@ operations:
17571757
reply:
17581758
attributes:
17591759
- header
1760+
- context
17601761
- hfunc
17611762
- indir
17621763
- hkey

Documentation/networking/ethtool-netlink.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,6 +1875,7 @@ Kernel response contents:
18751875

18761876
===================================== ====== ==========================
18771877
``ETHTOOL_A_RSS_HEADER`` nested reply header
1878+
``ETHTOOL_A_RSS_CONTEXT`` u32 context number
18781879
``ETHTOOL_A_RSS_HFUNC`` u32 RSS hash func
18791880
``ETHTOOL_A_RSS_INDIR`` binary Indir table bytes
18801881
``ETHTOOL_A_RSS_HKEY`` binary Hash key bytes

net/ethtool/rss.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ rss_reply_size(const struct ethnl_req_info *req_base,
111111
const struct rss_reply_data *data = RSS_REPDATA(reply_base);
112112
int len;
113113

114-
len = nla_total_size(sizeof(u32)) + /* _RSS_HFUNC */
114+
len = nla_total_size(sizeof(u32)) + /* _RSS_CONTEXT */
115+
nla_total_size(sizeof(u32)) + /* _RSS_HFUNC */
115116
nla_total_size(sizeof(u32)) + /* _RSS_INPUT_XFRM */
116117
nla_total_size(sizeof(u32) * data->indir_size) + /* _RSS_INDIR */
117118
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,
124125
const struct ethnl_reply_data *reply_base)
125126
{
126127
const struct rss_reply_data *data = RSS_REPDATA(reply_base);
128+
struct rss_req_info *request = RSS_REQINFO(req_base);
129+
130+
if (request->rss_context &&
131+
nla_put_u32(skb, ETHTOOL_A_RSS_CONTEXT, request->rss_context))
132+
return -EMSGSIZE;
127133

128134
if ((data->hfunc &&
129135
nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc)) ||

0 commit comments

Comments
 (0)