[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190627142305.16b8f331@carbon>
Date: Thu, 27 Jun 2019 14:23:05 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Ilias Apalodimas <ilias.apalodimas@...aro.org>
Cc: netdev@...r.kernel.org, jaswinder.singh@...aro.org,
ard.biesheuvel@...aro.org, bjorn.topel@...el.com,
magnus.karlsson@...el.com, daniel@...earbox.net, ast@...nel.org,
makita.toshiaki@....ntt.co.jp, jakub.kicinski@...ronome.com,
john.fastabend@...il.com, davem@...emloft.net, brouer@...hat.com
Subject: Re: [RFC, PATCH 2/2, net-next] net: netsec: add XDP support
On Tue, 25 Jun 2019 18:06:19 +0300
Ilias Apalodimas <ilias.apalodimas@...aro.org> wrote:
> @@ -609,6 +639,9 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
> int tail = dring->tail;
> int cnt = 0;
>
> + if (dring->is_xdp)
> + spin_lock(&dring->lock);
> +
> pkts = 0;
> bytes = 0;
> entry = dring->vaddr + DESC_SZ * tail;
> @@ -622,16 +655,24 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
> eop = (entry->attr >> NETSEC_TX_LAST) & 1;
> dma_rmb();
>
> - dma_unmap_single(priv->dev, desc->dma_addr, desc->len,
> - DMA_TO_DEVICE);
> - if (eop) {
> - pkts++;
> + if (!eop)
> + goto next;
> +
> + if (desc->buf_type == TYPE_NETSEC_SKB) {
> + dma_unmap_single(priv->dev, desc->dma_addr, desc->len,
> + DMA_TO_DEVICE);
I don't think this is correct. If I read the code correctly, you will
miss the DMA unmap for !eop packets.
> bytes += desc->skb->len;
> dev_kfree_skb(desc->skb);
> + } else {
> + if (desc->buf_type == TYPE_NETSEC_XDP_NDO)
> + dma_unmap_single(priv->dev, desc->dma_addr,
> + desc->len, DMA_TO_DEVICE);
> + xdp_return_frame(desc->xdpf);
> }
> /* clean up so netsec_uninit_pkt_dring() won't free the skb
> * again
> */
> +next:
> *desc = (struct netsec_desc){};
>
> /* entry->attr is not going to be accessed by the NIC until
> @@ -645,6 +686,8 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
> entry = dring->vaddr + DESC_SZ * tail;
> cnt++;
> }
> + if (dring->is_xdp)
> + spin_unlock(&dring->lock);
>
> if (!cnt)
> return false;
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists