patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11 1/5] net/dpaa2: add retry and timeout in packet enqueue API
@ 2019-12-17  9:30 Nipun Gupta
  2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 2/5] raw/dpaa2_cmdif: " Nipun Gupta
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Nipun Gupta @ 2019-12-17  9:30 UTC (permalink / raw)
  To: ktraynor; +Cc: stable, Nipun Gupta, Radu Bulie

In the packet transmit, if the QBMAN is not able to process the
packets, the Tx function loops infinitely to send the packet out.
This patch changes the logic retry for some time (count) and then
return.

Fixes: cd9935cec873 ("net/dpaa2: enable Rx and Tx operations")
Fixes: 16c4a3c46ab7 ("bus/fslmc: add enqueue response read in qbman")
Cc: stable@dpdk.org

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |  2 ++
 drivers/net/dpaa2/dpaa2_rxtx.c          | 38 +++++++++++++++++++------
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 473f779a1..0a59f9d84 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -54,6 +54,8 @@
 #define DPAA2_SWP_CINH_REGION		1
 #define DPAA2_SWP_CENA_MEM_REGION	2
 
+#define DPAA2_MAX_TX_RETRY_COUNT	10000
+
 #define MC_PORTAL_INDEX		0
 #define NUM_DPIO_REGIONS	2
 #define NUM_DQS_PER_QUEUE       2
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 03320ca1b..b0ed20551 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -809,15 +809,28 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			}
 			bufs++;
 		}
+
 		loop = 0;
+		retry_count = 0;
 		while (loop < frames_to_send) {
-			loop += qbman_swp_enqueue_multiple(swp, &eqdesc,
+			ret = qbman_swp_enqueue_multiple(swp, &eqdesc,
 					&fd_arr[loop], &flags[loop],
 					frames_to_send - loop);
+			if (unlikely(ret < 0)) {
+				retry_count++;
+				if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) {
+					num_tx += loop;
+					nb_pkts -= loop;
+					goto send_n_return;
+				}
+			} else {
+				loop += ret;
+				retry_count = 0;
+			}
 		}
 
-		num_tx += frames_to_send;
-		nb_pkts -= frames_to_send;
+		num_tx += loop;
+		nb_pkts -= loop;
 	}
 	dpaa2_q->tx_pkts += num_tx;
 	return num_tx;
@@ -827,13 +840,22 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	if (loop) {
 		unsigned int i = 0;
 
+		retry_count = 0;
 		while (i < loop) {
-			i += qbman_swp_enqueue_multiple(swp, &eqdesc,
-							&fd_arr[i],
-							&flags[loop],
-							loop - i);
+			ret = qbman_swp_enqueue_multiple(swp, &eqdesc,
+							 &fd_arr[i],
+							 &flags[i],
+							 loop - i);
+			if (unlikely(ret < 0)) {
+				retry_count++;
+				if (retry_count > DPAA2_MAX_TX_RETRY_COUNT)
+					break;
+			} else {
+				i += ret;
+				retry_count = 0;
+			}
 		}
-		num_tx += loop;
+		num_tx += i;
 	}
 skip_tx:
 	dpaa2_q->tx_pkts += num_tx;
-- 
2.17.1


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

end of thread, other threads:[~2019-12-18  5:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17  9:30 [dpdk-stable] [PATCH 18.11 1/5] net/dpaa2: add retry and timeout in packet enqueue API Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 2/5] raw/dpaa2_cmdif: " Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 3/5] net/dpaa2: set port in mbuf Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 4/5] bus/dpaa: fix dpaa_sec blacklist Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 5/5] test/crypto: fix session init failure for wireless case Nipun Gupta
2019-12-17 14:08 ` [dpdk-stable] [PATCH 18.11 1/5] net/dpaa2: add retry and timeout in packet enqueue API Kevin Traynor
2019-12-18  5:02   ` Nipun Gupta

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