History

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.

Jakub Kicinski committed 6 years ago

Commit c7d759e1 parent cc4e38312 files · +472 −1Browse files

Showing the changes to include/uapi/linux (2 of 12 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/ethtool.h +2 −0
  2. include/uapi/linux/ethtool_netlink.h +55 −0
include/uapi/linux/ethtool.h+2−0
@@ -669,6 +669,7 @@ enum ethtool_link_ext_substate_cable_issue { · 668 unmodified lines
669 * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags669 * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags
670 * @ETH_SS_TS_TX_TYPES: timestamping Tx types670 * @ETH_SS_TS_TX_TYPES: timestamping Tx types
671 * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters671 * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters
672 * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types
672 */673 */
673enum ethtool_stringset {674enum ethtool_stringset {
674 ETH_SS_TEST = 0,675 ETH_SS_TEST = 0,
@@ -686,6 +687,7 @@ enum ethtool_stringset { · 11 unmodified lines
686 ETH_SS_SOF_TIMESTAMPING,687 ETH_SS_SOF_TIMESTAMPING,
687 ETH_SS_TS_TX_TYPES,688 ETH_SS_TS_TX_TYPES,
688 ETH_SS_TS_RX_FILTERS,689 ETH_SS_TS_RX_FILTERS,
690 ETH_SS_UDP_TUNNEL_TYPES,
689 691
690 /* add new constants above here */692 /* add new constants above here */
691 ETH_SS_COUNT693 ETH_SS_COUNT
include/uapi/linux/ethtool_netlink.h+55−0
@@ -41,6 +41,7 @@ enum { · 40 unmodified lines
41 ETHTOOL_MSG_TSINFO_GET,41 ETHTOOL_MSG_TSINFO_GET,
42 ETHTOOL_MSG_CABLE_TEST_ACT,42 ETHTOOL_MSG_CABLE_TEST_ACT,
43 ETHTOOL_MSG_CABLE_TEST_TDR_ACT,43 ETHTOOL_MSG_CABLE_TEST_TDR_ACT,
44 ETHTOOL_MSG_TUNNEL_INFO_GET,
44 45
45 /* add new constants above here */46 /* add new constants above here */
46 __ETHTOOL_MSG_USER_CNT,47 __ETHTOOL_MSG_USER_CNT,
@@ -556,6 +557,60 @@ enum { · 509 unmodified lines
556 ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT - 1557 ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT - 1
557};558};
558 559
560/* TUNNEL INFO */
561
562enum {
563 ETHTOOL_UDP_TUNNEL_TYPE_VXLAN,
564 ETHTOOL_UDP_TUNNEL_TYPE_GENEVE,
565 ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE,
566
567 __ETHTOOL_UDP_TUNNEL_TYPE_CNT
568};
569
570enum {
571 ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC,
572
573 ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT, /* be16 */
574 ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE, /* u32 */
575
576 /* add new constants above here */
577 __ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT,
578 ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = (__ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT - 1)
579};
580
581enum {
582 ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC,
583
584 ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE, /* u32 */
585 ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES, /* bitset */
586 ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY, /* nest - _UDP_ENTRY_* */
587
588 /* add new constants above here */
589 __ETHTOOL_A_TUNNEL_UDP_TABLE_CNT,
590 ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = (__ETHTOOL_A_TUNNEL_UDP_TABLE_CNT - 1)
591};
592
593enum {
594 ETHTOOL_A_TUNNEL_UDP_UNSPEC,
595
596 ETHTOOL_A_TUNNEL_UDP_TABLE, /* nest - _UDP_TABLE_* */
597
598 /* add new constants above here */
599 __ETHTOOL_A_TUNNEL_UDP_CNT,
600 ETHTOOL_A_TUNNEL_UDP_MAX = (__ETHTOOL_A_TUNNEL_UDP_CNT - 1)
601};
602
603enum {
604 ETHTOOL_A_TUNNEL_INFO_UNSPEC,
605 ETHTOOL_A_TUNNEL_INFO_HEADER, /* nest - _A_HEADER_* */
606
607 ETHTOOL_A_TUNNEL_INFO_UDP_PORTS, /* nest - _UDP_TABLE */
608
609 /* add new constants above here */
610 __ETHTOOL_A_TUNNEL_INFO_CNT,
611 ETHTOOL_A_TUNNEL_INFO_MAX = (__ETHTOOL_A_TUNNEL_INFO_CNT - 1)
612};
613
559/* generic netlink info */614/* generic netlink info */
560#define ETHTOOL_GENL_NAME "ethtool"615#define ETHTOOL_GENL_NAME "ethtool"
561#define ETHTOOL_GENL_VERSION 1616#define ETHTOOL_GENL_VERSION 1