Skip to contentSkip to conversation

gve: fix dma sync bug where not all pages synced

PATCH Superseded Adi Suresh 2 participants 3 messages Nov 19, 2019

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Adi Suresh

author
#0 lore raw

PATCH v3 1/1 gve: fix dma sync bug where not all pages synced

The previous commit had a bug where the last page in the memory range could not be synced. This change fixes the behavior so that all the required pages are synced.

Fixes 4a55e8417c5d ("gve: Fixes DMA synchronization")

---
Addressed in v3:
- Used 12 digits of commit hash in Fixes tag

 drivers/net/ethernet/google/gve/gve_tx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/google/gve/gve_tx.c +5 -4
index 0a9a7ee2a866..f4889431f9b7 100644
@@ -393,12 +393,13 @@ static void gve_tx_fill_seg_desc(union gve_tx_desc *seg_desc,
 static void gve_dma_sync_for_device(struct device *dev, dma_addr_t *page_buses,
 				    u64 iov_offset, u64 iov_len)
 {
+	u64 last_page = (iov_offset + iov_len - 1) / PAGE_SIZE;
+	u64 first_page = iov_offset / PAGE_SIZE;
 	dma_addr_t dma;
-	u64 addr;
+	u64 page;
 
-	for (addr = iov_offset; addr < iov_offset + iov_len;
-	     addr += PAGE_SIZE) {
-		dma = page_buses[addr / PAGE_SIZE];
+	for (page = first_page; page <= last_page; page++) {
+		dma = page_buses[page];
 		dma_sync_single_for_device(dev, dma, PAGE_SIZE, DMA_TO_DEVICE);
 	}
 }
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
maintainer
#1 lore raw

From: Adi Suresh <[email protected]>
Date: Mon, 18 Nov 2019 18:47:06 -0800

Quoted 1 line
Fixes 4a55e8417c5d ("gve: Fixes DMA synchronization")

This commit doesn't exist in any tree.

[davem@localhost net]$ git describe 4a55e8417c5d
fatal: Not a valid object name 4a55e8417c5d

The gve patch submission process is getting very frustrating for me, just FYI...

author
#2 lore raw

Fixed in v4.

Quoted 13 lines · David Miller

From: Adi Suresh <[email protected]>
Date: Mon, 18 Nov 2019 18:47:06 -0800

Quoted 1 line
Fixes 4a55e8417c5d ("gve: Fixes DMA synchronization")

This commit doesn't exist in any tree.

[davem@localhost net]$ git describe 4a55e8417c5d
fatal: Not a valid object name 4a55e8417c5d

The gve patch submission process is getting very frustrating for me, just FYI...