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 59BBB41BAB for ; Thu, 2 Feb 2023 10:25:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C58242D5E; Thu, 2 Feb 2023 10:25:49 +0100 (CET) Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by mails.dpdk.org (Postfix) with ESMTP id D26C242D5E; Thu, 2 Feb 2023 10:25:45 +0100 (CET) X-QQ-mid: bizesmtp85t1675329941t0a3m7ha Received: from wxdbg.localdomain.com ( [183.129.236.74]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 02 Feb 2023 17:25:39 +0800 (CST) X-QQ-SSF: 01400000002000H0Y000B00A0000000 X-QQ-FEAT: V0qnkXF7A2hkAVXTunqMkYyGxxyCu7C2go5c92fw2/4+2xdw2osIeNyeX6rCC YTvmhh4NuKBO834o3GPthPvSGRG7EHb4QDbu6MtT4Y/26YQvhcx2yVBxaCkaMjSR4fokg3K D+qZ54m42hkEPVpXXWT6Se5V4/TLEAWCA6O5bN5NIXFr9NsbThbzgv/eOrAswMHbfDylXZS b5ChdKQT3LMJ4Tp0qrHA0uDuXU8AwCEHwSq7kJdIWyaBk/6rT2icssc1f2mhXyxP2n//27o X5F4aK8tX8ufArZJ4pKyV03trK2gZdJ1jBLpStVJr7/qc/hu7z2QCm+AxOVhLqXtmaLOrN3 4x2UAXigNNWMGkuuFrmS/0eBBW4d5kpvp4cQGI8PVBrIR+ISF/0GJahaOSgT45S+rQQ98Za OFqBItpF7udY/VBSmnkVIA== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu , stable@dpdk.org Subject: [PATCH v2 02/10] net/txgbe: fix Rx buffer size in configure register Date: Thu, 2 Feb 2023 17:21:24 +0800 Message-Id: <20230202092132.3271910-3-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230202092132.3271910-1-jiawenwu@trustnetic.com> References: <20230118060039.3074016-1-jiawenwu@trustnetic.com> <20230202092132.3271910-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp: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 When round up buffer size to 1K, to configure the register, hardware will receive packets exceeding the buffer size in LRO mode. It will cause a segment fault in the receive function. Fixes: be797cbf4582 ("net/txgbe: add Rx and Tx init") Cc: stable@dpdk.org Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_rxtx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index ac1bba08a3..328406908d 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -4382,7 +4382,10 @@ txgbe_dev_rx_init(struct rte_eth_dev *dev) */ buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM); - buf_size = ROUND_UP(buf_size, 0x1 << 10); + if (buf_size < 1024) + buf_size = ROUND_UP(buf_size, 0x1 << 10); + else + buf_size = ROUND_DOWN(buf_size, 0x1 << 10); srrctl |= TXGBE_RXCFG_PKTLEN(buf_size); wr32(hw, TXGBE_RXCFG(rxq->reg_idx), srrctl); -- 2.27.0