aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c102
1 files changed, 94 insertions, 8 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c062b0ad8262..407abb2c0548 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -398,6 +398,10 @@ e1000_reset(struct e1000_adapter *adapter)
398 case e1000_82547_rev_2: 398 case e1000_82547_rev_2:
399 pba = E1000_PBA_30K; 399 pba = E1000_PBA_30K;
400 break; 400 break;
401 case e1000_82571:
402 case e1000_82572:
403 pba = E1000_PBA_38K;
404 break;
401 case e1000_82573: 405 case e1000_82573:
402 pba = E1000_PBA_12K; 406 pba = E1000_PBA_12K;
403 break; 407 break;
@@ -475,6 +479,7 @@ e1000_probe(struct pci_dev *pdev,
475 struct net_device *netdev; 479 struct net_device *netdev;
476 struct e1000_adapter *adapter; 480 struct e1000_adapter *adapter;
477 unsigned long mmio_start, mmio_len; 481 unsigned long mmio_start, mmio_len;
482 uint32_t ctrl_ext;
478 uint32_t swsm; 483 uint32_t swsm;
479 484
480 static int cards_found = 0; 485 static int cards_found = 0;
@@ -688,6 +693,12 @@ e1000_probe(struct pci_dev *pdev,
688 693
689 /* Let firmware know the driver has taken over */ 694 /* Let firmware know the driver has taken over */
690 switch(adapter->hw.mac_type) { 695 switch(adapter->hw.mac_type) {
696 case e1000_82571:
697 case e1000_82572:
698 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
699 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
700 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
701 break;
691 case e1000_82573: 702 case e1000_82573:
692 swsm = E1000_READ_REG(&adapter->hw, SWSM); 703 swsm = E1000_READ_REG(&adapter->hw, SWSM);
693 E1000_WRITE_REG(&adapter->hw, SWSM, 704 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -732,6 +743,7 @@ e1000_remove(struct pci_dev *pdev)
732{ 743{
733 struct net_device *netdev = pci_get_drvdata(pdev); 744 struct net_device *netdev = pci_get_drvdata(pdev);
734 struct e1000_adapter *adapter = netdev_priv(netdev); 745 struct e1000_adapter *adapter = netdev_priv(netdev);
746 uint32_t ctrl_ext;
735 uint32_t manc, swsm; 747 uint32_t manc, swsm;
736 748
737 flush_scheduled_work(); 749 flush_scheduled_work();
@@ -746,6 +758,12 @@ e1000_remove(struct pci_dev *pdev)
746 } 758 }
747 759
748 switch(adapter->hw.mac_type) { 760 switch(adapter->hw.mac_type) {
761 case e1000_82571:
762 case e1000_82572:
763 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
764 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
765 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
766 break;
749 case e1000_82573: 767 case e1000_82573:
750 swsm = E1000_READ_REG(&adapter->hw, SWSM); 768 swsm = E1000_READ_REG(&adapter->hw, SWSM);
751 E1000_WRITE_REG(&adapter->hw, SWSM, 769 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -1236,7 +1254,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1236 rctl |= E1000_RCTL_LPE; 1254 rctl |= E1000_RCTL_LPE;
1237 1255
1238 /* Setup buffer sizes */ 1256 /* Setup buffer sizes */
1239 if(adapter->hw.mac_type == e1000_82573) { 1257 if(adapter->hw.mac_type >= e1000_82571) {
1240 /* We can now specify buffers in 1K increments. 1258 /* We can now specify buffers in 1K increments.
1241 * BSIZE and BSEX are ignored in this case. */ 1259 * BSIZE and BSEX are ignored in this case. */
1242 rctl |= adapter->rx_buffer_len << 0x11; 1260 rctl |= adapter->rx_buffer_len << 0x11;
@@ -1352,7 +1370,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1352 if(adapter->rx_csum == TRUE) { 1370 if(adapter->rx_csum == TRUE) {
1353 rxcsum |= E1000_RXCSUM_TUOFL; 1371 rxcsum |= E1000_RXCSUM_TUOFL;
1354 1372
1355 /* Enable 82573 IPv4 payload checksum for UDP fragments 1373 /* Enable 82571 IPv4 payload checksum for UDP fragments
1356 * Must be used in conjunction with packet-split. */ 1374 * Must be used in conjunction with packet-split. */
1357 if((adapter->hw.mac_type > e1000_82547_rev_2) && 1375 if((adapter->hw.mac_type > e1000_82547_rev_2) &&
1358 (adapter->rx_ps)) { 1376 (adapter->rx_ps)) {
@@ -1608,6 +1626,22 @@ e1000_set_mac(struct net_device *netdev, void *p)
1608 1626
1609 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); 1627 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
1610 1628
1629 /* With 82571 controllers, LAA may be overwritten (with the default)
1630 * due to controller reset from the other port. */
1631 if (adapter->hw.mac_type == e1000_82571) {
1632 /* activate the work around */
1633 adapter->hw.laa_is_present = 1;
1634
1635 /* Hold a copy of the LAA in RAR[14] This is done so that
1636 * between the time RAR[0] gets clobbered and the time it
1637 * gets fixed (in e1000_watchdog), the actual LAA is in one
1638 * of the RARs and no incoming packets directed to this port
1639 * are dropped. Eventaully the LAA will be in RAR[0] and
1640 * RAR[14] */
1641 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr,
1642 E1000_RAR_ENTRIES - 1);
1643 }
1644
1611 if(adapter->hw.mac_type == e1000_82542_rev2_0) 1645 if(adapter->hw.mac_type == e1000_82542_rev2_0)
1612 e1000_leave_82542_rst(adapter); 1646 e1000_leave_82542_rst(adapter);
1613 1647
@@ -1633,9 +1667,12 @@ e1000_set_multi(struct net_device *netdev)
1633 unsigned long flags; 1667 unsigned long flags;
1634 uint32_t rctl; 1668 uint32_t rctl;
1635 uint32_t hash_value; 1669 uint32_t hash_value;
1636 int i; 1670 int i, rar_entries = E1000_RAR_ENTRIES;
1637 1671
1638 spin_lock_irqsave(&adapter->tx_lock, flags); 1672 spin_lock_irqsave(&adapter->tx_lock, flags);
1673 /* reserve RAR[14] for LAA over-write work-around */
1674 if (adapter->hw.mac_type == e1000_82571)
1675 rar_entries--;
1639 1676
1640 /* Check for Promiscuous and All Multicast modes */ 1677 /* Check for Promiscuous and All Multicast modes */
1641 1678
@@ -1660,11 +1697,12 @@ e1000_set_multi(struct net_device *netdev)
1660 /* load the first 14 multicast address into the exact filters 1-14 1697 /* load the first 14 multicast address into the exact filters 1-14
1661 * RAR 0 is used for the station MAC adddress 1698 * RAR 0 is used for the station MAC adddress
1662 * if there are not 14 addresses, go ahead and clear the filters 1699 * if there are not 14 addresses, go ahead and clear the filters
1700 * -- with 82571 controllers only 0-13 entries are filled here
1663 */ 1701 */
1664 mc_ptr = netdev->mc_list; 1702 mc_ptr = netdev->mc_list;
1665 1703
1666 for(i = 1; i < E1000_RAR_ENTRIES; i++) { 1704 for(i = 1; i < rar_entries; i++) {
1667 if(mc_ptr) { 1705 if (mc_ptr) {
1668 e1000_rar_set(hw, mc_ptr->dmi_addr, i); 1706 e1000_rar_set(hw, mc_ptr->dmi_addr, i);
1669 mc_ptr = mc_ptr->next; 1707 mc_ptr = mc_ptr->next;
1670 } else { 1708 } else {
@@ -1848,6 +1886,11 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
1848 /* Force detection of hung controller every watchdog period */ 1886 /* Force detection of hung controller every watchdog period */
1849 adapter->detect_tx_hung = TRUE; 1887 adapter->detect_tx_hung = TRUE;
1850 1888
1889 /* With 82571 controllers, LAA may be overwritten due to controller
1890 * reset from the other port. Set the appropriate LAA in RAR[0] */
1891 if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present)
1892 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
1893
1851 /* Reset the timer */ 1894 /* Reset the timer */
1852 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 1895 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1853} 1896}
@@ -2269,6 +2312,27 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2269 local_irq_restore(flags); 2312 local_irq_restore(flags);
2270 return NETDEV_TX_LOCKED; 2313 return NETDEV_TX_LOCKED;
2271 } 2314 }
2315#ifdef NETIF_F_TSO
2316 /* TSO Workaround for 82571/2 Controllers -- if skb->data
2317 * points to just header, pull a few bytes of payload from
2318 * frags into skb->data */
2319 if (skb_shinfo(skb)->tso_size) {
2320 uint8_t hdr_len;
2321 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
2322 if (skb->data_len && (hdr_len < (skb->len - skb->data_len)) &&
2323 (adapter->hw.mac_type == e1000_82571 ||
2324 adapter->hw.mac_type == e1000_82572)) {
2325 unsigned int pull_size;
2326 pull_size = min((unsigned int)4, skb->data_len);
2327 if (!__pskb_pull_tail(skb, pull_size)) {
2328 printk(KERN_ERR "__pskb_pull_tail failed.\n");
2329 dev_kfree_skb_any(skb);
2330 return -EFAULT;
2331 }
2332 }
2333 }
2334#endif
2335
2272 if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) 2336 if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) )
2273 e1000_transfer_dhcp_info(adapter, skb); 2337 e1000_transfer_dhcp_info(adapter, skb);
2274 2338
@@ -2310,7 +2374,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2310 tx_flags |= E1000_TX_FLAGS_CSUM; 2374 tx_flags |= E1000_TX_FLAGS_CSUM;
2311 2375
2312 /* Old method was to assume IPv4 packet by default if TSO was enabled. 2376 /* Old method was to assume IPv4 packet by default if TSO was enabled.
2313 * 82573 hardware supports TSO capabilities for IPv6 as well... 2377 * 82571 hardware supports TSO capabilities for IPv6 as well...
2314 * no longer assume, we must. */ 2378 * no longer assume, we must. */
2315 if(likely(skb->protocol == ntohs(ETH_P_IP))) 2379 if(likely(skb->protocol == ntohs(ETH_P_IP)))
2316 tx_flags |= E1000_TX_FLAGS_IPV4; 2380 tx_flags |= E1000_TX_FLAGS_IPV4;
@@ -2389,9 +2453,18 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
2389 return -EINVAL; 2453 return -EINVAL;
2390 } 2454 }
2391 2455
2392#define MAX_STD_JUMBO_FRAME_SIZE 9216 2456#define MAX_STD_JUMBO_FRAME_SIZE 9234
2393 /* might want this to be bigger enum check... */ 2457 /* might want this to be bigger enum check... */
2394 if (adapter->hw.mac_type == e1000_82573 && 2458 /* 82571 controllers limit jumbo frame size to 10500 bytes */
2459 if ((adapter->hw.mac_type == e1000_82571 ||
2460 adapter->hw.mac_type == e1000_82572) &&
2461 max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
2462 DPRINTK(PROBE, ERR, "MTU > 9216 bytes not supported "
2463 "on 82571 and 82572 controllers.\n");
2464 return -EINVAL;
2465 }
2466
2467 if(adapter->hw.mac_type == e1000_82573 &&
2395 max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { 2468 max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
2396 DPRINTK(PROBE, ERR, "Jumbo Frames not supported " 2469 DPRINTK(PROBE, ERR, "Jumbo Frames not supported "
2397 "on 82573\n"); 2470 "on 82573\n");
@@ -3716,6 +3789,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
3716 } 3789 }
3717 3790
3718 switch(adapter->hw.mac_type) { 3791 switch(adapter->hw.mac_type) {
3792 case e1000_82571:
3793 case e1000_82572:
3794 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
3795 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
3796 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
3797 break;
3719 case e1000_82573: 3798 case e1000_82573:
3720 swsm = E1000_READ_REG(&adapter->hw, SWSM); 3799 swsm = E1000_READ_REG(&adapter->hw, SWSM);
3721 E1000_WRITE_REG(&adapter->hw, SWSM, 3800 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -3738,6 +3817,7 @@ e1000_resume(struct pci_dev *pdev)
3738 struct net_device *netdev = pci_get_drvdata(pdev); 3817 struct net_device *netdev = pci_get_drvdata(pdev);
3739 struct e1000_adapter *adapter = netdev_priv(netdev); 3818 struct e1000_adapter *adapter = netdev_priv(netdev);
3740 uint32_t manc, ret_val, swsm; 3819 uint32_t manc, ret_val, swsm;
3820 uint32_t ctrl_ext;
3741 3821
3742 pci_set_power_state(pdev, PCI_D0); 3822 pci_set_power_state(pdev, PCI_D0);
3743 pci_restore_state(pdev); 3823 pci_restore_state(pdev);
@@ -3763,6 +3843,12 @@ e1000_resume(struct pci_dev *pdev)
3763 } 3843 }
3764 3844
3765 switch(adapter->hw.mac_type) { 3845 switch(adapter->hw.mac_type) {
3846 case e1000_82571:
3847 case e1000_82572:
3848 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
3849 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
3850 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
3851 break;
3766 case e1000_82573: 3852 case e1000_82573:
3767 swsm = E1000_READ_REG(&adapter->hw, SWSM); 3853 swsm = E1000_READ_REG(&adapter->hw, SWSM);
3768 E1000_WRITE_REG(&adapter->hw, SWSM, 3854 E1000_WRITE_REG(&adapter->hw, SWSM,