Skip to contentSkip to conversation

fix bugs for ethtool APP

PATCH Superseded Min Hu (Connor) 3 participants 17 messages Apr 8, 2021 – Nov 17, 2021

lore
Share & tools
lore
#0 lore raw

cover fix bugs for ethtool APP

This patch fixed fix bugs for ethtool APP.

Chengwen Feng (1):
examples/ethtool: fix Rx/Tx queue setup with rte socket id

Huisong Li (1):
examples/ethtool: add closing port operation

 examples/ethtool/ethtool-app/main.c | 23 +++++++++++++++++++++++
 examples/ethtool/lib/rte_ethtool.c  |  4 ++--
 2 files changed, 25 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 examples/ethtool: fix Rx/Tx queue setup with rte socket id

From: Chengwen Feng <[email protected]>

The ethtool use the socket_id which get from rte_eth_dev_socket_id API in the init stage, but use the rte_socket_id API to get socket_id when setting ringparam.

This patch make sure it call rte_eth_dev_socket_id API to get socket_id when setting ringparam.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/lib/rte_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ethtool/lib/rte_ethtool.c +2 -2
index 4132516..b2e45f5 100644
@@ -465,12 +465,12 @@ rte_ethtool_set_ringparam(uint16_t port_id,
 		return stat;
 
 	stat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,
-		rte_socket_id(), NULL);
+		rte_eth_dev_socket_id(port_id), NULL);
 	if (stat != 0)
 		return stat;
 
 	stat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending,
-		rte_socket_id(), NULL, rx_qinfo.mp);
+		rte_eth_dev_socket_id(port_id), NULL, rx_qinfo.mp);
 	if (stat != 0)
 		return stat;
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] examples/ethtool: fix Rx/Tx queue setup with rte socket id

08/04/2021 12:14, Min Hu (Connor):

Quoted 11 lines

From: Chengwen Feng <[email protected]>

The ethtool use the socket_id which get from rte_eth_dev_socket_id API in the init stage, but use the rte_socket_id API to get socket_id when setting ringparam.

This patch make sure it call rte_eth_dev_socket_id API to get socket_id when setting ringparam.

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

The explanation is missing something.
Please tell why it is wrong.

#3 lore raw

Re: [dpdk-dev] [PATCH 1/2] examples/ethtool: fix Rx/Tx queue setup with rte socket id

Quoted 7 lines · Thomas Monjalon

08/04/2021 12:14, Min Hu (Connor):

Quoted 6 lines

From: Chengwen Feng <[email protected]>

The ethtool use the socket_id which get from rte_eth_dev_socket_id API in the init stage, but use the rte_socket_id API to get socket_id when setting ringparam.

Quoted 10 lines
Quoted 5 lines

This patch make sure it call rte_eth_dev_socket_id API to get socket_id when setting ringparam.

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

The explanation is missing something.
Please tell why it is wrong.

Hi, Thomas,
It is advised that bind queue resources to the NUMA node where the device resides, not the NUMA node corresponding to the thread where the command line resides. And that will be better.

Quoted 3 lines

.

#4 lore raw

Re: [dpdk-dev] [PATCH 1/2] examples/ethtool: fix Rx/Tx queue setup with rte socket id

20/04/2021 11:05, Min Hu (Connor):

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

08/04/2021 12:14, Min Hu (Connor):

Quoted 11 lines

From: Chengwen Feng <[email protected]>

The ethtool use the socket_id which get from rte_eth_dev_socket_id API in the init stage, but use the rte_socket_id API to get socket_id when setting ringparam.

This patch make sure it call rte_eth_dev_socket_id API to get socket_id when setting ringparam.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
Quoted 8 lines
Quoted 4 lines

The explanation is missing something.
Please tell why it is wrong.

Hi, Thomas,
It is advised that bind queue resources to the NUMA node where the device resides, not the NUMA node corresponding to the thread where the command line resides. And that will be better.

I know, but in the commit message, you give function name without saying that rte_socket_id is the running socket while rte_eth_dev_socket_id is the device socket.

Please make your commit messages more obvious for anyone reading. Story telling is usually a good approach.

#5 lore raw

