* [PATCH v1 0/5] fix RX data buffer size @ 2023-04-14 3:51 Wenjun Wu 2023-04-14 3:51 ` [PATCH v1 1/5] net/i40e: " Wenjun Wu ` (5 more replies) 0 siblings, 6 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu This patch set fixes RX data buffer size in ice, i40e, iavf and idpf driver. 1. Limit the maximum buffer size to no more than 16K - 128. 2. Align max buffer size to 128, or replace RTE_ALIGN with RTE_ALIGN_FLOOR according to [1]. [1] Commit c9c45beb1b97 ("net/iavf: fix Rx queue buffer size alignment") Wenjun Wu (5): net/i40e: fix RX data buffer size net/ice: fix RX data buffer size net/iavf: fix RX data buffer size net/idpf: fix RX data buffer size net/cpfl: fix RX data buffer size drivers/common/idpf/idpf_common_rxtx.h | 3 +++ drivers/net/cpfl/cpfl_rxtx.c | 3 ++- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ drivers/net/ice/ice_dcf_ethdev.c | 3 ++- drivers/net/ice/ice_rxtx.c | 3 ++- drivers/net/ice/ice_rxtx.h | 3 +++ drivers/net/idpf/idpf_rxtx.c | 6 ++++-- 10 files changed, 25 insertions(+), 5 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 1/5] net/i40e: fix RX data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size Wenjun Wu @ 2023-04-14 3:51 ` Wenjun Wu 2023-04-14 3:51 ` [PATCH v1 2/5] net/ice: " Wenjun Wu ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 788ffb51c2..fbbefb5015 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2904,6 +2904,8 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) rxq->rx_hdr_len = 0; rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << I40E_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, + I40E_RX_MAX_DATA_BUF_SIZE); rxq->hs_mode = i40e_header_split_none; break; } diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index 5e6eecc501..0376c219be 100644 --- a/drivers/net/i40e/i40e_rxtx.h +++ b/drivers/net/i40e/i40e_rxtx.h @@ -21,6 +21,9 @@ /* In none-PXE mode QLEN must be whole number of 32 descriptors. */ #define I40E_ALIGN_RING_DESC 32 +/* Max data buffer size must be 16K - 128 bytes */ +#define I40E_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + #define I40E_MIN_RING_DESC 64 #define I40E_MAX_RING_DESC 4096 -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 2/5] net/ice: fix RX data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size Wenjun Wu 2023-04-14 3:51 ` [PATCH v1 1/5] net/i40e: " Wenjun Wu @ 2023-04-14 3:51 ` Wenjun Wu 2023-04-14 3:51 ` [PATCH v1 3/5] net/iavf: " Wenjun Wu ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable 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. Replace RTE_ALIGN with RTE_ALIGN_FLOOR according to [1]. [1] Commit c9c45beb1b97 ("net/iavf: fix Rx queue buffer size alignment") Fixes: 50370662b727 ("net/ice: support device and queue ops") Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/ice/ice_dcf_ethdev.c | 3 ++- drivers/net/ice/ice_rxtx.c | 3 ++- drivers/net/ice/ice_rxtx.h | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index dcbf2af5b0..7304ea721c 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -115,7 +115,8 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; rxq->rx_hdr_len = 0; - rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE); max_pkt_len = RTE_MIN(ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, dev->data->mtu + ICE_ETH_OVERHEAD); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0ea0045836..560c1a4af7 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -259,7 +259,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) /* Set buffer size as the head split is disabled. */ buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM); - rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE); rxq->max_pkt_len = RTE_MIN((uint32_t)ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, frame_size); diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 94f6bcf3d1..89569029e1 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -51,6 +51,9 @@ extern int ice_timestamp_dynfield_offset; /* Max header size can be 2K - 64 bytes */ #define ICE_RX_HDR_BUF_SIZE (2048 - 64) +/* Max data buffer size must be 16K - 128 bytes */ +#define ICE_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + #define ICE_HEADER_SPLIT_ENA BIT(0) typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 3/5] net/iavf: fix RX data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size 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 ` Wenjun Wu 2023-04-14 3:51 ` [PATCH v1 4/5] net/idpf: " Wenjun Wu ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128. Fixes: 69dd4c3d0898 ("net/avf: enable queue and device") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index b1d0fbceb6..0db3aabd92 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -697,6 +697,7 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; rxq->rx_buf_len = RTE_ALIGN_FLOOR(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, IAVF_RX_MAX_DATA_BUF_SIZE); /* Allocate the software ring. */ len = nb_desc + IAVF_RX_MAX_BURST; diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index 09e2127db0..f205a2aaf1 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -16,6 +16,9 @@ /* used for Rx Bulk Allocate */ #define IAVF_RX_MAX_BURST 32 +/* Max data buffer size must be 16K - 128 bytes */ +#define IAVF_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + /* used for Vector PMD */ #define IAVF_VPMD_RX_MAX_BURST 32 #define IAVF_VPMD_TX_MAX_BURST 32 -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 4/5] net/idpf: fix RX data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size Wenjun Wu ` (2 preceding siblings ...) 2023-04-14 3:51 ` [PATCH v1 3/5] net/iavf: " Wenjun Wu @ 2023-04-14 3:51 ` 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 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 5/5] net/cpfl: fix RX data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size Wenjun Wu ` (3 preceding siblings ...) 2023-04-14 3:51 ` [PATCH v1 4/5] net/idpf: " Wenjun Wu @ 2023-04-14 3:51 ` Wenjun Wu 2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 3:51 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu 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. Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/cpfl/cpfl_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c index de59b31b3d..75021c3c54 100644 --- a/drivers/net/cpfl/cpfl_rxtx.c +++ b/drivers/net/cpfl/cpfl_rxtx.c @@ -155,7 +155,8 @@ cpfl_rx_split_bufq_setup(struct rte_eth_dev *dev, struct idpf_rx_queue *rxq, bufq->adapter = base; 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; -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 0/5] fix Rx data buffer size 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size Wenjun Wu ` (4 preceding siblings ...) 2023-04-14 3:51 ` [PATCH v1 5/5] net/cpfl: " Wenjun Wu @ 2023-04-14 5:47 ` Wenjun Wu 2023-04-14 5:47 ` [PATCH v2 1/5] net/i40e: " Wenjun Wu ` (5 more replies) 5 siblings, 6 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu This patch set fixes RX data buffer size in ice, i40e, iavf and idpf driver. 1. Limit the maximum buffer size to no more than 16K - 128. 2. Align max buffer size to 128, or replace RTE_ALIGN with RTE_ALIGN_FLOOR according to [1]. [1] Commit c9c45beb1b97 ("net/iavf: fix Rx queue buffer size alignment") --- v2: fix commit log Wenjun Wu (5): net/i40e: fix Rx data buffer size net/ice: fix Rx data buffer size net/iavf: fix Rx data buffer size net/idpf: fix Rx data buffer size net/cpfl: fix Rx data buffer size drivers/common/idpf/idpf_common_rxtx.h | 3 +++ drivers/net/cpfl/cpfl_rxtx.c | 3 ++- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ drivers/net/ice/ice_dcf_ethdev.c | 3 ++- drivers/net/ice/ice_rxtx.c | 3 ++- drivers/net/ice/ice_rxtx.h | 3 +++ drivers/net/idpf/idpf_rxtx.c | 6 ++++-- 10 files changed, 25 insertions(+), 5 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/5] net/i40e: fix Rx data buffer size 2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu @ 2023-04-14 5:47 ` Wenjun Wu 2023-04-14 5:47 ` [PATCH v2 2/5] net/ice: " Wenjun Wu ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 788ffb51c2..fbbefb5015 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2904,6 +2904,8 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) rxq->rx_hdr_len = 0; rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << I40E_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, + I40E_RX_MAX_DATA_BUF_SIZE); rxq->hs_mode = i40e_header_split_none; break; } diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index 5e6eecc501..0376c219be 100644 --- a/drivers/net/i40e/i40e_rxtx.h +++ b/drivers/net/i40e/i40e_rxtx.h @@ -21,6 +21,9 @@ /* In none-PXE mode QLEN must be whole number of 32 descriptors. */ #define I40E_ALIGN_RING_DESC 32 +/* Max data buffer size must be 16K - 128 bytes */ +#define I40E_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + #define I40E_MIN_RING_DESC 64 #define I40E_MAX_RING_DESC 4096 -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 2/5] net/ice: fix Rx data buffer size 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 ` Wenjun Wu 2023-04-14 5:47 ` [PATCH v2 3/5] net/iavf: " Wenjun Wu ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable 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. Replace RTE_ALIGN with RTE_ALIGN_FLOOR according to [1]. [1] Commit c9c45beb1b97 ("net/iavf: fix Rx queue buffer size alignment") Fixes: 50370662b727 ("net/ice: support device and queue ops") Fixes: 1b009275e2c8 ("net/ice: add Rx queue init in DCF") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/ice/ice_dcf_ethdev.c | 3 ++- drivers/net/ice/ice_rxtx.c | 3 ++- drivers/net/ice/ice_rxtx.h | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index dcbf2af5b0..7304ea721c 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -115,7 +115,8 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; rxq->rx_hdr_len = 0; - rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE); max_pkt_len = RTE_MIN(ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, dev->data->mtu + ICE_ETH_OVERHEAD); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0ea0045836..560c1a4af7 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -259,7 +259,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) /* Set buffer size as the head split is disabled. */ buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM); - rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE); rxq->max_pkt_len = RTE_MIN((uint32_t)ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, frame_size); diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 94f6bcf3d1..89569029e1 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -51,6 +51,9 @@ extern int ice_timestamp_dynfield_offset; /* Max header size can be 2K - 64 bytes */ #define ICE_RX_HDR_BUF_SIZE (2048 - 64) +/* Max data buffer size must be 16K - 128 bytes */ +#define ICE_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + #define ICE_HEADER_SPLIT_ENA BIT(0) typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 3/5] net/iavf: fix Rx data buffer size 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 ` Wenjun Wu 2023-04-14 5:47 ` [PATCH v2 4/5] net/idpf: " Wenjun Wu ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128. Fixes: 69dd4c3d0898 ("net/avf: enable queue and device") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index b1d0fbceb6..0db3aabd92 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -697,6 +697,7 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; rxq->rx_buf_len = RTE_ALIGN_FLOOR(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, IAVF_RX_MAX_DATA_BUF_SIZE); /* Allocate the software ring. */ len = nb_desc + IAVF_RX_MAX_BURST; diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index 09e2127db0..f205a2aaf1 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -16,6 +16,9 @@ /* used for Rx Bulk Allocate */ #define IAVF_RX_MAX_BURST 32 +/* Max data buffer size must be 16K - 128 bytes */ +#define IAVF_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128) + /* used for Vector PMD */ #define IAVF_VPMD_RX_MAX_BURST 32 #define IAVF_VPMD_TX_MAX_BURST 32 -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 4/5] net/idpf: fix Rx data buffer size 2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu ` (2 preceding siblings ...) 2023-04-14 5:47 ` [PATCH v2 3/5] net/iavf: " Wenjun Wu @ 2023-04-14 5:47 ` Wenjun Wu 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 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 5/5] net/cpfl: fix Rx data buffer size 2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu ` (3 preceding siblings ...) 2023-04-14 5:47 ` [PATCH v2 4/5] net/idpf: " Wenjun Wu @ 2023-04-14 5:47 ` Wenjun Wu 2023-04-26 2:50 ` [PATCH v2 0/5] " Zhang, Qi Z 5 siblings, 0 replies; 13+ messages in thread From: Wenjun Wu @ 2023-04-14 5:47 UTC (permalink / raw) To: dev, Yuying.Zhang, beilei.xing, jingjing.wu, qiming.yang, qi.z.zhang Cc: Wenjun Wu, stable 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: 119834846e93 ("net/cpfl: support Rx queue setup") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> --- drivers/net/cpfl/cpfl_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c index de59b31b3d..75021c3c54 100644 --- a/drivers/net/cpfl/cpfl_rxtx.c +++ b/drivers/net/cpfl/cpfl_rxtx.c @@ -155,7 +155,8 @@ cpfl_rx_split_bufq_setup(struct rte_eth_dev *dev, struct idpf_rx_queue *rxq, bufq->adapter = base; 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; -- 2.34.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2 0/5] fix Rx data buffer size 2023-04-14 5:47 ` [PATCH v2 0/5] fix Rx " Wenjun Wu ` (4 preceding siblings ...) 2023-04-14 5:47 ` [PATCH v2 5/5] net/cpfl: " Wenjun Wu @ 2023-04-26 2:50 ` Zhang, Qi Z 5 siblings, 0 replies; 13+ messages in thread From: Zhang, Qi Z @ 2023-04-26 2:50 UTC (permalink / raw) To: Wu, Wenjun1, dev, Zhang, Yuying, Xing, Beilei, Wu, Jingjing, Yang, Qiming > -----Original Message----- > From: Wu, Wenjun1 <wenjun1.wu@intel.com> > Sent: Friday, April 14, 2023 1:48 PM > To: dev@dpdk.org; Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei > <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yang, > Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com> > Cc: Wu, Wenjun1 <wenjun1.wu@intel.com> > Subject: [PATCH v2 0/5] fix Rx data buffer size > > This patch set fixes RX data buffer size in ice, i40e, iavf and idpf driver. > > 1. Limit the maximum buffer size to no more than 16K - 128. Confirmed with author, this target to align with hardware spec, added related explanation in commit log. > 2. Align max buffer size to 128, or replace RTE_ALIGN with > RTE_ALIGN_FLOOR according to [1]. > > [1] Commit c9c45beb1b97 ("net/iavf: fix Rx queue buffer size alignment") > > --- > v2: fix commit log > > Wenjun Wu (5): > net/i40e: fix Rx data buffer size > net/ice: fix Rx data buffer size > net/iavf: fix Rx data buffer size > net/idpf: fix Rx data buffer size > net/cpfl: fix Rx data buffer size > > drivers/common/idpf/idpf_common_rxtx.h | 3 +++ > drivers/net/cpfl/cpfl_rxtx.c | 3 ++- > drivers/net/i40e/i40e_rxtx.c | 2 ++ > drivers/net/i40e/i40e_rxtx.h | 3 +++ > drivers/net/iavf/iavf_rxtx.c | 1 + > drivers/net/iavf/iavf_rxtx.h | 3 +++ > drivers/net/ice/ice_dcf_ethdev.c | 3 ++- > drivers/net/ice/ice_rxtx.c | 3 ++- > drivers/net/ice/ice_rxtx.h | 3 +++ > drivers/net/idpf/idpf_rxtx.c | 6 ++++-- > 10 files changed, 25 insertions(+), 5 deletions(-) > > -- > 2.34.1 Acked-by: Qi Zhang <qi.z.zhang@intel.com> Applied to dpdk-next-net-intel. Thanks Qi ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-04-26 2:50 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-04-14 3:51 [PATCH v1 0/5] fix RX data buffer size 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 ` [PATCH v2 4/5] net/idpf: " Wenjun Wu 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
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).