Skip to contentSkip to conversation

app/test-pmd: fix testpmd log of start command

PATCH Superseded Bernard Iremonger 2 participants 11 messages May 15, 2018 – May 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test-pmd: fix testpmd log of start command

In the testpmd log of the start command, show the RX and TX descriptor values from dev_info instead of the default values.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index 1344016..5b00f7f 100644
@@ -2308,7 +2308,7 @@ struct pmd_test_command {
 		if (rx_drop_en != RTE_PMD_PARAM_UNSET)
 			port->rx_conf[qid].rx_drop_en = rx_drop_en;
 
-		port->nb_rx_desc[qid] = nb_rxd;
+		port->nb_rx_desc[qid] = port->dev_info.rx_desc_lim.nb_max;
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
@@ -2330,7 +2330,7 @@ struct pmd_test_command {
 		if (tx_free_thresh != RTE_PMD_PARAM_UNSET)
 			port->tx_conf[qid].tx_free_thresh = tx_free_thresh;
 
-		port->nb_tx_desc[qid] = nb_txd;
+		port->nb_tx_desc[qid] = port->dev_info.tx_desc_lim.nb_max;
 	}
 }
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · Bernard Iremonger

In the testpmd log of the start command, show the RX and TX descriptor values from dev_info instead of the default values.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +0 -0
index 1344016..5b00f7f 100644

