Description
eth_sam_gmac is quite an advanced Ethernet driver, the only one using DMA, etc.
But at the same time it does something which no other Ethernet (or non-Ethernet) driver does: it enforces at compile-time (using #error directives) high limits on the number of fragment buffers used by the IP stack (CONFIG_NET_BUF_RX_COUNT, CONFIG_NET_BUF_TX_COUNT): https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/ethernet/eth_sam_gmac.c#L43 . This has the following negative effect on the entire IP stack and Zephyr overall:
Tests/sample apps which perfectly build for any other board, break when building for boards using the eth_sam_gmac driver, e.g. BOARD=sam_e70_xplained. As part of Zephyr CI, we build tests/samples for as many boards as possible, so this negatively affects Zephyr CI overall.
As a response to it, there are attempts to work around eth_sam_gmac's behavior by bumping CONFIG_NET_BUF_RX_COUNT, CONFIG_NET_BUF_TX_COUNT higher, e.g. a0df4f6, #8966, etc. (there were definitely more sam_e70_xplained specific commits like that). There're however following issues with such workarounds:
- It negatively affects available memory on smaller boards. We probably didn't face cases of running out of RAM just yet, but can very easy start to see with more complex examples integrating other memory-hungry code (e.g. TLS).
- It adversely affects IP stack performance/stability (which is due to bugs in the IP stack, but nonetheless, eth_sam_gmac's behavior complicates behavior here and now for many other boards). An example is Revert "samples: net: Fix sanitycheck for sam_e70_xplained board" #7831 .
This ticket is created to capture the concern, and consider various ways out of the situation.