Patch "net: fec: add dma_wmb to ensure correct descriptor values" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: fec: add dma_wmb to ensure correct descriptor values

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-fec-add-dma_wmb-to-ensure-correct-descriptor-val.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 316556074d3ed59c3bc79747849abdfc81ab66c6
Author: Shenwei Wang <shenwei.wang@xxxxxxx>
Date:   Thu May 18 10:02:02 2023 -0500

    net: fec: add dma_wmb to ensure correct descriptor values
    
    [ Upstream commit 9025944fddfed5966c8f102f1fe921ab3aee2c12 ]
    
    Two dma_wmb() are added in the XDP TX path to ensure proper ordering of
    descriptor and buffer updates:
    1. A dma_wmb() is added after updating the last BD to make sure
       the updates to rest of the descriptor are visible before
       transferring ownership to FEC.
    2. A dma_wmb() is also added after updating the bdp to ensure these
       updates are visible before updating txq->bd.cur.
    3. Start the xmit of the frame immediately right after configuring the
       tx descriptor.
    
    Fixes: 6d6b39f180b8 ("net: fec: add initial XDP support")
    Signed-off-by: Shenwei Wang <shenwei.wang@xxxxxxx>
    Reviewed-by: Wei Fang <wei.fang@xxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 577d94821b3e7..38e5b5abe067c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3834,6 +3834,11 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep,
 	index = fec_enet_get_bd_index(last_bdp, &txq->bd);
 	txq->tx_skbuff[index] = NULL;
 
+	/* Make sure the updates to rest of the descriptor are performed before
+	 * transferring ownership.
+	 */
+	dma_wmb();
+
 	/* Send it on its way.  Tell FEC it's ready, interrupt when done,
 	 * it's the last BD of the frame, and to put the CRC on the end.
 	 */
@@ -3843,8 +3848,14 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep,
 	/* If this was the last BD in the ring, start at the beginning again. */
 	bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd);
 
+	/* Make sure the update to bdp are performed before txq->bd.cur. */
+	dma_wmb();
+
 	txq->bd.cur = bdp;
 
+	/* Trigger transmission start */
+	writel(0, txq->bd.reg_desc_active);
+
 	return 0;
 }
 
@@ -3873,12 +3884,6 @@ static int fec_enet_xdp_xmit(struct net_device *dev,
 		sent_frames++;
 	}
 
-	/* Make sure the update to bdp and tx_skbuff are performed. */
-	wmb();
-
-	/* Trigger transmission start */
-	writel(0, txq->bd.reg_desc_active);
-
 	__netif_tx_unlock(nq);
 
 	return sent_frames;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux