Skip to content

Commit 19a83d3

Browse files
mkubecekdavem330
authored andcommitted
ethtool: add and use message type for tunnel info reply
Tunnel offload info code uses ETHTOOL_MSG_TUNNEL_INFO_GET message type (cmd field in genetlink header) for replies to tunnel info netlink request, i.e. the same value as the request have. This is a problem because we are using two separate enums for userspace to kernel and kernel to userspace message types so that this ETHTOOL_MSG_TUNNEL_INFO_GET (28) collides with ETHTOOL_MSG_CABLE_TEST_TDR_NTF which is what message type 28 means for kernel to userspace messages. As the tunnel info request reached mainline in 5.9 merge window, we should still be able to fix the reply message type without breaking backward compatibility. Fixes: c7d759e ("ethtool: add tunnel info interface") Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9fb030a commit 19a83d3

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Documentation/networking/ethtool-netlink.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Userspace to kernel:
206206
``ETHTOOL_MSG_TSINFO_GET`` get timestamping info
207207
``ETHTOOL_MSG_CABLE_TEST_ACT`` action start cable test
208208
``ETHTOOL_MSG_CABLE_TEST_TDR_ACT`` action start raw TDR cable test
209+
``ETHTOOL_MSG_TUNNEL_INFO_GET`` get tunnel offload info
209210
===================================== ================================
210211

211212
Kernel to userspace:
@@ -239,6 +240,7 @@ Kernel to userspace:
239240
``ETHTOOL_MSG_TSINFO_GET_REPLY`` timestamping info
240241
``ETHTOOL_MSG_CABLE_TEST_NTF`` Cable test results
241242
``ETHTOOL_MSG_CABLE_TEST_TDR_NTF`` Cable test TDR results
243+
``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info
242244
===================================== =================================
243245

244246
``GET`` requests are sent by userspace applications to retrieve device
@@ -1363,4 +1365,5 @@ are netlink only.
13631365
``ETHTOOL_SFECPARAM`` n/a
13641366
n/a ''ETHTOOL_MSG_CABLE_TEST_ACT''
13651367
n/a ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''
1368+
n/a ``ETHTOOL_MSG_TUNNEL_INFO_GET``
13661369
=================================== =====================================

include/uapi/linux/ethtool_netlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ enum {
7979
ETHTOOL_MSG_TSINFO_GET_REPLY,
8080
ETHTOOL_MSG_CABLE_TEST_NTF,
8181
ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
82+
ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
8283

8384
/* add new constants above here */
8485
__ETHTOOL_MSG_KERNEL_CNT,

net/ethtool/tunnels.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info)
200200
reply_len = ret + ethnl_reply_header_size();
201201

202202
rskb = ethnl_reply_init(reply_len, req_info.dev,
203-
ETHTOOL_MSG_TUNNEL_INFO_GET,
203+
ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
204204
ETHTOOL_A_TUNNEL_INFO_HEADER,
205205
info, &reply_payload);
206206
if (!rskb) {
@@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
273273
goto cont;
274274

275275
ehdr = ethnl_dump_put(skb, cb,
276-
ETHTOOL_MSG_TUNNEL_INFO_GET);
276+
ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY);
277277
if (!ehdr) {
278278
ret = -EMSGSIZE;
279279
goto out;

0 commit comments

Comments
 (0)