diff options
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000.h | 4 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 131 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 23 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.h | 1 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 111 |
5 files changed, 173 insertions, 97 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index af1e82c5b808..092757bc721f 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -140,7 +140,7 @@ struct e1000_adapter; | |||
140 | #define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */ | 140 | #define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */ |
141 | 141 | ||
142 | #define AUTO_ALL_MODES 0 | 142 | #define AUTO_ALL_MODES 0 |
143 | #define E1000_EEPROM_82544_APM 0x0400 | 143 | #define E1000_EEPROM_82544_APM 0x0004 |
144 | #define E1000_EEPROM_APME 0x0400 | 144 | #define E1000_EEPROM_APME 0x0400 |
145 | 145 | ||
146 | #ifndef E1000_MASTER_SLAVE | 146 | #ifndef E1000_MASTER_SLAVE |
@@ -159,7 +159,7 @@ struct e1000_adapter; | |||
159 | * so a DMA handle can be stored along with the buffer */ | 159 | * so a DMA handle can be stored along with the buffer */ |
160 | struct e1000_buffer { | 160 | struct e1000_buffer { |
161 | struct sk_buff *skb; | 161 | struct sk_buff *skb; |
162 | uint64_t dma; | 162 | dma_addr_t dma; |
163 | unsigned long time_stamp; | 163 | unsigned long time_stamp; |
164 | uint16_t length; | 164 | uint16_t length; |
165 | uint16_t next_to_watch; | 165 | uint16_t next_to_watch; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 237247f74df4..f133ff0b0b94 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -105,7 +105,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { | |||
105 | static int | 105 | static int |
106 | e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 106 | e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
107 | { | 107 | { |
108 | struct e1000_adapter *adapter = netdev->priv; | 108 | struct e1000_adapter *adapter = netdev_priv(netdev); |
109 | struct e1000_hw *hw = &adapter->hw; | 109 | struct e1000_hw *hw = &adapter->hw; |
110 | 110 | ||
111 | if(hw->media_type == e1000_media_type_copper) { | 111 | if(hw->media_type == e1000_media_type_copper) { |
@@ -141,9 +141,9 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
141 | SUPPORTED_FIBRE | | 141 | SUPPORTED_FIBRE | |
142 | SUPPORTED_Autoneg); | 142 | SUPPORTED_Autoneg); |
143 | 143 | ||
144 | ecmd->advertising = (SUPPORTED_1000baseT_Full | | 144 | ecmd->advertising = (ADVERTISED_1000baseT_Full | |
145 | SUPPORTED_FIBRE | | 145 | ADVERTISED_FIBRE | |
146 | SUPPORTED_Autoneg); | 146 | ADVERTISED_Autoneg); |
147 | 147 | ||
148 | ecmd->port = PORT_FIBRE; | 148 | ecmd->port = PORT_FIBRE; |
149 | 149 | ||
@@ -179,13 +179,24 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
179 | static int | 179 | static int |
180 | e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 180 | e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
181 | { | 181 | { |
182 | struct e1000_adapter *adapter = netdev->priv; | 182 | struct e1000_adapter *adapter = netdev_priv(netdev); |
183 | struct e1000_hw *hw = &adapter->hw; | 183 | struct e1000_hw *hw = &adapter->hw; |
184 | 184 | ||
185 | if(ecmd->autoneg == AUTONEG_ENABLE) { | 185 | if(ecmd->autoneg == AUTONEG_ENABLE) { |
186 | hw->autoneg = 1; | 186 | hw->autoneg = 1; |
187 | hw->autoneg_advertised = 0x002F; | 187 | if(hw->media_type == e1000_media_type_fiber) |
188 | ecmd->advertising = 0x002F; | 188 | hw->autoneg_advertised = ADVERTISED_1000baseT_Full | |
189 | ADVERTISED_FIBRE | | ||
190 | ADVERTISED_Autoneg; | ||
191 | else | ||
192 | hw->autoneg_advertised = ADVERTISED_10baseT_Half | | ||
193 | ADVERTISED_10baseT_Full | | ||
194 | ADVERTISED_100baseT_Half | | ||
195 | ADVERTISED_100baseT_Full | | ||
196 | ADVERTISED_1000baseT_Full| | ||
197 | ADVERTISED_Autoneg | | ||
198 | ADVERTISED_TP; | ||
199 | ecmd->advertising = hw->autoneg_advertised; | ||
189 | } else | 200 | } else |
190 | if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) | 201 | if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) |
191 | return -EINVAL; | 202 | return -EINVAL; |
@@ -206,7 +217,7 @@ static void | |||
206 | e1000_get_pauseparam(struct net_device *netdev, | 217 | e1000_get_pauseparam(struct net_device *netdev, |
207 | struct ethtool_pauseparam *pause) | 218 | struct ethtool_pauseparam *pause) |
208 | { | 219 | { |
209 | struct e1000_adapter *adapter = netdev->priv; | 220 | struct e1000_adapter *adapter = netdev_priv(netdev); |
210 | struct e1000_hw *hw = &adapter->hw; | 221 | struct e1000_hw *hw = &adapter->hw; |
211 | 222 | ||
212 | pause->autoneg = | 223 | pause->autoneg = |
@@ -226,7 +237,7 @@ static int | |||
226 | e1000_set_pauseparam(struct net_device *netdev, | 237 | e1000_set_pauseparam(struct net_device *netdev, |
227 | struct ethtool_pauseparam *pause) | 238 | struct ethtool_pauseparam *pause) |
228 | { | 239 | { |
229 | struct e1000_adapter *adapter = netdev->priv; | 240 | struct e1000_adapter *adapter = netdev_priv(netdev); |
230 | struct e1000_hw *hw = &adapter->hw; | 241 | struct e1000_hw *hw = &adapter->hw; |
231 | 242 | ||
232 | adapter->fc_autoneg = pause->autoneg; | 243 | adapter->fc_autoneg = pause->autoneg; |
@@ -259,14 +270,14 @@ e1000_set_pauseparam(struct net_device *netdev, | |||
259 | static uint32_t | 270 | static uint32_t |
260 | e1000_get_rx_csum(struct net_device *netdev) | 271 | e1000_get_rx_csum(struct net_device *netdev) |
261 | { | 272 | { |
262 | struct e1000_adapter *adapter = netdev->priv; | 273 | struct e1000_adapter *adapter = netdev_priv(netdev); |
263 | return adapter->rx_csum; | 274 | return adapter->rx_csum; |
264 | } | 275 | } |
265 | 276 | ||
266 | static int | 277 | static int |
267 | e1000_set_rx_csum(struct net_device *netdev, uint32_t data) | 278 | e1000_set_rx_csum(struct net_device *netdev, uint32_t data) |
268 | { | 279 | { |
269 | struct e1000_adapter *adapter = netdev->priv; | 280 | struct e1000_adapter *adapter = netdev_priv(netdev); |
270 | adapter->rx_csum = data; | 281 | adapter->rx_csum = data; |
271 | 282 | ||
272 | if(netif_running(netdev)) { | 283 | if(netif_running(netdev)) { |
@@ -286,7 +297,7 @@ e1000_get_tx_csum(struct net_device *netdev) | |||
286 | static int | 297 | static int |
287 | e1000_set_tx_csum(struct net_device *netdev, uint32_t data) | 298 | e1000_set_tx_csum(struct net_device *netdev, uint32_t data) |
288 | { | 299 | { |
289 | struct e1000_adapter *adapter = netdev->priv; | 300 | struct e1000_adapter *adapter = netdev_priv(netdev); |
290 | 301 | ||
291 | if(adapter->hw.mac_type < e1000_82543) { | 302 | if(adapter->hw.mac_type < e1000_82543) { |
292 | if (!data) | 303 | if (!data) |
@@ -306,8 +317,8 @@ e1000_set_tx_csum(struct net_device *netdev, uint32_t data) | |||
306 | static int | 317 | static int |
307 | e1000_set_tso(struct net_device *netdev, uint32_t data) | 318 | e1000_set_tso(struct net_device *netdev, uint32_t data) |
308 | { | 319 | { |
309 | struct e1000_adapter *adapter = netdev->priv; | 320 | struct e1000_adapter *adapter = netdev_priv(netdev); |
310 | if ((adapter->hw.mac_type < e1000_82544) || | 321 | if((adapter->hw.mac_type < e1000_82544) || |
311 | (adapter->hw.mac_type == e1000_82547)) | 322 | (adapter->hw.mac_type == e1000_82547)) |
312 | return data ? -EINVAL : 0; | 323 | return data ? -EINVAL : 0; |
313 | 324 | ||
@@ -322,14 +333,14 @@ e1000_set_tso(struct net_device *netdev, uint32_t data) | |||
322 | static uint32_t | 333 | static uint32_t |
323 | e1000_get_msglevel(struct net_device *netdev) | 334 | e1000_get_msglevel(struct net_device *netdev) |
324 | { | 335 | { |
325 | struct e1000_adapter *adapter = netdev->priv; | 336 | struct e1000_adapter *adapter = netdev_priv(netdev); |
326 | return adapter->msg_enable; | 337 | return adapter->msg_enable; |
327 | } | 338 | } |
328 | 339 | ||
329 | static void | 340 | static void |
330 | e1000_set_msglevel(struct net_device *netdev, uint32_t data) | 341 | e1000_set_msglevel(struct net_device *netdev, uint32_t data) |
331 | { | 342 | { |
332 | struct e1000_adapter *adapter = netdev->priv; | 343 | struct e1000_adapter *adapter = netdev_priv(netdev); |
333 | adapter->msg_enable = data; | 344 | adapter->msg_enable = data; |
334 | } | 345 | } |
335 | 346 | ||
@@ -344,7 +355,7 @@ static void | |||
344 | e1000_get_regs(struct net_device *netdev, | 355 | e1000_get_regs(struct net_device *netdev, |
345 | struct ethtool_regs *regs, void *p) | 356 | struct ethtool_regs *regs, void *p) |
346 | { | 357 | { |
347 | struct e1000_adapter *adapter = netdev->priv; | 358 | struct e1000_adapter *adapter = netdev_priv(netdev); |
348 | struct e1000_hw *hw = &adapter->hw; | 359 | struct e1000_hw *hw = &adapter->hw; |
349 | uint32_t *regs_buff = p; | 360 | uint32_t *regs_buff = p; |
350 | uint16_t phy_data; | 361 | uint16_t phy_data; |
@@ -432,7 +443,7 @@ e1000_get_regs(struct net_device *netdev, | |||
432 | static int | 443 | static int |
433 | e1000_get_eeprom_len(struct net_device *netdev) | 444 | e1000_get_eeprom_len(struct net_device *netdev) |
434 | { | 445 | { |
435 | struct e1000_adapter *adapter = netdev->priv; | 446 | struct e1000_adapter *adapter = netdev_priv(netdev); |
436 | return adapter->hw.eeprom.word_size * 2; | 447 | return adapter->hw.eeprom.word_size * 2; |
437 | } | 448 | } |
438 | 449 | ||
@@ -440,7 +451,7 @@ static int | |||
440 | e1000_get_eeprom(struct net_device *netdev, | 451 | e1000_get_eeprom(struct net_device *netdev, |
441 | struct ethtool_eeprom *eeprom, uint8_t *bytes) | 452 | struct ethtool_eeprom *eeprom, uint8_t *bytes) |
442 | { | 453 | { |
443 | struct e1000_adapter *adapter = netdev->priv; | 454 | struct e1000_adapter *adapter = netdev_priv(netdev); |
444 | struct e1000_hw *hw = &adapter->hw; | 455 | struct e1000_hw *hw = &adapter->hw; |
445 | uint16_t *eeprom_buff; | 456 | uint16_t *eeprom_buff; |
446 | int first_word, last_word; | 457 | int first_word, last_word; |
@@ -486,7 +497,7 @@ static int | |||
486 | e1000_set_eeprom(struct net_device *netdev, | 497 | e1000_set_eeprom(struct net_device *netdev, |
487 | struct ethtool_eeprom *eeprom, uint8_t *bytes) | 498 | struct ethtool_eeprom *eeprom, uint8_t *bytes) |
488 | { | 499 | { |
489 | struct e1000_adapter *adapter = netdev->priv; | 500 | struct e1000_adapter *adapter = netdev_priv(netdev); |
490 | struct e1000_hw *hw = &adapter->hw; | 501 | struct e1000_hw *hw = &adapter->hw; |
491 | uint16_t *eeprom_buff; | 502 | uint16_t *eeprom_buff; |
492 | void *ptr; | 503 | void *ptr; |
@@ -547,7 +558,7 @@ static void | |||
547 | e1000_get_drvinfo(struct net_device *netdev, | 558 | e1000_get_drvinfo(struct net_device *netdev, |
548 | struct ethtool_drvinfo *drvinfo) | 559 | struct ethtool_drvinfo *drvinfo) |
549 | { | 560 | { |
550 | struct e1000_adapter *adapter = netdev->priv; | 561 | struct e1000_adapter *adapter = netdev_priv(netdev); |
551 | 562 | ||
552 | strncpy(drvinfo->driver, e1000_driver_name, 32); | 563 | strncpy(drvinfo->driver, e1000_driver_name, 32); |
553 | strncpy(drvinfo->version, e1000_driver_version, 32); | 564 | strncpy(drvinfo->version, e1000_driver_version, 32); |
@@ -563,7 +574,7 @@ static void | |||
563 | e1000_get_ringparam(struct net_device *netdev, | 574 | e1000_get_ringparam(struct net_device *netdev, |
564 | struct ethtool_ringparam *ring) | 575 | struct ethtool_ringparam *ring) |
565 | { | 576 | { |
566 | struct e1000_adapter *adapter = netdev->priv; | 577 | struct e1000_adapter *adapter = netdev_priv(netdev); |
567 | e1000_mac_type mac_type = adapter->hw.mac_type; | 578 | e1000_mac_type mac_type = adapter->hw.mac_type; |
568 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 579 | struct e1000_desc_ring *txdr = &adapter->tx_ring; |
569 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 580 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; |
@@ -584,7 +595,7 @@ static int | |||
584 | e1000_set_ringparam(struct net_device *netdev, | 595 | e1000_set_ringparam(struct net_device *netdev, |
585 | struct ethtool_ringparam *ring) | 596 | struct ethtool_ringparam *ring) |
586 | { | 597 | { |
587 | struct e1000_adapter *adapter = netdev->priv; | 598 | struct e1000_adapter *adapter = netdev_priv(netdev); |
588 | e1000_mac_type mac_type = adapter->hw.mac_type; | 599 | e1000_mac_type mac_type = adapter->hw.mac_type; |
589 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 600 | struct e1000_desc_ring *txdr = &adapter->tx_ring; |
590 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 601 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; |
@@ -651,6 +662,9 @@ err_setup_rx: | |||
651 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ | 662 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ |
652 | value = E1000_READ_REG(&adapter->hw, R); \ | 663 | value = E1000_READ_REG(&adapter->hw, R); \ |
653 | if(value != (test[pat] & W & M)) { \ | 664 | if(value != (test[pat] & W & M)) { \ |
665 | DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ | ||
666 | "0x%08X expected 0x%08X\n", \ | ||
667 | E1000_##R, value, (test[pat] & W & M)); \ | ||
654 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 668 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
655 | E1000_82542_##R : E1000_##R; \ | 669 | E1000_82542_##R : E1000_##R; \ |
656 | return 1; \ | 670 | return 1; \ |
@@ -663,7 +677,9 @@ err_setup_rx: | |||
663 | uint32_t value; \ | 677 | uint32_t value; \ |
664 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ | 678 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ |
665 | value = E1000_READ_REG(&adapter->hw, R); \ | 679 | value = E1000_READ_REG(&adapter->hw, R); \ |
666 | if ((W & M) != (value & M)) { \ | 680 | if((W & M) != (value & M)) { \ |
681 | DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ | ||
682 | "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ | ||
667 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 683 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
668 | E1000_82542_##R : E1000_##R; \ | 684 | E1000_82542_##R : E1000_##R; \ |
669 | return 1; \ | 685 | return 1; \ |
@@ -673,18 +689,33 @@ err_setup_rx: | |||
673 | static int | 689 | static int |
674 | e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | 690 | e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) |
675 | { | 691 | { |
676 | uint32_t value; | 692 | uint32_t value, before, after; |
677 | uint32_t i; | 693 | uint32_t i, toggle; |
678 | 694 | ||
679 | /* The status register is Read Only, so a write should fail. | 695 | /* The status register is Read Only, so a write should fail. |
680 | * Some bits that get toggled are ignored. | 696 | * Some bits that get toggled are ignored. |
681 | */ | 697 | */ |
682 | value = (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833)); | 698 | switch (adapter->hw.mac_type) { |
683 | E1000_WRITE_REG(&adapter->hw, STATUS, (0xFFFFFFFF)); | 699 | case e1000_82573: |
684 | if(value != (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833))) { | 700 | toggle = 0x7FFFF033; |
701 | break; | ||
702 | default: | ||
703 | toggle = 0xFFFFF833; | ||
704 | break; | ||
705 | } | ||
706 | |||
707 | before = E1000_READ_REG(&adapter->hw, STATUS); | ||
708 | value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); | ||
709 | E1000_WRITE_REG(&adapter->hw, STATUS, toggle); | ||
710 | after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; | ||
711 | if(value != after) { | ||
712 | DPRINTK(DRV, ERR, "failed STATUS register test got: " | ||
713 | "0x%08X expected: 0x%08X\n", after, value); | ||
685 | *data = 1; | 714 | *data = 1; |
686 | return 1; | 715 | return 1; |
687 | } | 716 | } |
717 | /* restore previous status */ | ||
718 | E1000_WRITE_REG(&adapter->hw, STATUS, before); | ||
688 | 719 | ||
689 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); | 720 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
690 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); | 721 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); |
@@ -766,7 +797,7 @@ e1000_test_intr(int irq, | |||
766 | struct pt_regs *regs) | 797 | struct pt_regs *regs) |
767 | { | 798 | { |
768 | struct net_device *netdev = (struct net_device *) data; | 799 | struct net_device *netdev = (struct net_device *) data; |
769 | struct e1000_adapter *adapter = netdev->priv; | 800 | struct e1000_adapter *adapter = netdev_priv(netdev); |
770 | 801 | ||
771 | adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR); | 802 | adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR); |
772 | 803 | ||
@@ -1214,6 +1245,7 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1214 | case e1000_82541_rev_2: | 1245 | case e1000_82541_rev_2: |
1215 | case e1000_82547: | 1246 | case e1000_82547: |
1216 | case e1000_82547_rev_2: | 1247 | case e1000_82547_rev_2: |
1248 | case e1000_82573: | ||
1217 | return e1000_integrated_phy_loopback(adapter); | 1249 | return e1000_integrated_phy_loopback(adapter); |
1218 | break; | 1250 | break; |
1219 | 1251 | ||
@@ -1422,7 +1454,7 @@ static void | |||
1422 | e1000_diag_test(struct net_device *netdev, | 1454 | e1000_diag_test(struct net_device *netdev, |
1423 | struct ethtool_test *eth_test, uint64_t *data) | 1455 | struct ethtool_test *eth_test, uint64_t *data) |
1424 | { | 1456 | { |
1425 | struct e1000_adapter *adapter = netdev->priv; | 1457 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1426 | boolean_t if_running = netif_running(netdev); | 1458 | boolean_t if_running = netif_running(netdev); |
1427 | 1459 | ||
1428 | if(eth_test->flags == ETH_TEST_FL_OFFLINE) { | 1460 | if(eth_test->flags == ETH_TEST_FL_OFFLINE) { |
@@ -1482,7 +1514,7 @@ e1000_diag_test(struct net_device *netdev, | |||
1482 | static void | 1514 | static void |
1483 | e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | 1515 | e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
1484 | { | 1516 | { |
1485 | struct e1000_adapter *adapter = netdev->priv; | 1517 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1486 | struct e1000_hw *hw = &adapter->hw; | 1518 | struct e1000_hw *hw = &adapter->hw; |
1487 | 1519 | ||
1488 | switch(adapter->hw.device_id) { | 1520 | switch(adapter->hw.device_id) { |
@@ -1527,7 +1559,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1527 | static int | 1559 | static int |
1528 | e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | 1560 | e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
1529 | { | 1561 | { |
1530 | struct e1000_adapter *adapter = netdev->priv; | 1562 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1531 | struct e1000_hw *hw = &adapter->hw; | 1563 | struct e1000_hw *hw = &adapter->hw; |
1532 | 1564 | ||
1533 | switch(adapter->hw.device_id) { | 1565 | switch(adapter->hw.device_id) { |
@@ -1588,22 +1620,31 @@ e1000_led_blink_callback(unsigned long data) | |||
1588 | static int | 1620 | static int |
1589 | e1000_phys_id(struct net_device *netdev, uint32_t data) | 1621 | e1000_phys_id(struct net_device *netdev, uint32_t data) |
1590 | { | 1622 | { |
1591 | struct e1000_adapter *adapter = netdev->priv; | 1623 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1592 | 1624 | ||
1593 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1625 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) |
1594 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 1626 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); |
1595 | 1627 | ||
1596 | if(!adapter->blink_timer.function) { | 1628 | if(adapter->hw.mac_type < e1000_82573) { |
1597 | init_timer(&adapter->blink_timer); | 1629 | if(!adapter->blink_timer.function) { |
1598 | adapter->blink_timer.function = e1000_led_blink_callback; | 1630 | init_timer(&adapter->blink_timer); |
1599 | adapter->blink_timer.data = (unsigned long) adapter; | 1631 | adapter->blink_timer.function = e1000_led_blink_callback; |
1632 | adapter->blink_timer.data = (unsigned long) adapter; | ||
1633 | } | ||
1634 | e1000_setup_led(&adapter->hw); | ||
1635 | mod_timer(&adapter->blink_timer, jiffies); | ||
1636 | msleep_interruptible(data * 1000); | ||
1637 | del_timer_sync(&adapter->blink_timer); | ||
1638 | } | ||
1639 | else { | ||
1640 | E1000_WRITE_REG(&adapter->hw, LEDCTL, (E1000_LEDCTL_LED2_BLINK_RATE | | ||
1641 | E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK | | ||
1642 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | | ||
1643 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) | | ||
1644 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT))); | ||
1645 | msleep_interruptible(data * 1000); | ||
1600 | } | 1646 | } |
1601 | 1647 | ||
1602 | e1000_setup_led(&adapter->hw); | ||
1603 | mod_timer(&adapter->blink_timer, jiffies); | ||
1604 | |||
1605 | msleep_interruptible(data * 1000); | ||
1606 | del_timer_sync(&adapter->blink_timer); | ||
1607 | e1000_led_off(&adapter->hw); | 1648 | e1000_led_off(&adapter->hw); |
1608 | clear_bit(E1000_LED_ON, &adapter->led_status); | 1649 | clear_bit(E1000_LED_ON, &adapter->led_status); |
1609 | e1000_cleanup_led(&adapter->hw); | 1650 | e1000_cleanup_led(&adapter->hw); |
@@ -1614,7 +1655,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1614 | static int | 1655 | static int |
1615 | e1000_nway_reset(struct net_device *netdev) | 1656 | e1000_nway_reset(struct net_device *netdev) |
1616 | { | 1657 | { |
1617 | struct e1000_adapter *adapter = netdev->priv; | 1658 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1618 | if(netif_running(netdev)) { | 1659 | if(netif_running(netdev)) { |
1619 | e1000_down(adapter); | 1660 | e1000_down(adapter); |
1620 | e1000_up(adapter); | 1661 | e1000_up(adapter); |
@@ -1632,7 +1673,7 @@ static void | |||
1632 | e1000_get_ethtool_stats(struct net_device *netdev, | 1673 | e1000_get_ethtool_stats(struct net_device *netdev, |
1633 | struct ethtool_stats *stats, uint64_t *data) | 1674 | struct ethtool_stats *stats, uint64_t *data) |
1634 | { | 1675 | { |
1635 | struct e1000_adapter *adapter = netdev->priv; | 1676 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1636 | int i; | 1677 | int i; |
1637 | 1678 | ||
1638 | e1000_update_stats(adapter); | 1679 | e1000_update_stats(adapter); |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 723589b28be5..045f5426ab9a 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -354,18 +354,27 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
354 | hw->media_type = e1000_media_type_internal_serdes; | 354 | hw->media_type = e1000_media_type_internal_serdes; |
355 | break; | 355 | break; |
356 | default: | 356 | default: |
357 | if(hw->mac_type >= e1000_82543) { | 357 | switch (hw->mac_type) { |
358 | case e1000_82542_rev2_0: | ||
359 | case e1000_82542_rev2_1: | ||
360 | hw->media_type = e1000_media_type_fiber; | ||
361 | break; | ||
362 | case e1000_82573: | ||
363 | /* The STATUS_TBIMODE bit is reserved or reused for the this | ||
364 | * device. | ||
365 | */ | ||
366 | hw->media_type = e1000_media_type_copper; | ||
367 | break; | ||
368 | default: | ||
358 | status = E1000_READ_REG(hw, STATUS); | 369 | status = E1000_READ_REG(hw, STATUS); |
359 | if(status & E1000_STATUS_TBIMODE) { | 370 | if (status & E1000_STATUS_TBIMODE) { |
360 | hw->media_type = e1000_media_type_fiber; | 371 | hw->media_type = e1000_media_type_fiber; |
361 | /* tbi_compatibility not valid on fiber */ | 372 | /* tbi_compatibility not valid on fiber */ |
362 | hw->tbi_compatibility_en = FALSE; | 373 | hw->tbi_compatibility_en = FALSE; |
363 | } else { | 374 | } else { |
364 | hw->media_type = e1000_media_type_copper; | 375 | hw->media_type = e1000_media_type_copper; |
365 | } | 376 | } |
366 | } else { | 377 | break; |
367 | /* This is an 82542 (fiber only) */ | ||
368 | hw->media_type = e1000_media_type_fiber; | ||
369 | } | 378 | } |
370 | } | 379 | } |
371 | } | 380 | } |
@@ -1189,9 +1198,9 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1189 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); | 1198 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
1190 | if(ret_val) | 1199 | if(ret_val) |
1191 | return ret_val; | 1200 | return ret_val; |
1192 | } | 1201 | } |
1193 | 1202 | ||
1194 | return E1000_SUCCESS; | 1203 | return E1000_SUCCESS; |
1195 | } | 1204 | } |
1196 | 1205 | ||
1197 | 1206 | ||
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index a0263ee96c6b..93e9f8788751 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -66,6 +66,7 @@ typedef enum { | |||
66 | e1000_eeprom_spi, | 66 | e1000_eeprom_spi, |
67 | e1000_eeprom_microwire, | 67 | e1000_eeprom_microwire, |
68 | e1000_eeprom_flash, | 68 | e1000_eeprom_flash, |
69 | e1000_eeprom_none, /* No NVM support */ | ||
69 | e1000_num_eeprom_types | 70 | e1000_num_eeprom_types |
70 | } e1000_eeprom_type; | 71 | } e1000_eeprom_type; |
71 | 72 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 137226d98d47..cb7f051a60ad 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "e1000.h" | 29 | #include "e1000.h" |
30 | 30 | ||
31 | /* Change Log | 31 | /* Change Log |
32 | * 6.0.58 4/20/05 | ||
33 | * o Accepted ethtool cleanup patch from Stephen Hemminger | ||
32 | * 6.0.44+ 2/15/05 | 34 | * 6.0.44+ 2/15/05 |
33 | * o applied Anton's patch to resolve tx hang in hardware | 35 | * o applied Anton's patch to resolve tx hang in hardware |
34 | * o Applied Andrew Mortons patch - e1000 stops working after resume | 36 | * o Applied Andrew Mortons patch - e1000 stops working after resume |
@@ -41,9 +43,9 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
41 | #else | 43 | #else |
42 | #define DRIVERNAPI "-NAPI" | 44 | #define DRIVERNAPI "-NAPI" |
43 | #endif | 45 | #endif |
44 | #define DRV_VERSION "6.0.54-k2"DRIVERNAPI | 46 | #define DRV_VERSION "6.0.60-k2"DRIVERNAPI |
45 | char e1000_driver_version[] = DRV_VERSION; | 47 | char e1000_driver_version[] = DRV_VERSION; |
46 | char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; | 48 | char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; |
47 | 49 | ||
48 | /* e1000_pci_tbl - PCI Device ID Table | 50 | /* e1000_pci_tbl - PCI Device ID Table |
49 | * | 51 | * |
@@ -517,7 +519,7 @@ e1000_probe(struct pci_dev *pdev, | |||
517 | SET_NETDEV_DEV(netdev, &pdev->dev); | 519 | SET_NETDEV_DEV(netdev, &pdev->dev); |
518 | 520 | ||
519 | pci_set_drvdata(pdev, netdev); | 521 | pci_set_drvdata(pdev, netdev); |
520 | adapter = netdev->priv; | 522 | adapter = netdev_priv(netdev); |
521 | adapter->netdev = netdev; | 523 | adapter->netdev = netdev; |
522 | adapter->pdev = pdev; | 524 | adapter->pdev = pdev; |
523 | adapter->hw.back = adapter; | 525 | adapter->hw.back = adapter; |
@@ -738,7 +740,7 @@ static void __devexit | |||
738 | e1000_remove(struct pci_dev *pdev) | 740 | e1000_remove(struct pci_dev *pdev) |
739 | { | 741 | { |
740 | struct net_device *netdev = pci_get_drvdata(pdev); | 742 | struct net_device *netdev = pci_get_drvdata(pdev); |
741 | struct e1000_adapter *adapter = netdev->priv; | 743 | struct e1000_adapter *adapter = netdev_priv(netdev); |
742 | uint32_t manc, swsm; | 744 | uint32_t manc, swsm; |
743 | 745 | ||
744 | flush_scheduled_work(); | 746 | flush_scheduled_work(); |
@@ -871,7 +873,7 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
871 | static int | 873 | static int |
872 | e1000_open(struct net_device *netdev) | 874 | e1000_open(struct net_device *netdev) |
873 | { | 875 | { |
874 | struct e1000_adapter *adapter = netdev->priv; | 876 | struct e1000_adapter *adapter = netdev_priv(netdev); |
875 | int err; | 877 | int err; |
876 | 878 | ||
877 | /* allocate transmit descriptors */ | 879 | /* allocate transmit descriptors */ |
@@ -919,7 +921,7 @@ err_setup_tx: | |||
919 | static int | 921 | static int |
920 | e1000_close(struct net_device *netdev) | 922 | e1000_close(struct net_device *netdev) |
921 | { | 923 | { |
922 | struct e1000_adapter *adapter = netdev->priv; | 924 | struct e1000_adapter *adapter = netdev_priv(netdev); |
923 | 925 | ||
924 | e1000_down(adapter); | 926 | e1000_down(adapter); |
925 | 927 | ||
@@ -1599,7 +1601,7 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter) | |||
1599 | static int | 1601 | static int |
1600 | e1000_set_mac(struct net_device *netdev, void *p) | 1602 | e1000_set_mac(struct net_device *netdev, void *p) |
1601 | { | 1603 | { |
1602 | struct e1000_adapter *adapter = netdev->priv; | 1604 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1603 | struct sockaddr *addr = p; | 1605 | struct sockaddr *addr = p; |
1604 | 1606 | ||
1605 | if(!is_valid_ether_addr(addr->sa_data)) | 1607 | if(!is_valid_ether_addr(addr->sa_data)) |
@@ -1634,7 +1636,7 @@ e1000_set_mac(struct net_device *netdev, void *p) | |||
1634 | static void | 1636 | static void |
1635 | e1000_set_multi(struct net_device *netdev) | 1637 | e1000_set_multi(struct net_device *netdev) |
1636 | { | 1638 | { |
1637 | struct e1000_adapter *adapter = netdev->priv; | 1639 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1638 | struct e1000_hw *hw = &adapter->hw; | 1640 | struct e1000_hw *hw = &adapter->hw; |
1639 | struct dev_mc_list *mc_ptr; | 1641 | struct dev_mc_list *mc_ptr; |
1640 | unsigned long flags; | 1642 | unsigned long flags; |
@@ -2213,7 +2215,7 @@ e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
2213 | static int | 2215 | static int |
2214 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 2216 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
2215 | { | 2217 | { |
2216 | struct e1000_adapter *adapter = netdev->priv; | 2218 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2217 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; | 2219 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; |
2218 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; | 2220 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; |
2219 | unsigned int tx_flags = 0; | 2221 | unsigned int tx_flags = 0; |
@@ -2344,7 +2346,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2344 | static void | 2346 | static void |
2345 | e1000_tx_timeout(struct net_device *netdev) | 2347 | e1000_tx_timeout(struct net_device *netdev) |
2346 | { | 2348 | { |
2347 | struct e1000_adapter *adapter = netdev->priv; | 2349 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2348 | 2350 | ||
2349 | /* Do the reset outside of interrupt context */ | 2351 | /* Do the reset outside of interrupt context */ |
2350 | schedule_work(&adapter->tx_timeout_task); | 2352 | schedule_work(&adapter->tx_timeout_task); |
@@ -2353,7 +2355,7 @@ e1000_tx_timeout(struct net_device *netdev) | |||
2353 | static void | 2355 | static void |
2354 | e1000_tx_timeout_task(struct net_device *netdev) | 2356 | e1000_tx_timeout_task(struct net_device *netdev) |
2355 | { | 2357 | { |
2356 | struct e1000_adapter *adapter = netdev->priv; | 2358 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2357 | 2359 | ||
2358 | e1000_down(adapter); | 2360 | e1000_down(adapter); |
2359 | e1000_up(adapter); | 2361 | e1000_up(adapter); |
@@ -2370,7 +2372,7 @@ e1000_tx_timeout_task(struct net_device *netdev) | |||
2370 | static struct net_device_stats * | 2372 | static struct net_device_stats * |
2371 | e1000_get_stats(struct net_device *netdev) | 2373 | e1000_get_stats(struct net_device *netdev) |
2372 | { | 2374 | { |
2373 | struct e1000_adapter *adapter = netdev->priv; | 2375 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2374 | 2376 | ||
2375 | e1000_update_stats(adapter); | 2377 | e1000_update_stats(adapter); |
2376 | return &adapter->net_stats; | 2378 | return &adapter->net_stats; |
@@ -2387,7 +2389,7 @@ e1000_get_stats(struct net_device *netdev) | |||
2387 | static int | 2389 | static int |
2388 | e1000_change_mtu(struct net_device *netdev, int new_mtu) | 2390 | e1000_change_mtu(struct net_device *netdev, int new_mtu) |
2389 | { | 2391 | { |
2390 | struct e1000_adapter *adapter = netdev->priv; | 2392 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2391 | int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; | 2393 | int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; |
2392 | 2394 | ||
2393 | if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || | 2395 | if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || |
@@ -2598,7 +2600,7 @@ static irqreturn_t | |||
2598 | e1000_intr(int irq, void *data, struct pt_regs *regs) | 2600 | e1000_intr(int irq, void *data, struct pt_regs *regs) |
2599 | { | 2601 | { |
2600 | struct net_device *netdev = data; | 2602 | struct net_device *netdev = data; |
2601 | struct e1000_adapter *adapter = netdev->priv; | 2603 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2602 | struct e1000_hw *hw = &adapter->hw; | 2604 | struct e1000_hw *hw = &adapter->hw; |
2603 | uint32_t icr = E1000_READ_REG(hw, ICR); | 2605 | uint32_t icr = E1000_READ_REG(hw, ICR); |
2604 | #ifndef CONFIG_E1000_NAPI | 2606 | #ifndef CONFIG_E1000_NAPI |
@@ -2661,7 +2663,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2661 | static int | 2663 | static int |
2662 | e1000_clean(struct net_device *netdev, int *budget) | 2664 | e1000_clean(struct net_device *netdev, int *budget) |
2663 | { | 2665 | { |
2664 | struct e1000_adapter *adapter = netdev->priv; | 2666 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2665 | int work_to_do = min(*budget, netdev->quota); | 2667 | int work_to_do = min(*budget, netdev->quota); |
2666 | int tx_cleaned; | 2668 | int tx_cleaned; |
2667 | int work_done = 0; | 2669 | int work_done = 0; |
@@ -2672,8 +2674,8 @@ e1000_clean(struct net_device *netdev, int *budget) | |||
2672 | *budget -= work_done; | 2674 | *budget -= work_done; |
2673 | netdev->quota -= work_done; | 2675 | netdev->quota -= work_done; |
2674 | 2676 | ||
2675 | /* If no Tx and no Rx work done, exit the polling mode */ | ||
2676 | if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | 2677 | if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { |
2678 | /* If no Tx and not enough Rx work done, exit the polling mode */ | ||
2677 | netif_rx_complete(netdev); | 2679 | netif_rx_complete(netdev); |
2678 | e1000_irq_enable(adapter); | 2680 | e1000_irq_enable(adapter); |
2679 | return 0; | 2681 | return 0; |
@@ -2769,13 +2771,13 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2769 | i = tx_ring->next_to_clean; | 2771 | i = tx_ring->next_to_clean; |
2770 | eop = tx_ring->buffer_info[i].next_to_watch; | 2772 | eop = tx_ring->buffer_info[i].next_to_watch; |
2771 | eop_desc = E1000_TX_DESC(*tx_ring, eop); | 2773 | eop_desc = E1000_TX_DESC(*tx_ring, eop); |
2772 | DPRINTK(TX_ERR, ERR, "Detected Tx Unit Hang\n" | 2774 | DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n" |
2773 | " TDH <%x>\n" | 2775 | " TDH <%x>\n" |
2774 | " TDT <%x>\n" | 2776 | " TDT <%x>\n" |
2775 | " next_to_use <%x>\n" | 2777 | " next_to_use <%x>\n" |
2776 | " next_to_clean <%x>\n" | 2778 | " next_to_clean <%x>\n" |
2777 | "buffer_info[next_to_clean]\n" | 2779 | "buffer_info[next_to_clean]\n" |
2778 | " dma <%llx>\n" | 2780 | " dma <%zx>\n" |
2779 | " time_stamp <%lx>\n" | 2781 | " time_stamp <%lx>\n" |
2780 | " next_to_watch <%x>\n" | 2782 | " next_to_watch <%x>\n" |
2781 | " jiffies <%lx>\n" | 2783 | " jiffies <%lx>\n" |
@@ -2994,7 +2996,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
2994 | 2996 | ||
2995 | i = rx_ring->next_to_clean; | 2997 | i = rx_ring->next_to_clean; |
2996 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 2998 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
2997 | staterr = rx_desc->wb.middle.status_error; | 2999 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
2998 | 3000 | ||
2999 | while(staterr & E1000_RXD_STAT_DD) { | 3001 | while(staterr & E1000_RXD_STAT_DD) { |
3000 | buffer_info = &rx_ring->buffer_info[i]; | 3002 | buffer_info = &rx_ring->buffer_info[i]; |
@@ -3065,16 +3067,16 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3065 | #ifdef CONFIG_E1000_NAPI | 3067 | #ifdef CONFIG_E1000_NAPI |
3066 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { | 3068 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
3067 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, | 3069 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
3068 | le16_to_cpu(rx_desc->wb.middle.vlan & | 3070 | le16_to_cpu(rx_desc->wb.middle.vlan) & |
3069 | E1000_RXD_SPC_VLAN_MASK)); | 3071 | E1000_RXD_SPC_VLAN_MASK); |
3070 | } else { | 3072 | } else { |
3071 | netif_receive_skb(skb); | 3073 | netif_receive_skb(skb); |
3072 | } | 3074 | } |
3073 | #else /* CONFIG_E1000_NAPI */ | 3075 | #else /* CONFIG_E1000_NAPI */ |
3074 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { | 3076 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
3075 | vlan_hwaccel_rx(skb, adapter->vlgrp, | 3077 | vlan_hwaccel_rx(skb, adapter->vlgrp, |
3076 | le16_to_cpu(rx_desc->wb.middle.vlan & | 3078 | le16_to_cpu(rx_desc->wb.middle.vlan) & |
3077 | E1000_RXD_SPC_VLAN_MASK)); | 3079 | E1000_RXD_SPC_VLAN_MASK); |
3078 | } else { | 3080 | } else { |
3079 | netif_rx(skb); | 3081 | netif_rx(skb); |
3080 | } | 3082 | } |
@@ -3087,7 +3089,7 @@ next_desc: | |||
3087 | if(unlikely(++i == rx_ring->count)) i = 0; | 3089 | if(unlikely(++i == rx_ring->count)) i = 0; |
3088 | 3090 | ||
3089 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 3091 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
3090 | staterr = rx_desc->wb.middle.status_error; | 3092 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
3091 | } | 3093 | } |
3092 | rx_ring->next_to_clean = i; | 3094 | rx_ring->next_to_clean = i; |
3093 | adapter->alloc_rx_buf(adapter); | 3095 | adapter->alloc_rx_buf(adapter); |
@@ -3371,11 +3373,12 @@ e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
3371 | static int | 3373 | static int |
3372 | e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | 3374 | e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
3373 | { | 3375 | { |
3374 | struct e1000_adapter *adapter = netdev->priv; | 3376 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3375 | struct mii_ioctl_data *data = if_mii(ifr); | 3377 | struct mii_ioctl_data *data = if_mii(ifr); |
3376 | int retval; | 3378 | int retval; |
3377 | uint16_t mii_reg; | 3379 | uint16_t mii_reg; |
3378 | uint16_t spddplx; | 3380 | uint16_t spddplx; |
3381 | unsigned long flags; | ||
3379 | 3382 | ||
3380 | if(adapter->hw.media_type != e1000_media_type_copper) | 3383 | if(adapter->hw.media_type != e1000_media_type_copper) |
3381 | return -EOPNOTSUPP; | 3384 | return -EOPNOTSUPP; |
@@ -3385,22 +3388,29 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
3385 | data->phy_id = adapter->hw.phy_addr; | 3388 | data->phy_id = adapter->hw.phy_addr; |
3386 | break; | 3389 | break; |
3387 | case SIOCGMIIREG: | 3390 | case SIOCGMIIREG: |
3388 | if (!capable(CAP_NET_ADMIN)) | 3391 | if(!capable(CAP_NET_ADMIN)) |
3389 | return -EPERM; | 3392 | return -EPERM; |
3390 | if (e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, | 3393 | spin_lock_irqsave(&adapter->stats_lock, flags); |
3391 | &data->val_out)) | 3394 | if(e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, |
3395 | &data->val_out)) { | ||
3396 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
3392 | return -EIO; | 3397 | return -EIO; |
3398 | } | ||
3399 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
3393 | break; | 3400 | break; |
3394 | case SIOCSMIIREG: | 3401 | case SIOCSMIIREG: |
3395 | if (!capable(CAP_NET_ADMIN)) | 3402 | if(!capable(CAP_NET_ADMIN)) |
3396 | return -EPERM; | 3403 | return -EPERM; |
3397 | if (data->reg_num & ~(0x1F)) | 3404 | if(data->reg_num & ~(0x1F)) |
3398 | return -EFAULT; | 3405 | return -EFAULT; |
3399 | mii_reg = data->val_in; | 3406 | mii_reg = data->val_in; |
3400 | if (e1000_write_phy_reg(&adapter->hw, data->reg_num, | 3407 | spin_lock_irqsave(&adapter->stats_lock, flags); |
3401 | mii_reg)) | 3408 | if(e1000_write_phy_reg(&adapter->hw, data->reg_num, |
3409 | mii_reg)) { | ||
3410 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
3402 | return -EIO; | 3411 | return -EIO; |
3403 | if (adapter->hw.phy_type == e1000_phy_m88) { | 3412 | } |
3413 | if(adapter->hw.phy_type == e1000_phy_m88) { | ||
3404 | switch (data->reg_num) { | 3414 | switch (data->reg_num) { |
3405 | case PHY_CTRL: | 3415 | case PHY_CTRL: |
3406 | if(mii_reg & MII_CR_POWER_DOWN) | 3416 | if(mii_reg & MII_CR_POWER_DOWN) |
@@ -3420,8 +3430,12 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
3420 | HALF_DUPLEX; | 3430 | HALF_DUPLEX; |
3421 | retval = e1000_set_spd_dplx(adapter, | 3431 | retval = e1000_set_spd_dplx(adapter, |
3422 | spddplx); | 3432 | spddplx); |
3423 | if(retval) | 3433 | if(retval) { |
3434 | spin_unlock_irqrestore( | ||
3435 | &adapter->stats_lock, | ||
3436 | flags); | ||
3424 | return retval; | 3437 | return retval; |
3438 | } | ||
3425 | } | 3439 | } |
3426 | if(netif_running(adapter->netdev)) { | 3440 | if(netif_running(adapter->netdev)) { |
3427 | e1000_down(adapter); | 3441 | e1000_down(adapter); |
@@ -3431,8 +3445,11 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
3431 | break; | 3445 | break; |
3432 | case M88E1000_PHY_SPEC_CTRL: | 3446 | case M88E1000_PHY_SPEC_CTRL: |
3433 | case M88E1000_EXT_PHY_SPEC_CTRL: | 3447 | case M88E1000_EXT_PHY_SPEC_CTRL: |
3434 | if (e1000_phy_reset(&adapter->hw)) | 3448 | if(e1000_phy_reset(&adapter->hw)) { |
3449 | spin_unlock_irqrestore( | ||
3450 | &adapter->stats_lock, flags); | ||
3435 | return -EIO; | 3451 | return -EIO; |
3452 | } | ||
3436 | break; | 3453 | break; |
3437 | } | 3454 | } |
3438 | } else { | 3455 | } else { |
@@ -3448,6 +3465,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
3448 | break; | 3465 | break; |
3449 | } | 3466 | } |
3450 | } | 3467 | } |
3468 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
3451 | break; | 3469 | break; |
3452 | default: | 3470 | default: |
3453 | return -EOPNOTSUPP; | 3471 | return -EOPNOTSUPP; |
@@ -3504,7 +3522,7 @@ e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) | |||
3504 | static void | 3522 | static void |
3505 | e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | 3523 | e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) |
3506 | { | 3524 | { |
3507 | struct e1000_adapter *adapter = netdev->priv; | 3525 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3508 | uint32_t ctrl, rctl; | 3526 | uint32_t ctrl, rctl; |
3509 | 3527 | ||
3510 | e1000_irq_disable(adapter); | 3528 | e1000_irq_disable(adapter); |
@@ -3544,7 +3562,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
3544 | static void | 3562 | static void |
3545 | e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) | 3563 | e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) |
3546 | { | 3564 | { |
3547 | struct e1000_adapter *adapter = netdev->priv; | 3565 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3548 | uint32_t vfta, index; | 3566 | uint32_t vfta, index; |
3549 | if((adapter->hw.mng_cookie.status & | 3567 | if((adapter->hw.mng_cookie.status & |
3550 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && | 3568 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && |
@@ -3560,7 +3578,7 @@ e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) | |||
3560 | static void | 3578 | static void |
3561 | e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) | 3579 | e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) |
3562 | { | 3580 | { |
3563 | struct e1000_adapter *adapter = netdev->priv; | 3581 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3564 | uint32_t vfta, index; | 3582 | uint32_t vfta, index; |
3565 | 3583 | ||
3566 | e1000_irq_disable(adapter); | 3584 | e1000_irq_disable(adapter); |
@@ -3601,6 +3619,13 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) | |||
3601 | { | 3619 | { |
3602 | adapter->hw.autoneg = 0; | 3620 | adapter->hw.autoneg = 0; |
3603 | 3621 | ||
3622 | /* Fiber NICs only allow 1000 gbps Full duplex */ | ||
3623 | if((adapter->hw.media_type == e1000_media_type_fiber) && | ||
3624 | spddplx != (SPEED_1000 + DUPLEX_FULL)) { | ||
3625 | DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); | ||
3626 | return -EINVAL; | ||
3627 | } | ||
3628 | |||
3604 | switch(spddplx) { | 3629 | switch(spddplx) { |
3605 | case SPEED_10 + DUPLEX_HALF: | 3630 | case SPEED_10 + DUPLEX_HALF: |
3606 | adapter->hw.forced_speed_duplex = e1000_10_half; | 3631 | adapter->hw.forced_speed_duplex = e1000_10_half; |
@@ -3647,7 +3672,7 @@ static int | |||
3647 | e1000_suspend(struct pci_dev *pdev, uint32_t state) | 3672 | e1000_suspend(struct pci_dev *pdev, uint32_t state) |
3648 | { | 3673 | { |
3649 | struct net_device *netdev = pci_get_drvdata(pdev); | 3674 | struct net_device *netdev = pci_get_drvdata(pdev); |
3650 | struct e1000_adapter *adapter = netdev->priv; | 3675 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3651 | uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm; | 3676 | uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm; |
3652 | uint32_t wufc = adapter->wol; | 3677 | uint32_t wufc = adapter->wol; |
3653 | 3678 | ||
@@ -3740,12 +3765,12 @@ static int | |||
3740 | e1000_resume(struct pci_dev *pdev) | 3765 | e1000_resume(struct pci_dev *pdev) |
3741 | { | 3766 | { |
3742 | struct net_device *netdev = pci_get_drvdata(pdev); | 3767 | struct net_device *netdev = pci_get_drvdata(pdev); |
3743 | struct e1000_adapter *adapter = netdev->priv; | 3768 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3744 | uint32_t manc, ret, swsm; | 3769 | uint32_t manc, ret_val, swsm; |
3745 | 3770 | ||
3746 | pci_set_power_state(pdev, 0); | 3771 | pci_set_power_state(pdev, 0); |
3747 | pci_restore_state(pdev); | 3772 | pci_restore_state(pdev); |
3748 | ret = pci_enable_device(pdev); | 3773 | ret_val = pci_enable_device(pdev); |
3749 | pci_set_master(pdev); | 3774 | pci_set_master(pdev); |
3750 | 3775 | ||
3751 | pci_enable_wake(pdev, 3, 0); | 3776 | pci_enable_wake(pdev, 3, 0); |
@@ -3788,7 +3813,7 @@ e1000_resume(struct pci_dev *pdev) | |||
3788 | static void | 3813 | static void |
3789 | e1000_netpoll(struct net_device *netdev) | 3814 | e1000_netpoll(struct net_device *netdev) |
3790 | { | 3815 | { |
3791 | struct e1000_adapter *adapter = netdev->priv; | 3816 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3792 | disable_irq(adapter->pdev->irq); | 3817 | disable_irq(adapter->pdev->irq); |
3793 | e1000_intr(adapter->pdev->irq, netdev, NULL); | 3818 | e1000_intr(adapter->pdev->irq, netdev, NULL); |
3794 | enable_irq(adapter->pdev->irq); | 3819 | enable_irq(adapter->pdev->irq); |