Skip to content

Commit 047c1ac

Browse files
prabhakarladUlrich Hecht
authored andcommitted
net: ravb: Ensure memory write completes before ringing TX doorbell
commit 706136c5723626fcde8dd8f598a4dcd251e24927 upstream. Add a final dma_wmb() barrier before triggering the transmit request (TCCR_TSRQ) to ensure all descriptor and buffer writes are visible to the DMA engine. According to the hardware manual, a read-back operation is required before writing to the doorbell register to guarantee completion of previous writes. Instead of performing a dummy read, a dma_wmb() is used to both enforce the same ordering semantics on the CPU side and also to ensure completion of writes. Fixes: c156633 ("Renesas Ethernet AVB driver proper") Cc: stable@vger.kernel.org Co-developed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Link: https://patch.msgid.link/20251017151830.171062-5-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [uli: backport to 4.19] Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 1308591 commit 047c1ac

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,13 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
15911591
desc--;
15921592
desc->die_dt = DT_FSTART;
15931593

1594+
/* Before ringing the doorbell we need to make sure that the latest
1595+
* writes have been committed to memory, otherwise it could delay
1596+
* things until the doorbell is rang again.
1597+
* This is in replacement of the read operation mentioned in the HW
1598+
* manuals.
1599+
*/
1600+
dma_wmb();
15941601
ravb_modify(ndev, TCCR, TCCR_TSRQ0 << q, TCCR_TSRQ0 << q);
15951602

15961603
priv->cur_tx[q] += NUM_TX_DESC;

0 commit comments

Comments
 (0)