aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/8139cp.c5
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/Kconfig14
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/b44.c2
-rw-r--r--drivers/net/e100.c4
-rw-r--r--drivers/net/e1000/e1000_ethtool.c1
-rw-r--r--drivers/net/e1000/e1000_main.c3
-rw-r--r--drivers/net/forcedeth.c75
-rw-r--r--drivers/net/hp100.c48
-rw-r--r--drivers/net/irda/stir4200.c7
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c8
-rw-r--r--drivers/net/ixgb/ixgb_main.c3
-rw-r--r--drivers/net/lne390.c2
-rw-r--r--drivers/net/mii.c15
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/ns83820.c3
-rw-r--r--drivers/net/pcnet32.c278
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/rionet.c574
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sundance.c2
-rw-r--r--drivers/net/tokenring/ibmtr.c9
-rw-r--r--drivers/net/tokenring/olympic.c2
-rw-r--r--drivers/net/tokenring/tms380tr.c3
-rw-r--r--drivers/net/typhoon.c7
-rw-r--r--drivers/net/via-rhine.c4
-rw-r--r--drivers/net/wan/cosa.c6
-rw-r--r--drivers/net/wan/cycx_drv.c7
-rw-r--r--drivers/net/wan/cycx_main.c2
-rw-r--r--drivers/net/wan/cycx_x25.c5
-rw-r--r--drivers/net/wan/dscc4.c23
-rw-r--r--drivers/net/wan/farsync.c27
-rw-r--r--drivers/net/wan/hdlc_fr.c2
-rw-r--r--drivers/net/wan/lmc/lmc_debug.c10
-rw-r--r--drivers/net/wan/lmc/lmc_media.c8
-rw-r--r--drivers/net/wan/pc300.h16
-rw-r--r--drivers/net/wan/pc300_drv.c87
-rw-r--r--drivers/net/wan/pc300_tty.c18
-rw-r--r--drivers/net/wan/sdla.c20
-rw-r--r--drivers/net/wan/sdla_fr.c4
-rw-r--r--drivers/net/wan/sdla_x25.c8
-rw-r--r--drivers/net/wan/sdladrv.c16
-rw-r--r--drivers/net/wan/syncppp.c10
-rw-r--r--drivers/net/wireless/atmel.c24
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c40
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c28
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c74
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.h6
-rw-r--r--drivers/net/wireless/ipw2100.c24
-rw-r--r--drivers/net/wireless/ipw2100.h2
-rw-r--r--drivers/net/wireless/ipw2200.c25
-rw-r--r--drivers/net/wireless/ipw2200.h4
-rw-r--r--drivers/net/wireless/orinoco.c141
-rw-r--r--drivers/net/wireless/orinoco.h6
-rw-r--r--drivers/net/wireless/orinoco_cs.c79
-rw-r--r--drivers/net/wireless/prism54/islpci_dev.c6
-rw-r--r--drivers/net/wireless/prism54/islpci_mgt.c5
-rw-r--r--drivers/net/wireless/ray_cs.c46
-rw-r--r--drivers/net/wireless/spectrum_cs.c28
-rw-r--r--drivers/net/wireless/wl3501.h2
61 files changed, 1279 insertions, 608 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index bc537440ca02..f822cd3025ff 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1027,8 +1027,7 @@ static void cp_reset_hw (struct cp_private *cp)
1027 if (!(cpr8(Cmd) & CmdReset)) 1027 if (!(cpr8(Cmd) & CmdReset))
1028 return; 1028 return;
1029 1029
1030 set_current_state(TASK_UNINTERRUPTIBLE); 1030 schedule_timeout_uninterruptible(10);
1031 schedule_timeout(10);
1032 } 1031 }
1033 1032
1034 printk(KERN_ERR "%s: hardware reset timeout\n", cp->dev->name); 1033 printk(KERN_ERR "%s: hardware reset timeout\n", cp->dev->name);
@@ -1575,6 +1574,7 @@ static struct ethtool_ops cp_ethtool_ops = {
1575 .set_wol = cp_set_wol, 1574 .set_wol = cp_set_wol,
1576 .get_strings = cp_get_strings, 1575 .get_strings = cp_get_strings,
1577 .get_ethtool_stats = cp_get_ethtool_stats, 1576 .get_ethtool_stats = cp_get_ethtool_stats,
1577 .get_perm_addr = ethtool_op_get_perm_addr,
1578}; 1578};
1579 1579
1580static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) 1580static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
@@ -1773,6 +1773,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1773 for (i = 0; i < 3; i++) 1773 for (i = 0; i < 3; i++)
1774 ((u16 *) (dev->dev_addr))[i] = 1774 ((u16 *) (dev->dev_addr))[i] =
1775 le16_to_cpu (read_eeprom (regs, i + 7, addr_len)); 1775 le16_to_cpu (read_eeprom (regs, i + 7, addr_len));
1776 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
1776 1777
1777 dev->open = cp_open; 1778 dev->open = cp_open;
1778 dev->stop = cp_close; 1779 dev->stop = cp_close;
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 4c2cf7bbd252..76ef6efd5950 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -970,6 +970,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
970 for (i = 0; i < 3; i++) 970 for (i = 0; i < 3; i++)
971 ((u16 *) (dev->dev_addr))[i] = 971 ((u16 *) (dev->dev_addr))[i] =
972 le16_to_cpu (read_eeprom (ioaddr, i + 7, addr_len)); 972 le16_to_cpu (read_eeprom (ioaddr, i + 7, addr_len));
973 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
973 974
974 /* The Rtl8139-specific entries in the device structure. */ 975 /* The Rtl8139-specific entries in the device structure. */
975 dev->open = rtl8139_open; 976 dev->open = rtl8139_open;
@@ -2465,6 +2466,7 @@ static struct ethtool_ops rtl8139_ethtool_ops = {
2465 .get_strings = rtl8139_get_strings, 2466 .get_strings = rtl8139_get_strings,
2466 .get_stats_count = rtl8139_get_stats_count, 2467 .get_stats_count = rtl8139_get_stats_count,
2467 .get_ethtool_stats = rtl8139_get_ethtool_stats, 2468 .get_ethtool_stats = rtl8139_get_ethtool_stats,
2469 .get_perm_addr = ethtool_op_get_perm_addr,
2468}; 2470};
2469 2471
2470static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 2472static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 96f14ab1c1f5..ff3fccd7513b 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2235,6 +2235,20 @@ config ISERIES_VETH
2235 tristate "iSeries Virtual Ethernet driver support" 2235 tristate "iSeries Virtual Ethernet driver support"
2236 depends on PPC_ISERIES 2236 depends on PPC_ISERIES
2237 2237
2238config RIONET
2239 tristate "RapidIO Ethernet over messaging driver support"
2240 depends on NETDEVICES && RAPIDIO
2241
2242config RIONET_TX_SIZE
2243 int "Number of outbound queue entries"
2244 depends on RIONET
2245 default "128"
2246
2247config RIONET_RX_SIZE
2248 int "Number of inbound queue entries"
2249 depends on RIONET
2250 default "128"
2251
2238config FDDI 2252config FDDI
2239 bool "FDDI driver support" 2253 bool "FDDI driver support"
2240 depends on (PCI || EISA) 2254 depends on (PCI || EISA)
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 8645c843cf4d..e6acba68923a 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_SKFP) += skfp/
63obj-$(CONFIG_VIA_RHINE) += via-rhine.o 63obj-$(CONFIG_VIA_RHINE) += via-rhine.o
64obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o 64obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
65obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o 65obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
66obj-$(CONFIG_RIONET) += rionet.o
66 67
67# 68#
68# end link order section 69# end link order section
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 94939f570f78..d27e870e59ab 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1676,6 +1676,7 @@ static struct ethtool_ops b44_ethtool_ops = {
1676 .set_pauseparam = b44_set_pauseparam, 1676 .set_pauseparam = b44_set_pauseparam,
1677 .get_msglevel = b44_get_msglevel, 1677 .get_msglevel = b44_get_msglevel,
1678 .set_msglevel = b44_set_msglevel, 1678 .set_msglevel = b44_set_msglevel,
1679 .get_perm_addr = ethtool_op_get_perm_addr,
1679}; 1680};
1680 1681
1681static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 1682static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
@@ -1718,6 +1719,7 @@ static int __devinit b44_get_invariants(struct b44 *bp)
1718 bp->dev->dev_addr[3] = eeprom[80]; 1719 bp->dev->dev_addr[3] = eeprom[80];
1719 bp->dev->dev_addr[4] = eeprom[83]; 1720 bp->dev->dev_addr[4] = eeprom[83];
1720 bp->dev->dev_addr[5] = eeprom[82]; 1721 bp->dev->dev_addr[5] = eeprom[82];
1722 memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len);
1721 1723
1722 bp->phy_addr = eeprom[90] & 0x1f; 1724 bp->phy_addr = eeprom[90] & 0x1f;
1723 1725
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index fbf1c06ec5c1..c15406d46418 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2389,6 +2389,7 @@ static struct ethtool_ops e100_ethtool_ops = {
2389 .phys_id = e100_phys_id, 2389 .phys_id = e100_phys_id,
2390 .get_stats_count = e100_get_stats_count, 2390 .get_stats_count = e100_get_stats_count,
2391 .get_ethtool_stats = e100_get_ethtool_stats, 2391 .get_ethtool_stats = e100_get_ethtool_stats,
2392 .get_perm_addr = ethtool_op_get_perm_addr,
2392}; 2393};
2393 2394
2394static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 2395static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
@@ -2539,7 +2540,8 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2539 e100_phy_init(nic); 2540 e100_phy_init(nic);
2540 2541
2541 memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN); 2542 memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
2542 if(!is_valid_ether_addr(netdev->dev_addr)) { 2543 memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN);
2544 if(!is_valid_ether_addr(netdev->perm_addr)) {
2543 DPRINTK(PROBE, ERR, "Invalid MAC address from " 2545 DPRINTK(PROBE, ERR, "Invalid MAC address from "
2544 "EEPROM, aborting.\n"); 2546 "EEPROM, aborting.\n");
2545 err = -EAGAIN; 2547 err = -EAGAIN;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index f133ff0b0b94..8f3a13420278 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1739,6 +1739,7 @@ struct ethtool_ops e1000_ethtool_ops = {
1739 .phys_id = e1000_phys_id, 1739 .phys_id = e1000_phys_id,
1740 .get_stats_count = e1000_get_stats_count, 1740 .get_stats_count = e1000_get_stats_count,
1741 .get_ethtool_stats = e1000_get_ethtool_stats, 1741 .get_ethtool_stats = e1000_get_ethtool_stats,
1742 .get_perm_addr = ethtool_op_get_perm_addr,
1742}; 1743};
1743 1744
1744void e1000_set_ethtool_ops(struct net_device *netdev) 1745void e1000_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ee687c902a20..c062b0ad8262 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -614,8 +614,9 @@ e1000_probe(struct pci_dev *pdev,
614 if(e1000_read_mac_addr(&adapter->hw)) 614 if(e1000_read_mac_addr(&adapter->hw))
615 DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); 615 DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
616 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); 616 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
617 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
617 618
618 if(!is_valid_ether_addr(netdev->dev_addr)) { 619 if(!is_valid_ether_addr(netdev->perm_addr)) {
619 DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); 620 DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
620 err = -EIO; 621 err = -EIO;
621 goto err_eeprom; 622 goto err_eeprom;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index d6eefdb71c17..e5f480203675 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -95,6 +95,7 @@
95 * of nv_remove 95 * of nv_remove
96 * 0.42: 06 Aug 2005: Fix lack of link speed initialization 96 * 0.42: 06 Aug 2005: Fix lack of link speed initialization
97 * in the second (and later) nv_open call 97 * in the second (and later) nv_open call
98 * 0.43: 10 Aug 2005: Add support for tx checksum.
98 * 99 *
99 * Known bugs: 100 * Known bugs:
100 * We suspect that on some hardware no TX done interrupts are generated. 101 * We suspect that on some hardware no TX done interrupts are generated.
@@ -106,7 +107,7 @@
106 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few 107 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
107 * superfluous timer interrupts from the nic. 108 * superfluous timer interrupts from the nic.
108 */ 109 */
109#define FORCEDETH_VERSION "0.41" 110#define FORCEDETH_VERSION "0.43"
110#define DRV_NAME "forcedeth" 111#define DRV_NAME "forcedeth"
111 112
112#include <linux/module.h> 113#include <linux/module.h>
@@ -145,6 +146,7 @@
145#define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */ 146#define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */
146#define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ 147#define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */
147#define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ 148#define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */
149#define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */
148 150
149enum { 151enum {
150 NvRegIrqStatus = 0x000, 152 NvRegIrqStatus = 0x000,
@@ -241,6 +243,9 @@ enum {
241#define NVREG_TXRXCTL_IDLE 0x0008 243#define NVREG_TXRXCTL_IDLE 0x0008
242#define NVREG_TXRXCTL_RESET 0x0010 244#define NVREG_TXRXCTL_RESET 0x0010
243#define NVREG_TXRXCTL_RXCHECK 0x0400 245#define NVREG_TXRXCTL_RXCHECK 0x0400
246#define NVREG_TXRXCTL_DESC_1 0
247#define NVREG_TXRXCTL_DESC_2 0x02100
248#define NVREG_TXRXCTL_DESC_3 0x02200
244 NvRegMIIStatus = 0x180, 249 NvRegMIIStatus = 0x180,
245#define NVREG_MIISTAT_ERROR 0x0001 250#define NVREG_MIISTAT_ERROR 0x0001
246#define NVREG_MIISTAT_LINKCHANGE 0x0008 251#define NVREG_MIISTAT_LINKCHANGE 0x0008
@@ -335,6 +340,8 @@ typedef union _ring_type {
335/* error and valid are the same for both */ 340/* error and valid are the same for both */
336#define NV_TX2_ERROR (1<<30) 341#define NV_TX2_ERROR (1<<30)
337#define NV_TX2_VALID (1<<31) 342#define NV_TX2_VALID (1<<31)
343#define NV_TX2_CHECKSUM_L3 (1<<27)
344#define NV_TX2_CHECKSUM_L4 (1<<26)
338 345
339#define NV_RX_DESCRIPTORVALID (1<<16) 346#define NV_RX_DESCRIPTORVALID (1<<16)
340#define NV_RX_MISSEDFRAME (1<<17) 347#define NV_RX_MISSEDFRAME (1<<17)
@@ -417,14 +424,14 @@ typedef union _ring_type {
417 424
418/* 425/*
419 * desc_ver values: 426 * desc_ver values:
420 * This field has two purposes: 427 * The nic supports three different descriptor types:
421 * - Newer nics uses a different ring layout. The layout is selected by 428 * - DESC_VER_1: Original
422 * comparing np->desc_ver with DESC_VER_xy. 429 * - DESC_VER_2: support for jumbo frames.
423 * - It contains bits that are forced on when writing to NvRegTxRxControl. 430 * - DESC_VER_3: 64-bit format.
424 */ 431 */
425#define DESC_VER_1 0x0 432#define DESC_VER_1 1
426#define DESC_VER_2 (0x02100|NVREG_TXRXCTL_RXCHECK) 433#define DESC_VER_2 2
427#define DESC_VER_3 (0x02200|NVREG_TXRXCTL_RXCHECK) 434#define DESC_VER_3 3
428 435
429/* PHY defines */ 436/* PHY defines */
430#define PHY_OUI_MARVELL 0x5043 437#define PHY_OUI_MARVELL 0x5043
@@ -491,6 +498,7 @@ struct fe_priv {
491 u32 orig_mac[2]; 498 u32 orig_mac[2];
492 u32 irqmask; 499 u32 irqmask;
493 u32 desc_ver; 500 u32 desc_ver;
501 u32 txrxctl_bits;
494 502
495 void __iomem *base; 503 void __iomem *base;
496 504
@@ -786,10 +794,10 @@ static void nv_txrx_reset(struct net_device *dev)
786 u8 __iomem *base = get_hwbase(dev); 794 u8 __iomem *base = get_hwbase(dev);
787 795
788 dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name); 796 dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name);
789 writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->desc_ver, base + NvRegTxRxControl); 797 writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl);
790 pci_push(base); 798 pci_push(base);
791 udelay(NV_TXRX_RESET_DELAY); 799 udelay(NV_TXRX_RESET_DELAY);
792 writel(NVREG_TXRXCTL_BIT2 | np->desc_ver, base + NvRegTxRxControl); 800 writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl);
793 pci_push(base); 801 pci_push(base);
794} 802}
795 803
@@ -961,6 +969,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
961{ 969{
962 struct fe_priv *np = get_nvpriv(dev); 970 struct fe_priv *np = get_nvpriv(dev);
963 int nr = np->next_tx % TX_RING; 971 int nr = np->next_tx % TX_RING;
972 u32 tx_checksum = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0);
964 973
965 np->tx_skbuff[nr] = skb; 974 np->tx_skbuff[nr] = skb;
966 np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data,skb->len, 975 np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data,skb->len,
@@ -976,10 +985,10 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
976 spin_lock_irq(&np->lock); 985 spin_lock_irq(&np->lock);
977 wmb(); 986 wmb();
978 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) 987 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2)
979 np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags ); 988 np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags | tx_checksum);
980 else 989 else
981 np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags ); 990 np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags | tx_checksum);
982 dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission.\n", 991 dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission\n",
983 dev->name, np->next_tx); 992 dev->name, np->next_tx);
984 { 993 {
985 int j; 994 int j;
@@ -997,7 +1006,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
997 if (np->next_tx - np->nic_tx >= TX_LIMIT_STOP) 1006 if (np->next_tx - np->nic_tx >= TX_LIMIT_STOP)
998 netif_stop_queue(dev); 1007 netif_stop_queue(dev);
999 spin_unlock_irq(&np->lock); 1008 spin_unlock_irq(&np->lock);
1000 writel(NVREG_TXRXCTL_KICK|np->desc_ver, get_hwbase(dev) + NvRegTxRxControl); 1009 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
1001 pci_push(get_hwbase(dev)); 1010 pci_push(get_hwbase(dev));
1002 return 0; 1011 return 0;
1003} 1012}
@@ -1408,7 +1417,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
1408 writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), 1417 writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT),
1409 base + NvRegRingSizes); 1418 base + NvRegRingSizes);
1410 pci_push(base); 1419 pci_push(base);
1411 writel(NVREG_TXRXCTL_KICK|np->desc_ver, get_hwbase(dev) + NvRegTxRxControl); 1420 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
1412 pci_push(base); 1421 pci_push(base);
1413 1422
1414 /* restart rx engine */ 1423 /* restart rx engine */
@@ -2065,6 +2074,7 @@ static struct ethtool_ops ops = {
2065 .get_regs_len = nv_get_regs_len, 2074 .get_regs_len = nv_get_regs_len,
2066 .get_regs = nv_get_regs, 2075 .get_regs = nv_get_regs,
2067 .nway_reset = nv_nway_reset, 2076 .nway_reset = nv_nway_reset,
2077 .get_perm_addr = ethtool_op_get_perm_addr,
2068}; 2078};
2069 2079
2070static int nv_open(struct net_device *dev) 2080static int nv_open(struct net_device *dev)
@@ -2114,9 +2124,9 @@ static int nv_open(struct net_device *dev)
2114 /* 5) continue setup */ 2124 /* 5) continue setup */
2115 writel(np->linkspeed, base + NvRegLinkSpeed); 2125 writel(np->linkspeed, base + NvRegLinkSpeed);
2116 writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); 2126 writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3);
2117 writel(np->desc_ver, base + NvRegTxRxControl); 2127 writel(np->txrxctl_bits, base + NvRegTxRxControl);
2118 pci_push(base); 2128 pci_push(base);
2119 writel(NVREG_TXRXCTL_BIT1|np->desc_ver, base + NvRegTxRxControl); 2129 writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl);
2120 reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, 2130 reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31,
2121 NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, 2131 NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX,
2122 KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); 2132 KERN_INFO "open: SetupReg5, Bit 31 remained off\n");
@@ -2314,18 +2324,26 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
2314 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", 2324 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n",
2315 pci_name(pci_dev)); 2325 pci_name(pci_dev));
2316 } 2326 }
2327 np->txrxctl_bits = NVREG_TXRXCTL_DESC_3;
2317 } else if (id->driver_data & DEV_HAS_LARGEDESC) { 2328 } else if (id->driver_data & DEV_HAS_LARGEDESC) {
2318 /* packet format 2: supports jumbo frames */ 2329 /* packet format 2: supports jumbo frames */
2319 np->desc_ver = DESC_VER_2; 2330 np->desc_ver = DESC_VER_2;
2331 np->txrxctl_bits = NVREG_TXRXCTL_DESC_2;
2320 } else { 2332 } else {
2321 /* original packet format */ 2333 /* original packet format */
2322 np->desc_ver = DESC_VER_1; 2334 np->desc_ver = DESC_VER_1;
2335 np->txrxctl_bits = NVREG_TXRXCTL_DESC_1;
2323 } 2336 }
2324 2337
2325 np->pkt_limit = NV_PKTLIMIT_1; 2338 np->pkt_limit = NV_PKTLIMIT_1;
2326 if (id->driver_data & DEV_HAS_LARGEDESC) 2339 if (id->driver_data & DEV_HAS_LARGEDESC)
2327 np->pkt_limit = NV_PKTLIMIT_2; 2340 np->pkt_limit = NV_PKTLIMIT_2;
2328 2341
2342 if (id->driver_data & DEV_HAS_CHECKSUM) {
2343 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
2344 dev->features |= NETIF_F_HW_CSUM;
2345 }
2346
2329 err = -ENOMEM; 2347 err = -ENOMEM;
2330 np->base = ioremap(addr, NV_PCI_REGSZ); 2348 np->base = ioremap(addr, NV_PCI_REGSZ);
2331 if (!np->base) 2349 if (!np->base)
@@ -2377,8 +2395,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
2377 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; 2395 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
2378 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; 2396 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
2379 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; 2397 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
2398 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
2380 2399
2381 if (!is_valid_ether_addr(dev->dev_addr)) { 2400 if (!is_valid_ether_addr(dev->perm_addr)) {
2382 /* 2401 /*
2383 * Bad mac address. At least one bios sets the mac address 2402 * Bad mac address. At least one bios sets the mac address
2384 * to 01:23:45:67:89:ab 2403 * to 01:23:45:67:89:ab
@@ -2525,35 +2544,35 @@ static struct pci_device_id pci_tbl[] = {
2525 }, 2544 },
2526 { /* nForce3 Ethernet Controller */ 2545 { /* nForce3 Ethernet Controller */
2527 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4), 2546 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4),
2528 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, 2547 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM,
2529 }, 2548 },
2530 { /* nForce3 Ethernet Controller */ 2549 { /* nForce3 Ethernet Controller */
2531 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5), 2550 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5),
2532 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, 2551 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM,
2533 }, 2552 },
2534 { /* nForce3 Ethernet Controller */ 2553 { /* nForce3 Ethernet Controller */
2535 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6), 2554 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6),
2536 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, 2555 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM,
2537 }, 2556 },
2538 { /* nForce3 Ethernet Controller */ 2557 { /* nForce3 Ethernet Controller */
2539 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7), 2558 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7),
2540 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, 2559 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM,
2541 }, 2560 },
2542 { /* CK804 Ethernet Controller */ 2561 { /* CK804 Ethernet Controller */
2543 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), 2562 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8),
2544 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2563 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2545 }, 2564 },
2546 { /* CK804 Ethernet Controller */ 2565 { /* CK804 Ethernet Controller */
2547 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), 2566 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9),
2548 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2567 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2549 }, 2568 },
2550 { /* MCP04 Ethernet Controller */ 2569 { /* MCP04 Ethernet Controller */
2551 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), 2570 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10),
2552 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2571 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2553 }, 2572 },
2554 { /* MCP04 Ethernet Controller */ 2573 { /* MCP04 Ethernet Controller */
2555 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), 2574 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11),
2556 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2575 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2557 }, 2576 },
2558 { /* MCP51 Ethernet Controller */ 2577 { /* MCP51 Ethernet Controller */
2559 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), 2578 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12),
@@ -2565,11 +2584,11 @@ static struct pci_device_id pci_tbl[] = {
2565 }, 2584 },
2566 { /* MCP55 Ethernet Controller */ 2585 { /* MCP55 Ethernet Controller */
2567 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), 2586 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14),
2568 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2587 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2569 }, 2588 },
2570 { /* MCP55 Ethernet Controller */ 2589 { /* MCP55 Ethernet Controller */
2571 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), 2590 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15),
2572 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, 2591 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA,
2573 }, 2592 },
2574 {0,}, 2593 {0,},
2575}; 2594};
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index cf0ac6fda1a1..b71fab6e34f4 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2517,10 +2517,8 @@ static int hp100_down_vg_link(struct net_device *dev)
2517 do { 2517 do {
2518 if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) 2518 if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST)
2519 break; 2519 break;
2520 if (!in_interrupt()) { 2520 if (!in_interrupt())
2521 set_current_state(TASK_INTERRUPTIBLE); 2521 schedule_timeout_interruptible(1);
2522 schedule_timeout(1);
2523 }
2524 } while (time_after(time, jiffies)); 2522 } while (time_after(time, jiffies));
2525 2523
2526 if (time_after_eq(jiffies, time)) /* no signal->no logout */ 2524 if (time_after_eq(jiffies, time)) /* no signal->no logout */
@@ -2536,10 +2534,8 @@ static int hp100_down_vg_link(struct net_device *dev)
2536 do { 2534 do {
2537 if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) 2535 if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
2538 break; 2536 break;
2539 if (!in_interrupt()) { 2537 if (!in_interrupt())
2540 set_current_state(TASK_INTERRUPTIBLE); 2538 schedule_timeout_interruptible(1);
2541 schedule_timeout(1);
2542 }
2543 } while (time_after(time, jiffies)); 2539 } while (time_after(time, jiffies));
2544 2540
2545#ifdef HP100_DEBUG 2541#ifdef HP100_DEBUG
@@ -2577,10 +2573,8 @@ static int hp100_down_vg_link(struct net_device *dev)
2577 do { 2573 do {
2578 if (!(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST)) 2574 if (!(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST))
2579 break; 2575 break;
2580 if (!in_interrupt()) { 2576 if (!in_interrupt())
2581 set_current_state(TASK_INTERRUPTIBLE); 2577 schedule_timeout_interruptible(1);
2582 schedule_timeout(1);
2583 }
2584 } while (time_after(time, jiffies)); 2578 } while (time_after(time, jiffies));
2585 2579
2586 hp100_orb(HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */ 2580 hp100_orb(HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */
@@ -2591,10 +2585,8 @@ static int hp100_down_vg_link(struct net_device *dev)
2591 do { 2585 do {
2592 if ((hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) == 0) 2586 if ((hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) == 0)
2593 break; 2587 break;
2594 if (!in_interrupt()) { 2588 if (!in_interrupt())
2595 set_current_state(TASK_INTERRUPTIBLE); 2589 schedule_timeout_interruptible(1);
2596 schedule_timeout(1);
2597 }
2598 } while (time_after(time, jiffies)); 2590 } while (time_after(time, jiffies));
2599 2591
2600 if (time_before_eq(time, jiffies)) { 2592 if (time_before_eq(time, jiffies)) {
@@ -2606,10 +2598,8 @@ static int hp100_down_vg_link(struct net_device *dev)
2606 2598
2607 time = jiffies + (2 * HZ); /* This seems to take a while.... */ 2599 time = jiffies + (2 * HZ); /* This seems to take a while.... */
2608 do { 2600 do {
2609 if (!in_interrupt()) { 2601 if (!in_interrupt())
2610 set_current_state(TASK_INTERRUPTIBLE); 2602 schedule_timeout_interruptible(1);
2611 schedule_timeout(1);
2612 }
2613 } while (time_after(time, jiffies)); 2603 } while (time_after(time, jiffies));
2614 2604
2615 return 0; 2605 return 0;
@@ -2659,10 +2649,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
2659 do { 2649 do {
2660 if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) 2650 if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
2661 break; 2651 break;
2662 if (!in_interrupt()) { 2652 if (!in_interrupt())
2663 set_current_state(TASK_INTERRUPTIBLE); 2653 schedule_timeout_interruptible(1);
2664 schedule_timeout(1);
2665 }
2666 } while (time_after(time, jiffies)); 2654 } while (time_after(time, jiffies));
2667 2655
2668 /* Start an addressed training and optionally request promiscuous port */ 2656 /* Start an addressed training and optionally request promiscuous port */
@@ -2697,10 +2685,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
2697 do { 2685 do {
2698 if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) 2686 if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST)
2699 break; 2687 break;
2700 if (!in_interrupt()) { 2688 if (!in_interrupt())
2701 set_current_state(TASK_INTERRUPTIBLE); 2689 schedule_timeout_interruptible(1);
2702 schedule_timeout(1);
2703 }
2704 } while (time_before(jiffies, time)); 2690 } while (time_before(jiffies, time));
2705 2691
2706 if (time_after_eq(jiffies, time)) { 2692 if (time_after_eq(jiffies, time)) {
@@ -2723,10 +2709,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
2723#endif 2709#endif
2724 break; 2710 break;
2725 } 2711 }
2726 if (!in_interrupt()) { 2712 if (!in_interrupt())
2727 set_current_state(TASK_INTERRUPTIBLE); 2713 schedule_timeout_interruptible(1);
2728 schedule_timeout(1);
2729 }
2730 } while (time_after(time, jiffies)); 2714 } while (time_after(time, jiffies));
2731 } 2715 }
2732 2716
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 15f207323d97..3961a754e920 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -678,10 +678,9 @@ static void turnaround_delay(const struct stir_cb *stir, long us)
678 return; 678 return;
679 679
680 ticks = us / (1000000 / HZ); 680 ticks = us / (1000000 / HZ);
681 if (ticks > 0) { 681 if (ticks > 0)
682 current->state = TASK_INTERRUPTIBLE; 682 schedule_timeout_interruptible(1 + ticks);
683 schedule_timeout(1 + ticks); 683 else
684 } else
685 udelay(us); 684 udelay(us);
686} 685}
687 686
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 9d026ed77ddd..04e47189d830 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -645,11 +645,10 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data)
645 645
646 mod_timer(&adapter->blink_timer, jiffies); 646 mod_timer(&adapter->blink_timer, jiffies);
647 647
648 set_current_state(TASK_INTERRUPTIBLE); 648 if (data)
649 if(data) 649 schedule_timeout_interruptible(data * HZ);
650 schedule_timeout(data * HZ);
651 else 650 else
652 schedule_timeout(MAX_SCHEDULE_TIMEOUT); 651 schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
653 652
654 del_timer_sync(&adapter->blink_timer); 653 del_timer_sync(&adapter->blink_timer);
655 ixgb_led_off(&adapter->hw); 654 ixgb_led_off(&adapter->hw);
@@ -723,6 +722,7 @@ struct ethtool_ops ixgb_ethtool_ops = {
723 .phys_id = ixgb_phys_id, 722 .phys_id = ixgb_phys_id,
724 .get_stats_count = ixgb_get_stats_count, 723 .get_stats_count = ixgb_get_stats_count,
725 .get_ethtool_stats = ixgb_get_ethtool_stats, 724 .get_ethtool_stats = ixgb_get_ethtool_stats,
725 .get_perm_addr = ethtool_op_get_perm_addr,
726}; 726};
727 727
728void ixgb_set_ethtool_ops(struct net_device *netdev) 728void ixgb_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 89d6d69be382..176680cb153e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -460,8 +460,9 @@ ixgb_probe(struct pci_dev *pdev,
460 } 460 }
461 461
462 ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr); 462 ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr);
463 memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
463 464
464 if(!is_valid_ether_addr(netdev->dev_addr)) { 465 if(!is_valid_ether_addr(netdev->perm_addr)) {
465 err = -EIO; 466 err = -EIO;
466 goto err_eeprom; 467 goto err_eeprom;
467 } 468 }
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c
index 27f0d8ac4c40..309d254842cf 100644
--- a/drivers/net/lne390.c
+++ b/drivers/net/lne390.c
@@ -298,7 +298,7 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
298 return 0; 298 return 0;
299unmap: 299unmap:
300 if (ei_status.reg0) 300 if (ei_status.reg0)
301 iounmap((void *)dev->mem_start); 301 iounmap(ei_status.mem);
302cleanup: 302cleanup:
303 free_irq(dev->irq, dev); 303 free_irq(dev->irq, dev);
304 return ret; 304 return ret;
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index c33cb3dc942b..e42aa797f08b 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -207,6 +207,20 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
207 return 0; 207 return 0;
208} 208}
209 209
210int mii_check_gmii_support(struct mii_if_info *mii)
211{
212 int reg;
213
214 reg = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR);
215 if (reg & BMSR_ESTATEN) {
216 reg = mii->mdio_read(mii->dev, mii->phy_id, MII_ESTATUS);
217 if (reg & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
218 return 1;
219 }
220
221 return 0;
222}
223
210int mii_link_ok (struct mii_if_info *mii) 224int mii_link_ok (struct mii_if_info *mii)
211{ 225{
212 /* first, a dummy read, needed to latch some MII phys */ 226 /* first, a dummy read, needed to latch some MII phys */
@@ -394,5 +408,6 @@ EXPORT_SYMBOL(mii_ethtool_gset);
394EXPORT_SYMBOL(mii_ethtool_sset); 408EXPORT_SYMBOL(mii_ethtool_sset);
395EXPORT_SYMBOL(mii_check_link); 409EXPORT_SYMBOL(mii_check_link);
396EXPORT_SYMBOL(mii_check_media); 410EXPORT_SYMBOL(mii_check_media);
411EXPORT_SYMBOL(mii_check_gmii_support);
397EXPORT_SYMBOL(generic_mii_ioctl); 412EXPORT_SYMBOL(generic_mii_ioctl);
398 413
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index f1c01ac29102..e531a4eedfee 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -372,6 +372,7 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
372 printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":"); 372 printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":");
373 dev->dev_addr[i] = SA_prom[i]; 373 dev->dev_addr[i] = SA_prom[i];
374 } 374 }
375 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
375 376
376 return 0; 377 return 0;
377 378
@@ -637,6 +638,7 @@ static struct ethtool_ops ne2k_pci_ethtool_ops = {
637 .get_drvinfo = ne2k_pci_get_drvinfo, 638 .get_drvinfo = ne2k_pci_get_drvinfo,
638 .get_tx_csum = ethtool_op_get_tx_csum, 639 .get_tx_csum = ethtool_op_get_tx_csum,
639 .get_sg = ethtool_op_get_sg, 640 .get_sg = ethtool_op_get_sg,
641 .get_perm_addr = ethtool_op_get_perm_addr,
640}; 642};
641 643
642static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) 644static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index e64df4d0800b..ed72a23c85dd 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1632,8 +1632,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
1632 timed_out = 1; 1632 timed_out = 1;
1633 break; 1633 break;
1634 } 1634 }
1635 set_current_state(TASK_UNINTERRUPTIBLE); 1635 schedule_timeout_uninterruptible(1);
1636 schedule_timeout(1);
1637 } 1636 }
1638 1637
1639 if (status & fail) 1638 if (status & fail)
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 113b68099216..70fe81a89df9 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -22,8 +22,8 @@
22 *************************************************************************/ 22 *************************************************************************/
23 23
24#define DRV_NAME "pcnet32" 24#define DRV_NAME "pcnet32"
25#define DRV_VERSION "1.30j" 25#define DRV_VERSION "1.31a"
26#define DRV_RELDATE "29.04.2005" 26#define DRV_RELDATE "12.Sep.2005"
27#define PFX DRV_NAME ": " 27#define PFX DRV_NAME ": "
28 28
29static const char *version = 29static const char *version =
@@ -257,6 +257,9 @@ static int homepna[MAX_UNITS];
257 * v1.30h 24 Jun 2004 Don Fry correctly select auto, speed, duplex in bcr32. 257 * v1.30h 24 Jun 2004 Don Fry correctly select auto, speed, duplex in bcr32.
258 * v1.30i 28 Jun 2004 Don Fry change to use module_param. 258 * v1.30i 28 Jun 2004 Don Fry change to use module_param.
259 * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test. 259 * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test.
260 * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam().
261 * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4
262 * to allow loopback test to work unchanged.
260 */ 263 */
261 264
262 265
@@ -266,17 +269,17 @@ static int homepna[MAX_UNITS];
266 * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). 269 * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4).
267 */ 270 */
268#ifndef PCNET32_LOG_TX_BUFFERS 271#ifndef PCNET32_LOG_TX_BUFFERS
269#define PCNET32_LOG_TX_BUFFERS 4 272#define PCNET32_LOG_TX_BUFFERS 4
270#define PCNET32_LOG_RX_BUFFERS 5 273#define PCNET32_LOG_RX_BUFFERS 5
274#define PCNET32_LOG_MAX_TX_BUFFERS 9 /* 2^9 == 512 */
275#define PCNET32_LOG_MAX_RX_BUFFERS 9
271#endif 276#endif
272 277
273#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) 278#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS))
274#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) 279#define TX_MAX_RING_SIZE (1 << (PCNET32_LOG_MAX_TX_BUFFERS))
275#define TX_RING_LEN_BITS ((PCNET32_LOG_TX_BUFFERS) << 12)
276 280
277#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) 281#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS))
278#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) 282#define RX_MAX_RING_SIZE (1 << (PCNET32_LOG_MAX_RX_BUFFERS))
279#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4)
280 283
281#define PKT_BUF_SZ 1544 284#define PKT_BUF_SZ 1544
282 285
@@ -334,14 +337,14 @@ struct pcnet32_access {
334}; 337};
335 338
336/* 339/*
337 * The first three fields of pcnet32_private are read by the ethernet device 340 * The first field of pcnet32_private is read by the ethernet device
338 * so we allocate the structure should be allocated by pci_alloc_consistent(). 341 * so the structure should be allocated using pci_alloc_consistent().
339 */ 342 */
340struct pcnet32_private { 343struct pcnet32_private {
341 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */
342 struct pcnet32_rx_head rx_ring[RX_RING_SIZE];
343 struct pcnet32_tx_head tx_ring[TX_RING_SIZE];
344 struct pcnet32_init_block init_block; 344 struct pcnet32_init_block init_block;
345 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */
346 struct pcnet32_rx_head *rx_ring;
347 struct pcnet32_tx_head *tx_ring;
345 dma_addr_t dma_addr; /* DMA address of beginning of this 348 dma_addr_t dma_addr; /* DMA address of beginning of this
346 object, returned by 349 object, returned by
347 pci_alloc_consistent */ 350 pci_alloc_consistent */
@@ -349,13 +352,21 @@ struct pcnet32_private {
349 structure */ 352 structure */
350 const char *name; 353 const char *name;
351 /* The saved address of a sent-in-place packet/buffer, for skfree(). */ 354 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
352 struct sk_buff *tx_skbuff[TX_RING_SIZE]; 355 struct sk_buff **tx_skbuff;
353 struct sk_buff *rx_skbuff[RX_RING_SIZE]; 356 struct sk_buff **rx_skbuff;
354 dma_addr_t tx_dma_addr[TX_RING_SIZE]; 357 dma_addr_t *tx_dma_addr;
355 dma_addr_t rx_dma_addr[RX_RING_SIZE]; 358 dma_addr_t *rx_dma_addr;
356 struct pcnet32_access a; 359 struct pcnet32_access a;
357 spinlock_t lock; /* Guard lock */ 360 spinlock_t lock; /* Guard lock */
358 unsigned int cur_rx, cur_tx; /* The next free ring entry */ 361 unsigned int cur_rx, cur_tx; /* The next free ring entry */
362 unsigned int rx_ring_size; /* current rx ring size */
363 unsigned int tx_ring_size; /* current tx ring size */
364 unsigned int rx_mod_mask; /* rx ring modular mask */
365 unsigned int tx_mod_mask; /* tx ring modular mask */
366 unsigned short rx_len_bits;
367 unsigned short tx_len_bits;
368 dma_addr_t rx_ring_dma_addr;
369 dma_addr_t tx_ring_dma_addr;
359 unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ 370 unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */
360 struct net_device_stats stats; 371 struct net_device_stats stats;
361 char tx_full; 372 char tx_full;
@@ -397,6 +408,9 @@ static int pcnet32_get_regs_len(struct net_device *dev);
397static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, 408static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
398 void *ptr); 409 void *ptr);
399static void pcnet32_purge_tx_ring(struct net_device *dev); 410static void pcnet32_purge_tx_ring(struct net_device *dev);
411static int pcnet32_alloc_ring(struct net_device *dev);
412static void pcnet32_free_ring(struct net_device *dev);
413
400 414
401enum pci_flags_bit { 415enum pci_flags_bit {
402 PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, 416 PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
@@ -613,10 +627,62 @@ static void pcnet32_get_ringparam(struct net_device *dev, struct ethtool_ringpar
613{ 627{
614 struct pcnet32_private *lp = dev->priv; 628 struct pcnet32_private *lp = dev->priv;
615 629
616 ering->tx_max_pending = TX_RING_SIZE - 1; 630 ering->tx_max_pending = TX_MAX_RING_SIZE - 1;
617 ering->tx_pending = lp->cur_tx - lp->dirty_tx; 631 ering->tx_pending = lp->tx_ring_size - 1;
618 ering->rx_max_pending = RX_RING_SIZE - 1; 632 ering->rx_max_pending = RX_MAX_RING_SIZE - 1;
619 ering->rx_pending = lp->cur_rx & RX_RING_MOD_MASK; 633 ering->rx_pending = lp->rx_ring_size - 1;
634}
635
636static int pcnet32_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
637{
638 struct pcnet32_private *lp = dev->priv;
639 unsigned long flags;
640 int i;
641
642 if (ering->rx_mini_pending || ering->rx_jumbo_pending)
643 return -EINVAL;
644
645 if (netif_running(dev))
646 pcnet32_close(dev);
647
648 spin_lock_irqsave(&lp->lock, flags);
649 pcnet32_free_ring(dev);
650 lp->tx_ring_size = min(ering->tx_pending, (unsigned int) TX_MAX_RING_SIZE);
651 lp->rx_ring_size = min(ering->rx_pending, (unsigned int) RX_MAX_RING_SIZE);
652
653 /* set the minimum ring size to 4, to allow the loopback test to work
654 * unchanged.
655 */
656 for (i = 2; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) {
657 if (lp->tx_ring_size <= (1 << i))
658 break;
659 }
660 lp->tx_ring_size = (1 << i);
661 lp->tx_mod_mask = lp->tx_ring_size - 1;
662 lp->tx_len_bits = (i << 12);
663
664 for (i = 2; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) {
665 if (lp->rx_ring_size <= (1 << i))
666 break;
667 }
668 lp->rx_ring_size = (1 << i);
669 lp->rx_mod_mask = lp->rx_ring_size - 1;
670 lp->rx_len_bits = (i << 4);
671
672 if (pcnet32_alloc_ring(dev)) {
673 pcnet32_free_ring(dev);
674 return -ENOMEM;
675 }
676
677 spin_unlock_irqrestore(&lp->lock, flags);
678
679 if (pcnet32_debug & NETIF_MSG_DRV)
680 printk(KERN_INFO PFX "Ring Param Settings: RX: %d, TX: %d\n", lp->rx_ring_size, lp->tx_ring_size);
681
682 if (netif_running(dev))
683 pcnet32_open(dev);
684
685 return 0;
620} 686}
621 687
622static void pcnet32_get_strings(struct net_device *dev, u32 stringset, u8 *data) 688static void pcnet32_get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -948,6 +1014,7 @@ static struct ethtool_ops pcnet32_ethtool_ops = {
948 .nway_reset = pcnet32_nway_reset, 1014 .nway_reset = pcnet32_nway_reset,
949 .get_link = pcnet32_get_link, 1015 .get_link = pcnet32_get_link,
950 .get_ringparam = pcnet32_get_ringparam, 1016 .get_ringparam = pcnet32_get_ringparam,
1017 .set_ringparam = pcnet32_set_ringparam,
951 .get_tx_csum = ethtool_op_get_tx_csum, 1018 .get_tx_csum = ethtool_op_get_tx_csum,
952 .get_sg = ethtool_op_get_sg, 1019 .get_sg = ethtool_op_get_sg,
953 .get_tso = ethtool_op_get_tso, 1020 .get_tso = ethtool_op_get_tso,
@@ -957,6 +1024,7 @@ static struct ethtool_ops pcnet32_ethtool_ops = {
957 .phys_id = pcnet32_phys_id, 1024 .phys_id = pcnet32_phys_id,
958 .get_regs_len = pcnet32_get_regs_len, 1025 .get_regs_len = pcnet32_get_regs_len,
959 .get_regs = pcnet32_get_regs, 1026 .get_regs = pcnet32_get_regs,
1027 .get_perm_addr = ethtool_op_get_perm_addr,
960}; 1028};
961 1029
962/* only probes for non-PCI devices, the rest are handled by 1030/* only probes for non-PCI devices, the rest are handled by
@@ -1185,9 +1253,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1185 memcpy(dev->dev_addr, promaddr, 6); 1253 memcpy(dev->dev_addr, promaddr, 6);
1186 } 1254 }
1187 } 1255 }
1256 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
1188 1257
1189 /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ 1258 /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */
1190 if (!is_valid_ether_addr(dev->dev_addr)) 1259 if (!is_valid_ether_addr(dev->perm_addr))
1191 memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); 1260 memset(dev->dev_addr, 0, sizeof(dev->dev_addr));
1192 1261
1193 if (pcnet32_debug & NETIF_MSG_PROBE) { 1262 if (pcnet32_debug & NETIF_MSG_PROBE) {
@@ -1239,6 +1308,12 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1239 dev->priv = lp; 1308 dev->priv = lp;
1240 lp->name = chipname; 1309 lp->name = chipname;
1241 lp->shared_irq = shared; 1310 lp->shared_irq = shared;
1311 lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */
1312 lp->rx_ring_size = RX_RING_SIZE; /* default rx ring size */
1313 lp->tx_mod_mask = lp->tx_ring_size - 1;
1314 lp->rx_mod_mask = lp->rx_ring_size - 1;
1315 lp->tx_len_bits = (PCNET32_LOG_TX_BUFFERS << 12);
1316 lp->rx_len_bits = (PCNET32_LOG_RX_BUFFERS << 4);
1242 lp->mii_if.full_duplex = fdx; 1317 lp->mii_if.full_duplex = fdx;
1243 lp->mii_if.phy_id_mask = 0x1f; 1318 lp->mii_if.phy_id_mask = 0x1f;
1244 lp->mii_if.reg_num_mask = 0x1f; 1319 lp->mii_if.reg_num_mask = 0x1f;
@@ -1265,21 +1340,23 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1265 } 1340 }
1266 lp->a = *a; 1341 lp->a = *a;
1267 1342
1343 if (pcnet32_alloc_ring(dev)) {
1344 ret = -ENOMEM;
1345 goto err_free_ring;
1346 }
1268 /* detect special T1/E1 WAN card by checking for MAC address */ 1347 /* detect special T1/E1 WAN card by checking for MAC address */
1269 if (dev->dev_addr[0] == 0x00 && dev->dev_addr[1] == 0xe0 1348 if (dev->dev_addr[0] == 0x00 && dev->dev_addr[1] == 0xe0
1270 && dev->dev_addr[2] == 0x75) 1349 && dev->dev_addr[2] == 0x75)
1271 lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI; 1350 lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI;
1272 1351
1273 lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */ 1352 lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */
1274 lp->init_block.tlen_rlen = le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); 1353 lp->init_block.tlen_rlen = le16_to_cpu(lp->tx_len_bits | lp->rx_len_bits);
1275 for (i = 0; i < 6; i++) 1354 for (i = 0; i < 6; i++)
1276 lp->init_block.phys_addr[i] = dev->dev_addr[i]; 1355 lp->init_block.phys_addr[i] = dev->dev_addr[i];
1277 lp->init_block.filter[0] = 0x00000000; 1356 lp->init_block.filter[0] = 0x00000000;
1278 lp->init_block.filter[1] = 0x00000000; 1357 lp->init_block.filter[1] = 0x00000000;
1279 lp->init_block.rx_ring = (u32)le32_to_cpu(lp->dma_addr + 1358 lp->init_block.rx_ring = (u32)le32_to_cpu(lp->rx_ring_dma_addr);
1280 offsetof(struct pcnet32_private, rx_ring)); 1359 lp->init_block.tx_ring = (u32)le32_to_cpu(lp->tx_ring_dma_addr);
1281 lp->init_block.tx_ring = (u32)le32_to_cpu(lp->dma_addr +
1282 offsetof(struct pcnet32_private, tx_ring));
1283 1360
1284 /* switch pcnet32 to 32bit mode */ 1361 /* switch pcnet32 to 32bit mode */
1285 a->write_bcr(ioaddr, 20, 2); 1362 a->write_bcr(ioaddr, 20, 2);
@@ -1310,7 +1387,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1310 if (pcnet32_debug & NETIF_MSG_PROBE) 1387 if (pcnet32_debug & NETIF_MSG_PROBE)
1311 printk(", failed to detect IRQ line.\n"); 1388 printk(", failed to detect IRQ line.\n");
1312 ret = -ENODEV; 1389 ret = -ENODEV;
1313 goto err_free_consistent; 1390 goto err_free_ring;
1314 } 1391 }
1315 if (pcnet32_debug & NETIF_MSG_PROBE) 1392 if (pcnet32_debug & NETIF_MSG_PROBE)
1316 printk(", probed IRQ %d.\n", dev->irq); 1393 printk(", probed IRQ %d.\n", dev->irq);
@@ -1341,7 +1418,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1341 1418
1342 /* Fill in the generic fields of the device structure. */ 1419 /* Fill in the generic fields of the device structure. */
1343 if (register_netdev(dev)) 1420 if (register_netdev(dev))
1344 goto err_free_consistent; 1421 goto err_free_ring;
1345 1422
1346 if (pdev) { 1423 if (pdev) {
1347 pci_set_drvdata(pdev, dev); 1424 pci_set_drvdata(pdev, dev);
@@ -1359,6 +1436,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1359 1436
1360 return 0; 1437 return 0;
1361 1438
1439err_free_ring:
1440 pcnet32_free_ring(dev);
1362err_free_consistent: 1441err_free_consistent:
1363 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); 1442 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
1364err_free_netdev: 1443err_free_netdev:
@@ -1369,6 +1448,86 @@ err_release_region:
1369} 1448}
1370 1449
1371 1450
1451static int pcnet32_alloc_ring(struct net_device *dev)
1452{
1453 struct pcnet32_private *lp = dev->priv;
1454
1455 if ((lp->tx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size,
1456 &lp->tx_ring_dma_addr)) == NULL) {
1457 if (pcnet32_debug & NETIF_MSG_DRV)
1458 printk(KERN_ERR PFX "Consistent memory allocation failed.\n");
1459 return -ENOMEM;
1460 }
1461
1462 if ((lp->rx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size,
1463 &lp->rx_ring_dma_addr)) == NULL) {
1464 if (pcnet32_debug & NETIF_MSG_DRV)
1465 printk(KERN_ERR PFX "Consistent memory allocation failed.\n");
1466 return -ENOMEM;
1467 }
1468
1469 if (!(lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size, GFP_ATOMIC))) {
1470 if (pcnet32_debug & NETIF_MSG_DRV)
1471 printk(KERN_ERR PFX "Memory allocation failed.\n");
1472 return -ENOMEM;
1473 }
1474 memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size);
1475
1476 if (!(lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size, GFP_ATOMIC))) {
1477 if (pcnet32_debug & NETIF_MSG_DRV)
1478 printk(KERN_ERR PFX "Memory allocation failed.\n");
1479 return -ENOMEM;
1480 }
1481 memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size);
1482
1483 if (!(lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size, GFP_ATOMIC))) {
1484 if (pcnet32_debug & NETIF_MSG_DRV)
1485 printk(KERN_ERR PFX "Memory allocation failed.\n");
1486 return -ENOMEM;
1487 }
1488 memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size);
1489
1490 if (!(lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size, GFP_ATOMIC))) {
1491 if (pcnet32_debug & NETIF_MSG_DRV)
1492 printk(KERN_ERR PFX "Memory allocation failed.\n");
1493 return -ENOMEM;
1494 }
1495 memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size);
1496
1497 return 0;
1498}
1499
1500
1501static void pcnet32_free_ring(struct net_device *dev)
1502{
1503 struct pcnet32_private *lp = dev->priv;
1504
1505 kfree(lp->tx_skbuff);
1506 lp->tx_skbuff = NULL;
1507
1508 kfree(lp->rx_skbuff);
1509 lp->rx_skbuff = NULL;
1510
1511 kfree(lp->tx_dma_addr);
1512 lp->tx_dma_addr = NULL;
1513
1514 kfree(lp->rx_dma_addr);
1515 lp->rx_dma_addr = NULL;
1516
1517 if (lp->tx_ring) {
1518 pci_free_consistent(lp->pci_dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size,
1519 lp->tx_ring, lp->tx_ring_dma_addr);
1520 lp->tx_ring = NULL;
1521 }
1522
1523 if (lp->rx_ring) {
1524 pci_free_consistent(lp->pci_dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size,
1525 lp->rx_ring, lp->rx_ring_dma_addr);
1526 lp->rx_ring = NULL;
1527 }
1528}
1529
1530
1372static int 1531static int
1373pcnet32_open(struct net_device *dev) 1532pcnet32_open(struct net_device *dev)
1374{ 1533{
@@ -1400,8 +1559,8 @@ pcnet32_open(struct net_device *dev)
1400 if (netif_msg_ifup(lp)) 1559 if (netif_msg_ifup(lp))
1401 printk(KERN_DEBUG "%s: pcnet32_open() irq %d tx/rx rings %#x/%#x init %#x.\n", 1560 printk(KERN_DEBUG "%s: pcnet32_open() irq %d tx/rx rings %#x/%#x init %#x.\n",
1402 dev->name, dev->irq, 1561 dev->name, dev->irq,
1403 (u32) (lp->dma_addr + offsetof(struct pcnet32_private, tx_ring)), 1562 (u32) (lp->tx_ring_dma_addr),
1404 (u32) (lp->dma_addr + offsetof(struct pcnet32_private, rx_ring)), 1563 (u32) (lp->rx_ring_dma_addr),
1405 (u32) (lp->dma_addr + offsetof(struct pcnet32_private, init_block))); 1564 (u32) (lp->dma_addr + offsetof(struct pcnet32_private, init_block)));
1406 1565
1407 /* set/reset autoselect bit */ 1566 /* set/reset autoselect bit */
@@ -1521,7 +1680,7 @@ pcnet32_open(struct net_device *dev)
1521 1680
1522err_free_ring: 1681err_free_ring:
1523 /* free any allocated skbuffs */ 1682 /* free any allocated skbuffs */
1524 for (i = 0; i < RX_RING_SIZE; i++) { 1683 for (i = 0; i < lp->rx_ring_size; i++) {
1525 lp->rx_ring[i].status = 0; 1684 lp->rx_ring[i].status = 0;
1526 if (lp->rx_skbuff[i]) { 1685 if (lp->rx_skbuff[i]) {
1527 pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i], PKT_BUF_SZ-2, 1686 pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i], PKT_BUF_SZ-2,
@@ -1531,6 +1690,9 @@ err_free_ring:
1531 lp->rx_skbuff[i] = NULL; 1690 lp->rx_skbuff[i] = NULL;
1532 lp->rx_dma_addr[i] = 0; 1691 lp->rx_dma_addr[i] = 0;
1533 } 1692 }
1693
1694 pcnet32_free_ring(dev);
1695
1534 /* 1696 /*
1535 * Switch back to 16bit mode to avoid problems with dumb 1697 * Switch back to 16bit mode to avoid problems with dumb
1536 * DOS packet driver after a warm reboot 1698 * DOS packet driver after a warm reboot
@@ -1562,7 +1724,7 @@ pcnet32_purge_tx_ring(struct net_device *dev)
1562 struct pcnet32_private *lp = dev->priv; 1724 struct pcnet32_private *lp = dev->priv;
1563 int i; 1725 int i;
1564 1726
1565 for (i = 0; i < TX_RING_SIZE; i++) { 1727 for (i = 0; i < lp->tx_ring_size; i++) {
1566 lp->tx_ring[i].status = 0; /* CPU owns buffer */ 1728 lp->tx_ring[i].status = 0; /* CPU owns buffer */
1567 wmb(); /* Make sure adapter sees owner change */ 1729 wmb(); /* Make sure adapter sees owner change */
1568 if (lp->tx_skbuff[i]) { 1730 if (lp->tx_skbuff[i]) {
@@ -1587,7 +1749,7 @@ pcnet32_init_ring(struct net_device *dev)
1587 lp->cur_rx = lp->cur_tx = 0; 1749 lp->cur_rx = lp->cur_tx = 0;
1588 lp->dirty_rx = lp->dirty_tx = 0; 1750 lp->dirty_rx = lp->dirty_tx = 0;
1589 1751
1590 for (i = 0; i < RX_RING_SIZE; i++) { 1752 for (i = 0; i < lp->rx_ring_size; i++) {
1591 struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; 1753 struct sk_buff *rx_skbuff = lp->rx_skbuff[i];
1592 if (rx_skbuff == NULL) { 1754 if (rx_skbuff == NULL) {
1593 if (!(rx_skbuff = lp->rx_skbuff[i] = dev_alloc_skb (PKT_BUF_SZ))) { 1755 if (!(rx_skbuff = lp->rx_skbuff[i] = dev_alloc_skb (PKT_BUF_SZ))) {
@@ -1611,20 +1773,18 @@ pcnet32_init_ring(struct net_device *dev)
1611 } 1773 }
1612 /* The Tx buffer address is filled in as needed, but we do need to clear 1774 /* The Tx buffer address is filled in as needed, but we do need to clear
1613 * the upper ownership bit. */ 1775 * the upper ownership bit. */
1614 for (i = 0; i < TX_RING_SIZE; i++) { 1776 for (i = 0; i < lp->tx_ring_size; i++) {
1615 lp->tx_ring[i].status = 0; /* CPU owns buffer */ 1777 lp->tx_ring[i].status = 0; /* CPU owns buffer */
1616 wmb(); /* Make sure adapter sees owner change */ 1778 wmb(); /* Make sure adapter sees owner change */
1617 lp->tx_ring[i].base = 0; 1779 lp->tx_ring[i].base = 0;
1618 lp->tx_dma_addr[i] = 0; 1780 lp->tx_dma_addr[i] = 0;
1619 } 1781 }
1620 1782
1621 lp->init_block.tlen_rlen = le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); 1783 lp->init_block.tlen_rlen = le16_to_cpu(lp->tx_len_bits | lp->rx_len_bits);
1622 for (i = 0; i < 6; i++) 1784 for (i = 0; i < 6; i++)
1623 lp->init_block.phys_addr[i] = dev->dev_addr[i]; 1785 lp->init_block.phys_addr[i] = dev->dev_addr[i];
1624 lp->init_block.rx_ring = (u32)le32_to_cpu(lp->dma_addr + 1786 lp->init_block.rx_ring = (u32)le32_to_cpu(lp->rx_ring_dma_addr);
1625 offsetof(struct pcnet32_private, rx_ring)); 1787 lp->init_block.tx_ring = (u32)le32_to_cpu(lp->tx_ring_dma_addr);
1626 lp->init_block.tx_ring = (u32)le32_to_cpu(lp->dma_addr +
1627 offsetof(struct pcnet32_private, tx_ring));
1628 wmb(); /* Make sure all changes are visible */ 1788 wmb(); /* Make sure all changes are visible */
1629 return 0; 1789 return 0;
1630} 1790}
@@ -1682,13 +1842,13 @@ pcnet32_tx_timeout (struct net_device *dev)
1682 printk(KERN_DEBUG " Ring data dump: dirty_tx %d cur_tx %d%s cur_rx %d.", 1842 printk(KERN_DEBUG " Ring data dump: dirty_tx %d cur_tx %d%s cur_rx %d.",
1683 lp->dirty_tx, lp->cur_tx, lp->tx_full ? " (full)" : "", 1843 lp->dirty_tx, lp->cur_tx, lp->tx_full ? " (full)" : "",
1684 lp->cur_rx); 1844 lp->cur_rx);
1685 for (i = 0 ; i < RX_RING_SIZE; i++) 1845 for (i = 0 ; i < lp->rx_ring_size; i++)
1686 printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", 1846 printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ",
1687 le32_to_cpu(lp->rx_ring[i].base), 1847 le32_to_cpu(lp->rx_ring[i].base),
1688 (-le16_to_cpu(lp->rx_ring[i].buf_length)) & 0xffff, 1848 (-le16_to_cpu(lp->rx_ring[i].buf_length)) & 0xffff,
1689 le32_to_cpu(lp->rx_ring[i].msg_length), 1849 le32_to_cpu(lp->rx_ring[i].msg_length),
1690 le16_to_cpu(lp->rx_ring[i].status)); 1850 le16_to_cpu(lp->rx_ring[i].status));
1691 for (i = 0 ; i < TX_RING_SIZE; i++) 1851 for (i = 0 ; i < lp->tx_ring_size; i++)
1692 printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", 1852 printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ",
1693 le32_to_cpu(lp->tx_ring[i].base), 1853 le32_to_cpu(lp->tx_ring[i].base),
1694 (-le16_to_cpu(lp->tx_ring[i].length)) & 0xffff, 1854 (-le16_to_cpu(lp->tx_ring[i].length)) & 0xffff,
@@ -1729,7 +1889,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
1729 /* Fill in a Tx ring entry */ 1889 /* Fill in a Tx ring entry */
1730 1890
1731 /* Mask to ring buffer boundary. */ 1891 /* Mask to ring buffer boundary. */
1732 entry = lp->cur_tx & TX_RING_MOD_MASK; 1892 entry = lp->cur_tx & lp->tx_mod_mask;
1733 1893
1734 /* Caution: the write order is important here, set the status 1894 /* Caution: the write order is important here, set the status
1735 * with the "ownership" bits last. */ 1895 * with the "ownership" bits last. */
@@ -1753,7 +1913,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
1753 1913
1754 dev->trans_start = jiffies; 1914 dev->trans_start = jiffies;
1755 1915
1756 if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base != 0) { 1916 if (lp->tx_ring[(entry+1) & lp->tx_mod_mask].base != 0) {
1757 lp->tx_full = 1; 1917 lp->tx_full = 1;
1758 netif_stop_queue(dev); 1918 netif_stop_queue(dev);
1759 } 1919 }
@@ -1806,7 +1966,7 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1806 int delta; 1966 int delta;
1807 1967
1808 while (dirty_tx != lp->cur_tx) { 1968 while (dirty_tx != lp->cur_tx) {
1809 int entry = dirty_tx & TX_RING_MOD_MASK; 1969 int entry = dirty_tx & lp->tx_mod_mask;
1810 int status = (short)le16_to_cpu(lp->tx_ring[entry].status); 1970 int status = (short)le16_to_cpu(lp->tx_ring[entry].status);
1811 1971
1812 if (status < 0) 1972 if (status < 0)
@@ -1864,18 +2024,18 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1864 dirty_tx++; 2024 dirty_tx++;
1865 } 2025 }
1866 2026
1867 delta = (lp->cur_tx - dirty_tx) & (TX_RING_MOD_MASK + TX_RING_SIZE); 2027 delta = (lp->cur_tx - dirty_tx) & (lp->tx_mod_mask + lp->tx_ring_size);
1868 if (delta > TX_RING_SIZE) { 2028 if (delta > lp->tx_ring_size) {
1869 if (netif_msg_drv(lp)) 2029 if (netif_msg_drv(lp))
1870 printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n", 2030 printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n",
1871 dev->name, dirty_tx, lp->cur_tx, lp->tx_full); 2031 dev->name, dirty_tx, lp->cur_tx, lp->tx_full);
1872 dirty_tx += TX_RING_SIZE; 2032 dirty_tx += lp->tx_ring_size;
1873 delta -= TX_RING_SIZE; 2033 delta -= lp->tx_ring_size;
1874 } 2034 }
1875 2035
1876 if (lp->tx_full && 2036 if (lp->tx_full &&
1877 netif_queue_stopped(dev) && 2037 netif_queue_stopped(dev) &&
1878 delta < TX_RING_SIZE - 2) { 2038 delta < lp->tx_ring_size - 2) {
1879 /* The ring is no longer full, clear tbusy. */ 2039 /* The ring is no longer full, clear tbusy. */
1880 lp->tx_full = 0; 2040 lp->tx_full = 0;
1881 netif_wake_queue (dev); 2041 netif_wake_queue (dev);
@@ -1932,8 +2092,8 @@ static int
1932pcnet32_rx(struct net_device *dev) 2092pcnet32_rx(struct net_device *dev)
1933{ 2093{
1934 struct pcnet32_private *lp = dev->priv; 2094 struct pcnet32_private *lp = dev->priv;
1935 int entry = lp->cur_rx & RX_RING_MOD_MASK; 2095 int entry = lp->cur_rx & lp->rx_mod_mask;
1936 int boguscnt = RX_RING_SIZE / 2; 2096 int boguscnt = lp->rx_ring_size / 2;
1937 2097
1938 /* If we own the next entry, it's a new packet. Send it up. */ 2098 /* If we own the next entry, it's a new packet. Send it up. */
1939 while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) { 2099 while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) {
@@ -1998,12 +2158,12 @@ pcnet32_rx(struct net_device *dev)
1998 if (netif_msg_drv(lp)) 2158 if (netif_msg_drv(lp))
1999 printk(KERN_ERR "%s: Memory squeeze, deferring packet.\n", 2159 printk(KERN_ERR "%s: Memory squeeze, deferring packet.\n",
2000 dev->name); 2160 dev->name);
2001 for (i = 0; i < RX_RING_SIZE; i++) 2161 for (i = 0; i < lp->rx_ring_size; i++)
2002 if ((short)le16_to_cpu(lp->rx_ring[(entry+i) 2162 if ((short)le16_to_cpu(lp->rx_ring[(entry+i)
2003 & RX_RING_MOD_MASK].status) < 0) 2163 & lp->rx_mod_mask].status) < 0)
2004 break; 2164 break;
2005 2165
2006 if (i > RX_RING_SIZE -2) { 2166 if (i > lp->rx_ring_size -2) {
2007 lp->stats.rx_dropped++; 2167 lp->stats.rx_dropped++;
2008 lp->rx_ring[entry].status |= le16_to_cpu(0x8000); 2168 lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
2009 wmb(); /* Make sure adapter sees owner change */ 2169 wmb(); /* Make sure adapter sees owner change */
@@ -2041,7 +2201,7 @@ pcnet32_rx(struct net_device *dev)
2041 lp->rx_ring[entry].buf_length = le16_to_cpu(2-PKT_BUF_SZ); 2201 lp->rx_ring[entry].buf_length = le16_to_cpu(2-PKT_BUF_SZ);
2042 wmb(); /* Make sure owner changes after all others are visible */ 2202 wmb(); /* Make sure owner changes after all others are visible */
2043 lp->rx_ring[entry].status |= le16_to_cpu(0x8000); 2203 lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
2044 entry = (++lp->cur_rx) & RX_RING_MOD_MASK; 2204 entry = (++lp->cur_rx) & lp->rx_mod_mask;
2045 if (--boguscnt <= 0) break; /* don't stay in loop forever */ 2205 if (--boguscnt <= 0) break; /* don't stay in loop forever */
2046 } 2206 }
2047 2207
@@ -2084,7 +2244,7 @@ pcnet32_close(struct net_device *dev)
2084 spin_lock_irqsave(&lp->lock, flags); 2244 spin_lock_irqsave(&lp->lock, flags);
2085 2245
2086 /* free all allocated skbuffs */ 2246 /* free all allocated skbuffs */
2087 for (i = 0; i < RX_RING_SIZE; i++) { 2247 for (i = 0; i < lp->rx_ring_size; i++) {
2088 lp->rx_ring[i].status = 0; 2248 lp->rx_ring[i].status = 0;
2089 wmb(); /* Make sure adapter sees owner change */ 2249 wmb(); /* Make sure adapter sees owner change */
2090 if (lp->rx_skbuff[i]) { 2250 if (lp->rx_skbuff[i]) {
@@ -2096,7 +2256,7 @@ pcnet32_close(struct net_device *dev)
2096 lp->rx_dma_addr[i] = 0; 2256 lp->rx_dma_addr[i] = 0;
2097 } 2257 }
2098 2258
2099 for (i = 0; i < TX_RING_SIZE; i++) { 2259 for (i = 0; i < lp->tx_ring_size; i++) {
2100 lp->tx_ring[i].status = 0; /* CPU owns buffer */ 2260 lp->tx_ring[i].status = 0; /* CPU owns buffer */
2101 wmb(); /* Make sure adapter sees owner change */ 2261 wmb(); /* Make sure adapter sees owner change */
2102 if (lp->tx_skbuff[i]) { 2262 if (lp->tx_skbuff[i]) {
@@ -2265,6 +2425,7 @@ static void __devexit pcnet32_remove_one(struct pci_dev *pdev)
2265 struct pcnet32_private *lp = dev->priv; 2425 struct pcnet32_private *lp = dev->priv;
2266 2426
2267 unregister_netdev(dev); 2427 unregister_netdev(dev);
2428 pcnet32_free_ring(dev);
2268 release_region(dev->base_addr, PCNET32_TOTAL_SIZE); 2429 release_region(dev->base_addr, PCNET32_TOTAL_SIZE);
2269 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); 2430 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
2270 free_netdev(dev); 2431 free_netdev(dev);
@@ -2340,6 +2501,7 @@ static void __exit pcnet32_cleanup_module(void)
2340 struct pcnet32_private *lp = pcnet32_dev->priv; 2501 struct pcnet32_private *lp = pcnet32_dev->priv;
2341 next_dev = lp->next; 2502 next_dev = lp->next;
2342 unregister_netdev(pcnet32_dev); 2503 unregister_netdev(pcnet32_dev);
2504 pcnet32_free_ring(pcnet32_dev);
2343 release_region(pcnet32_dev->base_addr, PCNET32_TOTAL_SIZE); 2505 release_region(pcnet32_dev->base_addr, PCNET32_TOTAL_SIZE);
2344 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); 2506 pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
2345 free_netdev(pcnet32_dev); 2507 free_netdev(pcnet32_dev);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index f9223c1c5aa4..40c40eba2581 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1028,6 +1028,7 @@ static struct ethtool_ops rtl8169_ethtool_ops = {
1028 .get_strings = rtl8169_get_strings, 1028 .get_strings = rtl8169_get_strings,
1029 .get_stats_count = rtl8169_get_stats_count, 1029 .get_stats_count = rtl8169_get_stats_count,
1030 .get_ethtool_stats = rtl8169_get_ethtool_stats, 1030 .get_ethtool_stats = rtl8169_get_ethtool_stats,
1031 .get_perm_addr = ethtool_op_get_perm_addr,
1031}; 1032};
1032 1033
1033static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum, 1034static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum,
@@ -1512,6 +1513,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1512 /* Get MAC address. FIXME: read EEPROM */ 1513 /* Get MAC address. FIXME: read EEPROM */
1513 for (i = 0; i < MAC_ADDR_LEN; i++) 1514 for (i = 0; i < MAC_ADDR_LEN; i++)
1514 dev->dev_addr[i] = RTL_R8(MAC0 + i); 1515 dev->dev_addr[i] = RTL_R8(MAC0 + i);
1516 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
1515 1517
1516 dev->open = rtl8169_open; 1518 dev->open = rtl8169_open;
1517 dev->hard_start_xmit = rtl8169_start_xmit; 1519 dev->hard_start_xmit = rtl8169_start_xmit;
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
new file mode 100644
index 000000000000..12cde0604580
--- /dev/null
+++ b/drivers/net/rionet.c
@@ -0,0 +1,574 @@
1/*
2 * rionet - Ethernet driver over RapidIO messaging services
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/dma-mapping.h>
16#include <linux/delay.h>
17#include <linux/rio.h>
18#include <linux/rio_drv.h>
19#include <linux/rio_ids.h>
20
21#include <linux/netdevice.h>
22#include <linux/etherdevice.h>
23#include <linux/skbuff.h>
24#include <linux/crc32.h>
25#include <linux/ethtool.h>
26
27#define DRV_NAME "rionet"
28#define DRV_VERSION "0.2"
29#define DRV_AUTHOR "Matt Porter <mporter@kernel.crashing.org>"
30#define DRV_DESC "Ethernet over RapidIO"
31
32MODULE_AUTHOR(DRV_AUTHOR);
33MODULE_DESCRIPTION(DRV_DESC);
34MODULE_LICENSE("GPL");
35
36#define RIONET_DEFAULT_MSGLEVEL \
37 (NETIF_MSG_DRV | \
38 NETIF_MSG_LINK | \
39 NETIF_MSG_RX_ERR | \
40 NETIF_MSG_TX_ERR)
41
42#define RIONET_DOORBELL_JOIN 0x1000
43#define RIONET_DOORBELL_LEAVE 0x1001
44
45#define RIONET_MAILBOX 0
46
47#define RIONET_TX_RING_SIZE CONFIG_RIONET_TX_SIZE
48#define RIONET_RX_RING_SIZE CONFIG_RIONET_RX_SIZE
49
50static LIST_HEAD(rionet_peers);
51
52struct rionet_private {
53 struct rio_mport *mport;
54 struct sk_buff *rx_skb[RIONET_RX_RING_SIZE];
55 struct sk_buff *tx_skb[RIONET_TX_RING_SIZE];
56 struct net_device_stats stats;
57 int rx_slot;
58 int tx_slot;
59 int tx_cnt;
60 int ack_slot;
61 spinlock_t lock;
62 spinlock_t tx_lock;
63 u32 msg_enable;
64};
65
66struct rionet_peer {
67 struct list_head node;
68 struct rio_dev *rdev;
69 struct resource *res;
70};
71
72static int rionet_check = 0;
73static int rionet_capable = 1;
74
75/*
76 * This is a fast lookup table for for translating TX
77 * Ethernet packets into a destination RIO device. It
78 * could be made into a hash table to save memory depending
79 * on system trade-offs.
80 */
81static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES];
82
83#define is_rionet_capable(pef, src_ops, dst_ops) \
84 ((pef & RIO_PEF_INB_MBOX) && \
85 (pef & RIO_PEF_INB_DOORBELL) && \
86 (src_ops & RIO_SRC_OPS_DOORBELL) && \
87 (dst_ops & RIO_DST_OPS_DOORBELL))
88#define dev_rionet_capable(dev) \
89 is_rionet_capable(dev->pef, dev->src_ops, dev->dst_ops)
90
91#define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001)
92#define RIONET_GET_DESTID(x) (*(u16 *)(x + 4))
93
94static struct net_device_stats *rionet_stats(struct net_device *ndev)
95{
96 struct rionet_private *rnet = ndev->priv;
97 return &rnet->stats;
98}
99
100static int rionet_rx_clean(struct net_device *ndev)
101{
102 int i;
103 int error = 0;
104 struct rionet_private *rnet = ndev->priv;
105 void *data;
106
107 i = rnet->rx_slot;
108
109 do {
110 if (!rnet->rx_skb[i])
111 continue;
112
113 if (!(data = rio_get_inb_message(rnet->mport, RIONET_MAILBOX)))
114 break;
115
116 rnet->rx_skb[i]->data = data;
117 skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE);
118 rnet->rx_skb[i]->dev = ndev;
119 rnet->rx_skb[i]->protocol =
120 eth_type_trans(rnet->rx_skb[i], ndev);
121 error = netif_rx(rnet->rx_skb[i]);
122
123 if (error == NET_RX_DROP) {
124 rnet->stats.rx_dropped++;
125 } else if (error == NET_RX_BAD) {
126 if (netif_msg_rx_err(rnet))
127 printk(KERN_WARNING "%s: bad rx packet\n",
128 DRV_NAME);
129 rnet->stats.rx_errors++;
130 } else {
131 rnet->stats.rx_packets++;
132 rnet->stats.rx_bytes += RIO_MAX_MSG_SIZE;
133 }
134
135 } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != rnet->rx_slot);
136
137 return i;
138}
139
140static void rionet_rx_fill(struct net_device *ndev, int end)
141{
142 int i;
143 struct rionet_private *rnet = ndev->priv;
144
145 i = rnet->rx_slot;
146 do {
147 rnet->rx_skb[i] = dev_alloc_skb(RIO_MAX_MSG_SIZE);
148
149 if (!rnet->rx_skb[i])
150 break;
151
152 rio_add_inb_buffer(rnet->mport, RIONET_MAILBOX,
153 rnet->rx_skb[i]->data);
154 } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != end);
155
156 rnet->rx_slot = i;
157}
158
159static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev,
160 struct rio_dev *rdev)
161{
162 struct rionet_private *rnet = ndev->priv;
163
164 rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len);
165 rnet->tx_skb[rnet->tx_slot] = skb;
166
167 rnet->stats.tx_packets++;
168 rnet->stats.tx_bytes += skb->len;
169
170 if (++rnet->tx_cnt == RIONET_TX_RING_SIZE)
171 netif_stop_queue(ndev);
172
173 ++rnet->tx_slot;
174 rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1);
175
176 if (netif_msg_tx_queued(rnet))
177 printk(KERN_INFO "%s: queued skb %8.8x len %8.8x\n", DRV_NAME,
178 (u32) skb, skb->len);
179
180 return 0;
181}
182
183static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
184{
185 int i;
186 struct rionet_private *rnet = ndev->priv;
187 struct ethhdr *eth = (struct ethhdr *)skb->data;
188 u16 destid;
189 unsigned long flags;
190
191 local_irq_save(flags);
192 if (!spin_trylock(&rnet->tx_lock)) {
193 local_irq_restore(flags);
194 return NETDEV_TX_LOCKED;
195 }
196
197 if ((rnet->tx_cnt + 1) > RIONET_TX_RING_SIZE) {
198 netif_stop_queue(ndev);
199 spin_unlock_irqrestore(&rnet->tx_lock, flags);
200 printk(KERN_ERR "%s: BUG! Tx Ring full when queue awake!\n",
201 ndev->name);
202 return NETDEV_TX_BUSY;
203 }
204
205 if (eth->h_dest[0] & 0x01) {
206 for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++)
207 if (rionet_active[i])
208 rionet_queue_tx_msg(skb, ndev,
209 rionet_active[i]);
210 } else if (RIONET_MAC_MATCH(eth->h_dest)) {
211 destid = RIONET_GET_DESTID(eth->h_dest);
212 if (rionet_active[destid])
213 rionet_queue_tx_msg(skb, ndev, rionet_active[destid]);
214 }
215
216 spin_unlock_irqrestore(&rnet->tx_lock, flags);
217
218 return 0;
219}
220
221static void rionet_dbell_event(struct rio_mport *mport, void *dev_id, u16 sid, u16 tid,
222 u16 info)
223{
224 struct net_device *ndev = dev_id;
225 struct rionet_private *rnet = ndev->priv;
226 struct rionet_peer *peer;
227
228 if (netif_msg_intr(rnet))
229 printk(KERN_INFO "%s: doorbell sid %4.4x tid %4.4x info %4.4x",
230 DRV_NAME, sid, tid, info);
231 if (info == RIONET_DOORBELL_JOIN) {
232 if (!rionet_active[sid]) {
233 list_for_each_entry(peer, &rionet_peers, node) {
234 if (peer->rdev->destid == sid)
235 rionet_active[sid] = peer->rdev;
236 }
237 rio_mport_send_doorbell(mport, sid,
238 RIONET_DOORBELL_JOIN);
239 }
240 } else if (info == RIONET_DOORBELL_LEAVE) {
241 rionet_active[sid] = NULL;
242 } else {
243 if (netif_msg_intr(rnet))
244 printk(KERN_WARNING "%s: unhandled doorbell\n",
245 DRV_NAME);
246 }
247}
248
249static void rionet_inb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot)
250{
251 int n;
252 struct net_device *ndev = dev_id;
253 struct rionet_private *rnet = (struct rionet_private *)ndev->priv;
254
255 if (netif_msg_intr(rnet))
256 printk(KERN_INFO "%s: inbound message event, mbox %d slot %d\n",
257 DRV_NAME, mbox, slot);
258
259 spin_lock(&rnet->lock);
260 if ((n = rionet_rx_clean(ndev)) != rnet->rx_slot)
261 rionet_rx_fill(ndev, n);
262 spin_unlock(&rnet->lock);
263}
264
265static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot)
266{
267 struct net_device *ndev = dev_id;
268 struct rionet_private *rnet = ndev->priv;
269
270 spin_lock(&rnet->lock);
271
272 if (netif_msg_intr(rnet))
273 printk(KERN_INFO
274 "%s: outbound message event, mbox %d slot %d\n",
275 DRV_NAME, mbox, slot);
276
277 while (rnet->tx_cnt && (rnet->ack_slot != slot)) {
278 /* dma unmap single */
279 dev_kfree_skb_irq(rnet->tx_skb[rnet->ack_slot]);
280 rnet->tx_skb[rnet->ack_slot] = NULL;
281 ++rnet->ack_slot;
282 rnet->ack_slot &= (RIONET_TX_RING_SIZE - 1);
283 rnet->tx_cnt--;
284 }
285
286 if (rnet->tx_cnt < RIONET_TX_RING_SIZE)
287 netif_wake_queue(ndev);
288
289 spin_unlock(&rnet->lock);
290}
291
292static int rionet_open(struct net_device *ndev)
293{
294 int i, rc = 0;
295 struct rionet_peer *peer, *tmp;
296 u32 pwdcsr;
297 struct rionet_private *rnet = ndev->priv;
298
299 if (netif_msg_ifup(rnet))
300 printk(KERN_INFO "%s: open\n", DRV_NAME);
301
302 if ((rc = rio_request_inb_dbell(rnet->mport,
303 (void *)ndev,
304 RIONET_DOORBELL_JOIN,
305 RIONET_DOORBELL_LEAVE,
306 rionet_dbell_event)) < 0)
307 goto out;
308
309 if ((rc = rio_request_inb_mbox(rnet->mport,
310 (void *)ndev,
311 RIONET_MAILBOX,
312 RIONET_RX_RING_SIZE,
313 rionet_inb_msg_event)) < 0)
314 goto out;
315
316 if ((rc = rio_request_outb_mbox(rnet->mport,
317 (void *)ndev,
318 RIONET_MAILBOX,
319 RIONET_TX_RING_SIZE,
320 rionet_outb_msg_event)) < 0)
321 goto out;
322
323 /* Initialize inbound message ring */
324 for (i = 0; i < RIONET_RX_RING_SIZE; i++)
325 rnet->rx_skb[i] = NULL;
326 rnet->rx_slot = 0;
327 rionet_rx_fill(ndev, 0);
328
329 rnet->tx_slot = 0;
330 rnet->tx_cnt = 0;
331 rnet->ack_slot = 0;
332
333 netif_carrier_on(ndev);
334 netif_start_queue(ndev);
335
336 list_for_each_entry_safe(peer, tmp, &rionet_peers, node) {
337 if (!(peer->res = rio_request_outb_dbell(peer->rdev,
338 RIONET_DOORBELL_JOIN,
339 RIONET_DOORBELL_LEAVE)))
340 {
341 printk(KERN_ERR "%s: error requesting doorbells\n",
342 DRV_NAME);
343 continue;
344 }
345
346 /*
347 * If device has initialized inbound doorbells,
348 * send a join message
349 */
350 rio_read_config_32(peer->rdev, RIO_WRITE_PORT_CSR, &pwdcsr);
351 if (pwdcsr & RIO_DOORBELL_AVAIL)
352 rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN);
353 }
354
355 out:
356 return rc;
357}
358
359static int rionet_close(struct net_device *ndev)
360{
361 struct rionet_private *rnet = (struct rionet_private *)ndev->priv;
362 struct rionet_peer *peer, *tmp;
363 int i;
364
365 if (netif_msg_ifup(rnet))
366 printk(KERN_INFO "%s: close\n", DRV_NAME);
367
368 netif_stop_queue(ndev);
369 netif_carrier_off(ndev);
370
371 for (i = 0; i < RIONET_RX_RING_SIZE; i++)
372 if (rnet->rx_skb[i])
373 kfree_skb(rnet->rx_skb[i]);
374
375 list_for_each_entry_safe(peer, tmp, &rionet_peers, node) {
376 if (rionet_active[peer->rdev->destid]) {
377 rio_send_doorbell(peer->rdev, RIONET_DOORBELL_LEAVE);
378 rionet_active[peer->rdev->destid] = NULL;
379 }
380 rio_release_outb_dbell(peer->rdev, peer->res);
381 }
382
383 rio_release_inb_dbell(rnet->mport, RIONET_DOORBELL_JOIN,
384 RIONET_DOORBELL_LEAVE);
385 rio_release_inb_mbox(rnet->mport, RIONET_MAILBOX);
386 rio_release_outb_mbox(rnet->mport, RIONET_MAILBOX);
387
388 return 0;
389}
390
391static void rionet_remove(struct rio_dev *rdev)
392{
393 struct net_device *ndev = NULL;
394 struct rionet_peer *peer, *tmp;
395
396 unregister_netdev(ndev);
397 kfree(ndev);
398
399 list_for_each_entry_safe(peer, tmp, &rionet_peers, node) {
400 list_del(&peer->node);
401 kfree(peer);
402 }
403}
404
405static void rionet_get_drvinfo(struct net_device *ndev,
406 struct ethtool_drvinfo *info)
407{
408 struct rionet_private *rnet = ndev->priv;
409
410 strcpy(info->driver, DRV_NAME);
411 strcpy(info->version, DRV_VERSION);
412 strcpy(info->fw_version, "n/a");
413 strcpy(info->bus_info, rnet->mport->name);
414}
415
416static u32 rionet_get_msglevel(struct net_device *ndev)
417{
418 struct rionet_private *rnet = ndev->priv;
419
420 return rnet->msg_enable;
421}
422
423static void rionet_set_msglevel(struct net_device *ndev, u32 value)
424{
425 struct rionet_private *rnet = ndev->priv;
426
427 rnet->msg_enable = value;
428}
429
430static struct ethtool_ops rionet_ethtool_ops = {
431 .get_drvinfo = rionet_get_drvinfo,
432 .get_msglevel = rionet_get_msglevel,
433 .set_msglevel = rionet_set_msglevel,
434 .get_link = ethtool_op_get_link,
435};
436
437static int rionet_setup_netdev(struct rio_mport *mport)
438{
439 int rc = 0;
440 struct net_device *ndev = NULL;
441 struct rionet_private *rnet;
442 u16 device_id;
443
444 /* Allocate our net_device structure */
445 ndev = alloc_etherdev(sizeof(struct rionet_private));
446 if (ndev == NULL) {
447 printk(KERN_INFO "%s: could not allocate ethernet device.\n",
448 DRV_NAME);
449 rc = -ENOMEM;
450 goto out;
451 }
452
453 /* Set up private area */
454 rnet = (struct rionet_private *)ndev->priv;
455 rnet->mport = mport;
456
457 /* Set the default MAC address */
458 device_id = rio_local_get_device_id(mport);
459 ndev->dev_addr[0] = 0x00;
460 ndev->dev_addr[1] = 0x01;
461 ndev->dev_addr[2] = 0x00;
462 ndev->dev_addr[3] = 0x01;
463 ndev->dev_addr[4] = device_id >> 8;
464 ndev->dev_addr[5] = device_id & 0xff;
465
466 /* Fill in the driver function table */
467 ndev->open = &rionet_open;
468 ndev->hard_start_xmit = &rionet_start_xmit;
469 ndev->stop = &rionet_close;
470 ndev->get_stats = &rionet_stats;
471 ndev->mtu = RIO_MAX_MSG_SIZE - 14;
472 ndev->features = NETIF_F_LLTX;
473 SET_ETHTOOL_OPS(ndev, &rionet_ethtool_ops);
474
475 SET_MODULE_OWNER(ndev);
476
477 spin_lock_init(&rnet->lock);
478 spin_lock_init(&rnet->tx_lock);
479
480 rnet->msg_enable = RIONET_DEFAULT_MSGLEVEL;
481
482 rc = register_netdev(ndev);
483 if (rc != 0)
484 goto out;
485
486 printk("%s: %s %s Version %s, MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
487 ndev->name,
488 DRV_NAME,
489 DRV_DESC,
490 DRV_VERSION,
491 ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2],
492 ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]);
493
494 out:
495 return rc;
496}
497
498/*
499 * XXX Make multi-net safe
500 */
501static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)
502{
503 int rc = -ENODEV;
504 u32 lpef, lsrc_ops, ldst_ops;
505 struct rionet_peer *peer;
506
507 /* If local device is not rionet capable, give up quickly */
508 if (!rionet_capable)
509 goto out;
510
511 /*
512 * First time through, make sure local device is rionet
513 * capable, setup netdev, and set flags so this is skipped
514 * on later probes
515 */
516 if (!rionet_check) {
517 rio_local_read_config_32(rdev->net->hport, RIO_PEF_CAR, &lpef);
518 rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR,
519 &lsrc_ops);
520 rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR,
521 &ldst_ops);
522 if (!is_rionet_capable(lpef, lsrc_ops, ldst_ops)) {
523 printk(KERN_ERR
524 "%s: local device is not network capable\n",
525 DRV_NAME);
526 rionet_check = 1;
527 rionet_capable = 0;
528 goto out;
529 }
530
531 rc = rionet_setup_netdev(rdev->net->hport);
532 rionet_check = 1;
533 }
534
535 /*
536 * If the remote device has mailbox/doorbell capabilities,
537 * add it to the peer list.
538 */
539 if (dev_rionet_capable(rdev)) {
540 if (!(peer = kmalloc(sizeof(struct rionet_peer), GFP_KERNEL))) {
541 rc = -ENOMEM;
542 goto out;
543 }
544 peer->rdev = rdev;
545 list_add_tail(&peer->node, &rionet_peers);
546 }
547
548 out:
549 return rc;
550}
551
552static struct rio_device_id rionet_id_table[] = {
553 {RIO_DEVICE(RIO_ANY_ID, RIO_ANY_ID)}
554};
555
556static struct rio_driver rionet_driver = {
557 .name = "rionet",
558 .id_table = rionet_id_table,
559 .probe = rionet_probe,
560 .remove = rionet_remove,
561};
562
563static int __init rionet_init(void)
564{
565 return rio_register_driver(&rionet_driver);
566}
567
568static void __exit rionet_exit(void)
569{
570 rio_unregister_driver(&rionet_driver);
571}
572
573module_init(rionet_init);
574module_exit(rionet_exit);
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index ae1996a3bc5c..189203c95330 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -730,6 +730,7 @@ static struct ethtool_ops skge_ethtool_ops = {
730 .phys_id = skge_phys_id, 730 .phys_id = skge_phys_id,
731 .get_stats_count = skge_get_stats_count, 731 .get_stats_count = skge_get_stats_count,
732 .get_ethtool_stats = skge_get_ethtool_stats, 732 .get_ethtool_stats = skge_get_ethtool_stats,
733 .get_perm_addr = ethtool_op_get_perm_addr,
733}; 734};
734 735
735/* 736/*
@@ -3070,6 +3071,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3070 3071
3071 /* read the mac address */ 3072 /* read the mac address */
3072 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); 3073 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN);
3074 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
3073 3075
3074 /* device is off until link detection */ 3076 /* device is off until link detection */
3075 netif_carrier_off(dev); 3077 netif_carrier_off(dev);
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index d500a5771dbc..e148a7212073 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -549,6 +549,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
549 for (i = 0; i < 3; i++) 549 for (i = 0; i < 3; i++)
550 ((u16 *)dev->dev_addr)[i] = 550 ((u16 *)dev->dev_addr)[i] =
551 le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); 551 le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
552 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
552 553
553 dev->base_addr = (unsigned long)ioaddr; 554 dev->base_addr = (unsigned long)ioaddr;
554 dev->irq = irq; 555 dev->irq = irq;
@@ -1619,6 +1620,7 @@ static struct ethtool_ops ethtool_ops = {
1619 .get_link = get_link, 1620 .get_link = get_link,
1620 .get_msglevel = get_msglevel, 1621 .get_msglevel = get_msglevel,
1621 .set_msglevel = set_msglevel, 1622 .set_msglevel = set_msglevel,
1623 .get_perm_addr = ethtool_op_get_perm_addr,
1622}; 1624};
1623 1625
1624static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1626static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index e7b001017b9a..8154bbbb7792 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -318,7 +318,7 @@ static void ibmtr_cleanup_card(struct net_device *dev)
318 if (dev->base_addr) { 318 if (dev->base_addr) {
319 outb(0,dev->base_addr+ADAPTRESET); 319 outb(0,dev->base_addr+ADAPTRESET);
320 320
321 schedule_timeout(TR_RST_TIME); /* wait 50ms */ 321 schedule_timeout_uninterruptible(TR_RST_TIME); /* wait 50ms */
322 322
323 outb(0,dev->base_addr+ADAPTRESETREL); 323 outb(0,dev->base_addr+ADAPTRESETREL);
324 } 324 }
@@ -859,8 +859,7 @@ static int tok_init_card(struct net_device *dev)
859 writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN); 859 writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
860 outb(0, PIOaddr + ADAPTRESET); 860 outb(0, PIOaddr + ADAPTRESET);
861 861
862 current->state=TASK_UNINTERRUPTIBLE; 862 schedule_timeout_uninterruptible(TR_RST_TIME); /* wait 50ms */
863 schedule_timeout(TR_RST_TIME); /* wait 50ms */
864 863
865 outb(0, PIOaddr + ADAPTRESETREL); 864 outb(0, PIOaddr + ADAPTRESETREL);
866#ifdef ENABLE_PAGING 865#ifdef ENABLE_PAGING
@@ -908,8 +907,8 @@ static int tok_open(struct net_device *dev)
908 DPRINTK("Adapter is up and running\n"); 907 DPRINTK("Adapter is up and running\n");
909 return 0; 908 return 0;
910 } 909 }
911 current->state=TASK_INTERRUPTIBLE; 910 i=schedule_timeout_interruptible(TR_RETRY_INTERVAL);
912 i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */ 911 /* wait 30 seconds */
913 if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */ 912 if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */
914 } 913 }
915 outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/ 914 outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 9e7923192a49..05477d24fd49 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -1101,7 +1101,7 @@ static int olympic_close(struct net_device *dev)
1101 1101
1102 while(olympic_priv->srb_queued) { 1102 while(olympic_priv->srb_queued) {
1103 1103
1104 t = schedule_timeout(60*HZ); 1104 t = schedule_timeout_interruptible(60*HZ);
1105 1105
1106 if(signal_pending(current)) { 1106 if(signal_pending(current)) {
1107 printk(KERN_WARNING "%s: SRB timed out.\n",dev->name); 1107 printk(KERN_WARNING "%s: SRB timed out.\n",dev->name);
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index 2e39bf1f7462..c1925590a0e1 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -1243,8 +1243,7 @@ void tms380tr_wait(unsigned long time)
1243 1243
1244 tmp = jiffies + time/(1000000/HZ); 1244 tmp = jiffies + time/(1000000/HZ);
1245 do { 1245 do {
1246 current->state = TASK_INTERRUPTIBLE; 1246 tmp = schedule_timeout_interruptible(tmp);
1247 tmp = schedule_timeout(tmp);
1248 } while(time_after(tmp, jiffies)); 1247 } while(time_after(tmp, jiffies));
1249#else 1248#else
1250 udelay(time); 1249 udelay(time);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index ecfa6f8805ce..4c76cb794bfb 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -419,10 +419,9 @@ typhoon_reset(void __iomem *ioaddr, int wait_type)
419 TYPHOON_STATUS_WAITING_FOR_HOST) 419 TYPHOON_STATUS_WAITING_FOR_HOST)
420 goto out; 420 goto out;
421 421
422 if(wait_type == WaitSleep) { 422 if(wait_type == WaitSleep)
423 set_current_state(TASK_UNINTERRUPTIBLE); 423 schedule_timeout_uninterruptible(1);
424 schedule_timeout(1); 424 else
425 } else
426 udelay(TYPHOON_UDELAY); 425 udelay(TYPHOON_UDELAY);
427 } 426 }
428 427
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index fc7738ffbfff..e7b4bc3820e3 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -814,8 +814,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
814 814
815 for (i = 0; i < 6; i++) 815 for (i = 0; i < 6; i++)
816 dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); 816 dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
817 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
817 818
818 if (!is_valid_ether_addr(dev->dev_addr)) { 819 if (!is_valid_ether_addr(dev->perm_addr)) {
819 rc = -EIO; 820 rc = -EIO;
820 printk(KERN_ERR "Invalid MAC address\n"); 821 printk(KERN_ERR "Invalid MAC address\n");
821 goto err_out_unmap; 822 goto err_out_unmap;
@@ -1829,6 +1830,7 @@ static struct ethtool_ops netdev_ethtool_ops = {
1829 .set_wol = rhine_set_wol, 1830 .set_wol = rhine_set_wol,
1830 .get_sg = ethtool_op_get_sg, 1831 .get_sg = ethtool_op_get_sg,
1831 .get_tx_csum = ethtool_op_get_tx_csum, 1832 .get_tx_csum = ethtool_op_get_tx_csum,
1833 .get_perm_addr = ethtool_op_get_perm_addr,
1832}; 1834};
1833 1835
1834static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1836static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 7ff814fd65d0..ae9e897c255e 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -1617,8 +1617,7 @@ static int get_wait_data(struct cosa_data *cosa)
1617 return r; 1617 return r;
1618 } 1618 }
1619 /* sleep if not ready to read */ 1619 /* sleep if not ready to read */
1620 set_current_state(TASK_INTERRUPTIBLE); 1620 schedule_timeout_interruptible(1);
1621 schedule_timeout(1);
1622 } 1621 }
1623 printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", 1622 printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n",
1624 cosa_getstatus(cosa)); 1623 cosa_getstatus(cosa));
@@ -1644,8 +1643,7 @@ static int put_wait_data(struct cosa_data *cosa, int data)
1644 } 1643 }
1645#if 0 1644#if 0
1646 /* sleep if not ready to read */ 1645 /* sleep if not ready to read */
1647 current->state = TASK_INTERRUPTIBLE; 1646 schedule_timeout_interruptible(1);
1648 schedule_timeout(1);
1649#endif 1647#endif
1650 } 1648 }
1651 printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", 1649 printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n",
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index 9e56fc346ba4..e6d005726aad 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -109,7 +109,7 @@ static long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
109 * < 0 error. 109 * < 0 error.
110 * Context: process */ 110 * Context: process */
111 111
112int __init cycx_drv_init(void) 112static int __init cycx_drv_init(void)
113{ 113{
114 printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, 114 printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE,
115 copyright); 115 copyright);
@@ -119,7 +119,7 @@ int __init cycx_drv_init(void)
119 119
120/* Module 'remove' entry point. 120/* Module 'remove' entry point.
121 * o release all remaining system resources */ 121 * o release all remaining system resources */
122void cycx_drv_cleanup(void) 122static void cycx_drv_cleanup(void)
123{ 123{
124} 124}
125 125
@@ -184,8 +184,7 @@ int cycx_down(struct cycx_hw *hw)
184} 184}
185 185
186/* Enable interrupt generation. */ 186/* Enable interrupt generation. */
187EXPORT_SYMBOL(cycx_inten); 187static void cycx_inten(struct cycx_hw *hw)
188void cycx_inten(struct cycx_hw *hw)
189{ 188{
190 writeb(0, hw->dpmbase); 189 writeb(0, hw->dpmbase);
191} 190}
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c
index 7b48064364dc..430b1f630fb4 100644
--- a/drivers/net/wan/cycx_main.c
+++ b/drivers/net/wan/cycx_main.c
@@ -103,7 +103,7 @@ static struct cycx_device *cycx_card_array; /* adapter data space */
103 * < 0 error. 103 * < 0 error.
104 * Context: process 104 * Context: process
105 */ 105 */
106int __init cycx_init(void) 106static int __init cycx_init(void)
107{ 107{
108 int cnt, err = -ENOMEM; 108 int cnt, err = -ENOMEM;
109 109
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 02d57c0b4243..a631d1c2fa14 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -78,6 +78,7 @@
78 78
79#define CYCLOMX_X25_DEBUG 1 79#define CYCLOMX_X25_DEBUG 1
80 80
81#include <linux/ctype.h> /* isdigit() */
81#include <linux/errno.h> /* return codes */ 82#include <linux/errno.h> /* return codes */
82#include <linux/if_arp.h> /* ARPHRD_HWX25 */ 83#include <linux/if_arp.h> /* ARPHRD_HWX25 */
83#include <linux/kernel.h> /* printk(), and other useful stuff */ 84#include <linux/kernel.h> /* printk(), and other useful stuff */
@@ -418,7 +419,7 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev,
418 419
419 /* Set channel timeouts (default if not specified) */ 420 /* Set channel timeouts (default if not specified) */
420 chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90; 421 chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90;
421 } else if (is_digit(conf->addr[0])) { /* PVC */ 422 } else if (isdigit(conf->addr[0])) { /* PVC */
422 s16 lcn = dec_to_uint(conf->addr, 0); 423 s16 lcn = dec_to_uint(conf->addr, 0);
423 424
424 if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) 425 if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc)
@@ -1531,7 +1532,7 @@ static unsigned dec_to_uint(u8 *str, int len)
1531 if (!len) 1532 if (!len)
1532 len = strlen(str); 1533 len = strlen(str);
1533 1534
1534 for (; len && is_digit(*str); ++str, --len) 1535 for (; len && isdigit(*str); ++str, --len)
1535 val = (val * 10) + (*str - (unsigned) '0'); 1536 val = (val * 10) + (*str - (unsigned) '0');
1536 1537
1537 return val; 1538 return val;
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 520a77a798e2..2f61a47b4716 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -446,8 +446,8 @@ static inline unsigned int dscc4_tx_quiescent(struct dscc4_dev_priv *dpriv,
446 return readl(dpriv->base_addr + CH0FTDA + dpriv->dev_id*4) == dpriv->ltda; 446 return readl(dpriv->base_addr + CH0FTDA + dpriv->dev_id*4) == dpriv->ltda;
447} 447}
448 448
449int state_check(u32 state, struct dscc4_dev_priv *dpriv, struct net_device *dev, 449static int state_check(u32 state, struct dscc4_dev_priv *dpriv,
450 const char *msg) 450 struct net_device *dev, const char *msg)
451{ 451{
452 int ret = 0; 452 int ret = 0;
453 453
@@ -466,8 +466,9 @@ int state_check(u32 state, struct dscc4_dev_priv *dpriv, struct net_device *dev,
466 return ret; 466 return ret;
467} 467}
468 468
469void dscc4_tx_print(struct net_device *dev, struct dscc4_dev_priv *dpriv, 469static void dscc4_tx_print(struct net_device *dev,
470 char *msg) 470 struct dscc4_dev_priv *dpriv,
471 char *msg)
471{ 472{
472 printk(KERN_DEBUG "%s: tx_current=%02d tx_dirty=%02d (%s)\n", 473 printk(KERN_DEBUG "%s: tx_current=%02d tx_dirty=%02d (%s)\n",
473 dev->name, dpriv->tx_current, dpriv->tx_dirty, msg); 474 dev->name, dpriv->tx_current, dpriv->tx_dirty, msg);
@@ -507,7 +508,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
507 } 508 }
508} 509}
509 510
510inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, struct net_device *dev) 511static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
512 struct net_device *dev)
511{ 513{
512 unsigned int dirty = dpriv->rx_dirty%RX_RING_SIZE; 514 unsigned int dirty = dpriv->rx_dirty%RX_RING_SIZE;
513 struct RxFD *rx_fd = dpriv->rx_fd + dirty; 515 struct RxFD *rx_fd = dpriv->rx_fd + dirty;
@@ -542,8 +544,7 @@ static int dscc4_wait_ack_cec(struct dscc4_dev_priv *dpriv,
542 msg, i); 544 msg, i);
543 goto done; 545 goto done;
544 } 546 }
545 set_current_state(TASK_UNINTERRUPTIBLE); 547 schedule_timeout_uninterruptible(10);
546 schedule_timeout(10);
547 rmb(); 548 rmb();
548 } while (++i > 0); 549 } while (++i > 0);
549 printk(KERN_ERR "%s: %s timeout\n", dev->name, msg); 550 printk(KERN_ERR "%s: %s timeout\n", dev->name, msg);
@@ -588,8 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv)
588 (dpriv->iqtx[cur] & Xpr)) 589 (dpriv->iqtx[cur] & Xpr))
589 break; 590 break;
590 smp_rmb(); 591 smp_rmb();
591 set_current_state(TASK_UNINTERRUPTIBLE); 592 schedule_timeout_uninterruptible(10);
592 schedule_timeout(10);
593 } while (++i > 0); 593 } while (++i > 0);
594 594
595 return (i >= 0 ) ? i : -EAGAIN; 595 return (i >= 0 ) ? i : -EAGAIN;
@@ -1035,8 +1035,7 @@ static void dscc4_pci_reset(struct pci_dev *pdev, void __iomem *ioaddr)
1035 /* Flush posted writes */ 1035 /* Flush posted writes */
1036 readl(ioaddr + GSTAR); 1036 readl(ioaddr + GSTAR);
1037 1037
1038 set_current_state(TASK_UNINTERRUPTIBLE); 1038 schedule_timeout_uninterruptible(10);
1039 schedule_timeout(10);
1040 1039
1041 for (i = 0; i < 16; i++) 1040 for (i = 0; i < 16; i++)
1042 pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); 1041 pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]);
@@ -1894,7 +1893,7 @@ try:
1894 * It failed and locked solid. Thus the introduction of a dummy skb. 1893 * It failed and locked solid. Thus the introduction of a dummy skb.
1895 * Problem is acknowledged in errata sheet DS5. Joy :o/ 1894 * Problem is acknowledged in errata sheet DS5. Joy :o/
1896 */ 1895 */
1897struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) 1896static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv)
1898{ 1897{
1899 struct sk_buff *skb; 1898 struct sk_buff *skb;
1900 1899
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 2c83cca34b86..7981a2c7906e 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -74,11 +74,11 @@ MODULE_LICENSE("GPL");
74/* 74/*
75 * Modules parameters and associated varaibles 75 * Modules parameters and associated varaibles
76 */ 76 */
77int fst_txq_low = FST_LOW_WATER_MARK; 77static int fst_txq_low = FST_LOW_WATER_MARK;
78int fst_txq_high = FST_HIGH_WATER_MARK; 78static int fst_txq_high = FST_HIGH_WATER_MARK;
79int fst_max_reads = 7; 79static int fst_max_reads = 7;
80int fst_excluded_cards = 0; 80static int fst_excluded_cards = 0;
81int fst_excluded_list[FST_MAX_CARDS]; 81static int fst_excluded_list[FST_MAX_CARDS];
82 82
83module_param(fst_txq_low, int, 0); 83module_param(fst_txq_low, int, 0);
84module_param(fst_txq_high, int, 0); 84module_param(fst_txq_high, int, 0);
@@ -572,13 +572,13 @@ static void do_bottom_half_rx(struct fst_card_info *card);
572static void fst_process_tx_work_q(unsigned long work_q); 572static void fst_process_tx_work_q(unsigned long work_q);
573static void fst_process_int_work_q(unsigned long work_q); 573static void fst_process_int_work_q(unsigned long work_q);
574 574
575DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); 575static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0);
576DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); 576static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0);
577 577
578struct fst_card_info *fst_card_array[FST_MAX_CARDS]; 578static struct fst_card_info *fst_card_array[FST_MAX_CARDS];
579spinlock_t fst_work_q_lock; 579static spinlock_t fst_work_q_lock;
580u64 fst_work_txq; 580static u64 fst_work_txq;
581u64 fst_work_intq; 581static u64 fst_work_intq;
582 582
583static void 583static void
584fst_q_work_item(u64 * queue, int card_index) 584fst_q_work_item(u64 * queue, int card_index)
@@ -980,8 +980,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd)
980 /* Wait for any previous command to complete */ 980 /* Wait for any previous command to complete */
981 while (mbval > NAK) { 981 while (mbval > NAK) {
982 spin_unlock_irqrestore(&card->card_lock, flags); 982 spin_unlock_irqrestore(&card->card_lock, flags);
983 set_current_state(TASK_UNINTERRUPTIBLE); 983 schedule_timeout_uninterruptible(1);
984 schedule_timeout(1);
985 spin_lock_irqsave(&card->card_lock, flags); 984 spin_lock_irqsave(&card->card_lock, flags);
986 985
987 if (++safety > 2000) { 986 if (++safety > 2000) {
@@ -1498,7 +1497,7 @@ do_bottom_half_rx(struct fst_card_info *card)
1498 * The interrupt service routine 1497 * The interrupt service routine
1499 * Dev_id is our fst_card_info pointer 1498 * Dev_id is our fst_card_info pointer
1500 */ 1499 */
1501irqreturn_t 1500static irqreturn_t
1502fst_intr(int irq, void *dev_id, struct pt_regs *regs) 1501fst_intr(int irq, void *dev_id, struct pt_regs *regs)
1503{ 1502{
1504 struct fst_card_info *card; 1503 struct fst_card_info *card;
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index a5d6891c9d4c..e1601d35dced 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -330,7 +330,7 @@ static int pvc_close(struct net_device *dev)
330 330
331 331
332 332
333int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 333static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
334{ 334{
335 pvc_device *pvc = dev_to_pvc(dev); 335 pvc_device *pvc = dev_to_pvc(dev);
336 fr_proto_pvc_info info; 336 fr_proto_pvc_info info;
diff --git a/drivers/net/wan/lmc/lmc_debug.c b/drivers/net/wan/lmc/lmc_debug.c
index 9dccd9546a17..3b94352b0d03 100644
--- a/drivers/net/wan/lmc/lmc_debug.c
+++ b/drivers/net/wan/lmc/lmc_debug.c
@@ -8,10 +8,10 @@
8/* 8/*
9 * Prints out len, max to 80 octets using printk, 20 per line 9 * Prints out len, max to 80 octets using printk, 20 per line
10 */ 10 */
11void lmcConsoleLog(char *type, unsigned char *ucData, int iLen)
12{
13#ifdef DEBUG 11#ifdef DEBUG
14#ifdef LMC_PACKET_LOG 12#ifdef LMC_PACKET_LOG
13void lmcConsoleLog(char *type, unsigned char *ucData, int iLen)
14{
15 int iNewLine = 1; 15 int iNewLine = 1;
16 char str[80], *pstr; 16 char str[80], *pstr;
17 17
@@ -43,26 +43,24 @@ void lmcConsoleLog(char *type, unsigned char *ucData, int iLen)
43 } 43 }
44 sprintf(pstr, "\n"); 44 sprintf(pstr, "\n");
45 printk(str); 45 printk(str);
46}
46#endif 47#endif
47#endif 48#endif
48}
49 49
50#ifdef DEBUG 50#ifdef DEBUG
51u_int32_t lmcEventLogIndex = 0; 51u_int32_t lmcEventLogIndex = 0;
52u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS]; 52u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS];
53#endif
54 53
55void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3) 54void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3)
56{ 55{
57#ifdef DEBUG
58 lmcEventLogBuf[lmcEventLogIndex++] = EventNum; 56 lmcEventLogBuf[lmcEventLogIndex++] = EventNum;
59 lmcEventLogBuf[lmcEventLogIndex++] = arg2; 57 lmcEventLogBuf[lmcEventLogIndex++] = arg2;
60 lmcEventLogBuf[lmcEventLogIndex++] = arg3; 58 lmcEventLogBuf[lmcEventLogIndex++] = arg3;
61 lmcEventLogBuf[lmcEventLogIndex++] = jiffies; 59 lmcEventLogBuf[lmcEventLogIndex++] = jiffies;
62 60
63 lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1; 61 lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1;
64#endif
65} 62}
63#endif /* DEBUG */
66 64
67void lmc_trace(struct net_device *dev, char *msg){ 65void lmc_trace(struct net_device *dev, char *msg){
68#ifdef LMC_TRACE 66#ifdef LMC_TRACE
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c
index f55ce76b00ed..af8b55fdd9d9 100644
--- a/drivers/net/wan/lmc/lmc_media.c
+++ b/drivers/net/wan/lmc/lmc_media.c
@@ -48,14 +48,6 @@
48 */ 48 */
49 49
50/* 50/*
51 * For lack of a better place, put the SSI cable stuff here.
52 */
53char *lmc_t1_cables[] = {
54 "V.10/RS423", "EIA530A", "reserved", "X.21", "V.35",
55 "EIA449/EIA530/V.36", "V.28/EIA232", "none", NULL
56};
57
58/*
59 * protocol independent method. 51 * protocol independent method.
60 */ 52 */
61static void lmc_set_protocol (lmc_softc_t * const, lmc_ctl_t *); 53static void lmc_set_protocol (lmc_softc_t * const, lmc_ctl_t *);
diff --git a/drivers/net/wan/pc300.h b/drivers/net/wan/pc300.h
index 73401b0f0151..2024b26b99e6 100644
--- a/drivers/net/wan/pc300.h
+++ b/drivers/net/wan/pc300.h
@@ -472,24 +472,8 @@ enum pc300_loopback_cmds {
472 472
473#ifdef __KERNEL__ 473#ifdef __KERNEL__
474/* Function Prototypes */ 474/* Function Prototypes */
475int dma_buf_write(pc300_t *, int, ucchar *, int);
476int dma_buf_read(pc300_t *, int, struct sk_buff *);
477void tx_dma_start(pc300_t *, int); 475void tx_dma_start(pc300_t *, int);
478void rx_dma_start(pc300_t *, int);
479void tx_dma_stop(pc300_t *, int);
480void rx_dma_stop(pc300_t *, int);
481int cpc_queue_xmit(struct sk_buff *, struct net_device *);
482void cpc_net_rx(struct net_device *);
483void cpc_sca_status(pc300_t *, int);
484int cpc_change_mtu(struct net_device *, int);
485int cpc_ioctl(struct net_device *, struct ifreq *, int);
486int ch_config(pc300dev_t *);
487int rx_config(pc300dev_t *);
488int tx_config(pc300dev_t *);
489void cpc_opench(pc300dev_t *);
490void cpc_closech(pc300dev_t *);
491int cpc_open(struct net_device *dev); 476int cpc_open(struct net_device *dev);
492int cpc_close(struct net_device *dev);
493int cpc_set_media(hdlc_device *, int); 477int cpc_set_media(hdlc_device *, int);
494#endif /* __KERNEL__ */ 478#endif /* __KERNEL__ */
495 479
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 3e7753b10717..a3e65d1bc19b 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -291,6 +291,7 @@ static uclong detect_ram(pc300_t *);
291static void plx_init(pc300_t *); 291static void plx_init(pc300_t *);
292static void cpc_trace(struct net_device *, struct sk_buff *, char); 292static void cpc_trace(struct net_device *, struct sk_buff *, char);
293static int cpc_attach(struct net_device *, unsigned short, unsigned short); 293static int cpc_attach(struct net_device *, unsigned short, unsigned short);
294static int cpc_close(struct net_device *dev);
294 295
295#ifdef CONFIG_PC300_MLPPP 296#ifdef CONFIG_PC300_MLPPP
296void cpc_tty_init(pc300dev_t * dev); 297void cpc_tty_init(pc300dev_t * dev);
@@ -437,7 +438,7 @@ static void rx_dma_buf_check(pc300_t * card, int ch)
437 printk("\n"); 438 printk("\n");
438} 439}
439 440
440int dma_get_rx_frame_size(pc300_t * card, int ch) 441static int dma_get_rx_frame_size(pc300_t * card, int ch)
441{ 442{
442 volatile pcsca_bd_t __iomem *ptdescr; 443 volatile pcsca_bd_t __iomem *ptdescr;
443 ucshort first_bd = card->chan[ch].rx_first_bd; 444 ucshort first_bd = card->chan[ch].rx_first_bd;
@@ -462,7 +463,7 @@ int dma_get_rx_frame_size(pc300_t * card, int ch)
462 * dma_buf_write: writes a frame to the Tx DMA buffers 463 * dma_buf_write: writes a frame to the Tx DMA buffers
463 * NOTE: this function writes one frame at a time. 464 * NOTE: this function writes one frame at a time.
464 */ 465 */
465int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) 466static int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len)
466{ 467{
467 int i, nchar; 468 int i, nchar;
468 volatile pcsca_bd_t __iomem *ptdescr; 469 volatile pcsca_bd_t __iomem *ptdescr;
@@ -503,7 +504,7 @@ int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len)
503 * dma_buf_read: reads a frame from the Rx DMA buffers 504 * dma_buf_read: reads a frame from the Rx DMA buffers
504 * NOTE: this function reads one frame at a time. 505 * NOTE: this function reads one frame at a time.
505 */ 506 */
506int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb) 507static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
507{ 508{
508 int nchar; 509 int nchar;
509 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 510 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
@@ -560,7 +561,7 @@ int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
560 return (rcvd); 561 return (rcvd);
561} 562}
562 563
563void tx_dma_stop(pc300_t * card, int ch) 564static void tx_dma_stop(pc300_t * card, int ch)
564{ 565{
565 void __iomem *scabase = card->hw.scabase; 566 void __iomem *scabase = card->hw.scabase;
566 ucchar drr_ena_bit = 1 << (5 + 2 * ch); 567 ucchar drr_ena_bit = 1 << (5 + 2 * ch);
@@ -571,7 +572,7 @@ void tx_dma_stop(pc300_t * card, int ch)
571 cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); 572 cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit);
572} 573}
573 574
574void rx_dma_stop(pc300_t * card, int ch) 575static void rx_dma_stop(pc300_t * card, int ch)
575{ 576{
576 void __iomem *scabase = card->hw.scabase; 577 void __iomem *scabase = card->hw.scabase;
577 ucchar drr_ena_bit = 1 << (4 + 2 * ch); 578 ucchar drr_ena_bit = 1 << (4 + 2 * ch);
@@ -582,7 +583,7 @@ void rx_dma_stop(pc300_t * card, int ch)
582 cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); 583 cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit);
583} 584}
584 585
585void rx_dma_start(pc300_t * card, int ch) 586static void rx_dma_start(pc300_t * card, int ch)
586{ 587{
587 void __iomem *scabase = card->hw.scabase; 588 void __iomem *scabase = card->hw.scabase;
588 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 589 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
@@ -607,7 +608,7 @@ void rx_dma_start(pc300_t * card, int ch)
607/*************************/ 608/*************************/
608/*** FALC Routines ***/ 609/*** FALC Routines ***/
609/*************************/ 610/*************************/
610void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) 611static void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd)
611{ 612{
612 void __iomem *falcbase = card->hw.falcbase; 613 void __iomem *falcbase = card->hw.falcbase;
613 unsigned long i = 0; 614 unsigned long i = 0;
@@ -622,7 +623,7 @@ void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd)
622 cpc_writeb(falcbase + F_REG(CMDR, ch), cmd); 623 cpc_writeb(falcbase + F_REG(CMDR, ch), cmd);
623} 624}
624 625
625void falc_intr_enable(pc300_t * card, int ch) 626static void falc_intr_enable(pc300_t * card, int ch)
626{ 627{
627 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 628 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
628 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 629 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -672,7 +673,7 @@ void falc_intr_enable(pc300_t * card, int ch)
672 } 673 }
673} 674}
674 675
675void falc_open_timeslot(pc300_t * card, int ch, int timeslot) 676static void falc_open_timeslot(pc300_t * card, int ch, int timeslot)
676{ 677{
677 void __iomem *falcbase = card->hw.falcbase; 678 void __iomem *falcbase = card->hw.falcbase;
678 ucchar tshf = card->chan[ch].falc.offset; 679 ucchar tshf = card->chan[ch].falc.offset;
@@ -688,7 +689,7 @@ void falc_open_timeslot(pc300_t * card, int ch, int timeslot)
688 (0x80 >> (timeslot & 0x07))); 689 (0x80 >> (timeslot & 0x07)));
689} 690}
690 691
691void falc_close_timeslot(pc300_t * card, int ch, int timeslot) 692static void falc_close_timeslot(pc300_t * card, int ch, int timeslot)
692{ 693{
693 void __iomem *falcbase = card->hw.falcbase; 694 void __iomem *falcbase = card->hw.falcbase;
694 ucchar tshf = card->chan[ch].falc.offset; 695 ucchar tshf = card->chan[ch].falc.offset;
@@ -704,7 +705,7 @@ void falc_close_timeslot(pc300_t * card, int ch, int timeslot)
704 ~(0x80 >> (timeslot & 0x07))); 705 ~(0x80 >> (timeslot & 0x07)));
705} 706}
706 707
707void falc_close_all_timeslots(pc300_t * card, int ch) 708static void falc_close_all_timeslots(pc300_t * card, int ch)
708{ 709{
709 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 710 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
710 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 711 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -726,7 +727,7 @@ void falc_close_all_timeslots(pc300_t * card, int ch)
726 } 727 }
727} 728}
728 729
729void falc_open_all_timeslots(pc300_t * card, int ch) 730static void falc_open_all_timeslots(pc300_t * card, int ch)
730{ 731{
731 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 732 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
732 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 733 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -758,7 +759,7 @@ void falc_open_all_timeslots(pc300_t * card, int ch)
758 } 759 }
759} 760}
760 761
761void falc_init_timeslot(pc300_t * card, int ch) 762static void falc_init_timeslot(pc300_t * card, int ch)
762{ 763{
763 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 764 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
764 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 765 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -776,7 +777,7 @@ void falc_init_timeslot(pc300_t * card, int ch)
776 } 777 }
777} 778}
778 779
779void falc_enable_comm(pc300_t * card, int ch) 780static void falc_enable_comm(pc300_t * card, int ch)
780{ 781{
781 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 782 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
782 falc_t *pfalc = (falc_t *) & chan->falc; 783 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -792,7 +793,7 @@ void falc_enable_comm(pc300_t * card, int ch)
792 ~((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); 793 ~((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch)));
793} 794}
794 795
795void falc_disable_comm(pc300_t * card, int ch) 796static void falc_disable_comm(pc300_t * card, int ch)
796{ 797{
797 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 798 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
798 falc_t *pfalc = (falc_t *) & chan->falc; 799 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -806,7 +807,7 @@ void falc_disable_comm(pc300_t * card, int ch)
806 ((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); 807 ((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch)));
807} 808}
808 809
809void falc_init_t1(pc300_t * card, int ch) 810static void falc_init_t1(pc300_t * card, int ch)
810{ 811{
811 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 812 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
812 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 813 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -975,7 +976,7 @@ void falc_init_t1(pc300_t * card, int ch)
975 falc_close_all_timeslots(card, ch); 976 falc_close_all_timeslots(card, ch);
976} 977}
977 978
978void falc_init_e1(pc300_t * card, int ch) 979static void falc_init_e1(pc300_t * card, int ch)
979{ 980{
980 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 981 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
981 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 982 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1155,7 +1156,7 @@ void falc_init_e1(pc300_t * card, int ch)
1155 falc_close_all_timeslots(card, ch); 1156 falc_close_all_timeslots(card, ch);
1156} 1157}
1157 1158
1158void falc_init_hdlc(pc300_t * card, int ch) 1159static void falc_init_hdlc(pc300_t * card, int ch)
1159{ 1160{
1160 void __iomem *falcbase = card->hw.falcbase; 1161 void __iomem *falcbase = card->hw.falcbase;
1161 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1162 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
@@ -1181,7 +1182,7 @@ void falc_init_hdlc(pc300_t * card, int ch)
1181 falc_intr_enable(card, ch); 1182 falc_intr_enable(card, ch);
1182} 1183}
1183 1184
1184void te_config(pc300_t * card, int ch) 1185static void te_config(pc300_t * card, int ch)
1185{ 1186{
1186 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1187 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1187 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1188 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1241,7 +1242,7 @@ void te_config(pc300_t * card, int ch)
1241 CPC_UNLOCK(card, flags); 1242 CPC_UNLOCK(card, flags);
1242} 1243}
1243 1244
1244void falc_check_status(pc300_t * card, int ch, unsigned char frs0) 1245static void falc_check_status(pc300_t * card, int ch, unsigned char frs0)
1245{ 1246{
1246 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1247 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1247 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1248 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1397,7 +1398,7 @@ void falc_check_status(pc300_t * card, int ch, unsigned char frs0)
1397 } 1398 }
1398} 1399}
1399 1400
1400void falc_update_stats(pc300_t * card, int ch) 1401static void falc_update_stats(pc300_t * card, int ch)
1401{ 1402{
1402 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1403 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1403 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1404 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1450,7 +1451,7 @@ void falc_update_stats(pc300_t * card, int ch)
1450 * the synchronizer and then sent to the system interface. 1451 * the synchronizer and then sent to the system interface.
1451 *---------------------------------------------------------------------------- 1452 *----------------------------------------------------------------------------
1452 */ 1453 */
1453void falc_remote_loop(pc300_t * card, int ch, int loop_on) 1454static void falc_remote_loop(pc300_t * card, int ch, int loop_on)
1454{ 1455{
1455 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1456 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1456 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1457 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1495,7 +1496,7 @@ void falc_remote_loop(pc300_t * card, int ch, int loop_on)
1495 * coding must be identical. 1496 * coding must be identical.
1496 *---------------------------------------------------------------------------- 1497 *----------------------------------------------------------------------------
1497 */ 1498 */
1498void falc_local_loop(pc300_t * card, int ch, int loop_on) 1499static void falc_local_loop(pc300_t * card, int ch, int loop_on)
1499{ 1500{
1500 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1501 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1501 falc_t *pfalc = (falc_t *) & chan->falc; 1502 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -1522,7 +1523,7 @@ void falc_local_loop(pc300_t * card, int ch, int loop_on)
1522 * looped. They are originated by the FALC-LH transmitter. 1523 * looped. They are originated by the FALC-LH transmitter.
1523 *---------------------------------------------------------------------------- 1524 *----------------------------------------------------------------------------
1524 */ 1525 */
1525void falc_payload_loop(pc300_t * card, int ch, int loop_on) 1526static void falc_payload_loop(pc300_t * card, int ch, int loop_on)
1526{ 1527{
1527 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1528 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1528 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1529 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1576,7 +1577,7 @@ void falc_payload_loop(pc300_t * card, int ch, int loop_on)
1576 * Description: Turns XLU bit off in the proper register 1577 * Description: Turns XLU bit off in the proper register
1577 *---------------------------------------------------------------------------- 1578 *----------------------------------------------------------------------------
1578 */ 1579 */
1579void turn_off_xlu(pc300_t * card, int ch) 1580static void turn_off_xlu(pc300_t * card, int ch)
1580{ 1581{
1581 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1582 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1582 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1583 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1597,7 +1598,7 @@ void turn_off_xlu(pc300_t * card, int ch)
1597 * Description: Turns XLD bit off in the proper register 1598 * Description: Turns XLD bit off in the proper register
1598 *---------------------------------------------------------------------------- 1599 *----------------------------------------------------------------------------
1599 */ 1600 */
1600void turn_off_xld(pc300_t * card, int ch) 1601static void turn_off_xld(pc300_t * card, int ch)
1601{ 1602{
1602 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1603 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1603 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1604 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1619,7 +1620,7 @@ void turn_off_xld(pc300_t * card, int ch)
1619 * to generate a LOOP activation code over a T1/E1 line. 1620 * to generate a LOOP activation code over a T1/E1 line.
1620 *---------------------------------------------------------------------------- 1621 *----------------------------------------------------------------------------
1621 */ 1622 */
1622void falc_generate_loop_up_code(pc300_t * card, int ch) 1623static void falc_generate_loop_up_code(pc300_t * card, int ch)
1623{ 1624{
1624 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1625 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1625 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1626 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1652,7 +1653,7 @@ void falc_generate_loop_up_code(pc300_t * card, int ch)
1652 * to generate a LOOP deactivation code over a T1/E1 line. 1653 * to generate a LOOP deactivation code over a T1/E1 line.
1653 *---------------------------------------------------------------------------- 1654 *----------------------------------------------------------------------------
1654 */ 1655 */
1655void falc_generate_loop_down_code(pc300_t * card, int ch) 1656static void falc_generate_loop_down_code(pc300_t * card, int ch)
1656{ 1657{
1657 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1658 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1658 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1659 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1682,7 +1683,7 @@ void falc_generate_loop_down_code(pc300_t * card, int ch)
1682 * it on the reception side. 1683 * it on the reception side.
1683 *---------------------------------------------------------------------------- 1684 *----------------------------------------------------------------------------
1684 */ 1685 */
1685void falc_pattern_test(pc300_t * card, int ch, unsigned int activate) 1686static void falc_pattern_test(pc300_t * card, int ch, unsigned int activate)
1686{ 1687{
1687 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1688 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1688 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 1689 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -1729,7 +1730,7 @@ void falc_pattern_test(pc300_t * card, int ch, unsigned int activate)
1729 * Description: This routine returns the bit error counter value 1730 * Description: This routine returns the bit error counter value
1730 *---------------------------------------------------------------------------- 1731 *----------------------------------------------------------------------------
1731 */ 1732 */
1732ucshort falc_pattern_test_error(pc300_t * card, int ch) 1733static ucshort falc_pattern_test_error(pc300_t * card, int ch)
1733{ 1734{
1734 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; 1735 pc300ch_t *chan = (pc300ch_t *) & card->chan[ch];
1735 falc_t *pfalc = (falc_t *) & chan->falc; 1736 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -1769,7 +1770,7 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx)
1769 netif_rx(skb); 1770 netif_rx(skb);
1770} 1771}
1771 1772
1772void cpc_tx_timeout(struct net_device *dev) 1773static void cpc_tx_timeout(struct net_device *dev)
1773{ 1774{
1774 pc300dev_t *d = (pc300dev_t *) dev->priv; 1775 pc300dev_t *d = (pc300dev_t *) dev->priv;
1775 pc300ch_t *chan = (pc300ch_t *) d->chan; 1776 pc300ch_t *chan = (pc300ch_t *) d->chan;
@@ -1797,7 +1798,7 @@ void cpc_tx_timeout(struct net_device *dev)
1797 netif_wake_queue(dev); 1798 netif_wake_queue(dev);
1798} 1799}
1799 1800
1800int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) 1801static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1801{ 1802{
1802 pc300dev_t *d = (pc300dev_t *) dev->priv; 1803 pc300dev_t *d = (pc300dev_t *) dev->priv;
1803 pc300ch_t *chan = (pc300ch_t *) d->chan; 1804 pc300ch_t *chan = (pc300ch_t *) d->chan;
@@ -1880,7 +1881,7 @@ int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1880 return 0; 1881 return 0;
1881} 1882}
1882 1883
1883void cpc_net_rx(struct net_device *dev) 1884static void cpc_net_rx(struct net_device *dev)
1884{ 1885{
1885 pc300dev_t *d = (pc300dev_t *) dev->priv; 1886 pc300dev_t *d = (pc300dev_t *) dev->priv;
1886 pc300ch_t *chan = (pc300ch_t *) d->chan; 1887 pc300ch_t *chan = (pc300ch_t *) d->chan;
@@ -2403,7 +2404,7 @@ static irqreturn_t cpc_intr(int irq, void *dev_id, struct pt_regs *regs)
2403 return IRQ_HANDLED; 2404 return IRQ_HANDLED;
2404} 2405}
2405 2406
2406void cpc_sca_status(pc300_t * card, int ch) 2407static void cpc_sca_status(pc300_t * card, int ch)
2407{ 2408{
2408 ucchar ilar; 2409 ucchar ilar;
2409 void __iomem *scabase = card->hw.scabase; 2410 void __iomem *scabase = card->hw.scabase;
@@ -2495,7 +2496,7 @@ void cpc_sca_status(pc300_t * card, int ch)
2495 } 2496 }
2496} 2497}
2497 2498
2498void cpc_falc_status(pc300_t * card, int ch) 2499static void cpc_falc_status(pc300_t * card, int ch)
2499{ 2500{
2500 pc300ch_t *chan = &card->chan[ch]; 2501 pc300ch_t *chan = &card->chan[ch];
2501 falc_t *pfalc = (falc_t *) & chan->falc; 2502 falc_t *pfalc = (falc_t *) & chan->falc;
@@ -2523,7 +2524,7 @@ void cpc_falc_status(pc300_t * card, int ch)
2523 CPC_UNLOCK(card, flags); 2524 CPC_UNLOCK(card, flags);
2524} 2525}
2525 2526
2526int cpc_change_mtu(struct net_device *dev, int new_mtu) 2527static int cpc_change_mtu(struct net_device *dev, int new_mtu)
2527{ 2528{
2528 if ((new_mtu < 128) || (new_mtu > PC300_DEF_MTU)) 2529 if ((new_mtu < 128) || (new_mtu > PC300_DEF_MTU))
2529 return -EINVAL; 2530 return -EINVAL;
@@ -2531,7 +2532,7 @@ int cpc_change_mtu(struct net_device *dev, int new_mtu)
2531 return 0; 2532 return 0;
2532} 2533}
2533 2534
2534int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2535static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2535{ 2536{
2536 hdlc_device *hdlc = dev_to_hdlc(dev); 2537 hdlc_device *hdlc = dev_to_hdlc(dev);
2537 pc300dev_t *d = (pc300dev_t *) dev->priv; 2538 pc300dev_t *d = (pc300dev_t *) dev->priv;
@@ -2856,7 +2857,7 @@ static int clock_rate_calc(uclong rate, uclong clock, int *br_io)
2856 } 2857 }
2857} 2858}
2858 2859
2859int ch_config(pc300dev_t * d) 2860static int ch_config(pc300dev_t * d)
2860{ 2861{
2861 pc300ch_t *chan = (pc300ch_t *) d->chan; 2862 pc300ch_t *chan = (pc300ch_t *) d->chan;
2862 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; 2863 pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
@@ -3004,7 +3005,7 @@ int ch_config(pc300dev_t * d)
3004 return 0; 3005 return 0;
3005} 3006}
3006 3007
3007int rx_config(pc300dev_t * d) 3008static int rx_config(pc300dev_t * d)
3008{ 3009{
3009 pc300ch_t *chan = (pc300ch_t *) d->chan; 3010 pc300ch_t *chan = (pc300ch_t *) d->chan;
3010 pc300_t *card = (pc300_t *) chan->card; 3011 pc300_t *card = (pc300_t *) chan->card;
@@ -3035,7 +3036,7 @@ int rx_config(pc300dev_t * d)
3035 return 0; 3036 return 0;
3036} 3037}
3037 3038
3038int tx_config(pc300dev_t * d) 3039static int tx_config(pc300dev_t * d)
3039{ 3040{
3040 pc300ch_t *chan = (pc300ch_t *) d->chan; 3041 pc300ch_t *chan = (pc300ch_t *) d->chan;
3041 pc300_t *card = (pc300_t *) chan->card; 3042 pc300_t *card = (pc300_t *) chan->card;
@@ -3098,7 +3099,7 @@ static int cpc_attach(struct net_device *dev, unsigned short encoding,
3098 return 0; 3099 return 0;
3099} 3100}
3100 3101
3101void cpc_opench(pc300dev_t * d) 3102static void cpc_opench(pc300dev_t * d)
3102{ 3103{
3103 pc300ch_t *chan = (pc300ch_t *) d->chan; 3104 pc300ch_t *chan = (pc300ch_t *) d->chan;
3104 pc300_t *card = (pc300_t *) chan->card; 3105 pc300_t *card = (pc300_t *) chan->card;
@@ -3116,7 +3117,7 @@ void cpc_opench(pc300dev_t * d)
3116 cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR)); 3117 cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR));
3117} 3118}
3118 3119
3119void cpc_closech(pc300dev_t * d) 3120static void cpc_closech(pc300dev_t * d)
3120{ 3121{
3121 pc300ch_t *chan = (pc300ch_t *) d->chan; 3122 pc300ch_t *chan = (pc300ch_t *) d->chan;
3122 pc300_t *card = (pc300_t *) chan->card; 3123 pc300_t *card = (pc300_t *) chan->card;
@@ -3173,7 +3174,7 @@ int cpc_open(struct net_device *dev)
3173 return 0; 3174 return 0;
3174} 3175}
3175 3176
3176int cpc_close(struct net_device *dev) 3177static int cpc_close(struct net_device *dev)
3177{ 3178{
3178 hdlc_device *hdlc = dev_to_hdlc(dev); 3179 hdlc_device *hdlc = dev_to_hdlc(dev);
3179 pc300dev_t *d = (pc300dev_t *) dev->priv; 3180 pc300dev_t *d = (pc300dev_t *) dev->priv;
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c
index 8454bf6caaa7..52f26b9c69d2 100644
--- a/drivers/net/wan/pc300_tty.c
+++ b/drivers/net/wan/pc300_tty.c
@@ -112,10 +112,10 @@ typedef struct _st_cpc_tty_area {
112static struct tty_driver serial_drv; 112static struct tty_driver serial_drv;
113 113
114/* local variables */ 114/* local variables */
115st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; 115static st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS];
116 116
117int cpc_tty_cnt=0; /* number of intrfaces configured with MLPPP */ 117static int cpc_tty_cnt = 0; /* number of intrfaces configured with MLPPP */
118int cpc_tty_unreg_flag = 0; 118static int cpc_tty_unreg_flag = 0;
119 119
120/* TTY functions prototype */ 120/* TTY functions prototype */
121static int cpc_tty_open(struct tty_struct *tty, struct file *flip); 121static int cpc_tty_open(struct tty_struct *tty, struct file *flip);
@@ -132,9 +132,9 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx);
132static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); 132static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char);
133static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); 133static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char);
134 134
135int pc300_tiocmset(struct tty_struct *, struct file *, 135static int pc300_tiocmset(struct tty_struct *, struct file *,
136 unsigned int, unsigned int); 136 unsigned int, unsigned int);
137int pc300_tiocmget(struct tty_struct *, struct file *); 137static int pc300_tiocmget(struct tty_struct *, struct file *);
138 138
139/* functions called by PC300 driver */ 139/* functions called by PC300 driver */
140void cpc_tty_init(pc300dev_t *dev); 140void cpc_tty_init(pc300dev_t *dev);
@@ -538,8 +538,8 @@ static int cpc_tty_chars_in_buffer(struct tty_struct *tty)
538 return(0); 538 return(0);
539} 539}
540 540
541int pc300_tiocmset(struct tty_struct *tty, struct file *file, 541static int pc300_tiocmset(struct tty_struct *tty, struct file *file,
542 unsigned int set, unsigned int clear) 542 unsigned int set, unsigned int clear)
543{ 543{
544 st_cpc_tty_area *cpc_tty; 544 st_cpc_tty_area *cpc_tty;
545 545
@@ -565,7 +565,7 @@ int pc300_tiocmset(struct tty_struct *tty, struct file *file,
565 return 0; 565 return 0;
566} 566}
567 567
568int pc300_tiocmget(struct tty_struct *tty, struct file *file) 568static int pc300_tiocmget(struct tty_struct *tty, struct file *file)
569{ 569{
570 unsigned int result; 570 unsigned int result;
571 unsigned char status; 571 unsigned char status;
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index 3ac9a45b20fa..036adc4f8ba7 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -182,7 +182,7 @@ static char sdla_byte(struct net_device *dev, int addr)
182 return(byte); 182 return(byte);
183} 183}
184 184
185void sdla_stop(struct net_device *dev) 185static void sdla_stop(struct net_device *dev)
186{ 186{
187 struct frad_local *flp; 187 struct frad_local *flp;
188 188
@@ -209,7 +209,7 @@ void sdla_stop(struct net_device *dev)
209 } 209 }
210} 210}
211 211
212void sdla_start(struct net_device *dev) 212static void sdla_start(struct net_device *dev)
213{ 213{
214 struct frad_local *flp; 214 struct frad_local *flp;
215 215
@@ -247,7 +247,7 @@ void sdla_start(struct net_device *dev)
247 * 247 *
248 ***************************************************/ 248 ***************************************************/
249 249
250int sdla_z80_poll(struct net_device *dev, int z80_addr, int jiffs, char resp1, char resp2) 250static int sdla_z80_poll(struct net_device *dev, int z80_addr, int jiffs, char resp1, char resp2)
251{ 251{
252 unsigned long start, done, now; 252 unsigned long start, done, now;
253 char resp, *temp; 253 char resp, *temp;
@@ -505,7 +505,7 @@ static int sdla_cmd(struct net_device *dev, int cmd, short dlci, short flags,
505 505
506static int sdla_reconfig(struct net_device *dev); 506static int sdla_reconfig(struct net_device *dev);
507 507
508int sdla_activate(struct net_device *slave, struct net_device *master) 508static int sdla_activate(struct net_device *slave, struct net_device *master)
509{ 509{
510 struct frad_local *flp; 510 struct frad_local *flp;
511 int i; 511 int i;
@@ -527,7 +527,7 @@ int sdla_activate(struct net_device *slave, struct net_device *master)
527 return(0); 527 return(0);
528} 528}
529 529
530int sdla_deactivate(struct net_device *slave, struct net_device *master) 530static int sdla_deactivate(struct net_device *slave, struct net_device *master)
531{ 531{
532 struct frad_local *flp; 532 struct frad_local *flp;
533 int i; 533 int i;
@@ -549,7 +549,7 @@ int sdla_deactivate(struct net_device *slave, struct net_device *master)
549 return(0); 549 return(0);
550} 550}
551 551
552int sdla_assoc(struct net_device *slave, struct net_device *master) 552static int sdla_assoc(struct net_device *slave, struct net_device *master)
553{ 553{
554 struct frad_local *flp; 554 struct frad_local *flp;
555 int i; 555 int i;
@@ -585,7 +585,7 @@ int sdla_assoc(struct net_device *slave, struct net_device *master)
585 return(0); 585 return(0);
586} 586}
587 587
588int sdla_deassoc(struct net_device *slave, struct net_device *master) 588static int sdla_deassoc(struct net_device *slave, struct net_device *master)
589{ 589{
590 struct frad_local *flp; 590 struct frad_local *flp;
591 int i; 591 int i;
@@ -613,7 +613,7 @@ int sdla_deassoc(struct net_device *slave, struct net_device *master)
613 return(0); 613 return(0);
614} 614}
615 615
616int sdla_dlci_conf(struct net_device *slave, struct net_device *master, int get) 616static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, int get)
617{ 617{
618 struct frad_local *flp; 618 struct frad_local *flp;
619 struct dlci_local *dlp; 619 struct dlci_local *dlp;
@@ -1324,7 +1324,7 @@ NOTE: This is rather a useless action right now, as the
1324 return(0); 1324 return(0);
1325} 1325}
1326 1326
1327int sdla_change_mtu(struct net_device *dev, int new_mtu) 1327static int sdla_change_mtu(struct net_device *dev, int new_mtu)
1328{ 1328{
1329 struct frad_local *flp; 1329 struct frad_local *flp;
1330 1330
@@ -1337,7 +1337,7 @@ int sdla_change_mtu(struct net_device *dev, int new_mtu)
1337 return(-EOPNOTSUPP); 1337 return(-EOPNOTSUPP);
1338} 1338}
1339 1339
1340int sdla_set_config(struct net_device *dev, struct ifmap *map) 1340static int sdla_set_config(struct net_device *dev, struct ifmap *map)
1341{ 1341{
1342 struct frad_local *flp; 1342 struct frad_local *flp;
1343 int i; 1343 int i;
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c
index 0497dbdb8631..7f1ce9d4333e 100644
--- a/drivers/net/wan/sdla_fr.c
+++ b/drivers/net/wan/sdla_fr.c
@@ -822,7 +822,7 @@ static int new_if(struct wan_device* wandev, struct net_device* dev,
822 chan->card = card; 822 chan->card = card;
823 823
824 /* verify media address */ 824 /* verify media address */
825 if (is_digit(conf->addr[0])) { 825 if (isdigit(conf->addr[0])) {
826 826
827 dlci = dec_to_uint(conf->addr, 0); 827 dlci = dec_to_uint(conf->addr, 0);
828 828
@@ -3456,7 +3456,7 @@ static unsigned int dec_to_uint (unsigned char* str, int len)
3456 if (!len) 3456 if (!len)
3457 len = strlen(str); 3457 len = strlen(str);
3458 3458
3459 for (val = 0; len && is_digit(*str); ++str, --len) 3459 for (val = 0; len && isdigit(*str); ++str, --len)
3460 val = (val * 10) + (*str - (unsigned)'0'); 3460 val = (val * 10) + (*str - (unsigned)'0');
3461 3461
3462 return val; 3462 return val;
diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c
index 8a95d61a2f8f..63f846d6f3a6 100644
--- a/drivers/net/wan/sdla_x25.c
+++ b/drivers/net/wan/sdla_x25.c
@@ -957,7 +957,7 @@ static int new_if(struct wan_device* wandev, struct net_device* dev,
957 chan->hold_timeout = (conf->hold_timeout) ? 957 chan->hold_timeout = (conf->hold_timeout) ?
958 conf->hold_timeout : 10; 958 conf->hold_timeout : 10;
959 959
960 }else if (is_digit(conf->addr[0])){ /* PVC */ 960 }else if (isdigit(conf->addr[0])){ /* PVC */
961 int lcn = dec_to_uint(conf->addr, 0); 961 int lcn = dec_to_uint(conf->addr, 0);
962 962
963 if ((lcn >= card->u.x.lo_pvc) && (lcn <= card->u.x.hi_pvc)){ 963 if ((lcn >= card->u.x.lo_pvc) && (lcn <= card->u.x.hi_pvc)){
@@ -3875,7 +3875,7 @@ static unsigned int dec_to_uint (unsigned char* str, int len)
3875 if (!len) 3875 if (!len)
3876 len = strlen(str); 3876 len = strlen(str);
3877 3877
3878 for (val = 0; len && is_digit(*str); ++str, --len) 3878 for (val = 0; len && isdigit(*str); ++str, --len)
3879 val = (val * 10) + (*str - (unsigned)'0'); 3879 val = (val * 10) + (*str - (unsigned)'0');
3880 3880
3881 return val; 3881 return val;
@@ -3896,9 +3896,9 @@ static unsigned int hex_to_uint (unsigned char* str, int len)
3896 for (val = 0; len; ++str, --len) 3896 for (val = 0; len; ++str, --len)
3897 { 3897 {
3898 ch = *str; 3898 ch = *str;
3899 if (is_digit(ch)) 3899 if (isdigit(ch))
3900 val = (val << 4) + (ch - (unsigned)'0'); 3900 val = (val << 4) + (ch - (unsigned)'0');
3901 else if (is_hex_digit(ch)) 3901 else if (isxdigit(ch))
3902 val = (val << 4) + ((ch & 0xDF) - (unsigned)'A' + 10); 3902 val = (val << 4) + ((ch & 0xDF) - (unsigned)'A' + 10);
3903 else break; 3903 else break;
3904 } 3904 }
diff --git a/drivers/net/wan/sdladrv.c b/drivers/net/wan/sdladrv.c
index c8bc6da57a41..7c2cf2e76300 100644
--- a/drivers/net/wan/sdladrv.c
+++ b/drivers/net/wan/sdladrv.c
@@ -642,9 +642,7 @@ int sdla_mapmem (sdlahw_t* hw, unsigned long addr)
642 * Enable interrupt generation. 642 * Enable interrupt generation.
643 */ 643 */
644 644
645EXPORT_SYMBOL(sdla_inten); 645static int sdla_inten (sdlahw_t* hw)
646
647int sdla_inten (sdlahw_t* hw)
648{ 646{
649 unsigned port = hw->port; 647 unsigned port = hw->port;
650 int tmp, i; 648 int tmp, i;
@@ -698,8 +696,7 @@ int sdla_inten (sdlahw_t* hw)
698 * Disable interrupt generation. 696 * Disable interrupt generation.
699 */ 697 */
700 698
701EXPORT_SYMBOL(sdla_intde); 699#if 0
702
703int sdla_intde (sdlahw_t* hw) 700int sdla_intde (sdlahw_t* hw)
704{ 701{
705 unsigned port = hw->port; 702 unsigned port = hw->port;
@@ -748,14 +745,13 @@ int sdla_intde (sdlahw_t* hw)
748 } 745 }
749 return 0; 746 return 0;
750} 747}
748#endif /* 0 */
751 749
752/*============================================================================ 750/*============================================================================
753 * Acknowledge SDLA hardware interrupt. 751 * Acknowledge SDLA hardware interrupt.
754 */ 752 */
755 753
756EXPORT_SYMBOL(sdla_intack); 754static int sdla_intack (sdlahw_t* hw)
757
758int sdla_intack (sdlahw_t* hw)
759{ 755{
760 unsigned port = hw->port; 756 unsigned port = hw->port;
761 int tmp; 757 int tmp;
@@ -827,8 +823,7 @@ void read_S514_int_stat (sdlahw_t* hw, u32* int_status)
827 * Generate an interrupt to adapter's CPU. 823 * Generate an interrupt to adapter's CPU.
828 */ 824 */
829 825
830EXPORT_SYMBOL(sdla_intr); 826#if 0
831
832int sdla_intr (sdlahw_t* hw) 827int sdla_intr (sdlahw_t* hw)
833{ 828{
834 unsigned port = hw->port; 829 unsigned port = hw->port;
@@ -863,6 +858,7 @@ int sdla_intr (sdlahw_t* hw)
863 } 858 }
864 return 0; 859 return 0;
865} 860}
861#endif /* 0 */
866 862
867/*============================================================================ 863/*============================================================================
868 * Execute Adapter Command. 864 * Execute Adapter Command.
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index b56a7b516d24..3731b22f6757 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -221,7 +221,7 @@ static void sppp_clear_timeout(struct sppp *p)
221 * here. 221 * here.
222 */ 222 */
223 223
224void sppp_input (struct net_device *dev, struct sk_buff *skb) 224static void sppp_input (struct net_device *dev, struct sk_buff *skb)
225{ 225{
226 struct ppp_header *h; 226 struct ppp_header *h;
227 struct sppp *sp = (struct sppp *)sppp_of(dev); 227 struct sppp *sp = (struct sppp *)sppp_of(dev);
@@ -355,8 +355,6 @@ done:
355 return; 355 return;
356} 356}
357 357
358EXPORT_SYMBOL(sppp_input);
359
360/* 358/*
361 * Handle transmit packets. 359 * Handle transmit packets.
362 */ 360 */
@@ -990,7 +988,7 @@ EXPORT_SYMBOL(sppp_reopen);
990 * the mtu is out of range. 988 * the mtu is out of range.
991 */ 989 */
992 990
993int sppp_change_mtu(struct net_device *dev, int new_mtu) 991static int sppp_change_mtu(struct net_device *dev, int new_mtu)
994{ 992{
995 if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP)) 993 if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP))
996 return -EINVAL; 994 return -EINVAL;
@@ -998,8 +996,6 @@ int sppp_change_mtu(struct net_device *dev, int new_mtu)
998 return 0; 996 return 0;
999} 997}
1000 998
1001EXPORT_SYMBOL(sppp_change_mtu);
1002
1003/** 999/**
1004 * sppp_do_ioctl - Ioctl handler for ppp/hdlc 1000 * sppp_do_ioctl - Ioctl handler for ppp/hdlc
1005 * @dev: Device subject to ioctl 1001 * @dev: Device subject to ioctl
@@ -1456,7 +1452,7 @@ static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_t
1456 return 0; 1452 return 0;
1457} 1453}
1458 1454
1459struct packet_type sppp_packet_type = { 1455static struct packet_type sppp_packet_type = {
1460 .type = __constant_htons(ETH_P_WAN_PPP), 1456 .type = __constant_htons(ETH_P_WAN_PPP),
1461 .func = sppp_rcv, 1457 .func = sppp_rcv,
1462}; 1458};
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 587869d86eee..d57011028b72 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -618,12 +618,12 @@ static int atmel_lock_mac(struct atmel_private *priv);
618static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); 618static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data);
619static void atmel_command_irq(struct atmel_private *priv); 619static void atmel_command_irq(struct atmel_private *priv);
620static int atmel_validate_channel(struct atmel_private *priv, int channel); 620static int atmel_validate_channel(struct atmel_private *priv, int channel);
621static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, 621static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
622 u16 frame_len, u8 rssi); 622 u16 frame_len, u8 rssi);
623static void atmel_management_timer(u_long a); 623static void atmel_management_timer(u_long a);
624static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size); 624static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size);
625static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size); 625static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size);
626static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, 626static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
627 u8 *body, int body_len); 627 u8 *body, int body_len);
628 628
629static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index); 629static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index);
@@ -827,7 +827,7 @@ static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, u16 l
827static int start_tx (struct sk_buff *skb, struct net_device *dev) 827static int start_tx (struct sk_buff *skb, struct net_device *dev)
828{ 828{
829 struct atmel_private *priv = netdev_priv(dev); 829 struct atmel_private *priv = netdev_priv(dev);
830 struct ieee80211_hdr header; 830 struct ieee80211_hdr_4addr header;
831 unsigned long flags; 831 unsigned long flags;
832 u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; 832 u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN;
833 u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; 833 u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
@@ -902,7 +902,7 @@ static int start_tx (struct sk_buff *skb, struct net_device *dev)
902} 902}
903 903
904static void atmel_transmit_management_frame(struct atmel_private *priv, 904static void atmel_transmit_management_frame(struct atmel_private *priv,
905 struct ieee80211_hdr *header, 905 struct ieee80211_hdr_4addr *header,
906 u8 *body, int body_len) 906 u8 *body, int body_len)
907{ 907{
908 u16 buff; 908 u16 buff;
@@ -917,7 +917,7 @@ static void atmel_transmit_management_frame(struct atmel_private *priv,
917 tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT); 917 tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT);
918} 918}
919 919
920static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, 920static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
921 u16 msdu_size, u16 rx_packet_loc, u32 crc) 921 u16 msdu_size, u16 rx_packet_loc, u32 crc)
922{ 922{
923 /* fast path: unfragmented packet copy directly into skbuf */ 923 /* fast path: unfragmented packet copy directly into skbuf */
@@ -990,7 +990,7 @@ static int probe_crc(struct atmel_private *priv, u16 packet_loc, u16 msdu_size)
990 return (crc ^ 0xffffffff) == netcrc; 990 return (crc ^ 0xffffffff) == netcrc;
991} 991}
992 992
993static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, 993static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
994 u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags) 994 u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags)
995{ 995{
996 u8 mac4[6]; 996 u8 mac4[6];
@@ -1082,7 +1082,7 @@ static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *heade
1082static void rx_done_irq(struct atmel_private *priv) 1082static void rx_done_irq(struct atmel_private *priv)
1083{ 1083{
1084 int i; 1084 int i;
1085 struct ieee80211_hdr header; 1085 struct ieee80211_hdr_4addr header;
1086 1086
1087 for (i = 0; 1087 for (i = 0;
1088 atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID && 1088 atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID &&
@@ -2650,7 +2650,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c
2650 2650
2651static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) 2651static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len)
2652{ 2652{
2653 struct ieee80211_hdr header; 2653 struct ieee80211_hdr_4addr header;
2654 struct auth_body auth; 2654 struct auth_body auth;
2655 2655
2656 header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); 2656 header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
@@ -2688,7 +2688,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
2688{ 2688{
2689 u8 *ssid_el_p; 2689 u8 *ssid_el_p;
2690 int bodysize; 2690 int bodysize;
2691 struct ieee80211_hdr header; 2691 struct ieee80211_hdr_4addr header;
2692 struct ass_req_format { 2692 struct ass_req_format {
2693 u16 capability; 2693 u16 capability;
2694 u16 listen_interval; 2694 u16 listen_interval;
@@ -2738,7 +2738,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
2738 atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize); 2738 atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize);
2739} 2739}
2740 2740
2741static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr *header) 2741static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr_4addr *header)
2742{ 2742{
2743 if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS) 2743 if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS)
2744 return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0; 2744 return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0;
@@ -2788,7 +2788,7 @@ static int retrieve_bss(struct atmel_private *priv)
2788} 2788}
2789 2789
2790 2790
2791static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr *header, 2791static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
2792 u16 capability, u16 beacon_period, u8 channel, u8 rssi, 2792 u16 capability, u16 beacon_period, u8 channel, u8 rssi,
2793 u8 ssid_len, u8 *ssid, int is_beacon) 2793 u8 ssid_len, u8 *ssid, int is_beacon)
2794{ 2794{
@@ -3072,7 +3072,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
3072} 3072}
3073 3073
3074/* deals with incoming managment frames. */ 3074/* deals with incoming managment frames. */
3075static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, 3075static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
3076 u16 frame_len, u8 rssi) 3076 u16 frame_len, u8 rssi)
3077{ 3077{
3078 u16 subtype; 3078 u16 subtype;
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index b0501243b175..42e61c68c325 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -6,10 +6,10 @@
6void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, 6void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
7 struct hostap_80211_rx_status *rx_stats) 7 struct hostap_80211_rx_status *rx_stats)
8{ 8{
9 struct ieee80211_hdr *hdr; 9 struct ieee80211_hdr_4addr *hdr;
10 u16 fc; 10 u16 fc;
11 11
12 hdr = (struct ieee80211_hdr *) skb->data; 12 hdr = (struct ieee80211_hdr_4addr *) skb->data;
13 13
14 printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " 14 printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d "
15 "jiffies=%ld\n", 15 "jiffies=%ld\n",
@@ -51,7 +51,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
51 int hdrlen, phdrlen, head_need, tail_need; 51 int hdrlen, phdrlen, head_need, tail_need;
52 u16 fc; 52 u16 fc;
53 int prism_header, ret; 53 int prism_header, ret;
54 struct ieee80211_hdr *hdr; 54 struct ieee80211_hdr_4addr *hdr;
55 55
56 iface = netdev_priv(dev); 56 iface = netdev_priv(dev);
57 local = iface->local; 57 local = iface->local;
@@ -70,7 +70,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
70 phdrlen = 0; 70 phdrlen = 0;
71 } 71 }
72 72
73 hdr = (struct ieee80211_hdr *) skb->data; 73 hdr = (struct ieee80211_hdr_4addr *) skb->data;
74 fc = le16_to_cpu(hdr->frame_ctl); 74 fc = le16_to_cpu(hdr->frame_ctl);
75 75
76 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { 76 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
@@ -215,7 +215,7 @@ prism2_frag_cache_find(local_info_t *local, unsigned int seq,
215 215
216/* Called only as a tasklet (software IRQ) */ 216/* Called only as a tasklet (software IRQ) */
217static struct sk_buff * 217static struct sk_buff *
218prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) 218prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
219{ 219{
220 struct sk_buff *skb = NULL; 220 struct sk_buff *skb = NULL;
221 u16 sc; 221 u16 sc;
@@ -229,7 +229,7 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr)
229 if (frag == 0) { 229 if (frag == 0) {
230 /* Reserve enough space to fit maximum frame length */ 230 /* Reserve enough space to fit maximum frame length */
231 skb = dev_alloc_skb(local->dev->mtu + 231 skb = dev_alloc_skb(local->dev->mtu +
232 sizeof(struct ieee80211_hdr) + 232 sizeof(struct ieee80211_hdr_4addr) +
233 8 /* LLC */ + 233 8 /* LLC */ +
234 2 /* alignment */ + 234 2 /* alignment */ +
235 8 /* WEP */ + ETH_ALEN /* WDS */); 235 8 /* WEP */ + ETH_ALEN /* WDS */);
@@ -267,7 +267,7 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr)
267 267
268/* Called only as a tasklet (software IRQ) */ 268/* Called only as a tasklet (software IRQ) */
269static int prism2_frag_cache_invalidate(local_info_t *local, 269static int prism2_frag_cache_invalidate(local_info_t *local,
270 struct ieee80211_hdr *hdr) 270 struct ieee80211_hdr_4addr *hdr)
271{ 271{
272 u16 sc; 272 u16 sc;
273 unsigned int seq; 273 unsigned int seq;
@@ -441,7 +441,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
441 u16 stype) 441 u16 stype)
442{ 442{
443 if (local->iw_mode == IW_MODE_MASTER) { 443 if (local->iw_mode == IW_MODE_MASTER) {
444 hostap_update_sta_ps(local, (struct ieee80211_hdr *) 444 hostap_update_sta_ps(local, (struct ieee80211_hdr_4addr *)
445 skb->data); 445 skb->data);
446 } 446 }
447 447
@@ -520,7 +520,7 @@ static inline struct net_device *prism2_rx_get_wds(local_info_t *local,
520 520
521 521
522static inline int 522static inline int
523hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, 523hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
524 u16 fc, struct net_device **wds) 524 u16 fc, struct net_device **wds)
525{ 525{
526 /* FIX: is this really supposed to accept WDS frames only in Master 526 /* FIX: is this really supposed to accept WDS frames only in Master
@@ -579,13 +579,13 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
579{ 579{
580 struct net_device *dev = local->dev; 580 struct net_device *dev = local->dev;
581 u16 fc, ethertype; 581 u16 fc, ethertype;
582 struct ieee80211_hdr *hdr; 582 struct ieee80211_hdr_4addr *hdr;
583 u8 *pos; 583 u8 *pos;
584 584
585 if (skb->len < 24) 585 if (skb->len < 24)
586 return 0; 586 return 0;
587 587
588 hdr = (struct ieee80211_hdr *) skb->data; 588 hdr = (struct ieee80211_hdr_4addr *) skb->data;
589 fc = le16_to_cpu(hdr->frame_ctl); 589 fc = le16_to_cpu(hdr->frame_ctl);
590 590
591 /* check that the frame is unicast frame to us */ 591 /* check that the frame is unicast frame to us */
@@ -619,13 +619,13 @@ static inline int
619hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, 619hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
620 struct ieee80211_crypt_data *crypt) 620 struct ieee80211_crypt_data *crypt)
621{ 621{
622 struct ieee80211_hdr *hdr; 622 struct ieee80211_hdr_4addr *hdr;
623 int res, hdrlen; 623 int res, hdrlen;
624 624
625 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 625 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
626 return 0; 626 return 0;
627 627
628 hdr = (struct ieee80211_hdr *) skb->data; 628 hdr = (struct ieee80211_hdr_4addr *) skb->data;
629 hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 629 hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
630 630
631 if (local->tkip_countermeasures && 631 if (local->tkip_countermeasures &&
@@ -658,13 +658,13 @@ static inline int
658hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, 658hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
659 int keyidx, struct ieee80211_crypt_data *crypt) 659 int keyidx, struct ieee80211_crypt_data *crypt)
660{ 660{
661 struct ieee80211_hdr *hdr; 661 struct ieee80211_hdr_4addr *hdr;
662 int res, hdrlen; 662 int res, hdrlen;
663 663
664 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) 664 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
665 return 0; 665 return 0;
666 666
667 hdr = (struct ieee80211_hdr *) skb->data; 667 hdr = (struct ieee80211_hdr_4addr *) skb->data;
668 hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 668 hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
669 669
670 atomic_inc(&crypt->refcnt); 670 atomic_inc(&crypt->refcnt);
@@ -689,7 +689,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
689{ 689{
690 struct hostap_interface *iface; 690 struct hostap_interface *iface;
691 local_info_t *local; 691 local_info_t *local;
692 struct ieee80211_hdr *hdr; 692 struct ieee80211_hdr_4addr *hdr;
693 size_t hdrlen; 693 size_t hdrlen;
694 u16 fc, type, stype, sc; 694 u16 fc, type, stype, sc;
695 struct net_device *wds = NULL; 695 struct net_device *wds = NULL;
@@ -716,7 +716,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
716 dev = local->ddev; 716 dev = local->ddev;
717 iface = netdev_priv(dev); 717 iface = netdev_priv(dev);
718 718
719 hdr = (struct ieee80211_hdr *) skb->data; 719 hdr = (struct ieee80211_hdr_4addr *) skb->data;
720 stats = hostap_get_stats(dev); 720 stats = hostap_get_stats(dev);
721 721
722 if (skb->len < 10) 722 if (skb->len < 10)
@@ -889,7 +889,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
889 if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && 889 if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
890 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 890 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
891 goto rx_dropped; 891 goto rx_dropped;
892 hdr = (struct ieee80211_hdr *) skb->data; 892 hdr = (struct ieee80211_hdr_4addr *) skb->data;
893 893
894 /* skb: hdr + (possibly fragmented) plaintext payload */ 894 /* skb: hdr + (possibly fragmented) plaintext payload */
895 895
@@ -941,7 +941,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
941 /* this was the last fragment and the frame will be 941 /* this was the last fragment and the frame will be
942 * delivered, so remove skb from fragment cache */ 942 * delivered, so remove skb from fragment cache */
943 skb = frag_skb; 943 skb = frag_skb;
944 hdr = (struct ieee80211_hdr *) skb->data; 944 hdr = (struct ieee80211_hdr_4addr *) skb->data;
945 prism2_frag_cache_invalidate(local, hdr); 945 prism2_frag_cache_invalidate(local, hdr);
946 } 946 }
947 947
@@ -952,7 +952,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
952 hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) 952 hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt))
953 goto rx_dropped; 953 goto rx_dropped;
954 954
955 hdr = (struct ieee80211_hdr *) skb->data; 955 hdr = (struct ieee80211_hdr_4addr *) skb->data;
956 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { 956 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) {
957 if (local->ieee_802_1x && 957 if (local->ieee_802_1x &&
958 hostap_is_eapol_frame(local, skb)) { 958 hostap_is_eapol_frame(local, skb)) {
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 6358015f6526..9d24f8a38ac5 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -1,9 +1,9 @@
1void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) 1void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
2{ 2{
3 struct ieee80211_hdr *hdr; 3 struct ieee80211_hdr_4addr *hdr;
4 u16 fc; 4 u16 fc;
5 5
6 hdr = (struct ieee80211_hdr *) skb->data; 6 hdr = (struct ieee80211_hdr_4addr *) skb->data;
7 7
8 printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", 8 printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n",
9 name, skb->len, jiffies); 9 name, skb->len, jiffies);
@@ -41,7 +41,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
41 struct hostap_interface *iface; 41 struct hostap_interface *iface;
42 local_info_t *local; 42 local_info_t *local;
43 int need_headroom, need_tailroom = 0; 43 int need_headroom, need_tailroom = 0;
44 struct ieee80211_hdr hdr; 44 struct ieee80211_hdr_4addr hdr;
45 u16 fc, ethertype = 0; 45 u16 fc, ethertype = 0;
46 enum { 46 enum {
47 WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME 47 WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME
@@ -244,7 +244,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
244 struct hostap_interface *iface; 244 struct hostap_interface *iface;
245 local_info_t *local; 245 local_info_t *local;
246 struct hostap_skb_tx_data *meta; 246 struct hostap_skb_tx_data *meta;
247 struct ieee80211_hdr *hdr; 247 struct ieee80211_hdr_4addr *hdr;
248 u16 fc; 248 u16 fc;
249 249
250 iface = netdev_priv(dev); 250 iface = netdev_priv(dev);
@@ -266,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
266 meta->iface = iface; 266 meta->iface = iface;
267 267
268 if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { 268 if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
269 hdr = (struct ieee80211_hdr *) skb->data; 269 hdr = (struct ieee80211_hdr_4addr *) skb->data;
270 fc = le16_to_cpu(hdr->frame_ctl); 270 fc = le16_to_cpu(hdr->frame_ctl);
271 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && 271 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
272 WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { 272 WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) {
@@ -289,7 +289,7 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
289{ 289{
290 struct hostap_interface *iface; 290 struct hostap_interface *iface;
291 local_info_t *local; 291 local_info_t *local;
292 struct ieee80211_hdr *hdr; 292 struct ieee80211_hdr_4addr *hdr;
293 u16 fc; 293 u16 fc;
294 int hdr_len, res; 294 int hdr_len, res;
295 295
@@ -303,7 +303,7 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
303 303
304 if (local->tkip_countermeasures && 304 if (local->tkip_countermeasures &&
305 crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { 305 crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) {
306 hdr = (struct ieee80211_hdr *) skb->data; 306 hdr = (struct ieee80211_hdr_4addr *) skb->data;
307 if (net_ratelimit()) { 307 if (net_ratelimit()) {
308 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 308 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
309 "TX packet to " MACSTR "\n", 309 "TX packet to " MACSTR "\n",
@@ -317,15 +317,15 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
317 if (skb == NULL) 317 if (skb == NULL)
318 return NULL; 318 return NULL;
319 319
320 if ((skb_headroom(skb) < crypt->ops->extra_prefix_len || 320 if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len ||
321 skb_tailroom(skb) < crypt->ops->extra_postfix_len) && 321 skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) &&
322 pskb_expand_head(skb, crypt->ops->extra_prefix_len, 322 pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len,
323 crypt->ops->extra_postfix_len, GFP_ATOMIC)) { 323 crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) {
324 kfree_skb(skb); 324 kfree_skb(skb);
325 return NULL; 325 return NULL;
326 } 326 }
327 327
328 hdr = (struct ieee80211_hdr *) skb->data; 328 hdr = (struct ieee80211_hdr_4addr *) skb->data;
329 fc = le16_to_cpu(hdr->frame_ctl); 329 fc = le16_to_cpu(hdr->frame_ctl);
330 hdr_len = hostap_80211_get_hdrlen(fc); 330 hdr_len = hostap_80211_get_hdrlen(fc);
331 331
@@ -360,7 +360,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
360 ap_tx_ret tx_ret; 360 ap_tx_ret tx_ret;
361 struct hostap_skb_tx_data *meta; 361 struct hostap_skb_tx_data *meta;
362 int no_encrypt = 0; 362 int no_encrypt = 0;
363 struct ieee80211_hdr *hdr; 363 struct ieee80211_hdr_4addr *hdr;
364 364
365 iface = netdev_priv(dev); 365 iface = netdev_priv(dev);
366 local = iface->local; 366 local = iface->local;
@@ -403,7 +403,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
403 tx_ret = hostap_handle_sta_tx(local, &tx); 403 tx_ret = hostap_handle_sta_tx(local, &tx);
404 skb = tx.skb; 404 skb = tx.skb;
405 meta = (struct hostap_skb_tx_data *) skb->cb; 405 meta = (struct hostap_skb_tx_data *) skb->cb;
406 hdr = (struct ieee80211_hdr *) skb->data; 406 hdr = (struct ieee80211_hdr_4addr *) skb->data;
407 fc = le16_to_cpu(hdr->frame_ctl); 407 fc = le16_to_cpu(hdr->frame_ctl);
408 switch (tx_ret) { 408 switch (tx_ret) {
409 case AP_TX_CONTINUE: 409 case AP_TX_CONTINUE:
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 930cef8367f2..087d9269af34 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -591,14 +591,14 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data)
591{ 591{
592 struct ap_data *ap = data; 592 struct ap_data *ap = data;
593 u16 fc; 593 u16 fc;
594 struct ieee80211_hdr *hdr; 594 struct ieee80211_hdr_4addr *hdr;
595 595
596 if (!ap->local->hostapd || !ap->local->apdev) { 596 if (!ap->local->hostapd || !ap->local->apdev) {
597 dev_kfree_skb(skb); 597 dev_kfree_skb(skb);
598 return; 598 return;
599 } 599 }
600 600
601 hdr = (struct ieee80211_hdr *) skb->data; 601 hdr = (struct ieee80211_hdr_4addr *) skb->data;
602 fc = le16_to_cpu(hdr->frame_ctl); 602 fc = le16_to_cpu(hdr->frame_ctl);
603 603
604 /* Pass the TX callback frame to the hostapd; use 802.11 header version 604 /* Pass the TX callback frame to the hostapd; use 802.11 header version
@@ -623,7 +623,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
623{ 623{
624 struct ap_data *ap = data; 624 struct ap_data *ap = data;
625 struct net_device *dev = ap->local->dev; 625 struct net_device *dev = ap->local->dev;
626 struct ieee80211_hdr *hdr; 626 struct ieee80211_hdr_4addr *hdr;
627 u16 fc, *pos, auth_alg, auth_transaction, status; 627 u16 fc, *pos, auth_alg, auth_transaction, status;
628 struct sta_info *sta = NULL; 628 struct sta_info *sta = NULL;
629 char *txt = NULL; 629 char *txt = NULL;
@@ -633,7 +633,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
633 return; 633 return;
634 } 634 }
635 635
636 hdr = (struct ieee80211_hdr *) skb->data; 636 hdr = (struct ieee80211_hdr_4addr *) skb->data;
637 fc = le16_to_cpu(hdr->frame_ctl); 637 fc = le16_to_cpu(hdr->frame_ctl);
638 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || 638 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
639 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || 639 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH ||
@@ -692,7 +692,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
692{ 692{
693 struct ap_data *ap = data; 693 struct ap_data *ap = data;
694 struct net_device *dev = ap->local->dev; 694 struct net_device *dev = ap->local->dev;
695 struct ieee80211_hdr *hdr; 695 struct ieee80211_hdr_4addr *hdr;
696 u16 fc, *pos, status; 696 u16 fc, *pos, status;
697 struct sta_info *sta = NULL; 697 struct sta_info *sta = NULL;
698 char *txt = NULL; 698 char *txt = NULL;
@@ -702,7 +702,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
702 return; 702 return;
703 } 703 }
704 704
705 hdr = (struct ieee80211_hdr *) skb->data; 705 hdr = (struct ieee80211_hdr_4addr *) skb->data;
706 fc = le16_to_cpu(hdr->frame_ctl); 706 fc = le16_to_cpu(hdr->frame_ctl);
707 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || 707 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
708 (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && 708 (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP &&
@@ -757,12 +757,12 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
757static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) 757static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
758{ 758{
759 struct ap_data *ap = data; 759 struct ap_data *ap = data;
760 struct ieee80211_hdr *hdr; 760 struct ieee80211_hdr_4addr *hdr;
761 struct sta_info *sta; 761 struct sta_info *sta;
762 762
763 if (skb->len < 24) 763 if (skb->len < 24)
764 goto fail; 764 goto fail;
765 hdr = (struct ieee80211_hdr *) skb->data; 765 hdr = (struct ieee80211_hdr_4addr *) skb->data;
766 if (ok) { 766 if (ok) {
767 spin_lock(&ap->sta_table_lock); 767 spin_lock(&ap->sta_table_lock);
768 sta = ap_get_sta(ap, hdr->addr1); 768 sta = ap_get_sta(ap, hdr->addr1);
@@ -918,7 +918,7 @@ static void prism2_send_mgmt(struct net_device *dev,
918{ 918{
919 struct hostap_interface *iface; 919 struct hostap_interface *iface;
920 local_info_t *local; 920 local_info_t *local;
921 struct ieee80211_hdr *hdr; 921 struct ieee80211_hdr_4addr *hdr;
922 u16 fc; 922 u16 fc;
923 struct sk_buff *skb; 923 struct sk_buff *skb;
924 struct hostap_skb_tx_data *meta; 924 struct hostap_skb_tx_data *meta;
@@ -944,7 +944,7 @@ static void prism2_send_mgmt(struct net_device *dev,
944 944
945 fc = type_subtype; 945 fc = type_subtype;
946 hdrlen = hostap_80211_get_hdrlen(fc); 946 hdrlen = hostap_80211_get_hdrlen(fc);
947 hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); 947 hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, hdrlen);
948 if (body) 948 if (body)
949 memcpy(skb_put(skb, body_len), body, body_len); 949 memcpy(skb_put(skb, body_len), body, body_len);
950 950
@@ -1256,14 +1256,14 @@ static char * ap_auth_make_challenge(struct ap_data *ap)
1256 } 1256 }
1257 1257
1258 skb = dev_alloc_skb(WLAN_AUTH_CHALLENGE_LEN + 1258 skb = dev_alloc_skb(WLAN_AUTH_CHALLENGE_LEN +
1259 ap->crypt->extra_prefix_len + 1259 ap->crypt->extra_mpdu_prefix_len +
1260 ap->crypt->extra_postfix_len); 1260 ap->crypt->extra_mpdu_postfix_len);
1261 if (skb == NULL) { 1261 if (skb == NULL) {
1262 kfree(tmpbuf); 1262 kfree(tmpbuf);
1263 return NULL; 1263 return NULL;
1264 } 1264 }
1265 1265
1266 skb_reserve(skb, ap->crypt->extra_prefix_len); 1266 skb_reserve(skb, ap->crypt->extra_mpdu_prefix_len);
1267 memset(skb_put(skb, WLAN_AUTH_CHALLENGE_LEN), 0, 1267 memset(skb_put(skb, WLAN_AUTH_CHALLENGE_LEN), 0,
1268 WLAN_AUTH_CHALLENGE_LEN); 1268 WLAN_AUTH_CHALLENGE_LEN);
1269 if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) { 1269 if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) {
@@ -1272,7 +1272,7 @@ static char * ap_auth_make_challenge(struct ap_data *ap)
1272 return NULL; 1272 return NULL;
1273 } 1273 }
1274 1274
1275 memcpy(tmpbuf, skb->data + ap->crypt->extra_prefix_len, 1275 memcpy(tmpbuf, skb->data + ap->crypt->extra_mpdu_prefix_len,
1276 WLAN_AUTH_CHALLENGE_LEN); 1276 WLAN_AUTH_CHALLENGE_LEN);
1277 dev_kfree_skb(skb); 1277 dev_kfree_skb(skb);
1278 1278
@@ -1285,7 +1285,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1285 struct hostap_80211_rx_status *rx_stats) 1285 struct hostap_80211_rx_status *rx_stats)
1286{ 1286{
1287 struct net_device *dev = local->dev; 1287 struct net_device *dev = local->dev;
1288 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1288 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
1289 size_t hdrlen; 1289 size_t hdrlen;
1290 struct ap_data *ap = local->ap; 1290 struct ap_data *ap = local->ap;
1291 char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; 1291 char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL;
@@ -1498,7 +1498,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1498 struct hostap_80211_rx_status *rx_stats, int reassoc) 1498 struct hostap_80211_rx_status *rx_stats, int reassoc)
1499{ 1499{
1500 struct net_device *dev = local->dev; 1500 struct net_device *dev = local->dev;
1501 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1501 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
1502 char body[12], *p, *lpos; 1502 char body[12], *p, *lpos;
1503 int len, left; 1503 int len, left;
1504 u16 *pos; 1504 u16 *pos;
@@ -1705,7 +1705,7 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1705 struct hostap_80211_rx_status *rx_stats) 1705 struct hostap_80211_rx_status *rx_stats)
1706{ 1706{
1707 struct net_device *dev = local->dev; 1707 struct net_device *dev = local->dev;
1708 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1708 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
1709 char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); 1709 char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN);
1710 int len; 1710 int len;
1711 u16 reason_code, *pos; 1711 u16 reason_code, *pos;
@@ -1746,7 +1746,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1746 struct hostap_80211_rx_status *rx_stats) 1746 struct hostap_80211_rx_status *rx_stats)
1747{ 1747{
1748 struct net_device *dev = local->dev; 1748 struct net_device *dev = local->dev;
1749 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1749 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
1750 char *body = skb->data + IEEE80211_MGMT_HDR_LEN; 1750 char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
1751 int len; 1751 int len;
1752 u16 reason_code, *pos; 1752 u16 reason_code, *pos;
@@ -1784,7 +1784,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1784 1784
1785/* Called only as a scheduled task for pending AP frames. */ 1785/* Called only as a scheduled task for pending AP frames. */
1786static void ap_handle_data_nullfunc(local_info_t *local, 1786static void ap_handle_data_nullfunc(local_info_t *local,
1787 struct ieee80211_hdr *hdr) 1787 struct ieee80211_hdr_4addr *hdr)
1788{ 1788{
1789 struct net_device *dev = local->dev; 1789 struct net_device *dev = local->dev;
1790 1790
@@ -1801,7 +1801,7 @@ static void ap_handle_data_nullfunc(local_info_t *local,
1801 1801
1802/* Called only as a scheduled task for pending AP frames. */ 1802/* Called only as a scheduled task for pending AP frames. */
1803static void ap_handle_dropped_data(local_info_t *local, 1803static void ap_handle_dropped_data(local_info_t *local,
1804 struct ieee80211_hdr *hdr) 1804 struct ieee80211_hdr_4addr *hdr)
1805{ 1805{
1806 struct net_device *dev = local->dev; 1806 struct net_device *dev = local->dev;
1807 struct sta_info *sta; 1807 struct sta_info *sta;
@@ -1860,7 +1860,7 @@ static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta,
1860 1860
1861/* Called only as a scheduled task for pending AP frames. */ 1861/* Called only as a scheduled task for pending AP frames. */
1862static void handle_pspoll(local_info_t *local, 1862static void handle_pspoll(local_info_t *local,
1863 struct ieee80211_hdr *hdr, 1863 struct ieee80211_hdr_4addr *hdr,
1864 struct hostap_80211_rx_status *rx_stats) 1864 struct hostap_80211_rx_status *rx_stats)
1865{ 1865{
1866 struct net_device *dev = local->dev; 1866 struct net_device *dev = local->dev;
@@ -1979,7 +1979,7 @@ static void handle_wds_oper_queue(void *data)
1979static void handle_beacon(local_info_t *local, struct sk_buff *skb, 1979static void handle_beacon(local_info_t *local, struct sk_buff *skb,
1980 struct hostap_80211_rx_status *rx_stats) 1980 struct hostap_80211_rx_status *rx_stats)
1981{ 1981{
1982 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1982 struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
1983 char *body = skb->data + IEEE80211_MGMT_HDR_LEN; 1983 char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
1984 int len, left; 1984 int len, left;
1985 u16 *pos, beacon_int, capability; 1985 u16 *pos, beacon_int, capability;
@@ -2137,11 +2137,11 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2137 struct net_device *dev = local->dev; 2137 struct net_device *dev = local->dev;
2138#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2138#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2139 u16 fc, type, stype; 2139 u16 fc, type, stype;
2140 struct ieee80211_hdr *hdr; 2140 struct ieee80211_hdr_4addr *hdr;
2141 2141
2142 /* FIX: should give skb->len to handler functions and check that the 2142 /* FIX: should give skb->len to handler functions and check that the
2143 * buffer is long enough */ 2143 * buffer is long enough */
2144 hdr = (struct ieee80211_hdr *) skb->data; 2144 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2145 fc = le16_to_cpu(hdr->frame_ctl); 2145 fc = le16_to_cpu(hdr->frame_ctl);
2146 type = WLAN_FC_GET_TYPE(fc); 2146 type = WLAN_FC_GET_TYPE(fc);
2147 stype = WLAN_FC_GET_STYPE(fc); 2147 stype = WLAN_FC_GET_STYPE(fc);
@@ -2258,7 +2258,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
2258 struct hostap_interface *iface; 2258 struct hostap_interface *iface;
2259 local_info_t *local; 2259 local_info_t *local;
2260 u16 fc; 2260 u16 fc;
2261 struct ieee80211_hdr *hdr; 2261 struct ieee80211_hdr_4addr *hdr;
2262 2262
2263 iface = netdev_priv(dev); 2263 iface = netdev_priv(dev);
2264 local = iface->local; 2264 local = iface->local;
@@ -2268,7 +2268,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
2268 2268
2269 local->stats.rx_packets++; 2269 local->stats.rx_packets++;
2270 2270
2271 hdr = (struct ieee80211_hdr *) skb->data; 2271 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2272 fc = le16_to_cpu(hdr->frame_ctl); 2272 fc = le16_to_cpu(hdr->frame_ctl);
2273 2273
2274 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && 2274 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
@@ -2289,7 +2289,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
2289static void schedule_packet_send(local_info_t *local, struct sta_info *sta) 2289static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2290{ 2290{
2291 struct sk_buff *skb; 2291 struct sk_buff *skb;
2292 struct ieee80211_hdr *hdr; 2292 struct ieee80211_hdr_4addr *hdr;
2293 struct hostap_80211_rx_status rx_stats; 2293 struct hostap_80211_rx_status rx_stats;
2294 2294
2295 if (skb_queue_empty(&sta->tx_buf)) 2295 if (skb_queue_empty(&sta->tx_buf))
@@ -2302,7 +2302,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2302 return; 2302 return;
2303 } 2303 }
2304 2304
2305 hdr = (struct ieee80211_hdr *) skb_put(skb, 16); 2305 hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, 16);
2306 2306
2307 /* Generate a fake pspoll frame to start packet delivery */ 2307 /* Generate a fake pspoll frame to start packet delivery */
2308 hdr->frame_ctl = __constant_cpu_to_le16( 2308 hdr->frame_ctl = __constant_cpu_to_le16(
@@ -2685,7 +2685,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2685 struct sta_info *sta = NULL; 2685 struct sta_info *sta = NULL;
2686 struct sk_buff *skb = tx->skb; 2686 struct sk_buff *skb = tx->skb;
2687 int set_tim, ret; 2687 int set_tim, ret;
2688 struct ieee80211_hdr *hdr; 2688 struct ieee80211_hdr_4addr *hdr;
2689 struct hostap_skb_tx_data *meta; 2689 struct hostap_skb_tx_data *meta;
2690 2690
2691 meta = (struct hostap_skb_tx_data *) skb->cb; 2691 meta = (struct hostap_skb_tx_data *) skb->cb;
@@ -2694,7 +2694,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2694 meta->iface->type == HOSTAP_INTERFACE_STA) 2694 meta->iface->type == HOSTAP_INTERFACE_STA)
2695 goto out; 2695 goto out;
2696 2696
2697 hdr = (struct ieee80211_hdr *) skb->data; 2697 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2698 2698
2699 if (hdr->addr1[0] & 0x01) { 2699 if (hdr->addr1[0] & 0x01) {
2700 /* broadcast/multicast frame - no AP related processing */ 2700 /* broadcast/multicast frame - no AP related processing */
@@ -2821,10 +2821,10 @@ void hostap_handle_sta_release(void *ptr)
2821void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) 2821void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2822{ 2822{
2823 struct sta_info *sta; 2823 struct sta_info *sta;
2824 struct ieee80211_hdr *hdr; 2824 struct ieee80211_hdr_4addr *hdr;
2825 struct hostap_skb_tx_data *meta; 2825 struct hostap_skb_tx_data *meta;
2826 2826
2827 hdr = (struct ieee80211_hdr *) skb->data; 2827 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2828 meta = (struct hostap_skb_tx_data *) skb->cb; 2828 meta = (struct hostap_skb_tx_data *) skb->cb;
2829 2829
2830 spin_lock(&local->ap->sta_table_lock); 2830 spin_lock(&local->ap->sta_table_lock);
@@ -2892,7 +2892,7 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
2892 2892
2893/* Called only as a tasklet (software IRQ). Called for each RX frame to update 2893/* Called only as a tasklet (software IRQ). Called for each RX frame to update
2894 * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */ 2894 * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */
2895int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) 2895int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
2896{ 2896{
2897 struct sta_info *sta; 2897 struct sta_info *sta;
2898 u16 fc; 2898 u16 fc;
@@ -2925,12 +2925,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2925 int ret; 2925 int ret;
2926 struct sta_info *sta; 2926 struct sta_info *sta;
2927 u16 fc, type, stype; 2927 u16 fc, type, stype;
2928 struct ieee80211_hdr *hdr; 2928 struct ieee80211_hdr_4addr *hdr;
2929 2929
2930 if (local->ap == NULL) 2930 if (local->ap == NULL)
2931 return AP_RX_CONTINUE; 2931 return AP_RX_CONTINUE;
2932 2932
2933 hdr = (struct ieee80211_hdr *) skb->data; 2933 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2934 2934
2935 fc = le16_to_cpu(hdr->frame_ctl); 2935 fc = le16_to_cpu(hdr->frame_ctl);
2936 type = WLAN_FC_GET_TYPE(fc); 2936 type = WLAN_FC_GET_TYPE(fc);
@@ -3058,7 +3058,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3058 3058
3059/* Called only as a tasklet (software IRQ) */ 3059/* Called only as a tasklet (software IRQ) */
3060int hostap_handle_sta_crypto(local_info_t *local, 3060int hostap_handle_sta_crypto(local_info_t *local,
3061 struct ieee80211_hdr *hdr, 3061 struct ieee80211_hdr_4addr *hdr,
3062 struct ieee80211_crypt_data **crypt, 3062 struct ieee80211_crypt_data **crypt,
3063 void **sta_ptr) 3063 void **sta_ptr)
3064{ 3064{
@@ -3160,7 +3160,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr)
3160 3160
3161/* Called only as a tasklet (software IRQ) */ 3161/* Called only as a tasklet (software IRQ) */
3162int hostap_update_rx_stats(struct ap_data *ap, 3162int hostap_update_rx_stats(struct ap_data *ap,
3163 struct ieee80211_hdr *hdr, 3163 struct ieee80211_hdr_4addr *hdr,
3164 struct hostap_80211_rx_status *rx_stats) 3164 struct hostap_80211_rx_status *rx_stats)
3165{ 3165{
3166 struct sta_info *sta; 3166 struct sta_info *sta;
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h
index 816a52bcea8f..6d00df69c2e3 100644
--- a/drivers/net/wireless/hostap/hostap_ap.h
+++ b/drivers/net/wireless/hostap/hostap_ap.h
@@ -233,7 +233,7 @@ struct hostap_tx_data {
233ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); 233ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx);
234void hostap_handle_sta_release(void *ptr); 234void hostap_handle_sta_release(void *ptr);
235void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); 235void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb);
236int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); 236int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr);
237typedef enum { 237typedef enum {
238 AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED 238 AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED
239} ap_rx_ret; 239} ap_rx_ret;
@@ -241,13 +241,13 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
241 struct sk_buff *skb, 241 struct sk_buff *skb,
242 struct hostap_80211_rx_status *rx_stats, 242 struct hostap_80211_rx_status *rx_stats,
243 int wds); 243 int wds);
244int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, 244int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
245 struct ieee80211_crypt_data **crypt, 245 struct ieee80211_crypt_data **crypt,
246 void **sta_ptr); 246 void **sta_ptr);
247int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); 247int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr);
248int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); 248int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr);
249int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); 249int hostap_add_sta(struct ap_data *ap, u8 *sta_addr);
250int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, 250int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr_4addr *hdr,
251 struct hostap_80211_rx_status *rx_stats); 251 struct hostap_80211_rx_status *rx_stats);
252void hostap_update_rates(local_info_t *local); 252void hostap_update_rates(local_info_t *local);
253void hostap_add_wds_links(local_info_t *local); 253void hostap_add_wds_links(local_info_t *local);
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 2414e6493aa5..ad7f8cd76db9 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -800,8 +800,7 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
800 * doesn't seem to have as many firmware restart cycles... 800 * doesn't seem to have as many firmware restart cycles...
801 * 801 *
802 * As a test, we're sticking in a 1/100s delay here */ 802 * As a test, we're sticking in a 1/100s delay here */
803 set_current_state(TASK_UNINTERRUPTIBLE); 803 schedule_timeout_uninterruptible(msecs_to_jiffies(10));
804 schedule_timeout(HZ / 100);
805 804
806 return 0; 805 return 0;
807 806
@@ -1256,8 +1255,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
1256 IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); 1255 IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n");
1257 i = 5000; 1256 i = 5000;
1258 do { 1257 do {
1259 set_current_state(TASK_UNINTERRUPTIBLE); 1258 schedule_timeout_uninterruptible(msecs_to_jiffies(40));
1260 schedule_timeout(40 * HZ / 1000);
1261 /* Todo... wait for sync command ... */ 1259 /* Todo... wait for sync command ... */
1262 1260
1263 read_register(priv->net_dev, IPW_REG_INTA, &inta); 1261 read_register(priv->net_dev, IPW_REG_INTA, &inta);
@@ -1411,8 +1409,7 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv)
1411 (val2 & IPW2100_COMMAND_PHY_OFF)) 1409 (val2 & IPW2100_COMMAND_PHY_OFF))
1412 return 0; 1410 return 0;
1413 1411
1414 set_current_state(TASK_UNINTERRUPTIBLE); 1412 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY);
1415 schedule_timeout(HW_PHY_OFF_LOOP_DELAY);
1416 } 1413 }
1417 1414
1418 return -EIO; 1415 return -EIO;
@@ -1466,7 +1463,7 @@ fail_up:
1466 1463
1467static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) 1464static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
1468{ 1465{
1469#define HW_POWER_DOWN_DELAY (HZ / 10) 1466#define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100))
1470 1467
1471 struct host_command cmd = { 1468 struct host_command cmd = {
1472 .host_command = HOST_PRE_POWER_DOWN, 1469 .host_command = HOST_PRE_POWER_DOWN,
@@ -1520,10 +1517,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
1520 printk(KERN_WARNING DRV_NAME ": " 1517 printk(KERN_WARNING DRV_NAME ": "
1521 "%s: Power down command failed: Error %d\n", 1518 "%s: Power down command failed: Error %d\n",
1522 priv->net_dev->name, err); 1519 priv->net_dev->name, err);
1523 else { 1520 else
1524 set_current_state(TASK_UNINTERRUPTIBLE); 1521 schedule_timeout_uninterruptible(HW_POWER_DOWN_DELAY);
1525 schedule_timeout(HW_POWER_DOWN_DELAY);
1526 }
1527 } 1522 }
1528 1523
1529 priv->status &= ~STATUS_ENABLED; 1524 priv->status &= ~STATUS_ENABLED;
@@ -2953,7 +2948,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
2953 int next = txq->next; 2948 int next = txq->next;
2954 int i = 0; 2949 int i = 0;
2955 struct ipw2100_data_header *ipw_hdr; 2950 struct ipw2100_data_header *ipw_hdr;
2956 struct ieee80211_hdr *hdr; 2951 struct ieee80211_hdr_3addr *hdr;
2957 2952
2958 while (!list_empty(&priv->tx_pend_list)) { 2953 while (!list_empty(&priv->tx_pend_list)) {
2959 /* if there isn't enough space in TBD queue, then 2954 /* if there isn't enough space in TBD queue, then
@@ -2989,7 +2984,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
2989 packet->index = txq->next; 2984 packet->index = txq->next;
2990 2985
2991 ipw_hdr = packet->info.d_struct.data; 2986 ipw_hdr = packet->info.d_struct.data;
2992 hdr = (struct ieee80211_hdr *)packet->info.d_struct.txb-> 2987 hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb->
2993 fragments[0]->data; 2988 fragments[0]->data;
2994 2989
2995 if (priv->ieee->iw_mode == IW_MODE_INFRA) { 2990 if (priv->ieee->iw_mode == IW_MODE_INFRA) {
@@ -3274,7 +3269,8 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data,
3274 return IRQ_NONE; 3269 return IRQ_NONE;
3275} 3270}
3276 3271
3277static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev) 3272static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev,
3273 int pri)
3278{ 3274{
3279 struct ipw2100_priv *priv = ieee80211_priv(dev); 3275 struct ipw2100_priv *priv = ieee80211_priv(dev);
3280 struct list_head *element; 3276 struct list_head *element;
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h
index 2a3cdbd50168..c9e99ce15d66 100644
--- a/drivers/net/wireless/ipw2100.h
+++ b/drivers/net/wireless/ipw2100.h
@@ -808,7 +808,7 @@ struct ipw2100_priv {
808struct ipw2100_rx { 808struct ipw2100_rx {
809 union { 809 union {
810 unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH]; 810 unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH];
811 struct ieee80211_hdr header; 811 struct ieee80211_hdr_4addr header;
812 u32 status; 812 u32 status;
813 struct ipw2100_notification notification; 813 struct ipw2100_notification notification;
814 struct ipw2100_cmd_header command; 814 struct ipw2100_cmd_header command;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index b7f275c00de3..7ea9bd58f65f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4904,7 +4904,7 @@ static void ipw_rx(struct ipw_priv *priv)
4904{ 4904{
4905 struct ipw_rx_mem_buffer *rxb; 4905 struct ipw_rx_mem_buffer *rxb;
4906 struct ipw_rx_packet *pkt; 4906 struct ipw_rx_packet *pkt;
4907 struct ieee80211_hdr *header; 4907 struct ieee80211_hdr_4addr *header;
4908 u32 r, w, i; 4908 u32 r, w, i;
4909 u8 network_packet; 4909 u8 network_packet;
4910 4910
@@ -4967,8 +4967,9 @@ static void ipw_rx(struct ipw_priv *priv)
4967#endif 4967#endif
4968 4968
4969 header = 4969 header =
4970 (struct ieee80211_hdr *)(rxb->skb->data + 4970 (struct ieee80211_hdr_4addr *)(rxb->skb->
4971 IPW_RX_FRAME_SIZE); 4971 data +
4972 IPW_RX_FRAME_SIZE);
4972 /* TODO: Check Ad-Hoc dest/source and make sure 4973 /* TODO: Check Ad-Hoc dest/source and make sure
4973 * that we are actually parsing these packets 4974 * that we are actually parsing these packets
4974 * correctly -- we should probably use the 4975 * correctly -- we should probably use the
@@ -6010,12 +6011,12 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
6010 } 6011 }
6011 6012
6012 if (priv->adapter == IPW_2915ABG) { 6013 if (priv->adapter == IPW_2915ABG) {
6013 priv->ieee->abg_ture = 1; 6014 priv->ieee->abg_true = 1;
6014 if (mode & IEEE_A) { 6015 if (mode & IEEE_A) {
6015 band |= IEEE80211_52GHZ_BAND; 6016 band |= IEEE80211_52GHZ_BAND;
6016 modulation |= IEEE80211_OFDM_MODULATION; 6017 modulation |= IEEE80211_OFDM_MODULATION;
6017 } else 6018 } else
6018 priv->ieee->abg_ture = 0; 6019 priv->ieee->abg_true = 0;
6019 } else { 6020 } else {
6020 if (mode & IEEE_A) { 6021 if (mode & IEEE_A) {
6021 IPW_WARNING("Attempt to set 2200BG into " 6022 IPW_WARNING("Attempt to set 2200BG into "
@@ -6023,20 +6024,20 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
6023 return -EINVAL; 6024 return -EINVAL;
6024 } 6025 }
6025 6026
6026 priv->ieee->abg_ture = 0; 6027 priv->ieee->abg_true = 0;
6027 } 6028 }
6028 6029
6029 if (mode & IEEE_B) { 6030 if (mode & IEEE_B) {
6030 band |= IEEE80211_24GHZ_BAND; 6031 band |= IEEE80211_24GHZ_BAND;
6031 modulation |= IEEE80211_CCK_MODULATION; 6032 modulation |= IEEE80211_CCK_MODULATION;
6032 } else 6033 } else
6033 priv->ieee->abg_ture = 0; 6034 priv->ieee->abg_true = 0;
6034 6035
6035 if (mode & IEEE_G) { 6036 if (mode & IEEE_G) {
6036 band |= IEEE80211_24GHZ_BAND; 6037 band |= IEEE80211_24GHZ_BAND;
6037 modulation |= IEEE80211_OFDM_MODULATION; 6038 modulation |= IEEE80211_OFDM_MODULATION;
6038 } else 6039 } else
6039 priv->ieee->abg_ture = 0; 6040 priv->ieee->abg_true = 0;
6040 6041
6041 priv->ieee->mode = mode; 6042 priv->ieee->mode = mode;
6042 priv->ieee->freq_band = band; 6043 priv->ieee->freq_band = band;
@@ -6325,7 +6326,7 @@ we need to heavily modify the ieee80211_skb_to_txb.
6325 6326
6326static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) 6327static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6327{ 6328{
6328 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) 6329 struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)
6329 txb->fragments[0]->data; 6330 txb->fragments[0]->data;
6330 int i = 0; 6331 int i = 0;
6331 struct tfd_frame *tfd; 6332 struct tfd_frame *tfd;
@@ -6448,7 +6449,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6448} 6449}
6449 6450
6450static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, 6451static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb,
6451 struct net_device *dev) 6452 struct net_device *dev, int pri)
6452{ 6453{
6453 struct ipw_priv *priv = ieee80211_priv(dev); 6454 struct ipw_priv *priv = ieee80211_priv(dev);
6454 unsigned long flags; 6455 unsigned long flags;
@@ -7108,7 +7109,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
7108 printk(KERN_INFO DRV_NAME 7109 printk(KERN_INFO DRV_NAME
7109 ": Detected Intel PRO/Wireless 2915ABG Network " 7110 ": Detected Intel PRO/Wireless 2915ABG Network "
7110 "Connection\n"); 7111 "Connection\n");
7111 priv->ieee->abg_ture = 1; 7112 priv->ieee->abg_true = 1;
7112 band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; 7113 band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND;
7113 modulation = IEEE80211_OFDM_MODULATION | 7114 modulation = IEEE80211_OFDM_MODULATION |
7114 IEEE80211_CCK_MODULATION; 7115 IEEE80211_CCK_MODULATION;
@@ -7124,7 +7125,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
7124 ": Detected Intel PRO/Wireless 2200BG Network " 7125 ": Detected Intel PRO/Wireless 2200BG Network "
7125 "Connection\n"); 7126 "Connection\n");
7126 7127
7127 priv->ieee->abg_ture = 0; 7128 priv->ieee->abg_true = 0;
7128 band = IEEE80211_24GHZ_BAND; 7129 band = IEEE80211_24GHZ_BAND;
7129 modulation = IEEE80211_OFDM_MODULATION | 7130 modulation = IEEE80211_OFDM_MODULATION |
7130 IEEE80211_CCK_MODULATION; 7131 IEEE80211_CCK_MODULATION;
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index 5b00882133f9..e9cf32bf3e31 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1654,12 +1654,12 @@ static const long ipw_frequencies[] = {
1654 1654
1655#define IPW_MAX_CONFIG_RETRIES 10 1655#define IPW_MAX_CONFIG_RETRIES 10
1656 1656
1657static inline u32 frame_hdr_len(struct ieee80211_hdr *hdr) 1657static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr)
1658{ 1658{
1659 u32 retval; 1659 u32 retval;
1660 u16 fc; 1660 u16 fc;
1661 1661
1662 retval = sizeof(struct ieee80211_hdr); 1662 retval = sizeof(struct ieee80211_hdr_3addr);
1663 fc = le16_to_cpu(hdr->frame_ctl); 1663 fc = le16_to_cpu(hdr->frame_ctl);
1664 1664
1665 /* 1665 /*
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 8de49fe57233..fc2fa4dc3a08 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -94,8 +94,6 @@
94#include <net/iw_handler.h> 94#include <net/iw_handler.h>
95#include <net/ieee80211.h> 95#include <net/ieee80211.h>
96 96
97#include <net/ieee80211.h>
98
99#include <asm/uaccess.h> 97#include <asm/uaccess.h>
100#include <asm/io.h> 98#include <asm/io.h>
101#include <asm/system.h> 99#include <asm/system.h>
@@ -137,7 +135,7 @@ MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions");
137 135
138/* We do this this way to avoid ifdefs in the actual code */ 136/* We do this this way to avoid ifdefs in the actual code */
139#ifdef WIRELESS_SPY 137#ifdef WIRELESS_SPY
140#define SPY_NUMBER(priv) (priv->spy_number) 138#define SPY_NUMBER(priv) (priv->spy_data.spy_number)
141#else 139#else
142#define SPY_NUMBER(priv) 0 140#define SPY_NUMBER(priv) 0
143#endif /* WIRELESS_SPY */ 141#endif /* WIRELESS_SPY */
@@ -396,10 +394,10 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
396 /* If a spy address is defined, we report stats of the 394 /* If a spy address is defined, we report stats of the
397 * first spy address - Jean II */ 395 * first spy address - Jean II */
398 if (SPY_NUMBER(priv)) { 396 if (SPY_NUMBER(priv)) {
399 wstats->qual.qual = priv->spy_stat[0].qual; 397 wstats->qual.qual = priv->spy_data.spy_stat[0].qual;
400 wstats->qual.level = priv->spy_stat[0].level; 398 wstats->qual.level = priv->spy_data.spy_stat[0].level;
401 wstats->qual.noise = priv->spy_stat[0].noise; 399 wstats->qual.noise = priv->spy_data.spy_stat[0].noise;
402 wstats->qual.updated = priv->spy_stat[0].updated; 400 wstats->qual.updated = priv->spy_data.spy_stat[0].updated;
403 } 401 }
404 } else { 402 } else {
405 struct { 403 struct {
@@ -638,7 +636,7 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
638 /* Read the frame header */ 636 /* Read the frame header */
639 err = hermes_bap_pread(hw, IRQ_BAP, &hdr, 637 err = hermes_bap_pread(hw, IRQ_BAP, &hdr,
640 sizeof(struct hermes_tx_descriptor) + 638 sizeof(struct hermes_tx_descriptor) +
641 sizeof(struct ieee80211_hdr), 639 sizeof(struct ieee80211_hdr_4addr),
642 fid, 0); 640 fid, 0);
643 641
644 hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); 642 hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
@@ -718,18 +716,13 @@ static inline int is_ethersnap(void *_hdr)
718static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, 716static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac,
719 int level, int noise) 717 int level, int noise)
720{ 718{
721 struct orinoco_private *priv = netdev_priv(dev); 719 struct iw_quality wstats;
722 int i; 720 wstats.level = level - 0x95;
723 721 wstats.noise = noise - 0x95;
724 /* Gather wireless spy statistics: for each packet, compare the 722 wstats.qual = (level > noise) ? (level - noise) : 0;
725 * source address with out list, and if match, get the stats... */ 723 wstats.updated = 7;
726 for (i = 0; i < priv->spy_number; i++) 724 /* Update spy records */
727 if (!memcmp(mac, priv->spy_address[i], ETH_ALEN)) { 725 wireless_spy_update(dev, mac, &wstats);
728 priv->spy_stat[i].level = level - 0x95;
729 priv->spy_stat[i].noise = noise - 0x95;
730 priv->spy_stat[i].qual = (level > noise) ? (level - noise) : 0;
731 priv->spy_stat[i].updated = 7;
732 }
733} 726}
734 727
735static void orinoco_stat_gather(struct net_device *dev, 728static void orinoco_stat_gather(struct net_device *dev,
@@ -2458,8 +2451,11 @@ struct net_device *alloc_orinocodev(int sizeof_card,
2458 dev->watchdog_timeo = HZ; /* 1 second timeout */ 2451 dev->watchdog_timeo = HZ; /* 1 second timeout */
2459 dev->get_stats = orinoco_get_stats; 2452 dev->get_stats = orinoco_get_stats;
2460 dev->ethtool_ops = &orinoco_ethtool_ops; 2453 dev->ethtool_ops = &orinoco_ethtool_ops;
2461 dev->get_wireless_stats = orinoco_get_wireless_stats;
2462 dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; 2454 dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def;
2455#ifdef WIRELESS_SPY
2456 priv->wireless_data.spy_data = &priv->spy_data;
2457 dev->wireless_data = &priv->wireless_data;
2458#endif
2463 dev->change_mtu = orinoco_change_mtu; 2459 dev->change_mtu = orinoco_change_mtu;
2464 dev->set_multicast_list = orinoco_set_multicast_list; 2460 dev->set_multicast_list = orinoco_set_multicast_list;
2465 /* we use the default eth_mac_addr for setting the MAC addr */ 2461 /* we use the default eth_mac_addr for setting the MAC addr */
@@ -2831,7 +2827,7 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev,
2831 } 2827 }
2832 } 2828 }
2833 2829
2834 if ((priv->iw_mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){ 2830 if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))){
2835 /* Quality stats meaningless in ad-hoc mode */ 2831 /* Quality stats meaningless in ad-hoc mode */
2836 } else { 2832 } else {
2837 range->max_qual.qual = 0x8b - 0x2f; 2833 range->max_qual.qual = 0x8b - 0x2f;
@@ -2878,6 +2874,14 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev,
2878 range->min_r_time = 0; 2874 range->min_r_time = 0;
2879 range->max_r_time = 65535 * 1000; /* ??? */ 2875 range->max_r_time = 65535 * 1000; /* ??? */
2880 2876
2877 /* Event capability (kernel) */
2878 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
2879 /* Event capability (driver) */
2880 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
2881 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
2882 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
2883 IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
2884
2881 TRACE_EXIT(dev->name); 2885 TRACE_EXIT(dev->name);
2882 2886
2883 return 0; 2887 return 0;
@@ -3837,92 +3841,6 @@ static int orinoco_ioctl_getrid(struct net_device *dev,
3837 return err; 3841 return err;
3838} 3842}
3839 3843
3840/* Spy is used for link quality/strength measurements in Ad-Hoc mode
3841 * Jean II */
3842static int orinoco_ioctl_setspy(struct net_device *dev,
3843 struct iw_request_info *info,
3844 struct iw_point *srq,
3845 char *extra)
3846
3847{
3848 struct orinoco_private *priv = netdev_priv(dev);
3849 struct sockaddr *address = (struct sockaddr *) extra;
3850 int number = srq->length;
3851 int i;
3852 unsigned long flags;
3853
3854 /* Make sure nobody mess with the structure while we do */
3855 if (orinoco_lock(priv, &flags) != 0)
3856 return -EBUSY;
3857
3858 /* orinoco_lock() doesn't disable interrupts, so make sure the
3859 * interrupt rx path don't get confused while we copy */
3860 priv->spy_number = 0;
3861
3862 if (number > 0) {
3863 /* Extract the addresses */
3864 for (i = 0; i < number; i++)
3865 memcpy(priv->spy_address[i], address[i].sa_data,
3866 ETH_ALEN);
3867 /* Reset stats */
3868 memset(priv->spy_stat, 0,
3869 sizeof(struct iw_quality) * IW_MAX_SPY);
3870 /* Set number of addresses */
3871 priv->spy_number = number;
3872 }
3873
3874 /* Now, let the others play */
3875 orinoco_unlock(priv, &flags);
3876
3877 /* Do NOT call commit handler */
3878 return 0;
3879}
3880
3881static int orinoco_ioctl_getspy(struct net_device *dev,
3882 struct iw_request_info *info,
3883 struct iw_point *srq,
3884 char *extra)
3885{
3886 struct orinoco_private *priv = netdev_priv(dev);
3887 struct sockaddr *address = (struct sockaddr *) extra;
3888 int number;
3889 int i;
3890 unsigned long flags;
3891
3892 if (orinoco_lock(priv, &flags) != 0)
3893 return -EBUSY;
3894
3895 number = priv->spy_number;
3896 /* Create address struct */
3897 for (i = 0; i < number; i++) {
3898 memcpy(address[i].sa_data, priv->spy_address[i], ETH_ALEN);
3899 address[i].sa_family = AF_UNIX;
3900 }
3901 if (number > 0) {
3902 /* Create address struct */
3903 for (i = 0; i < number; i++) {
3904 memcpy(address[i].sa_data, priv->spy_address[i],
3905 ETH_ALEN);
3906 address[i].sa_family = AF_UNIX;
3907 }
3908 /* Copy stats */
3909 /* In theory, we should disable irqs while copying the stats
3910 * because the rx path might update it in the middle...
3911 * Bah, who care ? - Jean II */
3912 memcpy(extra + (sizeof(struct sockaddr) * number),
3913 priv->spy_stat, sizeof(struct iw_quality) * number);
3914 }
3915 /* Reset updated flags. */
3916 for (i = 0; i < number; i++)
3917 priv->spy_stat[i].updated = 0;
3918
3919 orinoco_unlock(priv, &flags);
3920
3921 srq->length = number;
3922
3923 return 0;
3924}
3925
3926/* Trigger a scan (look for other cells in the vicinity */ 3844/* Trigger a scan (look for other cells in the vicinity */
3927static int orinoco_ioctl_setscan(struct net_device *dev, 3845static int orinoco_ioctl_setscan(struct net_device *dev,
3928 struct iw_request_info *info, 3846 struct iw_request_info *info,
@@ -4353,8 +4271,10 @@ static const iw_handler orinoco_handler[] = {
4353 [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens, 4271 [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens,
4354 [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens, 4272 [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens,
4355 [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange, 4273 [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange,
4356 [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setspy, 4274 [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_set_spy,
4357 [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getspy, 4275 [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_get_spy,
4276 [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_set_thrspy,
4277 [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_get_thrspy,
4358 [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap, 4278 [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap,
4359 [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap, 4279 [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap,
4360 [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan, 4280 [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan,
@@ -4399,6 +4319,7 @@ static const struct iw_handler_def orinoco_handler_def = {
4399 .standard = orinoco_handler, 4319 .standard = orinoco_handler,
4400 .private = orinoco_private_handler, 4320 .private = orinoco_private_handler,
4401 .private_args = orinoco_privtab, 4321 .private_args = orinoco_privtab,
4322 .get_wireless_stats = orinoco_get_wireless_stats,
4402}; 4323};
4403 4324
4404static void orinoco_get_drvinfo(struct net_device *dev, 4325static void orinoco_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 2f213a7103fe..c800563034a7 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -13,6 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/wireless.h> 15#include <linux/wireless.h>
16#include <net/iw_handler.h>
16#include <linux/version.h> 17#include <linux/version.h>
17 18
18#include "hermes.h" 19#include "hermes.h"
@@ -112,9 +113,8 @@ struct orinoco_private {
112 u16 pm_on, pm_mcast, pm_period, pm_timeout; 113 u16 pm_on, pm_mcast, pm_period, pm_timeout;
113 u16 preamble; 114 u16 preamble;
114#ifdef WIRELESS_SPY 115#ifdef WIRELESS_SPY
115 int spy_number; 116 struct iw_spy_data spy_data; /* iwspy support */
116 u_char spy_address[IW_MAX_SPY][ETH_ALEN]; 117 struct iw_public_data wireless_data;
117 struct iw_quality spy_stat[IW_MAX_SPY];
118#endif 118#endif
119 119
120 /* Configuration dependent variables */ 120 /* Configuration dependent variables */
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index bedd7f9f23e4..80920b1c6fcf 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -14,9 +14,6 @@
14#define PFX DRIVER_NAME ": " 14#define PFX DRIVER_NAME ": "
15 15
16#include <linux/config.h> 16#include <linux/config.h>
17#ifdef __IN_PCMCIA_PACKAGE__
18#include <pcmcia/k_compat.h>
19#endif /* __IN_PCMCIA_PACKAGE__ */
20 17
21#include <linux/module.h> 18#include <linux/module.h>
22#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -603,49 +600,85 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
603 "Pavel Roskin <proski@gnu.org>, et al)"; 600 "Pavel Roskin <proski@gnu.org>, et al)";
604 601
605static struct pcmcia_device_id orinoco_cs_ids[] = { 602static struct pcmcia_device_id orinoco_cs_ids[] = {
606 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), 603 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */
607 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), 604 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */
608 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), 605 PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */
609 PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), 606 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */
610 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), 607 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */
611 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), 608 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */
612 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), 609 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */
613 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), 610 PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */
614 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), 611 PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */
615 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), 612 PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */
616 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), 613 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
617 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), 614 PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */
618 PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), 615 PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */
619 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), 616 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */
620 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), 617 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
621 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), 618 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
622 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 619 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */
623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 620 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */
621 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */
622 PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */
623 PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */
624 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */
625 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */
626 PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */
627 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */
628 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */
629 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */
630 PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
624 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 631 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
625 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
626 PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), 632 PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
633 PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2),
634 PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092),
635 PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
636 PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
637 PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
627 PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), 638 PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
639 PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
628 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), 640 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
641 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
629 PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), 642 PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
643 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
644 PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39),
630 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), 645 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
631 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), 646 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
632 PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae), 647 PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae),
633 PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac), 648 PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
634 PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), 649 PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab),
650 PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916),
651 PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
635 PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), 652 PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
636 PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), 653 PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
654 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
655 PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077),
637 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), 656 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
657 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
658 PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf),
659 PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2),
660 PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
661 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
638 PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), 662 PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
639 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), 663 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
640 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), 664 PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
641 PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), 665 PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
642 PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), 666 PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a),
667 PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
643 PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), 668 PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
669 PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767),
670 PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6),
671 PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
672 PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39),
644 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), 673 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
674 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178),
645 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), 675 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
646 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), 676 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
647 PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), 677 PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
648 PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), 678 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a),
679 PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e),
680 PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
681 PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
649 PCMCIA_DEVICE_NULL, 682 PCMCIA_DEVICE_NULL,
650}; 683};
651MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); 684MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
index 6f13d4a8e2d3..10cce514c15d 100644
--- a/drivers/net/wireless/prism54/islpci_dev.c
+++ b/drivers/net/wireless/prism54/islpci_dev.c
@@ -439,8 +439,7 @@ prism54_bring_down(islpci_private *priv)
439 wmb(); 439 wmb();
440 440
441 /* wait a while for the device to reset */ 441 /* wait a while for the device to reset */
442 set_current_state(TASK_UNINTERRUPTIBLE); 442 schedule_timeout_uninterruptible(msecs_to_jiffies(50));
443 schedule_timeout(50*HZ/1000);
444 443
445 return 0; 444 return 0;
446} 445}
@@ -491,8 +490,7 @@ islpci_reset_if(islpci_private *priv)
491 /* The software reset acknowledge needs about 220 msec here. 490 /* The software reset acknowledge needs about 220 msec here.
492 * Be conservative and wait for up to one second. */ 491 * Be conservative and wait for up to one second. */
493 492
494 set_current_state(TASK_UNINTERRUPTIBLE); 493 remaining = schedule_timeout_uninterruptible(HZ);
495 remaining = schedule_timeout(HZ);
496 494
497 if(remaining > 0) { 495 if(remaining > 0) {
498 result = 0; 496 result = 0;
diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c
index b6f2e5a223be..4937a5ad4b2c 100644
--- a/drivers/net/wireless/prism54/islpci_mgt.c
+++ b/drivers/net/wireless/prism54/islpci_mgt.c
@@ -455,7 +455,7 @@ islpci_mgt_transaction(struct net_device *ndev,
455 struct islpci_mgmtframe **recvframe) 455 struct islpci_mgmtframe **recvframe)
456{ 456{
457 islpci_private *priv = netdev_priv(ndev); 457 islpci_private *priv = netdev_priv(ndev);
458 const long wait_cycle_jiffies = (ISL38XX_WAIT_CYCLE * 10 * HZ) / 1000; 458 const long wait_cycle_jiffies = msecs_to_jiffies(ISL38XX_WAIT_CYCLE * 10);
459 long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies; 459 long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies;
460 int err; 460 int err;
461 DEFINE_WAIT(wait); 461 DEFINE_WAIT(wait);
@@ -475,8 +475,7 @@ islpci_mgt_transaction(struct net_device *ndev,
475 int timeleft; 475 int timeleft;
476 struct islpci_mgmtframe *frame; 476 struct islpci_mgmtframe *frame;
477 477
478 set_current_state(TASK_UNINTERRUPTIBLE); 478 timeleft = schedule_timeout_uninterruptible(wait_cycle_jiffies);
479 timeleft = schedule_timeout(wait_cycle_jiffies);
480 frame = xchg(&priv->mgmt_received, NULL); 479 frame = xchg(&priv->mgmt_received, NULL);
481 if (frame) { 480 if (frame) {
482 if (frame->header->oid == oid) { 481 if (frame->header->oid == oid) {
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index e9c5ea0f5535..70fd6fd8feb9 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1649,28 +1649,28 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev)
1649 */ 1649 */
1650 1650
1651static const iw_handler ray_handler[] = { 1651static const iw_handler ray_handler[] = {
1652 [SIOCSIWCOMMIT-SIOCIWFIRST] (iw_handler) ray_commit, 1652 [SIOCSIWCOMMIT-SIOCIWFIRST] = (iw_handler) ray_commit,
1653 [SIOCGIWNAME -SIOCIWFIRST] (iw_handler) ray_get_name, 1653 [SIOCGIWNAME -SIOCIWFIRST] = (iw_handler) ray_get_name,
1654 [SIOCSIWFREQ -SIOCIWFIRST] (iw_handler) ray_set_freq, 1654 [SIOCSIWFREQ -SIOCIWFIRST] = (iw_handler) ray_set_freq,
1655 [SIOCGIWFREQ -SIOCIWFIRST] (iw_handler) ray_get_freq, 1655 [SIOCGIWFREQ -SIOCIWFIRST] = (iw_handler) ray_get_freq,
1656 [SIOCSIWMODE -SIOCIWFIRST] (iw_handler) ray_set_mode, 1656 [SIOCSIWMODE -SIOCIWFIRST] = (iw_handler) ray_set_mode,
1657 [SIOCGIWMODE -SIOCIWFIRST] (iw_handler) ray_get_mode, 1657 [SIOCGIWMODE -SIOCIWFIRST] = (iw_handler) ray_get_mode,
1658 [SIOCGIWRANGE -SIOCIWFIRST] (iw_handler) ray_get_range, 1658 [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) ray_get_range,
1659#ifdef WIRELESS_SPY 1659#ifdef WIRELESS_SPY
1660 [SIOCSIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_set_spy, 1660 [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_set_spy,
1661 [SIOCGIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_get_spy, 1661 [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_get_spy,
1662 [SIOCSIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_set_thrspy, 1662 [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_set_thrspy,
1663 [SIOCGIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_get_thrspy, 1663 [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_get_thrspy,
1664#endif /* WIRELESS_SPY */ 1664#endif /* WIRELESS_SPY */
1665 [SIOCGIWAP -SIOCIWFIRST] (iw_handler) ray_get_wap, 1665 [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) ray_get_wap,
1666 [SIOCSIWESSID -SIOCIWFIRST] (iw_handler) ray_set_essid, 1666 [SIOCSIWESSID -SIOCIWFIRST] = (iw_handler) ray_set_essid,
1667 [SIOCGIWESSID -SIOCIWFIRST] (iw_handler) ray_get_essid, 1667 [SIOCGIWESSID -SIOCIWFIRST] = (iw_handler) ray_get_essid,
1668 [SIOCSIWRATE -SIOCIWFIRST] (iw_handler) ray_set_rate, 1668 [SIOCSIWRATE -SIOCIWFIRST] = (iw_handler) ray_set_rate,
1669 [SIOCGIWRATE -SIOCIWFIRST] (iw_handler) ray_get_rate, 1669 [SIOCGIWRATE -SIOCIWFIRST] = (iw_handler) ray_get_rate,
1670 [SIOCSIWRTS -SIOCIWFIRST] (iw_handler) ray_set_rts, 1670 [SIOCSIWRTS -SIOCIWFIRST] = (iw_handler) ray_set_rts,
1671 [SIOCGIWRTS -SIOCIWFIRST] (iw_handler) ray_get_rts, 1671 [SIOCGIWRTS -SIOCIWFIRST] = (iw_handler) ray_get_rts,
1672 [SIOCSIWFRAG -SIOCIWFIRST] (iw_handler) ray_set_frag, 1672 [SIOCSIWFRAG -SIOCIWFIRST] = (iw_handler) ray_set_frag,
1673 [SIOCGIWFRAG -SIOCIWFIRST] (iw_handler) ray_get_frag, 1673 [SIOCGIWFRAG -SIOCIWFIRST] = (iw_handler) ray_get_frag,
1674}; 1674};
1675 1675
1676#define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ 1676#define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */
@@ -1678,9 +1678,9 @@ static const iw_handler ray_handler[] = {
1678#define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ 1678#define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */
1679 1679
1680static const iw_handler ray_private_handler[] = { 1680static const iw_handler ray_private_handler[] = {
1681 [0] (iw_handler) ray_set_framing, 1681 [0] = (iw_handler) ray_set_framing,
1682 [1] (iw_handler) ray_get_framing, 1682 [1] = (iw_handler) ray_get_framing,
1683 [3] (iw_handler) ray_get_country, 1683 [3] = (iw_handler) ray_get_country,
1684}; 1684};
1685 1685
1686static const struct iw_priv_args ray_private_args[] = { 1686static const struct iw_priv_args ray_private_args[] = {
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 39c6cdf7f3f7..63e00422d1a0 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -22,9 +22,6 @@
22#define PFX DRIVER_NAME ": " 22#define PFX DRIVER_NAME ": "
23 23
24#include <linux/config.h> 24#include <linux/config.h>
25#ifdef __IN_PCMCIA_PACKAGE__
26#include <pcmcia/k_compat.h>
27#endif /* __IN_PCMCIA_PACKAGE__ */
28 25
29#include <linux/module.h> 26#include <linux/module.h>
30#include <linux/kernel.h> 27#include <linux/kernel.h>
@@ -38,6 +35,7 @@
38#include <linux/if_arp.h> 35#include <linux/if_arp.h>
39#include <linux/etherdevice.h> 36#include <linux/etherdevice.h>
40#include <linux/wireless.h> 37#include <linux/wireless.h>
38#include <linux/firmware.h>
41 39
42#include <pcmcia/cs_types.h> 40#include <pcmcia/cs_types.h>
43#include <pcmcia/cs.h> 41#include <pcmcia/cs.h>
@@ -51,29 +49,10 @@
51 49
52#include "orinoco.h" 50#include "orinoco.h"
53 51
54/*
55 * If SPECTRUM_FW_INCLUDED is defined, the firmware is hardcoded into
56 * the driver. Use get_symbol_fw script to generate spectrum_fw.h and
57 * copy it to the same directory as spectrum_cs.c.
58 *
59 * If SPECTRUM_FW_INCLUDED is not defined, the firmware is loaded at the
60 * runtime using hotplug. Use the same get_symbol_fw script to generate
61 * files symbol_sp24t_prim_fw symbol_sp24t_sec_fw, copy them to the
62 * hotplug firmware directory (typically /usr/lib/hotplug/firmware) and
63 * make sure that you have hotplug installed and enabled in the kernel.
64 */
65/* #define SPECTRUM_FW_INCLUDED 1 */
66
67#ifdef SPECTRUM_FW_INCLUDED
68/* Header with the firmware */
69#include "spectrum_fw.h"
70#else /* !SPECTRUM_FW_INCLUDED */
71#include <linux/firmware.h>
72static unsigned char *primsym; 52static unsigned char *primsym;
73static unsigned char *secsym; 53static unsigned char *secsym;
74static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; 54static const char primary_fw_name[] = "symbol_sp24t_prim_fw";
75static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; 55static const char secondary_fw_name[] = "symbol_sp24t_sec_fw";
76#endif /* !SPECTRUM_FW_INCLUDED */
77 56
78/********************************************************************/ 57/********************************************************************/
79/* Module stuff */ 58/* Module stuff */
@@ -571,8 +550,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
571{ 550{
572 int ret; 551 int ret;
573 client_handle_t handle = link->handle; 552 client_handle_t handle = link->handle;
574
575#ifndef SPECTRUM_FW_INCLUDED
576 const struct firmware *fw_entry; 553 const struct firmware *fw_entry;
577 554
578 if (request_firmware(&fw_entry, primary_fw_name, 555 if (request_firmware(&fw_entry, primary_fw_name,
@@ -592,7 +569,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
592 secondary_fw_name); 569 secondary_fw_name);
593 return -ENOENT; 570 return -ENOENT;
594 } 571 }
595#endif
596 572
597 /* Load primary firmware */ 573 /* Load primary firmware */
598 ret = spectrum_dl_image(hw, link, primsym); 574 ret = spectrum_dl_image(hw, link, primsym);
@@ -1085,7 +1061,7 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
1085static struct pcmcia_device_id spectrum_cs_ids[] = { 1061static struct pcmcia_device_id spectrum_cs_ids[] = {
1086 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ 1062 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */
1087 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ 1063 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */
1088 PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), /* Intel PRO/Wireless 2011B */ 1064 PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */
1089 PCMCIA_DEVICE_NULL, 1065 PCMCIA_DEVICE_NULL,
1090}; 1066};
1091MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); 1067MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids);
diff --git a/drivers/net/wireless/wl3501.h b/drivers/net/wireless/wl3501.h
index 7fcbe589c3f2..4303c50c2ab6 100644
--- a/drivers/net/wireless/wl3501.h
+++ b/drivers/net/wireless/wl3501.h
@@ -548,7 +548,7 @@ struct wl3501_80211_tx_plcp_hdr {
548 548
549struct wl3501_80211_tx_hdr { 549struct wl3501_80211_tx_hdr {
550 struct wl3501_80211_tx_plcp_hdr pclp_hdr; 550 struct wl3501_80211_tx_plcp_hdr pclp_hdr;
551 struct ieee80211_hdr mac_hdr; 551 struct ieee80211_hdr_4addr mac_hdr;
552} __attribute__ ((packed)); 552} __attribute__ ((packed));
553 553
554/* 554/*