[PATCH v3 07/11] net/octeon_ep: flush pending DMA operations
Sathesh Edara
sedara at marvell.com
Mon Apr 24 14:28:30 CEST 2023
Flushes the pending DMA operations while reading
the packets by reading control and status register.
Signed-off-by: Sathesh Edara <sedara at marvell.com>
---
drivers/net/octeon_ep/otx_ep_common.h | 8 ++++++++
drivers/net/octeon_ep/otx_ep_rxtx.c | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/octeon_ep/otx_ep_common.h b/drivers/net/octeon_ep/otx_ep_common.h
index 76528ed49d..444136923f 100644
--- a/drivers/net/octeon_ep/otx_ep_common.h
+++ b/drivers/net/octeon_ep/otx_ep_common.h
@@ -345,6 +345,14 @@ struct otx_ep_droq {
*/
void *pkts_sent_reg;
+ /** Handle DMA incompletion during pkt reads.
+ * This variable is used to initiate a sent_reg_read
+ * that completes pending dma
+ * this variable is used as lvalue so compiler cannot optimize
+ * the reads.
+ */
+ uint32_t sent_reg_val;
+
/* Statistics for this DROQ. */
struct otx_ep_droq_stats stats;
diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.c b/drivers/net/octeon_ep/otx_ep_rxtx.c
index c4153bd583..ca968f6fe7 100644
--- a/drivers/net/octeon_ep/otx_ep_rxtx.c
+++ b/drivers/net/octeon_ep/otx_ep_rxtx.c
@@ -917,6 +917,10 @@ otx_ep_droq_read_packet(struct otx_ep_device *otx_ep,
struct rte_mbuf *first_buf = NULL;
struct rte_mbuf *last_buf = NULL;
+ /* csr read helps to flush pending dma */
+ droq->sent_reg_val = rte_read32(droq->pkts_sent_reg);
+ rte_rmb();
+
while (pkt_len < total_pkt_len) {
int cpy_len = 0;
--
2.31.1
More information about the dev
mailing list