aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/netdev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-08 17:56:41 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-08 17:56:41 -0400
commit4dd565134ece7e5d528d4c5288879310c54419e9 (patch)
treee08910d2d0feae0c030f8f01acc9b03eb760ad9a /drivers/net/e1000e/netdev.c
parent071d7ab6649eb34a873a53e71635186e9117101d (diff)
parent69849375d6b13e94d08cdc94b49b11fbab454a0e (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/e1000e/ich8lan.c drivers/net/e1000e/netdev.c
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r--drivers/net/e1000e/netdev.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 24d05cb7005..1b72749979c 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"
51char e1000e_driver_name[] = "e1000e"; 51char e1000e_driver_name[] = "e1000e";
52const char e1000e_driver_version[] = DRV_VERSION; 52const char e1000e_driver_version[] = DRV_VERSION;
53 53
@@ -1117,6 +1117,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1117 writel(0, adapter->hw.hw_addr + rx_ring->tail); 1117 writel(0, adapter->hw.hw_addr + rx_ring->tail);
1118} 1118}
1119 1119
1120static void e1000e_downshift_workaround(struct work_struct *work)
1121{
1122 struct e1000_adapter *adapter = container_of(work,
1123 struct e1000_adapter, downshift_task);
1124
1125 e1000e_gig_downshift_workaround_ich8lan(&adapter->hw);
1126}
1127
1120/** 1128/**
1121 * e1000_intr_msi - Interrupt Handler 1129 * e1000_intr_msi - Interrupt Handler
1122 * @irq: interrupt number 1130 * @irq: interrupt number
@@ -1141,7 +1149,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
1141 */ 1149 */
1142 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1150 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
1143 (!(er32(STATUS) & E1000_STATUS_LU))) 1151 (!(er32(STATUS) & E1000_STATUS_LU)))
1144 e1000e_gig_downshift_workaround_ich8lan(hw); 1152 schedule_work(&adapter->downshift_task);
1145 1153
1146 /* 1154 /*
1147 * 80003ES2LAN workaround-- For packet buffer work-around on 1155 * 80003ES2LAN workaround-- For packet buffer work-around on
@@ -1207,7 +1215,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
1207 */ 1215 */
1208 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1216 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
1209 (!(er32(STATUS) & E1000_STATUS_LU))) 1217 (!(er32(STATUS) & E1000_STATUS_LU)))
1210 e1000e_gig_downshift_workaround_ich8lan(hw); 1218 schedule_work(&adapter->downshift_task);
1211 1219
1212 /* 1220 /*
1213 * 80003ES2LAN workaround-- 1221 * 80003ES2LAN workaround--
@@ -2905,8 +2913,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
2905 /* Explicitly disable IRQ since the NIC can be in any state. */ 2913 /* Explicitly disable IRQ since the NIC can be in any state. */
2906 e1000_irq_disable(adapter); 2914 e1000_irq_disable(adapter);
2907 2915
2908 spin_lock_init(&adapter->stats_lock);
2909
2910 set_bit(__E1000_DOWN, &adapter->state); 2916 set_bit(__E1000_DOWN, &adapter->state);
2911 return 0; 2917 return 0;
2912} 2918}
@@ -3221,6 +3227,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
3221 return 0; 3227 return 0;
3222} 3228}
3223 3229
3230/**
3231 * e1000e_update_phy_task - work thread to update phy
3232 * @work: pointer to our work struct
3233 *
3234 * this worker thread exists because we must acquire a
3235 * semaphore to read the phy, which we could msleep while
3236 * waiting for it, and we can't msleep in a timer.
3237 **/
3238static void e1000e_update_phy_task(struct work_struct *work)
3239{
3240 struct e1000_adapter *adapter = container_of(work,
3241 struct e1000_adapter, update_phy_task);
3242 e1000_get_phy_info(&adapter->hw);
3243}
3244
3224/* 3245/*
3225 * Need to wait a few seconds after link up to get diagnostic information from 3246 * Need to wait a few seconds after link up to get diagnostic information from
3226 * the phy 3247 * the phy
@@ -3228,7 +3249,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
3228static void e1000_update_phy_info(unsigned long data) 3249static void e1000_update_phy_info(unsigned long data)
3229{ 3250{
3230 struct e1000_adapter *adapter = (struct e1000_adapter *) data; 3251 struct e1000_adapter *adapter = (struct e1000_adapter *) data;
3231 e1000_get_phy_info(&adapter->hw); 3252 schedule_work(&adapter->update_phy_task);
3232} 3253}
3233 3254
3234/** 3255/**
@@ -3239,10 +3260,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3239{ 3260{
3240 struct e1000_hw *hw = &adapter->hw; 3261 struct e1000_hw *hw = &adapter->hw;
3241 struct pci_dev *pdev = adapter->pdev; 3262 struct pci_dev *pdev = adapter->pdev;
3242 unsigned long irq_flags;
3243 u16 phy_tmp;
3244
3245#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
3246 3263
3247 /* 3264 /*
3248 * Prevent stats update while adapter is being reset, or if the pci 3265 * Prevent stats update while adapter is being reset, or if the pci
@@ -3253,14 +3270,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3253 if (pci_channel_offline(pdev)) 3270 if (pci_channel_offline(pdev))
3254 return; 3271 return;
3255 3272
3256 spin_lock_irqsave(&adapter->stats_lock, irq_flags);
3257
3258 /*
3259 * these counters are modified from e1000_adjust_tbi_stats,
3260 * called from the interrupt context, so they must only
3261 * be written while holding adapter->stats_lock
3262 */
3263
3264 adapter->stats.crcerrs += er32(CRCERRS); 3273 adapter->stats.crcerrs += er32(CRCERRS);
3265 adapter->stats.gprc += er32(GPRC); 3274 adapter->stats.gprc += er32(GPRC);
3266 adapter->stats.gorc += er32(GORCL); 3275 adapter->stats.gorc += er32(GORCL);
@@ -3332,21 +3341,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3332 3341
3333 /* Tx Dropped needs to be maintained elsewhere */ 3342 /* Tx Dropped needs to be maintained elsewhere */
3334 3343
3335 /* Phy Stats */
3336 if (hw->phy.media_type == e1000_media_type_copper) {
3337 if ((adapter->link_speed == SPEED_1000) &&
3338 (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) {
3339 phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
3340 adapter->phy_stats.idle_errors += phy_tmp;
3341 }
3342 }
3343
3344 /* Management Stats */ 3344 /* Management Stats */
3345 adapter->stats.mgptc += er32(MGTPTC); 3345 adapter->stats.mgptc += er32(MGTPTC);
3346 adapter->stats.mgprc += er32(MGTPRC); 3346 adapter->stats.mgprc += er32(MGTPRC);
3347 adapter->stats.mgpdc += er32(MGTPDC); 3347 adapter->stats.mgpdc += er32(MGTPDC);
3348
3349 spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
3350} 3348}
3351 3349
3352/** 3350/**
@@ -3358,10 +3356,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
3358 struct e1000_hw *hw = &adapter->hw; 3356 struct e1000_hw *hw = &adapter->hw;
3359 struct e1000_phy_regs *phy = &adapter->phy_regs; 3357 struct e1000_phy_regs *phy = &adapter->phy_regs;
3360 int ret_val; 3358 int ret_val;
3361 unsigned long irq_flags;
3362
3363
3364 spin_lock_irqsave(&adapter->stats_lock, irq_flags);
3365 3359
3366 if ((er32(STATUS) & E1000_STATUS_LU) && 3360 if ((er32(STATUS) & E1000_STATUS_LU) &&
3367 (adapter->hw.phy.media_type == e1000_media_type_copper)) { 3361 (adapter->hw.phy.media_type == e1000_media_type_copper)) {
@@ -3392,8 +3386,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
3392 phy->stat1000 = 0; 3386 phy->stat1000 = 0;
3393 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); 3387 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF);
3394 } 3388 }
3395
3396 spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
3397} 3389}
3398 3390
3399static void e1000_print_link_info(struct e1000_adapter *adapter) 3391static void e1000_print_link_info(struct e1000_adapter *adapter)
@@ -4822,6 +4814,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4822 if (err) 4814 if (err)
4823 goto err_hw_init; 4815 goto err_hw_init;
4824 4816
4817 if ((adapter->flags & FLAG_IS_ICH) &&
4818 (adapter->flags & FLAG_READ_ONLY_NVM))
4819 e1000e_write_protect_nvm_ich8lan(&adapter->hw);
4820
4825 hw->mac.ops.get_bus_info(&adapter->hw); 4821 hw->mac.ops.get_bus_info(&adapter->hw);
4826 4822
4827 adapter->hw.phy.autoneg_wait_to_complete = 0; 4823 adapter->hw.phy.autoneg_wait_to_complete = 0;
@@ -4912,6 +4908,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4912 4908
4913 INIT_WORK(&adapter->reset_task, e1000_reset_task); 4909 INIT_WORK(&adapter->reset_task, e1000_reset_task);
4914 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); 4910 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
4911 INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
4912 INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
4915 4913
4916 /* Initialize link parameters. User can change them with ethtool */ 4914 /* Initialize link parameters. User can change them with ethtool */
4917 adapter->hw.mac.autoneg = 1; 4915 adapter->hw.mac.autoneg = 1;