[dpdk-stable] patch 'net/iavf: fix vector Rx' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 9 19:40:26 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/11/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/3e92f86692ee585957ac5932ab853b6711179012

Thanks.

Luca Boccassi

---
>From 3e92f86692ee585957ac5932ab853b6711179012 Mon Sep 17 00:00:00 2001
From: Jeff Guo <jia.guo at intel.com>
Date: Fri, 16 Oct 2020 17:44:31 +0800
Subject: [PATCH] net/iavf: fix vector Rx
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 851b22ff688e759a961ed969ea620372b20581d9 ]

The limitation of burst size in vector rx was removed, since it should
retrieve as much received packets as possible. And also the scattered
receive path should use a wrapper function to achieve the goal of
burst maximizing.

Bugzilla ID: 516
Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes: 1162f5a0ef31 ("net/iavf: support flexible Rx descriptor in SSE path")
Fixes: 5b6e8859081d ("net/iavf: support flexible Rx descriptor in AVX path")

Signed-off-by: Jeff Guo <jia.guo at intel.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Tested-by: Wei Ling <weix.ling at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
 drivers/net/iavf/iavf_rxtx_vec_sse.c | 49 +++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 12 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c
index 2b16dc1b52..458730e089 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
@@ -227,10 +227,12 @@ desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 	rx_pkts[3]->packet_type = type_table[_mm_extract_epi8(ptype1, 8)];
 }
 
-/* Notice:
+/**
+ * vPMD raw receive routine, only accept(nb_pkts >= IAVF_VPMD_DESCS_PER_LOOP)
+ *
+ * Notice:
  * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
+ * - floor align nb_pkts to a IAVF_VPMD_DESCS_PER_LOOP power-of-two
  */
 static inline uint16_t
 _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -260,9 +262,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
 	__m128i dd_check, eop_check;
 
-	/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */
-	nb_pkts = RTE_MIN(nb_pkts, IAVF_VPMD_RX_MAX_BURST);
-
 	/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, IAVF_VPMD_DESCS_PER_LOOP);
 
@@ -486,15 +485,15 @@ iavf_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
 }
 
-/* vPMD receive routine that reassembles scattered packets
+/**
+ * vPMD receive routine that reassembles single burst of 32 scattered packets
+ *
  * Notice:
  * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
  */
-uint16_t
-iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
-			    uint16_t nb_pkts)
+static uint16_t
+iavf_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			      uint16_t nb_pkts)
 {
 	struct iavf_rx_queue *rxq = rx_queue;
 	uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0};
@@ -527,6 +526,32 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		&split_flags[i]);
 }
 
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ */
+uint16_t
+iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			     uint16_t nb_pkts)
+{
+	uint16_t retval = 0;
+
+	while (nb_pkts > IAVF_VPMD_RX_MAX_BURST) {
+		uint16_t burst;
+
+		burst = iavf_recv_scattered_burst_vec(rx_queue,
+						      rx_pkts + retval,
+						      IAVF_VPMD_RX_MAX_BURST);
+		retval += burst;
+		nb_pkts -= burst;
+		if (burst < IAVF_VPMD_RX_MAX_BURST)
+			return retval;
+	}
+
+	return retval + iavf_recv_scattered_burst_vec(rx_queue,
+						      rx_pkts + retval,
+						      nb_pkts);
+}
+
 static inline void
 vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