PATCH 2/2 examples/ethtool: add closing port operation

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/ethtool-app/main.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
examples/ethtool/ethtool-app/main.c +23 -0
index c6023a1..adabe6e 100644
@@ -256,6 +256,27 @@ static int worker_main(__rte_unused void *ptr_data)
 	return 0;
 }
 
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
+	}
+
+	ret = rte_eal_cleanup();
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n",
+			 strerror(-ret));
+}
+
 int main(int argc, char **argv)
 {
 	int cnt_args_parsed;
@@ -299,5 +320,7 @@ int main(int argc, char **argv)
 			return -1;
 	}
 
+	close_ports();
+
 	return 0;
 }
Signature · 1 line
2.7.4
#6 lore raw

Re: [dpdk-dev] [PATCH 2/2] examples/ethtool: add closing port operation

08/04/2021 12:14, Min Hu (Connor):

Quoted 25 lines

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

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

---

examples/ethtool/ethtool-app/main.c +9 -0
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)

examples/ethtool/ethtool-app/main.c static int worker_main(__rte_unused void *ptr_data) · line 277

Quoted 10 lines
examples/ethtool/ethtool-app/main.c +10 -0
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
+	}
+
+	ret = rte_eal_cleanup();
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n",
+			 strerror(-ret));

It would be better to add EAL cleanup in the main function.

#7 lore raw

Re: [dpdk-dev] [PATCH 2/2] examples/ethtool: add closing port operation

Quoted 30 lines · Thomas Monjalon

08/04/2021 12:14, Min Hu (Connor):

Quoted 29 lines

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

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

---

examples/ethtool/ethtool-app/main.c +13 -0
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
Quoted 9 lines

examples/ethtool/ethtool-app/main.c static int worker_main(__rte_unused void *ptr_data) · line 277

Quoted 6 lines
examples/ethtool/ethtool-app/main.c +6 -0
+	}
+
+	ret = rte_eal_cleanup();
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n",
+			 strerror(-ret));

It would be better to add EAL cleanup in the main function.

Hi, Thomas,
It has already been done in this patch: "examples: add eal
cleanup to examples", please check it out, thanks.

Quoted 3 lines

.

#8 lore raw

Re: [dpdk-dev] [PATCH 2/2] examples/ethtool: add closing port operation

20/04/2021 11:10, Min Hu (Connor):

Quoted 41 lines · Thomas Monjalon
Quoted 30 lines

08/04/2021 12:14, Min Hu (Connor):

Quoted 29 lines

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

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

---

examples/ethtool/ethtool-app/main.c +13 -0
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
Quoted 9 lines

examples/ethtool/ethtool-app/main.c static int worker_main(__rte_unused void *ptr_data) · line 277

Quoted 6 lines
examples/ethtool/ethtool-app/main.c +6 -0
+	}
+
+	ret = rte_eal_cleanup();
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n",
+			 strerror(-ret));

It would be better to add EAL cleanup in the main function.

Quoted 3 lines

Hi, Thomas,
It has already been done in this patch: "examples: add eal
cleanup to examples", please check it out, thanks.

So why adding it in this patch about ethdev close?

#9 lore raw

v2 cover fix bugs for ethtool APP

In reply to Min Hu (Connor)

This patch fixed fix bugs for ethtool APP.

Chengwen Feng (1):
examples/ethtool: fix Rx/Tx queue setup with rte socket id

Huisong Li (1):
examples/ethtool: add closing port operation

 examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++
 examples/ethtool/lib/rte_ethtool.c  |  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

---
v2:
* modified commit info.
add close port operation.

Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 1/2 examples/ethtool: fix Rx/Tx queue setup with rte socket id

From: Chengwen Feng <[email protected]>

In DPDK, 'rte_socket_id' means the running socket while 'rte_eth_dev_socket_id' is the device socket. For better performance, memory which queue setup used and device should be in the same socket.

This patch make sure it calls rte_eth_dev_socket_id API to get device socket_id when setting ringparam.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/lib/rte_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ethtool/lib/rte_ethtool.c +2 -2
index 4132516..b2e45f5 100644
@@ -465,12 +465,12 @@ rte_ethtool_set_ringparam(uint16_t port_id,
 		return stat;
 
 	stat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,
-		rte_socket_id(), NULL);
+		rte_eth_dev_socket_id(port_id), NULL);
 	if (stat != 0)
 		return stat;
 
 	stat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending,
-		rte_socket_id(), NULL, rx_qinfo.mp);
+		rte_eth_dev_socket_id(port_id), NULL, rx_qinfo.mp);
 	if (stat != 0)
 		return stat;
 
