aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-17 04:56:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-17 22:21:07 -0400
commitfd2ea0a79faad824258af5dcec1927aa24d81c16 (patch)
tree644fd4ce92227cc319c7a54c63ea07a96b8c6b8d /drivers
parent24344d2600108b9b79a60c0e4c43b3c499856d14 (diff)
net: Use queue aware tests throughout.
This effectively "flips the switch" by making the core networking and multiqueue-aware drivers use the new TX multiqueue structures. Non-multiqueue drivers need no changes. The interfaces they use such as netif_stop_queue() degenerate into an operation on TX queue zero. So everything "just works" for them. Code that really wants to do "X" to all TX queues now invokes a routine that does so, such as netif_tx_wake_all_queues(), netif_tx_stop_all_queues(), etc. pktgen and netpoll required a little bit more surgery than the others. In particular the pktgen changes, whilst functional, could be largely improved. The initial check in pktgen_xmit() will sometimes check the wrong queue, which is mostly harmless. The thing to do is probably to invoke fill_packet() earlier. The bulk of the netpoll changes is to make the code operate solely on the TX queue indicated by by the SKB queue mapping. Setting of the SKB queue mapping is entirely confined inside of net/core/dev.c:dev_pick_tx(). If we end up needing any kind of special semantics (drops, for example) it will be implemented here. Finally, we now have a "real_num_tx_queues" which is where the driver indicates how many TX queues are actually active. With IGB changes from Jeff Kirsher. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/cpmac.c20
-rw-r--r--drivers/net/igb/igb_main.c19
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c10
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c15
-rw-r--r--drivers/net/s2io.c48
5 files changed, 39 insertions, 73 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 7c7b54e4828e..fbd4280c102c 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -544,7 +544,7 @@ fatal_error:
544 544
545 spin_unlock(&priv->rx_lock); 545 spin_unlock(&priv->rx_lock);
546 netif_rx_complete(priv->dev, napi); 546 netif_rx_complete(priv->dev, napi);
547 netif_stop_queue(priv->dev); 547 netif_tx_stop_all_queues(priv->dev);
548 napi_disable(&priv->napi); 548 napi_disable(&priv->napi);
549 549
550 atomic_inc(&priv->reset_pending); 550 atomic_inc(&priv->reset_pending);
@@ -750,9 +750,7 @@ static void cpmac_hw_error(struct work_struct *work)
750 barrier(); 750 barrier();
751 atomic_dec(&priv->reset_pending); 751 atomic_dec(&priv->reset_pending);
752 752
753 for (i = 0; i < CPMAC_QUEUES; i++) 753 netif_tx_wake_all_queues(priv->dev);
754 netif_wake_subqueue(priv->dev, i);
755 netif_wake_queue(priv->dev);
756 cpmac_write(priv->regs, CPMAC_MAC_INT_ENABLE, 3); 754 cpmac_write(priv->regs, CPMAC_MAC_INT_ENABLE, 3);
757} 755}
758 756
@@ -781,7 +779,7 @@ static void cpmac_check_status(struct net_device *dev)
781 dev->name, tx_code, tx_channel, macstatus); 779 dev->name, tx_code, tx_channel, macstatus);
782 } 780 }
783 781
784 netif_stop_queue(dev); 782 netif_tx_stop_all_queues(dev);
785 cpmac_hw_stop(dev); 783 cpmac_hw_stop(dev);
786 if (schedule_work(&priv->reset_work)) 784 if (schedule_work(&priv->reset_work))
787 atomic_inc(&priv->reset_pending); 785 atomic_inc(&priv->reset_pending);
@@ -842,9 +840,7 @@ static void cpmac_tx_timeout(struct net_device *dev)
842 barrier(); 840 barrier();
843 atomic_dec(&priv->reset_pending); 841 atomic_dec(&priv->reset_pending);
844 842
845 netif_wake_queue(priv->dev); 843 netif_tx_wake_all_queues(priv->dev);
846 for (i = 0; i < CPMAC_QUEUES; i++)
847 netif_wake_subqueue(dev, i);
848} 844}
849 845
850static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 846static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
@@ -935,7 +931,7 @@ static void cpmac_adjust_link(struct net_device *dev)
935 931
936 spin_lock(&priv->lock); 932 spin_lock(&priv->lock);
937 if (priv->phy->link) { 933 if (priv->phy->link) {
938 netif_start_queue(dev); 934 netif_tx_start_all_queues(dev);
939 if (priv->phy->duplex != priv->oldduplex) { 935 if (priv->phy->duplex != priv->oldduplex) {
940 new_state = 1; 936 new_state = 1;
941 priv->oldduplex = priv->phy->duplex; 937 priv->oldduplex = priv->phy->duplex;
@@ -949,10 +945,10 @@ static void cpmac_adjust_link(struct net_device *dev)
949 if (!priv->oldlink) { 945 if (!priv->oldlink) {
950 new_state = 1; 946 new_state = 1;
951 priv->oldlink = 1; 947 priv->oldlink = 1;
952 netif_schedule(dev); 948 netif_tx_schedule_all(dev);
953 } 949 }
954 } else if (priv->oldlink) { 950 } else if (priv->oldlink) {
955 netif_stop_queue(dev); 951 netif_tx_stop_all_queues(dev);
956 new_state = 1; 952 new_state = 1;
957 priv->oldlink = 0; 953 priv->oldlink = 0;
958 priv->oldspeed = 0; 954 priv->oldspeed = 0;
@@ -1072,7 +1068,7 @@ static int cpmac_stop(struct net_device *dev)
1072 struct cpmac_priv *priv = netdev_priv(dev); 1068 struct cpmac_priv *priv = netdev_priv(dev);
1073 struct resource *mem; 1069 struct resource *mem;
1074 1070
1075 netif_stop_queue(dev); 1071 netif_tx_stop_all_queues(dev);
1076 1072
1077 cancel_work_sync(&priv->reset_work); 1073 cancel_work_sync(&priv->reset_work);
1078 napi_disable(&priv->napi); 1074 napi_disable(&priv->napi);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 471c194cd54e..81bba6983dde 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -533,7 +533,7 @@ msi_only:
533 adapter->flags |= IGB_FLAG_HAS_MSI; 533 adapter->flags |= IGB_FLAG_HAS_MSI;
534 534
535 /* Notify the stack of the (possibly) reduced Tx Queue count. */ 535 /* Notify the stack of the (possibly) reduced Tx Queue count. */
536 adapter->netdev->egress_subqueue_count = adapter->num_tx_queues; 536 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
537 return; 537 return;
538} 538}
539 539
@@ -821,9 +821,7 @@ void igb_down(struct igb_adapter *adapter)
821 wr32(E1000_RCTL, rctl & ~E1000_RCTL_EN); 821 wr32(E1000_RCTL, rctl & ~E1000_RCTL_EN);
822 /* flush and sleep below */ 822 /* flush and sleep below */
823 823
824 netif_stop_queue(netdev); 824 netif_tx_stop_all_queues(netdev);
825 for (i = 0; i < adapter->num_tx_queues; i++)
826 netif_stop_subqueue(netdev, i);
827 825
828 /* disable transmits in the hardware */ 826 /* disable transmits in the hardware */
829 tctl = rd32(E1000_TCTL); 827 tctl = rd32(E1000_TCTL);
@@ -1266,9 +1264,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1266 1264
1267 /* tell the stack to leave us alone until igb_open() is called */ 1265 /* tell the stack to leave us alone until igb_open() is called */
1268 netif_carrier_off(netdev); 1266 netif_carrier_off(netdev);
1269 netif_stop_queue(netdev); 1267 netif_tx_stop_all_queues(netdev);
1270 for (i = 0; i < adapter->num_tx_queues; i++)
1271 netif_stop_subqueue(netdev, i);
1272 1268
1273 strcpy(netdev->name, "eth%d"); 1269 strcpy(netdev->name, "eth%d");
1274 err = register_netdev(netdev); 1270 err = register_netdev(netdev);
@@ -2315,7 +2311,6 @@ static void igb_watchdog_task(struct work_struct *work)
2315 struct e1000_mac_info *mac = &adapter->hw.mac; 2311 struct e1000_mac_info *mac = &adapter->hw.mac;
2316 u32 link; 2312 u32 link;
2317 s32 ret_val; 2313 s32 ret_val;
2318 int i;
2319 2314
2320 if ((netif_carrier_ok(netdev)) && 2315 if ((netif_carrier_ok(netdev)) &&
2321 (rd32(E1000_STATUS) & E1000_STATUS_LU)) 2316 (rd32(E1000_STATUS) & E1000_STATUS_LU))
@@ -2371,9 +2366,7 @@ static void igb_watchdog_task(struct work_struct *work)
2371 } 2366 }
2372 2367
2373 netif_carrier_on(netdev); 2368 netif_carrier_on(netdev);
2374 netif_wake_queue(netdev); 2369 netif_tx_wake_all_queues(netdev);
2375 for (i = 0; i < adapter->num_tx_queues; i++)
2376 netif_wake_subqueue(netdev, i);
2377 2370
2378 if (!test_bit(__IGB_DOWN, &adapter->state)) 2371 if (!test_bit(__IGB_DOWN, &adapter->state))
2379 mod_timer(&adapter->phy_info_timer, 2372 mod_timer(&adapter->phy_info_timer,
@@ -2385,9 +2378,7 @@ static void igb_watchdog_task(struct work_struct *work)
2385 adapter->link_duplex = 0; 2378 adapter->link_duplex = 0;
2386 dev_info(&adapter->pdev->dev, "NIC Link is Down\n"); 2379 dev_info(&adapter->pdev->dev, "NIC Link is Down\n");
2387 netif_carrier_off(netdev); 2380 netif_carrier_off(netdev);
2388 netif_stop_queue(netdev); 2381 netif_tx_stop_all_queues(netdev);
2389 for (i = 0; i < adapter->num_tx_queues; i++)
2390 netif_stop_subqueue(netdev, i);
2391 if (!test_bit(__IGB_DOWN, &adapter->state)) 2382 if (!test_bit(__IGB_DOWN, &adapter->state))
2392 mod_timer(&adapter->phy_info_timer, 2383 mod_timer(&adapter->phy_info_timer,
2393 round_jiffies(jiffies + 2 * HZ)); 2384 round_jiffies(jiffies + 2 * HZ));
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 81b769093d22..3efe5dda10af 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -252,16 +252,10 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data)
252 netdev->features |= NETIF_F_TSO; 252 netdev->features |= NETIF_F_TSO;
253 netdev->features |= NETIF_F_TSO6; 253 netdev->features |= NETIF_F_TSO6;
254 } else { 254 } else {
255 struct ixgbe_adapter *adapter = netdev_priv(netdev); 255 netif_tx_stop_all_queues(netdev);
256 int i;
257 netif_stop_queue(netdev);
258 for (i = 0; i < adapter->num_tx_queues; i++)
259 netif_stop_subqueue(netdev, i);
260 netdev->features &= ~NETIF_F_TSO; 256 netdev->features &= ~NETIF_F_TSO;
261 netdev->features &= ~NETIF_F_TSO6; 257 netdev->features &= ~NETIF_F_TSO6;
262 for (i = 0; i < adapter->num_tx_queues; i++) 258 netif_tx_start_all_queues(netdev);
263 netif_start_subqueue(netdev, i);
264 netif_start_queue(netdev);
265 } 259 }
266 return 0; 260 return 0;
267} 261}
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index e6df9233f5ef..6af8fb5c4b5f 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2013,7 +2013,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
2013 del_timer_sync(&adapter->watchdog_timer); 2013 del_timer_sync(&adapter->watchdog_timer);
2014 2014
2015 netif_carrier_off(netdev); 2015 netif_carrier_off(netdev);
2016 netif_stop_queue(netdev); 2016 netif_tx_stop_all_queues(netdev);
2017 2017
2018 if (!pci_channel_offline(adapter->pdev)) 2018 if (!pci_channel_offline(adapter->pdev))
2019 ixgbe_reset(adapter); 2019 ixgbe_reset(adapter);
@@ -2359,7 +2359,7 @@ try_msi:
2359 2359
2360out: 2360out:
2361 /* Notify the stack of the (possibly) reduced Tx Queue count. */ 2361 /* Notify the stack of the (possibly) reduced Tx Queue count. */
2362 adapter->netdev->egress_subqueue_count = adapter->num_tx_queues; 2362 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
2363 2363
2364 return err; 2364 return err;
2365} 2365}
@@ -2896,7 +2896,6 @@ static void ixgbe_watchdog(unsigned long data)
2896 struct net_device *netdev = adapter->netdev; 2896 struct net_device *netdev = adapter->netdev;
2897 bool link_up; 2897 bool link_up;
2898 u32 link_speed = 0; 2898 u32 link_speed = 0;
2899 int i;
2900 2899
2901 adapter->hw.mac.ops.check_link(&adapter->hw, &(link_speed), &link_up); 2900 adapter->hw.mac.ops.check_link(&adapter->hw, &(link_speed), &link_up);
2902 2901
@@ -2917,9 +2916,7 @@ static void ixgbe_watchdog(unsigned long data)
2917 (FLOW_TX ? "TX" : "None")))); 2916 (FLOW_TX ? "TX" : "None"))));
2918 2917
2919 netif_carrier_on(netdev); 2918 netif_carrier_on(netdev);
2920 netif_wake_queue(netdev); 2919 netif_tx_wake_all_queues(netdev);
2921 for (i = 0; i < adapter->num_tx_queues; i++)
2922 netif_wake_subqueue(netdev, i);
2923 } else { 2920 } else {
2924 /* Force detection of hung controller */ 2921 /* Force detection of hung controller */
2925 adapter->detect_tx_hung = true; 2922 adapter->detect_tx_hung = true;
@@ -2928,7 +2925,7 @@ static void ixgbe_watchdog(unsigned long data)
2928 if (netif_carrier_ok(netdev)) { 2925 if (netif_carrier_ok(netdev)) {
2929 DPRINTK(LINK, INFO, "NIC Link is Down\n"); 2926 DPRINTK(LINK, INFO, "NIC Link is Down\n");
2930 netif_carrier_off(netdev); 2927 netif_carrier_off(netdev);
2931 netif_stop_queue(netdev); 2928 netif_tx_stop_all_queues(netdev);
2932 } 2929 }
2933 } 2930 }
2934 2931
@@ -3631,9 +3628,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
3631 ixgbe_start_hw(hw); 3628 ixgbe_start_hw(hw);
3632 3629
3633 netif_carrier_off(netdev); 3630 netif_carrier_off(netdev);
3634 netif_stop_queue(netdev); 3631 netif_tx_stop_all_queues(netdev);
3635 for (i = 0; i < adapter->num_tx_queues; i++)
3636 netif_stop_subqueue(netdev, i);
3637 3632
3638 ixgbe_napi_add_all(adapter); 3633 ixgbe_napi_add_all(adapter);
3639 3634
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 5f0fcb04afff..9dae40ccf048 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -545,63 +545,53 @@ static struct pci_driver s2io_driver = {
545/* netqueue manipulation helper functions */ 545/* netqueue manipulation helper functions */
546static inline void s2io_stop_all_tx_queue(struct s2io_nic *sp) 546static inline void s2io_stop_all_tx_queue(struct s2io_nic *sp)
547{ 547{
548 int i; 548 if (!sp->config.multiq) {
549 if (sp->config.multiq) { 549 int i;
550 for (i = 0; i < sp->config.tx_fifo_num; i++) 550
551 netif_stop_subqueue(sp->dev, i);
552 } else {
553 for (i = 0; i < sp->config.tx_fifo_num; i++) 551 for (i = 0; i < sp->config.tx_fifo_num; i++)
554 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_STOP; 552 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_STOP;
555 netif_stop_queue(sp->dev);
556 } 553 }
554 netif_tx_stop_all_queues(sp->dev);
557} 555}
558 556
559static inline void s2io_stop_tx_queue(struct s2io_nic *sp, int fifo_no) 557static inline void s2io_stop_tx_queue(struct s2io_nic *sp, int fifo_no)
560{ 558{
561 if (sp->config.multiq) 559 if (!sp->config.multiq)
562 netif_stop_subqueue(sp->dev, fifo_no);
563 else {
564 sp->mac_control.fifos[fifo_no].queue_state = 560 sp->mac_control.fifos[fifo_no].queue_state =
565 FIFO_QUEUE_STOP; 561 FIFO_QUEUE_STOP;
566 netif_stop_queue(sp->dev); 562
567 } 563 netif_tx_stop_all_queues(sp->dev);
568} 564}
569 565
570static inline void s2io_start_all_tx_queue(struct s2io_nic *sp) 566static inline void s2io_start_all_tx_queue(struct s2io_nic *sp)
571{ 567{
572 int i; 568 if (!sp->config.multiq) {
573 if (sp->config.multiq) { 569 int i;
574 for (i = 0; i < sp->config.tx_fifo_num; i++) 570
575 netif_start_subqueue(sp->dev, i);
576 } else {
577 for (i = 0; i < sp->config.tx_fifo_num; i++) 571 for (i = 0; i < sp->config.tx_fifo_num; i++)
578 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_START; 572 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_START;
579 netif_start_queue(sp->dev);
580 } 573 }
574 netif_tx_start_all_queues(sp->dev);
581} 575}
582 576
583static inline void s2io_start_tx_queue(struct s2io_nic *sp, int fifo_no) 577static inline void s2io_start_tx_queue(struct s2io_nic *sp, int fifo_no)
584{ 578{
585 if (sp->config.multiq) 579 if (!sp->config.multiq)
586 netif_start_subqueue(sp->dev, fifo_no);
587 else {
588 sp->mac_control.fifos[fifo_no].queue_state = 580 sp->mac_control.fifos[fifo_no].queue_state =
589 FIFO_QUEUE_START; 581 FIFO_QUEUE_START;
590 netif_start_queue(sp->dev); 582
591 } 583 netif_tx_start_all_queues(sp->dev);
592} 584}
593 585
594static inline void s2io_wake_all_tx_queue(struct s2io_nic *sp) 586static inline void s2io_wake_all_tx_queue(struct s2io_nic *sp)
595{ 587{
596 int i; 588 if (!sp->config.multiq) {
597 if (sp->config.multiq) { 589 int i;
598 for (i = 0; i < sp->config.tx_fifo_num; i++) 590
599 netif_wake_subqueue(sp->dev, i);
600 } else {
601 for (i = 0; i < sp->config.tx_fifo_num; i++) 591 for (i = 0; i < sp->config.tx_fifo_num; i++)
602 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_START; 592 sp->mac_control.fifos[i].queue_state = FIFO_QUEUE_START;
603 netif_wake_queue(sp->dev);
604 } 593 }
594 netif_tx_wake_all_queues(sp->dev);
605} 595}
606 596
607static inline void s2io_wake_tx_queue( 597static inline void s2io_wake_tx_queue(
@@ -8691,5 +8681,5 @@ static void s2io_io_resume(struct pci_dev *pdev)
8691 } 8681 }
8692 8682
8693 netif_device_attach(netdev); 8683 netif_device_attach(netdev);
8694 netif_wake_queue(netdev); 8684 netif_tx_wake_all_queues(netdev);
8695} 8685}