diff mbox series

[kernel] netlink: settings: add netlink support for coalesce cqe mode parameter

Message ID 1630035784-15926-1-git-send-email-moyufeng@huawei.com (mailing list archive)
State Superseded
Headers show
Series [kernel] netlink: settings: add netlink support for coalesce cqe mode parameter | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Yufeng Mo Aug. 27, 2021, 3:43 a.m. UTC
Add support for "ethtool -c <dev> cqe-mode-rx/cqe-mode-tx on/off"
for setting coalesce cqe mode.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
---
 ethtool.c          |  2 ++
 netlink/coalesce.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

Comments

Yufeng Mo Aug. 27, 2021, 6:10 a.m. UTC | #1
sorry, the title description of this patch is incorrect, will resent it.

On 2021/8/27 11:43, Yufeng Mo wrote:
> Add support for "ethtool -c <dev> cqe-mode-rx/cqe-mode-tx on/off"
> for setting coalesce cqe mode.
> 
> Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
> ---
>  ethtool.c          |  2 ++
>  netlink/coalesce.c | 15 +++++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 2486caa..a6826e9 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -5703,6 +5703,8 @@ static const struct option args[] = {
>  			  "		[tx-usecs-high N]\n"
>  			  "		[tx-frames-high N]\n"
>  			  "		[sample-interval N]\n"
> +			  "		[cqe-mode-rx on|off]\n"
> +			  "		[cqe-mode-tx on|off]\n"
>  	},
>  	{
>  		.opts	= "-g|--show-ring",
> diff --git a/netlink/coalesce.c b/netlink/coalesce.c
> index 75922a9..762d0e3 100644
> --- a/netlink/coalesce.c
> +++ b/netlink/coalesce.c
> @@ -66,6 +66,9 @@ int coalesce_reply_cb(const struct nlmsghdr *nlhdr, void *data)
>  	show_u32(tb[ETHTOOL_A_COALESCE_TX_USECS_HIGH], "tx-usecs-high: ");
>  	show_u32(tb[ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH], "tx-frame-high: ");
>  	putchar('\n');
> +	show_bool("rx", "CQE mode RX: %s  ",
> +		  tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX]);
> +	show_bool("tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX]);
>  
>  	return MNL_CB_OK;
>  }
> @@ -226,6 +229,18 @@ static const struct param_parser scoalesce_params[] = {
>  		.handler	= nl_parse_direct_u32,
>  		.min_argc	= 1,
>  	},
> +	{
> +		.arg		= "cqe-mode-rx",
> +		.type		= ETHTOOL_A_COALESCE_USE_CQE_MODE_RX,
> +		.handler	= nl_parse_u8bool,
> +		.min_argc	= 1,
> +	},
> +	{
> +		.arg		= "cqe-mode-tx",
> +		.type		= ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,
> +		.handler	= nl_parse_u8bool,
> +		.min_argc	= 1,
> +	},
>  	{}
>  };
>  
>
diff mbox series

Patch

diff --git a/ethtool.c b/ethtool.c
index 2486caa..a6826e9 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5703,6 +5703,8 @@  static const struct option args[] = {
 			  "		[tx-usecs-high N]\n"
 			  "		[tx-frames-high N]\n"
 			  "		[sample-interval N]\n"
+			  "		[cqe-mode-rx on|off]\n"
+			  "		[cqe-mode-tx on|off]\n"
 	},
 	{
 		.opts	= "-g|--show-ring",
diff --git a/netlink/coalesce.c b/netlink/coalesce.c
index 75922a9..762d0e3 100644
--- a/netlink/coalesce.c
+++ b/netlink/coalesce.c
@@ -66,6 +66,9 @@  int coalesce_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 	show_u32(tb[ETHTOOL_A_COALESCE_TX_USECS_HIGH], "tx-usecs-high: ");
 	show_u32(tb[ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH], "tx-frame-high: ");
 	putchar('\n');
+	show_bool("rx", "CQE mode RX: %s  ",
+		  tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX]);
+	show_bool("tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX]);
 
 	return MNL_CB_OK;
 }
@@ -226,6 +229,18 @@  static const struct param_parser scoalesce_params[] = {
 		.handler	= nl_parse_direct_u32,
 		.min_argc	= 1,
 	},
+	{
+		.arg		= "cqe-mode-rx",
+		.type		= ETHTOOL_A_COALESCE_USE_CQE_MODE_RX,
+		.handler	= nl_parse_u8bool,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "cqe-mode-tx",
+		.type		= ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,
+		.handler	= nl_parse_u8bool,
+		.min_argc	= 1,
+	},
 	{}
 };