* [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq
@ 2007-03-06 16:57 Auke Kok
2007-03-06 16:57 ` [PATCH 2/3] e1000: FIX: firmware handover bits Auke Kok
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Auke Kok @ 2007-03-06 16:57 UTC (permalink / raw)
To: jgarzik; +Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg
From: Auke Kok <auke-jan.h.kok@intel.com>
DEBUG_SHIRQ code exposed that e1000 was not ready for incoming interrupts
after having called pci_request_irq. This obviously requires us to finish
our software setup which assigns the irq handler before we request the
irq.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000/e1000_main.c | 66 +++++++++++++++++++++++++++-------------
1 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 98215fd..fff3bc0 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -522,14 +522,15 @@ e1000_release_manageability(struct e1000_adapter *adapter)
}
}
-int
-e1000_up(struct e1000_adapter *adapter)
+/**
+ * e1000_configure - configure the hardware for RX and TX
+ * @adapter = private board structure
+ **/
+static void e1000_configure(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
int i;
- /* hardware has been reset, we need to reload some things */
-
e1000_set_multi(netdev);
e1000_restore_vlan(adapter);
@@ -548,14 +549,20 @@ e1000_up(struct e1000_adapter *adapter)
}
adapter->tx_queue_len = netdev->tx_queue_len;
+}
+
+int e1000_up(struct e1000_adapter *adapter)
+{
+ /* hardware has been reset, we need to reload some things */
+ e1000_configure(adapter);
+
+ clear_bit(__E1000_DOWN, &adapter->flags);
#ifdef CONFIG_E1000_NAPI
- netif_poll_enable(netdev);
+ netif_poll_enable(adapter->netdev);
#endif
e1000_irq_enable(adapter);
- clear_bit(__E1000_DOWN, &adapter->flags);
-
/* fire a link change interrupt to start the watchdog */
E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC);
return 0;
@@ -640,15 +647,15 @@ e1000_down(struct e1000_adapter *adapter)
* reschedule our watchdog timer */
set_bit(__E1000_DOWN, &adapter->flags);
+#ifdef CONFIG_E1000_NAPI
+ netif_poll_disable(netdev);
+#endif
e1000_irq_disable(adapter);
del_timer_sync(&adapter->tx_fifo_stall_timer);
del_timer_sync(&adapter->watchdog_timer);
del_timer_sync(&adapter->phy_info_timer);
-#ifdef CONFIG_E1000_NAPI
- netif_poll_disable(netdev);
-#endif
netdev->tx_queue_len = adapter->tx_queue_len;
adapter->link_speed = 0;
adapter->link_duplex = 0;
@@ -1410,21 +1417,17 @@ e1000_open(struct net_device *netdev)
return -EBUSY;
/* allocate transmit descriptors */
- if ((err = e1000_setup_all_tx_resources(adapter)))
+ err = e1000_setup_all_tx_resources(adapter);
+ if (err)
goto err_setup_tx;
/* allocate receive descriptors */
- if ((err = e1000_setup_all_rx_resources(adapter)))
- goto err_setup_rx;
-
- err = e1000_request_irq(adapter);
+ err = e1000_setup_all_rx_resources(adapter);
if (err)
- goto err_req_irq;
+ goto err_setup_rx;
e1000_power_up_phy(adapter);
- if ((err = e1000_up(adapter)))
- goto err_up;
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
if ((adapter->hw.mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
@@ -1437,12 +1440,33 @@ e1000_open(struct net_device *netdev)
e1000_check_mng_mode(&adapter->hw))
e1000_get_hw_control(adapter);
+ /* before we allocate an interrupt, we must be ready to handle it.
+ * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
+ * as soon as we call pci_request_irq, so we have to setup our
+ * clean_rx handler before we do so. */
+ e1000_configure(adapter);
+
+ err = e1000_request_irq(adapter);
+ if (err)
+ goto err_req_irq;
+
+ /* From here on the code is the same as e1000_up() */
+ clear_bit(__E1000_DOWN, &adapter->flags);
+
+#ifdef CONFIG_E1000_NAPI
+ netif_poll_enable(netdev);
+#endif
+
+ e1000_irq_enable(adapter);
+
+ /* fire a link status change interrupt to start the watchdog */
+ E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC);
+
return E1000_SUCCESS;
-err_up:
- e1000_power_down_phy(adapter);
- e1000_free_irq(adapter);
err_req_irq:
+ e1000_release_hw_control(adapter);
+ e1000_power_down_phy(adapter);
e1000_free_all_rx_resources(adapter);
err_setup_rx:
e1000_free_all_tx_resources(adapter);
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] e1000: FIX: firmware handover bits
2007-03-06 16:57 [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Auke Kok
@ 2007-03-06 16:57 ` Auke Kok
2007-03-06 16:57 ` [PATCH 3/3] e1000: FIX: Stop raw interrupts disabled nag from RT Auke Kok
2007-03-09 16:46 ` [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Jeff Garzik
2 siblings, 0 replies; 6+ messages in thread
From: Auke Kok @ 2007-03-06 16:57 UTC (permalink / raw)
To: jgarzik; +Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg
From: Bruce Allan <bruce.w.allan@intel.com>
Upon code inspection it was spotted that the firmware handover bit get/set
mismatched, which may have resulted in management issues on PCI-E
adapters. Setting them correctly may fix some management issues such
as arp routing etc.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
---
drivers/net/e1000/e1000_main.c | 33 ++++++++++++---------------------
1 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index fff3bc0..3492f0b 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -409,25 +409,21 @@ e1000_release_hw_control(struct e1000_adapter *adapter)
{
uint32_t ctrl_ext;
uint32_t swsm;
- uint32_t extcnf;
/* Let firmware taken over control of h/w */
switch (adapter->hw.mac_type) {
- case e1000_82571:
- case e1000_82572:
- case e1000_80003es2lan:
- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
- ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
- break;
case e1000_82573:
swsm = E1000_READ_REG(&adapter->hw, SWSM);
E1000_WRITE_REG(&adapter->hw, SWSM,
swsm & ~E1000_SWSM_DRV_LOAD);
+ break;
+ case e1000_82571:
+ case e1000_82572:
+ case e1000_80003es2lan:
case e1000_ich8lan:
- extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT);
+ ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
- extcnf & ~E1000_CTRL_EXT_DRV_LOAD);
+ ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
break;
default:
break;
@@ -450,26 +446,21 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
{
uint32_t ctrl_ext;
uint32_t swsm;
- uint32_t extcnf;
/* Let firmware know the driver has taken over */
switch (adapter->hw.mac_type) {
- case e1000_82571:
- case e1000_82572:
- case e1000_80003es2lan:
- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
- ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
- break;
case e1000_82573:
swsm = E1000_READ_REG(&adapter->hw, SWSM);
E1000_WRITE_REG(&adapter->hw, SWSM,
swsm | E1000_SWSM_DRV_LOAD);
break;
+ case e1000_82571:
+ case e1000_82572:
+ case e1000_80003es2lan:
case e1000_ich8lan:
- extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL);
- E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL,
- extcnf | E1000_EXTCNF_CTRL_SWFLAG);
+ ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
+ E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
+ ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
break;
default:
break;
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] e1000: FIX: Stop raw interrupts disabled nag from RT
2007-03-06 16:57 [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Auke Kok
2007-03-06 16:57 ` [PATCH 2/3] e1000: FIX: firmware handover bits Auke Kok
@ 2007-03-06 16:57 ` Auke Kok
2007-03-09 16:46 ` [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Jeff Garzik
2 siblings, 0 replies; 6+ messages in thread
From: Auke Kok @ 2007-03-06 16:57 UTC (permalink / raw)
To: jgarzik; +Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg
From: Mark Huth <mhuth@mvista.com>
Current e1000_xmit_frame spews raw interrupt disabled nag messages when
used with RT kernel patches. This patch uses spin_trylock_irqsave,
which allows RT patches to properly manage the irq semantics.
Signed-off-by: Mark Huth <mhuth@mvista.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000/e1000_main.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 3492f0b..7bbefca 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3378,12 +3378,9 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
(adapter->hw.mac_type == e1000_82573))
e1000_transfer_dhcp_info(adapter, skb);
- local_irq_save(flags);
- if (!spin_trylock(&tx_ring->tx_lock)) {
+ if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags))
/* Collision - tell upper layer to requeue */
- local_irq_restore(flags);
return NETDEV_TX_LOCKED;
- }
/* need: count + 2 desc gap to keep tail from touching
* head, otherwise try next time */
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq
2007-03-06 16:57 [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Auke Kok
2007-03-06 16:57 ` [PATCH 2/3] e1000: FIX: firmware handover bits Auke Kok
2007-03-06 16:57 ` [PATCH 3/3] e1000: FIX: Stop raw interrupts disabled nag from RT Auke Kok
@ 2007-03-09 16:46 ` Jeff Garzik
2007-03-09 17:11 ` Kok, Auke
2 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2007-03-09 16:46 UTC (permalink / raw)
To: Auke Kok; +Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg
Auke Kok wrote:
> From: Auke Kok <auke-jan.h.kok@intel.com>
>
> DEBUG_SHIRQ code exposed that e1000 was not ready for incoming interrupts
> after having called pci_request_irq. This obviously requires us to finish
> our software setup which assigns the irq handler before we request the
> irq.
>
> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> ---
>
> drivers/net/e1000/e1000_main.c | 66 +++++++++++++++++++++++++++-------------
> 1 files changed, 45 insertions(+), 21 deletions(-)
All these do indeed look like fixes to me. But they look like low
priority fixes that would need some public testing behind them, and it's
pretty late in the 2.6.21-rc game.
I'll merge them into an e1000-fixes branch for now (and propagates
through #ALL to akpm's -mm). If replies to this email indicate we
really should push these upstream for 2.6.21-rc, it will be easy enough
to do so via #e1000-fixes.
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq
2007-03-09 16:46 ` [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Jeff Garzik
@ 2007-03-09 17:11 ` Kok, Auke
2007-03-09 17:38 ` Jeff Garzik
0 siblings, 1 reply; 6+ messages in thread
From: Kok, Auke @ 2007-03-09 17:11 UTC (permalink / raw)
To: Jeff Garzik
Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg,
Andrew Morton
Jeff Garzik wrote:
> Auke Kok wrote:
>> From: Auke Kok <auke-jan.h.kok@intel.com>
>>
>> DEBUG_SHIRQ code exposed that e1000 was not ready for incoming interrupts
>> after having called pci_request_irq. This obviously requires us to finish
>> our software setup which assigns the irq handler before we request the
>> irq.
>>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> ---
>>
>> drivers/net/e1000/e1000_main.c | 66 +++++++++++++++++++++++++++-------------
>> 1 files changed, 45 insertions(+), 21 deletions(-)
>
> All these do indeed look like fixes to me. But they look like low
> priority fixes that would need some public testing behind them, and it's
> pretty late in the 2.6.21-rc game.
>
> I'll merge them into an e1000-fixes branch for now (and propagates
> through #ALL to akpm's -mm). If replies to this email indicate we
> really should push these upstream for 2.6.21-rc, it will be easy enough
> to do so via #e1000-fixes.
Personally, I think this is really really needed. I'm surprised that you already
didn't push this considering Andrew pulled this into -mm immediately.
We've also been crunching this patch in our labs for a whole week now doing all
sorts of load/unload up/down torture and it's a real improvement. Especially
ESB2 systems were hit with this bug irregardless of the DEBUG_SHIRQ code active
or not, so it's a real bug with real fix.
but hey, it doesn't fix a new problem :)
Auke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq
2007-03-09 17:11 ` Kok, Auke
@ 2007-03-09 17:38 ` Jeff Garzik
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2007-03-09 17:38 UTC (permalink / raw)
To: Kok, Auke
Cc: torvalds, linux-kernel, netdev, john.ronciak, jesse.brandeburg,
Andrew Morton
Kok, Auke wrote:
> Personally, I think this is really really needed. I'm surprised that you
> already didn't push this considering Andrew pulled this into -mm
> immediately.
Since it affects a fragile area of e1000 for all [e1000] users, I much
prefer to err on the side of caution. I have a history of pulling
wide-impact fixes like this, late in -rc cycle, and having yet more
breakage appear.
But if Andrew or Linus disagree, feel free to override me. This is just
area where I am intentionally over-cautious.
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-09 17:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 16:57 [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Auke Kok
2007-03-06 16:57 ` [PATCH 2/3] e1000: FIX: firmware handover bits Auke Kok
2007-03-06 16:57 ` [PATCH 3/3] e1000: FIX: Stop raw interrupts disabled nag from RT Auke Kok
2007-03-09 16:46 ` [PATCH 1/3] e1000: FIX: be ready for incoming irq at pci_request_irq Jeff Garzik
2007-03-09 17:11 ` Kok, Auke
2007-03-09 17:38 ` Jeff Garzik
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).