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: <CAK8P3a3katJh+r-SveR0D_tcF2gvXxv_RAAF4cVeEsf==mi6Tg@mail.gmail.com>
Date:   Thu, 4 Jul 2019 17:22:19 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Ilias Apalodimas <ilias.apalodimas@...aro.org>
Cc:     Networking <netdev@...r.kernel.org>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: Re: [net-next, PATCH, v2] net: netsec: Sync dma for device on buffer allocation

On Thu, Jul 4, 2019 at 4:46 PM Ilias Apalodimas
<ilias.apalodimas@...aro.org> wrote:
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index 5544a722543f..ada7626bf3a2 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
>
> +       dma_start = page_pool_get_dma_addr(page);
>         /* We allocate the same buffer length for XDP and non-XDP cases.
>          * page_pool API will map the whole page, skip what's needed for
>          * network payloads and/or XDP
>          */
> -       *dma_handle = page_pool_get_dma_addr(page) + NETSEC_RXBUF_HEADROOM;
> +       *dma_handle = dma_start + NETSEC_RXBUF_HEADROOM;
>         /* Make sure the incoming payload fits in the page for XDP and non-XDP
>          * cases and reserve enough space for headroom + skb_shared_info
>          */
>         *desc_len = PAGE_SIZE - NETSEC_RX_BUF_NON_DATA;
> +       dma_dir = page_pool_get_dma_dir(dring->page_pool);
> +       dma_sync_single_for_device(priv->dev, dma_start, PAGE_SIZE, dma_dir);

Should this maybe become part of the page_pool_*() interfaces?
Basically in order to map a page from the pool, any driver would have
to go through these exact steps, so you could make it a combined function
call

dma_addr_t page_pool_sync_for_device(dring->page_pool, page);

Or even fold the page_pool_dev_alloc_pages() into it as well and
make that return both the virtual and dma addresses.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