netlink interface update for 5.7 release
Subsystems (3)
cover netlink interface update for 5.7 release
This series adds supports for netlink interface features supported in kernel 5.7:
- get/set netdev features (-k / -K)
- get/set device private flags (--show-priv-flags / --set-priv-flags)
- get/set ring sizes (-g / -G)
- get/set channel counts (-l / -L)
- get/set coalescing parameters (-c / -C)
- get/set pause parameters (-a / -A)
- get/set EEE settings (--show-eee / --set-eee)
- get timestamping information (-T)
First three patches fix bugs found in existing code.
Michal Kubecek (21):
netlink: fix build warnings
netlink: fix nest type grouping in parser
netlink: fix msgbuff_append() helper
update UAPI header copies
netlink: add more ethtool netlink message format descriptions
selftest: omit test-features if netlink is enabled
netlink: add netlink handler for gfeatures (-k)
netlink: add netlink handler for sfeatures (-K)
netlink: add netlink handler for gprivflags (--show-priv-flags)
netlink: add netlink handler for sprivflags (--set-priv-flags)
netlink: add netlink handler for gring (-g)
netlink: add netlink handler for sring (-G)
netlink: add netlink handler for gchannels (-l)
netlink: add netlink handler for schannels (-L)
netlink: add netlink handler for gcoalesce (-c)
netlink: add netlink handler for scoalesce (-C)
netlink: add netlink handler for gpause (-a)
netlink: add netlink handler for spause (-A)
netlink: add netlink handler for geee (--show-eee)
netlink: add netlink handler for seee (--set-eee)
netlink: add netlink handler for tsinfo (-T)
Makefile.am | 11 +- common.c | 30 ++ common.h | 19 ++ ethtool.c | 79 ++---- netlink/bitset.c | 31 +++ netlink/bitset.h | 2 + netlink/channels.c | 141 ++++++++++ netlink/coalesce.c | 269 ++++++++++++++++++ netlink/desc-ethtool.c | 129 ++++++++- netlink/eee.c | 189 +++++++++++++ netlink/extapi.h | 30 ++ netlink/features.c | 526 +++++++++++++++++++++++++++++++++++ netlink/monitor.c | 56 ++++ netlink/msgbuff.c | 1 + netlink/netlink.h | 46 +++ netlink/parser.c | 10 +- netlink/pause.c | 222 +++++++++++++++ netlink/privflags.c | 158 +++++++++++ netlink/rings.c | 141 ++++++++++ netlink/settings.c | 17 +- netlink/tsinfo.c | 124 +++++++++ uapi/linux/ethtool.h | 9 +- uapi/linux/ethtool_netlink.h | 175 ++++++++++++ uapi/linux/if_link.h | 6 +- uapi/linux/net_tstamp.h | 6 + 25 files changed, 2347 insertions(+), 80 deletions(-) create mode 100644 netlink/channels.c create mode 100644 netlink/coalesce.c create mode 100644 netlink/eee.c create mode 100644 netlink/features.c create mode 100644 netlink/pause.c create mode 100644 netlink/privflags.c create mode 100644 netlink/rings.c create mode 100644 netlink/tsinfo.c
Signature · 1 line
2.26.2
PATCH 1/21 netlink: fix build warnings
Depending on compiler version and options, some of these warnings may result in build failure.
- gcc 4.8 wants __KERNEL_DIV_ROUND_UP defined before including ethtool.h
- avoid pointer arithmetic on void *
--- netlink/desc-ethtool.c | 2 +- netlink/parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
netlink/desc-ethtool.c +1 -1
@@ -4,9 +4,9 @@* Descriptions of ethtool netlink messages and attributes for pretty print. */ +#include "../internal.h" #include <linux/ethtool_netlink.h> -#include "../internal.h" #include "prettymsg.h" static const struct pretty_nla_desc __header_desc[] = {
netlink/parser.c +1 -1
@@ -1016,7 +1016,7 @@ int nl_parser(struct nl_context *nlctx, const struct param_parser *params, buff =tmp_buff_find (buffs, parser->group); msgbuff = buff ? &buff->msgbuff : &nlsk->msgbuff; - param_dest = dest ? (dest + parser->dest_offset) :NULL ; + param_dest = dest ? ((char *)dest + parser->dest_offset) :NULL ; ret = parser->handler (nlctx, parser->type, parser->handler_data, msgbuff, param_dest);if (ret <0 )
Signature · 1 line
2.26.2
Re: [PATCH ethtool 01/21] netlink: fix build warnings
Hi Michal,
Quoted 7 lines · Michal Kubecek
Depending on compiler version and options, some of these warnings may result in build failure.
- gcc 4.8 wants
__KERNEL_DIV_ROUND_UPdefined before includingethtool.h
- avoid pointer arithmetic on void *Signed-off-by Michal Kubecek <[email protected]>
Signature · 1 line
Heiko
PATCH 2/21 netlink: fix nest type grouping in parser
In reply to Michal KubecekEven if we are only interested in one nested attribute when using PARSER_GROUP_NEST group type, the temporary buffer must contain proper netlink header and have pointer to it and payload set up correctly for libmnl composition functions to be able to track current message size.
--- netlink/parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
netlink/parser.c +4 -4
@@ -957,6 +957,10 @@ int nl_parser(struct nl_context *nlctx, const struct param_parser *params,if (!buff) goto out_free_buffs; msgbuff = &buff->msgbuff; + ret =msg_init (nlctx, msgbuff, parser->group, +NLM_F_REQUEST |NLM_F_ACK ); +if (ret <0 ) + goto out_free_buffs;switch (group_style) {case PARSER_GROUP_NEST :
@@ -966,10 +970,6 @@ int nl_parser(struct nl_context *nlctx, const struct param_parser *params, goto out_free_buffs;break ;case PARSER_GROUP_MSG : - ret =msg_init (nlctx, msgbuff, parser->group, -NLM_F_REQUEST |NLM_F_ACK ); -if (ret <0 ) - goto out_free_buffs;if (ethnla_fill_header (msgbuff,ETHTOOL_A_LINKINFO_HEADER , nlctx->devname,0 ))
Signature · 1 line
2.26.2
Re: [PATCH ethtool 02/21] netlink: fix nest type grouping in parser
Quoted 8 lines · Michal Kubecek
Even if we are only interested in one nested attribute when using
PARSER_GROUP_NESTgroup type, the temporary buffer must contain proper netlink header and have pointer to it and payload set up correctly for libmnl composition functions to be able to track current message size.Fixes 9ee9d9517542 ("netlink: add basic command line parsing helpers")Reported-by Andrew Lunn <[email protected]>Signed-off-by Michal Kubecek <[email protected]>
Andrew
PATCH 3/21 netlink: fix msgbuff_append() helper
In reply to Michal KubecekAs msgbuff_append() only copies protocol payload, i.e. part of the buffer without netlink and genetlink header, and mnl_nlmsg_get_payload_len() only subtracts netlink header length, we need to subtract genetlink header length manually to get correct length of appended data block.
--- netlink/msgbuff.c | 1 + 1 file changed, 1 insertion(+)
netlink/msgbuff.c +1 -0
@@ -79,6 +79,7 @@ int msgbuff_append(struct nl_msg_buff *dest, struct nl_msg_buff *src)unsigned int dest_len =MNL_ALIGN (msgbuff_len (dest));int ret; + src_len -=GENL_HDRLEN ; ret =msgbuff_realloc (dest, dest_len + src_len);if (ret <0 )return ret;
Signature · 1 line
2.26.2
Re: [PATCH ethtool 03/21] netlink: fix msgbuff_append() helper
Quoted 8 lines · Michal Kubecek
As
msgbuff_append()only copies protocol payload, i.e. part of the buffer without netlink and genetlink header, andmnl_nlmsg_get_payload_len()only subtracts netlink header length, we need to subtract genetlink header length manually to get correct length of appended data block.Fixes 5050607946b6 ("netlink: message buffer and composition helpers")Reported-by Andrew Lunn <[email protected]>Signed-off-by Michal Kubecek <[email protected]>
Andrew
PATCH 4/21 update UAPI header copies
In reply to Michal KubecekUpdate to kernel v5.7-rc7.
--- uapi/linux/ethtool.h | 9 +- uapi/linux/ethtool_netlink.h | 175 +++++++++++++++++++++++++++++++++++ uapi/linux/if_link.h | 6 +- uapi/linux/net_tstamp.h | 6 ++ 4 files changed, 193 insertions(+), 3 deletions(-)
uapi/linux/ethtool.h +7 -2
@@ -594,6 +594,9 @@ struct ethtool_pauseparam {* @ETH_SS_LINK_MODES: link mode names * @ETH_SS_MSG_CLASSES: debug message class names * @ETH_SS_WOL_MODES: wake-on-lan modes +* @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags +* @ETH_SS_TS_TX_TYPES: timestamping Tx types +* @ETH_SS_TS_RX_FILTERS: timestamping Rx filters */ enum ethtool_stringset {ETH_SS_TEST =0 ,
@@ -608,6 +611,9 @@ enum ethtool_stringset {ETH_SS_LINK_MODES ,ETH_SS_MSG_CLASSES ,ETH_SS_WOL_MODES , +ETH_SS_SOF_TIMESTAMPING , +ETH_SS_TS_TX_TYPES , +ETH_SS_TS_RX_FILTERS ,/* add new constants above here */ ETH_SS_COUNT
@@ -1521,8 +1527,7 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT =71 , ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT =72 , ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT =73 , -ETHTOOL_LINK_MODE_FEC_LLRS_BIT =74 , - +ETHTOOL_LINK_MODE_FEC_LLRS_BIT =74 ,/* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS };
uapi/linux/ethtool_netlink.h +175 -0
193 lines not on this page · raw message
uapi/linux/if_link.h +5 -1
@@ -461,6 +461,7 @@ enum {IFLA_MACSEC_REPLAY_PROTECT ,IFLA_MACSEC_VALIDATION ,IFLA_MACSEC_PAD , +IFLA_MACSEC_OFFLOAD , __IFLA_MACSEC_MAX, };
@@ -487,6 +488,7 @@ enum macsec_validation_type {enum macsec_offload {MACSEC_OFFLOAD_OFF =0 ,MACSEC_OFFLOAD_PHY =1 , +MACSEC_OFFLOAD_MAC =2 , __MACSEC_OFFLOAD_END,MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END -1 , };
@@ -970,11 +972,12 @@ enum {#define XDP_FLAGS_SKB_MODE (1U << 1)#define XDP_FLAGS_DRV_MODE (1U << 2)#define XDP_FLAGS_HW_MODE (1U << 3) +#define XDP_FLAGS_REPLACE (1U << 4)#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ XDP_FLAGS_DRV_MODE | \ XDP_FLAGS_HW_MODE)#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ - XDP_FLAGS_MODES) + XDP_FLAGS_MODES | XDP_FLAGS_REPLACE)/* These are stored into IFLA_XDP_ATTACHED on dump. */ enum {
@@ -994,6 +997,7 @@ enum {IFLA_XDP_DRV_PROG_ID ,IFLA_XDP_SKB_PROG_ID ,IFLA_XDP_HW_PROG_ID , +IFLA_XDP_EXPECTED_FD , __IFLA_XDP_MAX, };
uapi/linux/net_tstamp.h +6 -0
@@ -98,6 +98,9 @@ enum hwtstamp_tx_types {* receive a time stamp via the socket error queue. */ HWTSTAMP_TX_ONESTEP_P2P , + +/* add new constants above here */ + __HWTSTAMP_TX_CNT };/* possible values for hwtstamp_config->rx_filter */
@@ -140,6 +143,9 @@ enum hwtstamp_rx_filters {/* NTP, UDP, all versions and packet modes */ HWTSTAMP_FILTER_NTP_ALL , + +/* add new constants above here */ + __HWTSTAMP_FILTER_CNT };/* SCM_TIMESTAMPING_PKTINFO control message */
Signature · 1 line
2.26.2
PATCH 5/21 netlink: add more ethtool netlink message format descriptions
In reply to Michal KubecekAdd message format descriptions for pretty printing of messages related to netdev features, private flags, ring sizes, channel counts, coalescing, pause and EEE parameters and timestamping information.
--- netlink/desc-ethtool.c | 127 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+)
netlink/desc-ethtool.c +127 -0
@@ -106,6 +106,102 @@ static const struct pretty_nla_desc __wol_desc[] = { NLATTR_DESC_BINARY(ETHTOOL_A_WOL_SOPASS), }; +static const struct pretty_nla_desc __features_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_FEATURES_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_FEATURES_HEADER , header), +NLATTR_DESC_NESTED (ETHTOOL_A_FEATURES_HW , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_FEATURES_WANTED , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_FEATURES_ACTIVE , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_FEATURES_NOCHANGE , bitset), +}; + +static const struct pretty_nla_desc __privflags_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_PRIVFLAGS_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_PRIVFLAGS_HEADER , header), +NLATTR_DESC_NESTED (ETHTOOL_A_PRIVFLAGS_FLAGS , bitset), +}; + +static const struct pretty_nla_desc __rings_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_RINGS_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_RINGS_HEADER , header), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX_MINI_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX_JUMBO_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_TX_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX_MINI ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_RX_JUMBO ), +NLATTR_DESC_U32 (ETHTOOL_A_RINGS_TX ), +}; + +static const struct pretty_nla_desc __channels_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CHANNELS_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CHANNELS_HEADER , header), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_RX_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_TX_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_OTHER_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_COMBINED_MAX ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_RX_COUNT ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_TX_COUNT ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_OTHER_COUNT ), +NLATTR_DESC_U32 (ETHTOOL_A_CHANNELS_COMBINED_COUNT ), +}; + +static const struct pretty_nla_desc __coalesce_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_COALESCE_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_COALESCE_HEADER , header), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_USECS ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_MAX_FRAMES ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_USECS_IRQ ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_USECS ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_MAX_FRAMES ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_USECS_IRQ ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_STATS_BLOCK_USECS ), +NLATTR_DESC_BOOL (ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX ), +NLATTR_DESC_BOOL (ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_PKT_RATE_LOW ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_USECS_LOW ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_USECS_LOW ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_PKT_RATE_HIGH ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_USECS_HIGH ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_USECS_HIGH ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH ), +NLATTR_DESC_U32 (ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL ), +}; + +static const struct pretty_nla_desc __pause_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_PAUSE_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_PAUSE_HEADER , header), +NLATTR_DESC_BOOL (ETHTOOL_A_PAUSE_AUTONEG ), +NLATTR_DESC_BOOL (ETHTOOL_A_PAUSE_RX ), +NLATTR_DESC_BOOL (ETHTOOL_A_PAUSE_TX ), +}; + +static const struct pretty_nla_desc __eee_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_EEE_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_EEE_HEADER , header), +NLATTR_DESC_NESTED (ETHTOOL_A_EEE_MODES_OURS , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_EEE_MODES_PEER , bitset), +NLATTR_DESC_BOOL (ETHTOOL_A_EEE_ACTIVE ), +NLATTR_DESC_BOOL (ETHTOOL_A_EEE_ENABLED ), +NLATTR_DESC_BOOL (ETHTOOL_A_EEE_TX_LPI_ENABLED ), +NLATTR_DESC_U32 (ETHTOOL_A_EEE_TX_LPI_TIMER ), +}; + +static const struct pretty_nla_desc __tsinfo_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_TSINFO_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_TSINFO_HEADER , header), +NLATTR_DESC_NESTED (ETHTOOL_A_TSINFO_TIMESTAMPING , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_TSINFO_TX_TYPES , bitset), +NLATTR_DESC_NESTED (ETHTOOL_A_TSINFO_RX_FILTERS , bitset), +NLATTR_DESC_U32 (ETHTOOL_A_TSINFO_PHC_INDEX ), +}; +const struct pretty_nlmsg_desc ethnl_umsg_desc[] = {NLMSG_DESC_INVALID (ETHTOOL_MSG_USER_NONE ),NLMSG_DESC (ETHTOOL_MSG_STRSET_GET , strset),
@@ -118,6 +214,21 @@ const struct pretty_nlmsg_desc ethnl_umsg_desc[] = {NLMSG_DESC (ETHTOOL_MSG_DEBUG_SET , debug),NLMSG_DESC (ETHTOOL_MSG_WOL_GET , wol),NLMSG_DESC (ETHTOOL_MSG_WOL_SET , wol), +NLMSG_DESC (ETHTOOL_MSG_FEATURES_GET , features), +NLMSG_DESC (ETHTOOL_MSG_FEATURES_SET , features), +NLMSG_DESC (ETHTOOL_MSG_PRIVFLAGS_GET , privflags), +NLMSG_DESC (ETHTOOL_MSG_PRIVFLAGS_SET , privflags), +NLMSG_DESC (ETHTOOL_MSG_RINGS_GET , rings), +NLMSG_DESC (ETHTOOL_MSG_RINGS_SET , rings), +NLMSG_DESC (ETHTOOL_MSG_CHANNELS_GET , channels), +NLMSG_DESC (ETHTOOL_MSG_CHANNELS_SET , channels), +NLMSG_DESC (ETHTOOL_MSG_COALESCE_GET , coalesce), +NLMSG_DESC (ETHTOOL_MSG_COALESCE_SET , coalesce), +NLMSG_DESC (ETHTOOL_MSG_PAUSE_GET , pause), +NLMSG_DESC (ETHTOOL_MSG_PAUSE_SET , pause), +NLMSG_DESC (ETHTOOL_MSG_EEE_GET , eee), +NLMSG_DESC (ETHTOOL_MSG_EEE_SET , eee), + NLMSG_DESC(ETHTOOL_MSG_TSINFO_GET, tsinfo), };const unsigned int ethnl_umsg_n_desc =ARRAY_SIZE (ethnl_umsg_desc);
@@ -134,6 +245,22 @@ const struct pretty_nlmsg_desc ethnl_kmsg_desc[] = {NLMSG_DESC (ETHTOOL_MSG_DEBUG_NTF , debug),NLMSG_DESC (ETHTOOL_MSG_WOL_GET_REPLY , wol),NLMSG_DESC (ETHTOOL_MSG_WOL_NTF , wol), +NLMSG_DESC (ETHTOOL_MSG_FEATURES_GET_REPLY , features), +NLMSG_DESC (ETHTOOL_MSG_FEATURES_SET_REPLY , features), +NLMSG_DESC (ETHTOOL_MSG_FEATURES_NTF , features), +NLMSG_DESC (ETHTOOL_MSG_PRIVFLAGS_GET_REPLY , privflags), +NLMSG_DESC (ETHTOOL_MSG_PRIVFLAGS_NTF , privflags), +NLMSG_DESC (ETHTOOL_MSG_RINGS_GET_REPLY , rings), +NLMSG_DESC (ETHTOOL_MSG_RINGS_NTF , rings), +NLMSG_DESC (ETHTOOL_MSG_CHANNELS_GET_REPLY , channels), +NLMSG_DESC (ETHTOOL_MSG_CHANNELS_NTF , channels), +NLMSG_DESC (ETHTOOL_MSG_COALESCE_GET_REPLY , coalesce), +NLMSG_DESC (ETHTOOL_MSG_COALESCE_NTF , coalesce), +NLMSG_DESC (ETHTOOL_MSG_PAUSE_GET_REPLY , pause), +NLMSG_DESC (ETHTOOL_MSG_PAUSE_NTF , pause), +NLMSG_DESC (ETHTOOL_MSG_EEE_GET_REPLY , eee), +NLMSG_DESC (ETHTOOL_MSG_EEE_NTF , eee), + NLMSG_DESC(ETHTOOL_MSG_TSINFO_GET_REPLY, tsinfo), };const unsigned int ethnl_kmsg_n_desc =ARRAY_SIZE (ethnl_kmsg_desc);
Signature · 1 line
2.26.2
PATCH 6/21 selftest: omit test-features if netlink is enabled
In reply to Michal KubecekThe test-features selftest is checking data structures passed to ioctl() syscall. Therefore a complete rework of the test framework will be needed to be able to perform an equivalent selftest for netlink interface. Until such framework is implemented, disable test-features when building ethtool with netlink support.
--- Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Makefile.am +6 -2
@@ -40,12 +40,16 @@ AM_CPPFLAGS += @MNL_CFLAGS@ LDADD += @MNL_LIBS@ endif -TESTS = test-cmdline test-features -check_PROGRAMS = test-cmdline test-features +TESTS = test-cmdline +check_PROGRAMS = test-cmdline test_cmdline_SOURCES = test-cmdline.c test-common.c $(ethtool_SOURCES) test_cmdline_CFLAGS = -DTEST_ETHTOOL +if !ETHTOOL_ENABLE_NETLINK +TESTS += test-features +check_PROGRAMS += test-features test_features_SOURCES = test-features.c test-common.c $(ethtool_SOURCES) test_features_CFLAGS = -DTEST_ETHTOOL +endif dist-hook: cp $(top_srcdir)/ethtool.spec $(distdir)
Signature · 1 line
2.26.2
PATCH 7/21 netlink: add netlink handler for gfeatures (-k)
In reply to Michal KubecekImplement "ethtool -k <dev>" subcommand using ETHTOOL_MSG_FEATURES_GET netlink message. This retrieves and displays names and values of netdev feature flags, traditionally provided by ioctl request ETHTOOL_GFEATURES (and some older ones).
Unlike ioctl, the netlink code does not query kernel for values of legacy flags (ETH_FLAG_*) and computes their value from features grouped under such flag instead so that it can get slightly different results than ioctl implementation in cases where some new feature is not considered by kernel code (kernel fix is going to be submitted soon).
This commit also registers the callback with monitor code so that the monitor can display ETHTOOL_MSG_FEATURES_NTF notifications.
--- Makefile.am | 1 + common.c | 30 ++++++ common.h | 19 ++++ ethtool.c | 65 ++---------- netlink/bitset.c | 18 ++++ netlink/bitset.h | 1 + netlink/extapi.h | 2 + netlink/features.c | 241 +++++++++++++++++++++++++++++++++++++++++++++ netlink/monitor.c | 8 ++ netlink/netlink.h | 1 + 10 files changed, 331 insertions(+), 55 deletions(-) create mode 100644 netlink/features.c
Makefile.am +1 -0
@@ -31,6 +31,7 @@ ethtool_SOURCES += \ netlink/monitor.c netlink/bitset.c netlink/bitset.h \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ + netlink/features.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
common.c +30 -0
@@ -47,6 +47,36 @@ const struct flag_info flags_msglvl[] = { };const unsigned int n_flags_msglvl =ARRAY_SIZE (flags_msglvl) -1 ; +const struct off_flag_def off_flag_def[] = { + {"rx" ,"rx-checksumming" ,"rx-checksum" , +ETHTOOL_GRXCSUM ,ETHTOOL_SRXCSUM ,ETH_FLAG_RXCSUM ,0 }, + {"tx" ,"tx-checksumming" ,"tx-checksum-*" , +ETHTOOL_GTXCSUM ,ETHTOOL_STXCSUM ,ETH_FLAG_TXCSUM ,0 }, + {"sg" ,"scatter-gather" ,"tx-scatter-gather*" , +ETHTOOL_GSG ,ETHTOOL_SSG ,ETH_FLAG_SG ,0 }, + {"tso" ,"tcp-segmentation-offload" ,"tx-tcp*-segmentation" , +ETHTOOL_GTSO ,ETHTOOL_STSO ,ETH_FLAG_TSO ,0 }, + {"ufo" ,"udp-fragmentation-offload" ,"tx-udp-fragmentation" , +ETHTOOL_GUFO ,ETHTOOL_SUFO ,ETH_FLAG_UFO ,0 }, + {"gso" ,"generic-segmentation-offload" ,"tx-generic-segmentation" , +ETHTOOL_GGSO ,ETHTOOL_SGSO ,ETH_FLAG_GSO ,0 }, + {"gro" ,"generic-receive-offload" ,"rx-gro" , +ETHTOOL_GGRO ,ETHTOOL_SGRO ,ETH_FLAG_GRO ,0 }, + {"lro" ,"large-receive-offload" ,"rx-lro" , +0 ,0 ,ETH_FLAG_LRO , +KERNEL_VERSION (2 ,6 ,24 ) }, + {"rxvlan" ,"rx-vlan-offload" ,"rx-vlan-hw-parse" , +0 ,0 ,ETH_FLAG_RXVLAN , +KERNEL_VERSION (2 ,6 ,37 ) }, + {"txvlan" ,"tx-vlan-offload" ,"tx-vlan-hw-insert" , +0 ,0 ,ETH_FLAG_TXVLAN , +KERNEL_VERSION (2 ,6 ,37 ) }, + {"ntuple" ,"ntuple-filters" ,"rx-ntuple-filter" , +0 ,0 ,ETH_FLAG_NTUPLE ,0 }, + {"rxhash" ,"receive-hashing" ,"rx-hashing" , +0 ,0 ,ETH_FLAG_RXHASH ,0 }, +}; +void print_flags (const struct flag_info *info,unsigned int n_info,u32 value) {const char *sep ="" ;
common.h +19 -0
@@ -19,6 +19,25 @@ struct flag_info {extern const struct flag_info flags_msglvl[];extern const unsigned int n_flags_msglvl; +struct off_flag_def { +const char *short_name; +const char *long_name; +const char *kernel_name; +u32 get_cmd, set_cmd; +u32 value; +/* For features exposed through ETHTOOL_GFLAGS, the oldest +* kernel version for which we can trust the result. Where +* the flag was added at the same time the kernel started +* supporting the feature, this is 0 (to allow for backports). +* Where the feature was supported before the flag was added, +* it is the version that introduced the flag. +*/ +u32 min_kernel_ver; +}; + +#define OFF_FLAG_DEF_SIZE 12 +extern const struct off_flag_def off_flag_def[OFF_FLAG_DEF_SIZE ]; +void print_flags (const struct flag_info *info,unsigned int n_info,u32 value);int dump_wol (struct ethtool_wolinfo *wol);void dump_mdix (u8 mdix,u8 mdix_ctrl);
ethtool.c +10 -55
131 lines not on this page · raw message
netlink/bitset.c +18 -0
@@ -153,6 +153,24 @@ err:return true; } +uint32_t *get_compact_bitset_value (const struct nlattr *bitset) +{ +const struct nlattr *tb[ETHTOOL_A_BITSET_MAX +1 ] = {}; +DECLARE_ATTR_TB_INFO (tb); +unsigned int count; +int ret; + + ret =mnl_attr_parse_nested (bitset, attr_cb, &tb_info); +if (ret <0 || + !tb[ETHTOOL_A_BITSET_SIZE ] || !tb[ETHTOOL_A_BITSET_VALUE ]) +return NULL ; + count =mnl_attr_get_u32 (tb[ETHTOOL_A_BITSET_SIZE ]); +if (8 *mnl_attr_get_payload_len (tb[ETHTOOL_A_BITSET_VALUE ]) < count) +return NULL ; + +return mnl_attr_get_payload (tb[ETHTOOL_A_BITSET_VALUE ]); +} +int walk_bitset (const struct nlattr *bitset,const struct stringset *labels,bitset_walk_callback cb,void *data) {
netlink/bitset.h +1 -0
@@ -20,6 +20,7 @@ bool bitset_get_bit(const struct nlattr *bitset, bool mask, unsigned int idx, int *retptr);bool bitset_is_compact (const struct nlattr *bitset);bool bitset_is_empty (const struct nlattr *bitset,bool mask,int *retptr); +uint32_t *get_compact_bitset_value (const struct nlattr *bitset);int walk_bitset (const struct nlattr *bitset,const struct stringset *labels,bitset_walk_callback cb,void *data);
netlink/extapi.h +2 -0
@@ -20,6 +20,7 @@ void netlink_run_handler(struct cmd_context *ctx, nl_func_t nlfunc,int nl_gset (struct cmd_context *ctx);int nl_sset (struct cmd_context *ctx);int nl_permaddr (struct cmd_context *ctx); +int nl_gfeatures (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -44,6 +45,7 @@ static inline void nl_monitor_usage(void)#define nl_gset NULL#define nl_sset NULL#define nl_permaddr NULL +#define nl_gfeatures NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/features.c new file +241 -0
241 lines not on this page · raw message
netlink/monitor.c +8 -0
@@ -31,6 +31,10 @@ static struct { .cmd = ETHTOOL_MSG_DEBUG_NTF, .cb = debug_reply_cb, }, + { + .cmd = ETHTOOL_MSG_FEATURES_NTF, + .cb = features_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -102,6 +106,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-s|--change", .cmd = ETHTOOL_MSG_DEBUG_NTF, }, + { + .pattern = "-k|--show-features|--show-offload|-K|--features|--offload", + .cmd = ETHTOOL_MSG_FEATURES_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +1 -0
@@ -62,6 +62,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data);int linkinfo_reply_cb (const struct nlmsghdr *nlhdr,void *data);int wol_reply_cb (const struct nlmsghdr *nlhdr,void *data);int debug_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int features_reply_cb (const struct nlmsghdr *nlhdr,void *data);static inline void copy_devname (char *dst,const char *src) {
Signature · 1 line
2.26.2
PATCH 8/21 netlink: add netlink handler for sfeatures (-K)
In reply to Michal KubecekImplement "ethtool -K <dev> ..." subcommand to set netdev feature flags using ETHTOOL_MSG_FEATURES_SET netlink message. These are traditionally set using ETHTOOL_SFEATURES ioctl request (and some older ones).
Unlike with ioctl, an attempt to set a value of a "group flag" (e.g. "tso" or "txcsum") translates to a request to set all features in that group (rather than letting kernel to do that); this can be a different set of features than kernel uses (kernel fix is going to be submitted soon).
Output of the command also explicitly marks features with values changed without being requested (e.g. because of dependencies).
--- ethtool.c | 1 + netlink/bitset.c | 23 +++- netlink/bitset.h | 1 + netlink/extapi.h | 2 + netlink/features.c | 285 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 307 insertions(+), 5 deletions(-)
ethtool.c +1 -0
@@ -5219,6 +5219,7 @@ static const struct option args[] = { { .opts = "-K|--features|--offload", .func = do_sfeatures, + .nlfunc = nl_sfeatures, .help = "Set protocol offload and other features", .xhelp =" FEATURE on|off ...\n" },
netlink/bitset.c +18 -5
@@ -153,7 +153,8 @@ err:return true; } -uint32_t *get_compact_bitset_value (const struct nlattr *bitset) +static uint32_t *get_compact_bitset_attr (const struct nlattr *bitset, +uint16_t type) {const struct nlattr *tb[ETHTOOL_A_BITSET_MAX +1 ] = {};DECLARE_ATTR_TB_INFO (tb);
@@ -161,14 +162,26 @@ uint32_t *get_compact_bitset_value(const struct nlattr *bitset)int ret; ret =mnl_attr_parse_nested (bitset, attr_cb, &tb_info); -if (ret <0 || - !tb[ETHTOOL_A_BITSET_SIZE ] || !tb[ETHTOOL_A_BITSET_VALUE ]) +if (ret <0 ) +return NULL ; +if (!tb[ETHTOOL_A_BITSET_SIZE ] || !tb[ETHTOOL_A_BITSET_VALUE ] || + !tb[type])return NULL ; count =mnl_attr_get_u32 (tb[ETHTOOL_A_BITSET_SIZE ]); -if (8 *mnl_attr_get_payload_len (tb[ETHTOOL_A_BITSET_VALUE ]) < count) +if (8 *mnl_attr_get_payload_len (tb[type]) < count)return NULL ; -return mnl_attr_get_payload (tb[ETHTOOL_A_BITSET_VALUE ]); +return mnl_attr_get_payload (tb[type]); +} + +uint32_t *get_compact_bitset_value (const struct nlattr *bitset) +{ +return get_compact_bitset_attr (bitset,ETHTOOL_A_BITSET_VALUE ); +} + +uint32_t *get_compact_bitset_mask (const struct nlattr *bitset) +{ +return get_compact_bitset_attr (bitset,ETHTOOL_A_BITSET_MASK ); } int walk_bitset(const struct nlattr *bitset, const struct stringset *labels,
netlink/bitset.h +1 -0
@@ -21,6 +21,7 @@ bool bitset_get_bit(const struct nlattr *bitset, bool mask, unsigned int idx,bool bitset_is_compact (const struct nlattr *bitset);bool bitset_is_empty (const struct nlattr *bitset,bool mask,int *retptr);uint32_t *get_compact_bitset_value (const struct nlattr *bitset); +uint32_t *get_compact_bitset_mask (const struct nlattr *bitset);int walk_bitset (const struct nlattr *bitset,const struct stringset *labels,bitset_walk_callback cb,void *data);
netlink/extapi.h +2 -0
@@ -21,6 +21,7 @@ int nl_gset(struct cmd_context *ctx);int nl_sset (struct cmd_context *ctx);int nl_permaddr (struct cmd_context *ctx);int nl_gfeatures (struct cmd_context *ctx); +int nl_sfeatures (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -46,6 +47,7 @@ static inline void nl_monitor_usage(void)#define nl_sset NULL#define nl_permaddr NULL#define nl_gfeatures NULL +#define nl_sfeatures NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/features.c +285 -0
288 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 9/21 netlink: add netlink handler for gprivflags (--show-priv-flags)
In reply to Michal KubecekImplement "ethtool --show-priv-flags <dev>" subcommand using ETHTOOL_MSG_PRIVFLAGS_GET netlink message. This retrieves and displays values of device private flags, traditionally provided by ETHTOOL_GPFLAGS ioctl request.
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_PRIVFLAGS_NTF notifications.
--- Makefile.am | 2 +- ethtool.c | 1 + netlink/extapi.h | 2 + netlink/monitor.c | 8 ++++ netlink/netlink.h | 1 + netlink/privflags.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 netlink/privflags.c
Makefile.am +1 -1
@@ -31,7 +31,7 @@ ethtool_SOURCES += \ netlink/monitor.c netlink/bitset.c netlink/bitset.h \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ - netlink/features.c \ + netlink/features.c netlink/privflags.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5377,6 +5377,7 @@ static const struct option args[] = { { .opts = "--show-priv-flags", .func = do_gprivflags, + .nlfunc = nl_gprivflags, .help ="Query private flags" }, {
netlink/extapi.h +2 -0
@@ -22,6 +22,7 @@ int nl_sset(struct cmd_context *ctx);int nl_permaddr (struct cmd_context *ctx);int nl_gfeatures (struct cmd_context *ctx);int nl_sfeatures (struct cmd_context *ctx); +int nl_gprivflags (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -48,6 +49,7 @@ static inline void nl_monitor_usage(void)#define nl_permaddr NULL#define nl_gfeatures NULL#define nl_sfeatures NULL +#define nl_gprivflags NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -35,6 +35,10 @@ static struct { .cmd = ETHTOOL_MSG_FEATURES_NTF, .cb = features_reply_cb, }, + { + .cmd = ETHTOOL_MSG_PRIVFLAGS_NTF, + .cb = privflags_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -110,6 +114,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-k|--show-features|--show-offload|-K|--features|--offload", .cmd = ETHTOOL_MSG_FEATURES_NTF, }, + { + .pattern = "--show-priv-flags|--set-priv-flags", + .cmd = ETHTOOL_MSG_PRIVFLAGS_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +1 -0
@@ -63,6 +63,7 @@ int linkinfo_reply_cb(const struct nlmsghdr *nlhdr, void *data);int wol_reply_cb (const struct nlmsghdr *nlhdr,void *data);int debug_reply_cb (const struct nlmsghdr *nlhdr,void *data);int features_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int privflags_reply_cb (const struct nlmsghdr *nlhdr,void *data);static inline void copy_devname (char *dst,const char *src) {
netlink/privflags.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 10/21 netlink: add netlink handler for sprivflags (--set-priv-flags)
In reply to Michal KubecekImplement "ethtool --set-priv-flags <dev> ..." subcommand to set device private flags using ETHTOOL_MSG_PRIVFLAGS_SET netlink message. These are traditionally set using ETHTOOL_SPFLAGS ioctl request.
Unlike ioctl implementation, netlink does not retrieve private flag names first so that names provided on command line are validated by kernel rather than by parser. Unrecognized names are therefore interpreted as a failed request rather than a parser error.
--- ethtool.c | 1 + netlink/extapi.h | 2 ++ netlink/privflags.c | 51 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5383,6 +5383,7 @@ static const struct option args[] = { { .opts = "--set-priv-flags", .func = do_sprivflags, + .nlfunc = nl_sprivflags, .help = "Set private flags", .xhelp =" FLAG on|off ...\n" },
netlink/extapi.h +2 -0
@@ -23,6 +23,7 @@ int nl_permaddr(struct cmd_context *ctx);int nl_gfeatures (struct cmd_context *ctx);int nl_sfeatures (struct cmd_context *ctx);int nl_gprivflags (struct cmd_context *ctx); +int nl_sprivflags (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -50,6 +51,7 @@ static inline void nl_monitor_usage(void)#define nl_gfeatures NULL#define nl_sfeatures NULL#define nl_gprivflags NULL +#define nl_sprivflags NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/privflags.c +50 -1
66 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 11/21 netlink: add netlink handler for gring (-g)
In reply to Michal KubecekImplement "ethtool -g <dev>" subcommand using ETHTOOL_MSG_RINGS_GET netlink message. This retrieves and displays device ring sizes, traditionally provided by ETHTOOL_GRINGPARAM ioctl request.
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_RINGS_NTF notifications.
--- Makefile.am | 2 +- ethtool.c | 1 + netlink/extapi.h | 2 ++ netlink/monitor.c | 8 ++++++ netlink/netlink.h | 13 +++++++++ netlink/rings.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 netlink/rings.c
Makefile.am +1 -1
@@ -31,7 +31,7 @@ ethtool_SOURCES += \ netlink/monitor.c netlink/bitset.c netlink/bitset.h \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ - netlink/features.c netlink/privflags.c \ + netlink/features.c netlink/privflags.c netlink/rings.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5199,6 +5199,7 @@ static const struct option args[] = { { .opts = "-g|--show-ring", .func = do_gring, + .nlfunc = nl_gring, .help ="Query RX/TX ring parameters" }, {
netlink/extapi.h +2 -0
@@ -24,6 +24,7 @@ int nl_gfeatures(struct cmd_context *ctx);int nl_sfeatures (struct cmd_context *ctx);int nl_gprivflags (struct cmd_context *ctx);int nl_sprivflags (struct cmd_context *ctx); +int nl_gring (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -52,6 +53,7 @@ static inline void nl_monitor_usage(void)#define nl_sfeatures NULL#define nl_gprivflags NULL#define nl_sprivflags NULL +#define nl_gring NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -39,6 +39,10 @@ static struct { .cmd = ETHTOOL_MSG_PRIVFLAGS_NTF, .cb = privflags_reply_cb, }, + { + .cmd = ETHTOOL_MSG_RINGS_NTF, + .cb = rings_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -118,6 +122,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "--show-priv-flags|--set-priv-flags", .cmd = ETHTOOL_MSG_PRIVFLAGS_NTF, }, + { + .pattern = "-g|--show-ring|-G|--set-ring", + .cmd = ETHTOOL_MSG_RINGS_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +13 -0
@@ -64,6 +64,19 @@ int wol_reply_cb(const struct nlmsghdr *nlhdr, void *data);int debug_reply_cb (const struct nlmsghdr *nlhdr,void *data);int features_reply_cb (const struct nlmsghdr *nlhdr,void *data);int privflags_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int rings_reply_cb (const struct nlmsghdr *nlhdr,void *data); + +/* dump helpers */ + +static inline void show_u32 (const struct nlattr *attr,const char *label) +{ +if (attr) +printf ("%s%u\n" , label,mnl_attr_get_u32 (attr)); +else +printf ("%sn/a\n" , label); +} + +/* misc */ static inline void copy_devname (char *dst,const char *src) {
netlink/rings.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 12/21 netlink: add netlink handler for sring (-G)
In reply to Michal KubecekImplement "ethtool -G <dev> ..." subcommand to set network device ring sizes using ETHTOOL_MSG_RINGS_SET netlink request. These are traditionally set using ETHTOOL_SRINGPARAM ioctl request.
--- ethtool.c | 1 + netlink/extapi.h | 2 ++ netlink/rings.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5205,6 +5205,7 @@ static const struct option args[] = { { .opts = "-G|--set-ring", .func = do_sring, + .nlfunc = nl_sring, .help ="Set RX/TX ring parameters" , .xhelp = " [ rx N ]\n"" [ rx-mini N ]\n"
netlink/extapi.h +2 -0
@@ -25,6 +25,7 @@ int nl_sfeatures(struct cmd_context *ctx);int nl_gprivflags (struct cmd_context *ctx);int nl_sprivflags (struct cmd_context *ctx);int nl_gring (struct cmd_context *ctx); +int nl_sring (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -54,6 +55,7 @@ static inline void nl_monitor_usage(void)#define nl_gprivflags NULL#define nl_sprivflags NULL#define nl_gring NULL +#define nl_sring NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/rings.c +71 -1
87 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 13/21 netlink: add netlink handler for gchannels (-l)
In reply to Michal KubecekImplement "ethtool -l <dev>" subcommand using ETHTOOL_MSG_CHANNELS_GET netlink message. This retrieves and displays device channel counts, traditionally provided by ETHTOOL_GCHANNELS ioctl request.
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_CHANNELS_NTF notifications.
--- Makefile.am | 1 + ethtool.c | 1 + netlink/channels.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 2 ++ netlink/monitor.c | 8 ++++++ netlink/netlink.h | 1 + 6 files changed, 84 insertions(+) create mode 100644 netlink/channels.c
Makefile.am +1 -0
@@ -32,6 +32,7 @@ ethtool_SOURCES += \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ netlink/features.c netlink/privflags.c netlink/rings.c \ + netlink/channels.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5365,6 +5365,7 @@ static const struct option args[] = { { .opts = "-l|--show-channels", .func = do_gchannels, + .nlfunc = nl_gchannels, .help ="Query Channels" }, {
netlink/channels.c new file +71 -0
71 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -26,6 +26,7 @@ int nl_gprivflags(struct cmd_context *ctx);int nl_sprivflags (struct cmd_context *ctx);int nl_gring (struct cmd_context *ctx);int nl_sring (struct cmd_context *ctx); +int nl_gchannels (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -56,6 +57,7 @@ static inline void nl_monitor_usage(void)#define nl_sprivflags NULL#define nl_gring NULL#define nl_sring NULL +#define nl_gchannels NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -43,6 +43,10 @@ static struct { .cmd = ETHTOOL_MSG_RINGS_NTF, .cb = rings_reply_cb, }, + { + .cmd = ETHTOOL_MSG_CHANNELS_NTF, + .cb = channels_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -126,6 +130,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-g|--show-ring|-G|--set-ring", .cmd = ETHTOOL_MSG_RINGS_NTF, }, + { + .pattern = "-l|--show-channels|-L|--set-channels", + .cmd = ETHTOOL_MSG_CHANNELS_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +1 -0
@@ -65,6 +65,7 @@ int debug_reply_cb(const struct nlmsghdr *nlhdr, void *data);int features_reply_cb (const struct nlmsghdr *nlhdr,void *data);int privflags_reply_cb (const struct nlmsghdr *nlhdr,void *data);int rings_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int channels_reply_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */
Signature · 1 line
2.26.2
PATCH 14/21 netlink: add netlink handler for schannels (-L)
In reply to Michal KubecekImplement "ethtool -L <dev> ..." subcommand to set network device channel counts using ETHTOOL_MSG_CHANNELS_SET netlink message. These are traditionally set using ETHTOOL_SCHANNELS ioctl request.
--- ethtool.c | 1 + netlink/channels.c | 72 +++++++++++++++++++++++++++++++++++++++++++++- netlink/extapi.h | 2 ++ 3 files changed, 74 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5371,6 +5371,7 @@ static const struct option args[] = { { .opts = "-L|--set-channels", .func = do_schannels, + .nlfunc = nl_schannels, .help ="Set Channels" , .xhelp = " [ rx N ]\n"" [ tx N ]\n"
netlink/channels.c +71 -1
87 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -27,6 +27,7 @@ int nl_sprivflags(struct cmd_context *ctx);int nl_gring (struct cmd_context *ctx);int nl_sring (struct cmd_context *ctx);int nl_gchannels (struct cmd_context *ctx); +int nl_schannels (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -58,6 +59,7 @@ static inline void nl_monitor_usage(void)#define nl_gring NULL#define nl_sring NULL#define nl_gchannels NULL +#define nl_schannels NULL#endif /* ETHTOOL_ENABLE_NETLINK */
Signature · 1 line
2.26.2
PATCH 15/21 netlink: add netlink handler for gcoalesce (-c)
In reply to Michal KubecekImplement "ethtool -c <dev>" subcommand using ETHTOOL_MSG_COALESCE_GET netlink message. This retrieves and displays device coalescing parameters, traditionally provided by ETHTOOL_GCOALESCE ioctl request.
Unlike the ioctl code, netlink can distinguish between unsupported parameter (shown as "n/a") and zero value ("0" or "off").
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_COALESCE_NTF notifications.
--- Makefile.am | 2 +- ethtool.c | 1 + netlink/coalesce.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 2 + netlink/monitor.c | 8 ++++ netlink/netlink.h | 9 +++++ 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 netlink/coalesce.c
Makefile.am +1 -1
@@ -32,7 +32,7 @@ ethtool_SOURCES += \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ netlink/features.c netlink/privflags.c netlink/rings.c \ - netlink/channels.c \ + netlink/channels.c netlink/coalesce.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5167,6 +5167,7 @@ static const struct option args[] = { { .opts = "-c|--show-coalesce", .func = do_gcoalesce, + .nlfunc = nl_gcoalesce, .help ="Show coalesce options" }, {
netlink/coalesce.c new file +91 -0
91 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -28,6 +28,7 @@ int nl_gring(struct cmd_context *ctx);int nl_sring (struct cmd_context *ctx);int nl_gchannels (struct cmd_context *ctx);int nl_schannels (struct cmd_context *ctx); +int nl_gcoalesce (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -60,6 +61,7 @@ static inline void nl_monitor_usage(void)#define nl_sring NULL#define nl_gchannels NULL#define nl_schannels NULL +#define nl_gcoalesce NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -47,6 +47,10 @@ static struct { .cmd = ETHTOOL_MSG_CHANNELS_NTF, .cb = channels_reply_cb, }, + { + .cmd = ETHTOOL_MSG_COALESCE_NTF, + .cb = coalesce_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -134,6 +138,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-l|--show-channels|-L|--set-channels", .cmd = ETHTOOL_MSG_CHANNELS_NTF, }, + { + .pattern = "-c|--show-coalesce|-C|--coalesce", + .cmd = ETHTOOL_MSG_COALESCE_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +9 -0
@@ -66,6 +66,7 @@ int features_reply_cb(const struct nlmsghdr *nlhdr, void *data);int privflags_reply_cb (const struct nlmsghdr *nlhdr,void *data);int rings_reply_cb (const struct nlmsghdr *nlhdr,void *data);int channels_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int coalesce_reply_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */
@@ -77,6 +78,14 @@ static inline void show_u32(const struct nlattr *attr, const char *label)printf ("%sn/a\n" , label); } +static inline const char *u8_to_bool (const struct nlattr *attr) +{ +if (attr) +return mnl_attr_get_u8 (attr) ?"on" :"off" ; +else +return "n/a" ; +} +/* misc */ static inline void copy_devname (char *dst,const char *src)
Signature · 1 line
2.26.2
PATCH 16/21 netlink: add netlink handler for scoalesce (-C)
In reply to Michal KubecekImplement "ethtool -C <dev> ..." subcommand to set network device coalescing parameters using ETHTOOL_MSG_COALESCE_SET netlink message. These are traditionally set using ETHTOOL_SCOALESCE ioctl request.
--- ethtool.c | 1 + netlink/coalesce.c | 180 ++++++++++++++++++++++++++++++++++++++++++++- netlink/extapi.h | 2 + 3 files changed, 182 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5173,6 +5173,7 @@ static const struct option args[] = { { .opts = "-C|--coalesce", .func = do_scoalesce, + .nlfunc = nl_scoalesce, .help ="Set coalesce options" , .xhelp = " [adaptive-rx on|off]\n"" [adaptive-tx on|off]\n"
netlink/coalesce.c +179 -1
195 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -29,6 +29,7 @@ int nl_sring(struct cmd_context *ctx);int nl_gchannels (struct cmd_context *ctx);int nl_schannels (struct cmd_context *ctx);int nl_gcoalesce (struct cmd_context *ctx); +int nl_scoalesce (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -62,6 +63,7 @@ static inline void nl_monitor_usage(void)#define nl_gchannels NULL#define nl_schannels NULL#define nl_gcoalesce NULL +#define nl_scoalesce NULL#endif /* ETHTOOL_ENABLE_NETLINK */
Signature · 1 line
2.26.2
PATCH 17/21 netlink: add netlink handler for gpause (-a)
In reply to Michal KubecekImplement "ethtool -a <dev>" subcommand using ETHTOOL_MSG_PAUSE_GET netlink message. This retrieves and diaplays device pause parameters, traditionally provided by ETHTOOL_GPAUSEPARAM ioctl request.
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_PAUSE_NTF notifications. When in monitor mode, negotiated status is not displayed.
--- Makefile.am | 2 +- ethtool.c | 1 + netlink/extapi.h | 2 + netlink/monitor.c | 8 +++ netlink/netlink.h | 6 ++ netlink/pause.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 netlink/pause.c
Makefile.am +1 -1
@@ -32,7 +32,7 @@ ethtool_SOURCES += \ netlink/settings.c netlink/parser.c netlink/parser.h \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ netlink/features.c netlink/privflags.c netlink/rings.c \ - netlink/channels.c netlink/coalesce.c \ + netlink/channels.c netlink/coalesce.c netlink/pause.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5154,6 +5154,7 @@ static const struct option args[] = { { .opts = "-a|--show-pause", .func = do_gpause, + .nlfunc = nl_gpause, .help ="Show pause options" }, {
netlink/extapi.h +2 -0
@@ -30,6 +30,7 @@ int nl_gchannels(struct cmd_context *ctx);int nl_schannels (struct cmd_context *ctx);int nl_gcoalesce (struct cmd_context *ctx);int nl_scoalesce (struct cmd_context *ctx); +int nl_gpause (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -64,6 +65,7 @@ static inline void nl_monitor_usage(void)#define nl_schannels NULL#define nl_gcoalesce NULL#define nl_scoalesce NULL +#define nl_gpause NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -51,6 +51,10 @@ static struct { .cmd = ETHTOOL_MSG_COALESCE_NTF, .cb = coalesce_reply_cb, }, + { + .cmd = ETHTOOL_MSG_PAUSE_NTF, + .cb = pause_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -142,6 +146,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-c|--show-coalesce|-C|--coalesce", .cmd = ETHTOOL_MSG_COALESCE_NTF, }, + { + .pattern = "-a|--show-pause|-A|--pause", + .cmd = ETHTOOL_MSG_PAUSE_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +6 -0
@@ -67,6 +67,7 @@ int privflags_reply_cb(const struct nlmsghdr *nlhdr, void *data);int rings_reply_cb (const struct nlmsghdr *nlhdr,void *data);int channels_reply_cb (const struct nlmsghdr *nlhdr,void *data);int coalesce_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int pause_reply_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */
@@ -86,6 +87,11 @@ static inline const char *u8_to_bool(const struct nlattr *attr)return "n/a" ; } +static inline void show_bool (const struct nlattr *attr,const char *label) +{ +printf ("%s%s\n" , label,u8_to_bool (attr)); +} +/* misc */ static inline void copy_devname (char *dst,const char *src)
netlink/pause.c new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 18/21 netlink: add netlink handler for spause (-A)
In reply to Michal KubecekImplement "ethtool -A <dev> ..." subcommand to set network device pause parameters using ETHTOOL_MSG_PAUSE_SET netlink message. These are traditionally set using ETHTOOL_SPAUSEPARAM ioctl request.
--- ethtool.c | 1 + netlink/extapi.h | 2 ++ netlink/pause.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5160,6 +5160,7 @@ static const struct option args[] = { { .opts = "-A|--pause", .func = do_spause, + .nlfunc = nl_spause, .help ="Set pause options" , .xhelp = " [ autoneg on|off ]\n"" [ rx on|off ]\n"
netlink/extapi.h +2 -0
@@ -31,6 +31,7 @@ int nl_schannels(struct cmd_context *ctx);int nl_gcoalesce (struct cmd_context *ctx);int nl_scoalesce (struct cmd_context *ctx);int nl_gpause (struct cmd_context *ctx); +int nl_spause (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -66,6 +67,7 @@ static inline void nl_monitor_usage(void)#define nl_gcoalesce NULL#define nl_scoalesce NULL#define nl_gpause NULL +#define nl_spause NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/pause.c +65 -1
81 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 19/21 netlink: add netlink handler for geee (--show-eee)
In reply to Michal KubecekImplement "ethtool --show-eee <dev>" subcommand using ETHTOOL_MSG_EEE_GET netlink message. This retrieves and displays device coalescing parameters, traditionally provided by ETHTOOL_GEEE ioctl request.
Also register the callback with monitor code so that the monitor can display ETHTOOL_MSG_EEE_NTF notifications.
--- Makefile.am | 1 + ethtool.c | 1 + netlink/eee.c | 108 +++++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 2 + netlink/monitor.c | 8 ++++ netlink/netlink.h | 15 +++++++ netlink/settings.c | 17 ++----- 7 files changed, 138 insertions(+), 14 deletions(-) create mode 100644 netlink/eee.c
Makefile.am +1 -0
@@ -33,6 +33,7 @@ ethtool_SOURCES += \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ netlink/features.c netlink/privflags.c netlink/rings.c \ netlink/channels.c netlink/coalesce.c netlink/pause.c \ + netlink/eee.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5407,6 +5407,7 @@ static const struct option args[] = { { .opts = "--show-eee", .func = do_geee, + .nlfunc = nl_geee, .help = "Show EEE settings", }, {
netlink/eee.c new file +108 -0
108 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -32,6 +32,7 @@ int nl_gcoalesce(struct cmd_context *ctx);int nl_scoalesce (struct cmd_context *ctx);int nl_gpause (struct cmd_context *ctx);int nl_spause (struct cmd_context *ctx); +int nl_geee (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -68,6 +69,7 @@ static inline void nl_monitor_usage(void)#define nl_scoalesce NULL#define nl_gpause NULL#define nl_spause NULL +#define nl_geee NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +8 -0
@@ -55,6 +55,10 @@ static struct { .cmd = ETHTOOL_MSG_PAUSE_NTF, .cb = pause_reply_cb, }, + { + .cmd = ETHTOOL_MSG_EEE_NTF, + .cb = eee_reply_cb, + }, };static void clear_filter (struct nl_context *nlctx)
@@ -150,6 +154,10 @@ static struct monitor_option monitor_opts[] = { .pattern = "-a|--show-pause|-A|--pause", .cmd = ETHTOOL_MSG_PAUSE_NTF, }, + { + .pattern = "--show-eee|--set-eee", + .cmd = ETHTOOL_MSG_EEE_NTF, + }, };static bool pattern_match (const char *s,const char *pattern)
netlink/netlink.h +15 -0
@@ -16,6 +16,15 @@#define WILDCARD_DEVNAME "*"#define CMDMASK_WORDS DIV_ROUND_UP(__ETHTOOL_MSG_KERNEL_CNT, 32) +enum link_mode_class { +LM_CLASS_UNKNOWN , +LM_CLASS_REAL , +LM_CLASS_AUTONEG , +LM_CLASS_PORT , +LM_CLASS_PAUSE , +LM_CLASS_FEC , +}; +struct nl_context {struct cmd_context *ctx;void *cmd_private;
@@ -68,9 +77,15 @@ int rings_reply_cb(const struct nlmsghdr *nlhdr, void *data);int channels_reply_cb (const struct nlmsghdr *nlhdr,void *data);int coalesce_reply_cb (const struct nlmsghdr *nlhdr,void *data);int pause_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int eee_reply_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */ +int dump_link_modes (struct nl_context *nlctx,const struct nlattr *bitset, +bool mask,unsigned int class,const char *before, +const char *between,const char *after, +const char *if_none); +static inline void show_u32 (const struct nlattr *attr,const char *label) {if (attr)
netlink/settings.c +3 -14
@@ -17,15 +17,6 @@/* GET_SETTINGS */ -enum link_mode_class { -LM_CLASS_UNKNOWN , -LM_CLASS_REAL , -LM_CLASS_AUTONEG , -LM_CLASS_PORT , -LM_CLASS_PAUSE , -LM_CLASS_FEC , -}; -struct link_mode_info {enum link_mode_class class;u32 speed;
@@ -263,11 +254,9 @@ static void print_banner(struct nl_context *nlctx) nlctx->no_banner = true; } -static int dump_link_modes (struct nl_context *nlctx, -const struct nlattr *bitset,bool mask, -unsigned int class,const char *before, -const char *between,const char *after, -const char *if_none) +int dump_link_modes (struct nl_context *nlctx,const struct nlattr *bitset, +bool mask,unsigned int class,const char *before, +const char *between,const char *after,const char *if_none) {const struct nlattr *bitset_tb[ETHTOOL_A_BITSET_MAX +1 ] = {};DECLARE_ATTR_TB_INFO (bitset_tb);
Signature · 1 line
2.26.2
PATCH 20/21 netlink: add netlink handler for seee (--set-eee)
In reply to Michal KubecekImplement "ethtool --set-eee <dev> ..." subcommand to set network device EEE settings using ETHTOOL_MSG_EEE_SET netlink message. These are traditionally set using ETHTOOL_SEEE ioctl request.
--- ethtool.c | 1 + netlink/eee.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++- netlink/extapi.h | 2 ++ 3 files changed, 85 insertions(+), 1 deletion(-)
ethtool.c +1 -0
@@ -5413,6 +5413,7 @@ static const struct option args[] = { { .opts = "--set-eee", .func = do_seee, + .nlfunc = nl_seee, .help ="Set EEE settings" , .xhelp = " [ eee on|off ]\n"" [ advertise %x ]\n"
netlink/eee.c +82 -1
98 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -33,6 +33,7 @@ int nl_scoalesce(struct cmd_context *ctx);int nl_gpause (struct cmd_context *ctx);int nl_spause (struct cmd_context *ctx);int nl_geee (struct cmd_context *ctx); +int nl_seee (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -70,6 +71,7 @@ static inline void nl_monitor_usage(void)#define nl_gpause NULL#define nl_spause NULL#define nl_geee NULL +#define nl_seee NULL#endif /* ETHTOOL_ENABLE_NETLINK */
Signature · 1 line
2.26.2
PATCH 21/21 netlink: add netlink handler for tsinfo (-T)
In reply to Michal KubecekImplement "ethtool -T <dev>" subcommand using ETHTOOL_MSG_TSINFO_GET netlink message. This retrieves and displays device timestamping information, traditionally provided by ETHTOOL_GET_TS_INFO ioctl request.
--- Makefile.am | 2 +- ethtool.c | 1 + netlink/extapi.h | 2 + netlink/tsinfo.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 netlink/tsinfo.c
Makefile.am +1 -1
@@ -33,7 +33,7 @@ ethtool_SOURCES += \ netlink/permaddr.c netlink/prettymsg.c netlink/prettymsg.h \ netlink/features.c netlink/privflags.c netlink/rings.c \ netlink/channels.c netlink/coalesce.c netlink/pause.c \ - netlink/eee.c \ + netlink/eee.c netlink/tsinfo.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ netlink/desc-rtnl.c \ uapi/linux/ethtool_netlink.h \
ethtool.c +1 -0
@@ -5324,6 +5324,7 @@ static const struct option args[] = { { .opts = "-T|--show-time-stamping", .func = do_tsinfo, + .nlfunc = nl_tsinfo, .help ="Show time stamping capabilities" }, {
netlink/extapi.h +2 -0
@@ -34,6 +34,7 @@ int nl_gpause(struct cmd_context *ctx);int nl_spause (struct cmd_context *ctx);int nl_geee (struct cmd_context *ctx);int nl_seee (struct cmd_context *ctx); +int nl_tsinfo (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -72,6 +73,7 @@ static inline void nl_monitor_usage(void)#define nl_spause NULL#define nl_geee NULL#define nl_seee NULL +#define nl_tsinfo NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/tsinfo.c new file +124 -0
124 lines not on this page · raw message
Signature · 1 line
2.26.2