diff mbox series

[ethtool-next,v2,2/2] ethtool: add support to get/set tx push by ethtool -G/g

Message ID 20220421084646.15458-3-huangguangbin2@huawei.com (mailing list archive)
State Superseded
Delegated to: Michal Kubecek
Headers show
Series Add support to get/set tx push by ethtool -G/g | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Guangbin Huang April 21, 2022, 8:46 a.m. UTC
From: Jie Wang <wangjie125@huawei.com>

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 <dev> tx-push on|off" and
"ethtool -g <dev>" to set/get tx push mode.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
---
 ethtool.8.in    | 4 ++++
 ethtool.c       | 1 +
 netlink/rings.c | 7 +++++++
 3 files changed, 12 insertions(+)

Comments

sundeep subbaraya April 27, 2022, 1:46 p.m. UTC | #1
Hi Guangbin,

On Thu, Apr 21, 2022 at 3:47 PM Guangbin Huang
<huangguangbin2@huawei.com> wrote:
>
> From: Jie Wang <wangjie125@huawei.com>
>
> 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 <dev> tx-push on|off" and
> "ethtool -g <dev>" to set/get tx push mode.
>
> Signed-off-by: Jie Wang <wangjie125@huawei.com>
> ---
>  ethtool.8.in    | 4 ++++
>  ethtool.c       | 1 +
>  netlink/rings.c | 7 +++++++
>  3 files changed, 12 insertions(+)
>
> diff --git a/ethtool.8.in b/ethtool.8.in
> index 12940e1..a87f31f 100644
> --- a/ethtool.8.in
> +++ b/ethtool.8.in
> @@ -199,6 +199,7 @@ ethtool \- query or control network driver and hardware settings
>  .BN rx\-jumbo
>  .BN tx
>  .BN rx\-buf\-len
> +.BN tx\-push
>  .HP
>  .B ethtool \-i|\-\-driver
>  .I devname
> @@ -573,6 +574,9 @@ 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 4f5c234..4d2a475 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -5733,6 +5733,7 @@ static const struct option args[] = {
>                           "             [ rx-jumbo N ]\n"
>                           "             [ tx 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..a53eed5 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       = 0,

Why min_argc is 0 ? Thanks for syncing kernel headers. I have patch for adding
cqe-size command and will send after these are merged.

Sundeep
> +       },
>         {}
>  };
>
> --
> 2.33.0
>
wangjie (L) April 28, 2022, 11:54 a.m. UTC | #2
On 2022/4/27 21:46, sundeep subbaraya wrote:
> Hi Guangbin,
>
> On Thu, Apr 21, 2022 at 3:47 PM Guangbin Huang
> <huangguangbin2@huawei.com> wrote:
>>
>> From: Jie Wang <wangjie125@huawei.com>
>>
>> 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 <dev> tx-push on|off" and
>> "ethtool -g <dev>" to set/get tx push mode.
>>
>> Signed-off-by: Jie Wang <wangjie125@huawei.com>
>> ---
>>  ethtool.8.in    | 4 ++++
>>  ethtool.c       | 1 +
>>  netlink/rings.c | 7 +++++++
>>  3 files changed, 12 insertions(+)
>>
>> diff --git a/ethtool.8.in b/ethtool.8.in
>> index 12940e1..a87f31f 100644
>> --- a/ethtool.8.in
>> +++ b/ethtool.8.in
>> @@ -199,6 +199,7 @@ ethtool \- query or control network driver and hardware settings
>>  .BN rx\-jumbo
>>  .BN tx
>>  .BN rx\-buf\-len
>> +.BN tx\-push
>>  .HP
>>  .B ethtool \-i|\-\-driver
>>  .I devname
>> @@ -573,6 +574,9 @@ 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 4f5c234..4d2a475 100644
>> --- a/ethtool.c
>> +++ b/ethtool.c
>> @@ -5733,6 +5733,7 @@ static const struct option args[] = {
>>                           "             [ rx-jumbo N ]\n"
>>                           "             [ tx 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..a53eed5 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       = 0,
>
> Why min_argc is 0 ? Thanks for syncing kernel headers. I have patch for adding
> cqe-size command and will send after these are merged.
>
> Sundeep

Good catch. I checked this parameter,it should be 1. I misunderstood the 
meaning of this parameter.

>> +       },
>>         {}
>>  };
>>
>> --
>> 2.33.0
>>
>
> .
>
wangjie (L) April 28, 2022, 11:56 a.m. UTC | #3
On 2022/4/27 21:46, sundeep subbaraya wrote:
> Hi Guangbin,
>
> On Thu, Apr 21, 2022 at 3:47 PM Guangbin Huang
> <huangguangbin2@huawei.com> wrote:
>>
>> From: Jie Wang <wangjie125@huawei.com>
>>
>> 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 <dev> tx-push on|off" and
>> "ethtool -g <dev>" to set/get tx push mode.
>>
>> Signed-off-by: Jie Wang <wangjie125@huawei.com>
>> ---
>>  ethtool.8.in    | 4 ++++
>>  ethtool.c       | 1 +
>>  netlink/rings.c | 7 +++++++
>>  3 files changed, 12 insertions(+)
>>
>> diff --git a/ethtool.8.in b/ethtool.8.in
>> index 12940e1..a87f31f 100644
>> --- a/ethtool.8.in
>> +++ b/ethtool.8.in
>> @@ -199,6 +199,7 @@ ethtool \- query or control network driver and hardware settings
>>  .BN rx\-jumbo
>>  .BN tx
>>  .BN rx\-buf\-len
>> +.BN tx\-push
>>  .HP
>>  .B ethtool \-i|\-\-driver
>>  .I devname
>> @@ -573,6 +574,9 @@ 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 4f5c234..4d2a475 100644
>> --- a/ethtool.c
>> +++ b/ethtool.c
>> @@ -5733,6 +5733,7 @@ static const struct option args[] = {
>>                           "             [ rx-jumbo N ]\n"
>>                           "             [ tx 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..a53eed5 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       = 0,
>
> Why min_argc is 0 ? Thanks for syncing kernel headers. I have patch for adding
> cqe-size command and will send after these are merged.
>
> Sundeep
I will revise it in v2.
>> +       },
>>         {}
>>  };
>>
>> --
>> 2.33.0
>>
>
> .
>
diff mbox series

Patch

diff --git a/ethtool.8.in b/ethtool.8.in
index 12940e1..a87f31f 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -199,6 +199,7 @@  ethtool \- query or control network driver and hardware settings
 .BN rx\-jumbo
 .BN tx
 .BN rx\-buf\-len
+.BN tx\-push
 .HP
 .B ethtool \-i|\-\-driver
 .I devname
@@ -573,6 +574,9 @@  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 4f5c234..4d2a475 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5733,6 +5733,7 @@  static const struct option args[] = {
 			  "		[ rx-jumbo N ]\n"
 			  "		[ tx 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..a53eed5 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       = 0,
+	},
 	{}
 };