Subject: Re: [RFC, PATCH 2/2, net-next] net: netsec: add XDP support

From: Ilias Apalodimas <[email-masked]>
Date: Thu, 27 Jun 2019 15:24:30 +0300

On Thu, Jun 27, 2019 at 02:23:05PM +0200, Jesper Dangaard Brouer wrote:
> On Tue, 25 Jun 2019 18:06:19 +0300
> Ilias Apalodimas <[email-masked]> 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.
> 

You are reading it correct, thanks for catching this.
I'll fix it on the proper patch

Thanks
/Ilias