patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jeff Guo <jia.guo@intel.com>
To: ktraynor@redhat.com
Cc: stable@dpdk.org, jia.guo@intel.com,
	Morten Brørup <mb@smartsharesystems.com>,
	Wei Ling <weix.ling@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-stable] [PATCH 18.11 3/3] net/avf: fix vector Rx
Date: Thu,  3 Dec 2020 17:47:02 +0800
Message-ID: <20201203094702.25734-3-jia.guo@intel.com> (raw)
In-Reply-To: <20201203094702.25734-1-jia.guo@intel.com>

[ 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")

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

diff --git a/drivers/net/avf/avf_rxtx_vec_sse.c b/drivers/net/avf/avf_rxtx_vec_sse.c
index 13e94cebc0..4aa209f702 100644
--- a/drivers/net/avf/avf_rxtx_vec_sse.c
+++ b/drivers/net/avf/avf_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 >= AVF_VPMD_DESCS_PER_LOOP)
+ *
+ * Notice:
  * - nb_pkts < AVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > AVF_VPMD_RX_MAX_BURST, only scan AVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
+ * - floor align nb_pkts to a AVF_VPMD_DESCS_PER_LOOP power-of-two
  */
 static inline uint16_t
 _recv_raw_pkts_vec(struct avf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -260,9 +262,6 @@ _recv_raw_pkts_vec(struct avf_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 AVF_VPMD_RX_MAX_BURST */
-	nb_pkts = RTE_MIN(nb_pkts, AVF_VPMD_RX_MAX_BURST);
-
 	/* nb_pkts has to be floor-aligned to AVF_VPMD_DESCS_PER_LOOP */
 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, AVF_VPMD_DESCS_PER_LOOP);
 
@@ -486,15 +485,15 @@ avf_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 < AVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > VPMD_RX_MAX_BURST, only scan AVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
  */
-uint16_t
-avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
-			    uint16_t nb_pkts)
+static uint16_t
+avf_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			     uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = rx_queue;
 	uint8_t split_flags[AVF_VPMD_RX_MAX_BURST] = {0};
@@ -527,6 +526,32 @@ avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		&split_flags[i]);
 }
 
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ */
+uint16_t
+avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			    uint16_t nb_pkts)
+{
+	uint16_t retval = 0;
+
+	while (nb_pkts > AVF_VPMD_RX_MAX_BURST) {
+		uint16_t burst;
+
+		burst = avf_recv_scattered_burst_vec(rx_queue,
+						     rx_pkts + retval,
+						     AVF_VPMD_RX_MAX_BURST);
+		retval += burst;
+		nb_pkts -= burst;
+		if (burst < AVF_VPMD_RX_MAX_BURST)
+			return retval;
+	}
+
+	return retval + avf_recv_scattered_burst_vec(rx_queue,
+						     rx_pkts + retval,
+						     nb_pkts);
+}
+
 static inline void
 vtx1(volatile struct avf_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
-- 
2.20.1


  parent reply	other threads:[~2020-12-03 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03  9:47 [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Jeff Guo
2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush " Jeff Guo
2020-12-03  9:47 ` Jeff Guo [this message]
2020-12-03 16:45 ` [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command " Kevin Traynor

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=20201203094702.25734-3-jia.guo@intel.com \
    --to=jia.guo@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=mb@smartsharesystems.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=weix.ling@intel.com \
    /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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git