Signature · 1 line
2.7.4
#11 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] examples/ethtool: fix Rx/Tx queue setup with rte socket id

Hi, Thomas,
any comments?

Quoted 38 lines · Min Hu (Connor)

From: Chengwen Feng <[email protected]>

In DPDK, 'rte_socket_id' means the running socket while 'rte_eth_dev_socket_id' is the device socket. For better performance, memory which queue setup used and device should be in the same socket.

This patch make sure it calls rte_eth_dev_socket_id API to get device socket_id when setting ringparam.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
  examples/ethtool/lib/rte_ethtool.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
examples/ethtool/lib/rte_ethtool.c +2 -2
index 4132516..b2e45f5 100644
@@ -465,12 +465,12 @@ rte_ethtool_set_ringparam(uint16_t port_id,
  		return stat;
 
  	stat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,
-		rte_socket_id(), NULL);
+		rte_eth_dev_socket_id(port_id), NULL);
  	if (stat != 0)
  		return stat;
 
  	stat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending,
-		rte_socket_id(), NULL, rx_qinfo.mp);
+		rte_eth_dev_socket_id(port_id), NULL, rx_qinfo.mp);
  	if (stat != 0)
  		return stat;
 
#12 lore raw

PATCH v2 2/2 examples/ethtool: add closing port operation

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
examples/ethtool/ethtool-app/main.c +18 -0
index 21ed85c..9ac0a44 100644
@@ -256,6 +256,22 @@ static int worker_main(__rte_unused void *ptr_data)
 	return 0;
 }
 
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
+	}
+}
+
 int main(int argc, char **argv)
 {
 	int cnt_args_parsed;
@@ -299,6 +315,8 @@ int main(int argc, char **argv)
 			return -1;
 	}
 
+	close_ports();
+
 	/* clean up the EAL */
 	rte_eal_cleanup();
 
Signature · 1 line
2.7.4
#13 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] examples/ethtool: add closing port operation

Hi, Ferruh,
any comments?

Quoted 54 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
  examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
examples/ethtool/ethtool-app/main.c +18 -0
index 21ed85c..9ac0a44 100644
@@ -256,6 +256,22 @@ static int worker_main(__rte_unused void *ptr_data)
  	return 0;
  }
 
+static void close_ports(void)
+{
+	uint16_t portid;
+	int ret;
+
+	for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
+		printf("Closing port %d...", portid);
+		ret = rte_eth_dev_stop(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n",
+				 strerror(-ret), portid);
+		rte_eth_dev_close(portid);
+		printf(" Done\n");
+	}
+}
+
  int main(int argc, char **argv)
  {
  	int cnt_args_parsed;
@@ -299,6 +315,8 @@ int main(int argc, char **argv)
  			return -1;
  	}
 
+	close_ports();
+
  	/* clean up the EAL */
  	rte_eal_cleanup();
 
#14 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] examples/ethtool: add closing port operation

In reply to Min Hu (Connor)
Quoted 11 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, ethtool directly ends the process after 'quit' cmd. In this case, software resources are not released and hardware resources of the device are not uninstalled.

This patch adds closing port operation to release resources.

I see nothing wrong with series and there was no objection. Series applied, thanks.

Signature · 1 line
David Marchand
#15 lore raw
In reply to Min Hu (Connor)

Hi, all,
any comments?

Quoted 16 lines · Min Hu (Connor)

This patch fixed fix bugs for ethtool APP.

Chengwen Feng (1):
examples/ethtool: fix Rx/Tx queue setup with rte socket id

Huisong Li (1):
examples/ethtool: add closing port operation

  examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++
  examples/ethtool/lib/rte_ethtool.c  |  4 ++--
  2 files changed, 20 insertions(+), 2 deletions(-)

---
v2:
* modified commit info.
add close port operation.

#16 lore raw

Hi, all,
any comments?

Quoted 21 lines · Min Hu (Connor)

Hi, all,
    any comments?

Quoted 8 lines · Min Hu (Connor)

This patch fixed fix bugs for ethtool APP.

Chengwen Feng (1):
   examples/ethtool: fix Rx/Tx queue setup with rte socket id

Huisong Li (1):
   examples/ethtool: add closing port operation

Quoted 8 lines

  examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++++ examples/ethtool/lib/rte_ethtool.c  |  4 ++--

  2 files changed, 20 insertions(+), 2 deletions(-)

---
v2:
* modified commit info.
   add close port operation.

.