aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2006-01-12 19:50:41 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 07:40:11 -0500
commit7bfa48162d4924e8cc7fb8eccc8c8f66cc111eb4 (patch)
tree906365b7e1c17f15fa470dbad448cafa3310f011 /drivers/net/e1000/e1000_main.c
parentf56799ea39a85a6f3760a134aa0e6d1c17eea369 (diff)
[PATCH] e1000: Fix mulitple queues
Fixed stats when using multiple queues. When multiple queues are enabled, log a message in syslog. Fixed memory allocation for multiple queues. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: John Ronciak <john.ronciak@intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 540c8561fc24..4016264a7919 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -433,6 +433,12 @@ e1000_up(struct e1000_adapter *adapter)
433 return err; 433 return err;
434 } 434 }
435 435
436#ifdef CONFIG_E1000_MQ
437 e1000_setup_queue_mapping(adapter);
438#endif
439
440 adapter->tx_queue_len = netdev->tx_queue_len;
441
436 mod_timer(&adapter->watchdog_timer, jiffies); 442 mod_timer(&adapter->watchdog_timer, jiffies);
437 443
438#ifdef CONFIG_E1000_NAPI 444#ifdef CONFIG_E1000_NAPI
@@ -467,6 +473,7 @@ e1000_down(struct e1000_adapter *adapter)
467#ifdef CONFIG_E1000_NAPI 473#ifdef CONFIG_E1000_NAPI
468 netif_poll_disable(netdev); 474 netif_poll_disable(netdev);
469#endif 475#endif
476 netdev->tx_queue_len = adapter->tx_queue_len;
470 adapter->link_speed = 0; 477 adapter->link_speed = 0;
471 adapter->link_duplex = 0; 478 adapter->link_duplex = 0;
472 netif_carrier_off(netdev); 479 netif_carrier_off(netdev);
@@ -989,6 +996,15 @@ e1000_sw_init(struct e1000_adapter *adapter)
989 } 996 }
990 adapter->num_rx_queues = min(adapter->num_rx_queues, num_online_cpus()); 997 adapter->num_rx_queues = min(adapter->num_rx_queues, num_online_cpus());
991 adapter->num_tx_queues = min(adapter->num_tx_queues, num_online_cpus()); 998 adapter->num_tx_queues = min(adapter->num_tx_queues, num_online_cpus());
999 DPRINTK(DRV, INFO, "Multiqueue Enabled: Rx Queue count = %u %s\n",
1000 adapter->num_rx_queues,
1001 ((adapter->num_rx_queues == 1)
1002 ? ((num_online_cpus() > 1)
1003 ? "(due to unsupported feature in current adapter)"
1004 : "(due to unsupported system configuration)")
1005 : ""));
1006 DPRINTK(DRV, INFO, "Multiqueue Enabled: Tx Queue count = %u\n",
1007 adapter->num_tx_queues);
992#else 1008#else
993 adapter->num_tx_queues = 1; 1009 adapter->num_tx_queues = 1;
994 adapter->num_rx_queues = 1; 1010 adapter->num_rx_queues = 1;
@@ -1007,10 +1023,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
1007 dev_hold(&adapter->polling_netdev[i]); 1023 dev_hold(&adapter->polling_netdev[i]);
1008 set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state); 1024 set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state);
1009 } 1025 }
1010#endif 1026 spin_lock_init(&adapter->tx_queue_lock);
1011
1012#ifdef CONFIG_E1000_MQ
1013 e1000_setup_queue_mapping(adapter);
1014#endif 1027#endif
1015 1028
1016 atomic_set(&adapter->irq_sem, 1); 1029 atomic_set(&adapter->irq_sem, 1);
@@ -1058,6 +1071,14 @@ e1000_alloc_queues(struct e1000_adapter *adapter)
1058 memset(adapter->polling_netdev, 0, size); 1071 memset(adapter->polling_netdev, 0, size);
1059#endif 1072#endif
1060 1073
1074#ifdef CONFIG_E1000_MQ
1075 adapter->rx_sched_call_data.func = e1000_rx_schedule;
1076 adapter->rx_sched_call_data.info = adapter->netdev;
1077
1078 adapter->cpu_netdev = alloc_percpu(struct net_device *);
1079 adapter->cpu_tx_ring = alloc_percpu(struct e1000_tx_ring *);
1080#endif
1081
1061 return E1000_SUCCESS; 1082 return E1000_SUCCESS;
1062} 1083}
1063 1084
@@ -1084,7 +1105,8 @@ e1000_setup_queue_mapping(struct e1000_adapter *adapter)
1084 */ 1105 */
1085 if (i < adapter->num_rx_queues) { 1106 if (i < adapter->num_rx_queues) {
1086 *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i]; 1107 *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i];
1087 adapter->cpu_for_queue[i] = cpu; 1108 adapter->rx_ring[i].cpu = cpu;
1109 cpu_set(cpu, adapter->cpumask);
1088 } else 1110 } else
1089 *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL; 1111 *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL;
1090 1112
@@ -3337,6 +3359,10 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3337 if(unlikely(++i == tx_ring->count)) i = 0; 3359 if(unlikely(++i == tx_ring->count)) i = 0;
3338 } 3360 }
3339 3361
3362#ifdef CONFIG_E1000_MQ
3363 tx_ring->tx_stats.packets++;
3364#endif
3365
3340 eop = tx_ring->buffer_info[i].next_to_watch; 3366 eop = tx_ring->buffer_info[i].next_to_watch;
3341 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3367 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3342 } 3368 }
@@ -3365,6 +3391,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3365 eop = tx_ring->buffer_info[i].next_to_watch; 3391 eop = tx_ring->buffer_info[i].next_to_watch;
3366 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3392 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3367 DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n" 3393 DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
3394 " Tx Queue <%lu>\n"
3368 " TDH <%x>\n" 3395 " TDH <%x>\n"
3369 " TDT <%x>\n" 3396 " TDT <%x>\n"
3370 " next_to_use <%x>\n" 3397 " next_to_use <%x>\n"
@@ -3375,6 +3402,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3375 " next_to_watch <%x>\n" 3402 " next_to_watch <%x>\n"
3376 " jiffies <%lx>\n" 3403 " jiffies <%lx>\n"
3377 " next_to_watch.status <%x>\n", 3404 " next_to_watch.status <%x>\n",
3405 (unsigned long)((tx_ring - adapter->tx_ring) /
3406 sizeof(struct e1000_tx_ring)),
3378 readl(adapter->hw.hw_addr + tx_ring->tdh), 3407 readl(adapter->hw.hw_addr + tx_ring->tdh),
3379 readl(adapter->hw.hw_addr + tx_ring->tdt), 3408 readl(adapter->hw.hw_addr + tx_ring->tdt),
3380 tx_ring->next_to_use, 3409 tx_ring->next_to_use,
@@ -3541,6 +3570,10 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3541 } 3570 }
3542#endif /* CONFIG_E1000_NAPI */ 3571#endif /* CONFIG_E1000_NAPI */
3543 netdev->last_rx = jiffies; 3572 netdev->last_rx = jiffies;
3573#ifdef CONFIG_E1000_MQ
3574 rx_ring->rx_stats.packets++;
3575 rx_ring->rx_stats.bytes += length;
3576#endif
3544 3577
3545next_desc: 3578next_desc:
3546 rx_desc->status = 0; 3579 rx_desc->status = 0;
@@ -3671,6 +3704,10 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3671 } 3704 }
3672#endif /* CONFIG_E1000_NAPI */ 3705#endif /* CONFIG_E1000_NAPI */
3673 netdev->last_rx = jiffies; 3706 netdev->last_rx = jiffies;
3707#ifdef CONFIG_E1000_MQ
3708 rx_ring->rx_stats.packets++;
3709 rx_ring->rx_stats.bytes += length;
3710#endif
3674 3711
3675next_desc: 3712next_desc:
3676 rx_desc->wb.middle.status_error &= ~0xFF; 3713 rx_desc->wb.middle.status_error &= ~0xFF;