drivers: eth: gmac: conservatively compute the number of descriptors
If a pkt has more frags than the number of TX descriptors, we end up in a deadlock situation, as the whole packet and thus all the frags have to be mapped in the descriptors at once. That is why the number of descriptors is defined as CONFIG_NET_BUF_TX_COUNT + 1. This wrongly assumes that only TX buffers can be used to send data, however the packets might also come from the RX buffers, like for example with ICMPv4. Therefore define the number of descriptors as the maximum of CONFIG_NET_BUF_RX_COUNT + 1 and CONFIG_NET_BUF_TX_COUNT + 1. This fixes a deadlock when CONFIG_NET_BUF_TX_COUNT is much smaller than CONFIG_NET_BUF_RX_COUNT. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
18b07e09e0
commit
afbee4c96a
@ -30,8 +30,11 @@
|
||||
|
||||
/** RX descriptors count for main queue */
|
||||
#define MAIN_QUEUE_RX_DESC_COUNT CONFIG_ETH_SAM_GMAC_BUF_RX_COUNT
|
||||
/** TX descriptors count for main queue */
|
||||
#define MAIN_QUEUE_TX_DESC_COUNT (CONFIG_NET_BUF_TX_COUNT + 1)
|
||||
/** TX descriptors count for main queue. They should be able to store a full
|
||||
** packet, that might use either the TX or the RX buffers.
|
||||
*/
|
||||
#define MAIN_QUEUE_TX_DESC_COUNT (max(CONFIG_NET_BUF_RX_COUNT, \
|
||||
CONFIG_NET_BUF_TX_COUNT) + 1)
|
||||
|
||||
/** RX/TX descriptors count for priority queues */
|
||||
#if GMAC_PRIORITY_QUEUE_NO == 2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user