Commit 0791e68
net: ravb: Enforce descriptor type ordering
[ Upstream commit 5370c31 ]
Ensure the TX descriptor type fields are published in a safe order so the
DMA engine never begins processing a descriptor chain before all descriptor
fields are fully initialised.
For multi-descriptor transmits the driver writes DT_FEND into the last
descriptor and DT_FSTART into the first. The DMA engine begins processing
when it observes DT_FSTART. Move the dma_wmb() barrier so it executes
immediately after DT_FEND and immediately before writing DT_FSTART
(and before DT_FSINGLE in the single-descriptor case). This guarantees
that all prior CPU writes to the descriptor memory are visible to the
device before DT_FSTART is seen.
This avoids a situation where compiler/CPU reordering could publish
DT_FSTART ahead of DT_FEND or other descriptor fields, allowing the DMA to
start on a partially initialised chain and causing corrupted transmissions
or TX timeouts. Such a failure was observed on RZ/G2L with an RT kernel as
transmit queue timeouts and device resets.
Fixes: 2f45d19 ("ravb: minimize TX data copying")
Cc: [email protected]
Co-developed-by: Fabrizio Castro <[email protected]>
Signed-off-by: Fabrizio Castro <[email protected]>
Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Niklas Söderlund <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
[ kept unconditional skb_tx_timestamp() ]
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent ad36e20 commit 0791e68
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1596 | 1596 | | |
1597 | 1597 | | |
1598 | 1598 | | |
1599 | | - | |
1600 | | - | |
| 1599 | + | |
1601 | 1600 | | |
1602 | 1601 | | |
1603 | 1602 | | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1604 | 1614 | | |
1605 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
1606 | 1618 | | |
1607 | 1619 | | |
1608 | 1620 | | |
| |||
0 commit comments