aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/netdev.c
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2008-08-04 20:20:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-08-07 01:54:49 -0400
commit44defeb3f6f98ea9bb48a2fe6eb9004e9e1a49a1 (patch)
treea7a9b4d9091acaf32fe55da274a7c55f5e77f66d /drivers/net/e1000e/netdev.c
parent77970ea50b8e7ee9733a6589bf61ed9c02f20ee9 (diff)
e1000e: convert ndev_ printks to something smaller
The ndev_* printk's are too lenghty and we don't need to specify the adapter/netdev struct at all, making this a lot more readable. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r--drivers/net/e1000e/netdev.c154
1 files changed, 68 insertions, 86 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index d13677899767..378335f2b237 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -484,8 +484,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
484 * packet, also make sure the frame isn't just CRC only */ 484 * packet, also make sure the frame isn't just CRC only */
485 if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) { 485 if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) {
486 /* All receives must fit into a single buffer */ 486 /* All receives must fit into a single buffer */
487 ndev_dbg(netdev, "%s: Receive packet consumed " 487 e_dbg("%s: Receive packet consumed multiple buffers\n",
488 "multiple buffers\n", netdev->name); 488 netdev->name);
489 /* recycle */ 489 /* recycle */
490 buffer_info->skb = skb; 490 buffer_info->skb = skb;
491 goto next_desc; 491 goto next_desc;
@@ -576,28 +576,26 @@ static void e1000_print_tx_hang(struct e1000_adapter *adapter)
576 unsigned int i = tx_ring->next_to_clean; 576 unsigned int i = tx_ring->next_to_clean;
577 unsigned int eop = tx_ring->buffer_info[i].next_to_watch; 577 unsigned int eop = tx_ring->buffer_info[i].next_to_watch;
578 struct e1000_tx_desc *eop_desc = E1000_TX_DESC(*tx_ring, eop); 578 struct e1000_tx_desc *eop_desc = E1000_TX_DESC(*tx_ring, eop);
579 struct net_device *netdev = adapter->netdev;
580 579
581 /* detected Tx unit hang */ 580 /* detected Tx unit hang */
582 ndev_err(netdev, 581 e_err("Detected Tx Unit Hang:\n"
583 "Detected Tx Unit Hang:\n" 582 " TDH <%x>\n"
584 " TDH <%x>\n" 583 " TDT <%x>\n"
585 " TDT <%x>\n" 584 " next_to_use <%x>\n"
586 " next_to_use <%x>\n" 585 " next_to_clean <%x>\n"
587 " next_to_clean <%x>\n" 586 "buffer_info[next_to_clean]:\n"
588 "buffer_info[next_to_clean]:\n" 587 " time_stamp <%lx>\n"
589 " time_stamp <%lx>\n" 588 " next_to_watch <%x>\n"
590 " next_to_watch <%x>\n" 589 " jiffies <%lx>\n"
591 " jiffies <%lx>\n" 590 " next_to_watch.status <%x>\n",
592 " next_to_watch.status <%x>\n", 591 readl(adapter->hw.hw_addr + tx_ring->head),
593 readl(adapter->hw.hw_addr + tx_ring->head), 592 readl(adapter->hw.hw_addr + tx_ring->tail),
594 readl(adapter->hw.hw_addr + tx_ring->tail), 593 tx_ring->next_to_use,
595 tx_ring->next_to_use, 594 tx_ring->next_to_clean,
596 tx_ring->next_to_clean, 595 tx_ring->buffer_info[eop].time_stamp,
597 tx_ring->buffer_info[eop].time_stamp, 596 eop,
598 eop, 597 jiffies,
599 jiffies, 598 eop_desc->upper.fields.status);
600 eop_desc->upper.fields.status);
601} 599}
602 600
603/** 601/**
@@ -747,8 +745,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
747 buffer_info->dma = 0; 745 buffer_info->dma = 0;
748 746
749 if (!(staterr & E1000_RXD_STAT_EOP)) { 747 if (!(staterr & E1000_RXD_STAT_EOP)) {
750 ndev_dbg(netdev, "%s: Packet Split buffers didn't pick " 748 e_dbg("%s: Packet Split buffers didn't pick up the "
751 "up the full packet\n", netdev->name); 749 "full packet\n", netdev->name);
752 dev_kfree_skb_irq(skb); 750 dev_kfree_skb_irq(skb);
753 goto next_desc; 751 goto next_desc;
754 } 752 }
@@ -761,8 +759,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
761 length = le16_to_cpu(rx_desc->wb.middle.length0); 759 length = le16_to_cpu(rx_desc->wb.middle.length0);
762 760
763 if (!length) { 761 if (!length) {
764 ndev_dbg(netdev, "%s: Last part of the packet spanning" 762 e_dbg("%s: Last part of the packet spanning multiple "
765 " multiple descriptors\n", netdev->name); 763 "descriptors\n", netdev->name);
766 dev_kfree_skb_irq(skb); 764 dev_kfree_skb_irq(skb);
767 goto next_desc; 765 goto next_desc;
768 } 766 }
@@ -1011,7 +1009,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1011 1009
1012 /* eth type trans needs skb->data to point to something */ 1010 /* eth type trans needs skb->data to point to something */
1013 if (!pskb_may_pull(skb, ETH_HLEN)) { 1011 if (!pskb_may_pull(skb, ETH_HLEN)) {
1014 ndev_err(netdev, "pskb_may_pull failed.\n"); 1012 e_err("pskb_may_pull failed.\n");
1015 dev_kfree_skb(skb); 1013 dev_kfree_skb(skb);
1016 goto next_desc; 1014 goto next_desc;
1017 } 1015 }
@@ -1251,10 +1249,8 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
1251 err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, 1249 err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
1252 netdev); 1250 netdev);
1253 if (err) { 1251 if (err) {
1254 ndev_err(netdev, 1252 e_err("Unable to allocate %s interrupt (return: %d)\n",
1255 "Unable to allocate %s interrupt (return: %d)\n", 1253 adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", err);
1256 adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx",
1257 err);
1258 if (adapter->flags & FLAG_MSI_ENABLED) 1254 if (adapter->flags & FLAG_MSI_ENABLED)
1259 pci_disable_msi(adapter->pdev); 1255 pci_disable_msi(adapter->pdev);
1260 } 1256 }
@@ -1395,8 +1391,7 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter)
1395 return 0; 1391 return 0;
1396err: 1392err:
1397 vfree(tx_ring->buffer_info); 1393 vfree(tx_ring->buffer_info);
1398 ndev_err(adapter->netdev, 1394 e_err("Unable to allocate memory for the transmit descriptor ring\n");
1399 "Unable to allocate memory for the transmit descriptor ring\n");
1400 return err; 1395 return err;
1401} 1396}
1402 1397
@@ -1450,8 +1445,7 @@ err_pages:
1450 } 1445 }
1451err: 1446err:
1452 vfree(rx_ring->buffer_info); 1447 vfree(rx_ring->buffer_info);
1453 ndev_err(adapter->netdev, 1448 e_err("Unable to allocate memory for the transmit descriptor ring\n");
1454 "Unable to allocate memory for the transmit descriptor ring\n");
1455 return err; 1449 return err;
1456} 1450}
1457 1451
@@ -2456,7 +2450,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
2456 ew32(WUC, 0); 2450 ew32(WUC, 0);
2457 2451
2458 if (mac->ops.init_hw(hw)) 2452 if (mac->ops.init_hw(hw))
2459 ndev_err(adapter->netdev, "Hardware Error\n"); 2453 e_err("Hardware Error\n");
2460 2454
2461 e1000_update_mng_vlan(adapter); 2455 e1000_update_mng_vlan(adapter);
2462 2456
@@ -2591,7 +2585,7 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
2591 return 0; 2585 return 0;
2592 2586
2593err: 2587err:
2594 ndev_err(netdev, "Unable to allocate memory for queues\n"); 2588 e_err("Unable to allocate memory for queues\n");
2595 kfree(adapter->rx_ring); 2589 kfree(adapter->rx_ring);
2596 kfree(adapter->tx_ring); 2590 kfree(adapter->tx_ring);
2597 return -ENOMEM; 2591 return -ENOMEM;
@@ -2917,8 +2911,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
2917 ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000); 2911 ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000);
2918 ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); 2912 ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus);
2919 if (ret_val) 2913 if (ret_val)
2920 ndev_warn(adapter->netdev, 2914 e_warn("Error reading PHY register\n");
2921 "Error reading PHY register\n");
2922 } else { 2915 } else {
2923 /* 2916 /*
2924 * Do not read PHY registers if link is not up 2917 * Do not read PHY registers if link is not up
@@ -2943,18 +2936,16 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
2943static void e1000_print_link_info(struct e1000_adapter *adapter) 2936static void e1000_print_link_info(struct e1000_adapter *adapter)
2944{ 2937{
2945 struct e1000_hw *hw = &adapter->hw; 2938 struct e1000_hw *hw = &adapter->hw;
2946 struct net_device *netdev = adapter->netdev;
2947 u32 ctrl = er32(CTRL); 2939 u32 ctrl = er32(CTRL);
2948 2940
2949 ndev_info(netdev, 2941 e_info("Link is Up %d Mbps %s, Flow Control: %s\n",
2950 "Link is Up %d Mbps %s, Flow Control: %s\n", 2942 adapter->link_speed,
2951 adapter->link_speed, 2943 (adapter->link_duplex == FULL_DUPLEX) ?
2952 (adapter->link_duplex == FULL_DUPLEX) ? 2944 "Full Duplex" : "Half Duplex",
2953 "Full Duplex" : "Half Duplex", 2945 ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ?
2954 ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? 2946 "RX/TX" :
2955 "RX/TX" : 2947 ((ctrl & E1000_CTRL_RFCE) ? "RX" :
2956 ((ctrl & E1000_CTRL_RFCE) ? "RX" : 2948 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
2957 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
2958} 2949}
2959 2950
2960static bool e1000_has_link(struct e1000_adapter *adapter) 2951static bool e1000_has_link(struct e1000_adapter *adapter)
@@ -2994,8 +2985,7 @@ static bool e1000_has_link(struct e1000_adapter *adapter)
2994 if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && 2985 if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) &&
2995 (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { 2986 (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) {
2996 /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ 2987 /* See e1000_kmrn_lock_loss_workaround_ich8lan() */
2997 ndev_info(adapter->netdev, 2988 e_info("Gigabit has been disabled, downgrading speed\n");
2998 "Gigabit has been disabled, downgrading speed\n");
2999 } 2989 }
3000 2990
3001 return link_active; 2991 return link_active;
@@ -3096,8 +3086,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3096 switch (adapter->link_speed) { 3086 switch (adapter->link_speed) {
3097 case SPEED_10: 3087 case SPEED_10:
3098 case SPEED_100: 3088 case SPEED_100:
3099 ndev_info(netdev, 3089 e_info("10/100 speed: disabling TSO\n");
3100 "10/100 speed: disabling TSO\n");
3101 netdev->features &= ~NETIF_F_TSO; 3090 netdev->features &= ~NETIF_F_TSO;
3102 netdev->features &= ~NETIF_F_TSO6; 3091 netdev->features &= ~NETIF_F_TSO6;
3103 break; 3092 break;
@@ -3130,7 +3119,7 @@ static void e1000_watchdog_task(struct work_struct *work)
3130 if (netif_carrier_ok(netdev)) { 3119 if (netif_carrier_ok(netdev)) {
3131 adapter->link_speed = 0; 3120 adapter->link_speed = 0;
3132 adapter->link_duplex = 0; 3121 adapter->link_duplex = 0;
3133 ndev_info(netdev, "Link is Down\n"); 3122 e_info("Link is Down\n");
3134 netif_carrier_off(netdev); 3123 netif_carrier_off(netdev);
3135 netif_tx_stop_all_queues(netdev); 3124 netif_tx_stop_all_queues(netdev);
3136 if (!test_bit(__E1000_DOWN, &adapter->state)) 3125 if (!test_bit(__E1000_DOWN, &adapter->state))
@@ -3604,8 +3593,7 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3604 3593
3605 pull_size = min((unsigned int)4, skb->data_len); 3594 pull_size = min((unsigned int)4, skb->data_len);
3606 if (!__pskb_pull_tail(skb, pull_size)) { 3595 if (!__pskb_pull_tail(skb, pull_size)) {
3607 ndev_err(netdev, 3596 e_err("__pskb_pull_tail failed.\n");
3608 "__pskb_pull_tail failed.\n");
3609 dev_kfree_skb_any(skb); 3597 dev_kfree_skb_any(skb);
3610 return NETDEV_TX_OK; 3598 return NETDEV_TX_OK;
3611 } 3599 }
@@ -3737,25 +3725,25 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3737 3725
3738 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 3726 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
3739 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 3727 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
3740 ndev_err(netdev, "Invalid MTU setting\n"); 3728 e_err("Invalid MTU setting\n");
3741 return -EINVAL; 3729 return -EINVAL;
3742 } 3730 }
3743 3731
3744 /* Jumbo frame size limits */ 3732 /* Jumbo frame size limits */
3745 if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { 3733 if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) {
3746 if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { 3734 if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
3747 ndev_err(netdev, "Jumbo Frames not supported.\n"); 3735 e_err("Jumbo Frames not supported.\n");
3748 return -EINVAL; 3736 return -EINVAL;
3749 } 3737 }
3750 if (adapter->hw.phy.type == e1000_phy_ife) { 3738 if (adapter->hw.phy.type == e1000_phy_ife) {
3751 ndev_err(netdev, "Jumbo Frames not supported.\n"); 3739 e_err("Jumbo Frames not supported.\n");
3752 return -EINVAL; 3740 return -EINVAL;
3753 } 3741 }
3754 } 3742 }
3755 3743
3756#define MAX_STD_JUMBO_FRAME_SIZE 9234 3744#define MAX_STD_JUMBO_FRAME_SIZE 9234
3757 if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { 3745 if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
3758 ndev_err(netdev, "MTU > 9216 not supported.\n"); 3746 e_err("MTU > 9216 not supported.\n");
3759 return -EINVAL; 3747 return -EINVAL;
3760 } 3748 }
3761 3749
@@ -3792,8 +3780,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3792 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN 3780 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN
3793 + ETH_FCS_LEN; 3781 + ETH_FCS_LEN;
3794 3782
3795 ndev_info(netdev, "changing MTU from %d to %d\n", 3783 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
3796 netdev->mtu, new_mtu);
3797 netdev->mtu = new_mtu; 3784 netdev->mtu = new_mtu;
3798 3785
3799 if (netif_running(netdev)) 3786 if (netif_running(netdev))
@@ -4175,22 +4162,19 @@ static void e1000_print_device_info(struct e1000_adapter *adapter)
4175 u32 pba_num; 4162 u32 pba_num;
4176 4163
4177 /* print bus type/speed/width info */ 4164 /* print bus type/speed/width info */
4178 ndev_info(netdev, "(PCI Express:2.5GB/s:%s) " 4165 e_info("(PCI Express:2.5GB/s:%s) %02x:%02x:%02x:%02x:%02x:%02x\n",
4179 "%02x:%02x:%02x:%02x:%02x:%02x\n", 4166 /* bus width */
4180 /* bus width */ 4167 ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" :
4181 ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : 4168 "Width x1"),
4182 "Width x1"), 4169 /* MAC address */
4183 /* MAC address */ 4170 netdev->dev_addr[0], netdev->dev_addr[1],
4184 netdev->dev_addr[0], netdev->dev_addr[1], 4171 netdev->dev_addr[2], netdev->dev_addr[3],
4185 netdev->dev_addr[2], netdev->dev_addr[3], 4172 netdev->dev_addr[4], netdev->dev_addr[5]);
4186 netdev->dev_addr[4], netdev->dev_addr[5]); 4173 e_info("Intel(R) PRO/%s Network Connection\n",
4187 ndev_info(netdev, "Intel(R) PRO/%s Network Connection\n", 4174 (hw->phy.type == e1000_phy_ife) ? "10/100" : "1000");
4188 (hw->phy.type == e1000_phy_ife)
4189 ? "10/100" : "1000");
4190 e1000e_read_pba_num(hw, &pba_num); 4175 e1000e_read_pba_num(hw, &pba_num);
4191 ndev_info(netdev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n", 4176 e_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
4192 hw->mac.type, hw->phy.type, 4177 hw->mac.type, hw->phy.type, (pba_num >> 8), (pba_num & 0xff));
4193 (pba_num >> 8), (pba_num & 0xff));
4194} 4178}
4195 4179
4196/** 4180/**
@@ -4366,8 +4350,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4366 } 4350 }
4367 4351
4368 if (e1000_check_reset_block(&adapter->hw)) 4352 if (e1000_check_reset_block(&adapter->hw))
4369 ndev_info(netdev, 4353 e_info("PHY reset is blocked due to SOL/IDER session.\n");
4370 "PHY reset is blocked due to SOL/IDER session.\n");
4371 4354
4372 netdev->features = NETIF_F_SG | 4355 netdev->features = NETIF_F_SG |
4373 NETIF_F_HW_CSUM | 4356 NETIF_F_HW_CSUM |
@@ -4411,7 +4394,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4411 if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) 4394 if (e1000_validate_nvm_checksum(&adapter->hw) >= 0)
4412 break; 4395 break;
4413 if (i == 2) { 4396 if (i == 2) {
4414 ndev_err(netdev, "The NVM Checksum Is Not Valid\n"); 4397 e_err("The NVM Checksum Is Not Valid\n");
4415 err = -EIO; 4398 err = -EIO;
4416 goto err_eeprom; 4399 goto err_eeprom;
4417 } 4400 }
@@ -4419,17 +4402,16 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4419 4402
4420 /* copy the MAC address out of the NVM */ 4403 /* copy the MAC address out of the NVM */
4421 if (e1000e_read_mac_addr(&adapter->hw)) 4404 if (e1000e_read_mac_addr(&adapter->hw))
4422 ndev_err(netdev, "NVM Read Error while reading MAC address\n"); 4405 e_err("NVM Read Error while reading MAC address\n");
4423 4406
4424 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); 4407 memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
4425 memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); 4408 memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
4426 4409
4427 if (!is_valid_ether_addr(netdev->perm_addr)) { 4410 if (!is_valid_ether_addr(netdev->perm_addr)) {
4428 ndev_err(netdev, "Invalid MAC Address: " 4411 e_err("Invalid MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
4429 "%02x:%02x:%02x:%02x:%02x:%02x\n", 4412 netdev->perm_addr[0], netdev->perm_addr[1],
4430 netdev->perm_addr[0], netdev->perm_addr[1], 4413 netdev->perm_addr[2], netdev->perm_addr[3],
4431 netdev->perm_addr[2], netdev->perm_addr[3], 4414 netdev->perm_addr[4], netdev->perm_addr[5]);
4432 netdev->perm_addr[4], netdev->perm_addr[5]);
4433 err = -EIO; 4415 err = -EIO;
4434 goto err_eeprom; 4416 goto err_eeprom;
4435 } 4417 }