[dpdk-dev] [PATCH 01/17] mlx5: use fast Verbs interface for scattered RX operation

Adrien Mazarguil adrien.mazarguil at 6wind.com
Mon Oct 5 19:54:36 CEST 2015


This commit updates mlx5_rx_burst_sp() to use the fast verbs interface for
posting RX buffers just like mlx5_rx_burst(). Doing so avoids a loop in
libmlx5 and an indirect function call through libibverbs.

Note: recv_sg_list() is not implemented in the QP burst API, this commit is
only to prepare transition to the WQ-based API.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 668aff0..8db4f3f 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -600,9 +600,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	struct rxq_elt_sp (*elts)[rxq->elts_n] = rxq->elts.sp;
 	const unsigned int elts_n = rxq->elts_n;
 	unsigned int elts_head = rxq->elts_head;
-	struct ibv_recv_wr head;
-	struct ibv_recv_wr **next = &head.next;
-	struct ibv_recv_wr *bad_wr;
 	unsigned int i;
 	unsigned int pkts_ret = 0;
 	int ret;
@@ -660,9 +657,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 				/* Increment dropped packets counter. */
 				++rxq->stats.idropped;
 #endif
-				/* Link completed WRs together for repost. */
-				*next = wr;
-				next = &wr->next;
 				goto repost;
 			}
 			ret = wc.byte_len;
@@ -671,9 +665,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			break;
 		len = ret;
 		pkt_buf_len = len;
-		/* Link completed WRs together for repost. */
-		*next = wr;
-		next = &wr->next;
 		/*
 		 * Replace spent segments with new ones, concatenate and
 		 * return them as pkt_buf.
@@ -770,26 +761,22 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		rxq->stats.ibytes += pkt_buf_len;
 #endif
 repost:
+		ret = rxq->if_qp->recv_sg_list(rxq->qp,
+					       elt->sges,
+					       RTE_DIM(elt->sges));
+		if (unlikely(ret)) {
+			/* Inability to repost WRs is fatal. */
+			DEBUG("%p: recv_sg_list(): failed (ret=%d)",
+			      (void *)rxq->priv,
+			      ret);
+			abort();
+		}
 		if (++elts_head >= elts_n)
 			elts_head = 0;
 		continue;
 	}
 	if (unlikely(i == 0))
 		return 0;
-	*next = NULL;
-	/* Repost WRs. */
-#ifdef DEBUG_RECV
-	DEBUG("%p: reposting %d WRs", (void *)rxq, i);
-#endif
-	ret = ibv_post_recv(rxq->qp, head.next, &bad_wr);
-	if (unlikely(ret)) {
-		/* Inability to repost WRs is fatal. */
-		DEBUG("%p: ibv_post_recv(): failed for WR %p: %s",
-		      (void *)rxq->priv,
-		      (void *)bad_wr,
-		      strerror(ret));
-		abort();
-	}
 	rxq->elts_head = elts_head;
 #ifdef MLX5_PMD_SOFT_COUNTERS
 	/* Increment packets counter. */
-- 
2.1.0



More information about the dev mailing list