Re: [PATCH net-next v3 1/4] net: macb: queue tie-off or disable during WOL suspend

From: Vineeth Karumanchi
Date: Fri Jun 07 2024 - 01:54:33 EST


Hi Andrew,


On 06/06/24 7:14 am, Andrew Lunn wrote:
@@ -5224,17 +5257,38 @@ static int __maybe_unused macb_suspend(struct device *dev)
if (bp->wol & MACB_WOL_ENABLED) {
spin_lock_irqsave(&bp->lock, flags);
- /* Flush all status bits */
- macb_writel(bp, TSR, -1);
- macb_writel(bp, RSR, -1);
+
+ /* Disable Tx and Rx engines before disabling the queues,
+ * this is mandatory as per the IP spec sheet
+ */
+ tmp = macb_readl(bp, NCR);
+ macb_writel(bp, NCR, tmp & ~(MACB_BIT(TE) | MACB_BIT(RE)));

Is there any need to wait for this to complete? What if there is a DMA
transaction in flight?

Andrew


For newer (r1p10 +) versions , there is a new bit in status register to get the active axi transaction, we can leverage it.


For older versions, there is no mechanism to check the current ongoing
transaction, it is a corner case. Currently, in macb_close(), iflink down and in suspend we are disabling / cutting clocks to the engine
without checking any DMA transaction in flight.


Thanks
Vineeth