diff options
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index d266510c8a94..b81c4237b5d3 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | #include "e1000.h" | 48 | #include "e1000.h" |
49 | 49 | ||
50 | #define DRV_VERSION "0.3.3.3-k2" | 50 | #define DRV_VERSION "0.3.3.3-k6" |
51 | char e1000e_driver_name[] = "e1000e"; | 51 | char e1000e_driver_name[] = "e1000e"; |
52 | const char e1000e_driver_version[] = DRV_VERSION; | 52 | const char e1000e_driver_version[] = DRV_VERSION; |
53 | 53 | ||
@@ -1115,6 +1115,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1115 | writel(0, adapter->hw.hw_addr + rx_ring->tail); | 1115 | writel(0, adapter->hw.hw_addr + rx_ring->tail); |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | static void e1000e_downshift_workaround(struct work_struct *work) | ||
1119 | { | ||
1120 | struct e1000_adapter *adapter = container_of(work, | ||
1121 | struct e1000_adapter, downshift_task); | ||
1122 | |||
1123 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); | ||
1124 | } | ||
1125 | |||
1118 | /** | 1126 | /** |
1119 | * e1000_intr_msi - Interrupt Handler | 1127 | * e1000_intr_msi - Interrupt Handler |
1120 | * @irq: interrupt number | 1128 | * @irq: interrupt number |
@@ -1139,7 +1147,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) | |||
1139 | */ | 1147 | */ |
1140 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && | 1148 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
1141 | (!(er32(STATUS) & E1000_STATUS_LU))) | 1149 | (!(er32(STATUS) & E1000_STATUS_LU))) |
1142 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1150 | schedule_work(&adapter->downshift_task); |
1143 | 1151 | ||
1144 | /* | 1152 | /* |
1145 | * 80003ES2LAN workaround-- For packet buffer work-around on | 1153 | * 80003ES2LAN workaround-- For packet buffer work-around on |
@@ -1205,7 +1213,7 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
1205 | */ | 1213 | */ |
1206 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && | 1214 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
1207 | (!(er32(STATUS) & E1000_STATUS_LU))) | 1215 | (!(er32(STATUS) & E1000_STATUS_LU))) |
1208 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1216 | schedule_work(&adapter->downshift_task); |
1209 | 1217 | ||
1210 | /* | 1218 | /* |
1211 | * 80003ES2LAN workaround-- | 1219 | * 80003ES2LAN workaround-- |
@@ -2592,8 +2600,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
2592 | /* Explicitly disable IRQ since the NIC can be in any state. */ | 2600 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
2593 | e1000_irq_disable(adapter); | 2601 | e1000_irq_disable(adapter); |
2594 | 2602 | ||
2595 | spin_lock_init(&adapter->stats_lock); | ||
2596 | |||
2597 | set_bit(__E1000_DOWN, &adapter->state); | 2603 | set_bit(__E1000_DOWN, &adapter->state); |
2598 | return 0; | 2604 | return 0; |
2599 | 2605 | ||
@@ -2912,6 +2918,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p) | |||
2912 | return 0; | 2918 | return 0; |
2913 | } | 2919 | } |
2914 | 2920 | ||
2921 | /** | ||
2922 | * e1000e_update_phy_task - work thread to update phy | ||
2923 | * @work: pointer to our work struct | ||
2924 | * | ||
2925 | * this worker thread exists because we must acquire a | ||
2926 | * semaphore to read the phy, which we could msleep while | ||
2927 | * waiting for it, and we can't msleep in a timer. | ||
2928 | **/ | ||
2929 | static void e1000e_update_phy_task(struct work_struct *work) | ||
2930 | { | ||
2931 | struct e1000_adapter *adapter = container_of(work, | ||
2932 | struct e1000_adapter, update_phy_task); | ||
2933 | e1000_get_phy_info(&adapter->hw); | ||
2934 | } | ||
2935 | |||
2915 | /* | 2936 | /* |
2916 | * Need to wait a few seconds after link up to get diagnostic information from | 2937 | * Need to wait a few seconds after link up to get diagnostic information from |
2917 | * the phy | 2938 | * the phy |
@@ -2919,7 +2940,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p) | |||
2919 | static void e1000_update_phy_info(unsigned long data) | 2940 | static void e1000_update_phy_info(unsigned long data) |
2920 | { | 2941 | { |
2921 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 2942 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
2922 | e1000_get_phy_info(&adapter->hw); | 2943 | schedule_work(&adapter->update_phy_task); |
2923 | } | 2944 | } |
2924 | 2945 | ||
2925 | /** | 2946 | /** |
@@ -2930,10 +2951,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
2930 | { | 2951 | { |
2931 | struct e1000_hw *hw = &adapter->hw; | 2952 | struct e1000_hw *hw = &adapter->hw; |
2932 | struct pci_dev *pdev = adapter->pdev; | 2953 | struct pci_dev *pdev = adapter->pdev; |
2933 | unsigned long irq_flags; | ||
2934 | u16 phy_tmp; | ||
2935 | |||
2936 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF | ||
2937 | 2954 | ||
2938 | /* | 2955 | /* |
2939 | * Prevent stats update while adapter is being reset, or if the pci | 2956 | * Prevent stats update while adapter is being reset, or if the pci |
@@ -2944,14 +2961,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
2944 | if (pci_channel_offline(pdev)) | 2961 | if (pci_channel_offline(pdev)) |
2945 | return; | 2962 | return; |
2946 | 2963 | ||
2947 | spin_lock_irqsave(&adapter->stats_lock, irq_flags); | ||
2948 | |||
2949 | /* | ||
2950 | * these counters are modified from e1000_adjust_tbi_stats, | ||
2951 | * called from the interrupt context, so they must only | ||
2952 | * be written while holding adapter->stats_lock | ||
2953 | */ | ||
2954 | |||
2955 | adapter->stats.crcerrs += er32(CRCERRS); | 2964 | adapter->stats.crcerrs += er32(CRCERRS); |
2956 | adapter->stats.gprc += er32(GPRC); | 2965 | adapter->stats.gprc += er32(GPRC); |
2957 | adapter->stats.gorc += er32(GORCL); | 2966 | adapter->stats.gorc += er32(GORCL); |
@@ -3022,21 +3031,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3022 | 3031 | ||
3023 | /* Tx Dropped needs to be maintained elsewhere */ | 3032 | /* Tx Dropped needs to be maintained elsewhere */ |
3024 | 3033 | ||
3025 | /* Phy Stats */ | ||
3026 | if (hw->phy.media_type == e1000_media_type_copper) { | ||
3027 | if ((adapter->link_speed == SPEED_1000) && | ||
3028 | (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) { | ||
3029 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; | ||
3030 | adapter->phy_stats.idle_errors += phy_tmp; | ||
3031 | } | ||
3032 | } | ||
3033 | |||
3034 | /* Management Stats */ | 3034 | /* Management Stats */ |
3035 | adapter->stats.mgptc += er32(MGTPTC); | 3035 | adapter->stats.mgptc += er32(MGTPTC); |
3036 | adapter->stats.mgprc += er32(MGTPRC); | 3036 | adapter->stats.mgprc += er32(MGTPRC); |
3037 | adapter->stats.mgpdc += er32(MGTPDC); | 3037 | adapter->stats.mgpdc += er32(MGTPDC); |
3038 | |||
3039 | spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); | ||
3040 | } | 3038 | } |
3041 | 3039 | ||
3042 | /** | 3040 | /** |
@@ -3048,10 +3046,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
3048 | struct e1000_hw *hw = &adapter->hw; | 3046 | struct e1000_hw *hw = &adapter->hw; |
3049 | struct e1000_phy_regs *phy = &adapter->phy_regs; | 3047 | struct e1000_phy_regs *phy = &adapter->phy_regs; |
3050 | int ret_val; | 3048 | int ret_val; |
3051 | unsigned long irq_flags; | ||
3052 | |||
3053 | |||
3054 | spin_lock_irqsave(&adapter->stats_lock, irq_flags); | ||
3055 | 3049 | ||
3056 | if ((er32(STATUS) & E1000_STATUS_LU) && | 3050 | if ((er32(STATUS) & E1000_STATUS_LU) && |
3057 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 3051 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
@@ -3082,8 +3076,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
3082 | phy->stat1000 = 0; | 3076 | phy->stat1000 = 0; |
3083 | phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); | 3077 | phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); |
3084 | } | 3078 | } |
3085 | |||
3086 | spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); | ||
3087 | } | 3079 | } |
3088 | 3080 | ||
3089 | static void e1000_print_link_info(struct e1000_adapter *adapter) | 3081 | static void e1000_print_link_info(struct e1000_adapter *adapter) |
@@ -4467,6 +4459,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4467 | 4459 | ||
4468 | adapter->bd_number = cards_found++; | 4460 | adapter->bd_number = cards_found++; |
4469 | 4461 | ||
4462 | e1000e_check_options(adapter); | ||
4463 | |||
4470 | /* setup adapter struct */ | 4464 | /* setup adapter struct */ |
4471 | err = e1000_sw_init(adapter); | 4465 | err = e1000_sw_init(adapter); |
4472 | if (err) | 4466 | if (err) |
@@ -4482,6 +4476,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4482 | if (err) | 4476 | if (err) |
4483 | goto err_hw_init; | 4477 | goto err_hw_init; |
4484 | 4478 | ||
4479 | if ((adapter->flags & FLAG_IS_ICH) && | ||
4480 | (adapter->flags & FLAG_READ_ONLY_NVM)) | ||
4481 | e1000e_write_protect_nvm_ich8lan(&adapter->hw); | ||
4482 | |||
4485 | hw->mac.ops.get_bus_info(&adapter->hw); | 4483 | hw->mac.ops.get_bus_info(&adapter->hw); |
4486 | 4484 | ||
4487 | adapter->hw.phy.autoneg_wait_to_complete = 0; | 4485 | adapter->hw.phy.autoneg_wait_to_complete = 0; |
@@ -4572,8 +4570,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4572 | 4570 | ||
4573 | INIT_WORK(&adapter->reset_task, e1000_reset_task); | 4571 | INIT_WORK(&adapter->reset_task, e1000_reset_task); |
4574 | INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); | 4572 | INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); |
4575 | 4573 | INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); | |
4576 | e1000e_check_options(adapter); | 4574 | INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); |
4577 | 4575 | ||
4578 | /* Initialize link parameters. User can change them with ethtool */ | 4576 | /* Initialize link parameters. User can change them with ethtool */ |
4579 | adapter->hw.mac.autoneg = 1; | 4577 | adapter->hw.mac.autoneg = 1; |