Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: snelson@pensando.io
Cc: netdev@vger.kernel.org, neel@pensando.io
Subject: Re: [PATCH net-next 1/5] ionic: clean up page handling code
Date: Mon, 31 Aug 2020 17:14:54 -0700 (PDT)	[thread overview]
Message-ID: <20200831.171454.2235150331629306394.davem@davemloft.net> (raw)
In-Reply-To: <20200831233558.71417-2-snelson@pensando.io>

From: Shannon Nelson <snelson@pensando.io>
Date: Mon, 31 Aug 2020 16:35:54 -0700

> @@ -100,6 +100,8 @@ static struct sk_buff *ionic_rx_frags(struct ionic_queue *q,
>  		frag_len = min(len, (u16)PAGE_SIZE);
>  		len -= frag_len;
>  
> +		dma_sync_single_for_cpu(dev, dma_unmap_addr(page_info, dma_addr),
> +					len, DMA_FROM_DEVICE);
>  		dma_unmap_page(dev, dma_unmap_addr(page_info, dma_addr),
>  			       PAGE_SIZE, DMA_FROM_DEVICE);
>  		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,

The unmap operation performs a sync, if necessary, for you.

That's the pattern of usage:

	map();
	device read/write memory
	unmap();

That's it, no more, no less.

The time to use sync is when you want to maintain the mapping and keep
using it.

  reply	other threads:[~2020-09-01  0:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 23:35 [PATCH net-next 0/5] ionic: struct cleanups Shannon Nelson
2020-08-31 23:35 ` [PATCH net-next 1/5] ionic: clean up page handling code Shannon Nelson
2020-09-01  0:14   ` David Miller [this message]
2020-09-01  4:19     ` Shannon Nelson
2020-08-31 23:35 ` [PATCH net-next 2/5] ionic: smaller coalesce default Shannon Nelson
2020-08-31 23:50   ` Jakub Kicinski
2020-09-01  0:16     ` David Miller
2020-09-01  4:20       ` Shannon Nelson
2020-08-31 23:35 ` [PATCH net-next 3/5] ionic: struct reorder for faster access Shannon Nelson
2020-08-31 23:35 ` [PATCH net-next 4/5] ionic: clean up desc_info and cq_info structs Shannon Nelson
2020-08-31 23:35 ` [PATCH net-next 5/5] ionic: clean adminq service routine Shannon Nelson
2020-09-01  0:47 ` [PATCH net-next 0/5] ionic: struct cleanups Florian Fainelli
2020-09-01  4:21   ` Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200831.171454.2235150331629306394.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=neel@pensando.io \
    --cc=netdev@vger.kernel.org \
    --cc=snelson@pensando.io \
    --subject='Re: [PATCH net-next 1/5] ionic: clean up page handling code' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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