e1000e: incorporate napi_struct changes from net-2.6.24.git
Subsystems (2)
PATCH v4 1/1 e1000e: incorporate napi_struct changes from net-2.6.24.git
This incorporates the new napi_struct changes into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000.
Disabling polling is no longer needed at init time, so remove napi_disable() call from _probe().
This also fixes an endless polling loop where the driver signalled "polling done" improperly back to the stack.
---
drivers/net/e1000e/e1000.h | 2 ++ drivers/net/e1000e/netdev.c | 40 ++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 24 deletions(-)
drivers/net/e1000e/e1000.h +2 -0
@@ -187,6 +187,8 @@ struct e1000_adapter {struct e1000_ring *tx_ring/* One per active queue */ ____cacheline_aligned_in_smp ; +struct napi_struct napi; +unsigned long tx_queue_len;unsigned int restart_queue;u32 txd_cmd;
drivers/net/e1000e/netdev.c +16 -24
@@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }
@@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }
@@ -1662,10 +1662,10 @@ set_itr_now:* e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean (struct net_device *poll_dev,int *budget) +static int e1000_clean (struct napi_struct *napi,int budget) { -struct e1000_adapter *adapter; -int work_to_do =min (*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); +struct net_device *poll_dev = adapter->netdev;int tx_cleaned =0 , work_done =0 ;/* Must NOT use netdev_priv macro here. */
@@ -1684,25 +1684,19 @@ static int e1000_clean(struct net_device *poll_dev, int *budget)spin_unlock (&adapter->tx_queue_lock); } - adapter->clean_rx (adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx (adapter, &work_done, budget);/* If no Tx and not enough Rx work done, exit the polling mode */ -if ((!tx_cleaned && (work_done ==0 )) || +if ((!tx_cleaned && (work_done < budget)) || !netif_running (poll_dev)) { quit_polling:if (adapter->itr_setting &3 )e1000_set_itr (adapter); -netif_rx_complete (poll_dev); -if (test_bit (__E1000_DOWN, &adapter->state)) -atomic_dec (&adapter->irq_sem); -else -e1000_irq_enable (adapter); -return 0 ; +netif_rx_complete (poll_dev, napi); +e1000_irq_enable (adapter); } -return 1 ; +return work_done; }static void e1000_vlan_rx_add_vid (struct net_device *netdev,u16 vid)
@@ -2439,7 +2433,7 @@ int e1000e_up(struct e1000_adapter *adapter)clear_bit (__E1000_DOWN, &adapter->state); -netif_poll_enable (adapter->netdev); +napi_enable (&adapter->napi);e1000_irq_enable (adapter);/* fire a link change interrupt to start the watchdog */
@@ -2472,7 +2466,7 @@ void e1000e_down(struct e1000_adapter *adapter)e1e_flush ();msleep (10 ); -netif_poll_disable (netdev); +napi_disable (&adapter->napi);e1000_irq_disable (adapter);del_timer_sync (&adapter->watchdog_timer);
@@ -2605,7 +2599,7 @@ static int e1000_open(struct net_device *netdev)/* From here on the code is the same as e1000e_up() */ clear_bit (__E1000_DOWN, &adapter->state); -netif_poll_enable (netdev); +napi_enable (&adapter->napi);e1000_irq_enable (adapter);
@@ -4090,8 +4084,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,e1000e_set_ethtool_ops (netdev); netdev->tx_timeout = &e1000_tx_timeout; netdev->watchdog_timeo =5 *HZ ; - netdev->poll = &e1000_clean; - netdev->weight =64 ; +netif_napi_add (netdev, &adapter->napi, e1000_clean,64 ); netdev->vlan_rx_register = e1000_vlan_rx_register; netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
@@ -4260,7 +4253,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* tell the stack to leave us alone until e1000_open() is called */ netif_carrier_off (netdev);netif_stop_queue (netdev); -netif_poll_disable (netdev);strcpy (netdev->name,"eth%d" ); err =register_netdev (netdev);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 79 lines · Auke Kok
This incorporates the new
napi_structchanges into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000.Disabling polling is no longer needed at init time, so remove
napi_disable()call from_probe().This also fixes an endless polling loop where the driver signalled "polling done" improperly back to the stack.
Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000e/e1000.h | 2 ++ drivers/net/e1000e/netdev.c | 40 ++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 24 deletions(-)drivers/net/e1000e/e1000.h +2
-0@@ -187,6 +187,8 @@ struct e1000_adapter {struct e1000_ring *tx_ring/* One per active queue */ ____cacheline_aligned_in_smp ; +struct napi_struct napi; +unsigned long tx_queue_len;unsigned int restart_queue;u32 txd_cmd;drivers/net/e1000e/netdev.c +7
-7@@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }@@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }@@ -1662,10 +1662,10 @@ set_itr_now:* e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean (struct net_device *poll_dev,int *budget) +static int e1000_clean (struct napi_struct *napi,int budget) { -struct e1000_adapter *adapter; -int work_to_do =min (*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); +struct net_device *poll_dev = adapter->netdev;int tx_cleaned =0 , work_done =0 ;/* Must NOT use netdev_priv macro here. */ @@ -1684,25 +1684,19 @@ static int e1000_clean(struct net_device *poll_dev, int *budget)spin_unlock (&adapter->tx_queue_lock);
drivers/net/e1000e/netdev.c static int e1000_clean(struct net_device *poll_dev, int *budget) · line 1690
Quoted 10 lines
drivers/net/e1000e/netdev.c +2
-4} - adapter->clean_rx (adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx (adapter, &work_done, budget);/* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((!tx_cleaned && (work_done < budget)) ||
Hi,
sorry to say that, but this change since last your patch changes nothing on my machine (ksoftirq spinning at 100 % of CPU usage), I have some traces for you if it helps:
SysRq : Show Regs
CPU 0:
Modules linked in: floppy sr_mod ehci_hcd cdrom rtc_cmos rtc_core usbhid rtc_lib Pid: 4, comm: ksoftirqd/0 Not tainted 2.6.23-rc4-mm1_64 #24 RIP: 0010:[<ffffffff803b4ea3>] [<ffffffff803b4ea3>] e1000_clean_rx_irq+0x273/0x320 RSP: 0000:ffffffff80703e18 EFLAGS: 00000202 RAX: ffff8100032b0700 RBX: ffffffff80703ea8 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff810003097f60 RBP: ffffffff80703d90 R08: ffff810002b85340 R09: 0000000000000002 R10: 0000000000000002 R11: ffff8100032b0700 R12: ffffffff8020c1f1 R13: ffffffff80703d90 R14: ffff810004eac020 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffffffff806ad000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 00000000445d9978 CR3: 0000000004c49000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: <IRQ> [<ffffffff803b4e86>] e1000_clean_rx_irq+0x256/0x320 [<ffffffff803b3059>] e1000_clean+0x109/0x250 [<ffffffff80250a43>] hrtimer_run_queues+0x33/0x1b0 [<ffffffff8046d777>] net_rx_action+0xd7/0x190 [<ffffffff8023dc54>] __do_softirq+0x74/0xf0 [<ffffffff8020ce6c>] call_softirq+0x1c/0x30 <EOI> [<ffffffff8020eecd>] do_softirq+0x3d/0x90 [<ffffffff8023d932>] ksoftirqd+0x72/0x100 [<ffffffff8023d8c0>] ksoftirqd+0x0/0x100 [<ffffffff8024dbbd>] kthread+0x4d/0x80 [<ffffffff8020caf8>] child_rip+0xa/0x12 [<ffffffff8024db70>] kthread+0x0/0x80 [<ffffffff8020caee>] child_rip+0x0/0x12
SysRq : Show Regs
CPU 0:
Modules linked in: floppy sr_mod ehci_hcd cdrom rtc_cmos rtc_core usbhid rtc_lib Pid: 4, comm: ksoftirqd/0 Not tainted 2.6.23-rc4-mm1_64 #24 RIP: 0010:[<ffffffff804cd3f8>] [<ffffffff804cd3f8>] _spin_trylock+0x8/0x20 RSP: 0000:ffffffff80703ea8 EFLAGS: 00000246 RAX: 0000000000000001 RBX: ffffffff80703ea8 RCX: ffffffff80703f28 RDX: ffff8100032b0888 RSI: 0000000000000040 RDI: ffff8100032b0850 RBP: ffffffff80703e20 R08: ffff810002b85340 R09: 0000000000000002 R10: 0000000000000002 R11: ffff8100032b0700 R12: ffffffff8020c1f1 R13: ffffffff80703e20 R14: 0000000000000040 R15: ffff8100032b0700 FS: 0000000000000000(0000) GS:ffffffff806ad000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 00000000445d9978 CR3: 0000000004c49000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: <IRQ> [<ffffffff803b302d>] e1000_clean+0xdd/0x250 [<ffffffff80250a43>] hrtimer_run_queues+0x33/0x1b0 [<ffffffff8046d777>] net_rx_action+0xd7/0x190 [<ffffffff8023dc54>] __do_softirq+0x74/0xf0 [<ffffffff8020ce6c>] call_softirq+0x1c/0x30 <EOI> [<ffffffff8020eecd>] do_softirq+0x3d/0x90 [<ffffffff8023d932>] ksoftirqd+0x72/0x100 [<ffffffff8023d8c0>] ksoftirqd+0x0/0x100 [<ffffffff8024dbbd>] kthread+0x4d/0x80 [<ffffffff8020caf8>] child_rip+0xa/0x12 [<ffffffff8024db70>] kthread+0x0/0x80 [<ffffffff8020caee>] child_rip+0x0/0x12
regards,
Signature · 7 lines
Jiri Slaby ([email protected]) Faculty of Informatics, Masaryk University ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 93 lines · Jiri Slaby
Quoted 79 lines · Auke Kok
This incorporates the new
napi_structchanges into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000.Disabling polling is no longer needed at init time, so remove
napi_disable()call from_probe().This also fixes an endless polling loop where the driver signalled "polling done" improperly back to the stack.
Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000e/e1000.h | 2 ++ drivers/net/e1000e/netdev.c | 40 ++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 24 deletions(-)drivers/net/e1000e/e1000.h +2
-0@@ -187,6 +187,8 @@ struct e1000_adapter {struct e1000_ring *tx_ring/* One per active queue */ ____cacheline_aligned_in_smp ; +struct napi_struct napi; +unsigned long tx_queue_len;unsigned int restart_queue;u32 txd_cmd;drivers/net/e1000e/netdev.c +7
-7@@ -1149,12 +1149,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }@@ -1212,12 +1212,12 @@ static irqreturn_t e1000_intr(int irq, void *data)mod_timer (&adapter->watchdog_timer, jiffies +1 ); } -if (netif_rx_schedule_prep (netdev)) { +if (netif_rx_schedule_prep (netdev, &adapter->napi)) { adapter->total_tx_bytes =0 ; adapter->total_tx_packets =0 ; adapter->total_rx_bytes =0 ; adapter->total_rx_packets =0 ; -__netif_rx_schedule (netdev); +__netif_rx_schedule (netdev, &adapter->napi); }else {atomic_dec (&adapter->irq_sem); }@@ -1662,10 +1662,10 @@ set_itr_now:* e1000_clean - NAPI Rx polling callback * @adapter: board private structure **/ -static int e1000_clean (struct net_device *poll_dev,int *budget) +static int e1000_clean (struct napi_struct *napi,int budget) { -struct e1000_adapter *adapter; -int work_to_do =min (*budget, poll_dev->quota); + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); +struct net_device *poll_dev = adapter->netdev;int tx_cleaned =0 , work_done =0 ;/* Must NOT use netdev_priv macro here. */ @@ -1684,25 +1684,19 @@ static int e1000_clean(struct net_device *poll_dev, int *budget)spin_unlock (&adapter->tx_queue_lock);drivers/net/e1000e/netdev.c static int e1000_clean(struct net_device *poll_dev, int *budget) · line 1690
Quoted 10 lines
drivers/net/e1000e/netdev.c +2
-4} - adapter->clean_rx (adapter, &work_done, work_to_do); - *budget -= work_done; - poll_dev->quota -= work_done; + adapter->clean_rx (adapter, &work_done, budget);/* If no Tx and not enough Rx work done, exit the polling mode */ - if ((!tx_cleaned && (work_done == 0)) || + if ((!tx_cleaned && (work_done < budget)) ||Hi,
Quoted 3 lines
sorry to say that, but this change since last your patch changes nothing on my machine (ksoftirq spinning at 100 % of CPU usage), I have some traces for you if it helps:
davem pulled all the drivers and fixups into net-2.6.24 including e1000e (and tested it yesterday)... Perhaps you can give that tree a try?
I have no lockups here as well anymore, so I'm wondering if you accidentally used V3 of the patch.
Can you give today's net-2.6.24 a try?
Auke
Jiri Slaby
Tested-byQuoted 5 lines · Auke
Quoted 4 lines · Jiri Slaby
Quoted 3 lines · Auke Kok
This incorporates the new
napi_structchanges into e1000e. Included bugfix for ifdown hang from Krishna Kumar for e1000.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Disabling polling is no longer needed at init time, so remove
napi_disable()call from_probe().This also fixes an endless polling loop where the driver signalled "polling done" improperly back to the stack.
Signed-off-by Auke Kok <[email protected]>
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
drivers/net/e1000e/e1000.h | 2 ++ drivers/net/e1000e/netdev.c | 40 ++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 24 deletions(-)
[...]
Quoted 2 lines
I have no lockups here as well anymore, so I'm wondering if you accidentally used V3 of the patch.
And so am I, it works, I ported one change to e1000 (non-e) driver and missed the return 0; removal. Fixed both of them now, so one of them caused it.
thanks a lot,
Signature · 7 lines
Jiri Slaby ([email protected]) Faculty of Informatics, Masaryk University ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/