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: sta...@dpdk.org Signed-off-by: Wenjun Wu <wenjun1...@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