From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58DF8A0527 for ; Mon, 9 Nov 2020 19:43:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 51C4A6CA9; Mon, 9 Nov 2020 19:43:26 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id C4C2F6CA9 for ; Mon, 9 Nov 2020 19:43:25 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id r17so5960276wrw.1 for ; Mon, 09 Nov 2020 10:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EnSRcF0ZEmED2xsWgEOaVDxClb8CiqRXh3tZLrdkPvA=; b=LwHcGLc/sO/f5z8QLfTGUN6gJbEgGV0rzIOnIFGOSFerM98ENFl1q5LYuNg5QVorHF R1hdJqQMe5nbV2Yqz8vG7PbDj8X3pe4T+Q7+oc3yu6YHeoJawsNRKNtTEAKnKcmy1V0S yJX2DCYJp7DHJLOIUWUKIVVFi38ISFfd+EdtoVL1eH7gI3QtU5IVH7IXIVrjl6ovy86Z KWU4wTN9oP6mjxHPDJ3hv1VCejgU/zjnBlu8oliy7d9THV2EAAIlgjx4whx4n4LBKeaB lxXX6LS/qlHpwdwodMLxZHmE7WJByudqoF0N3DET2HJ3VTtonFPwJvcZqMcnA8zkwDTX nm7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EnSRcF0ZEmED2xsWgEOaVDxClb8CiqRXh3tZLrdkPvA=; b=c+lsxfspblBZm5wB6zD1ljPpOJ0N0A80A8VIShmaTU0qs+ypvfIAxCtGpg2NDlqnGi 057h4AIxOfLac0j0yUrbIWFE946g6bvvqrcTGgLsxbTN5mcO3r2mwjEiB2jXssf4ijUH xXThPHfoyLCiBPbZ6ueX7nf2zOQXCjnaWjTbV/JU19sdZ1t8H5YEWNY8egincCqvfDYI oKdrPP+jKK4QYG7h9RcZEJCfXcWcTAOSNidvdlljcqh4imGnwA0l9rGfzb/dR7rgQ3Jv j029fh9DzEM5943uUIYozUn9aMz6rE9j/7jgGtw+w7CNkRS97QBVUmPes+/sP1cQWZ3I LGIw== X-Gm-Message-State: AOAM532FwCRGN7OWxsU7mvSqqKqF8YNouDmslgzwEC3+Iuy0kHXZPVAD gU3dbE51Zf+N67iFMyqb4kY= X-Google-Smtp-Source: ABdhPJy5mtlHD85Bw8tXf6WiM3G31ewISUdzD/8BmWHBynXjsA6ox3zBH7/QxCp6Uqo4uYcZax8Tmw== X-Received: by 2002:adf:9507:: with SMTP id 7mr19350923wrs.365.1604947404468; Mon, 09 Nov 2020 10:43:24 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id u8sm345484wmg.6.2020.11.09.10.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:43:23 -0800 (PST) From: luca.boccassi@gmail.com To: Jeff Guo Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , Wei Ling , Qi Zhang , dpdk stable Date: Mon, 9 Nov 2020 18:40:26 +0000 Message-Id: <20201109184111.3463090-38-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/iavf: fix vector Rx' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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 Acked-by: Morten Brørup Tested-by: Wei Ling Acked-by: Qi Zhang --- 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@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) + {