e1000: fixes for 7.1.9-k2
Subsystems (2)
cover e1000: fixes for 7.1.9-k2
Jeff,
Please pull the following patches from
git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream-fixes-jgarzik (based on 22e1170310ec6afa41e0dc7ac9dfac735d82dcab)
To receive the following fixes for e1000:
[01]: Redo netpoll fix
[02]: remove CRC bytes from measured packet length [03]: fix panic on large frame receive when mtu=default [04]: bump version to 7.1.9-k4
Cheers,
Auke
--- drivers/net/e1000/e1000.h | 3 ++ drivers/net/e1000/e1000_main.c | 52 ++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 26 deletions(-)
--
Auke Kok <[email protected]>
PATCH 1/4 e1000: Redo netpoll fix to address community concerns
The original suggested fix for netpoll was found to be racy on SMP kernels. While it is highly unlikely that this race would ever be seen in the real world due to current netpoll usage models, we implemented this updated fix to address concerns.
---
drivers/net/e1000/e1000_main.c | 39 ++++++++++++++++----------------------- 1 files changed, 16 insertions(+), 23 deletions(-)
drivers/net/e1000/e1000_main.c +16 -23
@@ -3387,8 +3387,8 @@ e1000_intr(int irq, void *data, struct pE1000_WRITE_REG (hw,IMC , ~0 ); E1000_WRITE_FLUSH(hw); } -if (likely (netif_rx_schedule_prep (&adapter->polling_netdev[0 ]))) -__netif_rx_schedule (&adapter->polling_netdev[0 ]); +if (likely (netif_rx_schedule_prep (netdev))) +__netif_rx_schedule (netdev);else e1000_irq_enable (adapter);#else
@@ -3431,34 +3431,26 @@ e1000_clean(struct net_device *poll_dev, {struct e1000_adapter *adapter;int work_to_do =min (*budget, poll_dev->quota); -int tx_cleaned =0 , i =0 , work_done =0 ; +int tx_cleaned =0 , work_done =0 ;/* Must NOT use netdev_priv macro here. */ adapter = poll_dev->priv;/* Keep link state information with original netdev */ -if (!netif_carrier_ok (adapter->netdev)) +if (!netif_carrier_ok (poll_dev)) goto quit_polling; -while (poll_dev != &adapter->polling_netdev[i]) { - i++; -BUG_ON (i == adapter->num_rx_queues); - } - -if (likely (adapter->num_tx_queues ==1 )) { -/* e1000_clean is called per-cpu. This lock protects -* tx_ring[0] from being cleaned by multiple cpus -* simultaneously. A failure obtaining the lock means -* tx_ring[0] is currently being cleaned anyway. */ -if (spin_trylock (&adapter->tx_queue_lock)) { - tx_cleaned =e1000_clean_tx_irq (adapter, - &adapter->tx_ring[0 ]); -spin_unlock (&adapter->tx_queue_lock); - } - }else - tx_cleaned =e1000_clean_tx_irq (adapter, &adapter->tx_ring[i]); +/* e1000_clean is called per-cpu. This lock protects +* tx_ring[0] from being cleaned by multiple cpus +* simultaneously. A failure obtaining the lock means +* tx_ring[0] is currently being cleaned anyway. */ +if (spin_trylock (&adapter->tx_queue_lock)) { + tx_cleaned =e1000_clean_tx_irq (adapter, + &adapter->tx_ring[0 ]); +spin_unlock (&adapter->tx_queue_lock); + } - adapter->clean_rx (adapter, &adapter->rx_ring[i], + adapter->clean_rx (adapter, &adapter->rx_ring[0 ], &work_done, work_to_do); *budget -= work_done;
@@ -3466,7 +3458,7 @@ e1000_clean(struct net_device *poll_dev,/* If no Tx and not enough Rx work done, exit the polling mode */ if ((!tx_cleaned && (work_done ==0 )) || - !netif_running (adapter->netdev)) { + !netif_running (poll_dev)) { quit_polling:netif_rx_complete (poll_dev);e1000_irq_enable (adapter);
@@ -4752,6 +4744,7 @@ static void e1000_netpoll(struct net_device *netdev) {struct e1000_adapter *adapter =netdev_priv (netdev); +disable_irq (adapter->pdev->irq);e1000_intr (adapter->pdev->irq, netdev,NULL );e1000_clean_tx_irq (adapter, adapter->tx_ring);
--
Auke Kok <[email protected]>
PATCH 2/4 e1000: remove CRC bytes from measured packet length
In reply to Kok, AukeAfter removing the hardware CRC stripping which causes problems with SOL and related issues, we need to compensate for this changed size.
---
drivers/net/e1000/e1000_main.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +9 -1
@@ -3673,6 +3673,9 @@ e1000_clean_rx_irq(struct e1000_adapter length =le16_to_cpu (rx_desc->length); +/* adjust length to remove Ethernet CRC */ + length -=4 ; +if (unlikely (!(status &E1000_RXD_STAT_EOP ))) {/* All receives must fit into a single buffer */ E1000_DBG("%s: Receive packet consumed multiple"
@@ -3877,8 +3880,9 @@ e1000_clean_rx_irq_ps(struct e1000_adaptpci_dma_sync_single_for_device (pdev, ps_page_dma->ps_page_dma[0 ],PAGE_SIZE ,PCI_DMA_FROMDEVICE ); +/* remove the CRC */ + l1 -=4 ;skb_put (skb, l1); - length += l1; goto copydone; }/* if */ }
@@ -3897,6 +3901,10 @@ e1000_clean_rx_irq_ps(struct e1000_adapt skb->truesize += length; } +/* strip the ethernet crc, problem is we're using pages now so +* this whole operation can get a little cpu intensive */ +pskb_trim (skb, skb->len -4 ); + copydone:e1000_rx_checksum (adapter, staterr,le16_to_cpu (rx_desc->wb.lower.hi_dword.csum_ip.csum), skb);
--
Auke Kok <[email protected]>
PATCH 3/4 e1000: fix panic on large frame receive when mtu=default
In reply to Kok, AukeA panic was reported when receiving 1522 size packets if using the default MTU. we should set the initial rx buffer length to the value that e1000changemtu sets so that we can receive any packet that would not be dropped by LPE=0.
---
drivers/net/e1000/e1000.h | 3 +++ drivers/net/e1000/e1000_main.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/e1000/e1000.h +3 -0
@@ -110,6 +110,9 @@ struct e1000_adapter;#define E1000_MIN_RXD 80#define E1000_MAX_82544_RXD 4096 +/* this is the size past which hardware will drop packets when setting LPE=0 */ +#define MAXIMUM_ETHERNET_VLAN_SIZE 1522 +/* Supported Rx Buffer Sizes */ #define E1000_RXBUFFER_128 128/* Used for packet split */ #define E1000_RXBUFFER_256 256/* Used for packet split */
drivers/net/e1000/e1000_main.c +1 -2
@@ -1068,7 +1068,7 @@ e1000_sw_init(struct e1000_adapter *adappci_read_config_word (pdev,PCI_COMMAND , &hw->pci_cmd_word); - adapter->rx_buffer_len =MAXIMUM_ETHERNET_FRAME_SIZE ; + adapter->rx_buffer_len =MAXIMUM_ETHERNET_VLAN_SIZE ; adapter->rx_ps_bsize0 =E1000_RXBUFFER_128 ; hw->max_frame_size = netdev->mtu +ENET_HEADER_SIZE +ETHERNET_FCS_SIZE ;
@@ -3148,7 +3148,6 @@ e1000_change_mtu(struct net_device *netd adapter->rx_buffer_len =E1000_RXBUFFER_16384 ;/* adjust allocation if LPE protects us, and we aren't using SBP */ -#define MAXIMUM_ETHERNET_VLAN_SIZE 1522if (!adapter->hw.tbi_compatibility_on && ((max_frame ==MAXIMUM_ETHERNET_FRAME_SIZE ) || (max_frame ==MAXIMUM_ETHERNET_VLAN_SIZE )))
--
Auke Kok <[email protected]>
PATCH 4/4 e1000: bump version to 7.1.9-k4
In reply to Kok, AukeBump the version to 7.1.9-k4 to indicate three extra changes.
---
drivers/net/e1000/e1000_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +1 -1
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Int#else #define DRIVERNAPI "-NAPI"#endif -#define DRV_VERSION "7.1.9-k2"DRIVERNAPI +#define DRV_VERSION "7.1.9-k4"DRIVERNAPIchar e1000_driver_version[] =DRV_VERSION ;static char e1000_copyright[] ="Copyright (c) 1999-2006 Intel Corporation." ;
--
Auke Kok <[email protected]>
Quoted 11 lines · Auke
Jeff,
Please pull the following patches from
git://lost.foo-projects.org/~ahkok/git/netdev-2.6upstream-fixes-jgarzik (based on22e1170310ec6afa41e0dc7ac9dfac735d82dcab)To receive the following fixes for e1000:
[01]: Redo netpoll fix
Have I seen this patch? Is there a way to browse it?
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 13 lines · Matt Mackall
Quoted 11 lines · Auke
Jeff,
Please pull the following patches from
git://lost.foo-projects.org/~ahkok/git/netdev-2.6upstream-fixes-jgarzik (based on22e1170310ec6afa41e0dc7ac9dfac735d82dcab)To receive the following fixes for e1000:
[01]: Redo netpoll fix
Quoted 9 lines
Have I seen this patch? Is there a way to browse it?
--
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Matt,
The patch you are referring to is in patch set emails that Auke sent out.
I have also copied the patch below:
The original suggested fix for netpoll was found to be racy on SMP kernels. While it is highly unlikely that this race would ever be seen in the real world due to current netpoll usage models, we implemented this updated fix to address concerns.
---
drivers/net/e1000/e1000_main.c | 39 ++++++++++++++++-----------------------
1 files changed, 16 insertions(+), 23 deletions(-)
drivers/net/e1000/e1000_main.c +2 -2
@@ -3387,8 +3387,8 @@ e1000_intr(int irq, void *data, struct pE1000_WRITE_REG (hw,IMC , ~0 );E1000_WRITE_FLUSH (hw); } -if (likely (netif_rx_schedule_prep (&adapter->polling_netdev[0 ]))) -__netif_rx_schedule (&adapter->polling_netdev[0 ]); +if (likely (netif_rx_schedule_prep (netdev))) +__netif_rx_schedule (netdev);else e1000_irq_enable (adapter);
#else
@@ -3431,34 +3431,26 @@ e1000_clean(struct net_device *poll_dev,
{
struct e1000_adapter *adapter;
int work_to_do = min(*budget, poll_dev->quota);- int tx_cleaned = 0, i = 0, work_done = 0;
+ int tx_cleaned = 0, work_done = 0;
/* Must NOT use netdev_priv macro here. */
adapter = poll_dev->priv;
/* Keep link state information with original netdev */
- if (!netif_carrier_ok(adapter->netdev))
+ if (!netif_carrier_ok(poll_dev))
goto quit_polling;- while (poll_dev != &adapter->polling_netdev[i]) {
- i++;
- BUG_ON(i == adapter->num_rx_queues);
- }
-
- if (likely(adapter->num_tx_queues == 1)) {
- /* e1000_clean is called per-cpu. This lock protects
- * tx_ring[0] from being cleaned by multiple cpus - * simultaneously. A failure obtaining the lock means - * tx_ring[0] is currently being cleaned anyway. */
- if (spin_trylock(&adapter->tx_queue_lock)) {
- tx_cleaned = e1000_clean_tx_irq(adapter,
- &adapter->tx_ring[0]);
- spin_unlock(&adapter->tx_queue_lock);
- }
- } else
- tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]);
+ /* e1000_clean is called per-cpu. This lock protects
+ * tx_ring[0] from being cleaned by multiple cpus + * simultaneously. A failure obtaining the lock means + * tx_ring[0] is currently being cleaned anyway. */
+ if (spin_trylock(&adapter->tx_queue_lock)) {
+ tx_cleaned = e1000_clean_tx_irq(adapter,
+ &adapter->tx_ring[0]);
+ spin_unlock(&adapter->tx_queue_lock);
+ }
- adapter->clean_rx(adapter, &adapter->rx_ring[i],
+ adapter->clean_rx(adapter, &adapter->rx_ring[0],
&work_done, work_to_do);
*budget -= work_done;@@ -3466,7 +3458,7 @@ e1000_clean(struct net_device *poll_dev,
/* If no Tx and not enough Rx work done, exit the polling mode */
if ((!tx_cleaned && (work_done == 0)) ||
- !netif_running(adapter->netdev)) {
+ !netif_running(poll_dev)) {
quit_polling:
netif_rx_complete(poll_dev);
e1000_irq_enable(adapter);
@@ -4752,6 +4744,7 @@ static void
e1000_netpoll(struct net_device *netdev)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
+
disable_irq(adapter->pdev->irq);
e1000_intr(adapter->pdev->irq, netdev, NULL);
e1000_clean_tx_irq(adapter, adapter->tx_ring);Signature · 2 lines
Cheers, Jeff
Quoted 2 lines · Jeff Kirsher
Matt,
The patch you are referring to is in patch set emails that Auke sent out.
Doesn't look like it made it here.
Quoted 1 line
I have also copied the patch below:
I'm going to assume all the tab damage here is an artifact. Otherwise, looks good.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 6 lines · Auke
Jeff,
Please pull the following patches from
git://lost.foo-projects.org/~ahkok/git/netdev-2.6upstream-fixes-jgarzik (based on22e1170310ec6afa41e0dc7ac9dfac735d82dcab)
pulled