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: sta...@dpdk.org

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

Reply via email to