From: Wenjun Wu <wenjun1.wu@intel.com>
To: dev@dpdk.org, Yuying.Zhang@intel.com, beilei.xing@intel.com,
jingjing.wu@intel.com, qiming.yang@intel.com,
qi.z.zhang@intel.com
Cc: Wenjun Wu <wenjun1.wu@intel.com>, stable@dpdk.org
Subject: [PATCH v2 4/5] net/idpf: fix Rx data buffer size
Date: Fri, 14 Apr 2023 13:47:43 +0800 [thread overview]
Message-ID: <20230414054744.1399735-5-wenjun1.wu@intel.com> (raw)
In-Reply-To: <20230414054744.1399735-1-wenjun1.wu@intel.com>
This patch does two fixes.
1. No matter what the mbuf size is, the data buffer size should not
be greater than 16K - 128.
2. Align data buffer size to 128.
Fixes: 9c47c29739a1 ("net/idpf: add Rx queue setup")
Cc: stable@dpdk.org
Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
drivers/common/idpf/idpf_common_rxtx.h | 3 +++
drivers/net/idpf/idpf_rxtx.c | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/common/idpf/idpf_common_rxtx.h b/drivers/common/idpf/idpf_common_rxtx.h
index 11260d07f9..6cb83fc0a6 100644
--- a/drivers/common/idpf/idpf_common_rxtx.h
+++ b/drivers/common/idpf/idpf_common_rxtx.h
@@ -34,6 +34,9 @@
#define IDPF_MAX_TSO_FRAME_SIZE 262143
#define IDPF_TX_MAX_MTU_SEG 10
+#define IDPF_RLAN_CTX_DBUF_S 7
+#define IDPF_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128)
+
#define IDPF_TX_CKSUM_OFFLOAD_MASK ( \
RTE_MBUF_F_TX_IP_CKSUM | \
RTE_MBUF_F_TX_L4_MASK | \
diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c
index 414f9a37f6..3e3d81ca6d 100644
--- a/drivers/net/idpf/idpf_rxtx.c
+++ b/drivers/net/idpf/idpf_rxtx.c
@@ -155,7 +155,8 @@ idpf_rx_split_bufq_setup(struct rte_eth_dev *dev, struct idpf_rx_queue *rxq,
bufq->adapter = adapter;
len = rte_pktmbuf_data_room_size(bufq->mp) - RTE_PKTMBUF_HEADROOM;
- bufq->rx_buf_len = len;
+ bufq->rx_buf_len = RTE_ALIGN_FLOOR(len, (1 << IDPF_RLAN_CTX_DBUF_S));
+ bufq->rx_buf_len = RTE_MIN(bufq->rx_buf_len, IDPF_RX_MAX_DATA_BUF_SIZE);
/* Allocate a little more to support bulk allocate. */
len = nb_desc + IDPF_RX_MAX_BURST;
@@ -275,7 +276,8 @@ idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
rxq->offloads = idpf_rx_offload_convert(offloads);
len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
- rxq->rx_buf_len = len;
+ rxq->rx_buf_len = RTE_ALIGN_FLOOR(len, (1 << IDPF_RLAN_CTX_DBUF_S));
+ rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, IDPF_RX_MAX_DATA_BUF_SIZE);
/* Allocate a little more to support bulk allocate. */
len = nb_desc + IDPF_RX_MAX_BURST;
--
2.34.1
next prev parent reply other threads:[~2023-04-14 5:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 3:51 [PATCH v1 0/5] fix RX " Wenjun Wu
2023-04-14 3:51 ` [PATCH v1 1/5] net/i40e: " Wenjun Wu
2023-04-14 3:51 ` [PATCH v1 2/5] net/ice: " Wenjun Wu
2023-04-14 3:51 ` [PATCH v1 3/5] net/iavf: " Wenjun Wu
2023-04-14 3:51 ` [PATCH v1 4/5] net/idpf: " Wenjun Wu
2023-04-14 3:51 ` [PATCH v1 5/5] net/cpfl: " Wenjun Wu
2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu
2023-04-14 5:47 ` [PATCH v2 1/5] net/i40e: " Wenjun Wu
2023-04-14 5:47 ` [PATCH v2 2/5] net/ice: " Wenjun Wu
2023-04-14 5:47 ` [PATCH v2 3/5] net/iavf: " Wenjun Wu
2023-04-14 5:47 ` Wenjun Wu [this message]
2023-04-14 5:47 ` [PATCH v2 5/5] net/cpfl: " Wenjun Wu
2023-04-26 2:50 ` [PATCH v2 0/5] " Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230414054744.1399735-5-wenjun1.wu@intel.com \
--to=wenjun1.wu@intel.com \
--cc=Yuying.Zhang@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).