DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, hemant.agrawal@nxp.com,
	sachin.saxena@nxp.com, stable@dpdk.org,
	Nipun Gupta <nipun.gupta@nxp.com>,
	Radu Bulie <radu-andrei.bulie@nxp.com>
Subject: [dpdk-dev] [PATCH 5/9] net/dpaa2: add retry and timeout in packet enqueue API
Date: Fri, 11 Oct 2019 11:16:53 +0530	[thread overview]
Message-ID: <20191011054657.21931-6-nipun.gupta@nxp.com> (raw)
In-Reply-To: <20191011054657.21931-1-nipun.gupta@nxp.com>

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          | 72 ++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 5087f68c6..d28c7159f 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -59,6 +59,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 b7b2d8652..52d913d9e 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -1135,15 +1135,28 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 #endif
 			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;
@@ -1153,13 +1166,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;
@@ -1365,15 +1387,28 @@ dpaa2_dev_tx_ordered(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_desc(swp,
+			ret = qbman_swp_enqueue_multiple_desc(swp,
 					&eqdesc[loop], &fd_arr[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;
@@ -1383,11 +1418,20 @@ dpaa2_dev_tx_ordered(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_desc(swp, &eqdesc[loop],
-							&fd_arr[i], loop - i);
+			ret = qbman_swp_enqueue_multiple_desc(swp,
+				       &eqdesc[loop], &fd_arr[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


  parent reply	other threads:[~2019-10-11  6:03 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  5:46 [dpdk-dev] [PATCH 0/9] DPAA and FSLMC driver fixes and cleanup Nipun Gupta
2019-10-11  5:46 ` [dpdk-dev] [PATCH 1/9] net/dpaa: fix supported RSS types Nipun Gupta
2019-10-11  5:46 ` [dpdk-dev] [PATCH 2/9] net/dpaa: fix LS1043 alignment check Nipun Gupta
2019-10-11  5:46 ` [dpdk-dev] [PATCH 3/9] common/dpaax: fallback to check separate memory node for VM Nipun Gupta
2019-10-11  5:46 ` [dpdk-dev] [PATCH 4/9] mempool/dpaa2: panic on endless loop in mbuf release Nipun Gupta
2019-10-11  5:46 ` Nipun Gupta [this message]
2019-10-11  5:46 ` [dpdk-dev] [PATCH 6/9] raw/dpaa2_qdma: add retry and timeout in packet enqueue API Nipun Gupta
2019-10-15  6:55   ` Hemant Agrawal
2019-10-11  5:46 ` [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: " Nipun Gupta
2019-10-15  6:55   ` Hemant Agrawal
2019-10-11  5:46 ` [dpdk-dev] [PATCH 8/9] bus/dpaa: moving qbman global init to bus Nipun Gupta
2019-10-11  5:46 ` [dpdk-dev] [PATCH 9/9] bus/fslmc: sanitize device name parsing for clarity Nipun Gupta
2019-10-15  6:56 ` [dpdk-dev] [PATCH 0/9] DPAA and FSLMC driver fixes and cleanup Hemant Agrawal
2019-10-17 12:43 ` [dpdk-dev] [PATCH 0/9 v2] " Nipun Gupta
2019-10-17 12:43   ` [dpdk-dev] [PATCH 1/9 v2] net/dpaa: fix supported RSS types Nipun Gupta
2019-10-17 12:43   ` [dpdk-dev] [PATCH 2/9 v2] net/dpaa: fix LS1043 alignment check Nipun Gupta
2019-10-17 12:43   ` [dpdk-dev] [PATCH 3/9 v2] common/dpaax: fallback to check separate memory node for VM Nipun Gupta
2019-10-17 12:43   ` [dpdk-dev] [PATCH 4/9 v2] net/dpaa2: add retry and timeout in packet enqueue API Nipun Gupta
2019-10-17 12:43   ` [dpdk-dev] [PATCH 5/9 v2] raw/dpaa2_qdma: " Nipun Gupta
2019-10-17 12:44   ` [dpdk-dev] [PATCH 6/9 v2] raw/dpaa2_cmdif: " Nipun Gupta
2019-10-17 12:44   ` [dpdk-dev] [PATCH 7/9 v2] mempool/dpaa2: panic on endless loop in mbuf release Nipun Gupta
2019-10-23 23:08     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-10-30 12:17       ` Nipun Gupta
2019-10-17 12:44   ` [dpdk-dev] [PATCH 8/9 v2] bus/dpaa: moving qbman global init to bus Nipun Gupta
2019-10-18  9:06     ` Akhil Goyal
2019-10-17 12:44   ` [dpdk-dev] [PATCH 9/9 v2] bus/fslmc: sanitize device name parsing for clarity Nipun Gupta
2019-10-30 12:09 ` [dpdk-dev] [PATCH 0/9 v3] DPAA and FSLMC driver fixes and cleanup Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 1/9 v3] net/dpaa: fix supported RSS types Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 2/9 v3] net/dpaa: fix LS1043 alignment check Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 3/9 v3] common/dpaax: fallback to check separate memory node for VM Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 4/9 v3] net/dpaa2: add retry and timeout in packet enqueue API Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 5/9 v3] raw/dpaa2_qdma: " Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 6/9 v3] raw/dpaa2_cmdif: " Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 7/9 v3] mempool/dpaa2: report error on endless loop in mbuf release Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 8/9 v3] bus/dpaa: moving qbman global init to bus Nipun Gupta
2019-10-30 12:09   ` [dpdk-dev] [PATCH 9/9 v3] bus/fslmc: sanitize device name parsing for clarity Nipun Gupta
2019-11-05 14:23 ` [dpdk-dev] [PATCH 0/9 v4] DPAA and FSLMC driver fixes and cleanup Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 1/9 v4] net/dpaa: fix supported RSS types Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 2/9 v4] net/dpaa: fix LS1043 alignment check Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 3/9 v4] common/dpaax: fallback to check separate memory node for VM Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 4/9 v4] net/dpaa2: add retry and timeout in packet enqueue API Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 5/9 v4] raw/dpaa2_qdma: " Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 6/9 v4] raw/dpaa2_cmdif: " Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 7/9 v4] mempool/dpaa2: report error on endless loop in mbuf release Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 8/9 v4] bus/dpaa: moving qbman global init to bus Nipun Gupta
2019-11-05 14:23   ` [dpdk-dev] [PATCH 9/9 v4] bus/fslmc: sanitize device name parsing for clarity Nipun Gupta
2019-11-06  0:19   ` [dpdk-dev] [PATCH 0/9 v4] DPAA and FSLMC driver fixes and cleanup Thomas Monjalon

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=20191011054657.21931-6-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=radu-andrei.bulie@nxp.com \
    --cc=sachin.saxena@nxp.com \
    --cc=stable@dpdk.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).