ethtool: add tunnel info interface
Add an interface to report offloaded UDP ports via ethtool netlink. Now that core takes care of tracking which UDP tunnel ports the NICs are aware of we can quite easily export this information out to user space. The responsibility of writing the netlink dumps is split between ethtool code and udp_tunnel_nic.c - since udp_tunnel module may not always be loaded, yet we should always report the capabilities of the NIC. $ ethtool --show-tunnels eth0 Tunnel information for eth0: UDP port table 0: Size: 4 Types: vxlan No entries UDP port table 1: Size: 4 Types: geneve, vxlan-gpe Entries (1): port 1230, vxlan-gpe v4: - back to v2, build fix is now directly in udp_tunnel.h v3: - don't compile ETHTOOL_MSG_TUNNEL_INFO_GET in if CONFIG_INET not set. v2: - fix string set count, - reorder enums in the uAPI, - fix type of ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES to bitset in docs and comments. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
cc4e3835ef
commit
c7d759eb7b
@@ -41,6 +41,7 @@ enum {
|
||||
ETHTOOL_MSG_TSINFO_GET,
|
||||
ETHTOOL_MSG_CABLE_TEST_ACT,
|
||||
ETHTOOL_MSG_CABLE_TEST_TDR_ACT,
|
||||
ETHTOOL_MSG_TUNNEL_INFO_GET,
|
||||
|
||||
/* add new constants above here */
|
||||
__ETHTOOL_MSG_USER_CNT,
|
||||
@@ -556,6 +557,60 @@ enum {
|
||||
ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT - 1
|
||||
};
|
||||
|
||||
/* TUNNEL INFO */
|
||||
|
||||
enum {
|
||||
ETHTOOL_UDP_TUNNEL_TYPE_VXLAN,
|
||||
ETHTOOL_UDP_TUNNEL_TYPE_GENEVE,
|
||||
ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE,
|
||||
|
||||
__ETHTOOL_UDP_TUNNEL_TYPE_CNT
|
||||
};
|
||||
|
||||
enum {
|
||||
ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC,
|
||||
|
||||
ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT, /* be16 */
|
||||
ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE, /* u32 */
|
||||
|
||||
/* add new constants above here */
|
||||
__ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT,
|
||||
ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = (__ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT - 1)
|
||||
};
|
||||
|
||||
enum {
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC,
|
||||
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE, /* u32 */
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES, /* bitset */
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY, /* nest - _UDP_ENTRY_* */
|
||||
|
||||
/* add new constants above here */
|
||||
__ETHTOOL_A_TUNNEL_UDP_TABLE_CNT,
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = (__ETHTOOL_A_TUNNEL_UDP_TABLE_CNT - 1)
|
||||
};
|
||||
|
||||
enum {
|
||||
ETHTOOL_A_TUNNEL_UDP_UNSPEC,
|
||||
|
||||
ETHTOOL_A_TUNNEL_UDP_TABLE, /* nest - _UDP_TABLE_* */
|
||||
|
||||
/* add new constants above here */
|
||||
__ETHTOOL_A_TUNNEL_UDP_CNT,
|
||||
ETHTOOL_A_TUNNEL_UDP_MAX = (__ETHTOOL_A_TUNNEL_UDP_CNT - 1)
|
||||
};
|
||||
|
||||
enum {
|
||||
ETHTOOL_A_TUNNEL_INFO_UNSPEC,
|
||||
ETHTOOL_A_TUNNEL_INFO_HEADER, /* nest - _A_HEADER_* */
|
||||
|
||||
ETHTOOL_A_TUNNEL_INFO_UDP_PORTS, /* nest - _UDP_TABLE */
|
||||
|
||||
/* add new constants above here */
|
||||
__ETHTOOL_A_TUNNEL_INFO_CNT,
|
||||
ETHTOOL_A_TUNNEL_INFO_MAX = (__ETHTOOL_A_TUNNEL_INFO_CNT - 1)
|
||||
};
|
||||
|
||||
/* generic netlink info */
|
||||
#define ETHTOOL_GENL_NAME "ethtool"
|
||||
#define ETHTOOL_GENL_VERSION 1
|
||||
|
Reference in New Issue
Block a user