Skip to contentSkip to conversation

e1000: Use dma_wmb() instead of wmb() before doorbell writes

PATCH New Venkatesh Srinivas 2 participants 2 messages Jun 10, 2019 – Jun 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e1000: Use dma_wmb() instead of wmb() before doorbell writes

e1000 writes to doorbells to post transmit descriptors and fill the receive ring. After writing descriptors to memory but before writing to doorbells, use dma_wmb() rather than wmb(). wmb() is more heavyweight than necessary for a device to see descriptor writes.

On x86, this avoids SFENCEs before doorbell writes in both the tx and rx paths. On ARM, this converts DSB ST -> DMB OSHST.

Tested: 82576EB / x86; QEMU (qemu emulates an 8257x)

---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +3 -3
index 551de8c2fef2..f703fa58458e 100644
@@ -3019,7 +3019,7 @@ static void e1000_tx_queue(struct e1000_adapter *adapter,
 	 * applicable for weak-ordered memory model archs,
 	 * such as IA-64).
 	 */
-	wmb();
+	dma_wmb();
 
 	tx_ring->next_to_use = i;
 }
@@ -4540,7 +4540,7 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter,
 		 * applicable for weak-ordered memory model archs,
 		 * such as IA-64).
 		 */
-		wmb();
+		dma_wmb();
 		writel(i, adapter->hw.hw_addr + rx_ring->rdt);
 	}
 }
@@ -4655,7 +4655,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
 		 * applicable for weak-ordered memory model archs,
 		 * such as IA-64).
 		 */
-		wmb();
+		dma_wmb();
 		writel(i, hw->hw_addr + rx_ring->rdt);
 	}
 }
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
#1 lore raw

PATCH 1/1 e1000: Use dma_wmb() instead of wmb() before doorbell writes

Quoted 16 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Venkatesh Srinivas
Sent: Monday, June 10, 2019 2:28 PM
To: Kirsher, Jeffrey T <[email protected]>
Cc: intel-wired-lan at osuosl.org; vsrinivas at ops101.org
Subject: [Intel-wired-lan] [PATCH] e1000: Use dma_wmb() instead of wmb() before doorbell writes

e1000 writes to doorbells to post transmit descriptors and fill the receive ring. After writing descriptors to memory but before writing to doorbells, use dma_wmb() rather than wmb(). wmb() is more heavyweight than necessary for a device to see descriptor writes.

On x86, this avoids SFENCEs before doorbell writes in both the tx and rx paths. On ARM, this converts DSB ST -> DMB OSHST.

Quoted 7 lines

Tested: 82576EB / x86; QEMU (qemu emulates an 8257x)

---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Tested with a handful of physical parts that I still have laying around just for this purpose, 82540EM, multiple 82541PI, 82541GI, 82543GC, multiple 82544GC, ...