All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vlad Zolotarov" <vladz@broadcom.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Eilon Greenstein <eilong@broadcom.com>,
	Gary Zambrano <zambrano@broadcom.com>,
	Stephen Hemminger <shemminger@linux-foundation.org>,
	Stefano Brivio <stefano.brivio@polimi.it>,
	"e1000-devel@lists.sourceforge.net"
	<e1000-devel@lists.sourceforge.net>,
	Matthew Carlson <mcarlson@broadcom.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Francois Romieu <romieu@fr.zoreil.com>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	Ron Mercer <ron.mercer@qlogic.com>,
	Michael Chan <mchan@broadcom.com>,
	Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>,
	Divy Le Ray <divy@chelsio.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Bruce Allan <bruce.w.allan@intel.com>,
	Hartley Sweeten <hsweeten@visionengravers.com>,
	John Ronciak <john.ronciak@intel.com>,
	Jon Mas
Subject: Re: [PATCH v2 03/46] net drivers: remove unnecessary dma_sync_to_device(DMA_FROM_DEVICE)
Date: Mon, 11 Jul 2011 11:30:39 +0300	[thread overview]
Message-ID: <201107111130.39629.vladz@broadcom.com> (raw)
In-Reply-To: <6f2d2a58a4932cd93a0291fac9636d3681d69031.1310339688.git.mirq-linux@rere.qmqm.pl>

