From 34f9cd94904518c507a5bc28d483f3f7695db0dc Mon Sep 17 00:00:00 2001 From: Stanislav Poboril Date: Mon, 9 Jun 2025 12:30:32 +0200 Subject: [PATCH] drivers: ethernet: eth_nxp_enet_qos: increase default buffer descriptors Increased the default number of TX and RX buffer descriptors from 4 to 16. Since the current default buffer size (CONFIG_NET_BUF_DATA_SIZE) is 128, increasing the number of RX buffers is needed to be able to receive at least one frame of a maximum size split between multiple buffers. The default number of TX buffers was increased to match the number of RX buffers and to be able to transmit large frames with many fragments. Added build-time configuration validation to ensure that the combined size of all RX buffers is sufficient to receive a maximum-sized Ethernet frame. Signed-off-by: Stanislav Poboril --- drivers/ethernet/eth_nxp_enet_qos/Kconfig | 8 ++++++-- drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/ethernet/eth_nxp_enet_qos/Kconfig b/drivers/ethernet/eth_nxp_enet_qos/Kconfig index fcf03148e33..2f144244998 100644 --- a/drivers/ethernet/eth_nxp_enet_qos/Kconfig +++ b/drivers/ethernet/eth_nxp_enet_qos/Kconfig @@ -36,17 +36,21 @@ config ETH_NXP_ENET_QOS_MAC_UNIQUE_MAC_ADDRESS config ETH_NXP_ENET_QOS_TX_BUFFER_DESCRIPTORS int "Number of tx buffer descriptors" - default 4 + default 16 range 4 1024 help Number of TX buffer descriptors. config ETH_NXP_ENET_QOS_RX_BUFFER_DESCRIPTORS int "Number of rx buffer descriptors" - default 4 + default 16 range 4 1024 help Number of RX buffer descriptors. + Each descriptor references a buffer of a size of CONFIG_NET_BUF_DATA_SIZE + (with the two least significant bits ignored), so set this to a value + large enough so that at least one frame of a maximum size can be + received into all buffers combined. config ETH_NXP_ENET_QOS_DMA_RESET_WAIT_TIME int "Time in microseconds to wait for software reset" diff --git a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c index 612705dc3a3..34b7639405b 100644 --- a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c +++ b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c @@ -24,6 +24,10 @@ LOG_MODULE_REGISTER(eth_nxp_enet_qos_mac, CONFIG_ETHERNET_LOG_LEVEL); #include "../eth.h" #include "nxp_enet_qos_priv.h" +/* Verify configuration */ +BUILD_ASSERT((ENET_QOS_RX_BUFFER_SIZE * NUM_RX_BUFDESC) >= ENET_QOS_MAX_NORMAL_FRAME_LEN, + "ENET_QOS_RX_BUFFER_SIZE * NUM_RX_BUFDESC is not large enough to receive a full frame"); + static const uint32_t rx_desc_refresh_flags = OWN_FLAG | RX_INTERRUPT_ON_COMPLETE_FLAG | BUF1_ADDR_VALID_FLAG;