]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ethtool: rss: echo the context number back
authorJakub Kicinski <kuba@kernel.org>
Wed, 24 Jul 2024 23:42:49 +0000 (16:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Aug 2024 10:57:50 +0000 (12:57 +0200)
[ Upstream commit f96aae91b0d260f682e630e092ef70a05a718a43 ]

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")
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Documentation/netlink/specs/ethtool.yaml
Documentation/networking/ethtool-netlink.rst
net/ethtool/rss.c

index 3632c1c891e944131280e802d2967496d2a5eeb7..238145c31835e57cb544f970be0c17eb3e980467 100644 (file)
@@ -1638,6 +1638,7 @@ operations:
         reply:
           attributes:
             - header
+            - context
             - hfunc
             - indir
             - hkey
index 160bfb0ae8baece498024a23923d39d869ed25b8..0d8c487be39934a658e8339606bc6984a6c96e28 100644 (file)
@@ -1800,6 +1800,7 @@ Kernel response contents:
 
 =====================================  ======  ==========================
   ``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
index 71679137eff21820a88c25dd75a7bf115e899154..5c4c4505ab9a4a4497e6cfd669e3506c95511c81 100644 (file)
@@ -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)) ||