dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/multi_process - fix crash in mp_client with sparse ports
@ 2019-06-04  0:04 Stephen Hemminger
  2019-06-04  1:15 ` [dpdk-dev] Meson build failing in ../drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Stephen Hemminger @ 2019-06-04  0:04 UTC (permalink / raw)
  To: tomaszx.kulasek; +Cc: dev, Stephen Hemminger

From: Stephen Hemminger <sthemmin@microsoft.com>

The mp_client crashes if run on Azure or any system where ethdev
ports are owned. In that case, the tx_buffer and tx_stats for the
real port were initialized correctly, but the wrong port was used.

For example if the server has Ports 3 and 5. Then calling
rte_eth_tx_buffer_flush on any other buffer will dereference null
because the tx buffer for that port was not allocated.

Fixes: e2366e74e029 ("examples: use buffered Tx")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 examples/multi_process/client_server_mp/mp_client/client.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index c23dd3f378f7..c1d2d975b717 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -246,15 +246,16 @@ main(int argc, char *argv[])
 
 	for (;;) {
 		uint16_t i, rx_pkts;
-		uint16_t port;
 
 		rx_pkts = rte_ring_dequeue_burst(rx_ring, pkts,
 				PKT_READ_SIZE, NULL);
 
 		if (unlikely(rx_pkts == 0)){
 			if (need_flush)
-				for (port = 0; port < ports->num_ports; port++) {
-					sent = rte_eth_tx_buffer_flush(ports->id[port], client_id,
+				for (i = 0; i < ports->num_ports; i++) {
+					uint16_t port = ports->id[i]'
+
+					sent = rte_eth_tx_buffer_flush(ports, client_id,
 							tx_buffer[port]);
 					if (unlikely(sent))
 						tx_stats->tx[port] += sent;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-18 16:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04  0:04 [dpdk-dev] [PATCH] examples/multi_process - fix crash in mp_client with sparse ports Stephen Hemminger
2019-06-04  1:15 ` [dpdk-dev] Meson build failing in ../drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c Stephen Hemminger
2019-06-14  7:53 ` [dpdk-dev] [PATCH] examples/multi_process - fix crash in mp_client with sparse ports David Marchand
2019-06-18 16:35 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-06-18 16:40 ` [dpdk-dev] [PATCH v3] " Stephen Hemminger
2019-06-18 16:52   ` David Marchand

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).