From patchwork Mon Sep 6 07:00:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiming Chen X-Patchwork-Id: 98036 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 80944A0C4D; Mon, 6 Sep 2021 09:01:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7141C40E5A; Mon, 6 Sep 2021 09:01:15 +0200 (CEST) Received: from mail-m974.mail.163.com (mail-m974.mail.163.com [123.126.97.4]) by mails.dpdk.org (Postfix) with ESMTP id 6E5F940C35; Mon, 6 Sep 2021 09:01:12 +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=D9DCe if1mRFgyN65BfYlm7eNulV5f6Zo0fwmakpCPjI=; b=KrSth3aFxfiZomQH1oYvc 2Y5KjREFSP9+qBEzg4tXLfOBlHVsexR6WtC/NK9/2mHg+3T1WYNuWA41yKmopSP3 Ci1HJkSaBtgjcX+CZnk68xpq/YEjy0sv5rsVI+2nPsxJsTYHODQMRIdFhTCHtkLY HooaAamUC+W04ylolZ3VDY= Received: from localhost.localdomain (unknown [124.160.214.74]) by smtp4 (Coremail) with SMTP id HNxpCgCnOy+svDVhtA54BQ--.1607S2; Mon, 06 Sep 2021 15:01:03 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, Qiming Chen , stable@dpdk.org Date: Mon, 6 Sep 2021 15:00:14 +0800 Message-Id: <20210906070014.9680-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 X-CM-TRANSID: HNxpCgCnOy+svDVhtA54BQ--.1607S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tFyrKr48Jr1Dur17Kw1rJFb_yoW8GF1fpr sxAFW7AF4YqrsIqw48AF42gFWFq39I9aya9FWfJ3s0kanYkF17WFyUGa9F9a4qkF48Janx Zr1DtryUWayFyw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jmeHgUUUUU= X-Originating-IP: [124.160.214.74] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBZAUGoFQHOWoCoAAAsl Subject: [dpdk-dev] [PATCH] net/i40e: fix 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. Fixes: c1715402df8f ("i40evf: fix jumbo frame support") Cc: stable@dpdk.org 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);