fix RX data buffer size
cover 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.
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(-)
Signature · 1 line
2.34.1
PATCH 1/5 net/i40e: fix RX data buffer size
No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128.
--- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/net/i40e/i40e_rxtx.c +2 -0
@@ -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 ; }
drivers/net/i40e/i40e_rxtx.h +3 -0
@@ -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
Signature · 1 line
2.34.1
PATCH 2/5 net/ice: fix RX data buffer size
In reply to Wenjun WuThis 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")
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +2 -1
@@ -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 );
drivers/net/ice/ice_rxtx.c +2 -1
@@ -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);
drivers/net/ice/ice_rxtx.h +3 -0
@@ -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);
Signature · 1 line
2.34.1
PATCH 3/5 net/iavf: fix RX data buffer size
In reply to Wenjun WuNo matter what the mbuf size is, the data buffer size should not be greater than 16K - 128.
--- drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/net/iavf/iavf_rxtx.c +1 -0
@@ -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 ;
drivers/net/iavf/iavf_rxtx.h +3 -0
@@ -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
Signature · 1 line
2.34.1
PATCH 4/5 net/idpf: fix RX data buffer size
In reply to Wenjun WuThis 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.
--- drivers/common/idpf/idpf_common_rxtx.h | 3 +++ drivers/net/idpf/idpf_rxtx.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/common/idpf/idpf_common_rxtx.h +3 -0
@@ -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 | \
drivers/net/idpf/idpf_rxtx.c +4 -2
@@ -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 ;
Signature · 1 line
2.34.1
PATCH 5/5 net/cpfl: fix RX data buffer size
In reply to Wenjun WuThis 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.
--- drivers/net/cpfl/cpfl_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_rxtx.c +2 -1
@@ -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 ;
Signature · 1 line
2.34.1
v2 cover fix Rx data buffer size
In reply to Wenjun WuThis 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(-)
Signature · 1 line
2.34.1
PATCH v2 1/5 net/i40e: fix Rx data buffer size
No matter what the mbuf size is, the data buffer size should not be greater than 16K - 128.
--- drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/i40e/i40e_rxtx.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/net/i40e/i40e_rxtx.c +2 -0
@@ -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 ; }
drivers/net/i40e/i40e_rxtx.h +3 -0
@@ -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
Signature · 1 line
2.34.1
PATCH v2 2/5 net/ice: fix Rx data buffer size
In reply to Wenjun WuThis 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")
--- 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(-)
drivers/net/ice/ice_dcf_ethdev.c +2 -1
@@ -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 );
drivers/net/ice/ice_rxtx.c +2 -1
@@ -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);
drivers/net/ice/ice_rxtx.h +3 -0
@@ -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);
Signature · 1 line
2.34.1
PATCH v2 3/5 net/iavf: fix Rx data buffer size
In reply to Wenjun WuNo matter what the mbuf size is, the data buffer size should not be greater than 16K - 128.
--- drivers/net/iavf/iavf_rxtx.c | 1 + drivers/net/iavf/iavf_rxtx.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/net/iavf/iavf_rxtx.c +1 -0
@@ -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 ;
drivers/net/iavf/iavf_rxtx.h +3 -0
@@ -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
Signature · 1 line
2.34.1
PATCH v2 4/5 net/idpf: fix Rx data buffer size
In reply to Wenjun WuThis 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.
--- drivers/common/idpf/idpf_common_rxtx.h | 3 +++ drivers/net/idpf/idpf_rxtx.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/common/idpf/idpf_common_rxtx.h +3 -0
@@ -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 | \
drivers/net/idpf/idpf_rxtx.c +4 -2
@@ -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 ;
Signature · 1 line
2.34.1
PATCH v2 5/5 net/cpfl: fix Rx data buffer size
In reply to Wenjun WuThis 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.
--- drivers/net/cpfl/cpfl_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_rxtx.c +2 -1
@@ -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 ;
Signature · 1 line
2.34.1
RE: [PATCH v2 0/5] fix Rx data buffer size
In reply to Wenjun WuQuoted 11 lines
-----Original Message-----
From: Wu, Wenjun1 <[email protected]>
Sent: Friday, April 14, 2023 1:48 PM
To: [email protected]; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: Wu, Wenjun1 <[email protected]>
Subject: [PATCH v2 0/5] fix Rx data buffer size
Quoted 3 lines
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.
Quoted 27 lines
2. Align max buffer size to 128, or replace
RTE_ALIGNwithRTE_ALIGN_FLOORaccording to [1].[1] Commit
c9c45beb1b97("net/iavf: fix Rx queue buffer size alignment")---
v2: fix commit logWenjun 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 sizedrivers/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(-)
Quoted 2 lines
--
2.34.1
Applied to dpdk-next-net-intel.
Thanks
Qi