app/test-pmd/testpmd.c struct pmd_test_command { · line 2311

Quoted 5 lines
app/test-pmd/testpmd.c +1 -1
@@ -2308,7 +2308,7 @@ struct pmd_test_command {
 		if (rx_drop_en != RTE_PMD_PARAM_UNSET)
 			port->rx_conf[qid].rx_drop_en = rx_drop_en;
 
-		port->nb_rx_desc[qid] = nb_rxd;
+		port->nb_rx_desc[qid] = port->dev_info.rx_desc_lim.nb_max;

Hi Bernard,

"rx_desc_lim.nb_max" is not the value we want here.

Also we shouldn't concern what dev_info returns but what is the number device is configured.

Quoted 13 lines
app/test-pmd/testpmd.c +1 -1
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
@@ -2330,7 +2330,7 @@ struct pmd_test_command {
 		if (tx_free_thresh != RTE_PMD_PARAM_UNSET)
 			port->tx_conf[qid].tx_free_thresh = tx_free_thresh;
 
-		port->nb_tx_desc[qid] = nb_txd;
+		port->nb_tx_desc[qid] = port->dev_info.tx_desc_lim.nb_max;
 	}
 }
 
#2 lore raw

PATCH v2 1/1 app/testpmd: fix log of start command

In reply to Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors in the rte_port variable.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/testpmd.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +15 -1
index 1d308f0..293b2a5 100644
@@ -1592,6 +1592,9 @@ static void eth_dev_event_callback(char *device_name,
 	struct rte_port *port;
 	struct ether_addr mac_addr;
 	enum rte_eth_event_type event_type;
+	struct rte_eth_rxq_info rx_qinfo;
+	struct rte_eth_txq_info tx_qinfo;
+	int32_t rc;
 
 	if (port_id_is_invalid(pid, ENABLED_WARN))
 		return 0;
@@ -1706,8 +1709,19 @@ static void eth_dev_event_callback(char *device_name,
 					     &(port->rx_conf[qi]),
 					     mp);
 				}
-				if (diag == 0)
+				if (diag == 0) {
+					rc = rte_eth_rx_queue_info_get(pi, qi,
+						&rx_qinfo);
+					if (!rc)
+						port->nb_rx_desc[qi] =
+							rx_qinfo.nb_desc;
+					rc = rte_eth_tx_queue_info_get(pi, qi,
+						&tx_qinfo);
+					if (!rc)
+						port->nb_tx_desc[qi] =
+							tx_qinfo.nb_desc;
 					continue;
+				}
 
 				/* Fail to setup rx queue, return */
 				if (rte_atomic16_cmpset(&(port->port_status),
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH v2] app/testpmd: fix log of start command

Quoted 30 lines · Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors in the rte_port variable.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/testpmd.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +4 -1
index 1d308f0..293b2a5 100644
@@ -1592,6 +1592,9 @@ static void eth_dev_event_callback(char *device_name,
 	struct rte_port *port;
 	struct ether_addr mac_addr;
 	enum rte_eth_event_type event_type;
+	struct rte_eth_rxq_info rx_qinfo;
+	struct rte_eth_txq_info tx_qinfo;
+	int32_t rc;
 
 	if (port_id_is_invalid(pid, ENABLED_WARN))
 		return 0;
@@ -1706,8 +1709,19 @@ static void eth_dev_event_callback(char *device_name,
 					     &(port->rx_conf[qi]),
 					     mp);
 				}
-				if (diag == 0)
+				if (diag == 0) {

app/test-pmd/testpmd.c static void eth_dev_event_callback(char *device_name, · line 1722

Quoted 10 lines
app/test-pmd/testpmd.c +10 -0
+					rc = rte_eth_rx_queue_info_get(pi, qi,
+						&rx_qinfo);
+					if (!rc)
+						port->nb_rx_desc[qi] =
+							rx_qinfo.nb_desc;
+					rc = rte_eth_tx_queue_info_get(pi, qi,
+						&tx_qinfo);
+					if (!rc)
+						port->nb_tx_desc[qi] =
+							tx_qinfo.nb_desc;

Hi Bernard,

port->nb_rx_desc[qi] and port->nb_tx_desc[qi] are intentionally set to zero, to be able to use PMD provided values, assigning value to them will break that logic.

Instead of updating these values, what about using same information on print only?

#4 lore raw

Re: [PATCH v2] app/testpmd: fix log of start command

Hi Ferruh,

Quoted 54 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 21, 2018 3:16 PM
To: Iremonger, Bernard <[email protected]>; [email protected]
Subject: Re: [PATCH v2] app/testpmd: fix log of start command

app/test-pmd/testpmd.c static void eth_dev_event_callback(char

Quoted 15 lines · Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors in the rte_port variable.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/testpmd.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

1d308f0..293b2a5 100644

app/test-pmd/testpmd.c +0 -0
@@ -1592,6 +1592,9 @@ static void eth_dev_event_callback(char

*device_name,

app/test-pmd/testpmd.c static void eth_dev_event_callback(char

Quoted 10 lines
app/test-pmd/testpmd.c +3 -0
 	struct rte_port *port;
 	struct ether_addr mac_addr;
 	enum rte_eth_event_type event_type;
+	struct rte_eth_rxq_info rx_qinfo;
+	struct rte_eth_txq_info tx_qinfo;
+	int32_t rc;
 
 	if (port_id_is_invalid(pid, ENABLED_WARN))
 		return 0;
@@ -1706,8 +1709,19 @@ static void eth_dev_event_callback(char

*device_name,

app/test-pmd/testpmd.c static void eth_dev_event_callback(char *device_name,

Quoted 6 lines
app/test-pmd/testpmd.c +2 -1
 					     &(port->rx_conf[qi]),
 					     mp);
 				}
-				if (diag == 0)
+				if (diag == 0) {
+					rc = rte_eth_rx_queue_info_get(pi,

qi,

app/test-pmd/testpmd.c static void eth_dev_event_callback(char *device_name,

Quoted 5 lines
app/test-pmd/testpmd.c +5 -0
+						&rx_qinfo);
+					if (!rc)
+						port->nb_rx_desc[qi] =
+							rx_qinfo.nb_desc;
+					rc = rte_eth_tx_queue_info_get(pi,

qi,

app/test-pmd/testpmd.c static void eth_dev_event_callback(char *device_name, · line 1722

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+						&tx_qinfo);
+					if (!rc)
+						port->nb_tx_desc[qi] =
+							tx_qinfo.nb_desc;

Hi Bernard,

Quoted 7 lines

port->nb_rx_desc[qi] and port->nb_tx_desc[qi] are intentionally set to port->zero, to
be able to use PMD provided values, assigning value to them will break that logic.

Instead of updating these values, what about using same information on print only?

I don't think this fix is breaking any logic, as the nb_rx_desc[qi] and nb_tx_desc[qi] values are not being updated until after the rx and tx queues have been configured using the original values. The nb_rxd and nb_txd values assigned to nb_rx_desc[qi] and nb_tx_desc[qi] are initialised to 0 but can be initialised to other vallues from the command line.

I will investigate using the updated values in the print only to avoid any risk.

Regards,

Bernard.

#5 lore raw

PATCH v3 1/1 app/testpmd: fix log of start command

In reply to Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/config.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
app/test-pmd/config.c +11 -0
index 4520084..339651f 100644
@@ -1839,6 +1839,9 @@ struct igb_ring_desc_16_bytes {
 		struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
 		uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
 		uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
+		struct rte_eth_rxq_info rx_qinfo;
+		struct rte_eth_txq_info tx_qinfo;
+		int32_t rc;
 
 		/* per port config */
 		printf("  port %d: RX queue number: %d Tx queue number: %d\n",
@@ -1850,6 +1853,10 @@ struct igb_ring_desc_16_bytes {
 
 		/* per rx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
+			if (!rc)
+				nb_rx_desc[qid] = rx_qinfo.nb_desc;
+
 			printf("    RX queue: %d\n", qid);
 			printf("      RX desc=%d - RX free threshold=%d\n",
 				nb_rx_desc[qid], rx_conf[qid].rx_free_thresh);
@@ -1864,6 +1871,10 @@ struct igb_ring_desc_16_bytes {
 
 		/* per tx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
+			if (!rc)
+				nb_tx_desc[qid] = tx_qinfo.nb_desc;
+
 			printf("    TX queue: %d\n", qid);
 			printf("      TX desc=%d - TX free threshold=%d\n",
 				nb_tx_desc[qid], tx_conf[qid].tx_free_thresh);
Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH v3] app/testpmd: fix log of start command

Quoted 24 lines · Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/config.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
app/test-pmd/config.c +3 -0
index 4520084..339651f 100644
@@ -1839,6 +1839,9 @@ struct igb_ring_desc_16_bytes {
 		struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
 		uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
 		uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
+		struct rte_eth_rxq_info rx_qinfo;
+		struct rte_eth_txq_info tx_qinfo;
+		int32_t rc;
 
 		/* per port config */
 		printf("  port %d: RX queue number: %d Tx queue number: %d\n",

app/test-pmd/config.c struct igb_ring_desc_16_bytes { · line 1858

Quoted 6 lines
app/test-pmd/config.c +3 -0
@@ -1850,6 +1853,10 @@ struct igb_ring_desc_16_bytes {
 
 		/* per rx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
+			if (!rc)
+				nb_rx_desc[qid] = rx_qinfo.nb_desc;

Hi Bernard,

Isn't this doing same thing with previous patch, in a different location?

Do you think testpmd config variable should be updated? Why not just use the value for print but not save it?

Quoted 16 lines
app/test-pmd/config.c +5 -0
+
 			printf("    RX queue: %d\n", qid);
 			printf("      RX desc=%d - RX free threshold=%d\n",
 				nb_rx_desc[qid], rx_conf[qid].rx_free_thresh);
@@ -1864,6 +1871,10 @@ struct igb_ring_desc_16_bytes {
 
 		/* per tx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
+			if (!rc)
+				nb_tx_desc[qid] = tx_qinfo.nb_desc;
+
 			printf("    TX queue: %d\n", qid);
 			printf("      TX desc=%d - TX free threshold=%d\n",
 				nb_tx_desc[qid], tx_conf[qid].tx_free_thresh);
#7 lore raw

Re: [PATCH v3] app/testpmd: fix log of start command

Hi Ferruh,

<snip>

			nb_rx_desc[qid] = rx_qinfo.nb_desc;
Quoted 7 lines

Hi Bernard,

Isn't this doing same thing with previous patch, in a different location?

Do you think testpmd config variable should be updated? Why not just use the value for print but not save it?

Ok, I will send a v4

#8 lore raw

PATCH v4 1/1 app/testpmd: fix log of start command

In reply to Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/config.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
app/test-pmd/config.c +19 -2
index 4520084..97020fb 100644
@@ -1839,6 +1839,11 @@ struct igb_ring_desc_16_bytes {
 		struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
 		uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
 		uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
+		uint16_t nb_rx_desc_tmp;
+		uint16_t nb_tx_desc_tmp;
+		struct rte_eth_rxq_info rx_qinfo;
+		struct rte_eth_txq_info tx_qinfo;
+		int32_t rc;
 
 		/* per port config */
 		printf("  port %d: RX queue number: %d Tx queue number: %d\n",
@@ -1850,9 +1855,15 @@ struct igb_ring_desc_16_bytes {
 
 		/* per rx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
+			if (rc)
+				nb_rx_desc_tmp = nb_rx_desc[qid];
+			else
+				nb_rx_desc_tmp = rx_qinfo.nb_desc;
+
 			printf("    RX queue: %d\n", qid);
 			printf("      RX desc=%d - RX free threshold=%d\n",
-				nb_rx_desc[qid], rx_conf[qid].rx_free_thresh);
+				nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh);
 			printf("      RX threshold registers: pthresh=%d hthresh=%d "
 				" wthresh=%d\n",
 				rx_conf[qid].rx_thresh.pthresh,
@@ -1864,9 +1875,15 @@ struct igb_ring_desc_16_bytes {
 
 		/* per tx queue config only for first queue to be less verbose */
 		for (qid = 0; qid < 1; qid++) {
+			rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
+			if (rc)
+				nb_tx_desc_tmp = nb_tx_desc[qid];
+			else
+				nb_tx_desc_tmp = tx_qinfo.nb_desc;
+
 			printf("    TX queue: %d\n", qid);
 			printf("      TX desc=%d - TX free threshold=%d\n",
-				nb_tx_desc[qid], tx_conf[qid].tx_free_thresh);
+				nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh);
 			printf("      TX threshold registers: pthresh=%d hthresh=%d "
 				" wthresh=%d\n",
 				tx_conf[qid].tx_thresh.pthresh,
Signature · 1 line
1.9.1
Applied
#10 lore raw

Re: [PATCH v4] app/testpmd: fix log of start command

Quoted 8 lines · Ferruh Yigit
Quoted 5 lines · Bernard Iremonger

Call the rte_eth_rxq_info_get() and rte_eth_txq_info_get() functions to update the number of rx and tx descriptors.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")

Applied to dpdk-next-net/master, thanks.