summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Heib <mheib@redhat.com>2025-10-31 17:52:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-13 15:34:38 -0500
commit75d8062e9056aead115587ea490f04d8a8368bba (patch)
tree848e299d0e03f8c23f5bd0d6bf35b1b44592a5d5
parenta10496048cc57ae05d950c00bee97704dcbd5259 (diff)
downloadlinux-75d8062e9056aead115587ea490f04d8a8368bba.tar.gz
linux-75d8062e9056aead115587ea490f04d8a8368bba.tar.bz2
linux-75d8062e9056aead115587ea490f04d8a8368bba.zip
net: ionic: add dma_wmb() before ringing TX doorbell
[ Upstream commit d261f5b09c28850dc63ca1d3018596f829f402d5 ] The TX path currently writes descriptors and then immediately writes to the MMIO doorbell register to notify the NIC. On weakly ordered architectures, descriptor writes may still be pending in CPU or DMA write buffers when the doorbell is issued, leading to the device fetching stale or incomplete descriptors. Add a dma_wmb() in ionic_txq_post() to ensure all descriptor writes are visible to the device before the doorbell MMIO write. Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling") Signed-off-by: Mohammad Heib <mheib@redhat.com> Link: https://patch.msgid.link/20251031155203.203031-1-mheib@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ethernet/pensando/ionic/ionic_txrx.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index 0f5758c273c2..3a094d3ea6f4 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -29,6 +29,10 @@ static void ionic_tx_clean(struct ionic_queue *q,
static inline void ionic_txq_post(struct ionic_queue *q, bool ring_dbell)
{
+ /* Ensure TX descriptor writes reach memory before NIC reads them.
+ * Prevents device from fetching stale descriptors.
+ */
+ dma_wmb();
ionic_q_post(q, ring_dbell);
}