patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Huisong Li <lihuisong@huawei.com>
Cc: Min Hu <humin29@huawei.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'examples/ethtool: fix pause configuration' has been queued to stable release 21.11.6
Date: Thu,  7 Dec 2023 11:21:02 +0000	[thread overview]
Message-ID: <20231207112116.769502-10-ktraynor@redhat.com> (raw)
In-Reply-To: <20231207112116.769502-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 21.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/12/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/83eafb94412e089831db4793fd0344000b0da42b

Thanks.

Kevin

---
From 83eafb94412e089831db4793fd0344000b0da42b Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Fri, 10 Nov 2023 11:30:39 +0800
Subject: [PATCH] examples/ethtool: fix pause configuration

[ upstream commit 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f ]

Currently, the pause command in ethtool to enable Rx/Tx pause has the
following problem. Namely, Assume that the device supports flow control
auto-negotiation to set pause parameters, which will the device that does
not support flow control auto-negotiation fails to run this command.

This patch supports the configuration of flow control auto-negotiation
and fixes the print format and style of the pause cmd to make it more
readable.

Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/ethtool/ethtool-app/ethapp.c | 63 ++++++++++++++++-----------
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 78e86534e8..435d266bbc 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -50,4 +50,11 @@ struct pcmd_intintint_params {
 };
 
+struct pcmd_pause_params {
+	cmdline_fixed_string_t cmd;
+	uint16_t port;
+	cmdline_fixed_string_t mode;
+	cmdline_fixed_string_t autoneg;
+	cmdline_fixed_string_t an_status;
+};
 
 /* Parameter-less commands */
@@ -117,10 +124,16 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx =
 /* Pause commands */
 cmdline_parse_token_string_t pcmd_pause_token_cmd =
-	TOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, "pause");
+	TOKEN_STRING_INITIALIZER(struct pcmd_pause_params, cmd, "pause");
 cmdline_parse_token_num_t pcmd_pause_token_port =
-	TOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, RTE_UINT16);
-cmdline_parse_token_string_t pcmd_pause_token_opt =
-	TOKEN_STRING_INITIALIZER(struct pcmd_intstr_params,
-		opt, "all#tx#rx#none");
+	TOKEN_NUM_INITIALIZER(struct pcmd_pause_params, port, RTE_UINT16);
+cmdline_parse_token_string_t pcmd_pause_token_mode =
+	TOKEN_STRING_INITIALIZER(struct pcmd_pause_params,
+		mode, "full#tx#rx#none");
+cmdline_parse_token_string_t pcmd_pause_token_autoneg =
+	TOKEN_STRING_INITIALIZER(struct pcmd_pause_params,
+		autoneg, "autoneg");
+cmdline_parse_token_string_t pcmd_pause_token_an_status =
+	TOKEN_STRING_INITIALIZER(struct pcmd_pause_params,
+		an_status, "on#off");
 
 /* VLAN commands */
@@ -349,5 +362,4 @@ pcmd_module_eeprom_callback(void *ptr_params,
 }
 
-
 static void
 pcmd_pause_callback(void *ptr_params,
@@ -355,5 +367,5 @@ pcmd_pause_callback(void *ptr_params,
 	void *ptr_data)
 {
-	struct pcmd_intstr_params *params = ptr_params;
+	struct pcmd_pause_params *params = ptr_params;
 	struct ethtool_pauseparam info;
 	int stat;
@@ -367,11 +379,11 @@ pcmd_pause_callback(void *ptr_params,
 	} else {
 		memset(&info, 0, sizeof(info));
-		if (strcasecmp("all", params->opt) == 0) {
+		if (strcasecmp("full", params->mode) == 0) {
 			info.tx_pause = 1;
 			info.rx_pause = 1;
-		} else if (strcasecmp("tx", params->opt) == 0) {
+		} else if (strcasecmp("tx", params->mode) == 0) {
 			info.tx_pause = 1;
 			info.rx_pause = 0;
-		} else if (strcasecmp("rx", params->opt) == 0) {
+		} else if (strcasecmp("rx", params->mode) == 0) {
 			info.tx_pause = 0;
 			info.rx_pause = 1;
@@ -380,17 +392,17 @@ pcmd_pause_callback(void *ptr_params,
 			info.rx_pause = 0;
 		}
-		/* Assume auto-negotiation wanted */
-		info.autoneg = 1;
-		stat = rte_ethtool_set_pauseparam(params->port, &info);
-	}
-	if (stat == 0) {
-		if (info.rx_pause && info.tx_pause)
-			printf("Port %i: Tx & Rx Paused\n", params->port);
-		else if (info.rx_pause)
-			printf("Port %i: Rx Paused\n", params->port);
-		else if (info.tx_pause)
-			printf("Port %i: Tx Paused\n", params->port);
+
+		if (strcasecmp("on", params->an_status) == 0)
+			info.autoneg = 1;
 		else
-			printf("Port %i: Tx & Rx not paused\n", params->port);
+			info.autoneg = 0;
+
+		stat = rte_ethtool_set_pauseparam(params->port, &info);
+	}
+	if (stat == 0) {
+		printf("Pause parameters for Port %i:\n", params->port);
+		printf("Rx pause: %s\n", info.rx_pause ? "on" : "off");
+		printf("Tx pause: %s\n", info.tx_pause ? "on" : "off");
+		printf("Autoneg: %s\n", info.autoneg ? "on" : "off");
 	} else if (stat == -ENOTSUP)
 		printf("Port %i: Operation not supported\n", params->port);
@@ -399,5 +411,4 @@ pcmd_pause_callback(void *ptr_params,
 }
 
-
 static void
 pcmd_open_callback(__rte_unused void *ptr_params,
@@ -736,9 +747,11 @@ cmdline_parse_inst_t pcmd_pause = {
 	.data = NULL,
 	.help_str =
-		"pause <port_id> <all|tx|rx|none>\n     Pause/unpause port",
+		"pause <port_id> <full|tx|rx|none> autoneg <on|off>\n     Pause/unpause port",
 	.tokens = {
 		(void *)&pcmd_pause_token_cmd,
 		(void *)&pcmd_pause_token_port,
-		(void *)&pcmd_pause_token_opt,
+		(void *)&pcmd_pause_token_mode,
+		(void *)&pcmd_pause_token_autoneg,
+		(void *)&pcmd_pause_token_an_status,
 		NULL
 	},
-- 
2.43.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-12-07 11:18:59.859122268 +0000
+++ 0010-examples-ethtool-fix-pause-configuration.patch	2023-12-07 11:18:59.621873907 +0000
@@ -1 +1 @@
-From 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f Mon Sep 17 00:00:00 2001
+From 83eafb94412e089831db4793fd0344000b0da42b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f ]
+
@@ -16 +17,0 @@
-Cc: stable@dpdk.org
@@ -26 +27 @@
-index 4ea504ed6a..489cd4f515 100644
+index 78e86534e8..435d266bbc 100644
@@ -29 +30 @@
-@@ -52,4 +52,11 @@ struct pcmd_intintint_params {
+@@ -50,4 +50,11 @@ struct pcmd_intintint_params {
@@ -41 +42 @@
-@@ -119,10 +126,16 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx =
+@@ -117,10 +124,16 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx =
@@ -63 +64 @@
-@@ -351,5 +364,4 @@ pcmd_module_eeprom_callback(void *ptr_params,
+@@ -349,5 +362,4 @@ pcmd_module_eeprom_callback(void *ptr_params,
@@ -69 +70 @@
-@@ -357,5 +369,5 @@ pcmd_pause_callback(void *ptr_params,
+@@ -355,5 +367,5 @@ pcmd_pause_callback(void *ptr_params,
@@ -76 +77 @@
-@@ -369,11 +381,11 @@ pcmd_pause_callback(void *ptr_params,
+@@ -367,11 +379,11 @@ pcmd_pause_callback(void *ptr_params,
@@ -91 +92 @@
-@@ -382,17 +394,17 @@ pcmd_pause_callback(void *ptr_params,
+@@ -380,17 +392,17 @@ pcmd_pause_callback(void *ptr_params,
@@ -121 +122 @@
-@@ -401,5 +413,4 @@ pcmd_pause_callback(void *ptr_params,
+@@ -399,5 +411,4 @@ pcmd_pause_callback(void *ptr_params,
@@ -127 +128 @@
-@@ -738,9 +749,11 @@ cmdline_parse_inst_t pcmd_pause = {
+@@ -736,9 +747,11 @@ cmdline_parse_inst_t pcmd_pause = {


  parent reply	other threads:[~2023-12-07 11:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 11:20 patch 'net/txgbe: fix out of bound access' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix hns3 build option about max queue number' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update features in hns3 guide' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix RSS flow description " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update versions recommendations for i40e and ice' " Kevin Traynor
2023-12-07 11:20 ` patch 'examples/ipsec-secgw: fix partial overflow' " Kevin Traynor
2023-12-07 11:20 ` patch 'eal/windows: fix build with recent MinGW' " Kevin Traynor
2023-12-07 11:21 ` patch 'pdump: fix error number on IPC response' " Kevin Traynor
2023-12-07 11:21 ` patch 'app/dumpcap: allow multiple invocations' " Kevin Traynor
2023-12-07 11:21 ` Kevin Traynor [this message]
2023-12-07 11:21 ` patch 'test/hash: fix creation error log' " Kevin Traynor
2023-12-07 11:21 ` patch 'app/pipeline: add sigint handler' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove restriction on ixgbe vector support' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: fix some ordered lists' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove number of commands in vDPA guide' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: fix get function documentation' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: clarify enqueue/dequeue ops " Kevin Traynor
2023-12-07 11:21 ` patch 'ethdev: fix ESP packet type description' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix ignored reset event' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix reset event status' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix VF reset handler interruption' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/af_xdp: make compatible with libbpf 0.8.0' " Kevin Traynor
2023-12-07 14:16   ` Kevin Traynor
2023-12-11 12:44     ` Loftus, Ciara
2023-12-11 15:27       ` Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231207112116.769502-10-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=humin29@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).