aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000.h5
-rw-r--r--drivers/net/e1000/e1000_ethtool.c8
-rw-r--r--drivers/net/e1000/e1000_hw.h1
-rw-r--r--drivers/net/e1000/e1000_main.c76
-rw-r--r--drivers/net/e1000/e1000_param.c4
5 files changed, 55 insertions, 39 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 4dd1326dd04f..5940f7a223bc 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -268,6 +268,7 @@ struct e1000_adapter {
268#ifdef CONFIG_E1000_MQ 268#ifdef CONFIG_E1000_MQ
269 struct e1000_tx_ring **cpu_tx_ring; /* per-cpu */ 269 struct e1000_tx_ring **cpu_tx_ring; /* per-cpu */
270#endif 270#endif
271 unsigned long tx_queue_len;
271 uint32_t txd_cmd; 272 uint32_t txd_cmd;
272 uint32_t tx_int_delay; 273 uint32_t tx_int_delay;
273 uint32_t tx_abs_int_delay; 274 uint32_t tx_abs_int_delay;
@@ -303,7 +304,8 @@ struct e1000_adapter {
303 struct call_async_data_struct rx_sched_call_data; 304 struct call_async_data_struct rx_sched_call_data;
304 int cpu_for_queue[4]; 305 int cpu_for_queue[4];
305#endif 306#endif
306 int num_queues; 307 int num_tx_queues;
308 int num_rx_queues;
307 309
308 uint64_t hw_csum_err; 310 uint64_t hw_csum_err;
309 uint64_t hw_csum_good; 311 uint64_t hw_csum_good;
@@ -336,6 +338,7 @@ struct e1000_adapter {
336 struct e1000_rx_ring test_rx_ring; 338 struct e1000_rx_ring test_rx_ring;
337 339
338 340
341 u32 *config_space;
339 int msg_enable; 342 int msg_enable;
340#ifdef CONFIG_PCI_MSI 343#ifdef CONFIG_PCI_MSI
341 boolean_t have_msi; 344 boolean_t have_msi;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 54ae8805e79f..fa9a4659369a 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -614,8 +614,8 @@ e1000_set_ringparam(struct net_device *netdev,
614 struct e1000_rx_ring *rxdr, *rx_old, *rx_new; 614 struct e1000_rx_ring *rxdr, *rx_old, *rx_new;
615 int i, err, tx_ring_size, rx_ring_size; 615 int i, err, tx_ring_size, rx_ring_size;
616 616
617 tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_queues; 617 tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues;
618 rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_queues; 618 rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues;
619 619
620 if (netif_running(adapter->netdev)) 620 if (netif_running(adapter->netdev))
621 e1000_down(adapter); 621 e1000_down(adapter);
@@ -654,10 +654,10 @@ e1000_set_ringparam(struct net_device *netdev,
654 E1000_MAX_TXD : E1000_MAX_82544_TXD)); 654 E1000_MAX_TXD : E1000_MAX_82544_TXD));
655 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); 655 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
656 656
657 for (i = 0; i < adapter->num_queues; i++) { 657 for (i = 0; i < adapter->num_tx_queues; i++)
658 txdr[i].count = txdr->count; 658 txdr[i].count = txdr->count;
659 for (i = 0; i < adapter->num_rx_queues; i++)
659 rxdr[i].count = rxdr->count; 660 rxdr[i].count = rxdr->count;
660 }
661 661
662 if(netif_running(adapter->netdev)) { 662 if(netif_running(adapter->netdev)) {
663 /* Try to get new resources before deleting old */ 663 /* Try to get new resources before deleting old */
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 7caa35748cea..1ddfd56fc5df 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1497,6 +1497,7 @@ struct e1000_hw {
1497#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ 1497#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */
1498#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ 1498#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */
1499#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ 1499#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */
1500#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */
1500#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 1501#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
1501#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 1502#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
1502#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 1503#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 5f848b3a3a4d..540c8561fc24 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -411,8 +411,9 @@ e1000_up(struct e1000_adapter *adapter)
411 e1000_configure_tx(adapter); 411 e1000_configure_tx(adapter);
412 e1000_setup_rctl(adapter); 412 e1000_setup_rctl(adapter);
413 e1000_configure_rx(adapter); 413 e1000_configure_rx(adapter);
414 for (i = 0; i < adapter->num_queues; i++) 414 for (i = 0; i < adapter->num_rx_queues; i++) {
415 adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]); 415 adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]);
416 }
416 417
417#ifdef CONFIG_PCI_MSI 418#ifdef CONFIG_PCI_MSI
418 if(adapter->hw.mac_type > e1000_82547_rev_2) { 419 if(adapter->hw.mac_type > e1000_82547_rev_2) {
@@ -867,7 +868,7 @@ e1000_remove(struct pci_dev *pdev)
867 868
868 unregister_netdev(netdev); 869 unregister_netdev(netdev);
869#ifdef CONFIG_E1000_NAPI 870#ifdef CONFIG_E1000_NAPI
870 for (i = 0; i < adapter->num_queues; i++) 871 for (i = 0; i < adapter->num_rx_queues; i++)
871 __dev_put(&adapter->polling_netdev[i]); 872 __dev_put(&adapter->polling_netdev[i]);
872#endif 873#endif
873 874
@@ -972,15 +973,25 @@ e1000_sw_init(struct e1000_adapter *adapter)
972 switch (hw->mac_type) { 973 switch (hw->mac_type) {
973 case e1000_82571: 974 case e1000_82571:
974 case e1000_82572: 975 case e1000_82572:
975 adapter->num_queues = 2; 976 /* These controllers support 2 tx queues, but with a single
977 * qdisc implementation, multiple tx queues aren't quite as
978 * interesting. If we can find a logical way of mapping
979 * flows to a queue, then perhaps we can up the num_tx_queue
980 * count back to its default. Until then, we run the risk of
981 * terrible performance due to SACK overload. */
982 adapter->num_tx_queues = 1;
983 adapter->num_rx_queues = 2;
976 break; 984 break;
977 default: 985 default:
978 adapter->num_queues = 1; 986 adapter->num_tx_queues = 1;
987 adapter->num_rx_queues = 1;
979 break; 988 break;
980 } 989 }
981 adapter->num_queues = min(adapter->num_queues, num_online_cpus()); 990 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());
982#else 992#else
983 adapter->num_queues = 1; 993 adapter->num_tx_queues = 1;
994 adapter->num_rx_queues = 1;
984#endif 995#endif
985 996
986 if (e1000_alloc_queues(adapter)) { 997 if (e1000_alloc_queues(adapter)) {
@@ -989,7 +1000,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
989 } 1000 }
990 1001
991#ifdef CONFIG_E1000_NAPI 1002#ifdef CONFIG_E1000_NAPI
992 for (i = 0; i < adapter->num_queues; i++) { 1003 for (i = 0; i < adapter->num_rx_queues; i++) {
993 adapter->polling_netdev[i].priv = adapter; 1004 adapter->polling_netdev[i].priv = adapter;
994 adapter->polling_netdev[i].poll = &e1000_clean; 1005 adapter->polling_netdev[i].poll = &e1000_clean;
995 adapter->polling_netdev[i].weight = 64; 1006 adapter->polling_netdev[i].weight = 64;
@@ -1022,13 +1033,13 @@ e1000_alloc_queues(struct e1000_adapter *adapter)
1022{ 1033{
1023 int size; 1034 int size;
1024 1035
1025 size = sizeof(struct e1000_tx_ring) * adapter->num_queues; 1036 size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues;
1026 adapter->tx_ring = kmalloc(size, GFP_KERNEL); 1037 adapter->tx_ring = kmalloc(size, GFP_KERNEL);
1027 if (!adapter->tx_ring) 1038 if (!adapter->tx_ring)
1028 return -ENOMEM; 1039 return -ENOMEM;
1029 memset(adapter->tx_ring, 0, size); 1040 memset(adapter->tx_ring, 0, size);
1030 1041
1031 size = sizeof(struct e1000_rx_ring) * adapter->num_queues; 1042 size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues;
1032 adapter->rx_ring = kmalloc(size, GFP_KERNEL); 1043 adapter->rx_ring = kmalloc(size, GFP_KERNEL);
1033 if (!adapter->rx_ring) { 1044 if (!adapter->rx_ring) {
1034 kfree(adapter->tx_ring); 1045 kfree(adapter->tx_ring);
@@ -1037,7 +1048,7 @@ e1000_alloc_queues(struct e1000_adapter *adapter)
1037 memset(adapter->rx_ring, 0, size); 1048 memset(adapter->rx_ring, 0, size);
1038 1049
1039#ifdef CONFIG_E1000_NAPI 1050#ifdef CONFIG_E1000_NAPI
1040 size = sizeof(struct net_device) * adapter->num_queues; 1051 size = sizeof(struct net_device) * adapter->num_rx_queues;
1041 adapter->polling_netdev = kmalloc(size, GFP_KERNEL); 1052 adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
1042 if (!adapter->polling_netdev) { 1053 if (!adapter->polling_netdev) {
1043 kfree(adapter->tx_ring); 1054 kfree(adapter->tx_ring);
@@ -1066,12 +1077,12 @@ e1000_setup_queue_mapping(struct e1000_adapter *adapter)
1066 lock_cpu_hotplug(); 1077 lock_cpu_hotplug();
1067 i = 0; 1078 i = 0;
1068 for_each_online_cpu(cpu) { 1079 for_each_online_cpu(cpu) {
1069 *per_cpu_ptr(adapter->cpu_tx_ring, cpu) = &adapter->tx_ring[i % adapter->num_queues]; 1080 *per_cpu_ptr(adapter->cpu_tx_ring, cpu) = &adapter->tx_ring[i % adapter->num_tx_queues];
1070 /* This is incomplete because we'd like to assign separate 1081 /* This is incomplete because we'd like to assign separate
1071 * physical cpus to these netdev polling structures and 1082 * physical cpus to these netdev polling structures and
1072 * avoid saturating a subset of cpus. 1083 * avoid saturating a subset of cpus.
1073 */ 1084 */
1074 if (i < adapter->num_queues) { 1085 if (i < adapter->num_rx_queues) {
1075 *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i]; 1086 *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i];
1076 adapter->cpu_for_queue[i] = cpu; 1087 adapter->cpu_for_queue[i] = cpu;
1077 } else 1088 } else
@@ -1291,7 +1302,7 @@ e1000_setup_all_tx_resources(struct e1000_adapter *adapter)
1291{ 1302{
1292 int i, err = 0; 1303 int i, err = 0;
1293 1304
1294 for (i = 0; i < adapter->num_queues; i++) { 1305 for (i = 0; i < adapter->num_tx_queues; i++) {
1295 err = e1000_setup_tx_resources(adapter, &adapter->tx_ring[i]); 1306 err = e1000_setup_tx_resources(adapter, &adapter->tx_ring[i]);
1296 if (err) { 1307 if (err) {
1297 DPRINTK(PROBE, ERR, 1308 DPRINTK(PROBE, ERR,
@@ -1319,7 +1330,7 @@ e1000_configure_tx(struct e1000_adapter *adapter)
1319 1330
1320 /* Setup the HW Tx Head and Tail descriptor pointers */ 1331 /* Setup the HW Tx Head and Tail descriptor pointers */
1321 1332
1322 switch (adapter->num_queues) { 1333 switch (adapter->num_tx_queues) {
1323 case 2: 1334 case 2:
1324 tdba = adapter->tx_ring[1].dma; 1335 tdba = adapter->tx_ring[1].dma;
1325 tdlen = adapter->tx_ring[1].count * 1336 tdlen = adapter->tx_ring[1].count *
@@ -1537,7 +1548,7 @@ e1000_setup_all_rx_resources(struct e1000_adapter *adapter)
1537{ 1548{
1538 int i, err = 0; 1549 int i, err = 0;
1539 1550
1540 for (i = 0; i < adapter->num_queues; i++) { 1551 for (i = 0; i < adapter->num_rx_queues; i++) {
1541 err = e1000_setup_rx_resources(adapter, &adapter->rx_ring[i]); 1552 err = e1000_setup_rx_resources(adapter, &adapter->rx_ring[i]);
1542 if (err) { 1553 if (err) {
1543 DPRINTK(PROBE, ERR, 1554 DPRINTK(PROBE, ERR,
@@ -1709,7 +1720,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1709 1720
1710 /* Setup the HW Rx Head and Tail Descriptor Pointers and 1721 /* Setup the HW Rx Head and Tail Descriptor Pointers and
1711 * the Base and Length of the Rx Descriptor Ring */ 1722 * the Base and Length of the Rx Descriptor Ring */
1712 switch (adapter->num_queues) { 1723 switch (adapter->num_rx_queues) {
1713#ifdef CONFIG_E1000_MQ 1724#ifdef CONFIG_E1000_MQ
1714 case 2: 1725 case 2:
1715 rdba = adapter->rx_ring[1].dma; 1726 rdba = adapter->rx_ring[1].dma;
@@ -1736,7 +1747,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1736 } 1747 }
1737 1748
1738#ifdef CONFIG_E1000_MQ 1749#ifdef CONFIG_E1000_MQ
1739 if (adapter->num_queues > 1) { 1750 if (adapter->num_rx_queues > 1) {
1740 uint32_t random[10]; 1751 uint32_t random[10];
1741 1752
1742 get_random_bytes(&random[0], 40); 1753 get_random_bytes(&random[0], 40);
@@ -1746,7 +1757,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1746 E1000_WRITE_REG(hw, RSSIM, 0); 1757 E1000_WRITE_REG(hw, RSSIM, 0);
1747 } 1758 }
1748 1759
1749 switch (adapter->num_queues) { 1760 switch (adapter->num_rx_queues) {
1750 case 2: 1761 case 2:
1751 default: 1762 default:
1752 reta = 0x00800080; 1763 reta = 0x00800080;
@@ -1838,7 +1849,7 @@ e1000_free_all_tx_resources(struct e1000_adapter *adapter)
1838{ 1849{
1839 int i; 1850 int i;
1840 1851
1841 for (i = 0; i < adapter->num_queues; i++) 1852 for (i = 0; i < adapter->num_tx_queues; i++)
1842 e1000_free_tx_resources(adapter, &adapter->tx_ring[i]); 1853 e1000_free_tx_resources(adapter, &adapter->tx_ring[i]);
1843} 1854}
1844 1855
@@ -1905,7 +1916,7 @@ e1000_clean_all_tx_rings(struct e1000_adapter *adapter)
1905{ 1916{
1906 int i; 1917 int i;
1907 1918
1908 for (i = 0; i < adapter->num_queues; i++) 1919 for (i = 0; i < adapter->num_tx_queues; i++)
1909 e1000_clean_tx_ring(adapter, &adapter->tx_ring[i]); 1920 e1000_clean_tx_ring(adapter, &adapter->tx_ring[i]);
1910} 1921}
1911 1922
@@ -1949,7 +1960,7 @@ e1000_free_all_rx_resources(struct e1000_adapter *adapter)
1949{ 1960{
1950 int i; 1961 int i;
1951 1962
1952 for (i = 0; i < adapter->num_queues; i++) 1963 for (i = 0; i < adapter->num_rx_queues; i++)
1953 e1000_free_rx_resources(adapter, &adapter->rx_ring[i]); 1964 e1000_free_rx_resources(adapter, &adapter->rx_ring[i]);
1954} 1965}
1955 1966
@@ -2025,7 +2036,7 @@ e1000_clean_all_rx_rings(struct e1000_adapter *adapter)
2025{ 2036{
2026 int i; 2037 int i;
2027 2038
2028 for (i = 0; i < adapter->num_queues; i++) 2039 for (i = 0; i < adapter->num_rx_queues; i++)
2029 e1000_clean_rx_ring(adapter, &adapter->rx_ring[i]); 2040 e1000_clean_rx_ring(adapter, &adapter->rx_ring[i]);
2030} 2041}
2031 2042
@@ -2325,7 +2336,10 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
2325 2336
2326 e1000_update_adaptive(&adapter->hw); 2337 e1000_update_adaptive(&adapter->hw);
2327 2338
2328 if (adapter->num_queues == 1 && !netif_carrier_ok(netdev)) { 2339#ifdef CONFIG_E1000_MQ
2340 txdr = *per_cpu_ptr(adapter->cpu_tx_ring, smp_processor_id());
2341#endif
2342 if (!netif_carrier_ok(netdev)) {
2329 if (E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { 2343 if (E1000_DESC_UNUSED(txdr) + 1 < txdr->count) {
2330 /* We've lost link, so the controller stops DMA, 2344 /* We've lost link, so the controller stops DMA,
2331 * but we've got queued Tx work that's never going 2345 * but we've got queued Tx work that's never going
@@ -3197,14 +3211,12 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
3197 E1000_WRITE_FLUSH(hw); 3211 E1000_WRITE_FLUSH(hw);
3198#ifdef CONFIG_E1000_MQ 3212#ifdef CONFIG_E1000_MQ
3199 if (atomic_read(&adapter->rx_sched_call_data.count) == 0) { 3213 if (atomic_read(&adapter->rx_sched_call_data.count) == 0) {
3200 cpu_set(adapter->cpu_for_queue[0], 3214 /* We must setup the cpumask once count == 0 since
3201 adapter->rx_sched_call_data.cpumask); 3215 * each cpu bit is cleared when the work is done. */
3202 for (i = 1; i < adapter->num_queues; i++) { 3216 adapter->rx_sched_call_data.cpumask = adapter->cpumask;
3203 cpu_set(adapter->cpu_for_queue[i], 3217 atomic_add(adapter->num_rx_queues - 1, &adapter->irq_sem);
3204 adapter->rx_sched_call_data.cpumask); 3218 atomic_set(&adapter->rx_sched_call_data.count,
3205 atomic_inc(&adapter->irq_sem); 3219 adapter->num_rx_queues);
3206 }
3207 atomic_set(&adapter->rx_sched_call_data.count, i);
3208 smp_call_async_mask(&adapter->rx_sched_call_data); 3220 smp_call_async_mask(&adapter->rx_sched_call_data);
3209 } else { 3221 } else {
3210 printk("call_data.count == %u\n", atomic_read(&adapter->rx_sched_call_data.count)); 3222 printk("call_data.count == %u\n", atomic_read(&adapter->rx_sched_call_data.count));
@@ -3267,7 +3279,7 @@ e1000_clean(struct net_device *poll_dev, int *budget)
3267 3279
3268 while (poll_dev != &adapter->polling_netdev[i]) { 3280 while (poll_dev != &adapter->polling_netdev[i]) {
3269 i++; 3281 i++;
3270 if (unlikely(i == adapter->num_queues)) 3282 if (unlikely(i == adapter->num_rx_queues))
3271 BUG(); 3283 BUG();
3272 } 3284 }
3273 3285
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index 852841f12fb9..b0be7d69af34 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -320,7 +320,7 @@ e1000_check_options(struct e1000_adapter *adapter)
320 } else { 320 } else {
321 tx_ring->count = opt.def; 321 tx_ring->count = opt.def;
322 } 322 }
323 for (i = 0; i < adapter->num_queues; i++) 323 for (i = 0; i < adapter->num_tx_queues; i++)
324 tx_ring[i].count = tx_ring->count; 324 tx_ring[i].count = tx_ring->count;
325 } 325 }
326 { /* Receive Descriptor Count */ 326 { /* Receive Descriptor Count */
@@ -346,7 +346,7 @@ e1000_check_options(struct e1000_adapter *adapter)
346 } else { 346 } else {
347 rx_ring->count = opt.def; 347 rx_ring->count = opt.def;
348 } 348 }
349 for (i = 0; i < adapter->num_queues; i++) 349 for (i = 0; i < adapter->num_rx_queues; i++)
350 rx_ring[i].count = rx_ring->count; 350 rx_ring[i].count = rx_ring->count;
351 } 351 }
352 { /* Checksum Offload Enable/Disable */ 352 { /* Checksum Offload Enable/Disable */