From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3766DA00C3; Wed, 15 Dec 2021 09:07:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8CC440688; Wed, 15 Dec 2021 09:07:29 +0100 (CET) Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) by mails.dpdk.org (Postfix) with ESMTP id 7EBD740041; Wed, 15 Dec 2021 09:07:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1639555645; cv=none; d=zohomail.eu; s=zohoarc; b=hQWo6jv//cDH+laRVJikoUjhqWGxHboxBwzClkNPWGUVdqkHc+0pQtn935WSzJBxqJ8WrDhrLsRvDKO56+hX4CozYRhyZh4JA7SPJhy+0MuCtjQ1SIM9+1khXaelxad/7Z4/qtp/CaLAU9511doc++fVlAAEptIijuHqwHMvmfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1639555645; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=K9pbjpJU/pTdbV9AKkDQyhSR4rujJXnwZYogxWQvnKg=; b=VsZcFCnm2BeW/bxdqm23EMN6jlYjaHmLTvWopqlbBqCIcPHiHXETb+CssflMuliYzlV33qFSXCKv3flIw9ToeKO/63YSS2dRwR6zmBQSE8DMqO9Ug63FCuOXWxaaKHH2wWrGjZ2FGlBKwynOJsT5R4RWUrnSLFQJyknN0YAD9Mw= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=liangma@liangbit.com; dmarc=pass header.from= Received: from C02GF04TMD6V (cpc145956-finc19-2-0-cust124.4-2.cable.virginm.net [82.25.6.125]) by mx.zoho.eu with SMTPS id 1639555644205594.2517959982836; Wed, 15 Dec 2021 09:07:24 +0100 (CET) Date: Wed, 15 Dec 2021 08:07:21 +0000 From: Liang Ma To: Bin Zheng Cc: dev@dpdk.org, haiyue.wang@intel.com, stable@dpdk.org, leyi.rong@intel.com, jia.guo@intel.com Subject: Re: [PATCH v3] net/ixgbe: add vector Rx parameter check Message-ID: References: <20211202092001.1830481-2-zhengbin.89740@bytedance.com> <20211210082209.4102794-1-zhengbin.89740@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211210082209.4102794-1-zhengbin.89740@bytedance.com> X-ZohoMailClient: External X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Dec 10, 2021 at 04:22:09PM +0800, Bin Zheng wrote: > Under the circumstance that `rx_tail` wrap back to zero > and the advance speed of `rx_tail` is greater than `rxrearm_start`, > `rx_tail` will catch up with `rxrearm_start` and surpass it. > This may cause some mbufs be reused by application. > > So we need to make some restrictions to ensure that > `rx_tail` will not exceed `rxrearm_start`. > > e.g. > > RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959 > RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail: 991 > RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail: 1023 > RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0 > RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88 > RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail: 95 > ... > RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail: 895 > RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail: 927 > RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959 > RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail: 994 > > when `rx_tail` catches up with `rxrearm_start`, > 2(994 - 992) mbufs be reused by application ! > > Bugzilla ID: 882 > Fixes: 5a3cca342417 ("net/ixgbe: fix vector Rx") > Cc: jia.guo@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Bin Zheng > --- > drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c > index 1eed949495..4654d0adec 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c > @@ -364,6 +364,17 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, > uint8_t vlan_flags; > uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */ > > + /* > + * Under the circumstance that `rx_tail` wrap back to zero > + * and the advance speed of `rx_tail` is greater than `rxrearm_start`, > + * `rx_tail` will catch up with `rxrearm_start` and surpass it. > + * This may cause some mbufs be reused by application. > + * > + * So we need to make some restrictions to ensure that > + * `rx_tail` will not exceed `rxrearm_start`. > + */ > + nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH); > + > /* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */ > nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_IXGBE_DESCS_PER_LOOP); > > -- > 2.25.1 > Reviewed-by Liang Ma