>         prod_rx_buf->skb = skb;
> diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
> index c016e20..c9e49a0 100644
> --- a/drivers/net/bnx2x/bnx2x_cmn.h
> +++ b/drivers/net/bnx2x/bnx2x_cmn.h
> @@ -923,16 +923,11 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x
> *bp, static inline void bnx2x_reuse_rx_skb(struct bnx2x_fastpath *fp,
>                                       u16 cons, u16 prod)
>  {
> -       struct bnx2x *bp = fp->bp;
>         struct sw_rx_bd *cons_rx_buf = &fp->rx_buf_ring[cons];
>         struct sw_rx_bd *prod_rx_buf = &fp->rx_buf_ring[prod];
>         struct eth_rx_bd *cons_bd = &fp->rx_desc_ring[cons];
>         struct eth_rx_bd *prod_bd = &fp->rx_desc_ring[prod];
> 
> -       dma_sync_single_for_device(&bp->pdev->dev,
> -                                  dma_unmap_addr(cons_rx_buf, mapping),
> -                                  RX_COPY_THRESH, DMA_FROM_DEVICE);
> -
>         dma_unmap_addr_set(prod_rx_buf, mapping,
>                            dma_unmap_addr(cons_rx_buf, mapping));
>         prod_rx_buf->skb = cons_rx_buf->skb;

Michal, pls., note that this function is only called for buffers which were 
previously dma_synced towards CPU (your "[PATCH v2 05/46] net: bnx2x: fix DMA 
sync direction" properly fixes the direction of the first call which was 
incorrect). Then, according to the 3d edition of the "Linux device drivers" 
book, chapter 15, "Setting up streaming DMA mappings" article, end of the page 
449, when we call for dma_syc_single_for_cpu() the buffer ownership gets to 
the CPU and CPU may safely access the buffer (in particular, we read it). Then 
the author says: "Before the device accesses the buffer, however, ownership 
should be transfered back to it with: dma_sync_single_for_device().

The DMA-API.txt document u've referenced doesn't refer the above function, so, 
it's unclear how your fix may be based on it. On the other hand it clearly 
contradicts the "Linux device driver" book.

Pls., comment.

thanks,
vlad


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

  reply	other threads:[~2011-07-11  8:30 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11  0:52 [PATCH v2 00/46] Clean up RX copybreak and DMA handling Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 03/46] net drivers: remove unnecessary dma_sync_to_device(DMA_FROM_DEVICE) Michał Mirosław
2011-07-11  8:30   ` Vlad Zolotarov [this message]
2011-07-11  9:29     ` Michał Mirosław
2011-07-11  9:46       ` Vlad Zolotarov
2011-07-11  0:52 ` [PATCH v2 01/46] net: introduce __netdev_alloc_skb_aligned() Michał Mirosław
2011-07-11  5:46   ` [PATCH net-next-2.6] net: introduce build_skb() Eric Dumazet
2011-07-11 10:53     ` Michał Mirosław
2011-07-12 15:40     ` Eric Dumazet
2011-07-12 15:54       ` Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 02/46] net: wrap common patterns of rx handler code Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 04/46] net/wireless: p54: remove useless dma_sync_single_for_device(DMA_FROM_DEVICE) Michał Mirosław
2011-07-11 15:15   ` Pavel Roskin
2011-07-11 15:15     ` Pavel Roskin
2011-07-12  4:50   ` Felix Fietkau
2011-07-12  4:50     ` Felix Fietkau
2011-07-11  0:52 ` [PATCH v2 05/46] net: bnx2x: fix DMA sync direction Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 06/46] net/tokenring: 3c359: fix DMA API usage Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 08/46] net/wireless: b43: fix DMA direction for RX buffers Michał Mirosław
2011-07-11  0:52 ` [ath9k-devel] [PATCH v2 07/46] net/wireless: ath9k: fix DMA API usage Michał Mirosław
2011-07-11  0:52   ` Michał Mirosław
2011-07-11  0:52   ` Michał Mirosław
2011-07-12  4:36   ` [ath9k-devel] " Felix Fietkau
2011-07-12  4:36     ` Felix Fietkau
2011-07-12  4:36     ` [ath9k-devel] " Felix Fietkau
2011-07-12  5:30     ` Ben Greear
2011-07-12  5:30       ` Ben Greear
2011-07-12  5:30       ` Ben Greear
2011-07-12  9:55     ` Michał Mirosław
2011-07-12  9:55       ` Michał Mirosław
2011-07-12  9:55       ` Michał Mirosław
2011-07-12 12:54       ` Felix Fietkau
2011-07-12 12:54         ` Felix Fietkau
2011-07-12 12:54         ` [ath9k-devel] " Felix Fietkau
2011-07-12 13:03         ` Michał Mirosław
2011-07-12 13:03           ` Michał Mirosław
2011-07-12 13:03           ` Michał Mirosław
2011-07-12 14:21           ` Felix Fietkau
2011-07-12 14:21             ` Felix Fietkau
2011-07-12 14:21             ` Felix Fietkau
2011-07-12 15:58             ` Michał Mirosław
2011-07-12 15:58               ` Michał Mirosław
2011-07-12 16:04               ` Felix Fietkau
2011-07-12 16:04                 ` Felix Fietkau
2011-07-12 16:04                 ` Felix Fietkau
2011-07-12 19:13                 ` Michał Mirosław
2011-07-12 19:13                   ` Michał Mirosław
2011-07-12 19:32     ` Ralf Baechle
2011-07-12 19:32       ` Ralf Baechle
2011-07-12 20:53       ` Michał Mirosław
2011-07-12 20:53         ` Michał Mirosław
2011-07-12 20:53         ` Michał Mirosław
2011-07-12 20:59         ` Michał Mirosław
2011-07-12 20:59           ` Michał Mirosław
2011-07-12 20:59           ` Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 10/46] net: jme: convert to generic DMA API Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 11/46] net: sungem: cleanup RX skb allocation Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 12/46] net: sunhme: " Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 13/46] net: sunbmac: " Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 09/46] net: octeon_mgmt: fix DMA unmap size Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 46/46] net: mark drivers that drop packets from rx queue head under memory pressure Michał Mirosław
2011-07-11  5:40   ` Francois Romieu
2011-07-11  6:47   ` Eilon Greenstein
2011-07-11 10:04     ` Michał Mirosław
2011-07-11 10:16       ` Eilon Greenstein
2011-07-11 15:24   ` Stephen Hemminger
2011-07-11  0:52 ` [PATCH v2 14/46] net: sunbmac: cleanup magic '34' Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 15/46] net/wireless: b43: use kfree_skb() for untouched skbs Michał Mirosław
2011-07-11  0:52 ` [PATCH v2 16/46] net: cxgb3: don't drop packets on memory pressure in driver Michał Mirosław
2011-07-11  6:54 ` [PATCH v2 00/46] Clean up RX copybreak and DMA handling David Miller
2011-07-11  9:16   ` Michał Mirosław
2011-07-11  9:24     ` David Miller
2011-07-11  9:47       ` Michał Mirosław
2011-07-11 10:11         ` David Miller
2011-07-11 11:17           ` Michał Mirosław
2011-07-11 12:36   ` Ben Hutchings

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=201107111130.39629.vladz@broadcom.com \
    --to=vladz@broadcom.com \
    --cc=bruce.w.allan@intel.com \
    --cc=divy@chelsio.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=eilong@broadcom.com \
    --cc=hsweeten@visionengravers.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jitendra.kalsaria@qlogic.com \
    --cc=john.ronciak@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=romieu@fr.zoreil.com \
    --cc=ron.mercer@qlogic.com \
    --cc=shemminger@linux-foundation.org \
    --cc=stefano.brivio@polimi.it \
    --cc=zambrano@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.