lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200831.171454.2235150331629306394.davem@davemloft.net>
Date:   Mon, 31 Aug 2020 17:14:54 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     snelson@...sando.io
Cc:     netdev@...r.kernel.org, neel@...sando.io
Subject: Re: [PATCH net-next 1/5] ionic: clean up page handling code

From: Shannon Nelson <snelson@...sando.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