netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-2.6 PATCH 1/5] igb: fix unmap length bug
@ 2009-06-30 22:45 Jeff Kirsher
  2009-06-30 22:45 ` [net-2.6 PATCH 2/5] e1000: fix unmap bug Jeff Kirsher
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jeff Kirsher @ 2009-06-30 22:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Jesse Brandeburg, Jeff Kirsher

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

driver was mixing NET_IP_ALIGN count bytes in map/unmap calls
unevenly. Only map the bytes that the hardware might dma into

also fix unmap related bug where ->dma was not being cleared
after unmap

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/igb/igb_main.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index ea17319..468356d 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -4549,11 +4549,12 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 		cleaned = true;
 		cleaned_count++;
 
+		/* this is the fast path for the non-packet split case */
 		if (!adapter->rx_ps_hdr_size) {
 			pci_unmap_single(pdev, buffer_info->dma,
-					 adapter->rx_buffer_len +
-					   NET_IP_ALIGN,
+					 adapter->rx_buffer_len,
 					 PCI_DMA_FROMDEVICE);
+			buffer_info->dma = 0;
 			skb_put(skb, length);
 			goto send_up;
 		}
@@ -4570,8 +4571,9 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 
 		if (!skb_shinfo(skb)->nr_frags) {
 			pci_unmap_single(pdev, buffer_info->dma,
-					 adapter->rx_ps_hdr_size + NET_IP_ALIGN,
+					 adapter->rx_ps_hdr_size,
 					 PCI_DMA_FROMDEVICE);
+			buffer_info->dma = 0;
 			skb_put(skb, hlen);
 		}
 
@@ -4713,7 +4715,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
 		bufsz = adapter->rx_ps_hdr_size;
 	else
 		bufsz = adapter->rx_buffer_len;
-	bufsz += NET_IP_ALIGN;
 
 	while (cleaned_count--) {
 		rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
@@ -4737,7 +4738,7 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
 		}
 
 		if (!buffer_info->skb) {
-			skb = netdev_alloc_skb(netdev, bufsz);
+			skb = netdev_alloc_skb(netdev, bufsz + NET_IP_ALIGN);
 			if (!skb) {
 				adapter->alloc_rx_buff_failed++;
 				goto no_buffers;


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

* [net-2.6 PATCH 2/5] e1000: fix unmap bug
  2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
@ 2009-06-30 22:45 ` Jeff Kirsher
  2009-07-01  2:53   ` David Miller
  2009-06-30 22:45 ` [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT Jeff Kirsher
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jeff Kirsher @ 2009-06-30 22:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Jesse Brandeburg, Jeff Kirsher

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

as reported by kerneloops.org

[  121.781161] ------------[ cut here ]------------
[  121.781171] WARNING: at lib/dma-debug.c:793 check_unmap+0x14e/0x577()
[  121.781173] Hardware name: S5520HC
[  121.781177] e1000 0000:0a:00.0: DMA-API: device driver tries to free DMA
memory it has not allocated [device address=0x00000001d688b0fa] [size=1522
bytes]
[  121.781180] Modules linked in: e1000 mdio  dca [last unloaded: ixgbe]
[  121.781187] Pid: 4793, comm: bash Tainted: P 2.6.30-master-06161113 #3
[  121.781190] Call Trace:
[  121.781195]  [<ffffffff8123056f>] ? check_unmap+0x14e/0x577
[  121.781201]  [<ffffffff81057a19>] warn_slowpath_common+0x77/0x8f
[  121.781205]  [<ffffffff81057ae1>] warn_slowpath_fmt+0x9f/0xa1
[  121.781212]  [<ffffffff81477ce2>] ? _spin_lock_irqsave+0x3f/0x49
[  121.781216]  [<ffffffff8122fa97>] ? get_hash_bucket+0x28/0x33
[  121.781220]  [<ffffffff8123056f>] check_unmap+0x14e/0x577
[  121.781225]  [<ffffffff810e4f48>] ? check_bytes_and_report+0x38/0xcb
[  121.781230]  [<ffffffff81230bbf>] debug_dma_unmap_page+0x80/0x92
[  121.781234]  [<ffffffff8122e549>] ? unmap_single+0x1a/0x4e
[  121.781239]  [<ffffffff813901e1>] ? __kfree_skb+0x74/0x78
[  121.781250]  [<ffffffffa00662ef>] pci_unmap_single+0x64/0x6d [e1000]
[  121.781259]  [<ffffffffa0066344>] e1000_clean_rx_ring+0x4c/0xbf [e1000]
[  121.781268]  [<ffffffffa00663df>] e1000_clean_all_rx_rings+0x28/0x36 [e1000]
[  121.781277]  [<ffffffffa0067464>] e1000_down+0x138/0x141 [e1000]
[  121.781286]  [<ffffffffa00681c2>] __e1000_shutdown+0x6b/0x198 [e1000]
[  121.781296]  [<ffffffffa0068405>] e1000_suspend+0x17/0x50 [e1000]
[  121.781301]  [<ffffffff81237665>] pci_legacy_suspend+0x3b/0xbe
[  121.781305]  [<ffffffff81237bc6>] pci_pm_suspend+0x3e/0xf1
[  121.781310]  [<ffffffff812eaf1c>] pm_op+0x57/0xde
[  121.781314]  [<ffffffff812eb444>] dpm_suspend_start+0x31e/0x470
[  121.781319]  [<ffffffff810877da>] suspend_devices_and_enter+0x3e/0x1a2
[  121.781323]  [<ffffffff81087a0f>] enter_state+0xd1/0x127
[  121.781327]  [<ffffffff8108717a>] state_store+0xa7/0xc9
[  121.781332]  [<ffffffff81221843>] kobj_attr_store+0x17/0x19
[  121.781336]  [<ffffffff8113c01e>] sysfs_write_file+0xe5/0x121
[  121.781341]  [<ffffffff810ed165>] vfs_write+0xab/0x105
[  121.781344]  [<ffffffff810ed279>] sys_write+0x47/0x6d
[  121.781349]  [<ffffffff81027aab>] system_call_fastpath+0x16/0x1b
[  121.781352] ---[ end trace 97bacaaac2ed7786 ]---

Fix is to correctly zero out internal ->dma value when unmapping
and make sure never to unmap unless there specifically was a mapping done.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000/e1000_main.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 5e3356f..972e06d 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2185,12 +2185,16 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter,
 	/* Free all the Rx ring sk_buffs */
 	for (i = 0; i < rx_ring->count; i++) {
 		buffer_info = &rx_ring->buffer_info[i];
-		if (buffer_info->skb) {
+		if (buffer_info->dma) {
 			pci_unmap_single(pdev,
 					 buffer_info->dma,
 					 buffer_info->length,
 					 PCI_DMA_FROMDEVICE);
+		}
 
+		buffer_info->dma = 0;
+
+		if (buffer_info->skb) {
 			dev_kfree_skb(buffer_info->skb);
 			buffer_info->skb = NULL;
 		}
@@ -4033,6 +4037,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 		                 buffer_info->dma,
 		                 buffer_info->length,
 		                 PCI_DMA_FROMDEVICE);
+		buffer_info->dma = 0;
 
 		length = le16_to_cpu(rx_desc->length);
 		/* !EOP means multiple descriptors were used to store a single
@@ -4222,6 +4227,7 @@ map_skb:
 			pci_unmap_single(pdev, buffer_info->dma,
 					 adapter->rx_buffer_len,
 					 PCI_DMA_FROMDEVICE);
+			buffer_info->dma = 0;
 
 			break; /* while !buffer_info->skb */
 		}


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

* [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT
  2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
  2009-06-30 22:45 ` [net-2.6 PATCH 2/5] e1000: fix unmap bug Jeff Kirsher
@ 2009-06-30 22:45 ` Jeff Kirsher
  2009-07-01  2:53   ` David Miller
  2009-06-30 22:46 ` [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error Jeff Kirsher
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jeff Kirsher @ 2009-06-30 22:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Mike Mason, Jeff Kirsher

From: Mike Mason <mmlnx@us.ibm.com>

on permanent failure

PCI drivers that implement the io_error_detected callback
should return PCI_ERS_RESULT_DISCONNECT if the state
passed in is pci_channel_io_perm_failure.  This state is not
checked in many of the network drivers.

This patch fixes the omission in the e1000e driver.

Signed-off-by: Mike Mason <mmlnx@us.ibm.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000e/netdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 679885a..63415bb 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4785,6 +4785,9 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
 
 	netif_device_detach(netdev);
 
+	if (state == pci_channel_io_perm_failure)
+		return PCI_ERS_RESULT_DISCONNECT;
+
 	if (netif_running(netdev))
 		e1000e_down(adapter);
 	pci_disable_device(pdev);


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

* [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error
  2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
  2009-06-30 22:45 ` [net-2.6 PATCH 2/5] e1000: fix unmap bug Jeff Kirsher
  2009-06-30 22:45 ` [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT Jeff Kirsher
@ 2009-06-30 22:46 ` Jeff Kirsher
  2009-07-01  2:53   ` David Miller
  2009-06-30 22:46 ` [net-2.6 PATCH 5/5] igb: " Jeff Kirsher
  2009-07-01  2:53 ` [net-2.6 PATCH 1/5] igb: fix unmap length bug David Miller
  4 siblings, 1 reply; 10+ messages in thread
From: Jeff Kirsher @ 2009-06-30 22:46 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Andre Detsch, Mike Mason, Jeff Kirsher

From: Andre Detsch <adetsch@br.ibm.com>

PCI drivers that implement the io_error_detected callback
should return PCI_ERS_RESULT_DISCONNECT if the state
passed in is pci_channel_io_perm_failure.  This state is
not checked in many of the network drivers.

The patch fixes the omission in the e1000 driver.

Based on Mike Mason's similar patch for e1000e.

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
CC: Mike Mason <mmlnx@us.ibm.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000/e1000_main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 972e06d..5b8cbdb 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4823,6 +4823,9 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
 
 	netif_device_detach(netdev);
 
+	if (state == pci_channel_io_perm_failure)
+		return PCI_ERS_RESULT_DISCONNECT;
+
 	if (netif_running(netdev))
 		e1000_down(adapter);
 	pci_disable_device(pdev);


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

* [net-2.6 PATCH 5/5] igb: return PCI_ERS_RESULT_DISCONNECT on permanent error
  2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
                   ` (2 preceding siblings ...)
  2009-06-30 22:46 ` [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error Jeff Kirsher
@ 2009-06-30 22:46 ` Jeff Kirsher
  2009-07-01  2:54   ` David Miller
  2009-07-01  2:53 ` [net-2.6 PATCH 1/5] igb: fix unmap length bug David Miller
  4 siblings, 1 reply; 10+ messages in thread
From: Jeff Kirsher @ 2009-06-30 22:46 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Alexander Duyck, Jeff Kirsher

From: Alexander Duyck <alexander.h.duyck@intel.com>

PCI drivers that implement the io_error_detected callback should return
PCI_ERS_RESULT_DISCONNECT if the state passed in is
pci_channel_io_perm_failure.  This patch fixes the issue for igb.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/igb/igb_main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 468356d..be48029 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -5339,6 +5339,9 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
 
 	netif_device_detach(netdev);
 
+	if (state == pci_channel_io_perm_failure)
+		return PCI_ERS_RESULT_DISCONNECT;
+
 	if (netif_running(netdev))
 		igb_down(adapter);
 	pci_disable_device(pdev);


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

* Re: [net-2.6 PATCH 1/5] igb: fix unmap length bug
  2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
                   ` (3 preceding siblings ...)
  2009-06-30 22:46 ` [net-2.6 PATCH 5/5] igb: " Jeff Kirsher
@ 2009-07-01  2:53 ` David Miller
  4 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-07-01  2:53 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, jesse.brandeburg

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 30 Jun 2009 15:45:15 -0700

> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> driver was mixing NET_IP_ALIGN count bytes in map/unmap calls
> unevenly. Only map the bytes that the hardware might dma into
> 
> also fix unmap related bug where ->dma was not being cleared
> after unmap
> 
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net-2.6 PATCH 2/5] e1000: fix unmap bug
  2009-06-30 22:45 ` [net-2.6 PATCH 2/5] e1000: fix unmap bug Jeff Kirsher
@ 2009-07-01  2:53   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-07-01  2:53 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, jesse.brandeburg

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 30 Jun 2009 15:45:34 -0700

> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> as reported by kerneloops.org
 ...
> Fix is to correctly zero out internal ->dma value when unmapping
> and make sure never to unmap unless there specifically was a mapping done.
> 
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT
  2009-06-30 22:45 ` [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT Jeff Kirsher
@ 2009-07-01  2:53   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-07-01  2:53 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, mmlnx

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 30 Jun 2009 15:45:53 -0700

> From: Mike Mason <mmlnx@us.ibm.com>
> 
> on permanent failure
> 
> PCI drivers that implement the io_error_detected callback
> should return PCI_ERS_RESULT_DISCONNECT if the state
> passed in is pci_channel_io_perm_failure.  This state is not
> checked in many of the network drivers.
> 
> This patch fixes the omission in the e1000e driver.
> 
> Signed-off-by: Mike Mason <mmlnx@us.ibm.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error
  2009-06-30 22:46 ` [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error Jeff Kirsher
@ 2009-07-01  2:53   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-07-01  2:53 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, adetsch, mmlnx

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 30 Jun 2009 15:46:13 -0700

> From: Andre Detsch <adetsch@br.ibm.com>
> 
> PCI drivers that implement the io_error_detected callback
> should return PCI_ERS_RESULT_DISCONNECT if the state
> passed in is pci_channel_io_perm_failure.  This state is
> not checked in many of the network drivers.
> 
> The patch fixes the omission in the e1000 driver.
> 
> Based on Mike Mason's similar patch for e1000e.
> 
> Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
> CC: Mike Mason <mmlnx@us.ibm.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net-2.6 PATCH 5/5] igb: return PCI_ERS_RESULT_DISCONNECT on permanent error
  2009-06-30 22:46 ` [net-2.6 PATCH 5/5] igb: " Jeff Kirsher
@ 2009-07-01  2:54   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-07-01  2:54 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, alexander.h.duyck

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 30 Jun 2009 15:46:34 -0700

> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> PCI drivers that implement the io_error_detected callback should return
> PCI_ERS_RESULT_DISCONNECT if the state passed in is
> pci_channel_io_perm_failure.  This patch fixes the issue for igb.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

end of thread, other threads:[~2009-07-01  2:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 22:45 [net-2.6 PATCH 1/5] igb: fix unmap length bug Jeff Kirsher
2009-06-30 22:45 ` [net-2.6 PATCH 2/5] e1000: fix unmap bug Jeff Kirsher
2009-07-01  2:53   ` David Miller
2009-06-30 22:45 ` [net-2.6 PATCH 3/5] e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT Jeff Kirsher
2009-07-01  2:53   ` David Miller
2009-06-30 22:46 ` [net-2.6 PATCH 4/5] e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error Jeff Kirsher
2009-07-01  2:53   ` David Miller
2009-06-30 22:46 ` [net-2.6 PATCH 5/5] igb: " Jeff Kirsher
2009-07-01  2:54   ` David Miller
2009-07-01  2:53 ` [net-2.6 PATCH 1/5] igb: fix unmap length bug David Miller

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).