-- 
2.27.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-09 18:40:12.716967940 +0000
+++ 0038-net-iavf-fix-vector-Rx.patch	2020-11-09 18:40:11.163311780 +0000
@@ -1 +1 @@
-From 851b22ff688e759a961ed969ea620372b20581d9 Mon Sep 17 00:00:00 2001
+From 3e92f86692ee585957ac5932ab853b6711179012 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit 851b22ff688e759a961ed969ea620372b20581d9 ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -25,2 +26,2 @@
- drivers/net/iavf/iavf_rxtx_vec_sse.c | 151 ++++++++++++++++++---------
- 1 file changed, 102 insertions(+), 49 deletions(-)
+ drivers/net/iavf/iavf_rxtx_vec_sse.c | 49 +++++++++++++++++++++-------
+ 1 file changed, 37 insertions(+), 12 deletions(-)
@@ -29 +30 @@
-index 85c5bd4af0..11acaa029e 100644
+index 2b16dc1b52..458730e089 100644
@@ -32,2 +33,2 @@
-@@ -379,10 +379,12 @@ flex_desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts,
- 	rx_pkts[3]->packet_type = type_table[_mm_extract_epi16(ptype_all, 7)];
+@@ -227,10 +227,12 @@ desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
+ 	rx_pkts[3]->packet_type = type_table[_mm_extract_epi8(ptype1, 8)];
@@ -48 +49 @@
-@@ -413,9 +415,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
+@@ -260,9 +262,6 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -58,29 +59,2 @@
-@@ -627,10 +626,13 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
- 	return nb_pkts_recd;
- }
- 
--/* Notice:
-+/**
-+ * vPMD raw receive routine for flex RxD,
-+ * only accept(nb_pkts >= IAVF_VPMD_DESCS_PER_LOOP)
-+ *
-+ * Notice:
-  * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet
-- * - nb_pkts > IAVF_VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST
-- *   numbers of DD bits
-+ * - floor align nb_pkts to a IAVF_VPMD_DESCS_PER_LOOP power-of-two
-  */
- static inline uint16_t
- _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,
-@@ -688,9 +690,6 @@ _recv_raw_pkts_vec_flex_rxd(struct iavf_rx_queue *rxq,
- 	const __m128i eop_check = _mm_set_epi64x(0x0000000200000002LL,
- 						 0x0000000200000002LL);
- 
--	/* nb_pkts shall be less equal than IAVF_VPMD_RX_MAX_BURST */
--	nb_pkts = RTE_MIN(nb_pkts, IAVF_VPMD_RX_MAX_BURST);
--
- 	/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
- 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, IAVF_VPMD_DESCS_PER_LOOP);
- 
-@@ -945,15 +944,15 @@ iavf_recv_pkts_vec_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
- 	return _recv_raw_pkts_vec_flex_rxd(rx_queue, rx_pkts, nb_pkts, NULL);
+@@ -486,15 +485,15 @@ iavf_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+ 	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
@@ -107 +81 @@
-@@ -986,46 +985,100 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+@@ -527,6 +526,32 @@ iavf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
@@ -111 +84,0 @@
--/* vPMD receive routine that reassembles scattered packets for flex RxD
@@ -138,100 +110,0 @@
-+/**
-+ * vPMD receive routine that reassembles single burst of 32 scattered packets
-+ * for flex RxD
-+ *
-  * Notice:
-  * - nb_pkts < IAVF_VPMD_DESCS_PER_LOOP, just return no packet
-- * - nb_pkts > VPMD_RX_MAX_BURST, only scan IAVF_VPMD_RX_MAX_BURST
-- *   numbers of DD bits
-+ */
-+static uint16_t
-+iavf_recv_scattered_burst_vec_flex_rxd(void *rx_queue,
-+				       struct rte_mbuf **rx_pkts,
-+				       uint16_t nb_pkts)
-+{
-+	struct iavf_rx_queue *rxq = rx_queue;
-+	uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0};
-+	unsigned int i = 0;
-+
-+	/* get some new buffers */
-+	uint16_t nb_bufs = _recv_raw_pkts_vec_flex_rxd(rxq, rx_pkts, nb_pkts,
-+					      split_flags);
-+	if (nb_bufs == 0)
-+		return 0;
-+
-+	/* happy day case, full burst + no packets to be joined */
-+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
-+
-+	if (!rxq->pkt_first_seg &&
-+	    split_fl64[0] == 0 && split_fl64[1] == 0 &&
-+	    split_fl64[2] == 0 && split_fl64[3] == 0)
-+		return nb_bufs;
-+
-+	/* reassemble any packets that need reassembly*/
-+	if (!rxq->pkt_first_seg) {
-+		/* find the first split flag, and only reassemble then*/
-+		while (i < nb_bufs && !split_flags[i])
-+			i++;
-+		if (i == nb_bufs)
-+			return nb_bufs;
-+		rxq->pkt_first_seg = rx_pkts[i];
-+	}
-+	return i + reassemble_packets(rxq, &rx_pkts[i], nb_bufs - i,
-+		&split_flags[i]);
-+}
-+
-+/**
-+ * vPMD receive routine that reassembles scattered packets for flex RxD
-  */
- uint16_t
- iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue,
- 				      struct rte_mbuf **rx_pkts,
- 				      uint16_t nb_pkts)
- {
--	struct iavf_rx_queue *rxq = rx_queue;
--	uint8_t split_flags[IAVF_VPMD_RX_MAX_BURST] = {0};
--	unsigned int i = 0;
--
--	/* get some new buffers */
--	uint16_t nb_bufs = _recv_raw_pkts_vec_flex_rxd(rxq, rx_pkts, nb_pkts,
--					      split_flags);
--	if (nb_bufs == 0)
--		return 0;
--
--	/* happy day case, full burst + no packets to be joined */
--	const uint64_t *split_fl64 = (uint64_t *)split_flags;
--
--	if (!rxq->pkt_first_seg &&
--	    split_fl64[0] == 0 && split_fl64[1] == 0 &&
--	    split_fl64[2] == 0 && split_fl64[3] == 0)
--		return nb_bufs;
--
--	/* reassemble any packets that need reassembly*/
--	if (!rxq->pkt_first_seg) {
--		/* find the first split flag, and only reassemble then*/
--		while (i < nb_bufs && !split_flags[i])
--			i++;
--		if (i == nb_bufs)
--			return nb_bufs;
--		rxq->pkt_first_seg = rx_pkts[i];
-+	uint16_t retval = 0;
-+
-+	while (nb_pkts > IAVF_VPMD_RX_MAX_BURST) {
-+		uint16_t burst;
-+
-+		burst = iavf_recv_scattered_burst_vec_flex_rxd(rx_queue,
-+						rx_pkts + retval,
-+						IAVF_VPMD_RX_MAX_BURST);
-+		retval += burst;
-+		nb_pkts -= burst;
-+		if (burst < IAVF_VPMD_RX_MAX_BURST)
-+			return retval;
- 	}
--	return i + reassemble_packets(rxq, &rx_pkts[i], nb_bufs - i,
--		&split_flags[i]);
-+
-+	return retval + iavf_recv_scattered_burst_vec_flex_rxd(rx_queue,
-+						      rx_pkts + retval,
-+						      nb_pkts);
- }
- 
@@ -238,0 +112,2 @@
+ vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
+ {


More information about the stable mailing list