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 0390D41C4D for ; Thu, 9 Feb 2023 10:00:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE28541611; Thu, 9 Feb 2023 10:00:29 +0100 (CET) Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by mails.dpdk.org (Postfix) with ESMTP id CFE064067B; Thu, 9 Feb 2023 10:00:27 +0100 (CET) X-QQ-mid: Yeas47t1675933220t967t45213 Received: from 7082A6556EBF4E69829842272A565F7C (jiawenwu@trustnetic.com [183.129.236.74]) X-QQ-SSF: 00400000000000F0FL9000000000000 From: =?utf-8?b?Smlhd2VuIFd1?= To: "'Ferruh Yigit'" , Cc: References: <20230118060039.3074016-1-jiawenwu@trustnetic.com> <20230202092132.3271910-1-jiawenwu@trustnetic.com> <20230202092132.3271910-2-jiawenwu@trustnetic.com> In-Reply-To: Subject: RE: [PATCH v2 01/10] net/ngbe: fix Rx buffer size in configure register Date: Thu, 9 Feb 2023 17:00:13 +0800 Message-ID: <057601d93c64$ebb69d30$c323d790$@trustnetic.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: zh-cn Thread-Index: AQIBtVZXYxbb1ShePjndn/GGR7Jz2QIPMp+1AkW9BhkCExTCs65Bpedg X-QQ-SENDSIZE: 520 Feedback-ID: Yeas:trustnetic.com:qybglogicsvr:qybglogicsvr5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 On Wednesday, February 8, 2023 6:28 PM, Ferruh Yigit wrote: > On 2/2/2023 9:21 AM, Jiawen Wu wrote: > > When buffer size is less than 1K, round down makes it 0, which is an > > error value. > > > > Fixes: 62fc35e63d0e ("net/ngbe: support Rx queue start/stop") > > Cc: stable@dpdk.org > > > > Signed-off-by: Jiawen Wu > > --- > > drivers/net/ngbe/ngbe_rxtx.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ngbe/ngbe_rxtx.c > > b/drivers/net/ngbe/ngbe_rxtx.c index 9fd24fa444..9a646cb6a7 100644 > > --- a/drivers/net/ngbe/ngbe_rxtx.c > > +++ b/drivers/net/ngbe/ngbe_rxtx.c > > @@ -2944,7 +2944,10 @@ ngbe_dev_rx_init(struct rte_eth_dev *dev) > > */ > > buf_size =3D (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) = - > > RTE_PKTMBUF_HEADROOM); > > - buf_size =3D ROUND_DOWN(buf_size, 0x1 << 10); > > + if (buf_size < 1024) > > + buf_size =3D ROUND_UP(buf_size, 0x1 << 10); >=20 > Back to original problem statement in previous version, can't this = cause HW to > receive packets exceeding the buffer size? >=20 > If HW accepts buffer size in multiple of 1K, does this mean any buffer = size less than > 1K is an error condition for this HW? >=20 After rechecking the code, the minimum buffer size is limited to 1K by = the txgbe/ngbe [1]. I think v1 patch for txgbe is enough. [1] static int txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info = *dev_info) { struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); struct txgbe_hw *hw =3D TXGBE_DEV_HW(dev); dev_info->min_rx_bufsize =3D 1024; > > + else > > + buf_size =3D ROUND_DOWN(buf_size, 0x1 << 10); > > srrctl |=3D NGBE_RXCFG_PKTLEN(buf_size); > > > > wr32(hw, NGBE_RXCFG(rxq->reg_idx), srrctl); >=20 >=20