Skip to content

Commit 4c3aa49

Browse files
committed
Merge branch 'net-ravb-fix-soc-specific-configuration-and-descriptor-handling-issues'
Lad Prabhakar says: ==================== net: ravb: Fix SoC-specific configuration and descriptor handling issues [part] This series addresses several issues in the Renesas Ethernet AVB (ravb) driver related descriptor ordering. A potential ordering hazard in descriptor setup could cause the DMA engine to start prematurely, leading to TX stalls on some platforms. The series includes the following changes: Enforce descriptor type ordering to prevent early DMA start Ensure proper write ordering of TX descriptor type fields to prevent the DMA engine from observing an incomplete descriptor chain. This fixes observed TX stalls on RZ/G2L platforms running RT kernels. Tested on R/G1x Gen2, RZ/G2x Gen3 and RZ/G2L family hardware. ==================== Link: https://patch.msgid.link/20251017151830.171062-1-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents d63f039 + 706136c commit 4c3aa49

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,15 +2211,35 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
22112211

22122212
skb_tx_timestamp(skb);
22132213
}
2214-
/* Descriptor type must be set after all the above writes */
2215-
dma_wmb();
2214+
22162215
if (num_tx_desc > 1) {
22172216
desc->die_dt = DT_FEND;
22182217
desc--;
2218+
/* When using multi-descriptors, DT_FEND needs to get written
2219+
* before DT_FSTART, but the compiler may reorder the memory
2220+
* writes in an attempt to optimize the code.
2221+
* Use a dma_wmb() barrier to make sure DT_FEND and DT_FSTART
2222+
* are written exactly in the order shown in the code.
2223+
* This is particularly important for cases where the DMA engine
2224+
* is already running when we are running this code. If the DMA
2225+
* sees DT_FSTART without the corresponding DT_FEND it will enter
2226+
* an error condition.
2227+
*/
2228+
dma_wmb();
22192229
desc->die_dt = DT_FSTART;
22202230
} else {
2231+
/* Descriptor type must be set after all the above writes */
2232+
dma_wmb();
22212233
desc->die_dt = DT_FSINGLE;
22222234
}
2235+
2236+
/* Before ringing the doorbell we need to make sure that the latest
2237+
* writes have been committed to memory, otherwise it could delay
2238+
* things until the doorbell is rang again.
2239+
* This is in replacement of the read operation mentioned in the HW
2240+
* manuals.
2241+
*/
2242+
dma_wmb();
22232243
ravb_modify(ndev, TCCR, TCCR_TSRQ0 << q, TCCR_TSRQ0 << q);
22242244

22252245
priv->cur_tx[q] += num_tx_desc;

0 commit comments

Comments
 (0)