All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances
@ 2016-01-13 17:43 Neil Horman
  2016-01-13 17:43 ` [PATCH 1/2] 3c59x: balance page maps and unmaps Neil Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Neil Horman @ 2016-01-13 17:43 UTC (permalink / raw)
  To: netdev

Hey all-
	recent enhancements to libdma revealed a few minor bugs in 3c59x, in
which dma ranges were mapped as singles and unmaped as pages, or vice versa.
These patches fix those up.  Tested by myself with success

Best
Neil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] 3c59x: balance page maps and unmaps
  2016-01-13 17:43 [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances Neil Horman
@ 2016-01-13 17:43 ` Neil Horman
  2016-01-13 17:43 ` [PATCH 2/2] 3c59x: fix another page map/single unmap imbalance Neil Horman
  2016-01-13 19:55 ` [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Neil Horman @ 2016-01-13 17:43 UTC (permalink / raw)
  To: netdev; +Cc: Neil Horman, David S. Miller, Steffen Klassert

debug kernel noticed a screw up in 3c59x.  skbs being mapped as page were being
unmapped as singles.  Easy fix.  Tested by myself

Signed-off-by: Neil Horman <nhorman@tuxdriver.com
CC: "David S. Miller" <davem@davemloft.net>
CC: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>
---
 drivers/net/ethernet/3com/3c59x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 2839af0..eec4a3a 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -2460,7 +2460,7 @@ boomerang_interrupt(int irq, void *dev_id)
 #if DO_ZEROCOPY
 					int i;
 					for (i=0; i<=skb_shinfo(skb)->nr_frags; i++)
-							pci_unmap_single(VORTEX_PCI(vp),
+							pci_unmap_page(VORTEX_PCI(vp),
 											 le32_to_cpu(vp->tx_ring[entry].frag[i].addr),
 											 le32_to_cpu(vp->tx_ring[entry].frag[i].length)&0xFFF,
 											 PCI_DMA_TODEVICE);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] 3c59x: fix another page map/single unmap imbalance
  2016-01-13 17:43 [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances Neil Horman
  2016-01-13 17:43 ` [PATCH 1/2] 3c59x: balance page maps and unmaps Neil Horman
@ 2016-01-13 17:43 ` Neil Horman
  2016-01-13 19:55 ` [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Neil Horman @ 2016-01-13 17:43 UTC (permalink / raw)
  To: netdev; +Cc: Neil Horman, David S. Miller, Steffen Klassert

libdma debug found another page map/unmap imbalance in 3c59x.  Multi fragment
frames are mapped such that the lead fragment was mapped as a single entry,
while all other fragments were mapped as pages.  However, on unmapping they were
all unmapped as pages.  Fix is pretty easy, just unmap the lead frag as a single
entry, and bump the for loop initalization up by one so that all subsequent
frags get unmapped as pages

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>
---
 drivers/net/ethernet/3com/3c59x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index eec4a3a..b18ad8e 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -2459,7 +2459,12 @@ boomerang_interrupt(int irq, void *dev_id)
 					struct sk_buff *skb = vp->tx_skbuff[entry];
 #if DO_ZEROCOPY
 					int i;
-					for (i=0; i<=skb_shinfo(skb)->nr_frags; i++)
+					pci_unmap_single(VORTEX_PCI(vp),
+							le32_to_cpu(vp->tx_ring[entry].frag[0].addr), 
+							le32_to_cpu(vp->tx_ring[entry].frag[0].length),
+							PCI_DMA_TODEVICE);
+
+					for (i=1; i<=skb_shinfo(skb)->nr_frags; i++)
 							pci_unmap_page(VORTEX_PCI(vp),
 											 le32_to_cpu(vp->tx_ring[entry].frag[i].addr),
 											 le32_to_cpu(vp->tx_ring[entry].frag[i].length)&0xFFF,
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances
  2016-01-13 17:43 [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances Neil Horman
  2016-01-13 17:43 ` [PATCH 1/2] 3c59x: balance page maps and unmaps Neil Horman
  2016-01-13 17:43 ` [PATCH 2/2] 3c59x: fix another page map/single unmap imbalance Neil Horman
@ 2016-01-13 19:55 ` David Miller
  2016-01-13 20:12   ` Neil Horman
  2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2016-01-13 19:55 UTC (permalink / raw)
  To: nhorman; +Cc: netdev

From: Neil Horman <nhorman@tuxdriver.com>
Date: Wed, 13 Jan 2016 12:43:52 -0500

> Hey all-
> 	recent enhancements to libdma revealed a few minor bugs in 3c59x, in
> which dma ranges were mapped as singles and unmaped as pages, or vice versa.
> These patches fix those up.  Tested by myself with success

Series applied, but there was trailing whitespace added in the second
patch which I had to fix up by hand.

Please be careful when copy&pasteing stuff. :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances
  2016-01-13 19:55 ` [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances David Miller
@ 2016-01-13 20:12   ` Neil Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Horman @ 2016-01-13 20:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Wed, Jan 13, 2016 at 02:55:58PM -0500, David Miller wrote:
> From: Neil Horman <nhorman@tuxdriver.com>
> Date: Wed, 13 Jan 2016 12:43:52 -0500
> 
> > Hey all-
> > 	recent enhancements to libdma revealed a few minor bugs in 3c59x, in
> > which dma ranges were mapped as singles and unmaped as pages, or vice versa.
> > These patches fix those up.  Tested by myself with success
> 
> Series applied, but there was trailing whitespace added in the second
> patch which I had to fix up by hand.
> 
> Please be careful when copy&pasteing stuff. :)
> 

Yeah, apologies, linville just pointed that out to me too.  This got reported on
RHEL6 which I think has an old whitespacing style, and I think I missed some
corrections that I should have made when I cherry picked it into an upstream
kernel.  Sorry, I'll be more careful in the future.

Best
Neil

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-13 20:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13 17:43 [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances Neil Horman
2016-01-13 17:43 ` [PATCH 1/2] 3c59x: balance page maps and unmaps Neil Horman
2016-01-13 17:43 ` [PATCH 2/2] 3c59x: fix another page map/single unmap imbalance Neil Horman
2016-01-13 19:55 ` [PATCH 0/2] 3c59x: Fix dma map/unmap imbalances David Miller
2016-01-13 20:12   ` Neil Horman

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.