aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
authorAuke Kok <auke\-jan.h.kok@intel.com>2006-11-01 11:47:30 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-02 00:11:58 -0500
commit90fb51358a264f2f7e0cabdca6fc229bbc40cd91 (patch)
treed473bdee8cc4588eb610c596e14effd329e86fe4 /drivers/net/e1000/e1000_main.c
parenta362bf57aa12835e4fa6af6960e5135b5626bc5b (diff)
e1000: whitespace changes, comments, typos
Small whitespace changes, comment changes, typo fixes. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 726ec5e88ab2..7b1c092d921c 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -375,7 +375,7 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
375 * e1000_release_hw_control resets {CTRL_EXT|FWSM}:DRV_LOAD bit. 375 * e1000_release_hw_control resets {CTRL_EXT|FWSM}:DRV_LOAD bit.
376 * For ASF and Pass Through versions of f/w this means that the 376 * For ASF and Pass Through versions of f/w this means that the
377 * driver is no longer loaded. For AMT version (only with 82573) i 377 * driver is no longer loaded. For AMT version (only with 82573) i
378 * of the f/w this means that the netowrk i/f is closed. 378 * of the f/w this means that the network i/f is closed.
379 * 379 *
380 **/ 380 **/
381 381
@@ -416,7 +416,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter)
416 * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit. 416 * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit.
417 * For ASF and Pass Through versions of f/w this means that 417 * For ASF and Pass Through versions of f/w this means that
418 * the driver is loaded. For AMT version (only with 82573) 418 * the driver is loaded. For AMT version (only with 82573)
419 * of the f/w this means that the netowrk i/f is open. 419 * of the f/w this means that the network i/f is open.
420 * 420 *
421 **/ 421 **/
422 422
@@ -426,6 +426,7 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
426 uint32_t ctrl_ext; 426 uint32_t ctrl_ext;
427 uint32_t swsm; 427 uint32_t swsm;
428 uint32_t extcnf; 428 uint32_t extcnf;
429
429 /* Let firmware know the driver has taken over */ 430 /* Let firmware know the driver has taken over */
430 switch (adapter->hw.mac_type) { 431 switch (adapter->hw.mac_type) {
431 case e1000_82571: 432 case e1000_82571:
@@ -1279,12 +1280,10 @@ e1000_open(struct net_device *netdev)
1279 return -EBUSY; 1280 return -EBUSY;
1280 1281
1281 /* allocate transmit descriptors */ 1282 /* allocate transmit descriptors */
1282
1283 if ((err = e1000_setup_all_tx_resources(adapter))) 1283 if ((err = e1000_setup_all_tx_resources(adapter)))
1284 goto err_setup_tx; 1284 goto err_setup_tx;
1285 1285
1286 /* allocate receive descriptors */ 1286 /* allocate receive descriptors */
1287
1288 if ((err = e1000_setup_all_rx_resources(adapter))) 1287 if ((err = e1000_setup_all_rx_resources(adapter)))
1289 goto err_setup_rx; 1288 goto err_setup_rx;
1290 1289
@@ -1569,6 +1568,8 @@ e1000_configure_tx(struct e1000_adapter *adapter)
1569 1568
1570 if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) { 1569 if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) {
1571 tarc = E1000_READ_REG(hw, TARC0); 1570 tarc = E1000_READ_REG(hw, TARC0);
1571 /* set the speed mode bit, we'll clear it if we're not at
1572 * gigabit link later */
1572 tarc |= (1 << 21); 1573 tarc |= (1 << 21);
1573 E1000_WRITE_REG(hw, TARC0, tarc); 1574 E1000_WRITE_REG(hw, TARC0, tarc);
1574 } else if (hw->mac_type == e1000_80003es2lan) { 1575 } else if (hw->mac_type == e1000_80003es2lan) {
@@ -2418,6 +2419,7 @@ e1000_watchdog(unsigned long data)
2418 DPRINTK(LINK, INFO, 2419 DPRINTK(LINK, INFO,
2419 "Gigabit has been disabled, downgrading speed\n"); 2420 "Gigabit has been disabled, downgrading speed\n");
2420 } 2421 }
2422
2421 if (adapter->hw.mac_type == e1000_82573) { 2423 if (adapter->hw.mac_type == e1000_82573) {
2422 e1000_enable_tx_pkt_filtering(&adapter->hw); 2424 e1000_enable_tx_pkt_filtering(&adapter->hw);
2423 if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) 2425 if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
@@ -2462,13 +2464,12 @@ e1000_watchdog(unsigned long data)
2462 if ((adapter->hw.mac_type == e1000_82571 || 2464 if ((adapter->hw.mac_type == e1000_82571 ||
2463 adapter->hw.mac_type == e1000_82572) && 2465 adapter->hw.mac_type == e1000_82572) &&
2464 txb2b == 0) { 2466 txb2b == 0) {
2465#define SPEED_MODE_BIT (1 << 21)
2466 uint32_t tarc0; 2467 uint32_t tarc0;
2467 tarc0 = E1000_READ_REG(&adapter->hw, TARC0); 2468 tarc0 = E1000_READ_REG(&adapter->hw, TARC0);
2468 tarc0 &= ~SPEED_MODE_BIT; 2469 tarc0 &= ~(1 << 21);
2469 E1000_WRITE_REG(&adapter->hw, TARC0, tarc0); 2470 E1000_WRITE_REG(&adapter->hw, TARC0, tarc0);
2470 } 2471 }
2471 2472
2472#ifdef NETIF_F_TSO 2473#ifdef NETIF_F_TSO
2473 /* disable TSO for pcie and 10/100 speeds, to avoid 2474 /* disable TSO for pcie and 10/100 speeds, to avoid
2474 * some hardware issues */ 2475 * some hardware issues */
@@ -3010,9 +3011,9 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3010 max_per_txd = min(mss << 2, max_per_txd); 3011 max_per_txd = min(mss << 2, max_per_txd);
3011 max_txd_pwr = fls(max_per_txd) - 1; 3012 max_txd_pwr = fls(max_per_txd) - 1;
3012 3013
3013 /* TSO Workaround for 82571/2/3 Controllers -- if skb->data 3014 /* TSO Workaround for 82571/2/3 Controllers -- if skb->data
3014 * points to just header, pull a few bytes of payload from 3015 * points to just header, pull a few bytes of payload from
3015 * frags into skb->data */ 3016 * frags into skb->data */
3016 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 3017 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
3017 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) { 3018 if (skb->data_len && (hdr_len == (skb->len - skb->data_len))) {
3018 switch (adapter->hw.mac_type) { 3019 switch (adapter->hw.mac_type) {
@@ -3316,12 +3317,12 @@ e1000_update_stats(struct e1000_adapter *adapter)
3316 adapter->stats.roc += E1000_READ_REG(hw, ROC); 3317 adapter->stats.roc += E1000_READ_REG(hw, ROC);
3317 3318
3318 if (adapter->hw.mac_type != e1000_ich8lan) { 3319 if (adapter->hw.mac_type != e1000_ich8lan) {
3319 adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); 3320 adapter->stats.prc64 += E1000_READ_REG(hw, PRC64);
3320 adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); 3321 adapter->stats.prc127 += E1000_READ_REG(hw, PRC127);
3321 adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); 3322 adapter->stats.prc255 += E1000_READ_REG(hw, PRC255);
3322 adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); 3323 adapter->stats.prc511 += E1000_READ_REG(hw, PRC511);
3323 adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); 3324 adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023);
3324 adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); 3325 adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522);
3325 } 3326 }
3326 3327
3327 adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); 3328 adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS);
@@ -3352,12 +3353,12 @@ e1000_update_stats(struct e1000_adapter *adapter)
3352 adapter->stats.tpr += E1000_READ_REG(hw, TPR); 3353 adapter->stats.tpr += E1000_READ_REG(hw, TPR);
3353 3354
3354 if (adapter->hw.mac_type != e1000_ich8lan) { 3355 if (adapter->hw.mac_type != e1000_ich8lan) {
3355 adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); 3356 adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64);
3356 adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); 3357 adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127);
3357 adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); 3358 adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255);
3358 adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); 3359 adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511);
3359 adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); 3360 adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023);
3360 adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); 3361 adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522);
3361 } 3362 }
3362 3363
3363 adapter->stats.mptc += E1000_READ_REG(hw, MPTC); 3364 adapter->stats.mptc += E1000_READ_REG(hw, MPTC);
@@ -3383,18 +3384,17 @@ e1000_update_stats(struct e1000_adapter *adapter)
3383 adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); 3384 adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
3384 3385
3385 if (adapter->hw.mac_type != e1000_ich8lan) { 3386 if (adapter->hw.mac_type != e1000_ich8lan) {
3386 adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); 3387 adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
3387 adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); 3388 adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC);
3388 adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); 3389 adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC);
3389 adapter->stats.ictxatc += E1000_READ_REG(hw, ICTXATC); 3390 adapter->stats.ictxatc += E1000_READ_REG(hw, ICTXATC);
3390 adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); 3391 adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC);
3391 adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); 3392 adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC);
3392 adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); 3393 adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC);
3393 } 3394 }
3394 } 3395 }
3395 3396
3396 /* Fill out the OS statistics structure */ 3397 /* Fill out the OS statistics structure */
3397
3398 adapter->net_stats.rx_packets = adapter->stats.gprc; 3398 adapter->net_stats.rx_packets = adapter->stats.gprc;
3399 adapter->net_stats.tx_packets = adapter->stats.gptc; 3399 adapter->net_stats.tx_packets = adapter->stats.gptc;
3400 adapter->net_stats.rx_bytes = adapter->stats.gorcl; 3400 adapter->net_stats.rx_bytes = adapter->stats.gorcl;
@@ -3426,7 +3426,6 @@ e1000_update_stats(struct e1000_adapter *adapter)
3426 /* Tx Dropped needs to be maintained elsewhere */ 3426 /* Tx Dropped needs to be maintained elsewhere */
3427 3427
3428 /* Phy Stats */ 3428 /* Phy Stats */
3429
3430 if (hw->media_type == e1000_media_type_copper) { 3429 if (hw->media_type == e1000_media_type_copper) {
3431 if ((adapter->link_speed == SPEED_1000) && 3430 if ((adapter->link_speed == SPEED_1000) &&
3432 (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) { 3431 (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
@@ -3502,6 +3501,8 @@ e1000_intr(int irq, void *data)
3502 if (likely(netif_rx_schedule_prep(netdev))) 3501 if (likely(netif_rx_schedule_prep(netdev)))
3503 __netif_rx_schedule(netdev); 3502 __netif_rx_schedule(netdev);
3504 else 3503 else
3504 /* this really should not happen! if it does it is basically a
3505 * bug, but not a hard error, so enable ints and continue */
3505 e1000_irq_enable(adapter); 3506 e1000_irq_enable(adapter);
3506#else 3507#else
3507 /* Writing IMC and IMS is needed for 82547. 3508 /* Writing IMC and IMS is needed for 82547.
@@ -3528,7 +3529,6 @@ e1000_intr(int irq, void *data)
3528 e1000_irq_enable(adapter); 3529 e1000_irq_enable(adapter);
3529 3530
3530#endif 3531#endif
3531
3532 return IRQ_HANDLED; 3532 return IRQ_HANDLED;
3533} 3533}
3534 3534
@@ -3615,7 +3615,6 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3615 if (unlikely(++i == tx_ring->count)) i = 0; 3615 if (unlikely(++i == tx_ring->count)) i = 0;
3616 } 3616 }
3617 3617
3618
3619 eop = tx_ring->buffer_info[i].next_to_watch; 3618 eop = tx_ring->buffer_info[i].next_to_watch;
3620 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3619 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3621#ifdef CONFIG_E1000_NAPI 3620#ifdef CONFIG_E1000_NAPI
@@ -3760,6 +3759,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3760 while (rx_desc->status & E1000_RXD_STAT_DD) { 3759 while (rx_desc->status & E1000_RXD_STAT_DD) {
3761 struct sk_buff *skb; 3760 struct sk_buff *skb;
3762 u8 status; 3761 u8 status;
3762
3763#ifdef CONFIG_E1000_NAPI 3763#ifdef CONFIG_E1000_NAPI
3764 if (*work_done >= work_to_do) 3764 if (*work_done >= work_to_do)
3765 break; 3765 break;
@@ -3999,7 +3999,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3999 goto copydone; 3999 goto copydone;
4000 } /* if */ 4000 } /* if */
4001 } 4001 }
4002 4002
4003 for (j = 0; j < adapter->rx_ps_pages; j++) { 4003 for (j = 0; j < adapter->rx_ps_pages; j++) {
4004 if (!(length= le16_to_cpu(rx_desc->wb.upper.length[j]))) 4004 if (!(length= le16_to_cpu(rx_desc->wb.upper.length[j])))
4005 break; 4005 break;
@@ -4234,7 +4234,7 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
4234 } 4234 }
4235 4235
4236 skb = netdev_alloc_skb(netdev, 4236 skb = netdev_alloc_skb(netdev,
4237 adapter->rx_ps_bsize0 + NET_IP_ALIGN); 4237 adapter->rx_ps_bsize0 + NET_IP_ALIGN);
4238 4238
4239 if (unlikely(!skb)) { 4239 if (unlikely(!skb)) {
4240 adapter->alloc_rx_buff_failed++; 4240 adapter->alloc_rx_buff_failed++;
@@ -4511,7 +4511,6 @@ e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
4511 return E1000_SUCCESS; 4511 return E1000_SUCCESS;
4512} 4512}
4513 4513
4514
4515void 4514void
4516e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) 4515e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value)
4517{ 4516{
@@ -4534,12 +4533,12 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
4534 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); 4533 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
4535 4534
4536 if (adapter->hw.mac_type != e1000_ich8lan) { 4535 if (adapter->hw.mac_type != e1000_ich8lan) {
4537 /* enable VLAN receive filtering */ 4536 /* enable VLAN receive filtering */
4538 rctl = E1000_READ_REG(&adapter->hw, RCTL); 4537 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4539 rctl |= E1000_RCTL_VFE; 4538 rctl |= E1000_RCTL_VFE;
4540 rctl &= ~E1000_RCTL_CFIEN; 4539 rctl &= ~E1000_RCTL_CFIEN;
4541 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 4540 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4542 e1000_update_mng_vlan(adapter); 4541 e1000_update_mng_vlan(adapter);
4543 } 4542 }
4544 } else { 4543 } else {
4545 /* disable VLAN tag insert/strip */ 4544 /* disable VLAN tag insert/strip */
@@ -4548,14 +4547,16 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
4548 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); 4547 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
4549 4548
4550 if (adapter->hw.mac_type != e1000_ich8lan) { 4549 if (adapter->hw.mac_type != e1000_ich8lan) {
4551 /* disable VLAN filtering */ 4550 /* disable VLAN filtering */
4552 rctl = E1000_READ_REG(&adapter->hw, RCTL); 4551 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4553 rctl &= ~E1000_RCTL_VFE; 4552 rctl &= ~E1000_RCTL_VFE;
4554 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 4553 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4555 if (adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) { 4554 if (adapter->mng_vlan_id !=
4556 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 4555 (uint16_t)E1000_MNG_VLAN_NONE) {
4557 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 4556 e1000_vlan_rx_kill_vid(netdev,
4558 } 4557 adapter->mng_vlan_id);
4558 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
4559 }
4559 } 4560 }
4560 } 4561 }
4561 4562