aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1e/atl1e_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/atl1e/atl1e_main.c')
-rw-r--r--drivers/net/atl1e/atl1e_main.c160
1 files changed, 70 insertions, 90 deletions
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 08f8c0969e9..73302ae468a 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -35,7 +35,7 @@ char atl1e_driver_version[] = DRV_VERSION;
35 * { Vendor ID, Device ID, SubVendor ID, SubDevice ID, 35 * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
36 * Class, Class Mask, private data (not used) } 36 * Class, Class Mask, private data (not used) }
37 */ 37 */
38static struct pci_device_id atl1e_pci_tbl[] = { 38static DEFINE_PCI_DEVICE_TABLE(atl1e_pci_tbl) = {
39 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1E)}, 39 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1E)},
40 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1066)}, 40 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1066)},
41 /* required last entry */ 41 /* required last entry */
@@ -164,11 +164,10 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
164{ 164{
165 struct atl1e_hw *hw = &adapter->hw; 165 struct atl1e_hw *hw = &adapter->hw;
166 struct net_device *netdev = adapter->netdev; 166 struct net_device *netdev = adapter->netdev;
167 struct pci_dev *pdev = adapter->pdev;
168 int err = 0; 167 int err = 0;
169 u16 speed, duplex, phy_data; 168 u16 speed, duplex, phy_data;
170 169
171 /* MII_BMSR must read twise */ 170 /* MII_BMSR must read twice */
172 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data); 171 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
173 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data); 172 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
174 if ((phy_data & BMSR_LSTATUS) == 0) { 173 if ((phy_data & BMSR_LSTATUS) == 0) {
@@ -195,12 +194,11 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
195 adapter->link_speed = speed; 194 adapter->link_speed = speed;
196 adapter->link_duplex = duplex; 195 adapter->link_duplex = duplex;
197 atl1e_setup_mac_ctrl(adapter); 196 atl1e_setup_mac_ctrl(adapter);
198 dev_info(&pdev->dev, 197 netdev_info(netdev,
199 "%s: %s NIC Link is Up<%d Mbps %s>\n", 198 "NIC Link is Up <%d Mbps %s Duplex>\n",
200 atl1e_driver_name, netdev->name, 199 adapter->link_speed,
201 adapter->link_speed, 200 adapter->link_duplex == FULL_DUPLEX ?
202 adapter->link_duplex == FULL_DUPLEX ? 201 "Full" : "Half");
203 "Full Duplex" : "Half Duplex");
204 } 202 }
205 203
206 if (!netif_carrier_ok(netdev)) { 204 if (!netif_carrier_ok(netdev)) {
@@ -230,7 +228,6 @@ static void atl1e_link_chg_task(struct work_struct *work)
230static void atl1e_link_chg_event(struct atl1e_adapter *adapter) 228static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
231{ 229{
232 struct net_device *netdev = adapter->netdev; 230 struct net_device *netdev = adapter->netdev;
233 struct pci_dev *pdev = adapter->pdev;
234 u16 phy_data = 0; 231 u16 phy_data = 0;
235 u16 link_up = 0; 232 u16 link_up = 0;
236 233
@@ -243,8 +240,7 @@ static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
243 if (!link_up) { 240 if (!link_up) {
244 if (netif_carrier_ok(netdev)) { 241 if (netif_carrier_ok(netdev)) {
245 /* old link state: Up */ 242 /* old link state: Up */
246 dev_info(&pdev->dev, "%s: %s NIC Link is Down\n", 243 netdev_info(netdev, "NIC Link is Down\n");
247 atl1e_driver_name, netdev->name);
248 adapter->link_speed = SPEED_0; 244 adapter->link_speed = SPEED_0;
249 netif_stop_queue(netdev); 245 netif_stop_queue(netdev);
250 } 246 }
@@ -311,7 +307,7 @@ static void atl1e_set_multi(struct net_device *netdev)
311 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 307 AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
312 308
313 /* comoute mc addresses' hash value ,and put it into hash table */ 309 /* comoute mc addresses' hash value ,and put it into hash table */
314 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 310 netdev_for_each_mc_addr(mc_ptr, netdev) {
315 hash_value = atl1e_hash_mc_addr(hw, mc_ptr->dmi_addr); 311 hash_value = atl1e_hash_mc_addr(hw, mc_ptr->dmi_addr);
316 atl1e_hash_set(hw, hash_value); 312 atl1e_hash_set(hw, hash_value);
317 } 313 }
@@ -321,10 +317,9 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
321 struct vlan_group *grp) 317 struct vlan_group *grp)
322{ 318{
323 struct atl1e_adapter *adapter = netdev_priv(netdev); 319 struct atl1e_adapter *adapter = netdev_priv(netdev);
324 struct pci_dev *pdev = adapter->pdev;
325 u32 mac_ctrl_data = 0; 320 u32 mac_ctrl_data = 0;
326 321
327 dev_dbg(&pdev->dev, "atl1e_vlan_rx_register\n"); 322 netdev_dbg(adapter->netdev, "%s\n", __func__);
328 323
329 atl1e_irq_disable(adapter); 324 atl1e_irq_disable(adapter);
330 325
@@ -345,9 +340,7 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
345 340
346static void atl1e_restore_vlan(struct atl1e_adapter *adapter) 341static void atl1e_restore_vlan(struct atl1e_adapter *adapter)
347{ 342{
348 struct pci_dev *pdev = adapter->pdev; 343 netdev_dbg(adapter->netdev, "%s\n", __func__);
349
350 dev_dbg(&pdev->dev, "atl1e_restore_vlan !");
351 atl1e_vlan_rx_register(adapter->netdev, adapter->vlgrp); 344 atl1e_vlan_rx_register(adapter->netdev, adapter->vlgrp);
352} 345}
353/* 346/*
@@ -391,7 +384,7 @@ static int atl1e_change_mtu(struct net_device *netdev, int new_mtu)
391 384
392 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 385 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
393 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 386 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
394 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); 387 netdev_warn(adapter->netdev, "invalid MTU setting\n");
395 return -EINVAL; 388 return -EINVAL;
396 } 389 }
397 /* set MTU */ 390 /* set MTU */
@@ -438,7 +431,6 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
438 struct ifreq *ifr, int cmd) 431 struct ifreq *ifr, int cmd)
439{ 432{
440 struct atl1e_adapter *adapter = netdev_priv(netdev); 433 struct atl1e_adapter *adapter = netdev_priv(netdev);
441 struct pci_dev *pdev = adapter->pdev;
442 struct mii_ioctl_data *data = if_mii(ifr); 434 struct mii_ioctl_data *data = if_mii(ifr);
443 unsigned long flags; 435 unsigned long flags;
444 int retval = 0; 436 int retval = 0;
@@ -466,8 +458,8 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
466 goto out; 458 goto out;
467 } 459 }
468 460
469 dev_dbg(&pdev->dev, "<atl1e_mii_ioctl> write %x %x", 461 netdev_dbg(adapter->netdev, "<atl1e_mii_ioctl> write %x %x\n",
470 data->reg_num, data->val_in); 462 data->reg_num, data->val_in);
471 if (atl1e_write_phy_reg(&adapter->hw, 463 if (atl1e_write_phy_reg(&adapter->hw,
472 data->reg_num, data->val_in)) { 464 data->reg_num, data->val_in)) {
473 retval = -EIO; 465 retval = -EIO;
@@ -602,7 +594,7 @@ static int __devinit atl1e_sw_init(struct atl1e_adapter *adapter)
602 hw->dmaw_dly_cnt = 4; 594 hw->dmaw_dly_cnt = 4;
603 595
604 if (atl1e_alloc_queues(adapter)) { 596 if (atl1e_alloc_queues(adapter)) {
605 dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 597 netdev_err(adapter->netdev, "Unable to allocate memory for queues\n");
606 return -ENOMEM; 598 return -ENOMEM;
607 } 599 }
608 600
@@ -800,8 +792,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
800 adapter->ring_size, &adapter->ring_dma); 792 adapter->ring_size, &adapter->ring_dma);
801 793
802 if (adapter->ring_vir_addr == NULL) { 794 if (adapter->ring_vir_addr == NULL) {
803 dev_err(&pdev->dev, "pci_alloc_consistent failed, " 795 netdev_err(adapter->netdev,
804 "size = D%d", size); 796 "pci_alloc_consistent failed, size = D%d\n", size);
805 return -ENOMEM; 797 return -ENOMEM;
806 } 798 }
807 799
@@ -817,7 +809,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
817 size = sizeof(struct atl1e_tx_buffer) * (tx_ring->count); 809 size = sizeof(struct atl1e_tx_buffer) * (tx_ring->count);
818 tx_ring->tx_buffer = kzalloc(size, GFP_KERNEL); 810 tx_ring->tx_buffer = kzalloc(size, GFP_KERNEL);
819 if (tx_ring->tx_buffer == NULL) { 811 if (tx_ring->tx_buffer == NULL) {
820 dev_err(&pdev->dev, "kzalloc failed , size = D%d", size); 812 netdev_err(adapter->netdev, "kzalloc failed, size = D%d\n",
813 size);
821 err = -ENOMEM; 814 err = -ENOMEM;
822 goto failed; 815 goto failed;
823 } 816 }
@@ -852,8 +845,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
852 } 845 }
853 846
854 if (unlikely(offset > adapter->ring_size)) { 847 if (unlikely(offset > adapter->ring_size)) {
855 dev_err(&pdev->dev, "offset(%d) > ring size(%d) !!\n", 848 netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n",
856 offset, adapter->ring_size); 849 offset, adapter->ring_size);
857 err = -1; 850 err = -1;
858 goto failed; 851 goto failed;
859 } 852 }
@@ -1077,7 +1070,6 @@ static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter)
1077static int atl1e_configure(struct atl1e_adapter *adapter) 1070static int atl1e_configure(struct atl1e_adapter *adapter)
1078{ 1071{
1079 struct atl1e_hw *hw = &adapter->hw; 1072 struct atl1e_hw *hw = &adapter->hw;
1080 struct pci_dev *pdev = adapter->pdev;
1081 1073
1082 u32 intr_status_data = 0; 1074 u32 intr_status_data = 0;
1083 1075
@@ -1130,8 +1122,8 @@ static int atl1e_configure(struct atl1e_adapter *adapter)
1130 1122
1131 intr_status_data = AT_READ_REG(hw, REG_ISR); 1123 intr_status_data = AT_READ_REG(hw, REG_ISR);
1132 if (unlikely((intr_status_data & ISR_PHY_LINKDOWN) != 0)) { 1124 if (unlikely((intr_status_data & ISR_PHY_LINKDOWN) != 0)) {
1133 dev_err(&pdev->dev, "atl1e_configure failed," 1125 netdev_err(adapter->netdev,
1134 "PCIE phy link down\n"); 1126 "atl1e_configure failed, PCIE phy link down\n");
1135 return -1; 1127 return -1;
1136 } 1128 }
1137 1129
@@ -1262,7 +1254,6 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1262{ 1254{
1263 struct net_device *netdev = data; 1255 struct net_device *netdev = data;
1264 struct atl1e_adapter *adapter = netdev_priv(netdev); 1256 struct atl1e_adapter *adapter = netdev_priv(netdev);
1265 struct pci_dev *pdev = adapter->pdev;
1266 struct atl1e_hw *hw = &adapter->hw; 1257 struct atl1e_hw *hw = &adapter->hw;
1267 int max_ints = AT_MAX_INT_WORK; 1258 int max_ints = AT_MAX_INT_WORK;
1268 int handled = IRQ_NONE; 1259 int handled = IRQ_NONE;
@@ -1285,8 +1276,8 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1285 handled = IRQ_HANDLED; 1276 handled = IRQ_HANDLED;
1286 /* check if PCIE PHY Link down */ 1277 /* check if PCIE PHY Link down */
1287 if (status & ISR_PHY_LINKDOWN) { 1278 if (status & ISR_PHY_LINKDOWN) {
1288 dev_err(&pdev->dev, 1279 netdev_err(adapter->netdev,
1289 "pcie phy linkdown %x\n", status); 1280 "pcie phy linkdown %x\n", status);
1290 if (netif_running(adapter->netdev)) { 1281 if (netif_running(adapter->netdev)) {
1291 /* reset MAC */ 1282 /* reset MAC */
1292 atl1e_irq_reset(adapter); 1283 atl1e_irq_reset(adapter);
@@ -1297,9 +1288,9 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1297 1288
1298 /* check if DMA read/write error */ 1289 /* check if DMA read/write error */
1299 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) { 1290 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) {
1300 dev_err(&pdev->dev, 1291 netdev_err(adapter->netdev,
1301 "PCIE DMA RW error (status = 0x%x)\n", 1292 "PCIE DMA RW error (status = 0x%x)\n",
1302 status); 1293 status);
1303 atl1e_irq_reset(adapter); 1294 atl1e_irq_reset(adapter);
1304 schedule_work(&adapter->reset_task); 1295 schedule_work(&adapter->reset_task);
1305 break; 1296 break;
@@ -1382,7 +1373,6 @@ static struct atl1e_rx_page *atl1e_get_rx_page(struct atl1e_adapter *adapter,
1382static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que, 1373static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1383 int *work_done, int work_to_do) 1374 int *work_done, int work_to_do)
1384{ 1375{
1385 struct pci_dev *pdev = adapter->pdev;
1386 struct net_device *netdev = adapter->netdev; 1376 struct net_device *netdev = adapter->netdev;
1387 struct atl1e_rx_ring *rx_ring = (struct atl1e_rx_ring *) 1377 struct atl1e_rx_ring *rx_ring = (struct atl1e_rx_ring *)
1388 &adapter->rx_ring; 1378 &adapter->rx_ring;
@@ -1404,11 +1394,10 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1404 rx_page->read_offset); 1394 rx_page->read_offset);
1405 /* check sequence number */ 1395 /* check sequence number */
1406 if (prrs->seq_num != rx_page_desc[que].rx_nxseq) { 1396 if (prrs->seq_num != rx_page_desc[que].rx_nxseq) {
1407 dev_err(&pdev->dev, 1397 netdev_err(netdev,
1408 "rx sequence number" 1398 "rx sequence number error (rx=%d) (expect=%d)\n",
1409 " error (rx=%d) (expect=%d)\n", 1399 prrs->seq_num,
1410 prrs->seq_num, 1400 rx_page_desc[que].rx_nxseq);
1411 rx_page_desc[que].rx_nxseq);
1412 rx_page_desc[que].rx_nxseq++; 1401 rx_page_desc[que].rx_nxseq++;
1413 /* just for debug use */ 1402 /* just for debug use */
1414 AT_WRITE_REG(&adapter->hw, REG_DEBUG_DATA0, 1403 AT_WRITE_REG(&adapter->hw, REG_DEBUG_DATA0,
@@ -1424,9 +1413,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1424 RRS_ERR_DRIBBLE | RRS_ERR_CODE | 1413 RRS_ERR_DRIBBLE | RRS_ERR_CODE |
1425 RRS_ERR_TRUNC)) { 1414 RRS_ERR_TRUNC)) {
1426 /* hardware error, discard this packet*/ 1415 /* hardware error, discard this packet*/
1427 dev_err(&pdev->dev, 1416 netdev_err(netdev,
1428 "rx packet desc error %x\n", 1417 "rx packet desc error %x\n",
1429 *((u32 *)prrs + 1)); 1418 *((u32 *)prrs + 1));
1430 goto skip_pkt; 1419 goto skip_pkt;
1431 } 1420 }
1432 } 1421 }
@@ -1435,8 +1424,8 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1435 RRS_PKT_SIZE_MASK) - 4; /* CRC */ 1424 RRS_PKT_SIZE_MASK) - 4; /* CRC */
1436 skb = netdev_alloc_skb_ip_align(netdev, packet_size); 1425 skb = netdev_alloc_skb_ip_align(netdev, packet_size);
1437 if (skb == NULL) { 1426 if (skb == NULL) {
1438 dev_warn(&pdev->dev, "%s: Memory squeeze," 1427 netdev_warn(netdev,
1439 "deferring packet.\n", netdev->name); 1428 "Memory squeeze, deferring packet\n");
1440 goto skip_pkt; 1429 goto skip_pkt;
1441 } 1430 }
1442 skb->dev = netdev; 1431 skb->dev = netdev;
@@ -1450,9 +1439,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1450 u16 vlan_tag = (prrs->vtag >> 4) | 1439 u16 vlan_tag = (prrs->vtag >> 4) |
1451 ((prrs->vtag & 7) << 13) | 1440 ((prrs->vtag & 7) << 13) |
1452 ((prrs->vtag & 8) << 9); 1441 ((prrs->vtag & 8) << 9);
1453 dev_dbg(&pdev->dev, 1442 netdev_dbg(netdev,
1454 "RXD VLAN TAG<RRD>=0x%04x\n", 1443 "RXD VLAN TAG<RRD>=0x%04x\n",
1455 prrs->vtag); 1444 prrs->vtag);
1456 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 1445 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
1457 vlan_tag); 1446 vlan_tag);
1458 } else { 1447 } else {
@@ -1500,7 +1489,6 @@ static int atl1e_clean(struct napi_struct *napi, int budget)
1500{ 1489{
1501 struct atl1e_adapter *adapter = 1490 struct atl1e_adapter *adapter =
1502 container_of(napi, struct atl1e_adapter, napi); 1491 container_of(napi, struct atl1e_adapter, napi);
1503 struct pci_dev *pdev = adapter->pdev;
1504 u32 imr_data; 1492 u32 imr_data;
1505 int work_done = 0; 1493 int work_done = 0;
1506 1494
@@ -1519,8 +1507,8 @@ quit_polling:
1519 /* test debug */ 1507 /* test debug */
1520 if (test_bit(__AT_DOWN, &adapter->flags)) { 1508 if (test_bit(__AT_DOWN, &adapter->flags)) {
1521 atomic_dec(&adapter->irq_sem); 1509 atomic_dec(&adapter->irq_sem);
1522 dev_err(&pdev->dev, 1510 netdev_err(adapter->netdev,
1523 "atl1e_clean is called when AT_DOWN\n"); 1511 "atl1e_clean is called when AT_DOWN\n");
1524 } 1512 }
1525 /* reenable RX intr */ 1513 /* reenable RX intr */
1526 /*atl1e_irq_enable(adapter); */ 1514 /*atl1e_irq_enable(adapter); */
@@ -1618,7 +1606,6 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
1618static int atl1e_tso_csum(struct atl1e_adapter *adapter, 1606static int atl1e_tso_csum(struct atl1e_adapter *adapter,
1619 struct sk_buff *skb, struct atl1e_tpd_desc *tpd) 1607 struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
1620{ 1608{
1621 struct pci_dev *pdev = adapter->pdev;
1622 u8 hdr_len; 1609 u8 hdr_len;
1623 u32 real_len; 1610 u32 real_len;
1624 unsigned short offload_type; 1611 unsigned short offload_type;
@@ -1642,8 +1629,8 @@ static int atl1e_tso_csum(struct atl1e_adapter *adapter,
1642 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb)); 1629 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
1643 if (unlikely(skb->len == hdr_len)) { 1630 if (unlikely(skb->len == hdr_len)) {
1644 /* only xsum need */ 1631 /* only xsum need */
1645 dev_warn(&pdev->dev, 1632 netdev_warn(adapter->netdev,
1646 "IPV4 tso with zero data??\n"); 1633 "IPV4 tso with zero data??\n");
1647 goto check_sum; 1634 goto check_sum;
1648 } else { 1635 } else {
1649 ip_hdr(skb)->check = 0; 1636 ip_hdr(skb)->check = 0;
@@ -1672,8 +1659,8 @@ check_sum:
1672 1659
1673 cso = skb_transport_offset(skb); 1660 cso = skb_transport_offset(skb);
1674 if (unlikely(cso & 0x1)) { 1661 if (unlikely(cso & 0x1)) {
1675 dev_err(&adapter->pdev->dev, 1662 netdev_err(adapter->netdev,
1676 "pay load offset should not ant event number\n"); 1663 "payload offset should not ant event number\n");
1677 return -1; 1664 return -1;
1678 } else { 1665 } else {
1679 css = cso + skb->csum_offset; 1666 css = cso + skb->csum_offset;
@@ -1886,8 +1873,8 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
1886 adapter->have_msi = true; 1873 adapter->have_msi = true;
1887 err = pci_enable_msi(adapter->pdev); 1874 err = pci_enable_msi(adapter->pdev);
1888 if (err) { 1875 if (err) {
1889 dev_dbg(&pdev->dev, 1876 netdev_dbg(adapter->netdev,
1890 "Unable to allocate MSI interrupt Error: %d\n", err); 1877 "Unable to allocate MSI interrupt Error: %d\n", err);
1891 adapter->have_msi = false; 1878 adapter->have_msi = false;
1892 } else 1879 } else
1893 netdev->irq = pdev->irq; 1880 netdev->irq = pdev->irq;
@@ -1898,13 +1885,13 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
1898 err = request_irq(adapter->pdev->irq, atl1e_intr, flags, 1885 err = request_irq(adapter->pdev->irq, atl1e_intr, flags,
1899 netdev->name, netdev); 1886 netdev->name, netdev);
1900 if (err) { 1887 if (err) {
1901 dev_dbg(&pdev->dev, 1888 netdev_dbg(adapter->netdev,
1902 "Unable to allocate interrupt Error: %d\n", err); 1889 "Unable to allocate interrupt Error: %d\n", err);
1903 if (adapter->have_msi) 1890 if (adapter->have_msi)
1904 pci_disable_msi(adapter->pdev); 1891 pci_disable_msi(adapter->pdev);
1905 return err; 1892 return err;
1906 } 1893 }
1907 dev_dbg(&pdev->dev, "atl1e_request_irq OK\n"); 1894 netdev_dbg(adapter->netdev, "atl1e_request_irq OK\n");
1908 return err; 1895 return err;
1909} 1896}
1910 1897
@@ -2078,7 +2065,7 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2078 (atl1e_write_phy_reg(hw, 2065 (atl1e_write_phy_reg(hw,
2079 MII_ADVERTISE, mii_advertise_data) != 0) || 2066 MII_ADVERTISE, mii_advertise_data) != 0) ||
2080 (atl1e_phy_commit(hw)) != 0) { 2067 (atl1e_phy_commit(hw)) != 0) {
2081 dev_dbg(&pdev->dev, "set phy register failed\n"); 2068 netdev_dbg(adapter->netdev, "set phy register failed\n");
2082 goto wol_dis; 2069 goto wol_dis;
2083 } 2070 }
2084 2071
@@ -2100,17 +2087,14 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2100 } 2087 }
2101 2088
2102 if ((mii_bmsr_data & BMSR_LSTATUS) == 0) 2089 if ((mii_bmsr_data & BMSR_LSTATUS) == 0)
2103 dev_dbg(&pdev->dev, 2090 netdev_dbg(adapter->netdev,
2104 "%s: Link may change" 2091 "Link may change when suspend\n");
2105 "when suspend\n",
2106 atl1e_driver_name);
2107 } 2092 }
2108 wol_ctrl_data |= WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN; 2093 wol_ctrl_data |= WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
2109 /* only link up can wake up */ 2094 /* only link up can wake up */
2110 if (atl1e_write_phy_reg(hw, MII_INT_CTRL, 0x400) != 0) { 2095 if (atl1e_write_phy_reg(hw, MII_INT_CTRL, 0x400) != 0) {
2111 dev_dbg(&pdev->dev, "%s: read write phy " 2096 netdev_dbg(adapter->netdev,
2112 "register failed.\n", 2097 "read write phy register failed\n");
2113 atl1e_driver_name);
2114 goto wol_dis; 2098 goto wol_dis;
2115 } 2099 }
2116 } 2100 }
@@ -2131,9 +2115,8 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2131 if (wufc & AT_WUFC_MAG) 2115 if (wufc & AT_WUFC_MAG)
2132 mac_ctrl_data |= MAC_CTRL_BC_EN; 2116 mac_ctrl_data |= MAC_CTRL_BC_EN;
2133 2117
2134 dev_dbg(&pdev->dev, 2118 netdev_dbg(adapter->netdev, "suspend MAC=0x%x\n",
2135 "%s: suspend MAC=0x%x\n", 2119 mac_ctrl_data);
2136 atl1e_driver_name, mac_ctrl_data);
2137 2120
2138 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); 2121 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
2139 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); 2122 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
@@ -2183,8 +2166,8 @@ static int atl1e_resume(struct pci_dev *pdev)
2183 2166
2184 err = pci_enable_device(pdev); 2167 err = pci_enable_device(pdev);
2185 if (err) { 2168 if (err) {
2186 dev_err(&pdev->dev, "ATL1e: Cannot enable PCI" 2169 netdev_err(adapter->netdev,
2187 " device from suspend\n"); 2170 "Cannot enable PCI device from suspend\n");
2188 return err; 2171 return err;
2189 } 2172 }
2190 2173
@@ -2315,7 +2298,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2315 2298
2316 err = atl1e_init_netdev(netdev, pdev); 2299 err = atl1e_init_netdev(netdev, pdev);
2317 if (err) { 2300 if (err) {
2318 dev_err(&pdev->dev, "init netdevice failed\n"); 2301 netdev_err(netdev, "init netdevice failed\n");
2319 goto err_init_netdev; 2302 goto err_init_netdev;
2320 } 2303 }
2321 adapter = netdev_priv(netdev); 2304 adapter = netdev_priv(netdev);
@@ -2326,7 +2309,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2326 adapter->hw.hw_addr = pci_iomap(pdev, BAR_0, 0); 2309 adapter->hw.hw_addr = pci_iomap(pdev, BAR_0, 0);
2327 if (!adapter->hw.hw_addr) { 2310 if (!adapter->hw.hw_addr) {
2328 err = -EIO; 2311 err = -EIO;
2329 dev_err(&pdev->dev, "cannot map device registers\n"); 2312 netdev_err(netdev, "cannot map device registers\n");
2330 goto err_ioremap; 2313 goto err_ioremap;
2331 } 2314 }
2332 netdev->base_addr = (unsigned long)adapter->hw.hw_addr; 2315 netdev->base_addr = (unsigned long)adapter->hw.hw_addr;
@@ -2356,7 +2339,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2356 /* setup the private structure */ 2339 /* setup the private structure */
2357 err = atl1e_sw_init(adapter); 2340 err = atl1e_sw_init(adapter);
2358 if (err) { 2341 if (err) {
2359 dev_err(&pdev->dev, "net device private data init failed\n"); 2342 netdev_err(netdev, "net device private data init failed\n");
2360 goto err_sw_init; 2343 goto err_sw_init;
2361 } 2344 }
2362 2345
@@ -2372,22 +2355,19 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2372 2355
2373 if (atl1e_read_mac_addr(&adapter->hw) != 0) { 2356 if (atl1e_read_mac_addr(&adapter->hw) != 0) {
2374 err = -EIO; 2357 err = -EIO;
2375 dev_err(&pdev->dev, "get mac address failed\n"); 2358 netdev_err(netdev, "get mac address failed\n");
2376 goto err_eeprom; 2359 goto err_eeprom;
2377 } 2360 }
2378 2361
2379 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); 2362 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
2380 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); 2363 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
2381 dev_dbg(&pdev->dev, "mac address : %02x-%02x-%02x-%02x-%02x-%02x\n", 2364 netdev_dbg(netdev, "mac address : %pM\n", adapter->hw.mac_addr);
2382 adapter->hw.mac_addr[0], adapter->hw.mac_addr[1],
2383 adapter->hw.mac_addr[2], adapter->hw.mac_addr[3],
2384 adapter->hw.mac_addr[4], adapter->hw.mac_addr[5]);
2385 2365
2386 INIT_WORK(&adapter->reset_task, atl1e_reset_task); 2366 INIT_WORK(&adapter->reset_task, atl1e_reset_task);
2387 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); 2367 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task);
2388 err = register_netdev(netdev); 2368 err = register_netdev(netdev);
2389 if (err) { 2369 if (err) {
2390 dev_err(&pdev->dev, "register netdevice failed\n"); 2370 netdev_err(netdev, "register netdevice failed\n");
2391 goto err_register; 2371 goto err_register;
2392 } 2372 }
2393 2373
@@ -2488,8 +2468,8 @@ static pci_ers_result_t atl1e_io_slot_reset(struct pci_dev *pdev)
2488 struct atl1e_adapter *adapter = netdev_priv(netdev); 2468 struct atl1e_adapter *adapter = netdev_priv(netdev);
2489 2469
2490 if (pci_enable_device(pdev)) { 2470 if (pci_enable_device(pdev)) {
2491 dev_err(&pdev->dev, 2471 netdev_err(adapter->netdev,
2492 "ATL1e: Cannot re-enable PCI device after reset.\n"); 2472 "Cannot re-enable PCI device after reset\n");
2493 return PCI_ERS_RESULT_DISCONNECT; 2473 return PCI_ERS_RESULT_DISCONNECT;
2494 } 2474 }
2495 pci_set_master(pdev); 2475 pci_set_master(pdev);
@@ -2517,8 +2497,8 @@ static void atl1e_io_resume(struct pci_dev *pdev)
2517 2497
2518 if (netif_running(netdev)) { 2498 if (netif_running(netdev)) {
2519 if (atl1e_up(adapter)) { 2499 if (atl1e_up(adapter)) {
2520 dev_err(&pdev->dev, 2500 netdev_err(adapter->netdev,
2521 "ATL1e: can't bring device back up after reset\n"); 2501 "can't bring device back up after reset\n");
2522 return; 2502 return;
2523 } 2503 }
2524 } 2504 }