diff mbox series

[6/9,v4] raw/dpaa2_cmdif: add retry and timeout in packet enqueue API

Message ID 20191105142321.7478-7-nipun.gupta@nxp.com
State Accepted
Commit 0da362b8f9236e32c3ca70ac3e1b32d1110f37e8
Headers show
Series DPAA and FSLMC driver fixes and cleanup | expand

Commit Message

Nipun Gupta Nov. 5, 2019, 2:23 p.m. UTC
This patch adds retry in the DPAA2 CMDIF packet enqueue API

Fixes: 53c71586c789 ("raw/dpaa2_cmdif: support enqueue/dequeue operations")
Cc: stable@dpdk.org

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 3f42da1fe..ae53114b5 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -62,6 +62,7 @@  dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_fd fd;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
+	uint32_t retry_count = 0;
 	int ret;
 
 	RTE_SET_USED(count);
@@ -100,11 +101,15 @@  dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
 		if (ret < 0 && ret != -EBUSY)
 			DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret);
-	} while (ret == -EBUSY);
+		retry_count++;
+	} while ((ret == -EBUSY) && (retry_count < DPAA2_MAX_TX_RETRY_COUNT));
+
+	if (ret < 0)
+		return ret;
 
 	DPAA2_CMDIF_DP_DEBUG("Successfully transmitted a packet\n");
 
-	return 0;
+	return 1;
 }
 
 static int