From 0a0460a0e7c3d862a577fd048375f2ab0a024a97 Mon Sep 17 00:00:00 2001 From: Jie Wang Date: Fri, 29 Apr 2022 17:17:04 +0800 Subject: ethtool: add support to get/set tx push by ethtool -G/g Currently tx push is a standard feature for NICs such as Mellanox, HNS3. But there is no command to set or get this feature. So this patch adds support for "ethtool -G tx-push on|off" and "ethtool -g " to set/get tx push mode. commit: d772518 Reference: https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=d77251806eaa change log: use tab instead of space before [rx-buf-len]; To avoid add other content, add missing content for rx buf len, like ".BN rx\-buf\len" Signed-off-by: Jie Wang --- ethtool.8.in | 8 ++++++++ ethtool.c | 3 ++- netlink/rings.c | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ethtool.8.in b/ethtool.8.in index d2c7e5c..af1c5bc 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -198,6 +198,8 @@ ethtool \- query or control network driver and hardware settings .BN rx\-mini .BN rx\-jumbo .BN tx +.BN rx\-buf\-len +.BN tx\-push .HP .B ethtool \-i|\-\-driver .I devname @@ -559,6 +561,12 @@ Changes the number of ring entries for the Rx Jumbo ring. .TP .BI tx \ N Changes the number of ring entries for the Tx ring. +.TP +.BI rx\-buf\-len \ N +Changes the size of a buffer in the Rx ring. +.TP +.BI tx\-push \ on|off +Specifies whether TX push should be enabled. .RE .TP .B \-i \-\-driver diff --git a/ethtool.c b/ethtool.c index 040e911..46250eb 100644 --- a/ethtool.c +++ b/ethtool.c @@ -5730,7 +5730,8 @@ static const struct option args[] = { " [ rx-mini N ]\n" " [ rx-jumbo N ]\n" " [ tx N ]\n" - " [ rx-buf-len N]\n" + " [ rx-buf-len N]\n" + " [ tx-push on|off]\n" }, { .opts = "-k|--show-features|--show-offload", diff --git a/netlink/rings.c b/netlink/rings.c index 119178e..3718c10 100644 --- a/netlink/rings.c +++ b/netlink/rings.c @@ -47,6 +47,7 @@ int rings_reply_cb(const struct nlmsghdr *nlhdr, void *data) show_u32(tb[ETHTOOL_A_RINGS_RX_JUMBO], "RX Jumbo:\t"); show_u32(tb[ETHTOOL_A_RINGS_TX], "TX:\t\t"); show_u32(tb[ETHTOOL_A_RINGS_RX_BUF_LEN], "RX Buf Len:\t\t"); + show_bool("tx-push", "TX Push:\t%s\n", tb[ETHTOOL_A_RINGS_TX_PUSH]); return MNL_CB_OK; } @@ -105,6 +106,12 @@ static const struct param_parser sring_params[] = { .handler = nl_parse_direct_u32, .min_argc = 1, }, + { + .arg = "tx-push", + .type = ETHTOOL_A_RINGS_TX_PUSH, + .handler = nl_parse_u8bool, + .min_argc = 1, + }, {} }; -- 2.33.0