netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] gve: fix dma sync bug where not all pages synced
@ 2019-11-19  2:47 Adi Suresh
  2019-11-19  2:51 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Adi Suresh @ 2019-11-19  2:47 UTC (permalink / raw)
  To: netdev; +Cc: Adi Suresh, Catherine Sullivan

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")
Signed-off-by: Adi Suresh <adisuresh@google.com>
Reviewed-by: Catherine Sullivan <csully@google.com>
---
 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(-)

diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c
index 0a9a7ee2a866..f4889431f9b7 100644
--- a/drivers/net/ethernet/google/gve/gve_tx.c
+++ b/drivers/net/ethernet/google/gve/gve_tx.c
@@ -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);
 	}
 }
-- 
2.24.0.432.g9d3f5f5b63-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] gve: fix dma sync bug where not all pages synced
  2019-11-19  2:47 [PATCH net v3] gve: fix dma sync bug where not all pages synced Adi Suresh
@ 2019-11-19  2:51 ` David Miller
  2019-11-19 16:03   ` Adi Suresh
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-11-19  2:51 UTC (permalink / raw)
  To: adisuresh; +Cc: netdev, csully

From: Adi Suresh <adisuresh@google.com>
Date: Mon, 18 Nov 2019 18:47:06 -0800

> 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...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] gve: fix dma sync bug where not all pages synced
  2019-11-19  2:51 ` David Miller
@ 2019-11-19 16:03   ` Adi Suresh
  0 siblings, 0 replies; 3+ messages in thread
From: Adi Suresh @ 2019-11-19 16:03 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Catherine Sullivan

Fixed in v4.

On Mon, Nov 18, 2019 at 6:51 PM David Miller <davem@davemloft.net> wrote:
>
> From: Adi Suresh <adisuresh@google.com>
> Date: Mon, 18 Nov 2019 18:47:06 -0800
>
> > 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...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-19 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  2:47 [PATCH net v3] gve: fix dma sync bug where not all pages synced Adi Suresh
2019-11-19  2:51 ` David Miller
2019-11-19 16:03   ` Adi Suresh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).