[PATCH 1/6] net: macb: use dummy descriptor for RBQP

Claudiu Beznea claudiu.beznea at microchip.com
Thu Dec 3 10:25:51 CET 2020


In case of multiple queues on RX side the queue scheduler
will try to use all the available configured queues (with
descriptors having TX_USED bit cleared). If at least one RBQP
points to a descriptor with a valid used bit configuration then
the reception may block as this may point to any memory. To avoid
this scenario all the queues (except queue zero) were disabled by
setting DMA descriptors with used bit set on proper RBQP. The driver
anyway uses only queue 0 for TX/RX.

Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
---
 drivers/net/macb.c | 4 +++-
 drivers/net/macb.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index b80a259ff757..836eb85ec96a 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -732,8 +732,10 @@ static int gmac_init_multi_queues(struct macb_device *macb)
 	flush_dcache_range(macb->dummy_desc_dma, macb->dummy_desc_dma +
 			ALIGN(MACB_TX_DUMMY_DMA_DESC_SIZE, PKTALIGN));
 
-	for (i = 1; i < num_queues; i++)
+	for (i = 1; i < num_queues; i++) {
 		gem_writel_queue_TBQP(macb, macb->dummy_desc_dma, i - 1);
+		gem_writel_queue_RBQP(macb, macb->dummy_desc_dma, i - 1);
+	}
 
 	return 0;
 }
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index 9b16383eba46..28c7fe306883 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -768,5 +768,7 @@
 #define GEM_RX_CSUM_CHECKED_MASK		2
 #define gem_writel_queue_TBQP(port, value, queue_num)	\
 	writel((value), (port)->regs + GEM_TBQP(queue_num))
+#define gem_writel_queue_RBQP(port, value, queue_num)	\
+	writel((value), (port)->regs + GEM_RBQP(queue_num))
 
 #endif /* __DRIVERS_MACB_H__ */
-- 
2.7.4



More information about the U-Boot mailing list