aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/8139cp.c46
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/bonding/bond_main.c14
-rw-r--r--drivers/net/e100.c4
-rw-r--r--drivers/net/e1000/e1000_main.c1
-rw-r--r--drivers/net/ixgb/ixgb_main.c2
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/s2io.c9
-rw-r--r--drivers/net/sk98lin/skge.c12
-rw-r--r--drivers/net/skge.c290
-rw-r--r--drivers/net/skge.h4
-rw-r--r--drivers/net/spider_net.c4
-rw-r--r--drivers/net/tg3.c108
-rw-r--r--drivers/net/tulip/xircom_cb.c2
-rw-r--r--drivers/net/wan/hdlc_cisco.c2
-rw-r--r--drivers/net/wireless/airo.c5
16 files changed, 254 insertions, 255 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 34b80de34fae..bc537440ca02 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -353,8 +353,6 @@ struct cp_private {
353 353
354 struct net_device_stats net_stats; 354 struct net_device_stats net_stats;
355 struct cp_extra_stats cp_stats; 355 struct cp_extra_stats cp_stats;
356 struct cp_dma_stats *nic_stats;
357 dma_addr_t nic_stats_dma;
358 356
359 unsigned rx_tail ____cacheline_aligned; 357 unsigned rx_tail ____cacheline_aligned;
360 struct cp_desc *rx_ring; 358 struct cp_desc *rx_ring;
@@ -1143,10 +1141,6 @@ static int cp_alloc_rings (struct cp_private *cp)
1143 cp->rx_ring = mem; 1141 cp->rx_ring = mem;
1144 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE]; 1142 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE];
1145 1143
1146 mem += (CP_RING_BYTES - CP_STATS_SIZE);
1147 cp->nic_stats = mem;
1148 cp->nic_stats_dma = cp->ring_dma + (CP_RING_BYTES - CP_STATS_SIZE);
1149
1150 return cp_init_rings(cp); 1144 return cp_init_rings(cp);
1151} 1145}
1152 1146
@@ -1187,7 +1181,6 @@ static void cp_free_rings (struct cp_private *cp)
1187 pci_free_consistent(cp->pdev, CP_RING_BYTES, cp->rx_ring, cp->ring_dma); 1181 pci_free_consistent(cp->pdev, CP_RING_BYTES, cp->rx_ring, cp->ring_dma);
1188 cp->rx_ring = NULL; 1182 cp->rx_ring = NULL;
1189 cp->tx_ring = NULL; 1183 cp->tx_ring = NULL;
1190 cp->nic_stats = NULL;
1191} 1184}
1192 1185
1193static int cp_open (struct net_device *dev) 1186static int cp_open (struct net_device *dev)
@@ -1516,13 +1509,17 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1516 struct ethtool_stats *estats, u64 *tmp_stats) 1509 struct ethtool_stats *estats, u64 *tmp_stats)
1517{ 1510{
1518 struct cp_private *cp = netdev_priv(dev); 1511 struct cp_private *cp = netdev_priv(dev);
1512 struct cp_dma_stats *nic_stats;
1513 dma_addr_t dma;
1519 int i; 1514 int i;
1520 1515
1521 memset(cp->nic_stats, 0, sizeof(struct cp_dma_stats)); 1516 nic_stats = pci_alloc_consistent(cp->pdev, sizeof(*nic_stats), &dma);
1517 if (!nic_stats)
1518 return;
1522 1519
1523 /* begin NIC statistics dump */ 1520 /* begin NIC statistics dump */
1524 cpw32(StatsAddr + 4, (cp->nic_stats_dma >> 16) >> 16); 1521 cpw32(StatsAddr + 4, (u64)dma >> 32);
1525 cpw32(StatsAddr, (cp->nic_stats_dma & 0xffffffff) | DumpStats); 1522 cpw32(StatsAddr, ((u64)dma & DMA_32BIT_MASK) | DumpStats);
1526 cpr32(StatsAddr); 1523 cpr32(StatsAddr);
1527 1524
1528 for (i = 0; i < 1000; i++) { 1525 for (i = 0; i < 1000; i++) {
@@ -1532,24 +1529,27 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1532 } 1529 }
1533 cpw32(StatsAddr, 0); 1530 cpw32(StatsAddr, 0);
1534 cpw32(StatsAddr + 4, 0); 1531 cpw32(StatsAddr + 4, 0);
1532 cpr32(StatsAddr);
1535 1533
1536 i = 0; 1534 i = 0;
1537 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok); 1535 tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok);
1538 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok); 1536 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok);
1539 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err); 1537 tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err);
1540 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err); 1538 tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err);
1541 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo); 1539 tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo);
1542 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align); 1540 tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align);
1543 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col); 1541 tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col);
1544 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol); 1542 tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol);
1545 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys); 1543 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys);
1546 tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast); 1544 tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast);
1547 tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast); 1545 tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast);
1548 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort); 1546 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
1549 tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun); 1547 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
1550 tmp_stats[i++] = cp->cp_stats.rx_frags; 1548 tmp_stats[i++] = cp->cp_stats.rx_frags;
1551 if (i != CP_NUM_STATS) 1549 if (i != CP_NUM_STATS)
1552 BUG(); 1550 BUG();
1551
1552 pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma);
1553} 1553}
1554 1554
1555static struct ethtool_ops cp_ethtool_ops = { 1555static struct ethtool_ops cp_ethtool_ops = {
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 54fff9c2e802..96f14ab1c1f5 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1951,7 +1951,7 @@ config SKGE
1951 ---help--- 1951 ---help---
1952 This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx 1952 This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx
1953 and related Gigabit Ethernet adapters. It is a new smaller driver 1953 and related Gigabit Ethernet adapters. It is a new smaller driver
1954 driver with better performance and more complete ethtool support. 1954 with better performance and more complete ethtool support.
1955 1955
1956 It does not support the link failover and network management 1956 It does not support the link failover and network management
1957 features that "portable" vendor supplied sk98lin driver does. 1957 features that "portable" vendor supplied sk98lin driver does.
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 94c9f68dd16b..6d00c3de1a83 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1653,7 +1653,8 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de
1653 int old_features = bond_dev->features; 1653 int old_features = bond_dev->features;
1654 int res = 0; 1654 int res = 0;
1655 1655
1656 if (slave_dev->do_ioctl == NULL) { 1656 if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL &&
1657 slave_dev->do_ioctl == NULL) {
1657 printk(KERN_WARNING DRV_NAME 1658 printk(KERN_WARNING DRV_NAME
1658 ": Warning : no link monitoring support for %s\n", 1659 ": Warning : no link monitoring support for %s\n",
1659 slave_dev->name); 1660 slave_dev->name);
@@ -2879,6 +2880,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2879 * This target is not on a VLAN 2880 * This target is not on a VLAN
2880 */ 2881 */
2881 if (rt->u.dst.dev == bond->dev) { 2882 if (rt->u.dst.dev == bond->dev) {
2883 ip_rt_put(rt);
2882 dprintk("basa: rtdev == bond->dev: arp_send\n"); 2884 dprintk("basa: rtdev == bond->dev: arp_send\n");
2883 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 2885 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2884 bond->master_ip, 0); 2886 bond->master_ip, 0);
@@ -2898,6 +2900,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2898 } 2900 }
2899 2901
2900 if (vlan_id) { 2902 if (vlan_id) {
2903 ip_rt_put(rt);
2901 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 2904 bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
2902 vlan->vlan_ip, vlan_id); 2905 vlan->vlan_ip, vlan_id);
2903 continue; 2906 continue;
@@ -2909,6 +2912,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2909 bond->dev->name, NIPQUAD(fl.fl4_dst), 2912 bond->dev->name, NIPQUAD(fl.fl4_dst),
2910 rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); 2913 rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
2911 } 2914 }
2915 ip_rt_put(rt);
2912 } 2916 }
2913} 2917}
2914 2918
@@ -5036,6 +5040,14 @@ static int __init bonding_init(void)
5036 return 0; 5040 return 0;
5037 5041
5038out_err: 5042out_err:
5043 /*
5044 * rtnl_unlock() will run netdev_run_todo(), putting the
5045 * thus-far-registered bonding devices into a state which
5046 * unregigister_netdevice() will accept
5047 */
5048 rtnl_unlock();
5049 rtnl_lock();
5050
5039 /* free and unregister all bonds that were successfully added */ 5051 /* free and unregister all bonds that were successfully added */
5040 bond_free_all(); 5052 bond_free_all();
5041 5053
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 25cc20e415da..fbf1c06ec5c1 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1387,13 +1387,13 @@ static void e100_update_stats(struct nic *nic)
1387 ns->collisions += nic->tx_collisions; 1387 ns->collisions += nic->tx_collisions;
1388 ns->tx_errors += le32_to_cpu(s->tx_max_collisions) + 1388 ns->tx_errors += le32_to_cpu(s->tx_max_collisions) +
1389 le32_to_cpu(s->tx_lost_crs); 1389 le32_to_cpu(s->tx_lost_crs);
1390 ns->rx_dropped += le32_to_cpu(s->rx_resource_errors);
1391 ns->rx_length_errors += le32_to_cpu(s->rx_short_frame_errors) + 1390 ns->rx_length_errors += le32_to_cpu(s->rx_short_frame_errors) +
1392 nic->rx_over_length_errors; 1391 nic->rx_over_length_errors;
1393 ns->rx_crc_errors += le32_to_cpu(s->rx_crc_errors); 1392 ns->rx_crc_errors += le32_to_cpu(s->rx_crc_errors);
1394 ns->rx_frame_errors += le32_to_cpu(s->rx_alignment_errors); 1393 ns->rx_frame_errors += le32_to_cpu(s->rx_alignment_errors);
1395 ns->rx_over_errors += le32_to_cpu(s->rx_overrun_errors); 1394 ns->rx_over_errors += le32_to_cpu(s->rx_overrun_errors);
1396 ns->rx_fifo_errors += le32_to_cpu(s->rx_overrun_errors); 1395 ns->rx_fifo_errors += le32_to_cpu(s->rx_overrun_errors);
1396 ns->rx_missed_errors += le32_to_cpu(s->rx_resource_errors);
1397 ns->rx_errors += le32_to_cpu(s->rx_crc_errors) + 1397 ns->rx_errors += le32_to_cpu(s->rx_crc_errors) +
1398 le32_to_cpu(s->rx_alignment_errors) + 1398 le32_to_cpu(s->rx_alignment_errors) +
1399 le32_to_cpu(s->rx_short_frame_errors) + 1399 le32_to_cpu(s->rx_short_frame_errors) +
@@ -1727,12 +1727,10 @@ static inline int e100_rx_indicate(struct nic *nic, struct rx *rx,
1727 1727
1728 if(unlikely(!(rfd_status & cb_ok))) { 1728 if(unlikely(!(rfd_status & cb_ok))) {
1729 /* Don't indicate if hardware indicates errors */ 1729 /* Don't indicate if hardware indicates errors */
1730 nic->net_stats.rx_dropped++;
1731 dev_kfree_skb_any(skb); 1730 dev_kfree_skb_any(skb);
1732 } else if(actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) { 1731 } else if(actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) {
1733 /* Don't indicate oversized frames */ 1732 /* Don't indicate oversized frames */
1734 nic->rx_over_length_errors++; 1733 nic->rx_over_length_errors++;
1735 nic->net_stats.rx_dropped++;
1736 dev_kfree_skb_any(skb); 1734 dev_kfree_skb_any(skb);
1737 } else { 1735 } else {
1738 nic->net_stats.rx_packets++; 1736 nic->net_stats.rx_packets++;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7c8a0a22dcd5..ee687c902a20 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2544,7 +2544,6 @@ e1000_update_stats(struct e1000_adapter *adapter)
2544 adapter->stats.crcerrs + adapter->stats.algnerrc + 2544 adapter->stats.crcerrs + adapter->stats.algnerrc +
2545 adapter->stats.rlec + adapter->stats.mpc + 2545 adapter->stats.rlec + adapter->stats.mpc +
2546 adapter->stats.cexterr; 2546 adapter->stats.cexterr;
2547 adapter->net_stats.rx_dropped = adapter->stats.mpc;
2548 adapter->net_stats.rx_length_errors = adapter->stats.rlec; 2547 adapter->net_stats.rx_length_errors = adapter->stats.rlec;
2549 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 2548 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
2550 adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc; 2549 adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 5c555373adbe..89d6d69be382 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1616,8 +1616,6 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
1616 adapter->stats.icbc + 1616 adapter->stats.icbc +
1617 adapter->stats.ecbc + adapter->stats.mpc; 1617 adapter->stats.ecbc + adapter->stats.mpc;
1618 1618
1619 adapter->net_stats.rx_dropped = adapter->stats.mpc;
1620
1621 /* see above 1619 /* see above
1622 * adapter->net_stats.rx_length_errors = adapter->stats.rlec; 1620 * adapter->net_stats.rx_length_errors = adapter->stats.rlec;
1623 */ 1621 */
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index f0471d102e3c..f9223c1c5aa4 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -100,11 +100,11 @@ VERSION 2.2LK <2005/01/25>
100 100
101#ifdef CONFIG_R8169_NAPI 101#ifdef CONFIG_R8169_NAPI
102#define rtl8169_rx_skb netif_receive_skb 102#define rtl8169_rx_skb netif_receive_skb
103#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx 103#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb
104#define rtl8169_rx_quota(count, quota) min(count, quota) 104#define rtl8169_rx_quota(count, quota) min(count, quota)
105#else 105#else
106#define rtl8169_rx_skb netif_rx 106#define rtl8169_rx_skb netif_rx
107#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb 107#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx
108#define rtl8169_rx_quota(count, quota) count 108#define rtl8169_rx_quota(count, quota) count
109#endif 109#endif
110 110
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index c829e6a2e8a6..dd451e099a4c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -428,7 +428,7 @@ static int init_shared_mem(struct s2io_nic *nic)
428 DBG_PRINT(INIT_DBG, 428 DBG_PRINT(INIT_DBG,
429 "%s: Zero DMA address for TxDL. ", dev->name); 429 "%s: Zero DMA address for TxDL. ", dev->name);
430 DBG_PRINT(INIT_DBG, 430 DBG_PRINT(INIT_DBG,
431 "Virtual address %llx\n", (u64)tmp_v); 431 "Virtual address %p\n", tmp_v);
432 tmp_v = pci_alloc_consistent(nic->pdev, 432 tmp_v = pci_alloc_consistent(nic->pdev,
433 PAGE_SIZE, &tmp_p); 433 PAGE_SIZE, &tmp_p);
434 if (!tmp_v) { 434 if (!tmp_v) {
@@ -657,9 +657,10 @@ static void free_shared_mem(struct s2io_nic *nic)
657 mac_control->zerodma_virt_addr, 657 mac_control->zerodma_virt_addr,
658 (dma_addr_t)0); 658 (dma_addr_t)0);
659 DBG_PRINT(INIT_DBG, 659 DBG_PRINT(INIT_DBG,
660 "%s: Freeing TxDL with zero DMA addr. ", dev->name); 660 "%s: Freeing TxDL with zero DMA addr. ",
661 DBG_PRINT(INIT_DBG, "Virtual address %llx\n", 661 dev->name);
662 (u64)(mac_control->zerodma_virt_addr)); 662 DBG_PRINT(INIT_DBG, "Virtual address %p\n",
663 mac_control->zerodma_virt_addr);
663 } 664 }
664 kfree(mac_control->fifos[i].list_info); 665 kfree(mac_control->fifos[i].list_info);
665 } 666 }
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 6ee4771addf1..2e72d79a143c 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5216,17 +5216,15 @@ static struct pci_device_id skge_pci_tbl[] = {
5216 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5216 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5217 { PCI_VENDOR_ID_SYSKONNECT, 0x4300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5217 { PCI_VENDOR_ID_SYSKONNECT, 0x4300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5218 { PCI_VENDOR_ID_SYSKONNECT, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5218 { PCI_VENDOR_ID_SYSKONNECT, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5219 { PCI_VENDOR_ID_DLINK, 0x4c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5219/* DLink card does not have valid VPD so this driver gags
5220 * { PCI_VENDOR_ID_DLINK, 0x4c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5221 */
5220 { PCI_VENDOR_ID_MARVELL, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5222 { PCI_VENDOR_ID_MARVELL, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5221#if 0 /* don't handle Yukon2 cards at the moment -- mlindner@syskonnect.de */
5222 { PCI_VENDOR_ID_MARVELL, 0x4360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5223 { PCI_VENDOR_ID_MARVELL, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5224#endif
5225 { PCI_VENDOR_ID_MARVELL, 0x5005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5223 { PCI_VENDOR_ID_MARVELL, 0x5005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5226 { PCI_VENDOR_ID_CNET, 0x434e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5224 { PCI_VENDOR_ID_CNET, 0x434e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5227 { PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5225 { PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, 0x0015, },
5228 { PCI_VENDOR_ID_LINKSYS, 0x1064, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5226 { PCI_VENDOR_ID_LINKSYS, 0x1064, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5229 { 0, } 5227 { 0 }
5230}; 5228};
5231 5229
5232MODULE_DEVICE_TABLE(pci, skge_pci_tbl); 5230MODULE_DEVICE_TABLE(pci, skge_pci_tbl);
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index d7c98515fdfd..ae1996a3bc5c 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -42,7 +42,7 @@
42#include "skge.h" 42#include "skge.h"
43 43
44#define DRV_NAME "skge" 44#define DRV_NAME "skge"
45#define DRV_VERSION "0.9" 45#define DRV_VERSION "1.1"
46#define PFX DRV_NAME " " 46#define PFX DRV_NAME " "
47 47
48#define DEFAULT_TX_RING_SIZE 128 48#define DEFAULT_TX_RING_SIZE 128
@@ -105,41 +105,28 @@ static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
105static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; 105static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
106static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 }; 106static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 };
107 107
108/* Don't need to look at whole 16K.
109 * last interesting register is descriptor poll timer.
110 */
111#define SKGE_REGS_LEN (29*128)
112
113static int skge_get_regs_len(struct net_device *dev) 108static int skge_get_regs_len(struct net_device *dev)
114{ 109{
115 return SKGE_REGS_LEN; 110 return 0x4000;
116} 111}
117 112
118/* 113/*
119 * Returns copy of control register region 114 * Returns copy of whole control register region
120 * I/O region is divided into banks and certain regions are unreadable 115 * Note: skip RAM address register because accessing it will
116 * cause bus hangs!
121 */ 117 */
122static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, 118static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs,
123 void *p) 119 void *p)
124{ 120{
125 const struct skge_port *skge = netdev_priv(dev); 121 const struct skge_port *skge = netdev_priv(dev);
126 unsigned long offs;
127 const void __iomem *io = skge->hw->regs; 122 const void __iomem *io = skge->hw->regs;
128 static const unsigned long bankmap
129 = (1<<0) | (1<<2) | (1<<8) | (1<<9)
130 | (1<<12) | (1<<13) | (1<<14) | (1<<15) | (1<<16)
131 | (1<<17) | (1<<20) | (1<<21) | (1<<22) | (1<<23)
132 | (1<<24) | (1<<25) | (1<<26) | (1<<27) | (1<<28);
133 123
134 regs->version = 1; 124 regs->version = 1;
135 for (offs = 0; offs < regs->len; offs += 128) { 125 memset(p, 0, regs->len);
136 u32 len = min_t(u32, 128, regs->len - offs); 126 memcpy_fromio(p, io, B3_RAM_ADDR);
137 127
138 if (bankmap & (1<<(offs/128))) 128 memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1,
139 memcpy_fromio(p + offs, io + offs, len); 129 regs->len - B3_RI_WTO_R1);
140 else
141 memset(p + offs, 0, len);
142 }
143} 130}
144 131
145/* Wake on Lan only supported on Yukon chps with rev 1 or above */ 132/* Wake on Lan only supported on Yukon chps with rev 1 or above */
@@ -669,7 +656,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
669 PHY_M_LED_BLINK_RT(BLINK_84MS) | 656 PHY_M_LED_BLINK_RT(BLINK_84MS) |
670 PHY_M_LEDC_TX_CTRL | 657 PHY_M_LEDC_TX_CTRL |
671 PHY_M_LEDC_DP_CTRL); 658 PHY_M_LEDC_DP_CTRL);
672 659
673 gm_phy_write(hw, port, PHY_MARV_LED_OVER, 660 gm_phy_write(hw, port, PHY_MARV_LED_OVER,
674 PHY_M_LED_MO_RX(MO_LED_OFF) | 661 PHY_M_LED_MO_RX(MO_LED_OFF) |
675 (skge->speed == SPEED_100 ? 662 (skge->speed == SPEED_100 ?
@@ -775,17 +762,6 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base)
775 return 0; 762 return 0;
776} 763}
777 764
778static struct sk_buff *skge_rx_alloc(struct net_device *dev, unsigned int size)
779{
780 struct sk_buff *skb = dev_alloc_skb(size);
781
782 if (likely(skb)) {
783 skb->dev = dev;
784 skb_reserve(skb, NET_IP_ALIGN);
785 }
786 return skb;
787}
788
789/* Allocate and setup a new buffer for receiving */ 765/* Allocate and setup a new buffer for receiving */
790static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, 766static void skge_rx_setup(struct skge_port *skge, struct skge_element *e,
791 struct sk_buff *skb, unsigned int bufsize) 767 struct sk_buff *skb, unsigned int bufsize)
@@ -858,16 +834,17 @@ static int skge_rx_fill(struct skge_port *skge)
858{ 834{
859 struct skge_ring *ring = &skge->rx_ring; 835 struct skge_ring *ring = &skge->rx_ring;
860 struct skge_element *e; 836 struct skge_element *e;
861 unsigned int bufsize = skge->rx_buf_size;
862 837
863 e = ring->start; 838 e = ring->start;
864 do { 839 do {
865 struct sk_buff *skb = skge_rx_alloc(skge->netdev, bufsize); 840 struct sk_buff *skb;
866 841
842 skb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN);
867 if (!skb) 843 if (!skb)
868 return -ENOMEM; 844 return -ENOMEM;
869 845
870 skge_rx_setup(skge, e, skb, bufsize); 846 skb_reserve(skb, NET_IP_ALIGN);
847 skge_rx_setup(skge, e, skb, skge->rx_buf_size);
871 } while ( (e = e->next) != ring->start); 848 } while ( (e = e->next) != ring->start);
872 849
873 ring->to_clean = ring->start; 850 ring->to_clean = ring->start;
@@ -876,7 +853,7 @@ static int skge_rx_fill(struct skge_port *skge)
876 853
877static void skge_link_up(struct skge_port *skge) 854static void skge_link_up(struct skge_port *skge)
878{ 855{
879 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), 856 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG),
880 LED_BLK_OFF|LED_SYNC_OFF|LED_ON); 857 LED_BLK_OFF|LED_SYNC_OFF|LED_ON);
881 858
882 netif_carrier_on(skge->netdev); 859 netif_carrier_on(skge->netdev);
@@ -987,6 +964,8 @@ static void genesis_reset(struct skge_hw *hw, int port)
987{ 964{
988 const u8 zero[8] = { 0 }; 965 const u8 zero[8] = { 0 };
989 966
967 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
968
990 /* reset the statistics module */ 969 /* reset the statistics module */
991 xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT); 970 xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT);
992 xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */ 971 xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */
@@ -1021,8 +1000,6 @@ static void bcom_check_link(struct skge_hw *hw, int port)
1021 (void) xm_phy_read(hw, port, PHY_BCOM_STAT); 1000 (void) xm_phy_read(hw, port, PHY_BCOM_STAT);
1022 status = xm_phy_read(hw, port, PHY_BCOM_STAT); 1001 status = xm_phy_read(hw, port, PHY_BCOM_STAT);
1023 1002
1024 pr_debug("bcom_check_link status=0x%x\n", status);
1025
1026 if ((status & PHY_ST_LSYNC) == 0) { 1003 if ((status & PHY_ST_LSYNC) == 0) {
1027 u16 cmd = xm_read16(hw, port, XM_MMU_CMD); 1004 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1028 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); 1005 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
@@ -1106,8 +1083,6 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo)
1106 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 }, 1083 { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 },
1107 }; 1084 };
1108 1085
1109 pr_debug("bcom_phy_init\n");
1110
1111 /* read Id from external PHY (all have the same address) */ 1086 /* read Id from external PHY (all have the same address) */
1112 id1 = xm_phy_read(hw, port, PHY_XMAC_ID1); 1087 id1 = xm_phy_read(hw, port, PHY_XMAC_ID1);
1113 1088
@@ -1340,6 +1315,8 @@ static void genesis_stop(struct skge_port *skge)
1340 int port = skge->port; 1315 int port = skge->port;
1341 u32 reg; 1316 u32 reg;
1342 1317
1318 genesis_reset(hw, port);
1319
1343 /* Clear Tx packet arbiter timeout IRQ */ 1320 /* Clear Tx packet arbiter timeout IRQ */
1344 skge_write16(hw, B3_PA_CTRL, 1321 skge_write16(hw, B3_PA_CTRL,
1345 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); 1322 port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2);
@@ -1465,7 +1442,6 @@ static void genesis_link_up(struct skge_port *skge)
1465 u16 cmd; 1442 u16 cmd;
1466 u32 mode, msk; 1443 u32 mode, msk;
1467 1444
1468 pr_debug("genesis_link_up\n");
1469 cmd = xm_read16(hw, port, XM_MMU_CMD); 1445 cmd = xm_read16(hw, port, XM_MMU_CMD);
1470 1446
1471 /* 1447 /*
@@ -1578,7 +1554,6 @@ static void yukon_init(struct skge_hw *hw, int port)
1578 struct skge_port *skge = netdev_priv(hw->dev[port]); 1554 struct skge_port *skge = netdev_priv(hw->dev[port]);
1579 u16 ctrl, ct1000, adv; 1555 u16 ctrl, ct1000, adv;
1580 1556
1581 pr_debug("yukon_init\n");
1582 if (skge->autoneg == AUTONEG_ENABLE) { 1557 if (skge->autoneg == AUTONEG_ENABLE) {
1583 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 1558 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
1584 1559
@@ -1677,9 +1652,11 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1677 1652
1678 /* WA code for COMA mode -- set PHY reset */ 1653 /* WA code for COMA mode -- set PHY reset */
1679 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1654 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1680 hw->chip_rev >= CHIP_REV_YU_LITE_A3) 1655 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1681 skge_write32(hw, B2_GP_IO, 1656 reg = skge_read32(hw, B2_GP_IO);
1682 (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); 1657 reg |= GP_DIR_9 | GP_IO_9;
1658 skge_write32(hw, B2_GP_IO, reg);
1659 }
1683 1660
1684 /* hard reset */ 1661 /* hard reset */
1685 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 1662 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
@@ -1687,10 +1664,12 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1687 1664
1688 /* WA code for COMA mode -- clear PHY reset */ 1665 /* WA code for COMA mode -- clear PHY reset */
1689 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1666 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1690 hw->chip_rev >= CHIP_REV_YU_LITE_A3) 1667 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1691 skge_write32(hw, B2_GP_IO, 1668 reg = skge_read32(hw, B2_GP_IO);
1692 (skge_read32(hw, B2_GP_IO) | GP_DIR_9) 1669 reg |= GP_DIR_9;
1693 & ~GP_IO_9); 1670 reg &= ~GP_IO_9;
1671 skge_write32(hw, B2_GP_IO, reg);
1672 }
1694 1673
1695 /* Set hardware config mode */ 1674 /* Set hardware config mode */
1696 reg = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP | 1675 reg = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP |
@@ -1729,7 +1708,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1729 } 1708 }
1730 1709
1731 gma_write16(hw, port, GM_GP_CTRL, reg); 1710 gma_write16(hw, port, GM_GP_CTRL, reg);
1732 skge_read16(hw, GMAC_IRQ_SRC); 1711 skge_read16(hw, SK_REG(port, GMAC_IRQ_SRC));
1733 1712
1734 yukon_init(hw, port); 1713 yukon_init(hw, port);
1735 1714
@@ -1801,20 +1780,26 @@ static void yukon_stop(struct skge_port *skge)
1801 struct skge_hw *hw = skge->hw; 1780 struct skge_hw *hw = skge->hw;
1802 int port = skge->port; 1781 int port = skge->port;
1803 1782
1804 if (hw->chip_id == CHIP_ID_YUKON_LITE && 1783 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
1805 hw->chip_rev >= CHIP_REV_YU_LITE_A3) { 1784 yukon_reset(hw, port);
1806 skge_write32(hw, B2_GP_IO,
1807 skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9);
1808 }
1809 1785
1810 gma_write16(hw, port, GM_GP_CTRL, 1786 gma_write16(hw, port, GM_GP_CTRL,
1811 gma_read16(hw, port, GM_GP_CTRL) 1787 gma_read16(hw, port, GM_GP_CTRL)
1812 & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); 1788 & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA));
1813 gma_read16(hw, port, GM_GP_CTRL); 1789 gma_read16(hw, port, GM_GP_CTRL);
1814 1790
1791 if (hw->chip_id == CHIP_ID_YUKON_LITE &&
1792 hw->chip_rev >= CHIP_REV_YU_LITE_A3) {
1793 u32 io = skge_read32(hw, B2_GP_IO);
1794
1795 io |= GP_DIR_9 | GP_IO_9;
1796 skge_write32(hw, B2_GP_IO, io);
1797 skge_read32(hw, B2_GP_IO);
1798 }
1799
1815 /* set GPHY Control reset */ 1800 /* set GPHY Control reset */
1816 skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 1801 skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1817 skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET); 1802 skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET);
1818} 1803}
1819 1804
1820static void yukon_get_stats(struct skge_port *skge, u64 *data) 1805static void yukon_get_stats(struct skge_port *skge, u64 *data)
@@ -1873,10 +1858,8 @@ static void yukon_link_up(struct skge_port *skge)
1873 int port = skge->port; 1858 int port = skge->port;
1874 u16 reg; 1859 u16 reg;
1875 1860
1876 pr_debug("yukon_link_up\n");
1877
1878 /* Enable Transmit FIFO Underrun */ 1861 /* Enable Transmit FIFO Underrun */
1879 skge_write8(hw, GMAC_IRQ_MSK, GMAC_DEF_MSK); 1862 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK);
1880 1863
1881 reg = gma_read16(hw, port, GM_GP_CTRL); 1864 reg = gma_read16(hw, port, GM_GP_CTRL);
1882 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) 1865 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE)
@@ -1896,7 +1879,6 @@ static void yukon_link_down(struct skge_port *skge)
1896 int port = skge->port; 1879 int port = skge->port;
1897 u16 ctrl; 1880 u16 ctrl;
1898 1881
1899 pr_debug("yukon_link_down\n");
1900 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); 1882 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);
1901 1883
1902 ctrl = gma_read16(hw, port, GM_GP_CTRL); 1884 ctrl = gma_read16(hw, port, GM_GP_CTRL);
@@ -2112,7 +2094,6 @@ static int skge_up(struct net_device *dev)
2112 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2094 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2113 skge_led(skge, LED_MODE_ON); 2095 skge_led(skge, LED_MODE_ON);
2114 2096
2115 pr_debug("skge_up completed\n");
2116 return 0; 2097 return 0;
2117 2098
2118 free_rx_ring: 2099 free_rx_ring:
@@ -2135,15 +2116,20 @@ static int skge_down(struct net_device *dev)
2135 2116
2136 netif_stop_queue(dev); 2117 netif_stop_queue(dev);
2137 2118
2119 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
2120 if (hw->chip_id == CHIP_ID_GENESIS)
2121 genesis_stop(skge);
2122 else
2123 yukon_stop(skge);
2124
2125 hw->intr_mask &= ~portirqmask[skge->port];
2126 skge_write32(hw, B0_IMSK, hw->intr_mask);
2127
2138 /* Stop transmitter */ 2128 /* Stop transmitter */
2139 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); 2129 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP);
2140 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), 2130 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL),
2141 RB_RST_SET|RB_DIS_OP_MD); 2131 RB_RST_SET|RB_DIS_OP_MD);
2142 2132
2143 if (hw->chip_id == CHIP_ID_GENESIS)
2144 genesis_stop(skge);
2145 else
2146 yukon_stop(skge);
2147 2133
2148 /* Disable Force Sync bit and Enable Alloc bit */ 2134 /* Disable Force Sync bit and Enable Alloc bit */
2149 skge_write8(hw, SK_REG(port, TXA_CTRL), 2135 skge_write8(hw, SK_REG(port, TXA_CTRL),
@@ -2367,8 +2353,6 @@ static void genesis_set_multicast(struct net_device *dev)
2367 u32 mode; 2353 u32 mode;
2368 u8 filter[8]; 2354 u8 filter[8];
2369 2355
2370 pr_debug("genesis_set_multicast flags=%x count=%d\n", dev->flags, dev->mc_count);
2371
2372 mode = xm_read32(hw, port, XM_MODE); 2356 mode = xm_read32(hw, port, XM_MODE);
2373 mode |= XM_MD_ENA_HASH; 2357 mode |= XM_MD_ENA_HASH;
2374 if (dev->flags & IFF_PROMISC) 2358 if (dev->flags & IFF_PROMISC)
@@ -2435,6 +2419,14 @@ static void yukon_set_multicast(struct net_device *dev)
2435 gma_write16(hw, port, GM_RX_CTRL, reg); 2419 gma_write16(hw, port, GM_RX_CTRL, reg);
2436} 2420}
2437 2421
2422static inline u16 phy_length(const struct skge_hw *hw, u32 status)
2423{
2424 if (hw->chip_id == CHIP_ID_GENESIS)
2425 return status >> XMR_FS_LEN_SHIFT;
2426 else
2427 return status >> GMR_FS_LEN_SHIFT;
2428}
2429
2438static inline int bad_phy_status(const struct skge_hw *hw, u32 status) 2430static inline int bad_phy_status(const struct skge_hw *hw, u32 status)
2439{ 2431{
2440 if (hw->chip_id == CHIP_ID_GENESIS) 2432 if (hw->chip_id == CHIP_ID_GENESIS)
@@ -2444,80 +2436,99 @@ static inline int bad_phy_status(const struct skge_hw *hw, u32 status)
2444 (status & GMR_FS_RX_OK) == 0; 2436 (status & GMR_FS_RX_OK) == 0;
2445} 2437}
2446 2438
2447static void skge_rx_error(struct skge_port *skge, int slot,
2448 u32 control, u32 status)
2449{
2450 if (netif_msg_rx_err(skge))
2451 printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n",
2452 skge->netdev->name, slot, control, status);
2453
2454 if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF))
2455 skge->net_stats.rx_length_errors++;
2456 else if (skge->hw->chip_id == CHIP_ID_GENESIS) {
2457 if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR))
2458 skge->net_stats.rx_length_errors++;
2459 if (status & XMR_FS_FRA_ERR)
2460 skge->net_stats.rx_frame_errors++;
2461 if (status & XMR_FS_FCS_ERR)
2462 skge->net_stats.rx_crc_errors++;
2463 } else {
2464 if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE))
2465 skge->net_stats.rx_length_errors++;
2466 if (status & GMR_FS_FRAGMENT)
2467 skge->net_stats.rx_frame_errors++;
2468 if (status & GMR_FS_CRC_ERR)
2469 skge->net_stats.rx_crc_errors++;
2470 }
2471}
2472 2439
2473/* Get receive buffer from descriptor. 2440/* Get receive buffer from descriptor.
2474 * Handles copy of small buffers and reallocation failures 2441 * Handles copy of small buffers and reallocation failures
2475 */ 2442 */
2476static inline struct sk_buff *skge_rx_get(struct skge_port *skge, 2443static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
2477 struct skge_element *e, 2444 struct skge_element *e,
2478 unsigned int len) 2445 u32 control, u32 status, u16 csum)
2479{ 2446{
2480 struct sk_buff *nskb, *skb; 2447 struct sk_buff *skb;
2448 u16 len = control & BMU_BBC;
2449
2450 if (unlikely(netif_msg_rx_status(skge)))
2451 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n",
2452 skge->netdev->name, e - skge->rx_ring.start,
2453 status, len);
2454
2455 if (len > skge->rx_buf_size)
2456 goto error;
2457
2458 if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF))
2459 goto error;
2460
2461 if (bad_phy_status(skge->hw, status))
2462 goto error;
2463
2464 if (phy_length(skge->hw, status) != len)
2465 goto error;
2481 2466
2482 if (len < RX_COPY_THRESHOLD) { 2467 if (len < RX_COPY_THRESHOLD) {
2483 nskb = skge_rx_alloc(skge->netdev, len + NET_IP_ALIGN); 2468 skb = dev_alloc_skb(len + 2);
2484 if (unlikely(!nskb)) 2469 if (!skb)
2485 return NULL; 2470 goto resubmit;
2486 2471
2472 skb_reserve(skb, 2);
2487 pci_dma_sync_single_for_cpu(skge->hw->pdev, 2473 pci_dma_sync_single_for_cpu(skge->hw->pdev,
2488 pci_unmap_addr(e, mapaddr), 2474 pci_unmap_addr(e, mapaddr),
2489 len, PCI_DMA_FROMDEVICE); 2475 len, PCI_DMA_FROMDEVICE);
2490 memcpy(nskb->data, e->skb->data, len); 2476 memcpy(skb->data, e->skb->data, len);
2491 pci_dma_sync_single_for_device(skge->hw->pdev, 2477 pci_dma_sync_single_for_device(skge->hw->pdev,
2492 pci_unmap_addr(e, mapaddr), 2478 pci_unmap_addr(e, mapaddr),
2493 len, PCI_DMA_FROMDEVICE); 2479 len, PCI_DMA_FROMDEVICE);
2494
2495 if (skge->rx_csum) {
2496 struct skge_rx_desc *rd = e->desc;
2497 nskb->csum = le16_to_cpu(rd->csum2);
2498 nskb->ip_summed = CHECKSUM_HW;
2499 }
2500 skge_rx_reuse(e, skge->rx_buf_size); 2480 skge_rx_reuse(e, skge->rx_buf_size);
2501 return nskb;
2502 } else { 2481 } else {
2503 nskb = skge_rx_alloc(skge->netdev, skge->rx_buf_size); 2482 struct sk_buff *nskb;
2504 if (unlikely(!nskb)) 2483 nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN);
2505 return NULL; 2484 if (!nskb)
2485 goto resubmit;
2506 2486
2507 pci_unmap_single(skge->hw->pdev, 2487 pci_unmap_single(skge->hw->pdev,
2508 pci_unmap_addr(e, mapaddr), 2488 pci_unmap_addr(e, mapaddr),
2509 pci_unmap_len(e, maplen), 2489 pci_unmap_len(e, maplen),
2510 PCI_DMA_FROMDEVICE); 2490 PCI_DMA_FROMDEVICE);
2511 skb = e->skb; 2491 skb = e->skb;
2512 if (skge->rx_csum) { 2492 prefetch(skb->data);
2513 struct skge_rx_desc *rd = e->desc;
2514 skb->csum = le16_to_cpu(rd->csum2);
2515 skb->ip_summed = CHECKSUM_HW;
2516 }
2517
2518 skge_rx_setup(skge, e, nskb, skge->rx_buf_size); 2493 skge_rx_setup(skge, e, nskb, skge->rx_buf_size);
2519 return skb;
2520 } 2494 }
2495
2496 skb_put(skb, len);
2497 skb->dev = skge->netdev;
2498 if (skge->rx_csum) {
2499 skb->csum = csum;
2500 skb->ip_summed = CHECKSUM_HW;
2501 }
2502
2503 skb->protocol = eth_type_trans(skb, skge->netdev);
2504
2505 return skb;
2506error:
2507
2508 if (netif_msg_rx_err(skge))
2509 printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n",
2510 skge->netdev->name, e - skge->rx_ring.start,
2511 control, status);
2512
2513 if (skge->hw->chip_id == CHIP_ID_GENESIS) {
2514 if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR))
2515 skge->net_stats.rx_length_errors++;
2516 if (status & XMR_FS_FRA_ERR)
2517 skge->net_stats.rx_frame_errors++;
2518 if (status & XMR_FS_FCS_ERR)
2519 skge->net_stats.rx_crc_errors++;
2520 } else {
2521 if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE))
2522 skge->net_stats.rx_length_errors++;
2523 if (status & GMR_FS_FRAGMENT)
2524 skge->net_stats.rx_frame_errors++;
2525 if (status & GMR_FS_CRC_ERR)
2526 skge->net_stats.rx_crc_errors++;
2527 }
2528
2529resubmit:
2530 skge_rx_reuse(e, skge->rx_buf_size);
2531 return NULL;
2521} 2532}
2522 2533
2523 2534
@@ -2530,37 +2541,19 @@ static int skge_poll(struct net_device *dev, int *budget)
2530 unsigned int to_do = min(dev->quota, *budget); 2541 unsigned int to_do = min(dev->quota, *budget);
2531 unsigned int work_done = 0; 2542 unsigned int work_done = 0;
2532 2543
2533 pr_debug("skge_poll\n");
2534
2535 for (e = ring->to_clean; work_done < to_do; e = e->next) { 2544 for (e = ring->to_clean; work_done < to_do; e = e->next) {
2536 struct skge_rx_desc *rd = e->desc; 2545 struct skge_rx_desc *rd = e->desc;
2537 struct sk_buff *skb; 2546 struct sk_buff *skb;
2538 u32 control, len, status; 2547 u32 control;
2539 2548
2540 rmb(); 2549 rmb();
2541 control = rd->control; 2550 control = rd->control;
2542 if (control & BMU_OWN) 2551 if (control & BMU_OWN)
2543 break; 2552 break;
2544 2553
2545 len = control & BMU_BBC; 2554 skb = skge_rx_get(skge, e, control, rd->status,
2546 status = rd->status; 2555 le16_to_cpu(rd->csum2));
2547
2548 if (unlikely((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF)
2549 || bad_phy_status(hw, status))) {
2550 skge_rx_error(skge, e - ring->start, control, status);
2551 skge_rx_reuse(e, skge->rx_buf_size);
2552 continue;
2553 }
2554
2555 if (netif_msg_rx_status(skge))
2556 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n",
2557 dev->name, e - ring->start, rd->status, len);
2558
2559 skb = skge_rx_get(skge, e, len);
2560 if (likely(skb)) { 2556 if (likely(skb)) {
2561 skb_put(skb, len);
2562 skb->protocol = eth_type_trans(skb, dev);
2563
2564 dev->last_rx = jiffies; 2557 dev->last_rx = jiffies;
2565 netif_receive_skb(skb); 2558 netif_receive_skb(skb);
2566 2559
@@ -2672,9 +2665,9 @@ static void skge_error_irq(struct skge_hw *hw)
2672 if (hw->chip_id == CHIP_ID_GENESIS) { 2665 if (hw->chip_id == CHIP_ID_GENESIS) {
2673 /* clear xmac errors */ 2666 /* clear xmac errors */
2674 if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1)) 2667 if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1))
2675 skge_write16(hw, SK_REG(0, RX_MFF_CTRL1), MFF_CLR_INSTAT); 2668 skge_write16(hw, RX_MFF_CTRL1, MFF_CLR_INSTAT);
2676 if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2)) 2669 if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2))
2677 skge_write16(hw, SK_REG(0, RX_MFF_CTRL2), MFF_CLR_INSTAT); 2670 skge_write16(hw, RX_MFF_CTRL2, MFF_CLR_INSTAT);
2678 } else { 2671 } else {
2679 /* Timestamp (unused) overflow */ 2672 /* Timestamp (unused) overflow */
2680 if (hwstatus & IS_IRQ_TIST_OV) 2673 if (hwstatus & IS_IRQ_TIST_OV)
@@ -3000,9 +2993,6 @@ static int skge_reset(struct skge_hw *hw)
3000 2993
3001 skge_write32(hw, B0_IMSK, hw->intr_mask); 2994 skge_write32(hw, B0_IMSK, hw->intr_mask);
3002 2995
3003 if (hw->chip_id != CHIP_ID_GENESIS)
3004 skge_write8(hw, GMAC_IRQ_MSK, 0);
3005
3006 spin_lock_bh(&hw->phy_lock); 2996 spin_lock_bh(&hw->phy_lock);
3007 for (i = 0; i < hw->ports; i++) { 2997 for (i = 0; i < hw->ports; i++) {
3008 if (hw->chip_id == CHIP_ID_GENESIS) 2998 if (hw->chip_id == CHIP_ID_GENESIS)
@@ -3230,6 +3220,11 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3230 dev0 = hw->dev[0]; 3220 dev0 = hw->dev[0];
3231 unregister_netdev(dev0); 3221 unregister_netdev(dev0);
3232 3222
3223 skge_write32(hw, B0_IMSK, 0);
3224 skge_write16(hw, B0_LED, LED_STAT_OFF);
3225 skge_pci_clear(hw);
3226 skge_write8(hw, B0_CTST, CS_RST_SET);
3227
3233 tasklet_kill(&hw->ext_tasklet); 3228 tasklet_kill(&hw->ext_tasklet);
3234 3229
3235 free_irq(pdev->irq, hw); 3230 free_irq(pdev->irq, hw);
@@ -3238,7 +3233,7 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3238 if (dev1) 3233 if (dev1)
3239 free_netdev(dev1); 3234 free_netdev(dev1);
3240 free_netdev(dev0); 3235 free_netdev(dev0);
3241 skge_write16(hw, B0_LED, LED_STAT_OFF); 3236
3242 iounmap(hw->regs); 3237 iounmap(hw->regs);
3243 kfree(hw); 3238 kfree(hw);
3244 pci_set_drvdata(pdev, NULL); 3239 pci_set_drvdata(pdev, NULL);
@@ -3257,7 +3252,10 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
3257 struct skge_port *skge = netdev_priv(dev); 3252 struct skge_port *skge = netdev_priv(dev);
3258 if (netif_running(dev)) { 3253 if (netif_running(dev)) {
3259 netif_carrier_off(dev); 3254 netif_carrier_off(dev);
3260 skge_down(dev); 3255 if (skge->wol)
3256 netif_stop_queue(dev);
3257 else
3258 skge_down(dev);
3261 } 3259 }
3262 netif_device_detach(dev); 3260 netif_device_detach(dev);
3263 wol |= skge->wol; 3261 wol |= skge->wol;
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index f1680beb8e68..72c175b87a5a 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -953,6 +953,7 @@ enum {
953 */ 953 */
954enum { 954enum {
955 XMR_FS_LEN = 0x3fff<<18, /* Bit 31..18: Rx Frame Length */ 955 XMR_FS_LEN = 0x3fff<<18, /* Bit 31..18: Rx Frame Length */
956 XMR_FS_LEN_SHIFT = 18,
956 XMR_FS_2L_VLAN = 1<<17, /* Bit 17: tagged wh 2Lev VLAN ID*/ 957 XMR_FS_2L_VLAN = 1<<17, /* Bit 17: tagged wh 2Lev VLAN ID*/
957 XMR_FS_1_VLAN = 1<<16, /* Bit 16: tagged wh 1ev VLAN ID*/ 958 XMR_FS_1_VLAN = 1<<16, /* Bit 16: tagged wh 1ev VLAN ID*/
958 XMR_FS_BC = 1<<15, /* Bit 15: Broadcast Frame */ 959 XMR_FS_BC = 1<<15, /* Bit 15: Broadcast Frame */
@@ -1868,6 +1869,7 @@ enum {
1868/* Receive Frame Status Encoding */ 1869/* Receive Frame Status Encoding */
1869enum { 1870enum {
1870 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ 1871 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */
1872 GMR_FS_LEN_SHIFT = 16,
1871 GMR_FS_VLAN = 1<<13, /* Bit 13: VLAN Packet */ 1873 GMR_FS_VLAN = 1<<13, /* Bit 13: VLAN Packet */
1872 GMR_FS_JABBER = 1<<12, /* Bit 12: Jabber Packet */ 1874 GMR_FS_JABBER = 1<<12, /* Bit 12: Jabber Packet */
1873 GMR_FS_UN_SIZE = 1<<11, /* Bit 11: Undersize Packet */ 1875 GMR_FS_UN_SIZE = 1<<11, /* Bit 11: Undersize Packet */
@@ -2008,7 +2010,7 @@ enum {
2008 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ 2010 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
2009 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ 2011 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
2010 2012
2011#define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | GM_IS_TX_FF_UR) 2013#define GMAC_DEF_MSK (GM_IS_RX_FF_OR | GM_IS_TX_FF_UR)
2012 2014
2013/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ 2015/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
2014 /* Bits 15.. 2: reserved */ 2016 /* Bits 15.. 2: reserved */
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 4e19220473d0..c796f41b4a52 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1817,6 +1817,10 @@ spider_net_setup_phy(struct spider_net_card *card)
1817 /* LEDs active in both modes, autosense prio = fiber */ 1817 /* LEDs active in both modes, autosense prio = fiber */
1818 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f); 1818 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f);
1819 1819
1820 /* switch off fibre autoneg */
1821 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0xfc01);
1822 spider_net_write_phy(card->netdev, 1, 0x0b, 0x0004);
1823
1820 phy->def->ops->read_link(phy); 1824 phy->def->ops->read_link(phy);
1821 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name, 1825 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
1822 phy->speed, phy->duplex==1 ? "Full" : "Half"); 1826 phy->speed, phy->duplex==1 ? "Full" : "Half");
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 7599f52e15b3..81f4aedf534c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -67,8 +67,8 @@
67 67
68#define DRV_MODULE_NAME "tg3" 68#define DRV_MODULE_NAME "tg3"
69#define PFX DRV_MODULE_NAME ": " 69#define PFX DRV_MODULE_NAME ": "
70#define DRV_MODULE_VERSION "3.39" 70#define DRV_MODULE_VERSION "3.40"
71#define DRV_MODULE_RELDATE "September 5, 2005" 71#define DRV_MODULE_RELDATE "September 15, 2005"
72 72
73#define TG3_DEF_MAC_MODE 0 73#define TG3_DEF_MAC_MODE 0
74#define TG3_DEF_RX_MODE 0 74#define TG3_DEF_RX_MODE 0
@@ -3442,31 +3442,47 @@ static void tg3_tx_timeout(struct net_device *dev)
3442 schedule_work(&tp->reset_task); 3442 schedule_work(&tp->reset_task);
3443} 3443}
3444 3444
3445/* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */
3446static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
3447{
3448 u32 base = (u32) mapping & 0xffffffff;
3449
3450 return ((base > 0xffffdcc0) &&
3451 (base + len + 8 < base));
3452}
3453
3445static void tg3_set_txd(struct tg3 *, int, dma_addr_t, int, u32, u32); 3454static void tg3_set_txd(struct tg3 *, int, dma_addr_t, int, u32, u32);
3446 3455
3447static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, 3456static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
3448 u32 guilty_entry, int guilty_len, 3457 u32 last_plus_one, u32 *start,
3449 u32 last_plus_one, u32 *start, u32 mss) 3458 u32 base_flags, u32 mss)
3450{ 3459{
3451 struct sk_buff *new_skb = skb_copy(skb, GFP_ATOMIC); 3460 struct sk_buff *new_skb = skb_copy(skb, GFP_ATOMIC);
3452 dma_addr_t new_addr; 3461 dma_addr_t new_addr = 0;
3453 u32 entry = *start; 3462 u32 entry = *start;
3454 int i; 3463 int i, ret = 0;
3455 3464
3456 if (!new_skb) { 3465 if (!new_skb) {
3457 dev_kfree_skb(skb); 3466 ret = -1;
3458 return -1; 3467 } else {
3468 /* New SKB is guaranteed to be linear. */
3469 entry = *start;
3470 new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len,
3471 PCI_DMA_TODEVICE);
3472 /* Make sure new skb does not cross any 4G boundaries.
3473 * Drop the packet if it does.
3474 */
3475 if (tg3_4g_overflow_test(new_addr, new_skb->len)) {
3476 ret = -1;
3477 dev_kfree_skb(new_skb);
3478 new_skb = NULL;
3479 } else {
3480 tg3_set_txd(tp, entry, new_addr, new_skb->len,
3481 base_flags, 1 | (mss << 1));
3482 *start = NEXT_TX(entry);
3483 }
3459 } 3484 }
3460 3485
3461 /* New SKB is guaranteed to be linear. */
3462 entry = *start;
3463 new_addr = pci_map_single(tp->pdev, new_skb->data, new_skb->len,
3464 PCI_DMA_TODEVICE);
3465 tg3_set_txd(tp, entry, new_addr, new_skb->len,
3466 (skb->ip_summed == CHECKSUM_HW) ?
3467 TXD_FLAG_TCPUDP_CSUM : 0, 1 | (mss << 1));
3468 *start = NEXT_TX(entry);
3469
3470 /* Now clean up the sw ring entries. */ 3486 /* Now clean up the sw ring entries. */
3471 i = 0; 3487 i = 0;
3472 while (entry != last_plus_one) { 3488 while (entry != last_plus_one) {
@@ -3491,7 +3507,7 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
3491 3507
3492 dev_kfree_skb(skb); 3508 dev_kfree_skb(skb);
3493 3509
3494 return 0; 3510 return ret;
3495} 3511}
3496 3512
3497static void tg3_set_txd(struct tg3 *tp, int entry, 3513static void tg3_set_txd(struct tg3 *tp, int entry,
@@ -3517,19 +3533,10 @@ static void tg3_set_txd(struct tg3 *tp, int entry,
3517 txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; 3533 txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT;
3518} 3534}
3519 3535
3520static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
3521{
3522 u32 base = (u32) mapping & 0xffffffff;
3523
3524 return ((base > 0xffffdcc0) &&
3525 (base + len + 8 < base));
3526}
3527
3528static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) 3536static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3529{ 3537{
3530 struct tg3 *tp = netdev_priv(dev); 3538 struct tg3 *tp = netdev_priv(dev);
3531 dma_addr_t mapping; 3539 dma_addr_t mapping;
3532 unsigned int i;
3533 u32 len, entry, base_flags, mss; 3540 u32 len, entry, base_flags, mss;
3534 int would_hit_hwbug; 3541 int would_hit_hwbug;
3535 3542
@@ -3624,7 +3631,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3624 would_hit_hwbug = 0; 3631 would_hit_hwbug = 0;
3625 3632
3626 if (tg3_4g_overflow_test(mapping, len)) 3633 if (tg3_4g_overflow_test(mapping, len))
3627 would_hit_hwbug = entry + 1; 3634 would_hit_hwbug = 1;
3628 3635
3629 tg3_set_txd(tp, entry, mapping, len, base_flags, 3636 tg3_set_txd(tp, entry, mapping, len, base_flags,
3630 (skb_shinfo(skb)->nr_frags == 0) | (mss << 1)); 3637 (skb_shinfo(skb)->nr_frags == 0) | (mss << 1));
@@ -3648,12 +3655,8 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3648 tp->tx_buffers[entry].skb = NULL; 3655 tp->tx_buffers[entry].skb = NULL;
3649 pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, mapping); 3656 pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, mapping);
3650 3657
3651 if (tg3_4g_overflow_test(mapping, len)) { 3658 if (tg3_4g_overflow_test(mapping, len))
3652 /* Only one should match. */ 3659 would_hit_hwbug = 1;
3653 if (would_hit_hwbug)
3654 BUG();
3655 would_hit_hwbug = entry + 1;
3656 }
3657 3660
3658 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) 3661 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
3659 tg3_set_txd(tp, entry, mapping, len, 3662 tg3_set_txd(tp, entry, mapping, len,
@@ -3669,34 +3672,15 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3669 if (would_hit_hwbug) { 3672 if (would_hit_hwbug) {
3670 u32 last_plus_one = entry; 3673 u32 last_plus_one = entry;
3671 u32 start; 3674 u32 start;
3672 unsigned int len = 0;
3673
3674 would_hit_hwbug -= 1;
3675 entry = entry - 1 - skb_shinfo(skb)->nr_frags;
3676 entry &= (TG3_TX_RING_SIZE - 1);
3677 start = entry;
3678 i = 0;
3679 while (entry != last_plus_one) {
3680 if (i == 0)
3681 len = skb_headlen(skb);
3682 else
3683 len = skb_shinfo(skb)->frags[i-1].size;
3684 3675
3685 if (entry == would_hit_hwbug) 3676 start = entry - 1 - skb_shinfo(skb)->nr_frags;
3686 break; 3677 start &= (TG3_TX_RING_SIZE - 1);
3687
3688 i++;
3689 entry = NEXT_TX(entry);
3690
3691 }
3692 3678
3693 /* If the workaround fails due to memory/mapping 3679 /* If the workaround fails due to memory/mapping
3694 * failure, silently drop this packet. 3680 * failure, silently drop this packet.
3695 */ 3681 */
3696 if (tigon3_4gb_hwbug_workaround(tp, skb, 3682 if (tigon3_4gb_hwbug_workaround(tp, skb, last_plus_one,
3697 entry, len, 3683 &start, base_flags, mss))
3698 last_plus_one,
3699 &start, mss))
3700 goto out_unlock; 3684 goto out_unlock;
3701 3685
3702 entry = start; 3686 entry = start;
@@ -9271,6 +9255,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9271 static struct pci_device_id write_reorder_chipsets[] = { 9255 static struct pci_device_id write_reorder_chipsets[] = {
9272 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 9256 { PCI_DEVICE(PCI_VENDOR_ID_AMD,
9273 PCI_DEVICE_ID_AMD_FE_GATE_700C) }, 9257 PCI_DEVICE_ID_AMD_FE_GATE_700C) },
9258 { PCI_DEVICE(PCI_VENDOR_ID_AMD,
9259 PCI_DEVICE_ID_AMD_K8_NB) },
9274 { }, 9260 { },
9275 }; 9261 };
9276 u32 misc_ctrl_reg; 9262 u32 misc_ctrl_reg;
@@ -9285,7 +9271,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9285 tp->tg3_flags2 |= TG3_FLG2_SUN_570X; 9271 tp->tg3_flags2 |= TG3_FLG2_SUN_570X;
9286#endif 9272#endif
9287 9273
9288 /* If we have an AMD 762 chipset, write 9274 /* If we have an AMD 762 or K8 chipset, write
9289 * reordering to the mailbox registers done by the host 9275 * reordering to the mailbox registers done by the host
9290 * controller can cause major troubles. We read back from 9276 * controller can cause major troubles. We read back from
9291 * every mailbox register write to force the writes to be 9277 * every mailbox register write to force the writes to be
@@ -9532,7 +9518,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
9532 tp->write32_rx_mbox = tg3_write_indirect_mbox; 9518 tp->write32_rx_mbox = tg3_write_indirect_mbox;
9533 9519
9534 iounmap(tp->regs); 9520 iounmap(tp->regs);
9535 tp->regs = 0; 9521 tp->regs = NULL;
9536 9522
9537 pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd); 9523 pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd);
9538 pci_cmd &= ~PCI_COMMAND_MEMORY; 9524 pci_cmd &= ~PCI_COMMAND_MEMORY;
@@ -10680,7 +10666,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10680err_out_iounmap: 10666err_out_iounmap:
10681 if (tp->regs) { 10667 if (tp->regs) {
10682 iounmap(tp->regs); 10668 iounmap(tp->regs);
10683 tp->regs = 0; 10669 tp->regs = NULL;
10684 } 10670 }
10685 10671
10686err_out_free_dev: 10672err_out_free_dev:
@@ -10705,7 +10691,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
10705 unregister_netdev(dev); 10691 unregister_netdev(dev);
10706 if (tp->regs) { 10692 if (tp->regs) {
10707 iounmap(tp->regs); 10693 iounmap(tp->regs);
10708 tp->regs = 0; 10694 tp->regs = NULL;
10709 } 10695 }
10710 free_netdev(dev); 10696 free_netdev(dev);
10711 pci_release_regions(pdev); 10697 pci_release_regions(pdev);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 26cc4f6378c7..60d1e05ab732 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -117,7 +117,7 @@ static int xircom_open(struct net_device *dev);
117static int xircom_close(struct net_device *dev); 117static int xircom_close(struct net_device *dev);
118static void xircom_up(struct xircom_private *card); 118static void xircom_up(struct xircom_private *card);
119static struct net_device_stats *xircom_get_stats(struct net_device *dev); 119static struct net_device_stats *xircom_get_stats(struct net_device *dev);
120#if CONFIG_NET_POLL_CONTROLLER 120#ifdef CONFIG_NET_POLL_CONTROLLER
121static void xircom_poll_controller(struct net_device *dev); 121static void xircom_poll_controller(struct net_device *dev);
122#endif 122#endif
123 123
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 48c03c11cd9a..a01efa6d5c62 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -72,7 +72,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
72 } 72 }
73 skb_reserve(skb, 4); 73 skb_reserve(skb, 4);
74 cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0); 74 cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0);
75 data = (cisco_packet*)skb->data; 75 data = (cisco_packet*)(skb->data + 4);
76 76
77 data->type = htonl(type); 77 data->type = htonl(type);
78 data->par1 = htonl(par1); 78 data->par1 = htonl(par1);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 2be65d308fbe..06998c2240d9 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6852,7 +6852,10 @@ static inline char *airo_translate_scan(struct net_device *dev,
6852 /* Add frequency */ 6852 /* Add frequency */
6853 iwe.cmd = SIOCGIWFREQ; 6853 iwe.cmd = SIOCGIWFREQ;
6854 iwe.u.freq.m = le16_to_cpu(bss->dsChannel); 6854 iwe.u.freq.m = le16_to_cpu(bss->dsChannel);
6855 iwe.u.freq.m = frequency_list[iwe.u.freq.m] * 100000; 6855 /* iwe.u.freq.m containt the channel (starting 1), our
6856 * frequency_list array start at index 0...
6857 */
6858 iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000;
6856 iwe.u.freq.e = 1; 6859 iwe.u.freq.e = 1;
6857 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); 6860 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
6858 6861