[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141031030940.GA14783@pek-khao-d1.corp.ad.wrs.com>
Date: Fri, 31 Oct 2014 11:09:40 +0800
From: Kevin Hao <haokexin@...il.com>
To: Claudiu Manoil <claudiu.manoil@...escale.com>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH] net: gianfar: fix dma check map error when DMA_API_DEBUG
is enabled
On Thu, Oct 30, 2014 at 06:28:01PM +0200, Claudiu Manoil wrote:
> On 10/30/2014 12:25 PM, Kevin Hao wrote:
>
> [...]
>
> >@@ -2406,6 +2416,25 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
> > spin_unlock_irqrestore(&tx_queue->txlock, flags);
> >
> > return NETDEV_TX_OK;
> >+
> >+dma_map_err:
> >+ txbdp = next_txbd(txbdp_start, base, tx_queue->tx_ring_size);
> >+ if (do_tstamp)
> >+ txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size);
> >+ for (i = 0; i < nr_frags; i++) {
> >+ lstatus = txbdp->lstatus;
> >+ if (!(lstatus & BD_LFLAG(TXBD_READY)))
> >+ break;
> >+
> >+ txbdp->lstatus = lstatus & ~BD_LFLAG(TXBD_READY);
> >+ bufaddr = txbdp->bufPtr;
> >+ dma_unmap_page(priv->dev, bufaddr, txbdp->length,
> >+ DMA_TO_DEVICE);
> >+ txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size);
> >+ }
> >+ gfar_wmb();
>
> Why use the wmb() memory barrier here?
Just want make sure that the update to the txbdp->lstatus is performed before
any possible update to the BD fields later. Maybe this seems a bit redundant.
But this is not in hot path, so we may tolerate this overhead for more safety.
Thanks,
Kevin
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists