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.c345
1 files changed, 247 insertions, 98 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 73f3a85fd238..4c1ff752048c 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -213,6 +213,12 @@ static void e1000_netpoll (struct net_device *netdev);
213 213
214extern void e1000_check_options(struct e1000_adapter *adapter); 214extern void e1000_check_options(struct e1000_adapter *adapter);
215 215
216#define COPYBREAK_DEFAULT 256
217static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT;
218module_param(copybreak, uint, 0644);
219MODULE_PARM_DESC(copybreak,
220 "Maximum size of packet that is copied to a new buffer on receive");
221
216static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, 222static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
217 pci_channel_state_t state); 223 pci_channel_state_t state);
218static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); 224static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev);
@@ -264,7 +270,13 @@ e1000_init_module(void)
264 printk(KERN_INFO "%s\n", e1000_copyright); 270 printk(KERN_INFO "%s\n", e1000_copyright);
265 271
266 ret = pci_register_driver(&e1000_driver); 272 ret = pci_register_driver(&e1000_driver);
267 273 if (copybreak != COPYBREAK_DEFAULT) {
274 if (copybreak == 0)
275 printk(KERN_INFO "e1000: copybreak disabled\n");
276 else
277 printk(KERN_INFO "e1000: copybreak enabled for "
278 "packets <= %u bytes\n", copybreak);
279 }
268 return ret; 280 return ret;
269} 281}
270 282
@@ -464,6 +476,52 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
464 } 476 }
465} 477}
466 478
479static void
480e1000_init_manageability(struct e1000_adapter *adapter)
481{
482 if (adapter->en_mng_pt) {
483 uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
484
485 /* disable hardware interception of ARP */
486 manc &= ~(E1000_MANC_ARP_EN);
487
488 /* enable receiving management packets to the host */
489 /* this will probably generate destination unreachable messages
490 * from the host OS, but the packets will be handled on SMBUS */
491 if (adapter->hw.has_manc2h) {
492 uint32_t manc2h = E1000_READ_REG(&adapter->hw, MANC2H);
493
494 manc |= E1000_MANC_EN_MNG2HOST;
495#define E1000_MNG2HOST_PORT_623 (1 << 5)
496#define E1000_MNG2HOST_PORT_664 (1 << 6)
497 manc2h |= E1000_MNG2HOST_PORT_623;
498 manc2h |= E1000_MNG2HOST_PORT_664;
499 E1000_WRITE_REG(&adapter->hw, MANC2H, manc2h);
500 }
501
502 E1000_WRITE_REG(&adapter->hw, MANC, manc);
503 }
504}
505
506static void
507e1000_release_manageability(struct e1000_adapter *adapter)
508{
509 if (adapter->en_mng_pt) {
510 uint32_t manc = E1000_READ_REG(&adapter->hw, MANC);
511
512 /* re-enable hardware interception of ARP */
513 manc |= E1000_MANC_ARP_EN;
514
515 if (adapter->hw.has_manc2h)
516 manc &= ~E1000_MANC_EN_MNG2HOST;
517
518 /* don't explicitly have to mess with MANC2H since
519 * MANC has an enable disable that gates MANC2H */
520
521 E1000_WRITE_REG(&adapter->hw, MANC, manc);
522 }
523}
524
467int 525int
468e1000_up(struct e1000_adapter *adapter) 526e1000_up(struct e1000_adapter *adapter)
469{ 527{
@@ -475,6 +533,7 @@ e1000_up(struct e1000_adapter *adapter)
475 e1000_set_multi(netdev); 533 e1000_set_multi(netdev);
476 534
477 e1000_restore_vlan(adapter); 535 e1000_restore_vlan(adapter);
536 e1000_init_manageability(adapter);
478 537
479 e1000_configure_tx(adapter); 538 e1000_configure_tx(adapter);
480 e1000_setup_rctl(adapter); 539 e1000_setup_rctl(adapter);
@@ -497,7 +556,8 @@ e1000_up(struct e1000_adapter *adapter)
497 556
498 clear_bit(__E1000_DOWN, &adapter->flags); 557 clear_bit(__E1000_DOWN, &adapter->flags);
499 558
500 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 559 /* fire a link change interrupt to start the watchdog */
560 E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_LSC);
501 return 0; 561 return 0;
502} 562}
503 563
@@ -614,16 +674,34 @@ e1000_reinit_locked(struct e1000_adapter *adapter)
614void 674void
615e1000_reset(struct e1000_adapter *adapter) 675e1000_reset(struct e1000_adapter *adapter)
616{ 676{
617 uint32_t pba, manc; 677 uint32_t pba = 0, tx_space, min_tx_space, min_rx_space;
618 uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF; 678 uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
679 boolean_t legacy_pba_adjust = FALSE;
619 680
620 /* Repartition Pba for greater than 9k mtu 681 /* Repartition Pba for greater than 9k mtu
621 * To take effect CTRL.RST is required. 682 * To take effect CTRL.RST is required.
622 */ 683 */
623 684
624 switch (adapter->hw.mac_type) { 685 switch (adapter->hw.mac_type) {
686 case e1000_82542_rev2_0:
687 case e1000_82542_rev2_1:
688 case e1000_82543:
689 case e1000_82544:
690 case e1000_82540:
691 case e1000_82541:
692 case e1000_82541_rev_2:
693 legacy_pba_adjust = TRUE;
694 pba = E1000_PBA_48K;
695 break;
696 case e1000_82545:
697 case e1000_82545_rev_3:
698 case e1000_82546:
699 case e1000_82546_rev_3:
700 pba = E1000_PBA_48K;
701 break;
625 case e1000_82547: 702 case e1000_82547:
626 case e1000_82547_rev_2: 703 case e1000_82547_rev_2:
704 legacy_pba_adjust = TRUE;
627 pba = E1000_PBA_30K; 705 pba = E1000_PBA_30K;
628 break; 706 break;
629 case e1000_82571: 707 case e1000_82571:
@@ -632,27 +710,80 @@ e1000_reset(struct e1000_adapter *adapter)
632 pba = E1000_PBA_38K; 710 pba = E1000_PBA_38K;
633 break; 711 break;
634 case e1000_82573: 712 case e1000_82573:
635 pba = E1000_PBA_12K; 713 pba = E1000_PBA_20K;
636 break; 714 break;
637 case e1000_ich8lan: 715 case e1000_ich8lan:
638 pba = E1000_PBA_8K; 716 pba = E1000_PBA_8K;
639 break; 717 case e1000_undefined:
640 default: 718 case e1000_num_macs:
641 pba = E1000_PBA_48K;
642 break; 719 break;
643 } 720 }
644 721
645 if ((adapter->hw.mac_type != e1000_82573) && 722 if (legacy_pba_adjust == TRUE) {
646 (adapter->netdev->mtu > E1000_RXBUFFER_8192)) 723 if (adapter->netdev->mtu > E1000_RXBUFFER_8192)
647 pba -= 8; /* allocate more FIFO for Tx */ 724 pba -= 8; /* allocate more FIFO for Tx */
648 725
726 if (adapter->hw.mac_type == e1000_82547) {
727 adapter->tx_fifo_head = 0;
728 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
729 adapter->tx_fifo_size =
730 (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
731 atomic_set(&adapter->tx_fifo_stall, 0);
732 }
733 } else if (adapter->hw.max_frame_size > MAXIMUM_ETHERNET_FRAME_SIZE) {
734 /* adjust PBA for jumbo frames */
735 E1000_WRITE_REG(&adapter->hw, PBA, pba);
736
737 /* To maintain wire speed transmits, the Tx FIFO should be
738 * large enough to accomodate two full transmit packets,
739 * rounded up to the next 1KB and expressed in KB. Likewise,
740 * the Rx FIFO should be large enough to accomodate at least
741 * one full receive packet and is similarly rounded up and
742 * expressed in KB. */
743 pba = E1000_READ_REG(&adapter->hw, PBA);
744 /* upper 16 bits has Tx packet buffer allocation size in KB */
745 tx_space = pba >> 16;
746 /* lower 16 bits has Rx packet buffer allocation size in KB */
747 pba &= 0xffff;
748 /* don't include ethernet FCS because hardware appends/strips */
749 min_rx_space = adapter->netdev->mtu + ENET_HEADER_SIZE +
750 VLAN_TAG_SIZE;
751 min_tx_space = min_rx_space;
752 min_tx_space *= 2;
753 E1000_ROUNDUP(min_tx_space, 1024);
754 min_tx_space >>= 10;
755 E1000_ROUNDUP(min_rx_space, 1024);
756 min_rx_space >>= 10;
757
758 /* If current Tx allocation is less than the min Tx FIFO size,
759 * and the min Tx FIFO size is less than the current Rx FIFO
760 * allocation, take space away from current Rx allocation */
761 if (tx_space < min_tx_space &&
762 ((min_tx_space - tx_space) < pba)) {
763 pba = pba - (min_tx_space - tx_space);
764
765 /* PCI/PCIx hardware has PBA alignment constraints */
766 switch (adapter->hw.mac_type) {
767 case e1000_82545 ... e1000_82546_rev_3:
768 pba &= ~(E1000_PBA_8K - 1);
769 break;
770 default:
771 break;
772 }
649 773
650 if (adapter->hw.mac_type == e1000_82547) { 774 /* if short on rx space, rx wins and must trump tx
651 adapter->tx_fifo_head = 0; 775 * adjustment or use Early Receive if available */
652 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT; 776 if (pba < min_rx_space) {
653 adapter->tx_fifo_size = 777 switch (adapter->hw.mac_type) {
654 (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT; 778 case e1000_82573:
655 atomic_set(&adapter->tx_fifo_stall, 0); 779 /* ERT enabled in e1000_configure_rx */
780 break;
781 default:
782 pba = min_rx_space;
783 break;
784 }
785 }
786 }
656 } 787 }
657 788
658 E1000_WRITE_REG(&adapter->hw, PBA, pba); 789 E1000_WRITE_REG(&adapter->hw, PBA, pba);
@@ -685,6 +816,20 @@ e1000_reset(struct e1000_adapter *adapter)
685 if (e1000_init_hw(&adapter->hw)) 816 if (e1000_init_hw(&adapter->hw))
686 DPRINTK(PROBE, ERR, "Hardware Error\n"); 817 DPRINTK(PROBE, ERR, "Hardware Error\n");
687 e1000_update_mng_vlan(adapter); 818 e1000_update_mng_vlan(adapter);
819
820 /* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
821 if (adapter->hw.mac_type >= e1000_82544 &&
822 adapter->hw.mac_type <= e1000_82547_rev_2 &&
823 adapter->hw.autoneg == 1 &&
824 adapter->hw.autoneg_advertised == ADVERTISE_1000_FULL) {
825 uint32_t ctrl = E1000_READ_REG(&adapter->hw, CTRL);
826 /* clear phy power management bit if we are in gig only mode,
827 * which if enabled will attempt negotiation to 100Mb, which
828 * can cause a loss of link at power off or driver unload */
829 ctrl &= ~E1000_CTRL_SWDPIN3;
830 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
831 }
832
688 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 833 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
689 E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE); 834 E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
690 835
@@ -705,14 +850,7 @@ e1000_reset(struct e1000_adapter *adapter)
705 phy_data); 850 phy_data);
706 } 851 }
707 852
708 if ((adapter->en_mng_pt) && 853 e1000_release_manageability(adapter);
709 (adapter->hw.mac_type >= e1000_82540) &&
710 (adapter->hw.mac_type < e1000_82571) &&
711 (adapter->hw.media_type == e1000_media_type_copper)) {
712 manc = E1000_READ_REG(&adapter->hw, MANC);
713 manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
714 E1000_WRITE_REG(&adapter->hw, MANC, manc);
715 }
716} 854}
717 855
718/** 856/**
@@ -857,6 +995,12 @@ e1000_probe(struct pci_dev *pdev,
857 (adapter->hw.mac_type != e1000_82547)) 995 (adapter->hw.mac_type != e1000_82547))
858 netdev->features |= NETIF_F_TSO; 996 netdev->features |= NETIF_F_TSO;
859 997
998#ifdef CONFIG_DEBUG_SLAB
999 /* 82544's work arounds do not play nicely with DEBUG SLAB */
1000 if (adapter->hw.mac_type == e1000_82544)
1001 netdev->features &= ~NETIF_F_TSO;
1002#endif
1003
860#ifdef NETIF_F_TSO6 1004#ifdef NETIF_F_TSO6
861 if (adapter->hw.mac_type > e1000_82547_rev_2) 1005 if (adapter->hw.mac_type > e1000_82547_rev_2)
862 netdev->features |= NETIF_F_TSO6; 1006 netdev->features |= NETIF_F_TSO6;
@@ -1078,22 +1222,13 @@ e1000_remove(struct pci_dev *pdev)
1078{ 1222{
1079 struct net_device *netdev = pci_get_drvdata(pdev); 1223 struct net_device *netdev = pci_get_drvdata(pdev);
1080 struct e1000_adapter *adapter = netdev_priv(netdev); 1224 struct e1000_adapter *adapter = netdev_priv(netdev);
1081 uint32_t manc;
1082#ifdef CONFIG_E1000_NAPI 1225#ifdef CONFIG_E1000_NAPI
1083 int i; 1226 int i;
1084#endif 1227#endif
1085 1228
1086 flush_scheduled_work(); 1229 flush_scheduled_work();
1087 1230
1088 if (adapter->hw.mac_type >= e1000_82540 && 1231 e1000_release_manageability(adapter);
1089 adapter->hw.mac_type < e1000_82571 &&
1090 adapter->hw.media_type == e1000_media_type_copper) {
1091 manc = E1000_READ_REG(&adapter->hw, MANC);
1092 if (manc & E1000_MANC_SMBUS_EN) {
1093 manc |= E1000_MANC_ARP_EN;
1094 E1000_WRITE_REG(&adapter->hw, MANC, manc);
1095 }
1096 }
1097 1232
1098 /* Release control of h/w to f/w. If f/w is AMT enabled, this 1233 /* Release control of h/w to f/w. If f/w is AMT enabled, this
1099 * would have already happened in close and is redundant. */ 1234 * would have already happened in close and is redundant. */
@@ -1531,9 +1666,9 @@ e1000_configure_tx(struct e1000_adapter *adapter)
1531 } 1666 }
1532 1667
1533 /* Set the default values for the Tx Inter Packet Gap timer */ 1668 /* Set the default values for the Tx Inter Packet Gap timer */
1534 1669 if (adapter->hw.mac_type <= e1000_82547_rev_2 &&
1535 if (hw->media_type == e1000_media_type_fiber || 1670 (hw->media_type == e1000_media_type_fiber ||
1536 hw->media_type == e1000_media_type_internal_serdes) 1671 hw->media_type == e1000_media_type_internal_serdes))
1537 tipg = DEFAULT_82543_TIPG_IPGT_FIBER; 1672 tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
1538 else 1673 else
1539 tipg = DEFAULT_82543_TIPG_IPGT_COPPER; 1674 tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
@@ -2528,6 +2663,13 @@ e1000_watchdog(unsigned long data)
2528 netif_wake_queue(netdev); 2663 netif_wake_queue(netdev);
2529 mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ); 2664 mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ);
2530 adapter->smartspeed = 0; 2665 adapter->smartspeed = 0;
2666 } else {
2667 /* make sure the receive unit is started */
2668 if (adapter->hw.rx_needs_kicking) {
2669 struct e1000_hw *hw = &adapter->hw;
2670 uint32_t rctl = E1000_READ_REG(hw, RCTL);
2671 E1000_WRITE_REG(hw, RCTL, rctl | E1000_RCTL_EN);
2672 }
2531 } 2673 }
2532 } else { 2674 } else {
2533 if (netif_carrier_ok(netdev)) { 2675 if (netif_carrier_ok(netdev)) {
@@ -2628,29 +2770,34 @@ static unsigned int e1000_update_itr(struct e1000_adapter *adapter,
2628 if (packets == 0) 2770 if (packets == 0)
2629 goto update_itr_done; 2771 goto update_itr_done;
2630 2772
2631
2632 switch (itr_setting) { 2773 switch (itr_setting) {
2633 case lowest_latency: 2774 case lowest_latency:
2634 if ((packets < 5) && (bytes > 512)) 2775 /* jumbo frames get bulk treatment*/
2776 if (bytes/packets > 8000)
2777 retval = bulk_latency;
2778 else if ((packets < 5) && (bytes > 512))
2635 retval = low_latency; 2779 retval = low_latency;
2636 break; 2780 break;
2637 case low_latency: /* 50 usec aka 20000 ints/s */ 2781 case low_latency: /* 50 usec aka 20000 ints/s */
2638 if (bytes > 10000) { 2782 if (bytes > 10000) {
2639 if ((packets < 10) || 2783 /* jumbo frames need bulk latency setting */
2640 ((bytes/packets) > 1200)) 2784 if (bytes/packets > 8000)
2785 retval = bulk_latency;
2786 else if ((packets < 10) || ((bytes/packets) > 1200))
2641 retval = bulk_latency; 2787 retval = bulk_latency;
2642 else if ((packets > 35)) 2788 else if ((packets > 35))
2643 retval = lowest_latency; 2789 retval = lowest_latency;
2644 } else if (packets <= 2 && bytes < 512) 2790 } else if (bytes/packets > 2000)
2791 retval = bulk_latency;
2792 else if (packets <= 2 && bytes < 512)
2645 retval = lowest_latency; 2793 retval = lowest_latency;
2646 break; 2794 break;
2647 case bulk_latency: /* 250 usec aka 4000 ints/s */ 2795 case bulk_latency: /* 250 usec aka 4000 ints/s */
2648 if (bytes > 25000) { 2796 if (bytes > 25000) {
2649 if (packets > 35) 2797 if (packets > 35)
2650 retval = low_latency; 2798 retval = low_latency;
2651 } else { 2799 } else if (bytes < 6000) {
2652 if (bytes < 6000) 2800 retval = low_latency;
2653 retval = low_latency;
2654 } 2801 }
2655 break; 2802 break;
2656 } 2803 }
@@ -2679,17 +2826,20 @@ static void e1000_set_itr(struct e1000_adapter *adapter)
2679 adapter->tx_itr, 2826 adapter->tx_itr,
2680 adapter->total_tx_packets, 2827 adapter->total_tx_packets,
2681 adapter->total_tx_bytes); 2828 adapter->total_tx_bytes);
2829 /* conservative mode (itr 3) eliminates the lowest_latency setting */
2830 if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency)
2831 adapter->tx_itr = low_latency;
2832
2682 adapter->rx_itr = e1000_update_itr(adapter, 2833 adapter->rx_itr = e1000_update_itr(adapter,
2683 adapter->rx_itr, 2834 adapter->rx_itr,
2684 adapter->total_rx_packets, 2835 adapter->total_rx_packets,
2685 adapter->total_rx_bytes); 2836 adapter->total_rx_bytes);
2837 /* conservative mode (itr 3) eliminates the lowest_latency setting */
2838 if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency)
2839 adapter->rx_itr = low_latency;
2686 2840
2687 current_itr = max(adapter->rx_itr, adapter->tx_itr); 2841 current_itr = max(adapter->rx_itr, adapter->tx_itr);
2688 2842
2689 /* conservative mode eliminates the lowest_latency setting */
2690 if (current_itr == lowest_latency && (adapter->itr_setting == 3))
2691 current_itr = low_latency;
2692
2693 switch (current_itr) { 2843 switch (current_itr) {
2694 /* counts and packets in update_itr are dependent on these numbers */ 2844 /* counts and packets in update_itr are dependent on these numbers */
2695 case lowest_latency: 2845 case lowest_latency:
@@ -3168,6 +3318,16 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3168 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { 3318 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {
3169 switch (adapter->hw.mac_type) { 3319 switch (adapter->hw.mac_type) {
3170 unsigned int pull_size; 3320 unsigned int pull_size;
3321 case e1000_82544:
3322 /* Make sure we have room to chop off 4 bytes,
3323 * and that the end alignment will work out to
3324 * this hardware's requirements
3325 * NOTE: this is a TSO only workaround
3326 * if end byte alignment not correct move us
3327 * into the next dword */
3328 if ((unsigned long)(skb->tail - 1) & 4)
3329 break;
3330 /* fall through */
3171 case e1000_82571: 3331 case e1000_82571:
3172 case e1000_82572: 3332 case e1000_82572:
3173 case e1000_82573: 3333 case e1000_82573:
@@ -3419,12 +3579,11 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
3419 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE; 3579 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
3420 3580
3421 netdev->mtu = new_mtu; 3581 netdev->mtu = new_mtu;
3582 adapter->hw.max_frame_size = max_frame;
3422 3583
3423 if (netif_running(netdev)) 3584 if (netif_running(netdev))
3424 e1000_reinit_locked(adapter); 3585 e1000_reinit_locked(adapter);
3425 3586
3426 adapter->hw.max_frame_size = max_frame;
3427
3428 return 0; 3587 return 0;
3429} 3588}
3430 3589
@@ -3573,6 +3732,11 @@ e1000_update_stats(struct e1000_adapter *adapter)
3573 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; 3732 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
3574 adapter->net_stats.tx_window_errors = adapter->stats.latecol; 3733 adapter->net_stats.tx_window_errors = adapter->stats.latecol;
3575 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; 3734 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
3735 if (adapter->hw.bad_tx_carr_stats_fd &&
3736 adapter->link_duplex == FULL_DUPLEX) {
3737 adapter->net_stats.tx_carrier_errors = 0;
3738 adapter->stats.tncrs = 0;
3739 }
3576 3740
3577 /* Tx Dropped needs to be maintained elsewhere */ 3741 /* Tx Dropped needs to be maintained elsewhere */
3578 3742
@@ -3590,6 +3754,13 @@ e1000_update_stats(struct e1000_adapter *adapter)
3590 adapter->phy_stats.receive_errors += phy_tmp; 3754 adapter->phy_stats.receive_errors += phy_tmp;
3591 } 3755 }
3592 3756
3757 /* Management Stats */
3758 if (adapter->hw.has_smbus) {
3759 adapter->stats.mgptc += E1000_READ_REG(hw, MGTPTC);
3760 adapter->stats.mgprc += E1000_READ_REG(hw, MGTPRC);
3761 adapter->stats.mgpdc += E1000_READ_REG(hw, MGTPDC);
3762 }
3763
3593 spin_unlock_irqrestore(&adapter->stats_lock, flags); 3764 spin_unlock_irqrestore(&adapter->stats_lock, flags);
3594} 3765}
3595#ifdef CONFIG_PCI_MSI 3766#ifdef CONFIG_PCI_MSI
@@ -3868,11 +4039,11 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3868 cleaned = (i == eop); 4039 cleaned = (i == eop);
3869 4040
3870 if (cleaned) { 4041 if (cleaned) {
3871 /* this packet count is wrong for TSO but has a 4042 struct sk_buff *skb = buffer_info->skb;
3872 * tendency to make dynamic ITR change more 4043 unsigned int segs = skb_shinfo(skb)->gso_segs;
3873 * towards bulk */ 4044 total_tx_packets += segs;
3874 total_tx_packets++; 4045 total_tx_packets++;
3875 total_tx_bytes += buffer_info->skb->len; 4046 total_tx_bytes += skb->len;
3876 } 4047 }
3877 e1000_unmap_and_free_tx_resource(adapter, buffer_info); 4048 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
3878 tx_desc->upper.data = 0; 4049 tx_desc->upper.data = 0;
@@ -4094,8 +4265,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
4094 /* code added for copybreak, this should improve 4265 /* code added for copybreak, this should improve
4095 * performance for small packets with large amounts 4266 * performance for small packets with large amounts
4096 * of reassembly being done in the stack */ 4267 * of reassembly being done in the stack */
4097#define E1000_CB_LENGTH 256 4268 if (length < copybreak) {
4098 if (length < E1000_CB_LENGTH) {
4099 struct sk_buff *new_skb = 4269 struct sk_buff *new_skb =
4100 netdev_alloc_skb(netdev, length + NET_IP_ALIGN); 4270 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
4101 if (new_skb) { 4271 if (new_skb) {
@@ -4253,7 +4423,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
4253 4423
4254 /* page alloc/put takes too long and effects small packet 4424 /* page alloc/put takes too long and effects small packet
4255 * throughput, so unsplit small packets and save the alloc/put*/ 4425 * throughput, so unsplit small packets and save the alloc/put*/
4256 if (l1 && ((length + l1) <= adapter->rx_ps_bsize0)) { 4426 if (l1 && (l1 <= copybreak) && ((length + l1) <= adapter->rx_ps_bsize0)) {
4257 u8 *vaddr; 4427 u8 *vaddr;
4258 /* there is no documentation about how to call 4428 /* there is no documentation about how to call
4259 * kmap_atomic, so we can't hold the mapping 4429 * kmap_atomic, so we can't hold the mapping
@@ -4998,7 +5168,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4998{ 5168{
4999 struct net_device *netdev = pci_get_drvdata(pdev); 5169 struct net_device *netdev = pci_get_drvdata(pdev);
5000 struct e1000_adapter *adapter = netdev_priv(netdev); 5170 struct e1000_adapter *adapter = netdev_priv(netdev);
5001 uint32_t ctrl, ctrl_ext, rctl, manc, status; 5171 uint32_t ctrl, ctrl_ext, rctl, status;
5002 uint32_t wufc = adapter->wol; 5172 uint32_t wufc = adapter->wol;
5003#ifdef CONFIG_PM 5173#ifdef CONFIG_PM
5004 int retval = 0; 5174 int retval = 0;
@@ -5067,16 +5237,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5067 pci_enable_wake(pdev, PCI_D3cold, 0); 5237 pci_enable_wake(pdev, PCI_D3cold, 0);
5068 } 5238 }
5069 5239
5070 if (adapter->hw.mac_type >= e1000_82540 && 5240 e1000_release_manageability(adapter);
5071 adapter->hw.mac_type < e1000_82571 && 5241
5072 adapter->hw.media_type == e1000_media_type_copper) { 5242 /* make sure adapter isn't asleep if manageability is enabled */
5073 manc = E1000_READ_REG(&adapter->hw, MANC); 5243 if (adapter->en_mng_pt) {
5074 if (manc & E1000_MANC_SMBUS_EN) { 5244 pci_enable_wake(pdev, PCI_D3hot, 1);
5075 manc |= E1000_MANC_ARP_EN; 5245 pci_enable_wake(pdev, PCI_D3cold, 1);
5076 E1000_WRITE_REG(&adapter->hw, MANC, manc);
5077 pci_enable_wake(pdev, PCI_D3hot, 1);
5078 pci_enable_wake(pdev, PCI_D3cold, 1);
5079 }
5080 } 5246 }
5081 5247
5082 if (adapter->hw.phy_type == e1000_phy_igp_3) 5248 if (adapter->hw.phy_type == e1000_phy_igp_3)
@@ -5102,7 +5268,7 @@ e1000_resume(struct pci_dev *pdev)
5102{ 5268{
5103 struct net_device *netdev = pci_get_drvdata(pdev); 5269 struct net_device *netdev = pci_get_drvdata(pdev);
5104 struct e1000_adapter *adapter = netdev_priv(netdev); 5270 struct e1000_adapter *adapter = netdev_priv(netdev);
5105 uint32_t manc, err; 5271 uint32_t err;
5106 5272
5107 pci_set_power_state(pdev, PCI_D0); 5273 pci_set_power_state(pdev, PCI_D0);
5108 e1000_pci_restore_state(adapter); 5274 e1000_pci_restore_state(adapter);
@@ -5122,19 +5288,13 @@ e1000_resume(struct pci_dev *pdev)
5122 e1000_reset(adapter); 5288 e1000_reset(adapter);
5123 E1000_WRITE_REG(&adapter->hw, WUS, ~0); 5289 E1000_WRITE_REG(&adapter->hw, WUS, ~0);
5124 5290
5291 e1000_init_manageability(adapter);
5292
5125 if (netif_running(netdev)) 5293 if (netif_running(netdev))
5126 e1000_up(adapter); 5294 e1000_up(adapter);
5127 5295
5128 netif_device_attach(netdev); 5296 netif_device_attach(netdev);
5129 5297
5130 if (adapter->hw.mac_type >= e1000_82540 &&
5131 adapter->hw.mac_type < e1000_82571 &&
5132 adapter->hw.media_type == e1000_media_type_copper) {
5133 manc = E1000_READ_REG(&adapter->hw, MANC);
5134 manc &= ~(E1000_MANC_ARP_EN);
5135 E1000_WRITE_REG(&adapter->hw, MANC, manc);
5136 }
5137
5138 /* If the controller is 82573 and f/w is AMT, do not set 5298 /* If the controller is 82573 and f/w is AMT, do not set
5139 * DRV_LOAD until the interface is up. For all other cases, 5299 * DRV_LOAD until the interface is up. For all other cases,
5140 * let the f/w know that the h/w is now under the control 5300 * let the f/w know that the h/w is now under the control
@@ -5235,7 +5395,8 @@ static void e1000_io_resume(struct pci_dev *pdev)
5235{ 5395{
5236 struct net_device *netdev = pci_get_drvdata(pdev); 5396 struct net_device *netdev = pci_get_drvdata(pdev);
5237 struct e1000_adapter *adapter = netdev->priv; 5397 struct e1000_adapter *adapter = netdev->priv;
5238 uint32_t manc, swsm; 5398
5399 e1000_init_manageability(adapter);
5239 5400
5240 if (netif_running(netdev)) { 5401 if (netif_running(netdev)) {
5241 if (e1000_up(adapter)) { 5402 if (e1000_up(adapter)) {
@@ -5246,26 +5407,14 @@ static void e1000_io_resume(struct pci_dev *pdev)
5246 5407
5247 netif_device_attach(netdev); 5408 netif_device_attach(netdev);
5248 5409
5249 if (adapter->hw.mac_type >= e1000_82540 && 5410 /* If the controller is 82573 and f/w is AMT, do not set
5250 adapter->hw.mac_type < e1000_82571 && 5411 * DRV_LOAD until the interface is up. For all other cases,
5251 adapter->hw.media_type == e1000_media_type_copper) { 5412 * let the f/w know that the h/w is now under the control
5252 manc = E1000_READ_REG(&adapter->hw, MANC); 5413 * of the driver. */
5253 manc &= ~(E1000_MANC_ARP_EN); 5414 if (adapter->hw.mac_type != e1000_82573 ||
5254 E1000_WRITE_REG(&adapter->hw, MANC, manc); 5415 !e1000_check_mng_mode(&adapter->hw))
5255 } 5416 e1000_get_hw_control(adapter);
5256
5257 switch (adapter->hw.mac_type) {
5258 case e1000_82573:
5259 swsm = E1000_READ_REG(&adapter->hw, SWSM);
5260 E1000_WRITE_REG(&adapter->hw, SWSM,
5261 swsm | E1000_SWSM_DRV_LOAD);
5262 break;
5263 default:
5264 break;
5265 }
5266 5417
5267 if (netif_running(netdev))
5268 mod_timer(&adapter->watchdog_timer, jiffies);
5269} 5418}
5270 5419
5271/* e1000_main.c */ 5420/* e1000_main.c */