aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r--drivers/net/e100.c268
1 files changed, 134 insertions, 134 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 9f38b16ccbbd..134b2d60b479 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -658,12 +658,12 @@ static int e100_self_test(struct nic *nic)
658 e100_disable_irq(nic); 658 e100_disable_irq(nic);
659 659
660 /* Check results of self-test */ 660 /* Check results of self-test */
661 if(nic->mem->selftest.result != 0) { 661 if (nic->mem->selftest.result != 0) {
662 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", 662 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n",
663 nic->mem->selftest.result); 663 nic->mem->selftest.result);
664 return -ETIMEDOUT; 664 return -ETIMEDOUT;
665 } 665 }
666 if(nic->mem->selftest.signature == 0) { 666 if (nic->mem->selftest.signature == 0) {
667 DPRINTK(HW, ERR, "Self-test failed: timed out\n"); 667 DPRINTK(HW, ERR, "Self-test failed: timed out\n");
668 return -ETIMEDOUT; 668 return -ETIMEDOUT;
669 } 669 }
@@ -684,13 +684,13 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, __le16 da
684 cmd_addr_data[2] = op_ewds << (addr_len - 2); 684 cmd_addr_data[2] = op_ewds << (addr_len - 2);
685 685
686 /* Bit-bang cmds to write word to eeprom */ 686 /* Bit-bang cmds to write word to eeprom */
687 for(j = 0; j < 3; j++) { 687 for (j = 0; j < 3; j++) {
688 688
689 /* Chip select */ 689 /* Chip select */
690 iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo); 690 iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
691 e100_write_flush(nic); udelay(4); 691 e100_write_flush(nic); udelay(4);
692 692
693 for(i = 31; i >= 0; i--) { 693 for (i = 31; i >= 0; i--) {
694 ctrl = (cmd_addr_data[j] & (1 << i)) ? 694 ctrl = (cmd_addr_data[j] & (1 << i)) ?
695 eecs | eedi : eecs; 695 eecs | eedi : eecs;
696 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo); 696 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
@@ -723,7 +723,7 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
723 e100_write_flush(nic); udelay(4); 723 e100_write_flush(nic); udelay(4);
724 724
725 /* Bit-bang to read word from eeprom */ 725 /* Bit-bang to read word from eeprom */
726 for(i = 31; i >= 0; i--) { 726 for (i = 31; i >= 0; i--) {
727 ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs; 727 ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs;
728 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo); 728 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
729 e100_write_flush(nic); udelay(4); 729 e100_write_flush(nic); udelay(4);
@@ -734,7 +734,7 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
734 /* Eeprom drives a dummy zero to EEDO after receiving 734 /* Eeprom drives a dummy zero to EEDO after receiving
735 * complete address. Use this to adjust addr_len. */ 735 * complete address. Use this to adjust addr_len. */
736 ctrl = ioread8(&nic->csr->eeprom_ctrl_lo); 736 ctrl = ioread8(&nic->csr->eeprom_ctrl_lo);
737 if(!(ctrl & eedo) && i > 16) { 737 if (!(ctrl & eedo) && i > 16) {
738 *addr_len -= (i - 16); 738 *addr_len -= (i - 16);
739 i = 17; 739 i = 17;
740 } 740 }
@@ -758,9 +758,9 @@ static int e100_eeprom_load(struct nic *nic)
758 e100_eeprom_read(nic, &addr_len, 0); 758 e100_eeprom_read(nic, &addr_len, 0);
759 nic->eeprom_wc = 1 << addr_len; 759 nic->eeprom_wc = 1 << addr_len;
760 760
761 for(addr = 0; addr < nic->eeprom_wc; addr++) { 761 for (addr = 0; addr < nic->eeprom_wc; addr++) {
762 nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr); 762 nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
763 if(addr < nic->eeprom_wc - 1) 763 if (addr < nic->eeprom_wc - 1)
764 checksum += le16_to_cpu(nic->eeprom[addr]); 764 checksum += le16_to_cpu(nic->eeprom[addr]);
765 } 765 }
766 766
@@ -784,15 +784,15 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
784 e100_eeprom_read(nic, &addr_len, 0); 784 e100_eeprom_read(nic, &addr_len, 0);
785 nic->eeprom_wc = 1 << addr_len; 785 nic->eeprom_wc = 1 << addr_len;
786 786
787 if(start + count >= nic->eeprom_wc) 787 if (start + count >= nic->eeprom_wc)
788 return -EINVAL; 788 return -EINVAL;
789 789
790 for(addr = start; addr < start + count; addr++) 790 for (addr = start; addr < start + count; addr++)
791 e100_eeprom_write(nic, addr_len, addr, nic->eeprom[addr]); 791 e100_eeprom_write(nic, addr_len, addr, nic->eeprom[addr]);
792 792
793 /* The checksum, stored in the last word, is calculated such that 793 /* The checksum, stored in the last word, is calculated such that
794 * the sum of words should be 0xBABA */ 794 * the sum of words should be 0xBABA */
795 for(addr = 0; addr < nic->eeprom_wc - 1; addr++) 795 for (addr = 0; addr < nic->eeprom_wc - 1; addr++)
796 checksum += le16_to_cpu(nic->eeprom[addr]); 796 checksum += le16_to_cpu(nic->eeprom[addr]);
797 nic->eeprom[nic->eeprom_wc - 1] = cpu_to_le16(0xBABA - checksum); 797 nic->eeprom[nic->eeprom_wc - 1] = cpu_to_le16(0xBABA - checksum);
798 e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1, 798 e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1,
@@ -812,19 +812,19 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
812 spin_lock_irqsave(&nic->cmd_lock, flags); 812 spin_lock_irqsave(&nic->cmd_lock, flags);
813 813
814 /* Previous command is accepted when SCB clears */ 814 /* Previous command is accepted when SCB clears */
815 for(i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) { 815 for (i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) {
816 if(likely(!ioread8(&nic->csr->scb.cmd_lo))) 816 if (likely(!ioread8(&nic->csr->scb.cmd_lo)))
817 break; 817 break;
818 cpu_relax(); 818 cpu_relax();
819 if(unlikely(i > E100_WAIT_SCB_FAST)) 819 if (unlikely(i > E100_WAIT_SCB_FAST))
820 udelay(5); 820 udelay(5);
821 } 821 }
822 if(unlikely(i == E100_WAIT_SCB_TIMEOUT)) { 822 if (unlikely(i == E100_WAIT_SCB_TIMEOUT)) {
823 err = -EAGAIN; 823 err = -EAGAIN;
824 goto err_unlock; 824 goto err_unlock;
825 } 825 }
826 826
827 if(unlikely(cmd != cuc_resume)) 827 if (unlikely(cmd != cuc_resume))
828 iowrite32(dma_addr, &nic->csr->scb.gen_ptr); 828 iowrite32(dma_addr, &nic->csr->scb.gen_ptr);
829 iowrite8(cmd, &nic->csr->scb.cmd_lo); 829 iowrite8(cmd, &nic->csr->scb.cmd_lo);
830 830
@@ -843,7 +843,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
843 843
844 spin_lock_irqsave(&nic->cb_lock, flags); 844 spin_lock_irqsave(&nic->cb_lock, flags);
845 845
846 if(unlikely(!nic->cbs_avail)) { 846 if (unlikely(!nic->cbs_avail)) {
847 err = -ENOMEM; 847 err = -ENOMEM;
848 goto err_unlock; 848 goto err_unlock;
849 } 849 }
@@ -853,7 +853,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
853 nic->cbs_avail--; 853 nic->cbs_avail--;
854 cb->skb = skb; 854 cb->skb = skb;
855 855
856 if(unlikely(!nic->cbs_avail)) 856 if (unlikely(!nic->cbs_avail))
857 err = -ENOSPC; 857 err = -ENOSPC;
858 858
859 cb_prepare(nic, cb, skb); 859 cb_prepare(nic, cb, skb);
@@ -864,15 +864,15 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
864 wmb(); 864 wmb();
865 cb->prev->command &= cpu_to_le16(~cb_s); 865 cb->prev->command &= cpu_to_le16(~cb_s);
866 866
867 while(nic->cb_to_send != nic->cb_to_use) { 867 while (nic->cb_to_send != nic->cb_to_use) {
868 if(unlikely(e100_exec_cmd(nic, nic->cuc_cmd, 868 if (unlikely(e100_exec_cmd(nic, nic->cuc_cmd,
869 nic->cb_to_send->dma_addr))) { 869 nic->cb_to_send->dma_addr))) {
870 /* Ok, here's where things get sticky. It's 870 /* Ok, here's where things get sticky. It's
871 * possible that we can't schedule the command 871 * possible that we can't schedule the command
872 * because the controller is too busy, so 872 * because the controller is too busy, so
873 * let's just queue the command and try again 873 * let's just queue the command and try again
874 * when another command is scheduled. */ 874 * when another command is scheduled. */
875 if(err == -ENOSPC) { 875 if (err == -ENOSPC) {
876 //request a reset 876 //request a reset
877 schedule_work(&nic->tx_timeout_task); 877 schedule_work(&nic->tx_timeout_task);
878 } 878 }
@@ -945,7 +945,7 @@ static void e100_get_defaults(struct nic *nic)
945 945
946 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ 946 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */
947 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision; 947 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision;
948 if(nic->mac == mac_unknown) 948 if (nic->mac == mac_unknown)
949 nic->mac = mac_82557_D100_A; 949 nic->mac = mac_82557_D100_A;
950 950
951 nic->params.rfds = rfds; 951 nic->params.rfds = rfds;
@@ -1008,23 +1008,23 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1008 config->adaptive_ifs = nic->adaptive_ifs; 1008 config->adaptive_ifs = nic->adaptive_ifs;
1009 config->loopback = nic->loopback; 1009 config->loopback = nic->loopback;
1010 1010
1011 if(nic->mii.force_media && nic->mii.full_duplex) 1011 if (nic->mii.force_media && nic->mii.full_duplex)
1012 config->full_duplex_force = 0x1; /* 1=force, 0=auto */ 1012 config->full_duplex_force = 0x1; /* 1=force, 0=auto */
1013 1013
1014 if(nic->flags & promiscuous || nic->loopback) { 1014 if (nic->flags & promiscuous || nic->loopback) {
1015 config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ 1015 config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */
1016 config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */ 1016 config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */
1017 config->promiscuous_mode = 0x1; /* 1=on, 0=off */ 1017 config->promiscuous_mode = 0x1; /* 1=on, 0=off */
1018 } 1018 }
1019 1019
1020 if(nic->flags & multicast_all) 1020 if (nic->flags & multicast_all)
1021 config->multicast_all = 0x1; /* 1=accept, 0=no */ 1021 config->multicast_all = 0x1; /* 1=accept, 0=no */
1022 1022
1023 /* disable WoL when up */ 1023 /* disable WoL when up */
1024 if(netif_running(nic->netdev) || !(nic->flags & wol_magic)) 1024 if (netif_running(nic->netdev) || !(nic->flags & wol_magic))
1025 config->magic_packet_disable = 0x1; /* 1=off, 0=on */ 1025 config->magic_packet_disable = 0x1; /* 1=off, 0=on */
1026 1026
1027 if(nic->mac >= mac_82558_D101_A4) { 1027 if (nic->mac >= mac_82558_D101_A4) {
1028 config->fc_disable = 0x1; /* 1=Tx fc off, 0=Tx fc on */ 1028 config->fc_disable = 0x1; /* 1=Tx fc off, 0=Tx fc on */
1029 config->mwi_enable = 0x1; /* 1=enable, 0=disable */ 1029 config->mwi_enable = 0x1; /* 1=enable, 0=disable */
1030 config->standard_tcb = 0x0; /* 1=standard, 0=extended */ 1030 config->standard_tcb = 0x0; /* 1=standard, 0=extended */
@@ -1369,21 +1369,21 @@ static int e100_phy_init(struct nic *nic)
1369 u16 bmcr, stat, id_lo, id_hi, cong; 1369 u16 bmcr, stat, id_lo, id_hi, cong;
1370 1370
1371 /* Discover phy addr by searching addrs in order {1,0,2,..., 31} */ 1371 /* Discover phy addr by searching addrs in order {1,0,2,..., 31} */
1372 for(addr = 0; addr < 32; addr++) { 1372 for (addr = 0; addr < 32; addr++) {
1373 nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr; 1373 nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr;
1374 bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR); 1374 bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR);
1375 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); 1375 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);
1376 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); 1376 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);
1377 if(!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0)))) 1377 if (!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0))))
1378 break; 1378 break;
1379 } 1379 }
1380 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id); 1380 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id);
1381 if(addr == 32) 1381 if (addr == 32)
1382 return -EAGAIN; 1382 return -EAGAIN;
1383 1383
1384 /* Selected the phy and isolate the rest */ 1384 /* Selected the phy and isolate the rest */
1385 for(addr = 0; addr < 32; addr++) { 1385 for (addr = 0; addr < 32; addr++) {
1386 if(addr != nic->mii.phy_id) { 1386 if (addr != nic->mii.phy_id) {
1387 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE); 1387 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
1388 } else { 1388 } else {
1389 bmcr = mdio_read(netdev, addr, MII_BMCR); 1389 bmcr = mdio_read(netdev, addr, MII_BMCR);
@@ -1400,7 +1400,7 @@ static int e100_phy_init(struct nic *nic)
1400 1400
1401 /* Handle National tx phys */ 1401 /* Handle National tx phys */
1402#define NCS_PHY_MODEL_MASK 0xFFF0FFFF 1402#define NCS_PHY_MODEL_MASK 0xFFF0FFFF
1403 if((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) { 1403 if ((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) {
1404 /* Disable congestion control */ 1404 /* Disable congestion control */
1405 cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG); 1405 cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG);
1406 cong |= NSC_CONG_TXREADY; 1406 cong |= NSC_CONG_TXREADY;
@@ -1408,7 +1408,7 @@ static int e100_phy_init(struct nic *nic)
1408 mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong); 1408 mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong);
1409 } 1409 }
1410 1410
1411 if((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 1411 if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) &&
1412 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 1412 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) &&
1413 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { 1413 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) {
1414 /* enable/disable MDI/MDI-X auto-switching. */ 1414 /* enable/disable MDI/MDI-X auto-switching. */
@@ -1426,25 +1426,25 @@ static int e100_hw_init(struct nic *nic)
1426 e100_hw_reset(nic); 1426 e100_hw_reset(nic);
1427 1427
1428 DPRINTK(HW, ERR, "e100_hw_init\n"); 1428 DPRINTK(HW, ERR, "e100_hw_init\n");
1429 if(!in_interrupt() && (err = e100_self_test(nic))) 1429 if (!in_interrupt() && (err = e100_self_test(nic)))
1430 return err; 1430 return err;
1431 1431
1432 if((err = e100_phy_init(nic))) 1432 if ((err = e100_phy_init(nic)))
1433 return err; 1433 return err;
1434 if((err = e100_exec_cmd(nic, cuc_load_base, 0))) 1434 if ((err = e100_exec_cmd(nic, cuc_load_base, 0)))
1435 return err; 1435 return err;
1436 if((err = e100_exec_cmd(nic, ruc_load_base, 0))) 1436 if ((err = e100_exec_cmd(nic, ruc_load_base, 0)))
1437 return err; 1437 return err;
1438 if ((err = e100_exec_cb_wait(nic, NULL, e100_setup_ucode))) 1438 if ((err = e100_exec_cb_wait(nic, NULL, e100_setup_ucode)))
1439 return err; 1439 return err;
1440 if((err = e100_exec_cb(nic, NULL, e100_configure))) 1440 if ((err = e100_exec_cb(nic, NULL, e100_configure)))
1441 return err; 1441 return err;
1442 if((err = e100_exec_cb(nic, NULL, e100_setup_iaaddr))) 1442 if ((err = e100_exec_cb(nic, NULL, e100_setup_iaaddr)))
1443 return err; 1443 return err;
1444 if((err = e100_exec_cmd(nic, cuc_dump_addr, 1444 if ((err = e100_exec_cmd(nic, cuc_dump_addr,
1445 nic->dma_addr + offsetof(struct mem, stats)))) 1445 nic->dma_addr + offsetof(struct mem, stats))))
1446 return err; 1446 return err;
1447 if((err = e100_exec_cmd(nic, cuc_dump_reset, 0))) 1447 if ((err = e100_exec_cmd(nic, cuc_dump_reset, 0)))
1448 return err; 1448 return err;
1449 1449
1450 e100_disable_irq(nic); 1450 e100_disable_irq(nic);
@@ -1460,7 +1460,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1460 1460
1461 cb->command = cpu_to_le16(cb_multi); 1461 cb->command = cpu_to_le16(cb_multi);
1462 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); 1462 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
1463 for(i = 0; list && i < count; i++, list = list->next) 1463 for (i = 0; list && i < count; i++, list = list->next)
1464 memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr, 1464 memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr,
1465 ETH_ALEN); 1465 ETH_ALEN);
1466} 1466}
@@ -1472,12 +1472,12 @@ static void e100_set_multicast_list(struct net_device *netdev)
1472 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n", 1472 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n",
1473 netdev->mc_count, netdev->flags); 1473 netdev->mc_count, netdev->flags);
1474 1474
1475 if(netdev->flags & IFF_PROMISC) 1475 if (netdev->flags & IFF_PROMISC)
1476 nic->flags |= promiscuous; 1476 nic->flags |= promiscuous;
1477 else 1477 else
1478 nic->flags &= ~promiscuous; 1478 nic->flags &= ~promiscuous;
1479 1479
1480 if(netdev->flags & IFF_ALLMULTI || 1480 if (netdev->flags & IFF_ALLMULTI ||
1481 netdev->mc_count > E100_MAX_MULTICAST_ADDRS) 1481 netdev->mc_count > E100_MAX_MULTICAST_ADDRS)
1482 nic->flags |= multicast_all; 1482 nic->flags |= multicast_all;
1483 else 1483 else
@@ -1500,7 +1500,7 @@ static void e100_update_stats(struct nic *nic)
1500 * complete, so we're always waiting for results of the 1500 * complete, so we're always waiting for results of the
1501 * previous command. */ 1501 * previous command. */
1502 1502
1503 if(*complete == cpu_to_le32(cuc_dump_reset_complete)) { 1503 if (*complete == cpu_to_le32(cuc_dump_reset_complete)) {
1504 *complete = 0; 1504 *complete = 0;
1505 nic->tx_frames = le32_to_cpu(s->tx_good_frames); 1505 nic->tx_frames = le32_to_cpu(s->tx_good_frames);
1506 nic->tx_collisions = le32_to_cpu(s->tx_total_collisions); 1506 nic->tx_collisions = le32_to_cpu(s->tx_total_collisions);
@@ -1527,12 +1527,12 @@ static void e100_update_stats(struct nic *nic)
1527 le32_to_cpu(s->tx_single_collisions); 1527 le32_to_cpu(s->tx_single_collisions);
1528 nic->tx_multiple_collisions += 1528 nic->tx_multiple_collisions +=
1529 le32_to_cpu(s->tx_multiple_collisions); 1529 le32_to_cpu(s->tx_multiple_collisions);
1530 if(nic->mac >= mac_82558_D101_A4) { 1530 if (nic->mac >= mac_82558_D101_A4) {
1531 nic->tx_fc_pause += le32_to_cpu(s->fc_xmt_pause); 1531 nic->tx_fc_pause += le32_to_cpu(s->fc_xmt_pause);
1532 nic->rx_fc_pause += le32_to_cpu(s->fc_rcv_pause); 1532 nic->rx_fc_pause += le32_to_cpu(s->fc_rcv_pause);
1533 nic->rx_fc_unsupported += 1533 nic->rx_fc_unsupported +=
1534 le32_to_cpu(s->fc_rcv_unsupported); 1534 le32_to_cpu(s->fc_rcv_unsupported);
1535 if(nic->mac >= mac_82559_D101M) { 1535 if (nic->mac >= mac_82559_D101M) {
1536 nic->tx_tco_frames += 1536 nic->tx_tco_frames +=
1537 le16_to_cpu(s->xmt_tco_frames); 1537 le16_to_cpu(s->xmt_tco_frames);
1538 nic->rx_tco_frames += 1538 nic->rx_tco_frames +=
@@ -1542,7 +1542,7 @@ static void e100_update_stats(struct nic *nic)
1542 } 1542 }
1543 1543
1544 1544
1545 if(e100_exec_cmd(nic, cuc_dump_reset, 0)) 1545 if (e100_exec_cmd(nic, cuc_dump_reset, 0))
1546 DPRINTK(TX_ERR, DEBUG, "exec cuc_dump_reset failed\n"); 1546 DPRINTK(TX_ERR, DEBUG, "exec cuc_dump_reset failed\n");
1547} 1547}
1548 1548
@@ -1551,19 +1551,19 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex)
1551 /* Adjust inter-frame-spacing (IFS) between two transmits if 1551 /* Adjust inter-frame-spacing (IFS) between two transmits if
1552 * we're getting collisions on a half-duplex connection. */ 1552 * we're getting collisions on a half-duplex connection. */
1553 1553
1554 if(duplex == DUPLEX_HALF) { 1554 if (duplex == DUPLEX_HALF) {
1555 u32 prev = nic->adaptive_ifs; 1555 u32 prev = nic->adaptive_ifs;
1556 u32 min_frames = (speed == SPEED_100) ? 1000 : 100; 1556 u32 min_frames = (speed == SPEED_100) ? 1000 : 100;
1557 1557
1558 if((nic->tx_frames / 32 < nic->tx_collisions) && 1558 if ((nic->tx_frames / 32 < nic->tx_collisions) &&
1559 (nic->tx_frames > min_frames)) { 1559 (nic->tx_frames > min_frames)) {
1560 if(nic->adaptive_ifs < 60) 1560 if (nic->adaptive_ifs < 60)
1561 nic->adaptive_ifs += 5; 1561 nic->adaptive_ifs += 5;
1562 } else if (nic->tx_frames < min_frames) { 1562 } else if (nic->tx_frames < min_frames) {
1563 if(nic->adaptive_ifs >= 5) 1563 if (nic->adaptive_ifs >= 5)
1564 nic->adaptive_ifs -= 5; 1564 nic->adaptive_ifs -= 5;
1565 } 1565 }
1566 if(nic->adaptive_ifs != prev) 1566 if (nic->adaptive_ifs != prev)
1567 e100_exec_cb(nic, NULL, e100_configure); 1567 e100_exec_cb(nic, NULL, e100_configure);
1568 } 1568 }
1569} 1569}
@@ -1579,12 +1579,12 @@ static void e100_watchdog(unsigned long data)
1579 1579
1580 mii_ethtool_gset(&nic->mii, &cmd); 1580 mii_ethtool_gset(&nic->mii, &cmd);
1581 1581
1582 if(mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { 1582 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) {
1583 printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n", 1583 printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n",
1584 nic->netdev->name, 1584 nic->netdev->name,
1585 cmd.speed == SPEED_100 ? "100" : "10", 1585 cmd.speed == SPEED_100 ? "100" : "10",
1586 cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); 1586 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1587 } else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { 1587 } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
1588 printk(KERN_INFO "e100: %s NIC Link is Down\n", 1588 printk(KERN_INFO "e100: %s NIC Link is Down\n",
1589 nic->netdev->name); 1589 nic->netdev->name);
1590 } 1590 }
@@ -1604,11 +1604,11 @@ static void e100_watchdog(unsigned long data)
1604 e100_update_stats(nic); 1604 e100_update_stats(nic);
1605 e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex); 1605 e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
1606 1606
1607 if(nic->mac <= mac_82557_D100_C) 1607 if (nic->mac <= mac_82557_D100_C)
1608 /* Issue a multicast command to workaround a 557 lock up */ 1608 /* Issue a multicast command to workaround a 557 lock up */
1609 e100_set_multicast_list(nic->netdev); 1609 e100_set_multicast_list(nic->netdev);
1610 1610
1611 if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF) 1611 if (nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
1612 /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */ 1612 /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
1613 nic->flags |= ich_10h_workaround; 1613 nic->flags |= ich_10h_workaround;
1614 else 1614 else
@@ -1623,7 +1623,7 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
1623{ 1623{
1624 cb->command = nic->tx_command; 1624 cb->command = nic->tx_command;
1625 /* interrupt every 16 packets regardless of delay */ 1625 /* interrupt every 16 packets regardless of delay */
1626 if((nic->cbs_avail & ~15) == nic->cbs_avail) 1626 if ((nic->cbs_avail & ~15) == nic->cbs_avail)
1627 cb->command |= cpu_to_le16(cb_i); 1627 cb->command |= cpu_to_le16(cb_i);
1628 cb->u.tcb.tbd_array = cb->dma_addr + offsetof(struct cb, u.tcb.tbd); 1628 cb->u.tcb.tbd_array = cb->dma_addr + offsetof(struct cb, u.tcb.tbd);
1629 cb->u.tcb.tcb_byte_count = 0; 1629 cb->u.tcb.tcb_byte_count = 0;
@@ -1640,18 +1640,18 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1640 struct nic *nic = netdev_priv(netdev); 1640 struct nic *nic = netdev_priv(netdev);
1641 int err; 1641 int err;
1642 1642
1643 if(nic->flags & ich_10h_workaround) { 1643 if (nic->flags & ich_10h_workaround) {
1644 /* SW workaround for ICH[x] 10Mbps/half duplex Tx hang. 1644 /* SW workaround for ICH[x] 10Mbps/half duplex Tx hang.
1645 Issue a NOP command followed by a 1us delay before 1645 Issue a NOP command followed by a 1us delay before
1646 issuing the Tx command. */ 1646 issuing the Tx command. */
1647 if(e100_exec_cmd(nic, cuc_nop, 0)) 1647 if (e100_exec_cmd(nic, cuc_nop, 0))
1648 DPRINTK(TX_ERR, DEBUG, "exec cuc_nop failed\n"); 1648 DPRINTK(TX_ERR, DEBUG, "exec cuc_nop failed\n");
1649 udelay(1); 1649 udelay(1);
1650 } 1650 }
1651 1651
1652 err = e100_exec_cb(nic, skb, e100_xmit_prepare); 1652 err = e100_exec_cb(nic, skb, e100_xmit_prepare);
1653 1653
1654 switch(err) { 1654 switch (err) {
1655 case -ENOSPC: 1655 case -ENOSPC:
1656 /* We queued the skb, but now we're out of space. */ 1656 /* We queued the skb, but now we're out of space. */
1657 DPRINTK(TX_ERR, DEBUG, "No space for CB\n"); 1657 DPRINTK(TX_ERR, DEBUG, "No space for CB\n");
@@ -1677,14 +1677,14 @@ static int e100_tx_clean(struct nic *nic)
1677 spin_lock(&nic->cb_lock); 1677 spin_lock(&nic->cb_lock);
1678 1678
1679 /* Clean CBs marked complete */ 1679 /* Clean CBs marked complete */
1680 for(cb = nic->cb_to_clean; 1680 for (cb = nic->cb_to_clean;
1681 cb->status & cpu_to_le16(cb_complete); 1681 cb->status & cpu_to_le16(cb_complete);
1682 cb = nic->cb_to_clean = cb->next) { 1682 cb = nic->cb_to_clean = cb->next) {
1683 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n", 1683 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n",
1684 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)), 1684 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1685 cb->status); 1685 cb->status);
1686 1686
1687 if(likely(cb->skb != NULL)) { 1687 if (likely(cb->skb != NULL)) {
1688 dev->stats.tx_packets++; 1688 dev->stats.tx_packets++;
1689 dev->stats.tx_bytes += cb->skb->len; 1689 dev->stats.tx_bytes += cb->skb->len;
1690 1690
@@ -1703,7 +1703,7 @@ static int e100_tx_clean(struct nic *nic)
1703 spin_unlock(&nic->cb_lock); 1703 spin_unlock(&nic->cb_lock);
1704 1704
1705 /* Recover from running out of Tx resources in xmit_frame */ 1705 /* Recover from running out of Tx resources in xmit_frame */
1706 if(unlikely(tx_cleaned && netif_queue_stopped(nic->netdev))) 1706 if (unlikely(tx_cleaned && netif_queue_stopped(nic->netdev)))
1707 netif_wake_queue(nic->netdev); 1707 netif_wake_queue(nic->netdev);
1708 1708
1709 return tx_cleaned; 1709 return tx_cleaned;
@@ -1711,10 +1711,10 @@ static int e100_tx_clean(struct nic *nic)
1711 1711
1712static void e100_clean_cbs(struct nic *nic) 1712static void e100_clean_cbs(struct nic *nic)
1713{ 1713{
1714 if(nic->cbs) { 1714 if (nic->cbs) {
1715 while(nic->cbs_avail != nic->params.cbs.count) { 1715 while (nic->cbs_avail != nic->params.cbs.count) {
1716 struct cb *cb = nic->cb_to_clean; 1716 struct cb *cb = nic->cb_to_clean;
1717 if(cb->skb) { 1717 if (cb->skb) {
1718 pci_unmap_single(nic->pdev, 1718 pci_unmap_single(nic->pdev,
1719 le32_to_cpu(cb->u.tcb.tbd.buf_addr), 1719 le32_to_cpu(cb->u.tcb.tbd.buf_addr),
1720 le16_to_cpu(cb->u.tcb.tbd.size), 1720 le16_to_cpu(cb->u.tcb.tbd.size),
@@ -1746,10 +1746,10 @@ static int e100_alloc_cbs(struct nic *nic)
1746 1746
1747 nic->cbs = pci_alloc_consistent(nic->pdev, 1747 nic->cbs = pci_alloc_consistent(nic->pdev,
1748 sizeof(struct cb) * count, &nic->cbs_dma_addr); 1748 sizeof(struct cb) * count, &nic->cbs_dma_addr);
1749 if(!nic->cbs) 1749 if (!nic->cbs)
1750 return -ENOMEM; 1750 return -ENOMEM;
1751 1751
1752 for(cb = nic->cbs, i = 0; i < count; cb++, i++) { 1752 for (cb = nic->cbs, i = 0; i < count; cb++, i++) {
1753 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; 1753 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs;
1754 cb->prev = (i == 0) ? nic->cbs + count - 1 : cb - 1; 1754 cb->prev = (i == 0) ? nic->cbs + count - 1 : cb - 1;
1755 1755
@@ -1767,14 +1767,14 @@ static int e100_alloc_cbs(struct nic *nic)
1767 1767
1768static inline void e100_start_receiver(struct nic *nic, struct rx *rx) 1768static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
1769{ 1769{
1770 if(!nic->rxs) return; 1770 if (!nic->rxs) return;
1771 if(RU_SUSPENDED != nic->ru_running) return; 1771 if (RU_SUSPENDED != nic->ru_running) return;
1772 1772
1773 /* handle init time starts */ 1773 /* handle init time starts */
1774 if(!rx) rx = nic->rxs; 1774 if (!rx) rx = nic->rxs;
1775 1775
1776 /* (Re)start RU if suspended or idle and RFA is non-NULL */ 1776 /* (Re)start RU if suspended or idle and RFA is non-NULL */
1777 if(rx->skb) { 1777 if (rx->skb) {
1778 e100_exec_cmd(nic, ruc_start, rx->dma_addr); 1778 e100_exec_cmd(nic, ruc_start, rx->dma_addr);
1779 nic->ru_running = RU_RUNNING; 1779 nic->ru_running = RU_RUNNING;
1780 } 1780 }
@@ -1783,7 +1783,7 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
1783#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) 1783#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
1784static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) 1784static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
1785{ 1785{
1786 if(!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN))) 1786 if (!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN)))
1787 return -ENOMEM; 1787 return -ENOMEM;
1788 1788
1789 /* Align, init, and map the RFD. */ 1789 /* Align, init, and map the RFD. */
@@ -1820,7 +1820,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1820 struct rfd *rfd = (struct rfd *)skb->data; 1820 struct rfd *rfd = (struct rfd *)skb->data;
1821 u16 rfd_status, actual_size; 1821 u16 rfd_status, actual_size;
1822 1822
1823 if(unlikely(work_done && *work_done >= work_to_do)) 1823 if (unlikely(work_done && *work_done >= work_to_do))
1824 return -EAGAIN; 1824 return -EAGAIN;
1825 1825
1826 /* Need to sync before taking a peek at cb_complete bit */ 1826 /* Need to sync before taking a peek at cb_complete bit */
@@ -1847,7 +1847,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1847 1847
1848 /* Get actual data size */ 1848 /* Get actual data size */
1849 actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF; 1849 actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF;
1850 if(unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd))) 1850 if (unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd)))
1851 actual_size = RFD_BUF_LEN - sizeof(struct rfd); 1851 actual_size = RFD_BUF_LEN - sizeof(struct rfd);
1852 1852
1853 /* Get data */ 1853 /* Get data */
@@ -1872,10 +1872,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1872 skb_put(skb, actual_size); 1872 skb_put(skb, actual_size);
1873 skb->protocol = eth_type_trans(skb, nic->netdev); 1873 skb->protocol = eth_type_trans(skb, nic->netdev);
1874 1874
1875 if(unlikely(!(rfd_status & cb_ok))) { 1875 if (unlikely(!(rfd_status & cb_ok))) {
1876 /* Don't indicate if hardware indicates errors */ 1876 /* Don't indicate if hardware indicates errors */
1877 dev_kfree_skb_any(skb); 1877 dev_kfree_skb_any(skb);
1878 } else if(actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) { 1878 } else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) {
1879 /* Don't indicate oversized frames */ 1879 /* Don't indicate oversized frames */
1880 nic->rx_over_length_errors++; 1880 nic->rx_over_length_errors++;
1881 dev_kfree_skb_any(skb); 1881 dev_kfree_skb_any(skb);
@@ -1883,7 +1883,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1883 dev->stats.rx_packets++; 1883 dev->stats.rx_packets++;
1884 dev->stats.rx_bytes += actual_size; 1884 dev->stats.rx_bytes += actual_size;
1885 netif_receive_skb(skb); 1885 netif_receive_skb(skb);
1886 if(work_done) 1886 if (work_done)
1887 (*work_done)++; 1887 (*work_done)++;
1888 } 1888 }
1889 1889
@@ -1901,7 +1901,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1901 struct rfd *old_before_last_rfd, *new_before_last_rfd; 1901 struct rfd *old_before_last_rfd, *new_before_last_rfd;
1902 1902
1903 /* Indicate newly arrived packets */ 1903 /* Indicate newly arrived packets */
1904 for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { 1904 for (rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
1905 err = e100_rx_indicate(nic, rx, work_done, work_to_do); 1905 err = e100_rx_indicate(nic, rx, work_done, work_to_do);
1906 /* Hit quota or no more to clean */ 1906 /* Hit quota or no more to clean */
1907 if (-EAGAIN == err || -ENODATA == err) 1907 if (-EAGAIN == err || -ENODATA == err)
@@ -1922,8 +1922,8 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1922 old_before_last_rfd = (struct rfd *)old_before_last_rx->skb->data; 1922 old_before_last_rfd = (struct rfd *)old_before_last_rx->skb->data;
1923 1923
1924 /* Alloc new skbs to refill list */ 1924 /* Alloc new skbs to refill list */
1925 for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { 1925 for (rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
1926 if(unlikely(e100_rx_alloc_skb(nic, rx))) 1926 if (unlikely(e100_rx_alloc_skb(nic, rx)))
1927 break; /* Better luck next time (see watchdog) */ 1927 break; /* Better luck next time (see watchdog) */
1928 } 1928 }
1929 1929
@@ -1959,11 +1959,11 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1959 PCI_DMA_BIDIRECTIONAL); 1959 PCI_DMA_BIDIRECTIONAL);
1960 } 1960 }
1961 1961
1962 if(restart_required) { 1962 if (restart_required) {
1963 // ack the rnr? 1963 // ack the rnr?
1964 iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack); 1964 iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack);
1965 e100_start_receiver(nic, nic->rx_to_clean); 1965 e100_start_receiver(nic, nic->rx_to_clean);
1966 if(work_done) 1966 if (work_done)
1967 (*work_done)++; 1967 (*work_done)++;
1968 } 1968 }
1969} 1969}
@@ -1975,9 +1975,9 @@ static void e100_rx_clean_list(struct nic *nic)
1975 1975
1976 nic->ru_running = RU_UNINITIALIZED; 1976 nic->ru_running = RU_UNINITIALIZED;
1977 1977
1978 if(nic->rxs) { 1978 if (nic->rxs) {
1979 for(rx = nic->rxs, i = 0; i < count; rx++, i++) { 1979 for (rx = nic->rxs, i = 0; i < count; rx++, i++) {
1980 if(rx->skb) { 1980 if (rx->skb) {
1981 pci_unmap_single(nic->pdev, rx->dma_addr, 1981 pci_unmap_single(nic->pdev, rx->dma_addr,
1982 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); 1982 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
1983 dev_kfree_skb(rx->skb); 1983 dev_kfree_skb(rx->skb);
@@ -1999,13 +1999,13 @@ static int e100_rx_alloc_list(struct nic *nic)
1999 nic->rx_to_use = nic->rx_to_clean = NULL; 1999 nic->rx_to_use = nic->rx_to_clean = NULL;
2000 nic->ru_running = RU_UNINITIALIZED; 2000 nic->ru_running = RU_UNINITIALIZED;
2001 2001
2002 if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) 2002 if (!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
2003 return -ENOMEM; 2003 return -ENOMEM;
2004 2004
2005 for(rx = nic->rxs, i = 0; i < count; rx++, i++) { 2005 for (rx = nic->rxs, i = 0; i < count; rx++, i++) {
2006 rx->next = (i + 1 < count) ? rx + 1 : nic->rxs; 2006 rx->next = (i + 1 < count) ? rx + 1 : nic->rxs;
2007 rx->prev = (i == 0) ? nic->rxs + count - 1 : rx - 1; 2007 rx->prev = (i == 0) ? nic->rxs + count - 1 : rx - 1;
2008 if(e100_rx_alloc_skb(nic, rx)) { 2008 if (e100_rx_alloc_skb(nic, rx)) {
2009 e100_rx_clean_list(nic); 2009 e100_rx_clean_list(nic);
2010 return -ENOMEM; 2010 return -ENOMEM;
2011 } 2011 }
@@ -2038,7 +2038,7 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2038 2038
2039 DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack); 2039 DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack);
2040 2040
2041 if(stat_ack == stat_ack_not_ours || /* Not our interrupt */ 2041 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */
2042 stat_ack == stat_ack_not_present) /* Hardware is ejected */ 2042 stat_ack == stat_ack_not_present) /* Hardware is ejected */
2043 return IRQ_NONE; 2043 return IRQ_NONE;
2044 2044
@@ -2046,10 +2046,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2046 iowrite8(stat_ack, &nic->csr->scb.stat_ack); 2046 iowrite8(stat_ack, &nic->csr->scb.stat_ack);
2047 2047
2048 /* We hit Receive No Resource (RNR); restart RU after cleaning */ 2048 /* We hit Receive No Resource (RNR); restart RU after cleaning */
2049 if(stat_ack & stat_ack_rnr) 2049 if (stat_ack & stat_ack_rnr)
2050 nic->ru_running = RU_SUSPENDED; 2050 nic->ru_running = RU_SUSPENDED;
2051 2051
2052 if(likely(netif_rx_schedule_prep(&nic->napi))) { 2052 if (likely(netif_rx_schedule_prep(&nic->napi))) {
2053 e100_disable_irq(nic); 2053 e100_disable_irq(nic);
2054 __netif_rx_schedule(&nic->napi); 2054 __netif_rx_schedule(&nic->napi);
2055 } 2055 }
@@ -2102,7 +2102,7 @@ static int e100_set_mac_address(struct net_device *netdev, void *p)
2102 2102
2103static int e100_change_mtu(struct net_device *netdev, int new_mtu) 2103static int e100_change_mtu(struct net_device *netdev, int new_mtu)
2104{ 2104{
2105 if(new_mtu < ETH_ZLEN || new_mtu > ETH_DATA_LEN) 2105 if (new_mtu < ETH_ZLEN || new_mtu > ETH_DATA_LEN)
2106 return -EINVAL; 2106 return -EINVAL;
2107 netdev->mtu = new_mtu; 2107 netdev->mtu = new_mtu;
2108 return 0; 2108 return 0;
@@ -2121,16 +2121,16 @@ static int e100_up(struct nic *nic)
2121{ 2121{
2122 int err; 2122 int err;
2123 2123
2124 if((err = e100_rx_alloc_list(nic))) 2124 if ((err = e100_rx_alloc_list(nic)))
2125 return err; 2125 return err;
2126 if((err = e100_alloc_cbs(nic))) 2126 if ((err = e100_alloc_cbs(nic)))
2127 goto err_rx_clean_list; 2127 goto err_rx_clean_list;
2128 if((err = e100_hw_init(nic))) 2128 if ((err = e100_hw_init(nic)))
2129 goto err_clean_cbs; 2129 goto err_clean_cbs;
2130 e100_set_multicast_list(nic->netdev); 2130 e100_set_multicast_list(nic->netdev);
2131 e100_start_receiver(nic, NULL); 2131 e100_start_receiver(nic, NULL);
2132 mod_timer(&nic->watchdog, jiffies); 2132 mod_timer(&nic->watchdog, jiffies);
2133 if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, 2133 if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
2134 nic->netdev->name, nic->netdev))) 2134 nic->netdev->name, nic->netdev)))
2135 goto err_no_irq; 2135 goto err_no_irq;
2136 netif_wake_queue(nic->netdev); 2136 netif_wake_queue(nic->netdev);
@@ -2192,26 +2192,26 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
2192 * in loopback mode, and the test passes if the received 2192 * in loopback mode, and the test passes if the received
2193 * packet compares byte-for-byte to the transmitted packet. */ 2193 * packet compares byte-for-byte to the transmitted packet. */
2194 2194
2195 if((err = e100_rx_alloc_list(nic))) 2195 if ((err = e100_rx_alloc_list(nic)))
2196 return err; 2196 return err;
2197 if((err = e100_alloc_cbs(nic))) 2197 if ((err = e100_alloc_cbs(nic)))
2198 goto err_clean_rx; 2198 goto err_clean_rx;
2199 2199
2200 /* ICH PHY loopback is broken so do MAC loopback instead */ 2200 /* ICH PHY loopback is broken so do MAC loopback instead */
2201 if(nic->flags & ich && loopback_mode == lb_phy) 2201 if (nic->flags & ich && loopback_mode == lb_phy)
2202 loopback_mode = lb_mac; 2202 loopback_mode = lb_mac;
2203 2203
2204 nic->loopback = loopback_mode; 2204 nic->loopback = loopback_mode;
2205 if((err = e100_hw_init(nic))) 2205 if ((err = e100_hw_init(nic)))
2206 goto err_loopback_none; 2206 goto err_loopback_none;
2207 2207
2208 if(loopback_mode == lb_phy) 2208 if (loopback_mode == lb_phy)
2209 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, 2209 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
2210 BMCR_LOOPBACK); 2210 BMCR_LOOPBACK);
2211 2211
2212 e100_start_receiver(nic, NULL); 2212 e100_start_receiver(nic, NULL);
2213 2213
2214 if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { 2214 if (!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
2215 err = -ENOMEM; 2215 err = -ENOMEM;
2216 goto err_loopback_none; 2216 goto err_loopback_none;
2217 } 2217 }
@@ -2224,7 +2224,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
2224 pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr, 2224 pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr,
2225 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); 2225 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
2226 2226
2227 if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd), 2227 if (memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd),
2228 skb->data, ETH_DATA_LEN)) 2228 skb->data, ETH_DATA_LEN))
2229 err = -EAGAIN; 2229 err = -EAGAIN;
2230 2230
@@ -2301,7 +2301,7 @@ static void e100_get_regs(struct net_device *netdev,
2301 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | 2301 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 |
2302 ioread8(&nic->csr->scb.cmd_lo) << 16 | 2302 ioread8(&nic->csr->scb.cmd_lo) << 16 |
2303 ioread16(&nic->csr->scb.status); 2303 ioread16(&nic->csr->scb.status);
2304 for(i = E100_PHY_REGS; i >= 0; i--) 2304 for (i = E100_PHY_REGS; i >= 0; i--)
2305 buff[1 + E100_PHY_REGS - i] = 2305 buff[1 + E100_PHY_REGS - i] =
2306 mdio_read(netdev, nic->mii.phy_id, i); 2306 mdio_read(netdev, nic->mii.phy_id, i);
2307 memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); 2307 memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf));
@@ -2326,7 +2326,7 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2326 !device_can_wakeup(&nic->pdev->dev)) 2326 !device_can_wakeup(&nic->pdev->dev))
2327 return -EOPNOTSUPP; 2327 return -EOPNOTSUPP;
2328 2328
2329 if(wol->wolopts) 2329 if (wol->wolopts)
2330 nic->flags |= wol_magic; 2330 nic->flags |= wol_magic;
2331 else 2331 else
2332 nic->flags &= ~wol_magic; 2332 nic->flags &= ~wol_magic;
@@ -2385,7 +2385,7 @@ static int e100_set_eeprom(struct net_device *netdev,
2385{ 2385{
2386 struct nic *nic = netdev_priv(netdev); 2386 struct nic *nic = netdev_priv(netdev);
2387 2387
2388 if(eeprom->magic != E100_EEPROM_MAGIC) 2388 if (eeprom->magic != E100_EEPROM_MAGIC)
2389 return -EINVAL; 2389 return -EINVAL;
2390 2390
2391 memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len); 2391 memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len);
@@ -2421,7 +2421,7 @@ static int e100_set_ringparam(struct net_device *netdev,
2421 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 2421 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
2422 return -EINVAL; 2422 return -EINVAL;
2423 2423
2424 if(netif_running(netdev)) 2424 if (netif_running(netdev))
2425 e100_down(nic); 2425 e100_down(nic);
2426 rfds->count = max(ring->rx_pending, rfds->min); 2426 rfds->count = max(ring->rx_pending, rfds->min);
2427 rfds->count = min(rfds->count, rfds->max); 2427 rfds->count = min(rfds->count, rfds->max);
@@ -2429,7 +2429,7 @@ static int e100_set_ringparam(struct net_device *netdev,
2429 cbs->count = min(cbs->count, cbs->max); 2429 cbs->count = min(cbs->count, cbs->max);
2430 DPRINTK(DRV, INFO, "Ring Param settings: rx: %d, tx %d\n", 2430 DPRINTK(DRV, INFO, "Ring Param settings: rx: %d, tx %d\n",
2431 rfds->count, cbs->count); 2431 rfds->count, cbs->count);
2432 if(netif_running(netdev)) 2432 if (netif_running(netdev))
2433 e100_up(nic); 2433 e100_up(nic);
2434 2434
2435 return 0; 2435 return 0;
@@ -2454,12 +2454,12 @@ static void e100_diag_test(struct net_device *netdev,
2454 memset(data, 0, E100_TEST_LEN * sizeof(u64)); 2454 memset(data, 0, E100_TEST_LEN * sizeof(u64));
2455 data[0] = !mii_link_ok(&nic->mii); 2455 data[0] = !mii_link_ok(&nic->mii);
2456 data[1] = e100_eeprom_load(nic); 2456 data[1] = e100_eeprom_load(nic);
2457 if(test->flags & ETH_TEST_FL_OFFLINE) { 2457 if (test->flags & ETH_TEST_FL_OFFLINE) {
2458 2458
2459 /* save speed, duplex & autoneg settings */ 2459 /* save speed, duplex & autoneg settings */
2460 err = mii_ethtool_gset(&nic->mii, &cmd); 2460 err = mii_ethtool_gset(&nic->mii, &cmd);
2461 2461
2462 if(netif_running(netdev)) 2462 if (netif_running(netdev))
2463 e100_down(nic); 2463 e100_down(nic);
2464 data[2] = e100_self_test(nic); 2464 data[2] = e100_self_test(nic);
2465 data[3] = e100_loopback_test(nic, lb_mac); 2465 data[3] = e100_loopback_test(nic, lb_mac);
@@ -2468,10 +2468,10 @@ static void e100_diag_test(struct net_device *netdev,
2468 /* restore speed, duplex & autoneg settings */ 2468 /* restore speed, duplex & autoneg settings */
2469 err = mii_ethtool_sset(&nic->mii, &cmd); 2469 err = mii_ethtool_sset(&nic->mii, &cmd);
2470 2470
2471 if(netif_running(netdev)) 2471 if (netif_running(netdev))
2472 e100_up(nic); 2472 e100_up(nic);
2473 } 2473 }
2474 for(i = 0; i < E100_TEST_LEN; i++) 2474 for (i = 0; i < E100_TEST_LEN; i++)
2475 test->flags |= data[i] ? ETH_TEST_FL_FAILED : 0; 2475 test->flags |= data[i] ? ETH_TEST_FL_FAILED : 0;
2476 2476
2477 msleep_interruptible(4 * 1000); 2477 msleep_interruptible(4 * 1000);
@@ -2481,7 +2481,7 @@ static int e100_phys_id(struct net_device *netdev, u32 data)
2481{ 2481{
2482 struct nic *nic = netdev_priv(netdev); 2482 struct nic *nic = netdev_priv(netdev);
2483 2483
2484 if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) 2484 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
2485 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 2485 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
2486 mod_timer(&nic->blink_timer, jiffies); 2486 mod_timer(&nic->blink_timer, jiffies);
2487 msleep_interruptible(data * 1000); 2487 msleep_interruptible(data * 1000);
@@ -2524,7 +2524,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
2524 struct nic *nic = netdev_priv(netdev); 2524 struct nic *nic = netdev_priv(netdev);
2525 int i; 2525 int i;
2526 2526
2527 for(i = 0; i < E100_NET_STATS_LEN; i++) 2527 for (i = 0; i < E100_NET_STATS_LEN; i++)
2528 data[i] = ((unsigned long *)&netdev->stats)[i]; 2528 data[i] = ((unsigned long *)&netdev->stats)[i];
2529 2529
2530 data[i++] = nic->tx_deferred; 2530 data[i++] = nic->tx_deferred;
@@ -2539,7 +2539,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
2539 2539
2540static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data) 2540static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
2541{ 2541{
2542 switch(stringset) { 2542 switch (stringset) {
2543 case ETH_SS_TEST: 2543 case ETH_SS_TEST:
2544 memcpy(data, *e100_gstrings_test, sizeof(e100_gstrings_test)); 2544 memcpy(data, *e100_gstrings_test, sizeof(e100_gstrings_test));
2545 break; 2545 break;
@@ -2589,7 +2589,7 @@ static int e100_alloc(struct nic *nic)
2589 2589
2590static void e100_free(struct nic *nic) 2590static void e100_free(struct nic *nic)
2591{ 2591{
2592 if(nic->mem) { 2592 if (nic->mem) {
2593 pci_free_consistent(nic->pdev, sizeof(struct mem), 2593 pci_free_consistent(nic->pdev, sizeof(struct mem),
2594 nic->mem, nic->dma_addr); 2594 nic->mem, nic->dma_addr);
2595 nic->mem = NULL; 2595 nic->mem = NULL;
@@ -2602,7 +2602,7 @@ static int e100_open(struct net_device *netdev)
2602 int err = 0; 2602 int err = 0;
2603 2603
2604 netif_carrier_off(netdev); 2604 netif_carrier_off(netdev);
2605 if((err = e100_up(nic))) 2605 if ((err = e100_up(nic)))
2606 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n"); 2606 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n");
2607 return err; 2607 return err;
2608} 2608}
@@ -2635,8 +2635,8 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2635 struct nic *nic; 2635 struct nic *nic;
2636 int err; 2636 int err;
2637 2637
2638 if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { 2638 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) {
2639 if(((1 << debug) - 1) & NETIF_MSG_PROBE) 2639 if (((1 << debug) - 1) & NETIF_MSG_PROBE)
2640 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); 2640 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n");
2641 return -ENOMEM; 2641 return -ENOMEM;
2642 } 2642 }
@@ -2653,24 +2653,24 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2653 nic->msg_enable = (1 << debug) - 1; 2653 nic->msg_enable = (1 << debug) - 1;
2654 pci_set_drvdata(pdev, netdev); 2654 pci_set_drvdata(pdev, netdev);
2655 2655
2656 if((err = pci_enable_device(pdev))) { 2656 if ((err = pci_enable_device(pdev))) {
2657 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n"); 2657 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n");
2658 goto err_out_free_dev; 2658 goto err_out_free_dev;
2659 } 2659 }
2660 2660
2661 if(!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2661 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2662 DPRINTK(PROBE, ERR, "Cannot find proper PCI device " 2662 DPRINTK(PROBE, ERR, "Cannot find proper PCI device "
2663 "base address, aborting.\n"); 2663 "base address, aborting.\n");
2664 err = -ENODEV; 2664 err = -ENODEV;
2665 goto err_out_disable_pdev; 2665 goto err_out_disable_pdev;
2666 } 2666 }
2667 2667
2668 if((err = pci_request_regions(pdev, DRV_NAME))) { 2668 if ((err = pci_request_regions(pdev, DRV_NAME))) {
2669 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n"); 2669 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n");
2670 goto err_out_disable_pdev; 2670 goto err_out_disable_pdev;
2671 } 2671 }
2672 2672
2673 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { 2673 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
2674 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); 2674 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n");
2675 goto err_out_free_res; 2675 goto err_out_free_res;
2676 } 2676 }
@@ -2681,13 +2681,13 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2681 DPRINTK(PROBE, INFO, "using i/o access mode\n"); 2681 DPRINTK(PROBE, INFO, "using i/o access mode\n");
2682 2682
2683 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr)); 2683 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr));
2684 if(!nic->csr) { 2684 if (!nic->csr) {
2685 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n"); 2685 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n");
2686 err = -ENOMEM; 2686 err = -ENOMEM;
2687 goto err_out_free_res; 2687 goto err_out_free_res;
2688 } 2688 }
2689 2689
2690 if(ent->driver_data) 2690 if (ent->driver_data)
2691 nic->flags |= ich; 2691 nic->flags |= ich;
2692 else 2692 else
2693 nic->flags &= ~ich; 2693 nic->flags &= ~ich;
@@ -2715,12 +2715,12 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2715 2715
2716 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); 2716 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);
2717 2717
2718 if((err = e100_alloc(nic))) { 2718 if ((err = e100_alloc(nic))) {
2719 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n"); 2719 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n");
2720 goto err_out_iounmap; 2720 goto err_out_iounmap;
2721 } 2721 }
2722 2722
2723 if((err = e100_eeprom_load(nic))) 2723 if ((err = e100_eeprom_load(nic)))
2724 goto err_out_free; 2724 goto err_out_free;
2725 2725
2726 e100_phy_init(nic); 2726 e100_phy_init(nic);
@@ -2740,7 +2740,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2740 } 2740 }
2741 2741
2742 /* Wol magic packet can be enabled from eeprom */ 2742 /* Wol magic packet can be enabled from eeprom */
2743 if((nic->mac >= mac_82558_D101_A4) && 2743 if ((nic->mac >= mac_82558_D101_A4) &&
2744 (nic->eeprom[eeprom_id] & eeprom_id_wol)) { 2744 (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
2745 nic->flags |= wol_magic; 2745 nic->flags |= wol_magic;
2746 device_set_wakeup_enable(&pdev->dev, true); 2746 device_set_wakeup_enable(&pdev->dev, true);
@@ -2750,7 +2750,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2750 pci_pme_active(pdev, false); 2750 pci_pme_active(pdev, false);
2751 2751
2752 strcpy(netdev->name, "eth%d"); 2752 strcpy(netdev->name, "eth%d");
2753 if((err = register_netdev(netdev))) { 2753 if ((err = register_netdev(netdev))) {
2754 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); 2754 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
2755 goto err_out_free; 2755 goto err_out_free;
2756 } 2756 }
@@ -2779,7 +2779,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2779{ 2779{
2780 struct net_device *netdev = pci_get_drvdata(pdev); 2780 struct net_device *netdev = pci_get_drvdata(pdev);
2781 2781
2782 if(netdev) { 2782 if (netdev) {
2783 struct nic *nic = netdev_priv(netdev); 2783 struct nic *nic = netdev_priv(netdev);
2784 unregister_netdev(netdev); 2784 unregister_netdev(netdev);
2785 e100_free(nic); 2785 e100_free(nic);
@@ -2932,7 +2932,7 @@ static struct pci_driver e100_driver = {
2932 2932
2933static int __init e100_init_module(void) 2933static int __init e100_init_module(void)
2934{ 2934{
2935 if(((1 << debug) - 1) & NETIF_MSG_DRV) { 2935 if (((1 << debug) - 1) & NETIF_MSG_DRV) {
2936 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 2936 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
2937 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); 2937 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT);
2938 } 2938 }