From patchwork Mon Aug 23 04:11:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiming Chen X-Patchwork-Id: 97193 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 65A3BA0C54; Mon, 23 Aug 2021 06:11:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E565940143; Mon, 23 Aug 2021 06:11:53 +0200 (CEST) Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by mails.dpdk.org (Postfix) with ESMTP id EE7A84003E for ; Mon, 23 Aug 2021 06:11:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=5PbSn pq7Nk4oypi+LS4wOYHZZCv5h+/RXNkdBwe89L4=; b=Pnqop89ZxYRjlg/mBWslA in3VskArWQszzvpU6yaPl3oXHr4mIy23Z0hb0Xno/8YEhiQfzuXmj91iNInzFkmn xoTeu0r/A7IiZS+k/0fyWD2zwMx47UlFPdI3VpS5pYQw9SNymQazM61ghLCvtCA6 ZkX+XwLPE1WiVkouVRHtGA= Received: from localhost.localdomain (unknown [124.160.214.99]) by smtp2 (Coremail) with SMTP id GtxpCgA3HeMBICNh7isbPg--.43S2; Mon, 23 Aug 2021 12:11:48 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, Qiming Chen Date: Mon, 23 Aug 2021 12:11:05 +0800 Message-Id: <20210823041105.8006-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: GtxpCgA3HeMBICNh7isbPg--.43S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tFyrKr48Jr1Dur17Kw1rJFb_yoW8Jw1Upr sxAFW7AF4jqrnFq3y8AF42gFWFq39a9aya9FWfJ3s09anYkF17WFyUGa9F9a4qkF4kJanr Zr1DtryUWayFyw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jlNtxUUUUU= X-Originating-IP: [124.160.214.99] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBUQT3oFaD-4+ODwAAsm Subject: [dpdk-dev] [PATCH] net/i40e: solve vf rxq buf size alignment 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 Sender: "dev" The RTE_ALIGN macro is aligned upwards. If the buf_size variable is not aligned with 1 << I40E_RXQ_CTX_DBUFF_SHIFT, the rx_buf_len is larger than the actual mbuf memory after the operation. When receiving the packet, if the packet is larger than the configured buf_size, it will cause a memory stepping event. The patch uses the RTE_ALIGN_FLOOR down alignment macro to correct the problem. Signed-off-by: Qiming Chen --- drivers/net/i40e/i40e_ethdev_vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 924da8dfb4..5b1c8e76ab 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1927,7 +1927,7 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) RTE_PKTMBUF_HEADROOM); rxq->hs_mode = i40e_header_split_none; rxq->rx_hdr_len = 0; - rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << I40E_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << I40E_RXQ_CTX_DBUFF_SHIFT)); len = rxq->rx_buf_len * I40E_MAX_CHAINED_RX_BUFFERS; rxq->max_pkt_len = RTE_MIN(len, dev_data->dev_conf.rxmode.max_rx_pkt_len);