[PATCH 8/8] net: mrmac: increase the Rx BD ring
Padmarao Begari <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
With only two Rx descriptors the ring is full as soon as two frames arrive before the network stack drains them, and any further frame is dropped by hardware until a descriptor is freed. eth_rx() processes up to ETH_PACKETS_BATCH_RECV packets in one call, so size the Rx ring from that constant. A full call can then be served from the ring without hardware running out of descriptors, and the ring depth follows if that constant ever changes. Add static_assert() for the hardware minimum of two descriptors per direction, so a smaller value fails the build instead of silently making MRMAC drop packets. This is headroom rather than a speed up. A TFTP transfer sends one block at a time and waits for the ACK, so it keeps at most one packet in flight and does not benefit from the deeper ring. Signed-off-by: Padmarao Begari <[email protected]> --- drivers/net/xilinx_axi_mrmac.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/xilinx_axi_mrmac.h b/drivers/net/xilinx_axi_mrmac.h index 2c5c83421e5..29f7c440238 100644 --- a/drivers/net/xilinx_axi_mrmac.h +++ b/drivers/net/xilinx_axi_mrmac.h @@ -11,14 +11,26 @@ #ifndef __XILINX_AXI_MRMAC_H #define __XILINX_AXI_MRMAC_H +#include <net.h> +#include <linux/build_bug.h> + #define MIN_PKT_SIZE 60 /* MRMAC needs atleast two buffer descriptors for Tx/Rx to work. * Otherwise MRMAC will drop the packets. So, have atleast two Tx and * two Rx bd's. + * + * Tx keeps the minimum because send() waits for the transfer to + * complete, so a deeper Tx ring would never hold more than one frame. + * Rx matches the number of packets eth_rx() retires in one call, so a + * full batch can be taken from the ring without hardware dropping a + * frame for want of a free descriptor. */ #define TX_DESC 2 -#define RX_DESC 2 +#define RX_DESC ETH_PACKETS_BATCH_RECV + +static_assert(TX_DESC >= 2, "MRMAC needs at least two Tx descriptors"); +static_assert(RX_DESC >= 2, "MRMAC needs at least two Rx descriptors"); /* MRMAC platform data structure */ struct axi_mrmac_plat { -- 2.34.1