aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
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/net/s2io.c
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/net/s2io.c')
-rw-r--r--drivers/net/s2io.c48
1 files changed, 19 insertions, 29 deletions
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}