netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Alex Duyck <alexander.h.duyck@intel.com>,
	Bruce Allan <bruce.w.allan@intel.com>,
	Carolyn Wyborny <carolyn.wyborny@intel.com>,
	"Don Skidmore" <donald.c.skidmore@intel.com>,
	<e1000-devel@lists.sourceforge.net>,
	Greg Rose <gregory.v.rose@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	John Ronciak <john.ronciak@intel.com>, <netdev@vger.kernel.org>,
	"Peter P Waskiewicz Jr" <peter.p.waskiewicz.jr@intel.com>,
	Rasesh Mody <rmody@brocade.com>,
	Tushar Dave <tushar.n.dave@intel.com>
Subject: Re: [RFC 0/7] Fixing dma mask setting in various network drivers
Date: Tue, 11 Jun 2013 11:12:30 -0700	[thread overview]
Message-ID: <20130611111230.000062d2@unknown> (raw)
In-Reply-To: <20130610230849.GF18614@n2100.arm.linux.org.uk>

On Tue, 11 Jun 2013 00:08:49 +0100
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:

> While looking at the way coherent DMA masks are handled (and the
> fact many drivers write directly to the mask) I stumbled across
> this set of oddities in various network drivers, which looks like
> it's been cut'n'pasted.
> 
> I haven't yet tested these patches in any way, which is one reason
> I'm sending them out as an RFC.  The other reason is to find out
> if other people agree that these are indeed fixes.
> 
>  drivers/net/ethernet/brocade/bna/bnad.c           |    7 +++----
>  drivers/net/ethernet/intel/e1000e/netdev.c        |   11 +++++------
>  drivers/net/ethernet/intel/igb/igb_main.c         |   11 +++++------
>  drivers/net/ethernet/intel/igbvf/netdev.c         |   11 +++++------
>  drivers/net/ethernet/intel/ixgb/ixgb_main.c       |    9 ++++-----
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |   11 +++++------
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   11 +++++------
>  7 files changed, 32 insertions(+), 39 deletions(-)

Thanks Russell,

The intel driver changes seem valid (we are testing them now).
According to DMA-API-HOWTO, the coherent mask will always succeed if
the regular mask succeeded, so the code can be further simplified as
well to basically match the example in DMA-API-HOWTO.

This is my proposed change to the intel drivers.  Comments?

+	if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
+		pci_using_dac = true;
+		/* coherent mask for the same size will always succeed if
+		 * dma_set_mask does
+		 */
+		dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
+	} else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+		pci_using_dac = false;
+		dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+	} else {
+		dev_err(&pdev->dev, "%s: DMA configuration failed: %d\n",
+			 __func__, err);
+		err = -EIO;
+		goto err_dma;
 	}

  parent reply	other threads:[~2013-06-11 18:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 23:08 [RFC 0/7] Fixing dma mask setting in various network drivers Russell King - ARM Linux
2013-06-10 23:09 ` [PATCH 1/7] NET: brocade/bna/bnad.c: fix 32-bit DMA mask handling Russell King
2013-06-10 23:10 ` [PATCH 2/7] NET: intel/e1000e/netdev.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:11 ` [PATCH 3/7] NET: intel/igb/igb_main.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:12 ` [PATCH 4/7] NET: intel/igbvf/netdev.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:13 ` [PATCH 5/7] NET: intel/ixgb/ixgb_main.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:14 ` [PATCH 6/7] NET: intel/ixgbe/ixgbe_main.c: " Russell King
2013-06-10 23:28   ` Jeff Kirsher
2013-06-10 23:15 ` [PATCH 7/7] NET: intel/ixgbevf/ixgbevf_main.c: " Russell King
2013-06-10 23:28   ` Jeff Kirsher
2013-06-11 18:12 ` Jesse Brandeburg [this message]
2013-06-11 20:35   ` [RFC 0/7] Fixing dma mask setting in various network drivers Russell King - ARM Linux
2013-06-11 23:50     ` Jesse Brandeburg
2013-06-12  0:01       ` Russell King - ARM Linux
2013-06-17 14:01   ` Russell King - ARM Linux
2013-06-17 20:35     ` Jeff Kirsher
2013-06-17 20:45       ` Russell King - ARM Linux

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=20130611111230.000062d2@unknown \
    --to=jesse.brandeburg@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=carolyn.wyborny@intel.com \
    --cc=donald.c.skidmore@intel.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=gregory.v.rose@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=linux@arm.linux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    --cc=rmody@brocade.com \
    --cc=tushar.n.dave@intel.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).