diff mbox series

[ethtool-next,1/1] netlink: settings: add netlink support for coalesce tx aggr params

Message ID 20230313095107.2319823-1-dnlplm@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Michal Kubecek
Headers show
Series [ethtool-next,1/1] netlink: settings: add netlink support for coalesce tx aggr params | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Daniele Palmas March 13, 2023, 9:51 a.m. UTC
Add support for getting/setting coalesce tx aggregation parameters
(max bytes, max frames, max time).

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
 ethtool.8.in                  |  3 +++
 ethtool.c                     |  3 +++
 netlink/coalesce.c            | 25 +++++++++++++++++++++++++
 netlink/desc-ethtool.c        |  3 +++
 shell-completion/bash/ethtool |  3 +++
 5 files changed, 37 insertions(+)
diff mbox series

Patch

diff --git a/ethtool.8.in b/ethtool.8.in
index 3672e44..d171972 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -188,6 +188,9 @@  ethtool \- query or control network driver and hardware settings
 .BN sample\-interval
 .B2 cqe\-mode\-rx on off
 .B2 cqe\-mode\-tx on off
+.BN tx\-aggr\-max\-bytes
+.BN tx\-aggr\-max\-frames
+.BN tx\-aggr\-time\-usecs
 .HP
 .B ethtool \-g|\-\-show\-ring
 .I devname
diff --git a/ethtool.c b/ethtool.c
index 6022a6e..9e99831 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5730,6 +5730,9 @@  static const struct option args[] = {
 			  "		[sample-interval N]\n"
 			  "		[cqe-mode-rx on|off]\n"
 			  "		[cqe-mode-tx on|off]\n"
+			  "		[tx-aggr-max-bytes N]\n"
+			  "		[tx-aggr-max-frames N]\n"
+			  "		[tx-aggr-time-usecs N]\n"
 	},
 	{
 		.opts	= "-g|--show-ring",
diff --git a/netlink/coalesce.c b/netlink/coalesce.c
index 17a814b..bc34d3d 100644
--- a/netlink/coalesce.c
+++ b/netlink/coalesce.c
@@ -89,6 +89,13 @@  int coalesce_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		  tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX]);
 	show_bool("tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX]);
 	show_cr();
+	show_u32("tx-aggr-max-bytes", "tx-aggr-max-bytes:\t",
+		 tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES]);
+	show_u32("tx-aggr-max-frames", "tx-aggr-max-frames:\t",
+		 tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES]);
+	show_u32("tx-aggr-time-usecs", "tx-aggr-time-usecs\t",
+		 tb[ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS]);
+	show_cr();
 
 	close_json_object();
 
@@ -267,6 +274,24 @@  static const struct param_parser scoalesce_params[] = {
 		.handler	= nl_parse_u8bool,
 		.min_argc	= 1,
 	},
+	{
+		.arg		= "tx-aggr-max-bytes",
+		.type		= ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx-aggr-max-frames",
+		.type		= ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx-aggr-time-usecs",
+		.type		= ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
 	{}
 };
 
diff --git a/netlink/desc-ethtool.c b/netlink/desc-ethtool.c
index 2d8aa39..7b77f88 100644
--- a/netlink/desc-ethtool.c
+++ b/netlink/desc-ethtool.c
@@ -201,6 +201,9 @@  static const struct pretty_nla_desc __coalesce_desc[] = {
 	NLATTR_DESC_U32(ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL),
 	NLATTR_DESC_BOOL(ETHTOOL_A_COALESCE_USE_CQE_MODE_TX),
 	NLATTR_DESC_BOOL(ETHTOOL_A_COALESCE_USE_CQE_MODE_RX),
+	NLATTR_DESC_U32(ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES),
+	NLATTR_DESC_U32(ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES),
+	NLATTR_DESC_U32(ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS),
 };
 
 static const struct pretty_nla_desc __pause_stats_desc[] = {
diff --git a/shell-completion/bash/ethtool b/shell-completion/bash/ethtool
index 46334b5..99c5f6f 100644
--- a/shell-completion/bash/ethtool
+++ b/shell-completion/bash/ethtool
@@ -254,6 +254,9 @@  _ethtool_coalesce()
 		[tx-usecs-high]=1
 		[tx-usecs-irq]=1
 		[tx-usecs-low]=1
+		[tx-aggr-max-bytes]=1
+		[tx-aggr-max-frames]=1
+		[tx-aggr-time-usecs]=1
 	)
 
 	case "$prev" in