public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: gregory.clement@bootlin•com (Gregory CLEMENT)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/5] net: mvneta: fix the wrong function to unmap rx buf
Date: Wed, 29 Aug 2018 11:21:12 +0200	[thread overview]
Message-ID: <87a7p5jzp3.fsf@bootlin.com> (raw)
In-Reply-To: <20180829162751.018acbb6@xhacker.debian> (Jisheng Zhang's message of "Wed, 29 Aug 2018 16:27:51 +0800")

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.

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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-08-29  9:21 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 [this message]
2018-08-30  3:40     ` Jisheng Zhang
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=87a7p5jzp3.fsf@bootlin.com \
    --to=gregory.clement@bootlin$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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