netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: <thomas.petazzoni@bootlin.com>,
	"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH 2/5] net: mvneta: fix the wrong function to unmap rx buf
Date: Thu, 30 Aug 2018 11:40:42 +0800	[thread overview]
Message-ID: <20180830114042.1f9900d6@xhacker.debian> (raw)
In-Reply-To: <87a7p5jzp3.fsf@bootlin.com>

On Wed, 29 Aug 2018 11:21:12 +0200 Gregory CLEMENT  wrote:

> Hi Jisheng,
>  
>  On mer., août 29 2018, Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
> 
> > Commit 7e47fd84b56b ("net: mvneta: Allocate page for the descriptor")
> > always allocate one page for each rx descriptor, so the rx is mapped
> > with dmap_map_page() now, but the unmap routine isn't updated at the
> > same time.
> >
> > Fix this by using dma_unmap_page() in corresponding places.
> >
> > Fixes: 7e47fd84b56b ("net: mvneta: Allocate page for the descriptor")
> > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> > ---
> >  drivers/net/ethernet/marvell/mvneta.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> > index 0ce94f6587a5..d9206094fce3 100644
> > --- a/drivers/net/ethernet/marvell/mvneta.c
> > +++ b/drivers/net/ethernet/marvell/mvneta.c
> > @@ -1890,8 +1890,9 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp,
> >  		if (!data || !(rx_desc->buf_phys_addr))
> >  			continue;
> >  
> > -		dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
> > -				 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
> > +		dma_unmap_page(pp->dev->dev.parent, rx_desc->buf_phys_addr,
> > +			       MVNETA_RX_BUF_SIZE(pp->pkt_size),
> > +			       DMA_FROM_DEVICE);
> >  		__free_page(data);
> >  	}
> >  }  
> This one can be called when the allocation is done in with HWBM in this
> case which use a dma_map_single.

oops, thanks for the catch. will fix it in v2

> 
> Gregory
> 
> 
> 
> > @@ -2008,8 +2009,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
> >  				skb_add_rx_frag(rxq->skb, frag_num, page,
> >  						frag_offset, frag_size,
> >  						PAGE_SIZE);
> > -				dma_unmap_single(dev->dev.parent, phys_addr,
> > -						 PAGE_SIZE, DMA_FROM_DEVICE);
> > +				dma_unmap_page(dev->dev.parent, phys_addr,
> > +					       PAGE_SIZE, DMA_FROM_DEVICE);
> >  				rxq->left_size -= frag_size;
> >  			}
> >  		} else {
> > @@ -2039,9 +2040,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
> >  						frag_offset, frag_size,
> >  						PAGE_SIZE);
> >  
> > -				dma_unmap_single(dev->dev.parent, phys_addr,
> > -						 PAGE_SIZE,
> > -						 DMA_FROM_DEVICE);
> > +				dma_unmap_page(dev->dev.parent, phys_addr,
> > +					       PAGE_SIZE, DMA_FROM_DEVICE);
> >  
> >  				rxq->left_size -= frag_size;
> >  			}
> > -- 
> > 2.18.0
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel  
> 

  reply	other threads:[~2018-08-30  3:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  8:25 [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29  8:27 ` [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage Jisheng Zhang
2018-08-29  9:05   ` Gregory CLEMENT
2018-08-29  9:16     ` Jisheng Zhang
2018-08-29  8:27 ` [PATCH 2/5] net: mvneta: fix the wrong function to unmap rx buf Jisheng Zhang
2018-08-29  9:21   ` Gregory CLEMENT
2018-08-30  3:40     ` Jisheng Zhang [this message]
2018-08-29  8:28 ` [PATCH 3/5] net: mvneta: Don't check NETIF_F_GRO ourself Jisheng Zhang
2018-08-29  9:37   ` Gregory CLEMENT
2018-08-29  8:29 ` [PATCH 4/5] net: mvneta: enable NETIF_F_RXCSUM by default Jisheng Zhang
2018-08-29  9:38   ` Gregory CLEMENT
2018-08-29 13:08   ` Andrew Lunn
2018-08-30  3:27     ` Jisheng Zhang
2018-08-30  3:44       ` Andrew Lunn
2018-08-29  8:30 ` [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Jisheng Zhang
2018-08-29  9:44   ` Gregory CLEMENT
2018-08-29  8:40 ` [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29  8:51   ` Jisheng Zhang
2018-08-30  3:53     ` Jisheng Zhang
2018-08-29 13:12 ` Andrew Lunn
2018-08-30  3:42   ` Jisheng Zhang

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=20180830114042.1f9900d6@xhacker.debian \
    --to=jisheng.zhang@synaptics.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).