diff options
115 files changed, 3902 insertions, 3017 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 | ||
1580 | static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | 1580 | static 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 | ||
2470 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 2472 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2a908c4690a7..018b11a7a4ce 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2083,6 +2083,7 @@ config SPIDER_NET | |||
2083 | config GIANFAR | 2083 | config GIANFAR |
2084 | tristate "Gianfar Ethernet" | 2084 | tristate "Gianfar Ethernet" |
2085 | depends on 85xx || 83xx | 2085 | depends on 85xx || 83xx |
2086 | select PHYLIB | ||
2086 | help | 2087 | help |
2087 | This driver supports the Gigabit TSEC on the MPC85xx | 2088 | This driver supports the Gigabit TSEC on the MPC85xx |
2088 | family of chips, and the FEC on the 8540 | 2089 | family of chips, and the FEC on the 8540 |
@@ -2243,6 +2244,20 @@ config ISERIES_VETH | |||
2243 | tristate "iSeries Virtual Ethernet driver support" | 2244 | tristate "iSeries Virtual Ethernet driver support" |
2244 | depends on PPC_ISERIES | 2245 | depends on PPC_ISERIES |
2245 | 2246 | ||
2247 | config RIONET | ||
2248 | tristate "RapidIO Ethernet over messaging driver support" | ||
2249 | depends on NETDEVICES && RAPIDIO | ||
2250 | |||
2251 | config RIONET_TX_SIZE | ||
2252 | int "Number of outbound queue entries" | ||
2253 | depends on RIONET | ||
2254 | default "128" | ||
2255 | |||
2256 | config RIONET_RX_SIZE | ||
2257 | int "Number of inbound queue entries" | ||
2258 | depends on RIONET | ||
2259 | default "128" | ||
2260 | |||
2246 | config FDDI | 2261 | config FDDI |
2247 | bool "FDDI driver support" | 2262 | bool "FDDI driver support" |
2248 | depends on (PCI || EISA) | 2263 | depends on (PCI || EISA) |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 8aeec9f2495b..4c9477cb2127 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -13,7 +13,7 @@ obj-$(CONFIG_CHELSIO_T1) += chelsio/ | |||
13 | obj-$(CONFIG_BONDING) += bonding/ | 13 | obj-$(CONFIG_BONDING) += bonding/ |
14 | obj-$(CONFIG_GIANFAR) += gianfar_driver.o | 14 | obj-$(CONFIG_GIANFAR) += gianfar_driver.o |
15 | 15 | ||
16 | gianfar_driver-objs := gianfar.o gianfar_ethtool.o gianfar_phy.o | 16 | gianfar_driver-objs := gianfar.o gianfar_ethtool.o gianfar_mii.o |
17 | 17 | ||
18 | # | 18 | # |
19 | # link order important here | 19 | # link order important here |
@@ -64,6 +64,7 @@ obj-$(CONFIG_SKFP) += skfp/ | |||
64 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o | 64 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o |
65 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o | 65 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o |
66 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o | 66 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o |
67 | obj-$(CONFIG_RIONET) += rionet.o | ||
67 | 68 | ||
68 | # | 69 | # |
69 | # end link order section | 70 | # 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 | ||
1681 | static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1682 | static 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 | ||
2394 | static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | 2395 | static 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 | ||
1744 | void e1000_set_ethtool_ops(struct net_device *netdev) | 1745 | void 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 | ||
149 | enum { | 151 | enum { |
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 | ||
2070 | static int nv_open(struct net_device *dev) | 2080 | static 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/gianfar.c b/drivers/net/gianfar.c index 6518334b9280..ae5a2ed3b264 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -29,12 +29,7 @@ | |||
29 | * define the configuration needed by the board are defined in a | 29 | * define the configuration needed by the board are defined in a |
30 | * board structure in arch/ppc/platforms (though I do not | 30 | * board structure in arch/ppc/platforms (though I do not |
31 | * discount the possibility that other architectures could one | 31 | * discount the possibility that other architectures could one |
32 | * day be supported. One assumption the driver currently makes | 32 | * day be supported. |
33 | * is that the PHY is configured in such a way to advertise all | ||
34 | * capabilities. This is a sensible default, and on certain | ||
35 | * PHYs, changing this default encounters substantial errata | ||
36 | * issues. Future versions may remove this requirement, but for | ||
37 | * now, it is best for the firmware to ensure this is the case. | ||
38 | * | 33 | * |
39 | * The Gianfar Ethernet Controller uses a ring of buffer | 34 | * The Gianfar Ethernet Controller uses a ring of buffer |
40 | * descriptors. The beginning is indicated by a register | 35 | * descriptors. The beginning is indicated by a register |
@@ -47,7 +42,7 @@ | |||
47 | * corresponding bit in the IMASK register is also set (if | 42 | * corresponding bit in the IMASK register is also set (if |
48 | * interrupt coalescing is active, then the interrupt may not | 43 | * interrupt coalescing is active, then the interrupt may not |
49 | * happen immediately, but will wait until either a set number | 44 | * happen immediately, but will wait until either a set number |
50 | * of frames or amount of time have passed.). In NAPI, the | 45 | * of frames or amount of time have passed). In NAPI, the |
51 | * interrupt handler will signal there is work to be done, and | 46 | * interrupt handler will signal there is work to be done, and |
52 | * exit. Without NAPI, the packet(s) will be handled | 47 | * exit. Without NAPI, the packet(s) will be handled |
53 | * immediately. Both methods will start at the last known empty | 48 | * immediately. Both methods will start at the last known empty |
@@ -75,6 +70,7 @@ | |||
75 | #include <linux/sched.h> | 70 | #include <linux/sched.h> |
76 | #include <linux/string.h> | 71 | #include <linux/string.h> |
77 | #include <linux/errno.h> | 72 | #include <linux/errno.h> |
73 | #include <linux/unistd.h> | ||
78 | #include <linux/slab.h> | 74 | #include <linux/slab.h> |
79 | #include <linux/interrupt.h> | 75 | #include <linux/interrupt.h> |
80 | #include <linux/init.h> | 76 | #include <linux/init.h> |
@@ -97,9 +93,11 @@ | |||
97 | #include <linux/version.h> | 93 | #include <linux/version.h> |
98 | #include <linux/dma-mapping.h> | 94 | #include <linux/dma-mapping.h> |
99 | #include <linux/crc32.h> | 95 | #include <linux/crc32.h> |
96 | #include <linux/mii.h> | ||
97 | #include <linux/phy.h> | ||
100 | 98 | ||
101 | #include "gianfar.h" | 99 | #include "gianfar.h" |
102 | #include "gianfar_phy.h" | 100 | #include "gianfar_mii.h" |
103 | 101 | ||
104 | #define TX_TIMEOUT (1*HZ) | 102 | #define TX_TIMEOUT (1*HZ) |
105 | #define SKB_ALLOC_TIMEOUT 1000000 | 103 | #define SKB_ALLOC_TIMEOUT 1000000 |
@@ -113,9 +111,8 @@ | |||
113 | #endif | 111 | #endif |
114 | 112 | ||
115 | const char gfar_driver_name[] = "Gianfar Ethernet"; | 113 | const char gfar_driver_name[] = "Gianfar Ethernet"; |
116 | const char gfar_driver_version[] = "1.1"; | 114 | const char gfar_driver_version[] = "1.2"; |
117 | 115 | ||
118 | int startup_gfar(struct net_device *dev); | ||
119 | static int gfar_enet_open(struct net_device *dev); | 116 | static int gfar_enet_open(struct net_device *dev); |
120 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); | 117 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); |
121 | static void gfar_timeout(struct net_device *dev); | 118 | static void gfar_timeout(struct net_device *dev); |
@@ -126,17 +123,13 @@ static int gfar_set_mac_address(struct net_device *dev); | |||
126 | static int gfar_change_mtu(struct net_device *dev, int new_mtu); | 123 | static int gfar_change_mtu(struct net_device *dev, int new_mtu); |
127 | static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs); | 124 | static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs); |
128 | static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs); | 125 | static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs); |
129 | static irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs); | ||
130 | static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); | 126 | static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
131 | static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs); | ||
132 | static void gfar_phy_change(void *data); | ||
133 | static void gfar_phy_timer(unsigned long data); | ||
134 | static void adjust_link(struct net_device *dev); | 127 | static void adjust_link(struct net_device *dev); |
135 | static void init_registers(struct net_device *dev); | 128 | static void init_registers(struct net_device *dev); |
136 | static int init_phy(struct net_device *dev); | 129 | static int init_phy(struct net_device *dev); |
137 | static int gfar_probe(struct device *device); | 130 | static int gfar_probe(struct device *device); |
138 | static int gfar_remove(struct device *device); | 131 | static int gfar_remove(struct device *device); |
139 | void free_skb_resources(struct gfar_private *priv); | 132 | static void free_skb_resources(struct gfar_private *priv); |
140 | static void gfar_set_multi(struct net_device *dev); | 133 | static void gfar_set_multi(struct net_device *dev); |
141 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 134 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
142 | #ifdef CONFIG_GFAR_NAPI | 135 | #ifdef CONFIG_GFAR_NAPI |
@@ -144,7 +137,6 @@ static int gfar_poll(struct net_device *dev, int *budget); | |||
144 | #endif | 137 | #endif |
145 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); | 138 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); |
146 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); | 139 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); |
147 | static void gfar_phy_startup_timer(unsigned long data); | ||
148 | static void gfar_vlan_rx_register(struct net_device *netdev, | 140 | static void gfar_vlan_rx_register(struct net_device *netdev, |
149 | struct vlan_group *grp); | 141 | struct vlan_group *grp); |
150 | static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); | 142 | static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
@@ -162,6 +154,9 @@ int gfar_uses_fcb(struct gfar_private *priv) | |||
162 | else | 154 | else |
163 | return 0; | 155 | return 0; |
164 | } | 156 | } |
157 | |||
158 | /* Set up the ethernet device structure, private data, | ||
159 | * and anything else we need before we start */ | ||
165 | static int gfar_probe(struct device *device) | 160 | static int gfar_probe(struct device *device) |
166 | { | 161 | { |
167 | u32 tempval; | 162 | u32 tempval; |
@@ -175,7 +170,7 @@ static int gfar_probe(struct device *device) | |||
175 | 170 | ||
176 | einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; | 171 | einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; |
177 | 172 | ||
178 | if (einfo == NULL) { | 173 | if (NULL == einfo) { |
179 | printk(KERN_ERR "gfar %d: Missing additional data!\n", | 174 | printk(KERN_ERR "gfar %d: Missing additional data!\n", |
180 | pdev->id); | 175 | pdev->id); |
181 | 176 | ||
@@ -185,7 +180,7 @@ static int gfar_probe(struct device *device) | |||
185 | /* Create an ethernet device instance */ | 180 | /* Create an ethernet device instance */ |
186 | dev = alloc_etherdev(sizeof (*priv)); | 181 | dev = alloc_etherdev(sizeof (*priv)); |
187 | 182 | ||
188 | if (dev == NULL) | 183 | if (NULL == dev) |
189 | return -ENOMEM; | 184 | return -ENOMEM; |
190 | 185 | ||
191 | priv = netdev_priv(dev); | 186 | priv = netdev_priv(dev); |
@@ -207,20 +202,11 @@ static int gfar_probe(struct device *device) | |||
207 | priv->regs = (struct gfar *) | 202 | priv->regs = (struct gfar *) |
208 | ioremap(r->start, sizeof (struct gfar)); | 203 | ioremap(r->start, sizeof (struct gfar)); |
209 | 204 | ||
210 | if (priv->regs == NULL) { | 205 | if (NULL == priv->regs) { |
211 | err = -ENOMEM; | 206 | err = -ENOMEM; |
212 | goto regs_fail; | 207 | goto regs_fail; |
213 | } | 208 | } |
214 | 209 | ||
215 | /* Set the PHY base address */ | ||
216 | priv->phyregs = (struct gfar *) | ||
217 | ioremap(einfo->phy_reg_addr, sizeof (struct gfar)); | ||
218 | |||
219 | if (priv->phyregs == NULL) { | ||
220 | err = -ENOMEM; | ||
221 | goto phy_regs_fail; | ||
222 | } | ||
223 | |||
224 | spin_lock_init(&priv->lock); | 210 | spin_lock_init(&priv->lock); |
225 | 211 | ||
226 | dev_set_drvdata(device, dev); | 212 | dev_set_drvdata(device, dev); |
@@ -386,12 +372,10 @@ static int gfar_probe(struct device *device) | |||
386 | return 0; | 372 | return 0; |
387 | 373 | ||
388 | register_fail: | 374 | register_fail: |
389 | iounmap((void *) priv->phyregs); | ||
390 | phy_regs_fail: | ||
391 | iounmap((void *) priv->regs); | 375 | iounmap((void *) priv->regs); |
392 | regs_fail: | 376 | regs_fail: |
393 | free_netdev(dev); | 377 | free_netdev(dev); |
394 | return -ENOMEM; | 378 | return err; |
395 | } | 379 | } |
396 | 380 | ||
397 | static int gfar_remove(struct device *device) | 381 | static int gfar_remove(struct device *device) |
@@ -402,108 +386,41 @@ static int gfar_remove(struct device *device) | |||
402 | dev_set_drvdata(device, NULL); | 386 | dev_set_drvdata(device, NULL); |
403 | 387 | ||
404 | iounmap((void *) priv->regs); | 388 | iounmap((void *) priv->regs); |
405 | iounmap((void *) priv->phyregs); | ||
406 | free_netdev(dev); | 389 | free_netdev(dev); |
407 | 390 | ||
408 | return 0; | 391 | return 0; |
409 | } | 392 | } |
410 | 393 | ||
411 | 394 | ||
412 | /* Configure the PHY for dev. | 395 | /* Initializes driver's PHY state, and attaches to the PHY. |
413 | * returns 0 if success. -1 if failure | 396 | * Returns 0 on success. |
414 | */ | 397 | */ |
415 | static int init_phy(struct net_device *dev) | 398 | static int init_phy(struct net_device *dev) |
416 | { | 399 | { |
417 | struct gfar_private *priv = netdev_priv(dev); | 400 | struct gfar_private *priv = netdev_priv(dev); |
418 | struct phy_info *curphy; | 401 | uint gigabit_support = |
419 | unsigned int timeout = PHY_INIT_TIMEOUT; | 402 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? |
420 | struct gfar *phyregs = priv->phyregs; | 403 | SUPPORTED_1000baseT_Full : 0; |
421 | struct gfar_mii_info *mii_info; | 404 | struct phy_device *phydev; |
422 | int err; | ||
423 | 405 | ||
424 | priv->oldlink = 0; | 406 | priv->oldlink = 0; |
425 | priv->oldspeed = 0; | 407 | priv->oldspeed = 0; |
426 | priv->oldduplex = -1; | 408 | priv->oldduplex = -1; |
427 | 409 | ||
428 | mii_info = kmalloc(sizeof(struct gfar_mii_info), | 410 | phydev = phy_connect(dev, priv->einfo->bus_id, &adjust_link, 0); |
429 | GFP_KERNEL); | ||
430 | |||
431 | if(NULL == mii_info) { | ||
432 | if (netif_msg_ifup(priv)) | ||
433 | printk(KERN_ERR "%s: Could not allocate mii_info\n", | ||
434 | dev->name); | ||
435 | return -ENOMEM; | ||
436 | } | ||
437 | |||
438 | mii_info->speed = SPEED_1000; | ||
439 | mii_info->duplex = DUPLEX_FULL; | ||
440 | mii_info->pause = 0; | ||
441 | mii_info->link = 1; | ||
442 | |||
443 | mii_info->advertising = (ADVERTISED_10baseT_Half | | ||
444 | ADVERTISED_10baseT_Full | | ||
445 | ADVERTISED_100baseT_Half | | ||
446 | ADVERTISED_100baseT_Full | | ||
447 | ADVERTISED_1000baseT_Full); | ||
448 | mii_info->autoneg = 1; | ||
449 | 411 | ||
450 | spin_lock_init(&mii_info->mdio_lock); | 412 | if (IS_ERR(phydev)) { |
451 | 413 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | |
452 | mii_info->mii_id = priv->einfo->phyid; | 414 | return PTR_ERR(phydev); |
453 | |||
454 | mii_info->dev = dev; | ||
455 | |||
456 | mii_info->mdio_read = &read_phy_reg; | ||
457 | mii_info->mdio_write = &write_phy_reg; | ||
458 | |||
459 | priv->mii_info = mii_info; | ||
460 | |||
461 | /* Reset the management interface */ | ||
462 | gfar_write(&phyregs->miimcfg, MIIMCFG_RESET); | ||
463 | |||
464 | /* Setup the MII Mgmt clock speed */ | ||
465 | gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE); | ||
466 | |||
467 | /* Wait until the bus is free */ | ||
468 | while ((gfar_read(&phyregs->miimind) & MIIMIND_BUSY) && | ||
469 | timeout--) | ||
470 | cpu_relax(); | ||
471 | |||
472 | if(timeout <= 0) { | ||
473 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", | ||
474 | dev->name); | ||
475 | err = -1; | ||
476 | goto bus_fail; | ||
477 | } | ||
478 | |||
479 | /* get info for this PHY */ | ||
480 | curphy = get_phy_info(priv->mii_info); | ||
481 | |||
482 | if (curphy == NULL) { | ||
483 | if (netif_msg_ifup(priv)) | ||
484 | printk(KERN_ERR "%s: No PHY found\n", dev->name); | ||
485 | err = -1; | ||
486 | goto no_phy; | ||
487 | } | 415 | } |
488 | 416 | ||
489 | mii_info->phyinfo = curphy; | 417 | /* Remove any features not supported by the controller */ |
418 | phydev->supported &= (GFAR_SUPPORTED | gigabit_support); | ||
419 | phydev->advertising = phydev->supported; | ||
490 | 420 | ||
491 | /* Run the commands which initialize the PHY */ | 421 | priv->phydev = phydev; |
492 | if(curphy->init) { | ||
493 | err = curphy->init(priv->mii_info); | ||
494 | |||
495 | if (err) | ||
496 | goto phy_init_fail; | ||
497 | } | ||
498 | 422 | ||
499 | return 0; | 423 | return 0; |
500 | |||
501 | phy_init_fail: | ||
502 | no_phy: | ||
503 | bus_fail: | ||
504 | kfree(mii_info); | ||
505 | |||
506 | return err; | ||
507 | } | 424 | } |
508 | 425 | ||
509 | static void init_registers(struct net_device *dev) | 426 | static void init_registers(struct net_device *dev) |
@@ -603,24 +520,13 @@ void stop_gfar(struct net_device *dev) | |||
603 | struct gfar *regs = priv->regs; | 520 | struct gfar *regs = priv->regs; |
604 | unsigned long flags; | 521 | unsigned long flags; |
605 | 522 | ||
523 | phy_stop(priv->phydev); | ||
524 | |||
606 | /* Lock it down */ | 525 | /* Lock it down */ |
607 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
608 | 527 | ||
609 | /* Tell the kernel the link is down */ | ||
610 | priv->mii_info->link = 0; | ||
611 | adjust_link(dev); | ||
612 | |||
613 | gfar_halt(dev); | 528 | gfar_halt(dev); |
614 | 529 | ||
615 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
616 | /* Clear any pending interrupts */ | ||
617 | mii_clear_phy_interrupt(priv->mii_info); | ||
618 | |||
619 | /* Disable PHY Interrupts */ | ||
620 | mii_configure_phy_interrupt(priv->mii_info, | ||
621 | MII_INTERRUPT_DISABLED); | ||
622 | } | ||
623 | |||
624 | spin_unlock_irqrestore(&priv->lock, flags); | 530 | spin_unlock_irqrestore(&priv->lock, flags); |
625 | 531 | ||
626 | /* Free the IRQs */ | 532 | /* Free the IRQs */ |
@@ -629,13 +535,7 @@ void stop_gfar(struct net_device *dev) | |||
629 | free_irq(priv->interruptTransmit, dev); | 535 | free_irq(priv->interruptTransmit, dev); |
630 | free_irq(priv->interruptReceive, dev); | 536 | free_irq(priv->interruptReceive, dev); |
631 | } else { | 537 | } else { |
632 | free_irq(priv->interruptTransmit, dev); | 538 | free_irq(priv->interruptTransmit, dev); |
633 | } | ||
634 | |||
635 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
636 | free_irq(priv->einfo->interruptPHY, dev); | ||
637 | } else { | ||
638 | del_timer_sync(&priv->phy_info_timer); | ||
639 | } | 539 | } |
640 | 540 | ||
641 | free_skb_resources(priv); | 541 | free_skb_resources(priv); |
@@ -649,7 +549,7 @@ void stop_gfar(struct net_device *dev) | |||
649 | 549 | ||
650 | /* If there are any tx skbs or rx skbs still around, free them. | 550 | /* If there are any tx skbs or rx skbs still around, free them. |
651 | * Then free tx_skbuff and rx_skbuff */ | 551 | * Then free tx_skbuff and rx_skbuff */ |
652 | void free_skb_resources(struct gfar_private *priv) | 552 | static void free_skb_resources(struct gfar_private *priv) |
653 | { | 553 | { |
654 | struct rxbd8 *rxbdp; | 554 | struct rxbd8 *rxbdp; |
655 | struct txbd8 *txbdp; | 555 | struct txbd8 *txbdp; |
@@ -770,7 +670,7 @@ int startup_gfar(struct net_device *dev) | |||
770 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * | 670 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * |
771 | priv->tx_ring_size, GFP_KERNEL); | 671 | priv->tx_ring_size, GFP_KERNEL); |
772 | 672 | ||
773 | if (priv->tx_skbuff == NULL) { | 673 | if (NULL == priv->tx_skbuff) { |
774 | if (netif_msg_ifup(priv)) | 674 | if (netif_msg_ifup(priv)) |
775 | printk(KERN_ERR "%s: Could not allocate tx_skbuff\n", | 675 | printk(KERN_ERR "%s: Could not allocate tx_skbuff\n", |
776 | dev->name); | 676 | dev->name); |
@@ -785,7 +685,7 @@ int startup_gfar(struct net_device *dev) | |||
785 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * | 685 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * |
786 | priv->rx_ring_size, GFP_KERNEL); | 686 | priv->rx_ring_size, GFP_KERNEL); |
787 | 687 | ||
788 | if (priv->rx_skbuff == NULL) { | 688 | if (NULL == priv->rx_skbuff) { |
789 | if (netif_msg_ifup(priv)) | 689 | if (netif_msg_ifup(priv)) |
790 | printk(KERN_ERR "%s: Could not allocate rx_skbuff\n", | 690 | printk(KERN_ERR "%s: Could not allocate rx_skbuff\n", |
791 | dev->name); | 691 | dev->name); |
@@ -879,13 +779,7 @@ int startup_gfar(struct net_device *dev) | |||
879 | } | 779 | } |
880 | } | 780 | } |
881 | 781 | ||
882 | /* Set up the PHY change work queue */ | 782 | phy_start(priv->phydev); |
883 | INIT_WORK(&priv->tq, gfar_phy_change, dev); | ||
884 | |||
885 | init_timer(&priv->phy_info_timer); | ||
886 | priv->phy_info_timer.function = &gfar_phy_startup_timer; | ||
887 | priv->phy_info_timer.data = (unsigned long) priv->mii_info; | ||
888 | mod_timer(&priv->phy_info_timer, jiffies + HZ); | ||
889 | 783 | ||
890 | /* Configure the coalescing support */ | 784 | /* Configure the coalescing support */ |
891 | if (priv->txcoalescing) | 785 | if (priv->txcoalescing) |
@@ -933,11 +827,6 @@ tx_skb_fail: | |||
933 | priv->tx_bd_base, | 827 | priv->tx_bd_base, |
934 | gfar_read(®s->tbase0)); | 828 | gfar_read(®s->tbase0)); |
935 | 829 | ||
936 | if (priv->mii_info->phyinfo->close) | ||
937 | priv->mii_info->phyinfo->close(priv->mii_info); | ||
938 | |||
939 | kfree(priv->mii_info); | ||
940 | |||
941 | return err; | 830 | return err; |
942 | } | 831 | } |
943 | 832 | ||
@@ -1035,7 +924,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1035 | txbdp->status &= TXBD_WRAP; | 924 | txbdp->status &= TXBD_WRAP; |
1036 | 925 | ||
1037 | /* Set up checksumming */ | 926 | /* Set up checksumming */ |
1038 | if ((dev->features & NETIF_F_IP_CSUM) | 927 | if ((dev->features & NETIF_F_IP_CSUM) |
1039 | && (CHECKSUM_HW == skb->ip_summed)) { | 928 | && (CHECKSUM_HW == skb->ip_summed)) { |
1040 | fcb = gfar_add_fcb(skb, txbdp); | 929 | fcb = gfar_add_fcb(skb, txbdp); |
1041 | gfar_tx_checksum(skb, fcb); | 930 | gfar_tx_checksum(skb, fcb); |
@@ -1103,11 +992,9 @@ static int gfar_close(struct net_device *dev) | |||
1103 | struct gfar_private *priv = netdev_priv(dev); | 992 | struct gfar_private *priv = netdev_priv(dev); |
1104 | stop_gfar(dev); | 993 | stop_gfar(dev); |
1105 | 994 | ||
1106 | /* Shutdown the PHY */ | 995 | /* Disconnect from the PHY */ |
1107 | if (priv->mii_info->phyinfo->close) | 996 | phy_disconnect(priv->phydev); |
1108 | priv->mii_info->phyinfo->close(priv->mii_info); | 997 | priv->phydev = NULL; |
1109 | |||
1110 | kfree(priv->mii_info); | ||
1111 | 998 | ||
1112 | netif_stop_queue(dev); | 999 | netif_stop_queue(dev); |
1113 | 1000 | ||
@@ -1343,7 +1230,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp) | |||
1343 | while ((!skb) && timeout--) | 1230 | while ((!skb) && timeout--) |
1344 | skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT); | 1231 | skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT); |
1345 | 1232 | ||
1346 | if (skb == NULL) | 1233 | if (NULL == skb) |
1347 | return NULL; | 1234 | return NULL; |
1348 | 1235 | ||
1349 | /* We need the data buffer to be aligned properly. We will reserve | 1236 | /* We need the data buffer to be aligned properly. We will reserve |
@@ -1490,7 +1377,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
1490 | struct gfar_private *priv = netdev_priv(dev); | 1377 | struct gfar_private *priv = netdev_priv(dev); |
1491 | struct rxfcb *fcb = NULL; | 1378 | struct rxfcb *fcb = NULL; |
1492 | 1379 | ||
1493 | if (skb == NULL) { | 1380 | if (NULL == skb) { |
1494 | if (netif_msg_rx_err(priv)) | 1381 | if (netif_msg_rx_err(priv)) |
1495 | printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name); | 1382 | printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name); |
1496 | priv->stats.rx_dropped++; | 1383 | priv->stats.rx_dropped++; |
@@ -1718,131 +1605,9 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1718 | return IRQ_HANDLED; | 1605 | return IRQ_HANDLED; |
1719 | } | 1606 | } |
1720 | 1607 | ||
1721 | static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
1722 | { | ||
1723 | struct net_device *dev = (struct net_device *) dev_id; | ||
1724 | struct gfar_private *priv = netdev_priv(dev); | ||
1725 | |||
1726 | /* Clear the interrupt */ | ||
1727 | mii_clear_phy_interrupt(priv->mii_info); | ||
1728 | |||
1729 | /* Disable PHY interrupts */ | ||
1730 | mii_configure_phy_interrupt(priv->mii_info, | ||
1731 | MII_INTERRUPT_DISABLED); | ||
1732 | |||
1733 | /* Schedule the phy change */ | ||
1734 | schedule_work(&priv->tq); | ||
1735 | |||
1736 | return IRQ_HANDLED; | ||
1737 | } | ||
1738 | |||
1739 | /* Scheduled by the phy_interrupt/timer to handle PHY changes */ | ||
1740 | static void gfar_phy_change(void *data) | ||
1741 | { | ||
1742 | struct net_device *dev = (struct net_device *) data; | ||
1743 | struct gfar_private *priv = netdev_priv(dev); | ||
1744 | int result = 0; | ||
1745 | |||
1746 | /* Delay to give the PHY a chance to change the | ||
1747 | * register state */ | ||
1748 | msleep(1); | ||
1749 | |||
1750 | /* Update the link, speed, duplex */ | ||
1751 | result = priv->mii_info->phyinfo->read_status(priv->mii_info); | ||
1752 | |||
1753 | /* Adjust the known status as long as the link | ||
1754 | * isn't still coming up */ | ||
1755 | if((0 == result) || (priv->mii_info->link == 0)) | ||
1756 | adjust_link(dev); | ||
1757 | |||
1758 | /* Reenable interrupts, if needed */ | ||
1759 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) | ||
1760 | mii_configure_phy_interrupt(priv->mii_info, | ||
1761 | MII_INTERRUPT_ENABLED); | ||
1762 | } | ||
1763 | |||
1764 | /* Called every so often on systems that don't interrupt | ||
1765 | * the core for PHY changes */ | ||
1766 | static void gfar_phy_timer(unsigned long data) | ||
1767 | { | ||
1768 | struct net_device *dev = (struct net_device *) data; | ||
1769 | struct gfar_private *priv = netdev_priv(dev); | ||
1770 | |||
1771 | schedule_work(&priv->tq); | ||
1772 | |||
1773 | mod_timer(&priv->phy_info_timer, jiffies + | ||
1774 | GFAR_PHY_CHANGE_TIME * HZ); | ||
1775 | } | ||
1776 | |||
1777 | /* Keep trying aneg for some time | ||
1778 | * If, after GFAR_AN_TIMEOUT seconds, it has not | ||
1779 | * finished, we switch to forced. | ||
1780 | * Either way, once the process has completed, we either | ||
1781 | * request the interrupt, or switch the timer over to | ||
1782 | * using gfar_phy_timer to check status */ | ||
1783 | static void gfar_phy_startup_timer(unsigned long data) | ||
1784 | { | ||
1785 | int result; | ||
1786 | static int secondary = GFAR_AN_TIMEOUT; | ||
1787 | struct gfar_mii_info *mii_info = (struct gfar_mii_info *)data; | ||
1788 | struct gfar_private *priv = netdev_priv(mii_info->dev); | ||
1789 | |||
1790 | /* Configure the Auto-negotiation */ | ||
1791 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
1792 | |||
1793 | /* If autonegotiation failed to start, and | ||
1794 | * we haven't timed out, reset the timer, and return */ | ||
1795 | if (result && secondary--) { | ||
1796 | mod_timer(&priv->phy_info_timer, jiffies + HZ); | ||
1797 | return; | ||
1798 | } else if (result) { | ||
1799 | /* Couldn't start autonegotiation. | ||
1800 | * Try switching to forced */ | ||
1801 | mii_info->autoneg = 0; | ||
1802 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
1803 | |||
1804 | /* Forcing failed! Give up */ | ||
1805 | if(result) { | ||
1806 | if (netif_msg_link(priv)) | ||
1807 | printk(KERN_ERR "%s: Forcing failed!\n", | ||
1808 | mii_info->dev->name); | ||
1809 | return; | ||
1810 | } | ||
1811 | } | ||
1812 | |||
1813 | /* Kill the timer so it can be restarted */ | ||
1814 | del_timer_sync(&priv->phy_info_timer); | ||
1815 | |||
1816 | /* Grab the PHY interrupt, if necessary/possible */ | ||
1817 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
1818 | if (request_irq(priv->einfo->interruptPHY, | ||
1819 | phy_interrupt, | ||
1820 | SA_SHIRQ, | ||
1821 | "phy_interrupt", | ||
1822 | mii_info->dev) < 0) { | ||
1823 | if (netif_msg_intr(priv)) | ||
1824 | printk(KERN_ERR "%s: Can't get IRQ %d (PHY)\n", | ||
1825 | mii_info->dev->name, | ||
1826 | priv->einfo->interruptPHY); | ||
1827 | } else { | ||
1828 | mii_configure_phy_interrupt(priv->mii_info, | ||
1829 | MII_INTERRUPT_ENABLED); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | |||
1834 | /* Start the timer again, this time in order to | ||
1835 | * handle a change in status */ | ||
1836 | init_timer(&priv->phy_info_timer); | ||
1837 | priv->phy_info_timer.function = &gfar_phy_timer; | ||
1838 | priv->phy_info_timer.data = (unsigned long) mii_info->dev; | ||
1839 | mod_timer(&priv->phy_info_timer, jiffies + | ||
1840 | GFAR_PHY_CHANGE_TIME * HZ); | ||
1841 | } | ||
1842 | |||
1843 | /* Called every time the controller might need to be made | 1608 | /* Called every time the controller might need to be made |
1844 | * aware of new link state. The PHY code conveys this | 1609 | * aware of new link state. The PHY code conveys this |
1845 | * information through variables in the priv structure, and this | 1610 | * information through variables in the phydev structure, and this |
1846 | * function converts those variables into the appropriate | 1611 | * function converts those variables into the appropriate |
1847 | * register values, and can bring down the device if needed. | 1612 | * register values, and can bring down the device if needed. |
1848 | */ | 1613 | */ |
@@ -1850,84 +1615,68 @@ static void adjust_link(struct net_device *dev) | |||
1850 | { | 1615 | { |
1851 | struct gfar_private *priv = netdev_priv(dev); | 1616 | struct gfar_private *priv = netdev_priv(dev); |
1852 | struct gfar *regs = priv->regs; | 1617 | struct gfar *regs = priv->regs; |
1853 | u32 tempval; | 1618 | unsigned long flags; |
1854 | struct gfar_mii_info *mii_info = priv->mii_info; | 1619 | struct phy_device *phydev = priv->phydev; |
1620 | int new_state = 0; | ||
1621 | |||
1622 | spin_lock_irqsave(&priv->lock, flags); | ||
1623 | if (phydev->link) { | ||
1624 | u32 tempval = gfar_read(®s->maccfg2); | ||
1855 | 1625 | ||
1856 | if (mii_info->link) { | ||
1857 | /* Now we make sure that we can be in full duplex mode. | 1626 | /* Now we make sure that we can be in full duplex mode. |
1858 | * If not, we operate in half-duplex mode. */ | 1627 | * If not, we operate in half-duplex mode. */ |
1859 | if (mii_info->duplex != priv->oldduplex) { | 1628 | if (phydev->duplex != priv->oldduplex) { |
1860 | if (!(mii_info->duplex)) { | 1629 | new_state = 1; |
1861 | tempval = gfar_read(®s->maccfg2); | 1630 | if (!(phydev->duplex)) |
1862 | tempval &= ~(MACCFG2_FULL_DUPLEX); | 1631 | tempval &= ~(MACCFG2_FULL_DUPLEX); |
1863 | gfar_write(®s->maccfg2, tempval); | 1632 | else |
1864 | |||
1865 | if (netif_msg_link(priv)) | ||
1866 | printk(KERN_INFO "%s: Half Duplex\n", | ||
1867 | dev->name); | ||
1868 | } else { | ||
1869 | tempval = gfar_read(®s->maccfg2); | ||
1870 | tempval |= MACCFG2_FULL_DUPLEX; | 1633 | tempval |= MACCFG2_FULL_DUPLEX; |
1871 | gfar_write(®s->maccfg2, tempval); | ||
1872 | 1634 | ||
1873 | if (netif_msg_link(priv)) | 1635 | priv->oldduplex = phydev->duplex; |
1874 | printk(KERN_INFO "%s: Full Duplex\n", | ||
1875 | dev->name); | ||
1876 | } | ||
1877 | |||
1878 | priv->oldduplex = mii_info->duplex; | ||
1879 | } | 1636 | } |
1880 | 1637 | ||
1881 | if (mii_info->speed != priv->oldspeed) { | 1638 | if (phydev->speed != priv->oldspeed) { |
1882 | switch (mii_info->speed) { | 1639 | new_state = 1; |
1640 | switch (phydev->speed) { | ||
1883 | case 1000: | 1641 | case 1000: |
1884 | tempval = gfar_read(®s->maccfg2); | ||
1885 | tempval = | 1642 | tempval = |
1886 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII); | 1643 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII); |
1887 | gfar_write(®s->maccfg2, tempval); | ||
1888 | break; | 1644 | break; |
1889 | case 100: | 1645 | case 100: |
1890 | case 10: | 1646 | case 10: |
1891 | tempval = gfar_read(®s->maccfg2); | ||
1892 | tempval = | 1647 | tempval = |
1893 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII); | 1648 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII); |
1894 | gfar_write(®s->maccfg2, tempval); | ||
1895 | break; | 1649 | break; |
1896 | default: | 1650 | default: |
1897 | if (netif_msg_link(priv)) | 1651 | if (netif_msg_link(priv)) |
1898 | printk(KERN_WARNING | 1652 | printk(KERN_WARNING |
1899 | "%s: Ack! Speed (%d) is not 10/100/1000!\n", | 1653 | "%s: Ack! Speed (%d) is not 10/100/1000!\n", |
1900 | dev->name, mii_info->speed); | 1654 | dev->name, phydev->speed); |
1901 | break; | 1655 | break; |
1902 | } | 1656 | } |
1903 | 1657 | ||
1904 | if (netif_msg_link(priv)) | 1658 | priv->oldspeed = phydev->speed; |
1905 | printk(KERN_INFO "%s: Speed %dBT\n", dev->name, | ||
1906 | mii_info->speed); | ||
1907 | |||
1908 | priv->oldspeed = mii_info->speed; | ||
1909 | } | 1659 | } |
1910 | 1660 | ||
1661 | gfar_write(®s->maccfg2, tempval); | ||
1662 | |||
1911 | if (!priv->oldlink) { | 1663 | if (!priv->oldlink) { |
1912 | if (netif_msg_link(priv)) | 1664 | new_state = 1; |
1913 | printk(KERN_INFO "%s: Link is up\n", dev->name); | ||
1914 | priv->oldlink = 1; | 1665 | priv->oldlink = 1; |
1915 | netif_carrier_on(dev); | ||
1916 | netif_schedule(dev); | 1666 | netif_schedule(dev); |
1917 | } | 1667 | } |
1918 | } else { | 1668 | } else if (priv->oldlink) { |
1919 | if (priv->oldlink) { | 1669 | new_state = 1; |
1920 | if (netif_msg_link(priv)) | 1670 | priv->oldlink = 0; |
1921 | printk(KERN_INFO "%s: Link is down\n", | 1671 | priv->oldspeed = 0; |
1922 | dev->name); | 1672 | priv->oldduplex = -1; |
1923 | priv->oldlink = 0; | ||
1924 | priv->oldspeed = 0; | ||
1925 | priv->oldduplex = -1; | ||
1926 | netif_carrier_off(dev); | ||
1927 | } | ||
1928 | } | 1673 | } |
1929 | } | ||
1930 | 1674 | ||
1675 | if (new_state && netif_msg_link(priv)) | ||
1676 | phy_print_status(phydev); | ||
1677 | |||
1678 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1679 | } | ||
1931 | 1680 | ||
1932 | /* Update the hash table based on the current list of multicast | 1681 | /* Update the hash table based on the current list of multicast |
1933 | * addresses we subscribe to. Also, change the promiscuity of | 1682 | * addresses we subscribe to. Also, change the promiscuity of |
@@ -2122,12 +1871,23 @@ static struct device_driver gfar_driver = { | |||
2122 | 1871 | ||
2123 | static int __init gfar_init(void) | 1872 | static int __init gfar_init(void) |
2124 | { | 1873 | { |
2125 | return driver_register(&gfar_driver); | 1874 | int err = gfar_mdio_init(); |
1875 | |||
1876 | if (err) | ||
1877 | return err; | ||
1878 | |||
1879 | err = driver_register(&gfar_driver); | ||
1880 | |||
1881 | if (err) | ||
1882 | gfar_mdio_exit(); | ||
1883 | |||
1884 | return err; | ||
2126 | } | 1885 | } |
2127 | 1886 | ||
2128 | static void __exit gfar_exit(void) | 1887 | static void __exit gfar_exit(void) |
2129 | { | 1888 | { |
2130 | driver_unregister(&gfar_driver); | 1889 | driver_unregister(&gfar_driver); |
1890 | gfar_mdio_exit(); | ||
2131 | } | 1891 | } |
2132 | 1892 | ||
2133 | module_init(gfar_init); | 1893 | module_init(gfar_init); |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 28af087d9fbb..c77ca6c0d04a 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | * Still left to do: | 18 | * Still left to do: |
19 | * -Add support for module parameters | 19 | * -Add support for module parameters |
20 | * -Add support for ethtool -s | ||
21 | * -Add patch for ethtool phys id | 20 | * -Add patch for ethtool phys id |
22 | */ | 21 | */ |
23 | #ifndef __GIANFAR_H | 22 | #ifndef __GIANFAR_H |
@@ -37,7 +36,8 @@ | |||
37 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
38 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
39 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
40 | #include <linux/fsl_devices.h> | 39 | #include <linux/mii.h> |
40 | #include <linux/phy.h> | ||
41 | 41 | ||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
@@ -48,7 +48,8 @@ | |||
48 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
49 | #include <linux/ethtool.h> | 49 | #include <linux/ethtool.h> |
50 | #include <linux/netdevice.h> | 50 | #include <linux/netdevice.h> |
51 | #include "gianfar_phy.h" | 51 | #include <linux/fsl_devices.h> |
52 | #include "gianfar_mii.h" | ||
52 | 53 | ||
53 | /* The maximum number of packets to be handled in one call of gfar_poll */ | 54 | /* The maximum number of packets to be handled in one call of gfar_poll */ |
54 | #define GFAR_DEV_WEIGHT 64 | 55 | #define GFAR_DEV_WEIGHT 64 |
@@ -73,7 +74,7 @@ | |||
73 | #define PHY_INIT_TIMEOUT 100000 | 74 | #define PHY_INIT_TIMEOUT 100000 |
74 | #define GFAR_PHY_CHANGE_TIME 2 | 75 | #define GFAR_PHY_CHANGE_TIME 2 |
75 | 76 | ||
76 | #define DEVICE_NAME "%s: Gianfar Ethernet Controller Version 1.1, " | 77 | #define DEVICE_NAME "%s: Gianfar Ethernet Controller Version 1.2, " |
77 | #define DRV_NAME "gfar-enet" | 78 | #define DRV_NAME "gfar-enet" |
78 | extern const char gfar_driver_name[]; | 79 | extern const char gfar_driver_name[]; |
79 | extern const char gfar_driver_version[]; | 80 | extern const char gfar_driver_version[]; |
@@ -578,12 +579,7 @@ struct gfar { | |||
578 | u32 hafdup; /* 0x.50c - Half Duplex Register */ | 579 | u32 hafdup; /* 0x.50c - Half Duplex Register */ |
579 | u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */ | 580 | u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */ |
580 | u8 res18[12]; | 581 | u8 res18[12]; |
581 | u32 miimcfg; /* 0x.520 - MII Management Configuration Register */ | 582 | u8 gfar_mii_regs[24]; /* See gianfar_phy.h */ |
582 | u32 miimcom; /* 0x.524 - MII Management Command Register */ | ||
583 | u32 miimadd; /* 0x.528 - MII Management Address Register */ | ||
584 | u32 miimcon; /* 0x.52c - MII Management Control Register */ | ||
585 | u32 miimstat; /* 0x.530 - MII Management Status Register */ | ||
586 | u32 miimind; /* 0x.534 - MII Management Indicator Register */ | ||
587 | u8 res19[4]; | 583 | u8 res19[4]; |
588 | u32 ifstat; /* 0x.53c - Interface Status Register */ | 584 | u32 ifstat; /* 0x.53c - Interface Status Register */ |
589 | u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */ | 585 | u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */ |
@@ -688,9 +684,6 @@ struct gfar_private { | |||
688 | struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ | 684 | struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ |
689 | u32 *hash_regs[16]; | 685 | u32 *hash_regs[16]; |
690 | int hash_width; | 686 | int hash_width; |
691 | struct gfar *phyregs; | ||
692 | struct work_struct tq; | ||
693 | struct timer_list phy_info_timer; | ||
694 | struct net_device_stats stats; /* linux network statistics */ | 687 | struct net_device_stats stats; /* linux network statistics */ |
695 | struct gfar_extra_stats extra_stats; | 688 | struct gfar_extra_stats extra_stats; |
696 | spinlock_t lock; | 689 | spinlock_t lock; |
@@ -710,7 +703,8 @@ struct gfar_private { | |||
710 | unsigned int interruptError; | 703 | unsigned int interruptError; |
711 | struct gianfar_platform_data *einfo; | 704 | struct gianfar_platform_data *einfo; |
712 | 705 | ||
713 | struct gfar_mii_info *mii_info; | 706 | struct phy_device *phydev; |
707 | struct mii_bus *mii_bus; | ||
714 | int oldspeed; | 708 | int oldspeed; |
715 | int oldduplex; | 709 | int oldduplex; |
716 | int oldlink; | 710 | int oldlink; |
@@ -732,4 +726,12 @@ extern inline void gfar_write(volatile unsigned *addr, u32 val) | |||
732 | 726 | ||
733 | extern struct ethtool_ops *gfar_op_array[]; | 727 | extern struct ethtool_ops *gfar_op_array[]; |
734 | 728 | ||
729 | extern irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs); | ||
730 | extern int startup_gfar(struct net_device *dev); | ||
731 | extern void stop_gfar(struct net_device *dev); | ||
732 | extern void gfar_halt(struct net_device *dev); | ||
733 | extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, | ||
734 | int enable, u32 regnum, u32 read); | ||
735 | void gfar_setup_stashing(struct net_device *dev); | ||
736 | |||
735 | #endif /* __GIANFAR_H */ | 737 | #endif /* __GIANFAR_H */ |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index a451de629197..68e3578e7613 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -39,17 +39,18 @@ | |||
39 | #include <asm/types.h> | 39 | #include <asm/types.h> |
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | #include <linux/ethtool.h> | 41 | #include <linux/ethtool.h> |
42 | #include <linux/mii.h> | ||
43 | #include <linux/phy.h> | ||
42 | 44 | ||
43 | #include "gianfar.h" | 45 | #include "gianfar.h" |
44 | 46 | ||
45 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) | 47 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) |
46 | 48 | ||
47 | extern int startup_gfar(struct net_device *dev); | ||
48 | extern void stop_gfar(struct net_device *dev); | ||
49 | extern void gfar_halt(struct net_device *dev); | ||
50 | extern void gfar_start(struct net_device *dev); | 49 | extern void gfar_start(struct net_device *dev); |
51 | extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); | 50 | extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); |
52 | 51 | ||
52 | #define GFAR_MAX_COAL_USECS 0xffff | ||
53 | #define GFAR_MAX_COAL_FRAMES 0xff | ||
53 | static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, | 54 | static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, |
54 | u64 * buf); | 55 | u64 * buf); |
55 | static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf); | 56 | static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf); |
@@ -182,38 +183,32 @@ static void gfar_gdrvinfo(struct net_device *dev, struct | |||
182 | drvinfo->eedump_len = 0; | 183 | drvinfo->eedump_len = 0; |
183 | } | 184 | } |
184 | 185 | ||
186 | |||
187 | static int gfar_ssettings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
188 | { | ||
189 | struct gfar_private *priv = netdev_priv(dev); | ||
190 | struct phy_device *phydev = priv->phydev; | ||
191 | |||
192 | if (NULL == phydev) | ||
193 | return -ENODEV; | ||
194 | |||
195 | return phy_ethtool_sset(phydev, cmd); | ||
196 | } | ||
197 | |||
198 | |||
185 | /* Return the current settings in the ethtool_cmd structure */ | 199 | /* Return the current settings in the ethtool_cmd structure */ |
186 | static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) | 200 | static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) |
187 | { | 201 | { |
188 | struct gfar_private *priv = netdev_priv(dev); | 202 | struct gfar_private *priv = netdev_priv(dev); |
189 | uint gigabit_support = | 203 | struct phy_device *phydev = priv->phydev; |
190 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? | 204 | |
191 | SUPPORTED_1000baseT_Full : 0; | 205 | if (NULL == phydev) |
192 | uint gigabit_advert = | 206 | return -ENODEV; |
193 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? | 207 | |
194 | ADVERTISED_1000baseT_Full: 0; | ||
195 | |||
196 | cmd->supported = (SUPPORTED_10baseT_Half | ||
197 | | SUPPORTED_100baseT_Half | ||
198 | | SUPPORTED_100baseT_Full | ||
199 | | gigabit_support | SUPPORTED_Autoneg); | ||
200 | |||
201 | /* For now, we always advertise everything */ | ||
202 | cmd->advertising = (ADVERTISED_10baseT_Half | ||
203 | | ADVERTISED_100baseT_Half | ||
204 | | ADVERTISED_100baseT_Full | ||
205 | | gigabit_advert | ADVERTISED_Autoneg); | ||
206 | |||
207 | cmd->speed = priv->mii_info->speed; | ||
208 | cmd->duplex = priv->mii_info->duplex; | ||
209 | cmd->port = PORT_MII; | ||
210 | cmd->phy_address = priv->mii_info->mii_id; | ||
211 | cmd->transceiver = XCVR_EXTERNAL; | ||
212 | cmd->autoneg = AUTONEG_ENABLE; | ||
213 | cmd->maxtxpkt = priv->txcount; | 208 | cmd->maxtxpkt = priv->txcount; |
214 | cmd->maxrxpkt = priv->rxcount; | 209 | cmd->maxrxpkt = priv->rxcount; |
215 | 210 | ||
216 | return 0; | 211 | return phy_ethtool_gset(phydev, cmd); |
217 | } | 212 | } |
218 | 213 | ||
219 | /* Return the length of the register structure */ | 214 | /* Return the length of the register structure */ |
@@ -241,14 +236,14 @@ static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int use | |||
241 | unsigned int count; | 236 | unsigned int count; |
242 | 237 | ||
243 | /* The timer is different, depending on the interface speed */ | 238 | /* The timer is different, depending on the interface speed */ |
244 | switch (priv->mii_info->speed) { | 239 | switch (priv->phydev->speed) { |
245 | case 1000: | 240 | case SPEED_1000: |
246 | count = GFAR_GBIT_TIME; | 241 | count = GFAR_GBIT_TIME; |
247 | break; | 242 | break; |
248 | case 100: | 243 | case SPEED_100: |
249 | count = GFAR_100_TIME; | 244 | count = GFAR_100_TIME; |
250 | break; | 245 | break; |
251 | case 10: | 246 | case SPEED_10: |
252 | default: | 247 | default: |
253 | count = GFAR_10_TIME; | 248 | count = GFAR_10_TIME; |
254 | break; | 249 | break; |
@@ -265,14 +260,14 @@ static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int tic | |||
265 | unsigned int count; | 260 | unsigned int count; |
266 | 261 | ||
267 | /* The timer is different, depending on the interface speed */ | 262 | /* The timer is different, depending on the interface speed */ |
268 | switch (priv->mii_info->speed) { | 263 | switch (priv->phydev->speed) { |
269 | case 1000: | 264 | case SPEED_1000: |
270 | count = GFAR_GBIT_TIME; | 265 | count = GFAR_GBIT_TIME; |
271 | break; | 266 | break; |
272 | case 100: | 267 | case SPEED_100: |
273 | count = GFAR_100_TIME; | 268 | count = GFAR_100_TIME; |
274 | break; | 269 | break; |
275 | case 10: | 270 | case SPEED_10: |
276 | default: | 271 | default: |
277 | count = GFAR_10_TIME; | 272 | count = GFAR_10_TIME; |
278 | break; | 273 | break; |
@@ -292,6 +287,9 @@ static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
292 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) | 287 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) |
293 | return -EOPNOTSUPP; | 288 | return -EOPNOTSUPP; |
294 | 289 | ||
290 | if (NULL == priv->phydev) | ||
291 | return -ENODEV; | ||
292 | |||
295 | cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); | 293 | cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); |
296 | cvals->rx_max_coalesced_frames = priv->rxcount; | 294 | cvals->rx_max_coalesced_frames = priv->rxcount; |
297 | 295 | ||
@@ -348,6 +346,22 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
348 | else | 346 | else |
349 | priv->rxcoalescing = 1; | 347 | priv->rxcoalescing = 1; |
350 | 348 | ||
349 | if (NULL == priv->phydev) | ||
350 | return -ENODEV; | ||
351 | |||
352 | /* Check the bounds of the values */ | ||
353 | if (cvals->rx_coalesce_usecs > GFAR_MAX_COAL_USECS) { | ||
354 | pr_info("Coalescing is limited to %d microseconds\n", | ||
355 | GFAR_MAX_COAL_USECS); | ||
356 | return -EINVAL; | ||
357 | } | ||
358 | |||
359 | if (cvals->rx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { | ||
360 | pr_info("Coalescing is limited to %d frames\n", | ||
361 | GFAR_MAX_COAL_FRAMES); | ||
362 | return -EINVAL; | ||
363 | } | ||
364 | |||
351 | priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs); | 365 | priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs); |
352 | priv->rxcount = cvals->rx_max_coalesced_frames; | 366 | priv->rxcount = cvals->rx_max_coalesced_frames; |
353 | 367 | ||
@@ -358,6 +372,19 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
358 | else | 372 | else |
359 | priv->txcoalescing = 1; | 373 | priv->txcoalescing = 1; |
360 | 374 | ||
375 | /* Check the bounds of the values */ | ||
376 | if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) { | ||
377 | pr_info("Coalescing is limited to %d microseconds\n", | ||
378 | GFAR_MAX_COAL_USECS); | ||
379 | return -EINVAL; | ||
380 | } | ||
381 | |||
382 | if (cvals->tx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { | ||
383 | pr_info("Coalescing is limited to %d frames\n", | ||
384 | GFAR_MAX_COAL_FRAMES); | ||
385 | return -EINVAL; | ||
386 | } | ||
387 | |||
361 | priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs); | 388 | priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs); |
362 | priv->txcount = cvals->tx_max_coalesced_frames; | 389 | priv->txcount = cvals->tx_max_coalesced_frames; |
363 | 390 | ||
@@ -536,6 +563,7 @@ static void gfar_set_msglevel(struct net_device *dev, uint32_t data) | |||
536 | 563 | ||
537 | struct ethtool_ops gfar_ethtool_ops = { | 564 | struct ethtool_ops gfar_ethtool_ops = { |
538 | .get_settings = gfar_gsettings, | 565 | .get_settings = gfar_gsettings, |
566 | .set_settings = gfar_ssettings, | ||
539 | .get_drvinfo = gfar_gdrvinfo, | 567 | .get_drvinfo = gfar_gdrvinfo, |
540 | .get_regs_len = gfar_reglen, | 568 | .get_regs_len = gfar_reglen, |
541 | .get_regs = gfar_get_regs, | 569 | .get_regs = gfar_get_regs, |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c new file mode 100644 index 000000000000..1eca1dbca7f1 --- /dev/null +++ b/drivers/net/gianfar_mii.c | |||
@@ -0,0 +1,219 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_mii.c | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- MIIM bus implementation | ||
5 | * Provides Bus interface for MIIM regs | ||
6 | * | ||
7 | * Author: Andy Fleming | ||
8 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
9 | * | ||
10 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/config.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/string.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/unistd.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/version.h> | ||
36 | #include <asm/ocp.h> | ||
37 | #include <linux/crc32.h> | ||
38 | #include <linux/mii.h> | ||
39 | #include <linux/phy.h> | ||
40 | |||
41 | #include <asm/io.h> | ||
42 | #include <asm/irq.h> | ||
43 | #include <asm/uaccess.h> | ||
44 | |||
45 | #include "gianfar.h" | ||
46 | #include "gianfar_mii.h" | ||
47 | |||
48 | /* Write value to the PHY at mii_id at register regnum, | ||
49 | * on the bus, waiting until the write is done before returning. | ||
50 | * All PHY configuration is done through the TSEC1 MIIM regs */ | ||
51 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) | ||
52 | { | ||
53 | struct gfar_mii *regs = bus->priv; | ||
54 | |||
55 | /* Set the PHY address and the register address we want to write */ | ||
56 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); | ||
57 | |||
58 | /* Write out the value we want */ | ||
59 | gfar_write(®s->miimcon, value); | ||
60 | |||
61 | /* Wait for the transaction to finish */ | ||
62 | while (gfar_read(®s->miimind) & MIIMIND_BUSY) | ||
63 | cpu_relax(); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | /* Read the bus for PHY at addr mii_id, register regnum, and | ||
69 | * return the value. Clears miimcom first. All PHY | ||
70 | * configuration has to be done through the TSEC1 MIIM regs */ | ||
71 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | ||
72 | { | ||
73 | struct gfar_mii *regs = bus->priv; | ||
74 | u16 value; | ||
75 | |||
76 | /* Set the PHY address and the register address we want to read */ | ||
77 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); | ||
78 | |||
79 | /* Clear miimcom, and then initiate a read */ | ||
80 | gfar_write(®s->miimcom, 0); | ||
81 | gfar_write(®s->miimcom, MII_READ_COMMAND); | ||
82 | |||
83 | /* Wait for the transaction to finish */ | ||
84 | while (gfar_read(®s->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) | ||
85 | cpu_relax(); | ||
86 | |||
87 | /* Grab the value of the register from miimstat */ | ||
88 | value = gfar_read(®s->miimstat); | ||
89 | |||
90 | return value; | ||
91 | } | ||
92 | |||
93 | |||
94 | /* Reset the MIIM registers, and wait for the bus to free */ | ||
95 | int gfar_mdio_reset(struct mii_bus *bus) | ||
96 | { | ||
97 | struct gfar_mii *regs = bus->priv; | ||
98 | unsigned int timeout = PHY_INIT_TIMEOUT; | ||
99 | |||
100 | spin_lock_bh(&bus->mdio_lock); | ||
101 | |||
102 | /* Reset the management interface */ | ||
103 | gfar_write(®s->miimcfg, MIIMCFG_RESET); | ||
104 | |||
105 | /* Setup the MII Mgmt clock speed */ | ||
106 | gfar_write(®s->miimcfg, MIIMCFG_INIT_VALUE); | ||
107 | |||
108 | /* Wait until the bus is free */ | ||
109 | while ((gfar_read(®s->miimind) & MIIMIND_BUSY) && | ||
110 | timeout--) | ||
111 | cpu_relax(); | ||
112 | |||
113 | spin_unlock_bh(&bus->mdio_lock); | ||
114 | |||
115 | if(timeout <= 0) { | ||
116 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", | ||
117 | bus->name); | ||
118 | return -EBUSY; | ||
119 | } | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | |||
125 | int gfar_mdio_probe(struct device *dev) | ||
126 | { | ||
127 | struct platform_device *pdev = to_platform_device(dev); | ||
128 | struct gianfar_mdio_data *pdata; | ||
129 | struct gfar_mii *regs; | ||
130 | struct mii_bus *new_bus; | ||
131 | int err = 0; | ||
132 | |||
133 | if (NULL == dev) | ||
134 | return -EINVAL; | ||
135 | |||
136 | new_bus = kmalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
137 | |||
138 | if (NULL == new_bus) | ||
139 | return -ENOMEM; | ||
140 | |||
141 | new_bus->name = "Gianfar MII Bus", | ||
142 | new_bus->read = &gfar_mdio_read, | ||
143 | new_bus->write = &gfar_mdio_write, | ||
144 | new_bus->reset = &gfar_mdio_reset, | ||
145 | new_bus->id = pdev->id; | ||
146 | |||
147 | pdata = (struct gianfar_mdio_data *)pdev->dev.platform_data; | ||
148 | |||
149 | if (NULL == pdata) { | ||
150 | printk(KERN_ERR "gfar mdio %d: Missing platform data!\n", pdev->id); | ||
151 | return -ENODEV; | ||
152 | } | ||
153 | |||
154 | /* Set the PHY base address */ | ||
155 | regs = (struct gfar_mii *) ioremap(pdata->paddr, | ||
156 | sizeof (struct gfar_mii)); | ||
157 | |||
158 | if (NULL == regs) { | ||
159 | err = -ENOMEM; | ||
160 | goto reg_map_fail; | ||
161 | } | ||
162 | |||
163 | new_bus->priv = regs; | ||
164 | |||
165 | new_bus->irq = pdata->irq; | ||
166 | |||
167 | new_bus->dev = dev; | ||
168 | dev_set_drvdata(dev, new_bus); | ||
169 | |||
170 | err = mdiobus_register(new_bus); | ||
171 | |||
172 | if (0 != err) { | ||
173 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
174 | new_bus->name); | ||
175 | goto bus_register_fail; | ||
176 | } | ||
177 | |||
178 | return 0; | ||
179 | |||
180 | bus_register_fail: | ||
181 | iounmap((void *) regs); | ||
182 | reg_map_fail: | ||
183 | kfree(new_bus); | ||
184 | |||
185 | return err; | ||
186 | } | ||
187 | |||
188 | |||
189 | int gfar_mdio_remove(struct device *dev) | ||
190 | { | ||
191 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
192 | |||
193 | mdiobus_unregister(bus); | ||
194 | |||
195 | dev_set_drvdata(dev, NULL); | ||
196 | |||
197 | iounmap((void *) (&bus->priv)); | ||
198 | bus->priv = NULL; | ||
199 | kfree(bus); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct device_driver gianfar_mdio_driver = { | ||
205 | .name = "fsl-gianfar_mdio", | ||
206 | .bus = &platform_bus_type, | ||
207 | .probe = gfar_mdio_probe, | ||
208 | .remove = gfar_mdio_remove, | ||
209 | }; | ||
210 | |||
211 | int __init gfar_mdio_init(void) | ||
212 | { | ||
213 | return driver_register(&gianfar_mdio_driver); | ||
214 | } | ||
215 | |||
216 | void __exit gfar_mdio_exit(void) | ||
217 | { | ||
218 | driver_unregister(&gianfar_mdio_driver); | ||
219 | } | ||
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h new file mode 100644 index 000000000000..56e5665d5c9b --- /dev/null +++ b/drivers/net/gianfar_mii.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_mii.h | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- MII Management Bus Implementation | ||
5 | * Driver for the MDIO bus controller in the Gianfar register space | ||
6 | * | ||
7 | * Author: Andy Fleming | ||
8 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
9 | * | ||
10 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | */ | ||
18 | #ifndef __GIANFAR_MII_H | ||
19 | #define __GIANFAR_MII_H | ||
20 | |||
21 | #define MIIMIND_BUSY 0x00000001 | ||
22 | #define MIIMIND_NOTVALID 0x00000004 | ||
23 | |||
24 | #define MII_READ_COMMAND 0x00000001 | ||
25 | |||
26 | #define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \ | ||
27 | | SUPPORTED_100baseT_Half \ | ||
28 | | SUPPORTED_100baseT_Full \ | ||
29 | | SUPPORTED_Autoneg \ | ||
30 | | SUPPORTED_MII) | ||
31 | |||
32 | struct gfar_mii { | ||
33 | u32 miimcfg; /* 0x.520 - MII Management Config Register */ | ||
34 | u32 miimcom; /* 0x.524 - MII Management Command Register */ | ||
35 | u32 miimadd; /* 0x.528 - MII Management Address Register */ | ||
36 | u32 miimcon; /* 0x.52c - MII Management Control Register */ | ||
37 | u32 miimstat; /* 0x.530 - MII Management Status Register */ | ||
38 | u32 miimind; /* 0x.534 - MII Management Indicator Register */ | ||
39 | }; | ||
40 | |||
41 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum); | ||
42 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); | ||
43 | int __init gfar_mdio_init(void); | ||
44 | void __exit gfar_mdio_exit(void); | ||
45 | #endif /* GIANFAR_PHY_H */ | ||
diff --git a/drivers/net/gianfar_phy.c b/drivers/net/gianfar_phy.c deleted file mode 100644 index 7c965f268a82..000000000000 --- a/drivers/net/gianfar_phy.c +++ /dev/null | |||
@@ -1,661 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_phy.c | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- PHY handling | ||
5 | * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560 | ||
6 | * Based on 8260_io/fcc_enet.c | ||
7 | * | ||
8 | * Author: Andy Fleming | ||
9 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
10 | * | ||
11 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/errno.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mm.h> | ||
34 | |||
35 | #include <asm/io.h> | ||
36 | #include <asm/irq.h> | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/version.h> | ||
40 | #include <linux/crc32.h> | ||
41 | #include <linux/mii.h> | ||
42 | |||
43 | #include "gianfar.h" | ||
44 | #include "gianfar_phy.h" | ||
45 | |||
46 | static void config_genmii_advert(struct gfar_mii_info *mii_info); | ||
47 | static void genmii_setup_forced(struct gfar_mii_info *mii_info); | ||
48 | static void genmii_restart_aneg(struct gfar_mii_info *mii_info); | ||
49 | static int gbit_config_aneg(struct gfar_mii_info *mii_info); | ||
50 | static int genmii_config_aneg(struct gfar_mii_info *mii_info); | ||
51 | static int genmii_update_link(struct gfar_mii_info *mii_info); | ||
52 | static int genmii_read_status(struct gfar_mii_info *mii_info); | ||
53 | u16 phy_read(struct gfar_mii_info *mii_info, u16 regnum); | ||
54 | void phy_write(struct gfar_mii_info *mii_info, u16 regnum, u16 val); | ||
55 | |||
56 | /* Write value to the PHY for this device to the register at regnum, */ | ||
57 | /* waiting until the write is done before it returns. All PHY */ | ||
58 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
59 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) | ||
60 | { | ||
61 | struct gfar_private *priv = netdev_priv(dev); | ||
62 | struct gfar *regbase = priv->phyregs; | ||
63 | |||
64 | /* Set the PHY address and the register address we want to write */ | ||
65 | gfar_write(®base->miimadd, (mii_id << 8) | regnum); | ||
66 | |||
67 | /* Write out the value we want */ | ||
68 | gfar_write(®base->miimcon, value); | ||
69 | |||
70 | /* Wait for the transaction to finish */ | ||
71 | while (gfar_read(®base->miimind) & MIIMIND_BUSY) | ||
72 | cpu_relax(); | ||
73 | } | ||
74 | |||
75 | /* Reads from register regnum in the PHY for device dev, */ | ||
76 | /* returning the value. Clears miimcom first. All PHY */ | ||
77 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
78 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum) | ||
79 | { | ||
80 | struct gfar_private *priv = netdev_priv(dev); | ||
81 | struct gfar *regbase = priv->phyregs; | ||
82 | u16 value; | ||
83 | |||
84 | /* Set the PHY address and the register address we want to read */ | ||
85 | gfar_write(®base->miimadd, (mii_id << 8) | regnum); | ||
86 | |||
87 | /* Clear miimcom, and then initiate a read */ | ||
88 | gfar_write(®base->miimcom, 0); | ||
89 | gfar_write(®base->miimcom, MII_READ_COMMAND); | ||
90 | |||
91 | /* Wait for the transaction to finish */ | ||
92 | while (gfar_read(®base->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) | ||
93 | cpu_relax(); | ||
94 | |||
95 | /* Grab the value of the register from miimstat */ | ||
96 | value = gfar_read(®base->miimstat); | ||
97 | |||
98 | return value; | ||
99 | } | ||
100 | |||
101 | void mii_clear_phy_interrupt(struct gfar_mii_info *mii_info) | ||
102 | { | ||
103 | if(mii_info->phyinfo->ack_interrupt) | ||
104 | mii_info->phyinfo->ack_interrupt(mii_info); | ||
105 | } | ||
106 | |||
107 | |||
108 | void mii_configure_phy_interrupt(struct gfar_mii_info *mii_info, u32 interrupts) | ||
109 | { | ||
110 | mii_info->interrupts = interrupts; | ||
111 | if(mii_info->phyinfo->config_intr) | ||
112 | mii_info->phyinfo->config_intr(mii_info); | ||
113 | } | ||
114 | |||
115 | |||
116 | /* Writes MII_ADVERTISE with the appropriate values, after | ||
117 | * sanitizing advertise to make sure only supported features | ||
118 | * are advertised | ||
119 | */ | ||
120 | static void config_genmii_advert(struct gfar_mii_info *mii_info) | ||
121 | { | ||
122 | u32 advertise; | ||
123 | u16 adv; | ||
124 | |||
125 | /* Only allow advertising what this PHY supports */ | ||
126 | mii_info->advertising &= mii_info->phyinfo->features; | ||
127 | advertise = mii_info->advertising; | ||
128 | |||
129 | /* Setup standard advertisement */ | ||
130 | adv = phy_read(mii_info, MII_ADVERTISE); | ||
131 | adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); | ||
132 | if (advertise & ADVERTISED_10baseT_Half) | ||
133 | adv |= ADVERTISE_10HALF; | ||
134 | if (advertise & ADVERTISED_10baseT_Full) | ||
135 | adv |= ADVERTISE_10FULL; | ||
136 | if (advertise & ADVERTISED_100baseT_Half) | ||
137 | adv |= ADVERTISE_100HALF; | ||
138 | if (advertise & ADVERTISED_100baseT_Full) | ||
139 | adv |= ADVERTISE_100FULL; | ||
140 | phy_write(mii_info, MII_ADVERTISE, adv); | ||
141 | } | ||
142 | |||
143 | static void genmii_setup_forced(struct gfar_mii_info *mii_info) | ||
144 | { | ||
145 | u16 ctrl; | ||
146 | u32 features = mii_info->phyinfo->features; | ||
147 | |||
148 | ctrl = phy_read(mii_info, MII_BMCR); | ||
149 | |||
150 | ctrl &= ~(BMCR_FULLDPLX|BMCR_SPEED100|BMCR_SPEED1000|BMCR_ANENABLE); | ||
151 | ctrl |= BMCR_RESET; | ||
152 | |||
153 | switch(mii_info->speed) { | ||
154 | case SPEED_1000: | ||
155 | if(features & (SUPPORTED_1000baseT_Half | ||
156 | | SUPPORTED_1000baseT_Full)) { | ||
157 | ctrl |= BMCR_SPEED1000; | ||
158 | break; | ||
159 | } | ||
160 | mii_info->speed = SPEED_100; | ||
161 | case SPEED_100: | ||
162 | if (features & (SUPPORTED_100baseT_Half | ||
163 | | SUPPORTED_100baseT_Full)) { | ||
164 | ctrl |= BMCR_SPEED100; | ||
165 | break; | ||
166 | } | ||
167 | mii_info->speed = SPEED_10; | ||
168 | case SPEED_10: | ||
169 | if (features & (SUPPORTED_10baseT_Half | ||
170 | | SUPPORTED_10baseT_Full)) | ||
171 | break; | ||
172 | default: /* Unsupported speed! */ | ||
173 | printk(KERN_ERR "%s: Bad speed!\n", | ||
174 | mii_info->dev->name); | ||
175 | break; | ||
176 | } | ||
177 | |||
178 | phy_write(mii_info, MII_BMCR, ctrl); | ||
179 | } | ||
180 | |||
181 | |||
182 | /* Enable and Restart Autonegotiation */ | ||
183 | static void genmii_restart_aneg(struct gfar_mii_info *mii_info) | ||
184 | { | ||
185 | u16 ctl; | ||
186 | |||
187 | ctl = phy_read(mii_info, MII_BMCR); | ||
188 | ctl |= (BMCR_ANENABLE | BMCR_ANRESTART); | ||
189 | phy_write(mii_info, MII_BMCR, ctl); | ||
190 | } | ||
191 | |||
192 | |||
193 | static int gbit_config_aneg(struct gfar_mii_info *mii_info) | ||
194 | { | ||
195 | u16 adv; | ||
196 | u32 advertise; | ||
197 | |||
198 | if(mii_info->autoneg) { | ||
199 | /* Configure the ADVERTISE register */ | ||
200 | config_genmii_advert(mii_info); | ||
201 | advertise = mii_info->advertising; | ||
202 | |||
203 | adv = phy_read(mii_info, MII_1000BASETCONTROL); | ||
204 | adv &= ~(MII_1000BASETCONTROL_FULLDUPLEXCAP | | ||
205 | MII_1000BASETCONTROL_HALFDUPLEXCAP); | ||
206 | if (advertise & SUPPORTED_1000baseT_Half) | ||
207 | adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP; | ||
208 | if (advertise & SUPPORTED_1000baseT_Full) | ||
209 | adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP; | ||
210 | phy_write(mii_info, MII_1000BASETCONTROL, adv); | ||
211 | |||
212 | /* Start/Restart aneg */ | ||
213 | genmii_restart_aneg(mii_info); | ||
214 | } else | ||
215 | genmii_setup_forced(mii_info); | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static int marvell_config_aneg(struct gfar_mii_info *mii_info) | ||
221 | { | ||
222 | /* The Marvell PHY has an errata which requires | ||
223 | * that certain registers get written in order | ||
224 | * to restart autonegotiation */ | ||
225 | phy_write(mii_info, MII_BMCR, BMCR_RESET); | ||
226 | |||
227 | phy_write(mii_info, 0x1d, 0x1f); | ||
228 | phy_write(mii_info, 0x1e, 0x200c); | ||
229 | phy_write(mii_info, 0x1d, 0x5); | ||
230 | phy_write(mii_info, 0x1e, 0); | ||
231 | phy_write(mii_info, 0x1e, 0x100); | ||
232 | |||
233 | gbit_config_aneg(mii_info); | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | static int genmii_config_aneg(struct gfar_mii_info *mii_info) | ||
238 | { | ||
239 | if (mii_info->autoneg) { | ||
240 | config_genmii_advert(mii_info); | ||
241 | genmii_restart_aneg(mii_info); | ||
242 | } else | ||
243 | genmii_setup_forced(mii_info); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | |||
249 | static int genmii_update_link(struct gfar_mii_info *mii_info) | ||
250 | { | ||
251 | u16 status; | ||
252 | |||
253 | /* Do a fake read */ | ||
254 | phy_read(mii_info, MII_BMSR); | ||
255 | |||
256 | /* Read link and autonegotiation status */ | ||
257 | status = phy_read(mii_info, MII_BMSR); | ||
258 | if ((status & BMSR_LSTATUS) == 0) | ||
259 | mii_info->link = 0; | ||
260 | else | ||
261 | mii_info->link = 1; | ||
262 | |||
263 | /* If we are autonegotiating, and not done, | ||
264 | * return an error */ | ||
265 | if (mii_info->autoneg && !(status & BMSR_ANEGCOMPLETE)) | ||
266 | return -EAGAIN; | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static int genmii_read_status(struct gfar_mii_info *mii_info) | ||
272 | { | ||
273 | u16 status; | ||
274 | int err; | ||
275 | |||
276 | /* Update the link, but return if there | ||
277 | * was an error */ | ||
278 | err = genmii_update_link(mii_info); | ||
279 | if (err) | ||
280 | return err; | ||
281 | |||
282 | if (mii_info->autoneg) { | ||
283 | status = phy_read(mii_info, MII_LPA); | ||
284 | |||
285 | if (status & (LPA_10FULL | LPA_100FULL)) | ||
286 | mii_info->duplex = DUPLEX_FULL; | ||
287 | else | ||
288 | mii_info->duplex = DUPLEX_HALF; | ||
289 | if (status & (LPA_100FULL | LPA_100HALF)) | ||
290 | mii_info->speed = SPEED_100; | ||
291 | else | ||
292 | mii_info->speed = SPEED_10; | ||
293 | mii_info->pause = 0; | ||
294 | } | ||
295 | /* On non-aneg, we assume what we put in BMCR is the speed, | ||
296 | * though magic-aneg shouldn't prevent this case from occurring | ||
297 | */ | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | static int marvell_read_status(struct gfar_mii_info *mii_info) | ||
302 | { | ||
303 | u16 status; | ||
304 | int err; | ||
305 | |||
306 | /* Update the link, but return if there | ||
307 | * was an error */ | ||
308 | err = genmii_update_link(mii_info); | ||
309 | if (err) | ||
310 | return err; | ||
311 | |||
312 | /* If the link is up, read the speed and duplex */ | ||
313 | /* If we aren't autonegotiating, assume speeds | ||
314 | * are as set */ | ||
315 | if (mii_info->autoneg && mii_info->link) { | ||
316 | int speed; | ||
317 | status = phy_read(mii_info, MII_M1011_PHY_SPEC_STATUS); | ||
318 | |||
319 | #if 0 | ||
320 | /* If speed and duplex aren't resolved, | ||
321 | * return an error. Isn't this handled | ||
322 | * by checking aneg? | ||
323 | */ | ||
324 | if ((status & MII_M1011_PHY_SPEC_STATUS_RESOLVED) == 0) | ||
325 | return -EAGAIN; | ||
326 | #endif | ||
327 | |||
328 | /* Get the duplexity */ | ||
329 | if (status & MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX) | ||
330 | mii_info->duplex = DUPLEX_FULL; | ||
331 | else | ||
332 | mii_info->duplex = DUPLEX_HALF; | ||
333 | |||
334 | /* Get the speed */ | ||
335 | speed = status & MII_M1011_PHY_SPEC_STATUS_SPD_MASK; | ||
336 | switch(speed) { | ||
337 | case MII_M1011_PHY_SPEC_STATUS_1000: | ||
338 | mii_info->speed = SPEED_1000; | ||
339 | break; | ||
340 | case MII_M1011_PHY_SPEC_STATUS_100: | ||
341 | mii_info->speed = SPEED_100; | ||
342 | break; | ||
343 | default: | ||
344 | mii_info->speed = SPEED_10; | ||
345 | break; | ||
346 | } | ||
347 | mii_info->pause = 0; | ||
348 | } | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | |||
354 | static int cis820x_read_status(struct gfar_mii_info *mii_info) | ||
355 | { | ||
356 | u16 status; | ||
357 | int err; | ||
358 | |||
359 | /* Update the link, but return if there | ||
360 | * was an error */ | ||
361 | err = genmii_update_link(mii_info); | ||
362 | if (err) | ||
363 | return err; | ||
364 | |||
365 | /* If the link is up, read the speed and duplex */ | ||
366 | /* If we aren't autonegotiating, assume speeds | ||
367 | * are as set */ | ||
368 | if (mii_info->autoneg && mii_info->link) { | ||
369 | int speed; | ||
370 | |||
371 | status = phy_read(mii_info, MII_CIS8201_AUX_CONSTAT); | ||
372 | if (status & MII_CIS8201_AUXCONSTAT_DUPLEX) | ||
373 | mii_info->duplex = DUPLEX_FULL; | ||
374 | else | ||
375 | mii_info->duplex = DUPLEX_HALF; | ||
376 | |||
377 | speed = status & MII_CIS8201_AUXCONSTAT_SPEED; | ||
378 | |||
379 | switch (speed) { | ||
380 | case MII_CIS8201_AUXCONSTAT_GBIT: | ||
381 | mii_info->speed = SPEED_1000; | ||
382 | break; | ||
383 | case MII_CIS8201_AUXCONSTAT_100: | ||
384 | mii_info->speed = SPEED_100; | ||
385 | break; | ||
386 | default: | ||
387 | mii_info->speed = SPEED_10; | ||
388 | break; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | return 0; | ||
393 | } | ||
394 | |||
395 | static int marvell_ack_interrupt(struct gfar_mii_info *mii_info) | ||
396 | { | ||
397 | /* Clear the interrupts by reading the reg */ | ||
398 | phy_read(mii_info, MII_M1011_IEVENT); | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | static int marvell_config_intr(struct gfar_mii_info *mii_info) | ||
404 | { | ||
405 | if(mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
406 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_INIT); | ||
407 | else | ||
408 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR); | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static int cis820x_init(struct gfar_mii_info *mii_info) | ||
414 | { | ||
415 | phy_write(mii_info, MII_CIS8201_AUX_CONSTAT, | ||
416 | MII_CIS8201_AUXCONSTAT_INIT); | ||
417 | phy_write(mii_info, MII_CIS8201_EXT_CON1, | ||
418 | MII_CIS8201_EXTCON1_INIT); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int cis820x_ack_interrupt(struct gfar_mii_info *mii_info) | ||
424 | { | ||
425 | phy_read(mii_info, MII_CIS8201_ISTAT); | ||
426 | |||
427 | return 0; | ||
428 | } | ||
429 | |||
430 | static int cis820x_config_intr(struct gfar_mii_info *mii_info) | ||
431 | { | ||
432 | if(mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
433 | phy_write(mii_info, MII_CIS8201_IMASK, MII_CIS8201_IMASK_MASK); | ||
434 | else | ||
435 | phy_write(mii_info, MII_CIS8201_IMASK, 0); | ||
436 | |||
437 | return 0; | ||
438 | } | ||
439 | |||
440 | #define DM9161_DELAY 10 | ||
441 | |||
442 | static int dm9161_read_status(struct gfar_mii_info *mii_info) | ||
443 | { | ||
444 | u16 status; | ||
445 | int err; | ||
446 | |||
447 | /* Update the link, but return if there | ||
448 | * was an error */ | ||
449 | err = genmii_update_link(mii_info); | ||
450 | if (err) | ||
451 | return err; | ||
452 | |||
453 | /* If the link is up, read the speed and duplex */ | ||
454 | /* If we aren't autonegotiating, assume speeds | ||
455 | * are as set */ | ||
456 | if (mii_info->autoneg && mii_info->link) { | ||
457 | status = phy_read(mii_info, MII_DM9161_SCSR); | ||
458 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_100H)) | ||
459 | mii_info->speed = SPEED_100; | ||
460 | else | ||
461 | mii_info->speed = SPEED_10; | ||
462 | |||
463 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_10F)) | ||
464 | mii_info->duplex = DUPLEX_FULL; | ||
465 | else | ||
466 | mii_info->duplex = DUPLEX_HALF; | ||
467 | } | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | |||
473 | static int dm9161_config_aneg(struct gfar_mii_info *mii_info) | ||
474 | { | ||
475 | struct dm9161_private *priv = mii_info->priv; | ||
476 | |||
477 | if(0 == priv->resetdone) | ||
478 | return -EAGAIN; | ||
479 | |||
480 | return 0; | ||
481 | } | ||
482 | |||
483 | static void dm9161_timer(unsigned long data) | ||
484 | { | ||
485 | struct gfar_mii_info *mii_info = (struct gfar_mii_info *)data; | ||
486 | struct dm9161_private *priv = mii_info->priv; | ||
487 | u16 status = phy_read(mii_info, MII_BMSR); | ||
488 | |||
489 | if (status & BMSR_ANEGCOMPLETE) { | ||
490 | priv->resetdone = 1; | ||
491 | } else | ||
492 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
493 | } | ||
494 | |||
495 | static int dm9161_init(struct gfar_mii_info *mii_info) | ||
496 | { | ||
497 | struct dm9161_private *priv; | ||
498 | |||
499 | /* Allocate the private data structure */ | ||
500 | priv = kmalloc(sizeof(struct dm9161_private), GFP_KERNEL); | ||
501 | |||
502 | if (NULL == priv) | ||
503 | return -ENOMEM; | ||
504 | |||
505 | mii_info->priv = priv; | ||
506 | |||
507 | /* Reset is not done yet */ | ||
508 | priv->resetdone = 0; | ||
509 | |||
510 | /* Isolate the PHY */ | ||
511 | phy_write(mii_info, MII_BMCR, BMCR_ISOLATE); | ||
512 | |||
513 | /* Do not bypass the scrambler/descrambler */ | ||
514 | phy_write(mii_info, MII_DM9161_SCR, MII_DM9161_SCR_INIT); | ||
515 | |||
516 | /* Clear 10BTCSR to default */ | ||
517 | phy_write(mii_info, MII_DM9161_10BTCSR, MII_DM9161_10BTCSR_INIT); | ||
518 | |||
519 | /* Reconnect the PHY, and enable Autonegotiation */ | ||
520 | phy_write(mii_info, MII_BMCR, BMCR_ANENABLE); | ||
521 | |||
522 | /* Start a timer for DM9161_DELAY seconds to wait | ||
523 | * for the PHY to be ready */ | ||
524 | init_timer(&priv->timer); | ||
525 | priv->timer.function = &dm9161_timer; | ||
526 | priv->timer.data = (unsigned long) mii_info; | ||
527 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
532 | static void dm9161_close(struct gfar_mii_info *mii_info) | ||
533 | { | ||
534 | struct dm9161_private *priv = mii_info->priv; | ||
535 | |||
536 | del_timer_sync(&priv->timer); | ||
537 | kfree(priv); | ||
538 | } | ||
539 | |||
540 | #if 0 | ||
541 | static int dm9161_ack_interrupt(struct gfar_mii_info *mii_info) | ||
542 | { | ||
543 | phy_read(mii_info, MII_DM9161_INTR); | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | #endif | ||
548 | |||
549 | /* Cicada 820x */ | ||
550 | static struct phy_info phy_info_cis820x = { | ||
551 | 0x000fc440, | ||
552 | "Cicada Cis8204", | ||
553 | 0x000fffc0, | ||
554 | .features = MII_GBIT_FEATURES, | ||
555 | .init = &cis820x_init, | ||
556 | .config_aneg = &gbit_config_aneg, | ||
557 | .read_status = &cis820x_read_status, | ||
558 | .ack_interrupt = &cis820x_ack_interrupt, | ||
559 | .config_intr = &cis820x_config_intr, | ||
560 | }; | ||
561 | |||
562 | static struct phy_info phy_info_dm9161 = { | ||
563 | .phy_id = 0x0181b880, | ||
564 | .name = "Davicom DM9161E", | ||
565 | .phy_id_mask = 0x0ffffff0, | ||
566 | .init = dm9161_init, | ||
567 | .config_aneg = dm9161_config_aneg, | ||
568 | .read_status = dm9161_read_status, | ||
569 | .close = dm9161_close, | ||
570 | }; | ||
571 | |||
572 | static struct phy_info phy_info_marvell = { | ||
573 | .phy_id = 0x01410c00, | ||
574 | .phy_id_mask = 0xffffff00, | ||
575 | .name = "Marvell 88E1101/88E1111", | ||
576 | .features = MII_GBIT_FEATURES, | ||
577 | .config_aneg = &marvell_config_aneg, | ||
578 | .read_status = &marvell_read_status, | ||
579 | .ack_interrupt = &marvell_ack_interrupt, | ||
580 | .config_intr = &marvell_config_intr, | ||
581 | }; | ||
582 | |||
583 | static struct phy_info phy_info_genmii= { | ||
584 | .phy_id = 0x00000000, | ||
585 | .phy_id_mask = 0x00000000, | ||
586 | .name = "Generic MII", | ||
587 | .features = MII_BASIC_FEATURES, | ||
588 | .config_aneg = genmii_config_aneg, | ||
589 | .read_status = genmii_read_status, | ||
590 | }; | ||
591 | |||
592 | static struct phy_info *phy_info[] = { | ||
593 | &phy_info_cis820x, | ||
594 | &phy_info_marvell, | ||
595 | &phy_info_dm9161, | ||
596 | &phy_info_genmii, | ||
597 | NULL | ||
598 | }; | ||
599 | |||
600 | u16 phy_read(struct gfar_mii_info *mii_info, u16 regnum) | ||
601 | { | ||
602 | u16 retval; | ||
603 | unsigned long flags; | ||
604 | |||
605 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
606 | retval = mii_info->mdio_read(mii_info->dev, mii_info->mii_id, regnum); | ||
607 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
608 | |||
609 | return retval; | ||
610 | } | ||
611 | |||
612 | void phy_write(struct gfar_mii_info *mii_info, u16 regnum, u16 val) | ||
613 | { | ||
614 | unsigned long flags; | ||
615 | |||
616 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
617 | mii_info->mdio_write(mii_info->dev, | ||
618 | mii_info->mii_id, | ||
619 | regnum, val); | ||
620 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
621 | } | ||
622 | |||
623 | /* Use the PHY ID registers to determine what type of PHY is attached | ||
624 | * to device dev. return a struct phy_info structure describing that PHY | ||
625 | */ | ||
626 | struct phy_info * get_phy_info(struct gfar_mii_info *mii_info) | ||
627 | { | ||
628 | u16 phy_reg; | ||
629 | u32 phy_ID; | ||
630 | int i; | ||
631 | struct phy_info *theInfo = NULL; | ||
632 | struct net_device *dev = mii_info->dev; | ||
633 | |||
634 | /* Grab the bits from PHYIR1, and put them in the upper half */ | ||
635 | phy_reg = phy_read(mii_info, MII_PHYSID1); | ||
636 | phy_ID = (phy_reg & 0xffff) << 16; | ||
637 | |||
638 | /* Grab the bits from PHYIR2, and put them in the lower half */ | ||
639 | phy_reg = phy_read(mii_info, MII_PHYSID2); | ||
640 | phy_ID |= (phy_reg & 0xffff); | ||
641 | |||
642 | /* loop through all the known PHY types, and find one that */ | ||
643 | /* matches the ID we read from the PHY. */ | ||
644 | for (i = 0; phy_info[i]; i++) | ||
645 | if (phy_info[i]->phy_id == | ||
646 | (phy_ID & phy_info[i]->phy_id_mask)) { | ||
647 | theInfo = phy_info[i]; | ||
648 | break; | ||
649 | } | ||
650 | |||
651 | /* This shouldn't happen, as we have generic PHY support */ | ||
652 | if (theInfo == NULL) { | ||
653 | printk("%s: PHY id %x is not supported!\n", dev->name, phy_ID); | ||
654 | return NULL; | ||
655 | } else { | ||
656 | printk("%s: PHY is %s (%x)\n", dev->name, theInfo->name, | ||
657 | phy_ID); | ||
658 | } | ||
659 | |||
660 | return theInfo; | ||
661 | } | ||
diff --git a/drivers/net/gianfar_phy.h b/drivers/net/gianfar_phy.h deleted file mode 100644 index 1e9b3abf1e6d..000000000000 --- a/drivers/net/gianfar_phy.h +++ /dev/null | |||
@@ -1,213 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_phy.h | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- PHY handling | ||
5 | * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560 | ||
6 | * Based on 8260_io/fcc_enet.c | ||
7 | * | ||
8 | * Author: Andy Fleming | ||
9 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
10 | * | ||
11 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | #ifndef __GIANFAR_PHY_H | ||
20 | #define __GIANFAR_PHY_H | ||
21 | |||
22 | #define MII_end ((u32)-2) | ||
23 | #define MII_read ((u32)-1) | ||
24 | |||
25 | #define MIIMIND_BUSY 0x00000001 | ||
26 | #define MIIMIND_NOTVALID 0x00000004 | ||
27 | |||
28 | #define GFAR_AN_TIMEOUT 2000 | ||
29 | |||
30 | /* 1000BT control (Marvell & BCM54xx at least) */ | ||
31 | #define MII_1000BASETCONTROL 0x09 | ||
32 | #define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200 | ||
33 | #define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 | ||
34 | |||
35 | /* Cicada Extended Control Register 1 */ | ||
36 | #define MII_CIS8201_EXT_CON1 0x17 | ||
37 | #define MII_CIS8201_EXTCON1_INIT 0x0000 | ||
38 | |||
39 | /* Cicada Interrupt Mask Register */ | ||
40 | #define MII_CIS8201_IMASK 0x19 | ||
41 | #define MII_CIS8201_IMASK_IEN 0x8000 | ||
42 | #define MII_CIS8201_IMASK_SPEED 0x4000 | ||
43 | #define MII_CIS8201_IMASK_LINK 0x2000 | ||
44 | #define MII_CIS8201_IMASK_DUPLEX 0x1000 | ||
45 | #define MII_CIS8201_IMASK_MASK 0xf000 | ||
46 | |||
47 | /* Cicada Interrupt Status Register */ | ||
48 | #define MII_CIS8201_ISTAT 0x1a | ||
49 | #define MII_CIS8201_ISTAT_STATUS 0x8000 | ||
50 | #define MII_CIS8201_ISTAT_SPEED 0x4000 | ||
51 | #define MII_CIS8201_ISTAT_LINK 0x2000 | ||
52 | #define MII_CIS8201_ISTAT_DUPLEX 0x1000 | ||
53 | |||
54 | /* Cicada Auxiliary Control/Status Register */ | ||
55 | #define MII_CIS8201_AUX_CONSTAT 0x1c | ||
56 | #define MII_CIS8201_AUXCONSTAT_INIT 0x0004 | ||
57 | #define MII_CIS8201_AUXCONSTAT_DUPLEX 0x0020 | ||
58 | #define MII_CIS8201_AUXCONSTAT_SPEED 0x0018 | ||
59 | #define MII_CIS8201_AUXCONSTAT_GBIT 0x0010 | ||
60 | #define MII_CIS8201_AUXCONSTAT_100 0x0008 | ||
61 | |||
62 | /* 88E1011 PHY Status Register */ | ||
63 | #define MII_M1011_PHY_SPEC_STATUS 0x11 | ||
64 | #define MII_M1011_PHY_SPEC_STATUS_1000 0x8000 | ||
65 | #define MII_M1011_PHY_SPEC_STATUS_100 0x4000 | ||
66 | #define MII_M1011_PHY_SPEC_STATUS_SPD_MASK 0xc000 | ||
67 | #define MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX 0x2000 | ||
68 | #define MII_M1011_PHY_SPEC_STATUS_RESOLVED 0x0800 | ||
69 | #define MII_M1011_PHY_SPEC_STATUS_LINK 0x0400 | ||
70 | |||
71 | #define MII_M1011_IEVENT 0x13 | ||
72 | #define MII_M1011_IEVENT_CLEAR 0x0000 | ||
73 | |||
74 | #define MII_M1011_IMASK 0x12 | ||
75 | #define MII_M1011_IMASK_INIT 0x6400 | ||
76 | #define MII_M1011_IMASK_CLEAR 0x0000 | ||
77 | |||
78 | #define MII_DM9161_SCR 0x10 | ||
79 | #define MII_DM9161_SCR_INIT 0x0610 | ||
80 | |||
81 | /* DM9161 Specified Configuration and Status Register */ | ||
82 | #define MII_DM9161_SCSR 0x11 | ||
83 | #define MII_DM9161_SCSR_100F 0x8000 | ||
84 | #define MII_DM9161_SCSR_100H 0x4000 | ||
85 | #define MII_DM9161_SCSR_10F 0x2000 | ||
86 | #define MII_DM9161_SCSR_10H 0x1000 | ||
87 | |||
88 | /* DM9161 Interrupt Register */ | ||
89 | #define MII_DM9161_INTR 0x15 | ||
90 | #define MII_DM9161_INTR_PEND 0x8000 | ||
91 | #define MII_DM9161_INTR_DPLX_MASK 0x0800 | ||
92 | #define MII_DM9161_INTR_SPD_MASK 0x0400 | ||
93 | #define MII_DM9161_INTR_LINK_MASK 0x0200 | ||
94 | #define MII_DM9161_INTR_MASK 0x0100 | ||
95 | #define MII_DM9161_INTR_DPLX_CHANGE 0x0010 | ||
96 | #define MII_DM9161_INTR_SPD_CHANGE 0x0008 | ||
97 | #define MII_DM9161_INTR_LINK_CHANGE 0x0004 | ||
98 | #define MII_DM9161_INTR_INIT 0x0000 | ||
99 | #define MII_DM9161_INTR_STOP \ | ||
100 | (MII_DM9161_INTR_DPLX_MASK | MII_DM9161_INTR_SPD_MASK \ | ||
101 | | MII_DM9161_INTR_LINK_MASK | MII_DM9161_INTR_MASK) | ||
102 | |||
103 | /* DM9161 10BT Configuration/Status */ | ||
104 | #define MII_DM9161_10BTCSR 0x12 | ||
105 | #define MII_DM9161_10BTCSR_INIT 0x7800 | ||
106 | |||
107 | #define MII_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ | ||
108 | SUPPORTED_10baseT_Full | \ | ||
109 | SUPPORTED_100baseT_Half | \ | ||
110 | SUPPORTED_100baseT_Full | \ | ||
111 | SUPPORTED_Autoneg | \ | ||
112 | SUPPORTED_TP | \ | ||
113 | SUPPORTED_MII) | ||
114 | |||
115 | #define MII_GBIT_FEATURES (MII_BASIC_FEATURES | \ | ||
116 | SUPPORTED_1000baseT_Half | \ | ||
117 | SUPPORTED_1000baseT_Full) | ||
118 | |||
119 | #define MII_READ_COMMAND 0x00000001 | ||
120 | |||
121 | #define MII_INTERRUPT_DISABLED 0x0 | ||
122 | #define MII_INTERRUPT_ENABLED 0x1 | ||
123 | /* Taken from mii_if_info and sungem_phy.h */ | ||
124 | struct gfar_mii_info { | ||
125 | /* Information about the PHY type */ | ||
126 | /* And management functions */ | ||
127 | struct phy_info *phyinfo; | ||
128 | |||
129 | /* forced speed & duplex (no autoneg) | ||
130 | * partner speed & duplex & pause (autoneg) | ||
131 | */ | ||
132 | int speed; | ||
133 | int duplex; | ||
134 | int pause; | ||
135 | |||
136 | /* The most recently read link state */ | ||
137 | int link; | ||
138 | |||
139 | /* Enabled Interrupts */ | ||
140 | u32 interrupts; | ||
141 | |||
142 | u32 advertising; | ||
143 | int autoneg; | ||
144 | int mii_id; | ||
145 | |||
146 | /* private data pointer */ | ||
147 | /* For use by PHYs to maintain extra state */ | ||
148 | void *priv; | ||
149 | |||
150 | /* Provided by host chip */ | ||
151 | struct net_device *dev; | ||
152 | |||
153 | /* A lock to ensure that only one thing can read/write | ||
154 | * the MDIO bus at a time */ | ||
155 | spinlock_t mdio_lock; | ||
156 | |||
157 | /* Provided by ethernet driver */ | ||
158 | int (*mdio_read) (struct net_device *dev, int mii_id, int reg); | ||
159 | void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val); | ||
160 | }; | ||
161 | |||
162 | /* struct phy_info: a structure which defines attributes for a PHY | ||
163 | * | ||
164 | * id will contain a number which represents the PHY. During | ||
165 | * startup, the driver will poll the PHY to find out what its | ||
166 | * UID--as defined by registers 2 and 3--is. The 32-bit result | ||
167 | * gotten from the PHY will be ANDed with phy_id_mask to | ||
168 | * discard any bits which may change based on revision numbers | ||
169 | * unimportant to functionality | ||
170 | * | ||
171 | * There are 6 commands which take a gfar_mii_info structure. | ||
172 | * Each PHY must declare config_aneg, and read_status. | ||
173 | */ | ||
174 | struct phy_info { | ||
175 | u32 phy_id; | ||
176 | char *name; | ||
177 | unsigned int phy_id_mask; | ||
178 | u32 features; | ||
179 | |||
180 | /* Called to initialize the PHY */ | ||
181 | int (*init)(struct gfar_mii_info *mii_info); | ||
182 | |||
183 | /* Called to suspend the PHY for power */ | ||
184 | int (*suspend)(struct gfar_mii_info *mii_info); | ||
185 | |||
186 | /* Reconfigures autonegotiation (or disables it) */ | ||
187 | int (*config_aneg)(struct gfar_mii_info *mii_info); | ||
188 | |||
189 | /* Determines the negotiated speed and duplex */ | ||
190 | int (*read_status)(struct gfar_mii_info *mii_info); | ||
191 | |||
192 | /* Clears any pending interrupts */ | ||
193 | int (*ack_interrupt)(struct gfar_mii_info *mii_info); | ||
194 | |||
195 | /* Enables or disables interrupts */ | ||
196 | int (*config_intr)(struct gfar_mii_info *mii_info); | ||
197 | |||
198 | /* Clears up any memory if needed */ | ||
199 | void (*close)(struct gfar_mii_info *mii_info); | ||
200 | }; | ||
201 | |||
202 | struct phy_info *get_phy_info(struct gfar_mii_info *mii_info); | ||
203 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum); | ||
204 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value); | ||
205 | void mii_clear_phy_interrupt(struct gfar_mii_info *mii_info); | ||
206 | void mii_configure_phy_interrupt(struct gfar_mii_info *mii_info, u32 interrupts); | ||
207 | |||
208 | struct dm9161_private { | ||
209 | struct timer_list timer; | ||
210 | int resetdone; | ||
211 | }; | ||
212 | |||
213 | #endif /* GIANFAR_PHY_H */ | ||
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 | ||
728 | void ixgb_set_ethtool_ops(struct net_device *netdev) | 728 | void 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; |
299 | unmap: | 299 | unmap: |
300 | if (ei_status.reg0) | 300 | if (ei_status.reg0) |
301 | iounmap((void *)dev->mem_start); | 301 | iounmap(ei_status.mem); |
302 | cleanup: | 302 | cleanup: |
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 | ||
210 | int 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 | |||
210 | int mii_link_ok (struct mii_if_info *mii) | 224 | int 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); | |||
394 | EXPORT_SYMBOL(mii_ethtool_sset); | 408 | EXPORT_SYMBOL(mii_ethtool_sset); |
395 | EXPORT_SYMBOL(mii_check_link); | 409 | EXPORT_SYMBOL(mii_check_link); |
396 | EXPORT_SYMBOL(mii_check_media); | 410 | EXPORT_SYMBOL(mii_check_media); |
411 | EXPORT_SYMBOL(mii_check_gmii_support); | ||
397 | EXPORT_SYMBOL(generic_mii_ioctl); | 412 | EXPORT_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 | ||
642 | static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) | 644 | static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 1d123d2b53fd..bc354a80c099 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 | ||
29 | static const char *version = | 29 | static 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 | */ |
340 | struct pcnet32_private { | 343 | struct 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); | |||
397 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 408 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
398 | void *ptr); | 409 | void *ptr); |
399 | static void pcnet32_purge_tx_ring(struct net_device *dev); | 410 | static void pcnet32_purge_tx_ring(struct net_device *dev); |
411 | static int pcnet32_alloc_ring(struct net_device *dev); | ||
412 | static void pcnet32_free_ring(struct net_device *dev); | ||
413 | |||
400 | 414 | ||
401 | enum pci_flags_bit { | 415 | enum 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 | |||
636 | static 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 | ||
622 | static void pcnet32_get_strings(struct net_device *dev, u32 stringset, u8 *data) | 688 | static 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 | ||
1439 | err_free_ring: | ||
1440 | pcnet32_free_ring(dev); | ||
1362 | err_free_consistent: | 1441 | err_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); |
1364 | err_free_netdev: | 1443 | err_free_netdev: |
@@ -1369,6 +1448,86 @@ err_release_region: | |||
1369 | } | 1448 | } |
1370 | 1449 | ||
1371 | 1450 | ||
1451 | static 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 | |||
1501 | static 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 | |||
1372 | static int | 1531 | static int |
1373 | pcnet32_open(struct net_device *dev) | 1532 | pcnet32_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 | ||
1522 | err_free_ring: | 1681 | err_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 | |||
1932 | pcnet32_rx(struct net_device *dev) | 2092 | pcnet32_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/phy/Kconfig b/drivers/net/phy/Kconfig index 14f4de1a8180..c782a6329805 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -12,14 +12,6 @@ config PHYLIB | |||
12 | devices. This option provides infrastructure for | 12 | devices. This option provides infrastructure for |
13 | managing PHY devices. | 13 | managing PHY devices. |
14 | 14 | ||
15 | config PHYCONTROL | ||
16 | bool " Support for automatically handling PHY state changes" | ||
17 | depends on PHYLIB | ||
18 | help | ||
19 | Adds code to perform all the work for keeping PHY link | ||
20 | state (speed/duplex/etc) up-to-date. Also handles | ||
21 | interrupts. | ||
22 | |||
23 | comment "MII PHY device drivers" | 15 | comment "MII PHY device drivers" |
24 | depends on PHYLIB | 16 | depends on PHYLIB |
25 | 17 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d9e11f93bf3a..9209da9dde0d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -242,10 +242,6 @@ EXPORT_SYMBOL(phy_sanitize_settings); | |||
242 | * choose the next best ones from the ones selected, so we don't | 242 | * choose the next best ones from the ones selected, so we don't |
243 | * care if ethtool tries to give us bad values | 243 | * care if ethtool tries to give us bad values |
244 | * | 244 | * |
245 | * A note about the PHYCONTROL Layer. If you turn off | ||
246 | * CONFIG_PHYCONTROL, you will need to read the PHY status | ||
247 | * registers after this function completes, and update your | ||
248 | * controller manually. | ||
249 | */ | 245 | */ |
250 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) | 246 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) |
251 | { | 247 | { |
@@ -380,7 +376,6 @@ int phy_start_aneg(struct phy_device *phydev) | |||
380 | 376 | ||
381 | err = phydev->drv->config_aneg(phydev); | 377 | err = phydev->drv->config_aneg(phydev); |
382 | 378 | ||
383 | #ifdef CONFIG_PHYCONTROL | ||
384 | if (err < 0) | 379 | if (err < 0) |
385 | goto out_unlock; | 380 | goto out_unlock; |
386 | 381 | ||
@@ -395,14 +390,12 @@ int phy_start_aneg(struct phy_device *phydev) | |||
395 | } | 390 | } |
396 | 391 | ||
397 | out_unlock: | 392 | out_unlock: |
398 | #endif | ||
399 | spin_unlock(&phydev->lock); | 393 | spin_unlock(&phydev->lock); |
400 | return err; | 394 | return err; |
401 | } | 395 | } |
402 | EXPORT_SYMBOL(phy_start_aneg); | 396 | EXPORT_SYMBOL(phy_start_aneg); |
403 | 397 | ||
404 | 398 | ||
405 | #ifdef CONFIG_PHYCONTROL | ||
406 | static void phy_change(void *data); | 399 | static void phy_change(void *data); |
407 | static void phy_timer(unsigned long data); | 400 | static void phy_timer(unsigned long data); |
408 | 401 | ||
@@ -868,4 +861,3 @@ static void phy_timer(unsigned long data) | |||
868 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); | 861 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); |
869 | } | 862 | } |
870 | 863 | ||
871 | #endif /* CONFIG_PHYCONTROL */ | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 33f7bdb5857c..6da1aa0706a1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -101,7 +101,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
101 | return dev; | 101 | return dev; |
102 | } | 102 | } |
103 | 103 | ||
104 | #ifdef CONFIG_PHYCONTROL | ||
105 | /* phy_prepare_link: | 104 | /* phy_prepare_link: |
106 | * | 105 | * |
107 | * description: Tells the PHY infrastructure to handle the | 106 | * description: Tells the PHY infrastructure to handle the |
@@ -160,8 +159,6 @@ void phy_disconnect(struct phy_device *phydev) | |||
160 | } | 159 | } |
161 | EXPORT_SYMBOL(phy_disconnect); | 160 | EXPORT_SYMBOL(phy_disconnect); |
162 | 161 | ||
163 | #endif /* CONFIG_PHYCONTROL */ | ||
164 | |||
165 | /* phy_attach: | 162 | /* phy_attach: |
166 | * | 163 | * |
167 | * description: Called by drivers to attach to a particular PHY | 164 | * description: Called by drivers to attach to a particular PHY |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index afb3f186b884..159b56a56ef4 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1027,6 +1027,7 @@ static struct ethtool_ops rtl8169_ethtool_ops = { | |||
1027 | .get_strings = rtl8169_get_strings, | 1027 | .get_strings = rtl8169_get_strings, |
1028 | .get_stats_count = rtl8169_get_stats_count, | 1028 | .get_stats_count = rtl8169_get_stats_count, |
1029 | .get_ethtool_stats = rtl8169_get_ethtool_stats, | 1029 | .get_ethtool_stats = rtl8169_get_ethtool_stats, |
1030 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1030 | }; | 1031 | }; |
1031 | 1032 | ||
1032 | static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum, | 1033 | static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum, |
@@ -1511,6 +1512,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1511 | /* Get MAC address. FIXME: read EEPROM */ | 1512 | /* Get MAC address. FIXME: read EEPROM */ |
1512 | for (i = 0; i < MAC_ADDR_LEN; i++) | 1513 | for (i = 0; i < MAC_ADDR_LEN; i++) |
1513 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | 1514 | dev->dev_addr[i] = RTL_R8(MAC0 + i); |
1515 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
1514 | 1516 | ||
1515 | dev->open = rtl8169_open; | 1517 | dev->open = rtl8169_open; |
1516 | dev->hard_start_xmit = rtl8169_start_xmit; | 1518 | 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 | |||
32 | MODULE_AUTHOR(DRV_AUTHOR); | ||
33 | MODULE_DESCRIPTION(DRV_DESC); | ||
34 | MODULE_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 | |||
50 | static LIST_HEAD(rionet_peers); | ||
51 | |||
52 | struct 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 | |||
66 | struct rionet_peer { | ||
67 | struct list_head node; | ||
68 | struct rio_dev *rdev; | ||
69 | struct resource *res; | ||
70 | }; | ||
71 | |||
72 | static int rionet_check = 0; | ||
73 | static 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 | */ | ||
81 | static 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 | |||
94 | static struct net_device_stats *rionet_stats(struct net_device *ndev) | ||
95 | { | ||
96 | struct rionet_private *rnet = ndev->priv; | ||
97 | return &rnet->stats; | ||
98 | } | ||
99 | |||
100 | static 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 | |||
140 | static 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 | |||
159 | static 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 | |||
183 | static 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 | |||
221 | static 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 | |||
249 | static 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 | |||
265 | static 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 | |||
292 | static 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 | |||
359 | static 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 | |||
391 | static 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 | |||
405 | static 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 | |||
416 | static u32 rionet_get_msglevel(struct net_device *ndev) | ||
417 | { | ||
418 | struct rionet_private *rnet = ndev->priv; | ||
419 | |||
420 | return rnet->msg_enable; | ||
421 | } | ||
422 | |||
423 | static 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 | |||
430 | static 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 | |||
437 | static 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 | */ | ||
501 | static 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 | |||
552 | static struct rio_device_id rionet_id_table[] = { | ||
553 | {RIO_DEVICE(RIO_ANY_ID, RIO_ANY_ID)} | ||
554 | }; | ||
555 | |||
556 | static struct rio_driver rionet_driver = { | ||
557 | .name = "rionet", | ||
558 | .id_table = rionet_id_table, | ||
559 | .probe = rionet_probe, | ||
560 | .remove = rionet_remove, | ||
561 | }; | ||
562 | |||
563 | static int __init rionet_init(void) | ||
564 | { | ||
565 | return rio_register_driver(&rionet_driver); | ||
566 | } | ||
567 | |||
568 | static void __exit rionet_exit(void) | ||
569 | { | ||
570 | rio_unregister_driver(&rionet_driver); | ||
571 | } | ||
572 | |||
573 | module_init(rionet_init); | ||
574 | module_exit(rionet_exit); | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index c2e6484ef138..572f121b1f4e 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 | /* |
@@ -3096,6 +3097,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3096 | 3097 | ||
3097 | /* read the mac address */ | 3098 | /* read the mac address */ |
3098 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); | 3099 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); |
3100 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
3099 | 3101 | ||
3100 | /* device is off until link detection */ | 3102 | /* device is off until link detection */ |
3101 | netif_carrier_off(dev); | 3103 | 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 | ||
1624 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1626 | static 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 | ||
1834 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1836 | static 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 | ||
112 | int __init cycx_drv_init(void) | 112 | static 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 */ |
122 | void cycx_drv_cleanup(void) | 122 | static 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. */ |
187 | EXPORT_SYMBOL(cycx_inten); | 187 | static void cycx_inten(struct cycx_hw *hw) |
188 | void 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 | */ |
106 | int __init cycx_init(void) | 106 | static 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 | ||
449 | int state_check(u32 state, struct dscc4_dev_priv *dpriv, struct net_device *dev, | 449 | static 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 | ||
469 | void dscc4_tx_print(struct net_device *dev, struct dscc4_dev_priv *dpriv, | 469 | static 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 | ||
510 | inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, struct net_device *dev) | 511 | static 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 | */ |
1897 | struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) | 1896 | static 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 | */ |
77 | int fst_txq_low = FST_LOW_WATER_MARK; | 77 | static int fst_txq_low = FST_LOW_WATER_MARK; |
78 | int fst_txq_high = FST_HIGH_WATER_MARK; | 78 | static int fst_txq_high = FST_HIGH_WATER_MARK; |
79 | int fst_max_reads = 7; | 79 | static int fst_max_reads = 7; |
80 | int fst_excluded_cards = 0; | 80 | static int fst_excluded_cards = 0; |
81 | int fst_excluded_list[FST_MAX_CARDS]; | 81 | static int fst_excluded_list[FST_MAX_CARDS]; |
82 | 82 | ||
83 | module_param(fst_txq_low, int, 0); | 83 | module_param(fst_txq_low, int, 0); |
84 | module_param(fst_txq_high, int, 0); | 84 | module_param(fst_txq_high, int, 0); |
@@ -572,13 +572,13 @@ static void do_bottom_half_rx(struct fst_card_info *card); | |||
572 | static void fst_process_tx_work_q(unsigned long work_q); | 572 | static void fst_process_tx_work_q(unsigned long work_q); |
573 | static void fst_process_int_work_q(unsigned long work_q); | 573 | static void fst_process_int_work_q(unsigned long work_q); |
574 | 574 | ||
575 | DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); | 575 | static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); |
576 | DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); | 576 | static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); |
577 | 577 | ||
578 | struct fst_card_info *fst_card_array[FST_MAX_CARDS]; | 578 | static struct fst_card_info *fst_card_array[FST_MAX_CARDS]; |
579 | spinlock_t fst_work_q_lock; | 579 | static spinlock_t fst_work_q_lock; |
580 | u64 fst_work_txq; | 580 | static u64 fst_work_txq; |
581 | u64 fst_work_intq; | 581 | static u64 fst_work_intq; |
582 | 582 | ||
583 | static void | 583 | static void |
584 | fst_q_work_item(u64 * queue, int card_index) | 584 | fst_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 | */ |
1501 | irqreturn_t | 1500 | static irqreturn_t |
1502 | fst_intr(int irq, void *dev_id, struct pt_regs *regs) | 1501 | fst_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 | ||
333 | int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 333 | static 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 | */ |
11 | void 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 |
13 | void 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 |
51 | u_int32_t lmcEventLogIndex = 0; | 51 | u_int32_t lmcEventLogIndex = 0; |
52 | u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS]; | 52 | u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS]; |
53 | #endif | ||
54 | 53 | ||
55 | void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3) | 54 | void 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 | ||
67 | void lmc_trace(struct net_device *dev, char *msg){ | 65 | void 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 | */ | ||
53 | char *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 | */ |
61 | static void lmc_set_protocol (lmc_softc_t * const, lmc_ctl_t *); | 53 | static 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 */ |
475 | int dma_buf_write(pc300_t *, int, ucchar *, int); | ||
476 | int dma_buf_read(pc300_t *, int, struct sk_buff *); | ||
477 | void tx_dma_start(pc300_t *, int); | 475 | void tx_dma_start(pc300_t *, int); |
478 | void rx_dma_start(pc300_t *, int); | ||
479 | void tx_dma_stop(pc300_t *, int); | ||
480 | void rx_dma_stop(pc300_t *, int); | ||
481 | int cpc_queue_xmit(struct sk_buff *, struct net_device *); | ||
482 | void cpc_net_rx(struct net_device *); | ||
483 | void cpc_sca_status(pc300_t *, int); | ||
484 | int cpc_change_mtu(struct net_device *, int); | ||
485 | int cpc_ioctl(struct net_device *, struct ifreq *, int); | ||
486 | int ch_config(pc300dev_t *); | ||
487 | int rx_config(pc300dev_t *); | ||
488 | int tx_config(pc300dev_t *); | ||
489 | void cpc_opench(pc300dev_t *); | ||
490 | void cpc_closech(pc300dev_t *); | ||
491 | int cpc_open(struct net_device *dev); | 476 | int cpc_open(struct net_device *dev); |
492 | int cpc_close(struct net_device *dev); | ||
493 | int cpc_set_media(hdlc_device *, int); | 477 | int 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 *); | |||
291 | static void plx_init(pc300_t *); | 291 | static void plx_init(pc300_t *); |
292 | static void cpc_trace(struct net_device *, struct sk_buff *, char); | 292 | static void cpc_trace(struct net_device *, struct sk_buff *, char); |
293 | static int cpc_attach(struct net_device *, unsigned short, unsigned short); | 293 | static int cpc_attach(struct net_device *, unsigned short, unsigned short); |
294 | static int cpc_close(struct net_device *dev); | ||
294 | 295 | ||
295 | #ifdef CONFIG_PC300_MLPPP | 296 | #ifdef CONFIG_PC300_MLPPP |
296 | void cpc_tty_init(pc300dev_t * dev); | 297 | void 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 | ||
440 | int dma_get_rx_frame_size(pc300_t * card, int ch) | 441 | static 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 | */ |
465 | int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) | 466 | static 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 | */ |
506 | int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb) | 507 | static 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 | ||
563 | void tx_dma_stop(pc300_t * card, int ch) | 564 | static 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 | ||
574 | void rx_dma_stop(pc300_t * card, int ch) | 575 | static 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 | ||
585 | void rx_dma_start(pc300_t * card, int ch) | 586 | static 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 | /*************************/ |
610 | void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) | 611 | static 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 | ||
625 | void falc_intr_enable(pc300_t * card, int ch) | 626 | static 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 | ||
675 | void falc_open_timeslot(pc300_t * card, int ch, int timeslot) | 676 | static 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 | ||
691 | void falc_close_timeslot(pc300_t * card, int ch, int timeslot) | 692 | static 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 | ||
707 | void falc_close_all_timeslots(pc300_t * card, int ch) | 708 | static 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 | ||
729 | void falc_open_all_timeslots(pc300_t * card, int ch) | 730 | static 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 | ||
761 | void falc_init_timeslot(pc300_t * card, int ch) | 762 | static 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 | ||
779 | void falc_enable_comm(pc300_t * card, int ch) | 780 | static 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 | ||
795 | void falc_disable_comm(pc300_t * card, int ch) | 796 | static 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 | ||
809 | void falc_init_t1(pc300_t * card, int ch) | 810 | static 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 | ||
978 | void falc_init_e1(pc300_t * card, int ch) | 979 | static 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 | ||
1158 | void falc_init_hdlc(pc300_t * card, int ch) | 1159 | static 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 | ||
1184 | void te_config(pc300_t * card, int ch) | 1185 | static 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 | ||
1244 | void falc_check_status(pc300_t * card, int ch, unsigned char frs0) | 1245 | static 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 | ||
1400 | void falc_update_stats(pc300_t * card, int ch) | 1401 | static 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 | */ |
1453 | void falc_remote_loop(pc300_t * card, int ch, int loop_on) | 1454 | static 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 | */ |
1498 | void falc_local_loop(pc300_t * card, int ch, int loop_on) | 1499 | static 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 | */ |
1525 | void falc_payload_loop(pc300_t * card, int ch, int loop_on) | 1526 | static 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 | */ |
1579 | void turn_off_xlu(pc300_t * card, int ch) | 1580 | static 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 | */ |
1600 | void turn_off_xld(pc300_t * card, int ch) | 1601 | static 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 | */ |
1622 | void falc_generate_loop_up_code(pc300_t * card, int ch) | 1623 | static 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 | */ |
1655 | void falc_generate_loop_down_code(pc300_t * card, int ch) | 1656 | static 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 | */ |
1685 | void falc_pattern_test(pc300_t * card, int ch, unsigned int activate) | 1686 | static 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 | */ |
1732 | ucshort falc_pattern_test_error(pc300_t * card, int ch) | 1733 | static 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 | ||
1772 | void cpc_tx_timeout(struct net_device *dev) | 1773 | static 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 | ||
1800 | int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | 1801 | static 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 | ||
1883 | void cpc_net_rx(struct net_device *dev) | 1884 | static 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 | ||
2406 | void cpc_sca_status(pc300_t * card, int ch) | 2407 | static 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 | ||
2498 | void cpc_falc_status(pc300_t * card, int ch) | 2499 | static 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 | ||
2526 | int cpc_change_mtu(struct net_device *dev, int new_mtu) | 2527 | static 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 | ||
2534 | int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 2535 | static 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 | ||
2859 | int ch_config(pc300dev_t * d) | 2860 | static 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 | ||
3007 | int rx_config(pc300dev_t * d) | 3008 | static 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 | ||
3038 | int tx_config(pc300dev_t * d) | 3039 | static 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 | ||
3101 | void cpc_opench(pc300dev_t * d) | 3102 | static 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 | ||
3119 | void cpc_closech(pc300dev_t * d) | 3120 | static 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 | ||
3176 | int cpc_close(struct net_device *dev) | 3177 | static 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 { | |||
112 | static struct tty_driver serial_drv; | 112 | static struct tty_driver serial_drv; |
113 | 113 | ||
114 | /* local variables */ | 114 | /* local variables */ |
115 | st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; | 115 | static st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; |
116 | 116 | ||
117 | int cpc_tty_cnt=0; /* number of intrfaces configured with MLPPP */ | 117 | static int cpc_tty_cnt = 0; /* number of intrfaces configured with MLPPP */ |
118 | int cpc_tty_unreg_flag = 0; | 118 | static int cpc_tty_unreg_flag = 0; |
119 | 119 | ||
120 | /* TTY functions prototype */ | 120 | /* TTY functions prototype */ |
121 | static int cpc_tty_open(struct tty_struct *tty, struct file *flip); | 121 | static 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); | |||
132 | static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); | 132 | static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); |
133 | static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); | 133 | static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); |
134 | 134 | ||
135 | int pc300_tiocmset(struct tty_struct *, struct file *, | 135 | static int pc300_tiocmset(struct tty_struct *, struct file *, |
136 | unsigned int, unsigned int); | 136 | unsigned int, unsigned int); |
137 | int pc300_tiocmget(struct tty_struct *, struct file *); | 137 | static int pc300_tiocmget(struct tty_struct *, struct file *); |
138 | 138 | ||
139 | /* functions called by PC300 driver */ | 139 | /* functions called by PC300 driver */ |
140 | void cpc_tty_init(pc300dev_t *dev); | 140 | void 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 | ||
541 | int pc300_tiocmset(struct tty_struct *tty, struct file *file, | 541 | static 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 | ||
568 | int pc300_tiocmget(struct tty_struct *tty, struct file *file) | 568 | static 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 | ||
185 | void sdla_stop(struct net_device *dev) | 185 | static 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 | ||
212 | void sdla_start(struct net_device *dev) | 212 | static 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 | ||
250 | int sdla_z80_poll(struct net_device *dev, int z80_addr, int jiffs, char resp1, char resp2) | 250 | static 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 | ||
506 | static int sdla_reconfig(struct net_device *dev); | 506 | static int sdla_reconfig(struct net_device *dev); |
507 | 507 | ||
508 | int sdla_activate(struct net_device *slave, struct net_device *master) | 508 | static 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 | ||
530 | int sdla_deactivate(struct net_device *slave, struct net_device *master) | 530 | static 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 | ||
552 | int sdla_assoc(struct net_device *slave, struct net_device *master) | 552 | static 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 | ||
588 | int sdla_deassoc(struct net_device *slave, struct net_device *master) | 588 | static 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 | ||
616 | int sdla_dlci_conf(struct net_device *slave, struct net_device *master, int get) | 616 | static 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 | ||
1327 | int sdla_change_mtu(struct net_device *dev, int new_mtu) | 1327 | static 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 | ||
1340 | int sdla_set_config(struct net_device *dev, struct ifmap *map) | 1340 | static 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 | ||
645 | EXPORT_SYMBOL(sdla_inten); | 645 | static int sdla_inten (sdlahw_t* hw) |
646 | |||
647 | int 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 | ||
701 | EXPORT_SYMBOL(sdla_intde); | 699 | #if 0 |
702 | |||
703 | int sdla_intde (sdlahw_t* hw) | 700 | int 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 | ||
756 | EXPORT_SYMBOL(sdla_intack); | 754 | static int sdla_intack (sdlahw_t* hw) |
757 | |||
758 | int 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 | ||
830 | EXPORT_SYMBOL(sdla_intr); | 826 | #if 0 |
831 | |||
832 | int sdla_intr (sdlahw_t* hw) | 827 | int 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 a6d3b55013a5..2d1bba06a085 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 | ||
224 | void sppp_input (struct net_device *dev, struct sk_buff *skb) | 224 | static 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 | ||
358 | EXPORT_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 | ||
993 | int sppp_change_mtu(struct net_device *dev, int new_mtu) | 991 | static 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 | ||
1001 | EXPORT_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 | ||
1459 | struct packet_type sppp_packet_type = { | 1455 | static 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/airo.c b/drivers/net/wireless/airo.c index 06998c2240d9..746456c34df8 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -1046,7 +1046,6 @@ static WifiCtlHdr wifictlhdr8023 = { | |||
1046 | } | 1046 | } |
1047 | }; | 1047 | }; |
1048 | 1048 | ||
1049 | #ifdef WIRELESS_EXT | ||
1050 | // Frequency list (map channels to frequencies) | 1049 | // Frequency list (map channels to frequencies) |
1051 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | 1050 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, |
1052 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | 1051 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; |
@@ -1067,7 +1066,6 @@ typedef struct wep_key_t { | |||
1067 | 1066 | ||
1068 | /* List of Wireless Handlers (new API) */ | 1067 | /* List of Wireless Handlers (new API) */ |
1069 | static const struct iw_handler_def airo_handler_def; | 1068 | static const struct iw_handler_def airo_handler_def; |
1070 | #endif /* WIRELESS_EXT */ | ||
1071 | 1069 | ||
1072 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; | 1070 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; |
1073 | 1071 | ||
@@ -1110,10 +1108,8 @@ static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs | |||
1110 | static int airo_thread(void *data); | 1108 | static int airo_thread(void *data); |
1111 | static void timer_func( struct net_device *dev ); | 1109 | static void timer_func( struct net_device *dev ); |
1112 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 1110 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
1113 | #ifdef WIRELESS_EXT | ||
1114 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); | 1111 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); |
1115 | static void airo_read_wireless_stats (struct airo_info *local); | 1112 | static void airo_read_wireless_stats (struct airo_info *local); |
1116 | #endif /* WIRELESS_EXT */ | ||
1117 | #ifdef CISCO_EXT | 1113 | #ifdef CISCO_EXT |
1118 | static int readrids(struct net_device *dev, aironet_ioctl *comp); | 1114 | static int readrids(struct net_device *dev, aironet_ioctl *comp); |
1119 | static int writerids(struct net_device *dev, aironet_ioctl *comp); | 1115 | static int writerids(struct net_device *dev, aironet_ioctl *comp); |
@@ -1187,12 +1183,10 @@ struct airo_info { | |||
1187 | int fid; | 1183 | int fid; |
1188 | } xmit, xmit11; | 1184 | } xmit, xmit11; |
1189 | struct net_device *wifidev; | 1185 | struct net_device *wifidev; |
1190 | #ifdef WIRELESS_EXT | ||
1191 | struct iw_statistics wstats; // wireless stats | 1186 | struct iw_statistics wstats; // wireless stats |
1192 | unsigned long scan_timestamp; /* Time started to scan */ | 1187 | unsigned long scan_timestamp; /* Time started to scan */ |
1193 | struct iw_spy_data spy_data; | 1188 | struct iw_spy_data spy_data; |
1194 | struct iw_public_data wireless_data; | 1189 | struct iw_public_data wireless_data; |
1195 | #endif /* WIRELESS_EXT */ | ||
1196 | #ifdef MICSUPPORT | 1190 | #ifdef MICSUPPORT |
1197 | /* MIC stuff */ | 1191 | /* MIC stuff */ |
1198 | struct crypto_tfm *tfm; | 1192 | struct crypto_tfm *tfm; |
@@ -2527,7 +2521,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2527 | unsigned long mem_start, mem_len, aux_start, aux_len; | 2521 | unsigned long mem_start, mem_len, aux_start, aux_len; |
2528 | int rc = -1; | 2522 | int rc = -1; |
2529 | int i; | 2523 | int i; |
2530 | unsigned char *busaddroff,*vpackoff; | 2524 | dma_addr_t busaddroff; |
2525 | unsigned char *vpackoff; | ||
2531 | unsigned char __iomem *pciaddroff; | 2526 | unsigned char __iomem *pciaddroff; |
2532 | 2527 | ||
2533 | mem_start = pci_resource_start(pci, 1); | 2528 | mem_start = pci_resource_start(pci, 1); |
@@ -2570,7 +2565,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2570 | /* | 2565 | /* |
2571 | * Setup descriptor RX, TX, CONFIG | 2566 | * Setup descriptor RX, TX, CONFIG |
2572 | */ | 2567 | */ |
2573 | busaddroff = (unsigned char *)ai->shared_dma; | 2568 | busaddroff = ai->shared_dma; |
2574 | pciaddroff = ai->pciaux + AUX_OFFSET; | 2569 | pciaddroff = ai->pciaux + AUX_OFFSET; |
2575 | vpackoff = ai->shared; | 2570 | vpackoff = ai->shared; |
2576 | 2571 | ||
@@ -2579,7 +2574,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2579 | ai->rxfids[i].pending = 0; | 2574 | ai->rxfids[i].pending = 0; |
2580 | ai->rxfids[i].card_ram_off = pciaddroff; | 2575 | ai->rxfids[i].card_ram_off = pciaddroff; |
2581 | ai->rxfids[i].virtual_host_addr = vpackoff; | 2576 | ai->rxfids[i].virtual_host_addr = vpackoff; |
2582 | ai->rxfids[i].rx_desc.host_addr = (dma_addr_t) busaddroff; | 2577 | ai->rxfids[i].rx_desc.host_addr = busaddroff; |
2583 | ai->rxfids[i].rx_desc.valid = 1; | 2578 | ai->rxfids[i].rx_desc.valid = 1; |
2584 | ai->rxfids[i].rx_desc.len = PKTSIZE; | 2579 | ai->rxfids[i].rx_desc.len = PKTSIZE; |
2585 | ai->rxfids[i].rx_desc.rdy = 0; | 2580 | ai->rxfids[i].rx_desc.rdy = 0; |
@@ -2594,7 +2589,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2594 | ai->txfids[i].card_ram_off = pciaddroff; | 2589 | ai->txfids[i].card_ram_off = pciaddroff; |
2595 | ai->txfids[i].virtual_host_addr = vpackoff; | 2590 | ai->txfids[i].virtual_host_addr = vpackoff; |
2596 | ai->txfids[i].tx_desc.valid = 1; | 2591 | ai->txfids[i].tx_desc.valid = 1; |
2597 | ai->txfids[i].tx_desc.host_addr = (dma_addr_t) busaddroff; | 2592 | ai->txfids[i].tx_desc.host_addr = busaddroff; |
2598 | memcpy(ai->txfids[i].virtual_host_addr, | 2593 | memcpy(ai->txfids[i].virtual_host_addr, |
2599 | &wifictlhdr8023, sizeof(wifictlhdr8023)); | 2594 | &wifictlhdr8023, sizeof(wifictlhdr8023)); |
2600 | 2595 | ||
@@ -2607,8 +2602,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2607 | /* Rid descriptor setup */ | 2602 | /* Rid descriptor setup */ |
2608 | ai->config_desc.card_ram_off = pciaddroff; | 2603 | ai->config_desc.card_ram_off = pciaddroff; |
2609 | ai->config_desc.virtual_host_addr = vpackoff; | 2604 | ai->config_desc.virtual_host_addr = vpackoff; |
2610 | ai->config_desc.rid_desc.host_addr = (dma_addr_t) busaddroff; | 2605 | ai->config_desc.rid_desc.host_addr = busaddroff; |
2611 | ai->ridbus = (dma_addr_t)busaddroff; | 2606 | ai->ridbus = busaddroff; |
2612 | ai->config_desc.rid_desc.rid = 0; | 2607 | ai->config_desc.rid_desc.rid = 0; |
2613 | ai->config_desc.rid_desc.len = RIDSIZE; | 2608 | ai->config_desc.rid_desc.len = RIDSIZE; |
2614 | ai->config_desc.rid_desc.valid = 1; | 2609 | ai->config_desc.rid_desc.valid = 1; |
@@ -2647,9 +2642,7 @@ static void wifi_setup(struct net_device *dev) | |||
2647 | dev->get_stats = &airo_get_stats; | 2642 | dev->get_stats = &airo_get_stats; |
2648 | dev->set_mac_address = &airo_set_mac_address; | 2643 | dev->set_mac_address = &airo_set_mac_address; |
2649 | dev->do_ioctl = &airo_ioctl; | 2644 | dev->do_ioctl = &airo_ioctl; |
2650 | #ifdef WIRELESS_EXT | ||
2651 | dev->wireless_handlers = &airo_handler_def; | 2645 | dev->wireless_handlers = &airo_handler_def; |
2652 | #endif /* WIRELESS_EXT */ | ||
2653 | dev->change_mtu = &airo_change_mtu; | 2646 | dev->change_mtu = &airo_change_mtu; |
2654 | dev->open = &airo_open; | 2647 | dev->open = &airo_open; |
2655 | dev->stop = &airo_close; | 2648 | dev->stop = &airo_close; |
@@ -2675,9 +2668,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, | |||
2675 | dev->priv = ethdev->priv; | 2668 | dev->priv = ethdev->priv; |
2676 | dev->irq = ethdev->irq; | 2669 | dev->irq = ethdev->irq; |
2677 | dev->base_addr = ethdev->base_addr; | 2670 | dev->base_addr = ethdev->base_addr; |
2678 | #ifdef WIRELESS_EXT | ||
2679 | dev->wireless_data = ethdev->wireless_data; | 2671 | dev->wireless_data = ethdev->wireless_data; |
2680 | #endif /* WIRELESS_EXT */ | ||
2681 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); | 2672 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); |
2682 | err = register_netdev(dev); | 2673 | err = register_netdev(dev); |
2683 | if (err<0) { | 2674 | if (err<0) { |
@@ -2755,11 +2746,9 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2755 | dev->set_multicast_list = &airo_set_multicast_list; | 2746 | dev->set_multicast_list = &airo_set_multicast_list; |
2756 | dev->set_mac_address = &airo_set_mac_address; | 2747 | dev->set_mac_address = &airo_set_mac_address; |
2757 | dev->do_ioctl = &airo_ioctl; | 2748 | dev->do_ioctl = &airo_ioctl; |
2758 | #ifdef WIRELESS_EXT | ||
2759 | dev->wireless_handlers = &airo_handler_def; | 2749 | dev->wireless_handlers = &airo_handler_def; |
2760 | ai->wireless_data.spy_data = &ai->spy_data; | 2750 | ai->wireless_data.spy_data = &ai->spy_data; |
2761 | dev->wireless_data = &ai->wireless_data; | 2751 | dev->wireless_data = &ai->wireless_data; |
2762 | #endif /* WIRELESS_EXT */ | ||
2763 | dev->change_mtu = &airo_change_mtu; | 2752 | dev->change_mtu = &airo_change_mtu; |
2764 | dev->open = &airo_open; | 2753 | dev->open = &airo_open; |
2765 | dev->stop = &airo_close; | 2754 | dev->stop = &airo_close; |
@@ -5598,7 +5587,6 @@ static void __exit airo_cleanup_module( void ) | |||
5598 | remove_proc_entry("aironet", proc_root_driver); | 5587 | remove_proc_entry("aironet", proc_root_driver); |
5599 | } | 5588 | } |
5600 | 5589 | ||
5601 | #ifdef WIRELESS_EXT | ||
5602 | /* | 5590 | /* |
5603 | * Initial Wireless Extension code for Aironet driver by : | 5591 | * Initial Wireless Extension code for Aironet driver by : |
5604 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 | 5592 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 |
@@ -7107,8 +7095,6 @@ static const struct iw_handler_def airo_handler_def = | |||
7107 | .get_wireless_stats = airo_get_wireless_stats, | 7095 | .get_wireless_stats = airo_get_wireless_stats, |
7108 | }; | 7096 | }; |
7109 | 7097 | ||
7110 | #endif /* WIRELESS_EXT */ | ||
7111 | |||
7112 | /* | 7098 | /* |
7113 | * This defines the configuration part of the Wireless Extensions | 7099 | * This defines the configuration part of the Wireless Extensions |
7114 | * Note : irq and spinlock protection will occur in the subroutines | 7100 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7187,7 +7173,6 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
7187 | return rc; | 7173 | return rc; |
7188 | } | 7174 | } |
7189 | 7175 | ||
7190 | #ifdef WIRELESS_EXT | ||
7191 | /* | 7176 | /* |
7192 | * Get the Wireless stats out of the driver | 7177 | * Get the Wireless stats out of the driver |
7193 | * Note : irq and spinlock protection will occur in the subroutines | 7178 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7260,7 +7245,6 @@ static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) | |||
7260 | 7245 | ||
7261 | return &local->wstats; | 7246 | return &local->wstats; |
7262 | } | 7247 | } |
7263 | #endif /* WIRELESS_EXT */ | ||
7264 | 7248 | ||
7265 | #ifdef CISCO_EXT | 7249 | #ifdef CISCO_EXT |
7266 | /* | 7250 | /* |
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c index 9d496703c465..7b321f7cf358 100644 --- a/drivers/net/wireless/airport.c +++ b/drivers/net/wireless/airport.c | |||
@@ -15,28 +15,11 @@ | |||
15 | #define PFX DRIVER_NAME ": " | 15 | #define PFX DRIVER_NAME ": " |
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | |||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/ptrace.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/string.h> | ||
25 | #include <linux/timer.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/netdevice.h> | ||
28 | #include <linux/if_arp.h> | ||
29 | #include <linux/etherdevice.h> | ||
30 | #include <linux/wireless.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <asm/system.h> | ||
34 | #include <asm/current.h> | ||
35 | #include <asm/prom.h> | ||
36 | #include <asm/machdep.h> | ||
37 | #include <asm/pmac_feature.h> | 22 | #include <asm/pmac_feature.h> |
38 | #include <asm/irq.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | 23 | ||
41 | #include "orinoco.h" | 24 | #include "orinoco.h" |
42 | 25 | ||
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); | |||
618 | static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); | 618 | static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); |
619 | static void atmel_command_irq(struct atmel_private *priv); | 619 | static void atmel_command_irq(struct atmel_private *priv); |
620 | static int atmel_validate_channel(struct atmel_private *priv, int channel); | 620 | static int atmel_validate_channel(struct atmel_private *priv, int channel); |
621 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 621 | static 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); |
623 | static void atmel_management_timer(u_long a); | 623 | static void atmel_management_timer(u_long a); |
624 | static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size); | 624 | static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size); |
625 | static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size); | 625 | static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size); |
626 | static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 626 | static 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 | ||
629 | static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index); | 629 | static 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 | |||
827 | static int start_tx (struct sk_buff *skb, struct net_device *dev) | 827 | static 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 | ||
904 | static void atmel_transmit_management_frame(struct atmel_private *priv, | 904 | static 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 | ||
920 | static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, | 920 | static 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 | ||
993 | static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, | 993 | static 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 | |||
1082 | static void rx_done_irq(struct atmel_private *priv) | 1082 | static 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 | ||
2651 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2651 | static 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 | ||
2741 | static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr *header) | 2741 | static 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 | ||
2791 | static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr *header, | 2791 | static 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. */ |
3075 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 3075 | static 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/hermes.c b/drivers/net/wireless/hermes.c index 21c3d0d227e6..eba0d9d2b7c5 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c | |||
@@ -39,17 +39,10 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/config.h> | 41 | #include <linux/config.h> |
42 | |||
43 | #include <linux/module.h> | 42 | #include <linux/module.h> |
44 | #include <linux/types.h> | ||
45 | #include <linux/threads.h> | ||
46 | #include <linux/smp.h> | ||
47 | #include <asm/io.h> | ||
48 | #include <linux/delay.h> | ||
49 | #include <linux/init.h> | ||
50 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
51 | #include <linux/net.h> | 44 | #include <linux/init.h> |
52 | #include <asm/errno.h> | 45 | #include <linux/delay.h> |
53 | 46 | ||
54 | #include "hermes.h" | 47 | #include "hermes.h" |
55 | 48 | ||
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h index 8c9e874c9118..ad28e3294360 100644 --- a/drivers/net/wireless/hermes.h +++ b/drivers/net/wireless/hermes.h | |||
@@ -30,9 +30,8 @@ | |||
30 | * access to the hermes_t structure, and to the hardware | 30 | * access to the hermes_t structure, and to the hardware |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/delay.h> | ||
34 | #include <linux/if_ether.h> | 33 | #include <linux/if_ether.h> |
35 | #include <asm/byteorder.h> | 34 | #include <asm/io.h> |
36 | 35 | ||
37 | /* | 36 | /* |
38 | * Limits and constants | 37 | * Limits and constants |
@@ -192,13 +191,13 @@ | |||
192 | #define HERMES_RXSTAT_WMP (0x6000) /* Wavelan-II Management Protocol frame */ | 191 | #define HERMES_RXSTAT_WMP (0x6000) /* Wavelan-II Management Protocol frame */ |
193 | 192 | ||
194 | struct hermes_tx_descriptor { | 193 | struct hermes_tx_descriptor { |
195 | u16 status; | 194 | __le16 status; |
196 | u16 reserved1; | 195 | __le16 reserved1; |
197 | u16 reserved2; | 196 | __le16 reserved2; |
198 | u32 sw_support; | 197 | __le32 sw_support; |
199 | u8 retry_count; | 198 | u8 retry_count; |
200 | u8 tx_rate; | 199 | u8 tx_rate; |
201 | u16 tx_control; | 200 | __le16 tx_control; |
202 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
203 | 202 | ||
204 | #define HERMES_TXSTAT_RETRYERR (0x0001) | 203 | #define HERMES_TXSTAT_RETRYERR (0x0001) |
@@ -222,60 +221,60 @@ struct hermes_tx_descriptor { | |||
222 | #define HERMES_INQ_SEC_STAT_AGERE (0xF202) | 221 | #define HERMES_INQ_SEC_STAT_AGERE (0xF202) |
223 | 222 | ||
224 | struct hermes_tallies_frame { | 223 | struct hermes_tallies_frame { |
225 | u16 TxUnicastFrames; | 224 | __le16 TxUnicastFrames; |
226 | u16 TxMulticastFrames; | 225 | __le16 TxMulticastFrames; |
227 | u16 TxFragments; | 226 | __le16 TxFragments; |
228 | u16 TxUnicastOctets; | 227 | __le16 TxUnicastOctets; |
229 | u16 TxMulticastOctets; | 228 | __le16 TxMulticastOctets; |
230 | u16 TxDeferredTransmissions; | 229 | __le16 TxDeferredTransmissions; |
231 | u16 TxSingleRetryFrames; | 230 | __le16 TxSingleRetryFrames; |
232 | u16 TxMultipleRetryFrames; | 231 | __le16 TxMultipleRetryFrames; |
233 | u16 TxRetryLimitExceeded; | 232 | __le16 TxRetryLimitExceeded; |
234 | u16 TxDiscards; | 233 | __le16 TxDiscards; |
235 | u16 RxUnicastFrames; | 234 | __le16 RxUnicastFrames; |
236 | u16 RxMulticastFrames; | 235 | __le16 RxMulticastFrames; |
237 | u16 RxFragments; | 236 | __le16 RxFragments; |
238 | u16 RxUnicastOctets; | 237 | __le16 RxUnicastOctets; |
239 | u16 RxMulticastOctets; | 238 | __le16 RxMulticastOctets; |
240 | u16 RxFCSErrors; | 239 | __le16 RxFCSErrors; |
241 | u16 RxDiscards_NoBuffer; | 240 | __le16 RxDiscards_NoBuffer; |
242 | u16 TxDiscardsWrongSA; | 241 | __le16 TxDiscardsWrongSA; |
243 | u16 RxWEPUndecryptable; | 242 | __le16 RxWEPUndecryptable; |
244 | u16 RxMsgInMsgFragments; | 243 | __le16 RxMsgInMsgFragments; |
245 | u16 RxMsgInBadMsgFragments; | 244 | __le16 RxMsgInBadMsgFragments; |
246 | /* Those last are probably not available in very old firmwares */ | 245 | /* Those last are probably not available in very old firmwares */ |
247 | u16 RxDiscards_WEPICVError; | 246 | __le16 RxDiscards_WEPICVError; |
248 | u16 RxDiscards_WEPExcluded; | 247 | __le16 RxDiscards_WEPExcluded; |
249 | } __attribute__ ((packed)); | 248 | } __attribute__ ((packed)); |
250 | 249 | ||
251 | /* Grabbed from wlan-ng - Thanks Mark... - Jean II | 250 | /* Grabbed from wlan-ng - Thanks Mark... - Jean II |
252 | * This is the result of a scan inquiry command */ | 251 | * This is the result of a scan inquiry command */ |
253 | /* Structure describing info about an Access Point */ | 252 | /* Structure describing info about an Access Point */ |
254 | struct prism2_scan_apinfo { | 253 | struct prism2_scan_apinfo { |
255 | u16 channel; /* Channel where the AP sits */ | 254 | __le16 channel; /* Channel where the AP sits */ |
256 | u16 noise; /* Noise level */ | 255 | __le16 noise; /* Noise level */ |
257 | u16 level; /* Signal level */ | 256 | __le16 level; /* Signal level */ |
258 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 257 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
259 | u16 beacon_interv; /* Beacon interval */ | 258 | __le16 beacon_interv; /* Beacon interval */ |
260 | u16 capabilities; /* Capabilities */ | 259 | __le16 capabilities; /* Capabilities */ |
261 | u16 essid_len; /* ESSID length */ | 260 | __le16 essid_len; /* ESSID length */ |
262 | u8 essid[32]; /* ESSID of the network */ | 261 | u8 essid[32]; /* ESSID of the network */ |
263 | u8 rates[10]; /* Bit rate supported */ | 262 | u8 rates[10]; /* Bit rate supported */ |
264 | u16 proberesp_rate; /* Data rate of the response frame */ | 263 | __le16 proberesp_rate; /* Data rate of the response frame */ |
265 | u16 atim; /* ATIM window time, Kus (hostscan only) */ | 264 | __le16 atim; /* ATIM window time, Kus (hostscan only) */ |
266 | } __attribute__ ((packed)); | 265 | } __attribute__ ((packed)); |
267 | 266 | ||
268 | /* Same stuff for the Lucent/Agere card. | 267 | /* Same stuff for the Lucent/Agere card. |
269 | * Thanks to h1kari <h1kari AT dachb0den.com> - Jean II */ | 268 | * Thanks to h1kari <h1kari AT dachb0den.com> - Jean II */ |
270 | struct agere_scan_apinfo { | 269 | struct agere_scan_apinfo { |
271 | u16 channel; /* Channel where the AP sits */ | 270 | __le16 channel; /* Channel where the AP sits */ |
272 | u16 noise; /* Noise level */ | 271 | __le16 noise; /* Noise level */ |
273 | u16 level; /* Signal level */ | 272 | __le16 level; /* Signal level */ |
274 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 273 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
275 | u16 beacon_interv; /* Beacon interval */ | 274 | __le16 beacon_interv; /* Beacon interval */ |
276 | u16 capabilities; /* Capabilities */ | 275 | __le16 capabilities; /* Capabilities */ |
277 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ | 276 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ |
278 | u16 essid_len; /* ESSID length */ | 277 | __le16 essid_len; /* ESSID length */ |
279 | u8 essid[32]; /* ESSID of the network */ | 278 | u8 essid[32]; /* ESSID of the network */ |
280 | } __attribute__ ((packed)); | 279 | } __attribute__ ((packed)); |
281 | 280 | ||
@@ -283,16 +282,16 @@ struct agere_scan_apinfo { | |||
283 | struct symbol_scan_apinfo { | 282 | struct symbol_scan_apinfo { |
284 | u8 channel; /* Channel where the AP sits */ | 283 | u8 channel; /* Channel where the AP sits */ |
285 | u8 unknown1; /* 8 in 2.9x and 3.9x f/w, 0 otherwise */ | 284 | u8 unknown1; /* 8 in 2.9x and 3.9x f/w, 0 otherwise */ |
286 | u16 noise; /* Noise level */ | 285 | __le16 noise; /* Noise level */ |
287 | u16 level; /* Signal level */ | 286 | __le16 level; /* Signal level */ |
288 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 287 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
289 | u16 beacon_interv; /* Beacon interval */ | 288 | __le16 beacon_interv; /* Beacon interval */ |
290 | u16 capabilities; /* Capabilities */ | 289 | __le16 capabilities; /* Capabilities */ |
291 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ | 290 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ |
292 | u16 essid_len; /* ESSID length */ | 291 | __le16 essid_len; /* ESSID length */ |
293 | u8 essid[32]; /* ESSID of the network */ | 292 | u8 essid[32]; /* ESSID of the network */ |
294 | u16 rates[5]; /* Bit rate supported */ | 293 | __le16 rates[5]; /* Bit rate supported */ |
295 | u16 basic_rates; /* Basic rates bitmask */ | 294 | __le16 basic_rates; /* Basic rates bitmask */ |
296 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ | 295 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ |
297 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ | 296 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ |
298 | } __attribute__ ((packed)); | 297 | } __attribute__ ((packed)); |
@@ -312,7 +311,7 @@ union hermes_scan_info { | |||
312 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) | 311 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) |
313 | 312 | ||
314 | struct hermes_linkstatus { | 313 | struct hermes_linkstatus { |
315 | u16 linkstatus; /* Link status */ | 314 | __le16 linkstatus; /* Link status */ |
316 | } __attribute__ ((packed)); | 315 | } __attribute__ ((packed)); |
317 | 316 | ||
318 | struct hermes_response { | 317 | struct hermes_response { |
@@ -321,8 +320,8 @@ struct hermes_response { | |||
321 | 320 | ||
322 | /* "ID" structure - used for ESSID and station nickname */ | 321 | /* "ID" structure - used for ESSID and station nickname */ |
323 | struct hermes_idstring { | 322 | struct hermes_idstring { |
324 | u16 len; | 323 | __le16 len; |
325 | u16 val[16]; | 324 | __le16 val[16]; |
326 | } __attribute__ ((packed)); | 325 | } __attribute__ ((packed)); |
327 | 326 | ||
328 | struct hermes_multicast { | 327 | struct hermes_multicast { |
@@ -447,7 +446,7 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count | |||
447 | 446 | ||
448 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | 447 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) |
449 | { | 448 | { |
450 | u16 rec; | 449 | __le16 rec; |
451 | int err; | 450 | int err; |
452 | 451 | ||
453 | err = HERMES_READ_RECORD(hw, bap, rid, &rec); | 452 | err = HERMES_READ_RECORD(hw, bap, rid, &rec); |
@@ -457,7 +456,7 @@ static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | |||
457 | 456 | ||
458 | static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) | 457 | static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) |
459 | { | 458 | { |
460 | u16 rec = cpu_to_le16(word); | 459 | __le16 rec = cpu_to_le16(word); |
461 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); | 460 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); |
462 | } | 461 | } |
463 | 462 | ||
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c index e7f5821b4942..6a96cd9f2685 100644 --- a/drivers/net/wireless/hostap/hostap.c +++ b/drivers/net/wireless/hostap/hostap.c | |||
@@ -716,9 +716,6 @@ static int prism2_close(struct net_device *dev) | |||
716 | hostap_deauth_all_stas(dev, local->ap, 1); | 716 | hostap_deauth_all_stas(dev, local->ap, 1); |
717 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 717 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
718 | 718 | ||
719 | if (local->func->dev_close && local->func->dev_close(local)) | ||
720 | return 0; | ||
721 | |||
722 | if (dev == local->dev) { | 719 | if (dev == local->dev) { |
723 | local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); | 720 | local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); |
724 | } | 721 | } |
@@ -766,9 +763,6 @@ static int prism2_open(struct net_device *dev) | |||
766 | local->hw_downloading) | 763 | local->hw_downloading) |
767 | return -ENODEV; | 764 | return -ENODEV; |
768 | 765 | ||
769 | if (local->func->dev_open && local->func->dev_open(local)) | ||
770 | return 1; | ||
771 | |||
772 | if (!try_module_get(local->hw_module)) | 766 | if (!try_module_get(local->hw_module)) |
773 | return -ENODEV; | 767 | return -ENODEV; |
774 | local->num_dev_open++; | 768 | local->num_dev_open++; |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index b0501243b175..ffac50899454 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -6,10 +6,10 @@ | |||
6 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | 6 | void 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) */ |
217 | static struct sk_buff * | 217 | static struct sk_buff * |
218 | prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) | 218 | prism2_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) */ |
269 | static int prism2_frag_cache_invalidate(local_info_t *local, | 269 | static 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 | ||
522 | static inline int | 522 | static inline int |
523 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, | 523 | hostap_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 | |||
619 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, | 619 | hostap_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 | |||
658 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, | 658 | hostap_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) |
@@ -737,7 +737,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
737 | struct iw_quality wstats; | 737 | struct iw_quality wstats; |
738 | wstats.level = rx_stats->signal; | 738 | wstats.level = rx_stats->signal; |
739 | wstats.noise = rx_stats->noise; | 739 | wstats.noise = rx_stats->noise; |
740 | wstats.updated = 6; /* No qual value */ | 740 | wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED |
741 | | IW_QUAL_QUAL_INVALID | IW_QUAL_DBM; | ||
741 | /* Update spy records */ | 742 | /* Update spy records */ |
742 | wireless_spy_update(dev, hdr->addr2, &wstats); | 743 | wireless_spy_update(dev, hdr->addr2, &wstats); |
743 | } | 744 | } |
@@ -889,7 +890,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
889 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && | 890 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && |
890 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) | 891 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) |
891 | goto rx_dropped; | 892 | goto rx_dropped; |
892 | hdr = (struct ieee80211_hdr *) skb->data; | 893 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
893 | 894 | ||
894 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 895 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
895 | 896 | ||
@@ -941,7 +942,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
941 | /* this was the last fragment and the frame will be | 942 | /* this was the last fragment and the frame will be |
942 | * delivered, so remove skb from fragment cache */ | 943 | * delivered, so remove skb from fragment cache */ |
943 | skb = frag_skb; | 944 | skb = frag_skb; |
944 | hdr = (struct ieee80211_hdr *) skb->data; | 945 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
945 | prism2_frag_cache_invalidate(local, hdr); | 946 | prism2_frag_cache_invalidate(local, hdr); |
946 | } | 947 | } |
947 | 948 | ||
@@ -952,7 +953,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
952 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) | 953 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) |
953 | goto rx_dropped; | 954 | goto rx_dropped; |
954 | 955 | ||
955 | hdr = (struct ieee80211_hdr *) skb->data; | 956 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
956 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { | 957 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { |
957 | if (local->ieee_802_1x && | 958 | if (local->ieee_802_1x && |
958 | hostap_is_eapol_frame(local, skb)) { | 959 | 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 @@ | |||
1 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | 1 | void 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..9da94ab7f05f 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) | |||
757 | static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) | 757 | static 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. */ |
1786 | static void ap_handle_data_nullfunc(local_info_t *local, | 1786 | static 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. */ |
1803 | static void ap_handle_dropped_data(local_info_t *local, | 1803 | static 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. */ |
1862 | static void handle_pspoll(local_info_t *local, | 1862 | static 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) | |||
1979 | static void handle_beacon(local_info_t *local, struct sk_buff *skb, | 1979 | static 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, | |||
2289 | static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | 2289 | static 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( |
@@ -2349,7 +2349,7 @@ static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | |||
2349 | qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); | 2349 | qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); |
2350 | qual[count].updated = sta->last_rx_updated; | 2350 | qual[count].updated = sta->last_rx_updated; |
2351 | 2351 | ||
2352 | sta->last_rx_updated = 0; | 2352 | sta->last_rx_updated = IW_QUAL_DBM; |
2353 | 2353 | ||
2354 | count++; | 2354 | count++; |
2355 | if (count >= buf_size) | 2355 | if (count >= buf_size) |
@@ -2467,7 +2467,7 @@ static int prism2_ap_translate_scan(struct net_device *dev, char *buffer) | |||
2467 | } | 2467 | } |
2468 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 2468 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
2469 | 2469 | ||
2470 | sta->last_rx_updated = 0; | 2470 | sta->last_rx_updated = IW_QUAL_DBM; |
2471 | 2471 | ||
2472 | /* To be continued, we should make good use of IWEVCUSTOM */ | 2472 | /* To be continued, we should make good use of IWEVCUSTOM */ |
2473 | } | 2473 | } |
@@ -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) | |||
2821 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) | 2821 | void 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. */ |
2895 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) | 2895 | int 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) */ |
3060 | int hostap_handle_sta_crypto(local_info_t *local, | 3060 | int 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) */ |
3162 | int hostap_update_rx_stats(struct ap_data *ap, | 3162 | int 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; |
@@ -3174,7 +3174,7 @@ int hostap_update_rx_stats(struct ap_data *ap, | |||
3174 | sta->last_rx_silence = rx_stats->noise; | 3174 | sta->last_rx_silence = rx_stats->noise; |
3175 | sta->last_rx_signal = rx_stats->signal; | 3175 | sta->last_rx_signal = rx_stats->signal; |
3176 | sta->last_rx_rate = rx_stats->rate; | 3176 | sta->last_rx_rate = rx_stats->rate; |
3177 | sta->last_rx_updated = 7; | 3177 | sta->last_rx_updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
3178 | if (rx_stats->rate == 10) | 3178 | if (rx_stats->rate == 10) |
3179 | sta->rx_count[0]++; | 3179 | sta->rx_count[0]++; |
3180 | else if (rx_stats->rate == 20) | 3180 | else if (rx_stats->rate == 20) |
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 { | |||
233 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); | 233 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); |
234 | void hostap_handle_sta_release(void *ptr); | 234 | void hostap_handle_sta_release(void *ptr); |
235 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); | 235 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); |
236 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); | 236 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr); |
237 | typedef enum { | 237 | typedef 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); |
244 | int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, | 244 | int 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); |
247 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); | 247 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); |
248 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); | 248 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); |
249 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); | 249 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); |
250 | int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, | 250 | int 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); |
252 | void hostap_update_rates(local_info_t *local); | 252 | void hostap_update_rates(local_info_t *local); |
253 | void hostap_add_wds_links(local_info_t *local); | 253 | void hostap_add_wds_links(local_info_t *local); |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index faa83badf0a1..2643976a6677 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -492,42 +492,10 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | static int prism2_pccard_dev_open(local_info_t *local) | ||
496 | { | ||
497 | struct hostap_cs_priv *hw_priv = local->hw_priv; | ||
498 | hw_priv->link->open++; | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | |||
503 | static int prism2_pccard_dev_close(local_info_t *local) | ||
504 | { | ||
505 | struct hostap_cs_priv *hw_priv; | ||
506 | |||
507 | if (local == NULL || local->hw_priv == NULL) | ||
508 | return 1; | ||
509 | hw_priv = local->hw_priv; | ||
510 | if (hw_priv->link == NULL) | ||
511 | return 1; | ||
512 | |||
513 | if (!hw_priv->link->open) { | ||
514 | printk(KERN_WARNING "%s: prism2_pccard_dev_close(): " | ||
515 | "link not open?!\n", local->dev->name); | ||
516 | return 1; | ||
517 | } | ||
518 | |||
519 | hw_priv->link->open--; | ||
520 | |||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | |||
525 | static struct prism2_helper_functions prism2_pccard_funcs = | 495 | static struct prism2_helper_functions prism2_pccard_funcs = |
526 | { | 496 | { |
527 | .card_present = prism2_pccard_card_present, | 497 | .card_present = prism2_pccard_card_present, |
528 | .cor_sreset = prism2_pccard_cor_sreset, | 498 | .cor_sreset = prism2_pccard_cor_sreset, |
529 | .dev_open = prism2_pccard_dev_open, | ||
530 | .dev_close = prism2_pccard_dev_close, | ||
531 | .genesis_reset = prism2_pccard_genesis_reset, | 499 | .genesis_reset = prism2_pccard_genesis_reset, |
532 | .hw_type = HOSTAP_HW_PCCARD, | 500 | .hw_type = HOSTAP_HW_PCCARD, |
533 | }; | 501 | }; |
@@ -597,13 +565,14 @@ static void prism2_detach(dev_link_t *link) | |||
597 | *linkp = link->next; | 565 | *linkp = link->next; |
598 | /* release net devices */ | 566 | /* release net devices */ |
599 | if (link->priv) { | 567 | if (link->priv) { |
568 | struct hostap_cs_priv *hw_priv; | ||
600 | struct net_device *dev; | 569 | struct net_device *dev; |
601 | struct hostap_interface *iface; | 570 | struct hostap_interface *iface; |
602 | dev = link->priv; | 571 | dev = link->priv; |
603 | iface = netdev_priv(dev); | 572 | iface = netdev_priv(dev); |
604 | kfree(iface->local->hw_priv); | 573 | hw_priv = iface->local->hw_priv; |
605 | iface->local->hw_priv = NULL; | ||
606 | prism2_free_local_data(dev); | 574 | prism2_free_local_data(dev); |
575 | kfree(hw_priv); | ||
607 | } | 576 | } |
608 | kfree(link); | 577 | kfree(link); |
609 | } | 578 | } |
@@ -883,6 +852,13 @@ static int prism2_event(event_t event, int priority, | |||
883 | { | 852 | { |
884 | dev_link_t *link = args->client_data; | 853 | dev_link_t *link = args->client_data; |
885 | struct net_device *dev = (struct net_device *) link->priv; | 854 | struct net_device *dev = (struct net_device *) link->priv; |
855 | int dev_open = 0; | ||
856 | |||
857 | if (link->state & DEV_CONFIG) { | ||
858 | struct hostap_interface *iface = netdev_priv(dev); | ||
859 | if (iface && iface->local) | ||
860 | dev_open = iface->local->num_dev_open > 0; | ||
861 | } | ||
886 | 862 | ||
887 | switch (event) { | 863 | switch (event) { |
888 | case CS_EVENT_CARD_INSERTION: | 864 | case CS_EVENT_CARD_INSERTION: |
@@ -911,7 +887,7 @@ static int prism2_event(event_t event, int priority, | |||
911 | case CS_EVENT_RESET_PHYSICAL: | 887 | case CS_EVENT_RESET_PHYSICAL: |
912 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); | 888 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); |
913 | if (link->state & DEV_CONFIG) { | 889 | if (link->state & DEV_CONFIG) { |
914 | if (link->open) { | 890 | if (dev_open) { |
915 | netif_stop_queue(dev); | 891 | netif_stop_queue(dev); |
916 | netif_device_detach(dev); | 892 | netif_device_detach(dev); |
917 | } | 893 | } |
@@ -931,8 +907,8 @@ static int prism2_event(event_t event, int priority, | |||
931 | pcmcia_request_configuration(link->handle, | 907 | pcmcia_request_configuration(link->handle, |
932 | &link->conf); | 908 | &link->conf); |
933 | prism2_hw_shutdown(dev, 1); | 909 | prism2_hw_shutdown(dev, 1); |
934 | prism2_hw_config(dev, link->open ? 0 : 1); | 910 | prism2_hw_config(dev, dev_open ? 0 : 1); |
935 | if (link->open) { | 911 | if (dev_open) { |
936 | netif_device_attach(dev); | 912 | netif_device_attach(dev); |
937 | netif_start_queue(dev); | 913 | netif_start_queue(dev); |
938 | } | 914 | } |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index e533a663deda..59fc15572395 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -3322,6 +3322,18 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3322 | iface = netdev_priv(dev); | 3322 | iface = netdev_priv(dev); |
3323 | local = iface->local; | 3323 | local = iface->local; |
3324 | 3324 | ||
3325 | /* Unregister all netdevs before freeing local data. */ | ||
3326 | list_for_each_safe(ptr, n, &local->hostap_interfaces) { | ||
3327 | iface = list_entry(ptr, struct hostap_interface, list); | ||
3328 | if (iface->type == HOSTAP_INTERFACE_MASTER) { | ||
3329 | /* special handling for this interface below */ | ||
3330 | continue; | ||
3331 | } | ||
3332 | hostap_remove_interface(iface->dev, 0, 1); | ||
3333 | } | ||
3334 | |||
3335 | unregister_netdev(local->dev); | ||
3336 | |||
3325 | flush_scheduled_work(); | 3337 | flush_scheduled_work(); |
3326 | 3338 | ||
3327 | if (timer_pending(&local->crypt_deinit_timer)) | 3339 | if (timer_pending(&local->crypt_deinit_timer)) |
@@ -3382,15 +3394,6 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3382 | prism2_download_free_data(local->dl_sec); | 3394 | prism2_download_free_data(local->dl_sec); |
3383 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ | 3395 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ |
3384 | 3396 | ||
3385 | list_for_each_safe(ptr, n, &local->hostap_interfaces) { | ||
3386 | iface = list_entry(ptr, struct hostap_interface, list); | ||
3387 | if (iface->type == HOSTAP_INTERFACE_MASTER) { | ||
3388 | /* special handling for this interface below */ | ||
3389 | continue; | ||
3390 | } | ||
3391 | hostap_remove_interface(iface->dev, 0, 1); | ||
3392 | } | ||
3393 | |||
3394 | prism2_clear_set_tim_queue(local); | 3397 | prism2_clear_set_tim_queue(local); |
3395 | 3398 | ||
3396 | list_for_each_safe(ptr, n, &local->bss_list) { | 3399 | list_for_each_safe(ptr, n, &local->bss_list) { |
@@ -3403,7 +3406,6 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3403 | kfree(local->last_scan_results); | 3406 | kfree(local->last_scan_results); |
3404 | kfree(local->generic_elem); | 3407 | kfree(local->generic_elem); |
3405 | 3408 | ||
3406 | unregister_netdev(local->dev); | ||
3407 | free_netdev(local->dev); | 3409 | free_netdev(local->dev); |
3408 | } | 3410 | } |
3409 | 3411 | ||
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index e720369a3515..53f5246c40aa 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -50,7 +50,8 @@ static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) | |||
50 | #endif /* in_atomic */ | 50 | #endif /* in_atomic */ |
51 | 51 | ||
52 | if (update && prism2_update_comms_qual(dev) == 0) | 52 | if (update && prism2_update_comms_qual(dev) == 0) |
53 | wstats->qual.updated = 7; | 53 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | |
54 | IW_QUAL_DBM; | ||
54 | 55 | ||
55 | wstats->qual.qual = local->comms_qual; | 56 | wstats->qual.qual = local->comms_qual; |
56 | wstats->qual.level = local->avg_signal; | 57 | wstats->qual.level = local->avg_signal; |
@@ -59,7 +60,7 @@ static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) | |||
59 | wstats->qual.qual = 0; | 60 | wstats->qual.qual = 0; |
60 | wstats->qual.level = 0; | 61 | wstats->qual.level = 0; |
61 | wstats->qual.noise = 0; | 62 | wstats->qual.noise = 0; |
62 | wstats->qual.updated = 0; | 63 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
63 | } | 64 | } |
64 | 65 | ||
65 | return wstats; | 66 | return wstats; |
@@ -1827,13 +1828,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1827 | iwe.cmd = SIOCGIWAP; | 1828 | iwe.cmd = SIOCGIWAP; |
1828 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 1829 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
1829 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); | 1830 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); |
1830 | /* FIX: | ||
1831 | * I do not know how this is possible, but iwe_stream_add_event | ||
1832 | * seems to re-order memcpy execution so that len is set only | ||
1833 | * after copying.. Pre-setting len here "fixes" this, but real | ||
1834 | * problems should be solved (after which these iwe.len | ||
1835 | * settings could be removed from this function). */ | ||
1836 | iwe.len = IW_EV_ADDR_LEN; | ||
1837 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1831 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1838 | IW_EV_ADDR_LEN); | 1832 | IW_EV_ADDR_LEN); |
1839 | 1833 | ||
@@ -1843,7 +1837,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1843 | iwe.cmd = SIOCGIWESSID; | 1837 | iwe.cmd = SIOCGIWESSID; |
1844 | iwe.u.data.length = ssid_len; | 1838 | iwe.u.data.length = ssid_len; |
1845 | iwe.u.data.flags = 1; | 1839 | iwe.u.data.flags = 1; |
1846 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1847 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); | 1840 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); |
1848 | 1841 | ||
1849 | memset(&iwe, 0, sizeof(iwe)); | 1842 | memset(&iwe, 0, sizeof(iwe)); |
@@ -1859,7 +1852,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1859 | iwe.u.mode = IW_MODE_MASTER; | 1852 | iwe.u.mode = IW_MODE_MASTER; |
1860 | else | 1853 | else |
1861 | iwe.u.mode = IW_MODE_ADHOC; | 1854 | iwe.u.mode = IW_MODE_ADHOC; |
1862 | iwe.len = IW_EV_UINT_LEN; | ||
1863 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1855 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1864 | IW_EV_UINT_LEN); | 1856 | IW_EV_UINT_LEN); |
1865 | } | 1857 | } |
@@ -1877,7 +1869,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1877 | if (chan > 0) { | 1869 | if (chan > 0) { |
1878 | iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000; | 1870 | iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000; |
1879 | iwe.u.freq.e = 1; | 1871 | iwe.u.freq.e = 1; |
1880 | iwe.len = IW_EV_FREQ_LEN; | ||
1881 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1872 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1882 | IW_EV_FREQ_LEN); | 1873 | IW_EV_FREQ_LEN); |
1883 | } | 1874 | } |
@@ -1894,7 +1885,10 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1894 | iwe.u.qual.noise = | 1885 | iwe.u.qual.noise = |
1895 | HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl)); | 1886 | HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl)); |
1896 | } | 1887 | } |
1897 | iwe.len = IW_EV_QUAL_LEN; | 1888 | iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED |
1889 | | IW_QUAL_NOISE_UPDATED | ||
1890 | | IW_QUAL_QUAL_INVALID | ||
1891 | | IW_QUAL_DBM; | ||
1898 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1892 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1899 | IW_EV_QUAL_LEN); | 1893 | IW_EV_QUAL_LEN); |
1900 | } | 1894 | } |
@@ -1906,7 +1900,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1906 | else | 1900 | else |
1907 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1901 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
1908 | iwe.u.data.length = 0; | 1902 | iwe.u.data.length = 0; |
1909 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1910 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); | 1903 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); |
1911 | 1904 | ||
1912 | /* TODO: add SuppRates into BSS table */ | 1905 | /* TODO: add SuppRates into BSS table */ |
@@ -1930,7 +1923,7 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1930 | } | 1923 | } |
1931 | 1924 | ||
1932 | /* TODO: add BeaconInt,resp_rate,atim into BSS table */ | 1925 | /* TODO: add BeaconInt,resp_rate,atim into BSS table */ |
1933 | buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_KERNEL); | 1926 | buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_ATOMIC); |
1934 | if (buf && scan) { | 1927 | if (buf && scan) { |
1935 | memset(&iwe, 0, sizeof(iwe)); | 1928 | memset(&iwe, 0, sizeof(iwe)); |
1936 | iwe.cmd = IWEVCUSTOM; | 1929 | iwe.cmd = IWEVCUSTOM; |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 025f8cdb5566..da0c80fb941c 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -59,11 +59,13 @@ static struct pci_device_id prism2_pci_id_table[] __devinitdata = { | |||
59 | static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) | 59 | static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) |
60 | { | 60 | { |
61 | struct hostap_interface *iface; | 61 | struct hostap_interface *iface; |
62 | struct hostap_pci_priv *hw_priv; | ||
62 | local_info_t *local; | 63 | local_info_t *local; |
63 | unsigned long flags; | 64 | unsigned long flags; |
64 | 65 | ||
65 | iface = netdev_priv(dev); | 66 | iface = netdev_priv(dev); |
66 | local = iface->local; | 67 | local = iface->local; |
68 | hw_priv = local->hw_priv; | ||
67 | 69 | ||
68 | spin_lock_irqsave(&local->lock, flags); | 70 | spin_lock_irqsave(&local->lock, flags); |
69 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); | 71 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); |
@@ -74,12 +76,14 @@ static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) | |||
74 | static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) | 76 | static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) |
75 | { | 77 | { |
76 | struct hostap_interface *iface; | 78 | struct hostap_interface *iface; |
79 | struct hostap_pci_priv *hw_priv; | ||
77 | local_info_t *local; | 80 | local_info_t *local; |
78 | unsigned long flags; | 81 | unsigned long flags; |
79 | u8 v; | 82 | u8 v; |
80 | 83 | ||
81 | iface = netdev_priv(dev); | 84 | iface = netdev_priv(dev); |
82 | local = iface->local; | 85 | local = iface->local; |
86 | hw_priv = local->hw_priv; | ||
83 | 87 | ||
84 | spin_lock_irqsave(&local->lock, flags); | 88 | spin_lock_irqsave(&local->lock, flags); |
85 | v = readb(hw_priv->mem_start + a); | 89 | v = readb(hw_priv->mem_start + a); |
@@ -91,11 +95,13 @@ static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) | |||
91 | static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) | 95 | static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) |
92 | { | 96 | { |
93 | struct hostap_interface *iface; | 97 | struct hostap_interface *iface; |
98 | struct hostap_pci_priv *hw_priv; | ||
94 | local_info_t *local; | 99 | local_info_t *local; |
95 | unsigned long flags; | 100 | unsigned long flags; |
96 | 101 | ||
97 | iface = netdev_priv(dev); | 102 | iface = netdev_priv(dev); |
98 | local = iface->local; | 103 | local = iface->local; |
104 | hw_priv = local->hw_priv; | ||
99 | 105 | ||
100 | spin_lock_irqsave(&local->lock, flags); | 106 | spin_lock_irqsave(&local->lock, flags); |
101 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); | 107 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); |
@@ -106,12 +112,14 @@ static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) | |||
106 | static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) | 112 | static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) |
107 | { | 113 | { |
108 | struct hostap_interface *iface; | 114 | struct hostap_interface *iface; |
115 | struct hostap_pci_priv *hw_priv; | ||
109 | local_info_t *local; | 116 | local_info_t *local; |
110 | unsigned long flags; | 117 | unsigned long flags; |
111 | u16 v; | 118 | u16 v; |
112 | 119 | ||
113 | iface = netdev_priv(dev); | 120 | iface = netdev_priv(dev); |
114 | local = iface->local; | 121 | local = iface->local; |
122 | hw_priv = local->hw_priv; | ||
115 | 123 | ||
116 | spin_lock_irqsave(&local->lock, flags); | 124 | spin_lock_irqsave(&local->lock, flags); |
117 | v = readw(hw_priv->mem_start + a); | 125 | v = readw(hw_priv->mem_start + a); |
@@ -277,8 +285,6 @@ static struct prism2_helper_functions prism2_pci_funcs = | |||
277 | { | 285 | { |
278 | .card_present = NULL, | 286 | .card_present = NULL, |
279 | .cor_sreset = prism2_pci_cor_sreset, | 287 | .cor_sreset = prism2_pci_cor_sreset, |
280 | .dev_open = NULL, | ||
281 | .dev_close = NULL, | ||
282 | .genesis_reset = prism2_pci_genesis_reset, | 288 | .genesis_reset = prism2_pci_genesis_reset, |
283 | .hw_type = HOSTAP_HW_PCI, | 289 | .hw_type = HOSTAP_HW_PCI, |
284 | }; | 290 | }; |
@@ -352,8 +358,6 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
352 | return hostap_hw_ready(dev); | 358 | return hostap_hw_ready(dev); |
353 | 359 | ||
354 | fail: | 360 | fail: |
355 | kfree(hw_priv); | ||
356 | |||
357 | if (irq_registered && dev) | 361 | if (irq_registered && dev) |
358 | free_irq(dev->irq, dev); | 362 | free_irq(dev->irq, dev); |
359 | 363 | ||
@@ -364,10 +368,8 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
364 | 368 | ||
365 | err_out_disable: | 369 | err_out_disable: |
366 | pci_disable_device(pdev); | 370 | pci_disable_device(pdev); |
367 | kfree(hw_priv); | ||
368 | if (local) | ||
369 | local->hw_priv = NULL; | ||
370 | prism2_free_local_data(dev); | 371 | prism2_free_local_data(dev); |
372 | kfree(hw_priv); | ||
371 | 373 | ||
372 | return -ENODEV; | 374 | return -ENODEV; |
373 | } | 375 | } |
@@ -392,9 +394,8 @@ static void prism2_pci_remove(struct pci_dev *pdev) | |||
392 | free_irq(dev->irq, dev); | 394 | free_irq(dev->irq, dev); |
393 | 395 | ||
394 | mem_start = hw_priv->mem_start; | 396 | mem_start = hw_priv->mem_start; |
395 | kfree(hw_priv); | ||
396 | iface->local->hw_priv = NULL; | ||
397 | prism2_free_local_data(dev); | 397 | prism2_free_local_data(dev); |
398 | kfree(hw_priv); | ||
398 | 399 | ||
399 | iounmap(mem_start); | 400 | iounmap(mem_start); |
400 | 401 | ||
@@ -441,7 +442,7 @@ static int prism2_pci_resume(struct pci_dev *pdev) | |||
441 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); | 442 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); |
442 | 443 | ||
443 | static struct pci_driver prism2_pci_drv_id = { | 444 | static struct pci_driver prism2_pci_drv_id = { |
444 | .name = "prism2_pci", | 445 | .name = "hostap_pci", |
445 | .id_table = prism2_pci_id_table, | 446 | .id_table = prism2_pci_id_table, |
446 | .probe = prism2_pci_probe, | 447 | .probe = prism2_pci_probe, |
447 | .remove = prism2_pci_remove, | 448 | .remove = prism2_pci_remove, |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 474ef83d813e..78d67b408b2f 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -328,8 +328,6 @@ static struct prism2_helper_functions prism2_plx_funcs = | |||
328 | { | 328 | { |
329 | .card_present = NULL, | 329 | .card_present = NULL, |
330 | .cor_sreset = prism2_plx_cor_sreset, | 330 | .cor_sreset = prism2_plx_cor_sreset, |
331 | .dev_open = NULL, | ||
332 | .dev_close = NULL, | ||
333 | .genesis_reset = prism2_plx_genesis_reset, | 331 | .genesis_reset = prism2_plx_genesis_reset, |
334 | .hw_type = HOSTAP_HW_PLX, | 332 | .hw_type = HOSTAP_HW_PLX, |
335 | }; | 333 | }; |
@@ -570,10 +568,8 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
570 | return hostap_hw_ready(dev); | 568 | return hostap_hw_ready(dev); |
571 | 569 | ||
572 | fail: | 570 | fail: |
573 | kfree(hw_priv); | ||
574 | if (local) | ||
575 | local->hw_priv = NULL; | ||
576 | prism2_free_local_data(dev); | 571 | prism2_free_local_data(dev); |
572 | kfree(hw_priv); | ||
577 | 573 | ||
578 | if (irq_registered && dev) | 574 | if (irq_registered && dev) |
579 | free_irq(dev->irq, dev); | 575 | free_irq(dev->irq, dev); |
@@ -606,9 +602,8 @@ static void prism2_plx_remove(struct pci_dev *pdev) | |||
606 | if (dev->irq) | 602 | if (dev->irq) |
607 | free_irq(dev->irq, dev); | 603 | free_irq(dev->irq, dev); |
608 | 604 | ||
609 | kfree(iface->local->hw_priv); | ||
610 | iface->local->hw_priv = NULL; | ||
611 | prism2_free_local_data(dev); | 605 | prism2_free_local_data(dev); |
606 | kfree(hw_priv); | ||
612 | pci_disable_device(pdev); | 607 | pci_disable_device(pdev); |
613 | } | 608 | } |
614 | 609 | ||
@@ -616,7 +611,7 @@ static void prism2_plx_remove(struct pci_dev *pdev) | |||
616 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); | 611 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); |
617 | 612 | ||
618 | static struct pci_driver prism2_plx_drv_id = { | 613 | static struct pci_driver prism2_plx_drv_id = { |
619 | .name = "prism2_plx", | 614 | .name = "hostap_plx", |
620 | .id_table = prism2_plx_id_table, | 615 | .id_table = prism2_plx_id_table, |
621 | .probe = prism2_plx_probe, | 616 | .probe = prism2_plx_probe, |
622 | .remove = prism2_plx_remove, | 617 | .remove = prism2_plx_remove, |
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index cc061e1560d3..cfd801559492 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -552,8 +552,6 @@ struct prism2_helper_functions { | |||
552 | * (hostap_{cs,plx,pci}.c */ | 552 | * (hostap_{cs,plx,pci}.c */ |
553 | int (*card_present)(local_info_t *local); | 553 | int (*card_present)(local_info_t *local); |
554 | void (*cor_sreset)(local_info_t *local); | 554 | void (*cor_sreset)(local_info_t *local); |
555 | int (*dev_open)(local_info_t *local); | ||
556 | int (*dev_close)(local_info_t *local); | ||
557 | void (*genesis_reset)(local_info_t *local, int hcr); | 555 | void (*genesis_reset)(local_info_t *local, int hcr); |
558 | 556 | ||
559 | /* the following functions are from hostap_hw.c, but they may have some | 557 | /* the following functions are from hostap_hw.c, but they may have some |
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 | ||
1467 | static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | 1464 | static 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 | ||
3277 | static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev) | 3272 | static 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 { | |||
808 | struct ipw2100_rx { | 808 | struct 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 | ||
6326 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | 6327 | static 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 | ||
6450 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | 6451 | static 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 | ||
1657 | static inline u32 frame_hdr_len(struct ieee80211_hdr *hdr) | 1657 | static 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/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index ca6c03c89926..92793b958e32 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -57,9 +57,7 @@ | |||
57 | #include <linux/bitops.h> | 57 | #include <linux/bitops.h> |
58 | #ifdef CONFIG_NET_RADIO | 58 | #ifdef CONFIG_NET_RADIO |
59 | #include <linux/wireless.h> | 59 | #include <linux/wireless.h> |
60 | #if WIRELESS_EXT > 12 | ||
61 | #include <net/iw_handler.h> | 60 | #include <net/iw_handler.h> |
62 | #endif /* WIRELESS_EXT > 12 */ | ||
63 | #endif | 61 | #endif |
64 | 62 | ||
65 | #include <pcmcia/cs_types.h> | 63 | #include <pcmcia/cs_types.h> |
@@ -225,10 +223,7 @@ static void update_stats(struct net_device *dev); | |||
225 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); | 223 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); |
226 | 224 | ||
227 | /* Wireless extensions */ | 225 | /* Wireless extensions */ |
228 | #ifdef WIRELESS_EXT | ||
229 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); | 226 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); |
230 | #endif | ||
231 | static int netwave_ioctl(struct net_device *, struct ifreq *, int); | ||
232 | 227 | ||
233 | static void set_multicast_list(struct net_device *dev); | 228 | static void set_multicast_list(struct net_device *dev); |
234 | 229 | ||
@@ -260,26 +255,7 @@ static dev_link_t *dev_list; | |||
260 | because they generally can't be allocated dynamically. | 255 | because they generally can't be allocated dynamically. |
261 | */ | 256 | */ |
262 | 257 | ||
263 | #if WIRELESS_EXT <= 12 | ||
264 | /* Wireless extensions backward compatibility */ | ||
265 | |||
266 | /* Part of iw_handler prototype we need */ | ||
267 | struct iw_request_info | ||
268 | { | ||
269 | __u16 cmd; /* Wireless Extension command */ | ||
270 | __u16 flags; /* More to come ;-) */ | ||
271 | }; | ||
272 | |||
273 | /* Wireless Extension Backward compatibility - Jean II | ||
274 | * If the new wireless device private ioctl range is not defined, | ||
275 | * default to standard device private ioctl range */ | ||
276 | #ifndef SIOCIWFIRSTPRIV | ||
277 | #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE | ||
278 | #endif /* SIOCIWFIRSTPRIV */ | ||
279 | |||
280 | #else /* WIRELESS_EXT <= 12 */ | ||
281 | static const struct iw_handler_def netwave_handler_def; | 258 | static const struct iw_handler_def netwave_handler_def; |
282 | #endif /* WIRELESS_EXT <= 12 */ | ||
283 | 259 | ||
284 | #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */ | 260 | #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */ |
285 | 261 | ||
@@ -319,9 +295,7 @@ typedef struct netwave_private { | |||
319 | struct timer_list watchdog; /* To avoid blocking state */ | 295 | struct timer_list watchdog; /* To avoid blocking state */ |
320 | struct site_survey nss; | 296 | struct site_survey nss; |
321 | struct net_device_stats stats; | 297 | struct net_device_stats stats; |
322 | #ifdef WIRELESS_EXT | ||
323 | struct iw_statistics iw_stats; /* Wireless stats */ | 298 | struct iw_statistics iw_stats; /* Wireless stats */ |
324 | #endif | ||
325 | } netwave_private; | 299 | } netwave_private; |
326 | 300 | ||
327 | #ifdef NETWAVE_STATS | 301 | #ifdef NETWAVE_STATS |
@@ -353,7 +327,6 @@ static inline void wait_WOC(unsigned int iobase) | |||
353 | while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ; | 327 | while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ; |
354 | } | 328 | } |
355 | 329 | ||
356 | #ifdef WIRELESS_EXT | ||
357 | static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, | 330 | static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, |
358 | kio_addr_t iobase) { | 331 | kio_addr_t iobase) { |
359 | u_short resultBuffer; | 332 | u_short resultBuffer; |
@@ -376,9 +349,7 @@ static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, | |||
376 | sizeof(struct site_survey)); | 349 | sizeof(struct site_survey)); |
377 | } | 350 | } |
378 | } | 351 | } |
379 | #endif | ||
380 | 352 | ||
381 | #ifdef WIRELESS_EXT | ||
382 | /* | 353 | /* |
383 | * Function netwave_get_wireless_stats (dev) | 354 | * Function netwave_get_wireless_stats (dev) |
384 | * | 355 | * |
@@ -411,7 +382,6 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev) | |||
411 | 382 | ||
412 | return &priv->iw_stats; | 383 | return &priv->iw_stats; |
413 | } | 384 | } |
414 | #endif | ||
415 | 385 | ||
416 | /* | 386 | /* |
417 | * Function netwave_attach (void) | 387 | * Function netwave_attach (void) |
@@ -471,13 +441,7 @@ static dev_link_t *netwave_attach(void) | |||
471 | dev->get_stats = &netwave_get_stats; | 441 | dev->get_stats = &netwave_get_stats; |
472 | dev->set_multicast_list = &set_multicast_list; | 442 | dev->set_multicast_list = &set_multicast_list; |
473 | /* wireless extensions */ | 443 | /* wireless extensions */ |
474 | #if WIRELESS_EXT <= 16 | ||
475 | dev->get_wireless_stats = &netwave_get_wireless_stats; | ||
476 | #endif /* WIRELESS_EXT <= 16 */ | ||
477 | #if WIRELESS_EXT > 12 | ||
478 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; | 444 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; |
479 | #endif /* WIRELESS_EXT > 12 */ | ||
480 | dev->do_ioctl = &netwave_ioctl; | ||
481 | 445 | ||
482 | dev->tx_timeout = &netwave_watchdog; | 446 | dev->tx_timeout = &netwave_watchdog; |
483 | dev->watchdog_timeo = TX_TIMEOUT; | 447 | dev->watchdog_timeo = TX_TIMEOUT; |
@@ -576,13 +540,8 @@ static int netwave_set_nwid(struct net_device *dev, | |||
576 | /* Disable interrupts & save flags */ | 540 | /* Disable interrupts & save flags */ |
577 | spin_lock_irqsave(&priv->spinlock, flags); | 541 | spin_lock_irqsave(&priv->spinlock, flags); |
578 | 542 | ||
579 | #if WIRELESS_EXT > 8 | ||
580 | if(!wrqu->nwid.disabled) { | 543 | if(!wrqu->nwid.disabled) { |
581 | domain = wrqu->nwid.value; | 544 | domain = wrqu->nwid.value; |
582 | #else /* WIRELESS_EXT > 8 */ | ||
583 | if(wrqu->nwid.on) { | ||
584 | domain = wrqu->nwid.nwid; | ||
585 | #endif /* WIRELESS_EXT > 8 */ | ||
586 | printk( KERN_DEBUG "Setting domain to 0x%x%02x\n", | 545 | printk( KERN_DEBUG "Setting domain to 0x%x%02x\n", |
587 | (domain >> 8) & 0x01, domain & 0xff); | 546 | (domain >> 8) & 0x01, domain & 0xff); |
588 | wait_WOC(iobase); | 547 | wait_WOC(iobase); |
@@ -606,15 +565,9 @@ static int netwave_get_nwid(struct net_device *dev, | |||
606 | union iwreq_data *wrqu, | 565 | union iwreq_data *wrqu, |
607 | char *extra) | 566 | char *extra) |
608 | { | 567 | { |
609 | #if WIRELESS_EXT > 8 | ||
610 | wrqu->nwid.value = domain; | 568 | wrqu->nwid.value = domain; |
611 | wrqu->nwid.disabled = 0; | 569 | wrqu->nwid.disabled = 0; |
612 | wrqu->nwid.fixed = 1; | 570 | wrqu->nwid.fixed = 1; |
613 | #else /* WIRELESS_EXT > 8 */ | ||
614 | wrqu->nwid.nwid = domain; | ||
615 | wrqu->nwid.on = 1; | ||
616 | #endif /* WIRELESS_EXT > 8 */ | ||
617 | |||
618 | return 0; | 571 | return 0; |
619 | } | 572 | } |
620 | 573 | ||
@@ -657,17 +610,11 @@ static int netwave_get_scramble(struct net_device *dev, | |||
657 | { | 610 | { |
658 | key[1] = scramble_key & 0xff; | 611 | key[1] = scramble_key & 0xff; |
659 | key[0] = (scramble_key>>8) & 0xff; | 612 | key[0] = (scramble_key>>8) & 0xff; |
660 | #if WIRELESS_EXT > 8 | ||
661 | wrqu->encoding.flags = IW_ENCODE_ENABLED; | 613 | wrqu->encoding.flags = IW_ENCODE_ENABLED; |
662 | wrqu->encoding.length = 2; | 614 | wrqu->encoding.length = 2; |
663 | #else /* WIRELESS_EXT > 8 */ | ||
664 | wrqu->encoding.method = 1; | ||
665 | #endif /* WIRELESS_EXT > 8 */ | ||
666 | |||
667 | return 0; | 615 | return 0; |
668 | } | 616 | } |
669 | 617 | ||
670 | #if WIRELESS_EXT > 8 | ||
671 | /* | 618 | /* |
672 | * Wireless Handler : get mode | 619 | * Wireless Handler : get mode |
673 | */ | 620 | */ |
@@ -683,7 +630,6 @@ static int netwave_get_mode(struct net_device *dev, | |||
683 | 630 | ||
684 | return 0; | 631 | return 0; |
685 | } | 632 | } |
686 | #endif /* WIRELESS_EXT > 8 */ | ||
687 | 633 | ||
688 | /* | 634 | /* |
689 | * Wireless Handler : get range info | 635 | * Wireless Handler : get range info |
@@ -702,11 +648,9 @@ static int netwave_get_range(struct net_device *dev, | |||
702 | /* Set all the info we don't care or don't know about to zero */ | 648 | /* Set all the info we don't care or don't know about to zero */ |
703 | memset(range, 0, sizeof(struct iw_range)); | 649 | memset(range, 0, sizeof(struct iw_range)); |
704 | 650 | ||
705 | #if WIRELESS_EXT > 10 | ||
706 | /* Set the Wireless Extension versions */ | 651 | /* Set the Wireless Extension versions */ |
707 | range->we_version_compiled = WIRELESS_EXT; | 652 | range->we_version_compiled = WIRELESS_EXT; |
708 | range->we_version_source = 9; /* Nothing for us in v10 and v11 */ | 653 | range->we_version_source = 9; /* Nothing for us in v10 and v11 */ |
709 | #endif /* WIRELESS_EXT > 10 */ | ||
710 | 654 | ||
711 | /* Set information in the range struct */ | 655 | /* Set information in the range struct */ |
712 | range->throughput = 450 * 1000; /* don't argue on this ! */ | 656 | range->throughput = 450 * 1000; /* don't argue on this ! */ |
@@ -720,16 +664,12 @@ static int netwave_get_range(struct net_device *dev, | |||
720 | range->max_qual.level = 255; | 664 | range->max_qual.level = 255; |
721 | range->max_qual.noise = 0; | 665 | range->max_qual.noise = 0; |
722 | 666 | ||
723 | #if WIRELESS_EXT > 7 | ||
724 | range->num_bitrates = 1; | 667 | range->num_bitrates = 1; |
725 | range->bitrate[0] = 1000000; /* 1 Mb/s */ | 668 | range->bitrate[0] = 1000000; /* 1 Mb/s */ |
726 | #endif /* WIRELESS_EXT > 7 */ | ||
727 | 669 | ||
728 | #if WIRELESS_EXT > 8 | ||
729 | range->encoding_size[0] = 2; /* 16 bits scrambling */ | 670 | range->encoding_size[0] = 2; /* 16 bits scrambling */ |
730 | range->num_encoding_sizes = 1; | 671 | range->num_encoding_sizes = 1; |
731 | range->max_encoding_tokens = 1; /* Only one key possible */ | 672 | range->max_encoding_tokens = 1; /* Only one key possible */ |
732 | #endif /* WIRELESS_EXT > 8 */ | ||
733 | 673 | ||
734 | return ret; | 674 | return ret; |
735 | } | 675 | } |
@@ -775,8 +715,6 @@ static const struct iw_priv_args netwave_private_args[] = { | |||
775 | "getsitesurvey" }, | 715 | "getsitesurvey" }, |
776 | }; | 716 | }; |
777 | 717 | ||
778 | #if WIRELESS_EXT > 12 | ||
779 | |||
780 | static const iw_handler netwave_handler[] = | 718 | static const iw_handler netwave_handler[] = |
781 | { | 719 | { |
782 | NULL, /* SIOCSIWNAME */ | 720 | NULL, /* SIOCSIWNAME */ |
@@ -839,131 +777,8 @@ static const struct iw_handler_def netwave_handler_def = | |||
839 | .standard = (iw_handler *) netwave_handler, | 777 | .standard = (iw_handler *) netwave_handler, |
840 | .private = (iw_handler *) netwave_private_handler, | 778 | .private = (iw_handler *) netwave_private_handler, |
841 | .private_args = (struct iw_priv_args *) netwave_private_args, | 779 | .private_args = (struct iw_priv_args *) netwave_private_args, |
842 | #if WIRELESS_EXT > 16 | ||
843 | .get_wireless_stats = netwave_get_wireless_stats, | 780 | .get_wireless_stats = netwave_get_wireless_stats, |
844 | #endif /* WIRELESS_EXT > 16 */ | ||
845 | }; | 781 | }; |
846 | #endif /* WIRELESS_EXT > 12 */ | ||
847 | |||
848 | /* | ||
849 | * Function netwave_ioctl (dev, rq, cmd) | ||
850 | * | ||
851 | * Perform ioctl : config & info stuff | ||
852 | * This is the stuff that are treated the wireless extensions (iwconfig) | ||
853 | * | ||
854 | */ | ||
855 | static int netwave_ioctl(struct net_device *dev, /* ioctl device */ | ||
856 | struct ifreq *rq, /* Data passed */ | ||
857 | int cmd) /* Ioctl number */ | ||
858 | { | ||
859 | int ret = 0; | ||
860 | #ifdef WIRELESS_EXT | ||
861 | #if WIRELESS_EXT <= 12 | ||
862 | struct iwreq *wrq = (struct iwreq *) rq; | ||
863 | #endif | ||
864 | #endif | ||
865 | |||
866 | DEBUG(0, "%s: ->netwave_ioctl(cmd=0x%X)\n", dev->name, cmd); | ||
867 | |||
868 | /* Look what is the request */ | ||
869 | switch(cmd) { | ||
870 | /* --------------- WIRELESS EXTENSIONS --------------- */ | ||
871 | #ifdef WIRELESS_EXT | ||
872 | #if WIRELESS_EXT <= 12 | ||
873 | case SIOCGIWNAME: | ||
874 | netwave_get_name(dev, NULL, &(wrq->u), NULL); | ||
875 | break; | ||
876 | case SIOCSIWNWID: | ||
877 | ret = netwave_set_nwid(dev, NULL, &(wrq->u), NULL); | ||
878 | break; | ||
879 | case SIOCGIWNWID: | ||
880 | ret = netwave_get_nwid(dev, NULL, &(wrq->u), NULL); | ||
881 | break; | ||
882 | #if WIRELESS_EXT > 8 /* Note : The API did change... */ | ||
883 | case SIOCGIWENCODE: | ||
884 | /* Get scramble key */ | ||
885 | if(wrq->u.encoding.pointer != (caddr_t) 0) | ||
886 | { | ||
887 | char key[2]; | ||
888 | ret = netwave_get_scramble(dev, NULL, &(wrq->u), key); | ||
889 | if(copy_to_user(wrq->u.encoding.pointer, key, 2)) | ||
890 | ret = -EFAULT; | ||
891 | } | ||
892 | break; | ||
893 | case SIOCSIWENCODE: | ||
894 | /* Set scramble key */ | ||
895 | if(wrq->u.encoding.pointer != (caddr_t) 0) | ||
896 | { | ||
897 | char key[2]; | ||
898 | if(copy_from_user(key, wrq->u.encoding.pointer, 2)) | ||
899 | { | ||
900 | ret = -EFAULT; | ||
901 | break; | ||
902 | } | ||
903 | ret = netwave_set_scramble(dev, NULL, &(wrq->u), key); | ||
904 | } | ||
905 | break; | ||
906 | case SIOCGIWMODE: | ||
907 | /* Mode of operation */ | ||
908 | ret = netwave_get_mode(dev, NULL, &(wrq->u), NULL); | ||
909 | break; | ||
910 | #else /* WIRELESS_EXT > 8 */ | ||
911 | case SIOCGIWENCODE: | ||
912 | /* Get scramble key */ | ||
913 | ret = netwave_get_scramble(dev, NULL, &(wrq->u), | ||
914 | (char *) &wrq->u.encoding.code); | ||
915 | break; | ||
916 | case SIOCSIWENCODE: | ||
917 | /* Set scramble key */ | ||
918 | ret = netwave_set_scramble(dev, NULL, &(wrq->u), | ||
919 | (char *) &wrq->u.encoding.code); | ||
920 | break; | ||
921 | #endif /* WIRELESS_EXT > 8 */ | ||
922 | case SIOCGIWRANGE: | ||
923 | /* Basic checking... */ | ||
924 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
925 | struct iw_range range; | ||
926 | ret = netwave_get_range(dev, NULL, &(wrq->u), (char *) &range); | ||
927 | if (copy_to_user(wrq->u.data.pointer, &range, | ||
928 | sizeof(struct iw_range))) | ||
929 | ret = -EFAULT; | ||
930 | } | ||
931 | break; | ||
932 | case SIOCGIWPRIV: | ||
933 | /* Basic checking... */ | ||
934 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
935 | /* Set the number of ioctl available */ | ||
936 | wrq->u.data.length = sizeof(netwave_private_args) / sizeof(netwave_private_args[0]); | ||
937 | |||
938 | /* Copy structure to the user buffer */ | ||
939 | if(copy_to_user(wrq->u.data.pointer, | ||
940 | (u_char *) netwave_private_args, | ||
941 | sizeof(netwave_private_args))) | ||
942 | ret = -EFAULT; | ||
943 | } | ||
944 | break; | ||
945 | case SIOCGIPSNAP: | ||
946 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
947 | char buffer[sizeof( struct site_survey)]; | ||
948 | ret = netwave_get_snap(dev, NULL, &(wrq->u), buffer); | ||
949 | /* Copy structure to the user buffer */ | ||
950 | if(copy_to_user(wrq->u.data.pointer, | ||
951 | buffer, | ||
952 | sizeof( struct site_survey))) | ||
953 | { | ||
954 | printk(KERN_DEBUG "Bad buffer!\n"); | ||
955 | break; | ||
956 | } | ||
957 | } | ||
958 | break; | ||
959 | #endif /* WIRELESS_EXT <= 12 */ | ||
960 | #endif /* WIRELESS_EXT */ | ||
961 | default: | ||
962 | ret = -EOPNOTSUPP; | ||
963 | } | ||
964 | |||
965 | return ret; | ||
966 | } | ||
967 | 782 | ||
968 | /* | 783 | /* |
969 | * Function netwave_pcmcia_config (link) | 784 | * Function netwave_pcmcia_config (link) |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 6deb7cc810cc..78afbc7f08be 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -77,30 +77,16 @@ | |||
77 | #define DRIVER_NAME "orinoco" | 77 | #define DRIVER_NAME "orinoco" |
78 | 78 | ||
79 | #include <linux/config.h> | 79 | #include <linux/config.h> |
80 | |||
81 | #include <linux/module.h> | 80 | #include <linux/module.h> |
82 | #include <linux/kernel.h> | 81 | #include <linux/kernel.h> |
83 | #include <linux/init.h> | 82 | #include <linux/init.h> |
84 | #include <linux/ptrace.h> | ||
85 | #include <linux/slab.h> | ||
86 | #include <linux/string.h> | ||
87 | #include <linux/timer.h> | ||
88 | #include <linux/ioport.h> | ||
89 | #include <linux/netdevice.h> | 83 | #include <linux/netdevice.h> |
90 | #include <linux/if_arp.h> | ||
91 | #include <linux/etherdevice.h> | 84 | #include <linux/etherdevice.h> |
92 | #include <linux/ethtool.h> | 85 | #include <linux/ethtool.h> |
93 | #include <linux/wireless.h> | 86 | #include <linux/wireless.h> |
94 | #include <net/iw_handler.h> | 87 | #include <net/iw_handler.h> |
95 | #include <net/ieee80211.h> | 88 | #include <net/ieee80211.h> |
96 | 89 | ||
97 | #include <net/ieee80211.h> | ||
98 | |||
99 | #include <asm/uaccess.h> | ||
100 | #include <asm/io.h> | ||
101 | #include <asm/system.h> | ||
102 | |||
103 | #include "hermes.h" | ||
104 | #include "hermes_rid.h" | 90 | #include "hermes_rid.h" |
105 | #include "orinoco.h" | 91 | #include "orinoco.h" |
106 | 92 | ||
@@ -137,7 +123,7 @@ MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions"); | |||
137 | 123 | ||
138 | /* We do this this way to avoid ifdefs in the actual code */ | 124 | /* We do this this way to avoid ifdefs in the actual code */ |
139 | #ifdef WIRELESS_SPY | 125 | #ifdef WIRELESS_SPY |
140 | #define SPY_NUMBER(priv) (priv->spy_number) | 126 | #define SPY_NUMBER(priv) (priv->spy_data.spy_number) |
141 | #else | 127 | #else |
142 | #define SPY_NUMBER(priv) 0 | 128 | #define SPY_NUMBER(priv) 0 |
143 | #endif /* WIRELESS_SPY */ | 129 | #endif /* WIRELESS_SPY */ |
@@ -216,31 +202,32 @@ static struct { | |||
216 | /********************************************************************/ | 202 | /********************************************************************/ |
217 | 203 | ||
218 | /* Used in Event handling. | 204 | /* Used in Event handling. |
219 | * We avoid nested structres as they break on ARM -- Moustafa */ | 205 | * We avoid nested structures as they break on ARM -- Moustafa */ |
220 | struct hermes_tx_descriptor_802_11 { | 206 | struct hermes_tx_descriptor_802_11 { |
221 | /* hermes_tx_descriptor */ | 207 | /* hermes_tx_descriptor */ |
222 | u16 status; | 208 | __le16 status; |
223 | u16 reserved1; | 209 | __le16 reserved1; |
224 | u16 reserved2; | 210 | __le16 reserved2; |
225 | u32 sw_support; | 211 | __le32 sw_support; |
226 | u8 retry_count; | 212 | u8 retry_count; |
227 | u8 tx_rate; | 213 | u8 tx_rate; |
228 | u16 tx_control; | 214 | __le16 tx_control; |
229 | 215 | ||
230 | /* ieee802_11_hdr */ | 216 | /* ieee80211_hdr */ |
231 | u16 frame_ctl; | 217 | __le16 frame_ctl; |
232 | u16 duration_id; | 218 | __le16 duration_id; |
233 | u8 addr1[ETH_ALEN]; | 219 | u8 addr1[ETH_ALEN]; |
234 | u8 addr2[ETH_ALEN]; | 220 | u8 addr2[ETH_ALEN]; |
235 | u8 addr3[ETH_ALEN]; | 221 | u8 addr3[ETH_ALEN]; |
236 | u16 seq_ctl; | 222 | __le16 seq_ctl; |
237 | u8 addr4[ETH_ALEN]; | 223 | u8 addr4[ETH_ALEN]; |
238 | u16 data_len; | 224 | |
225 | __le16 data_len; | ||
239 | 226 | ||
240 | /* ethhdr */ | 227 | /* ethhdr */ |
241 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 228 | u8 h_dest[ETH_ALEN]; /* destination eth addr */ |
242 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 229 | u8 h_source[ETH_ALEN]; /* source ether addr */ |
243 | unsigned short h_proto; /* packet type ID field */ | 230 | __be16 h_proto; /* packet type ID field */ |
244 | 231 | ||
245 | /* p8022_hdr */ | 232 | /* p8022_hdr */ |
246 | u8 dsap; | 233 | u8 dsap; |
@@ -248,31 +235,31 @@ struct hermes_tx_descriptor_802_11 { | |||
248 | u8 ctrl; | 235 | u8 ctrl; |
249 | u8 oui[3]; | 236 | u8 oui[3]; |
250 | 237 | ||
251 | u16 ethertype; | 238 | __be16 ethertype; |
252 | } __attribute__ ((packed)); | 239 | } __attribute__ ((packed)); |
253 | 240 | ||
254 | /* Rx frame header except compatibility 802.3 header */ | 241 | /* Rx frame header except compatibility 802.3 header */ |
255 | struct hermes_rx_descriptor { | 242 | struct hermes_rx_descriptor { |
256 | /* Control */ | 243 | /* Control */ |
257 | u16 status; | 244 | __le16 status; |
258 | u32 time; | 245 | __le32 time; |
259 | u8 silence; | 246 | u8 silence; |
260 | u8 signal; | 247 | u8 signal; |
261 | u8 rate; | 248 | u8 rate; |
262 | u8 rxflow; | 249 | u8 rxflow; |
263 | u32 reserved; | 250 | __le32 reserved; |
264 | 251 | ||
265 | /* 802.11 header */ | 252 | /* 802.11 header */ |
266 | u16 frame_ctl; | 253 | __le16 frame_ctl; |
267 | u16 duration_id; | 254 | __le16 duration_id; |
268 | u8 addr1[ETH_ALEN]; | 255 | u8 addr1[ETH_ALEN]; |
269 | u8 addr2[ETH_ALEN]; | 256 | u8 addr2[ETH_ALEN]; |
270 | u8 addr3[ETH_ALEN]; | 257 | u8 addr3[ETH_ALEN]; |
271 | u16 seq_ctl; | 258 | __le16 seq_ctl; |
272 | u8 addr4[ETH_ALEN]; | 259 | u8 addr4[ETH_ALEN]; |
273 | 260 | ||
274 | /* Data length */ | 261 | /* Data length */ |
275 | u16 data_len; | 262 | __le16 data_len; |
276 | } __attribute__ ((packed)); | 263 | } __attribute__ ((packed)); |
277 | 264 | ||
278 | /********************************************************************/ | 265 | /********************************************************************/ |
@@ -396,14 +383,14 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev) | |||
396 | /* If a spy address is defined, we report stats of the | 383 | /* If a spy address is defined, we report stats of the |
397 | * first spy address - Jean II */ | 384 | * first spy address - Jean II */ |
398 | if (SPY_NUMBER(priv)) { | 385 | if (SPY_NUMBER(priv)) { |
399 | wstats->qual.qual = priv->spy_stat[0].qual; | 386 | wstats->qual.qual = priv->spy_data.spy_stat[0].qual; |
400 | wstats->qual.level = priv->spy_stat[0].level; | 387 | wstats->qual.level = priv->spy_data.spy_stat[0].level; |
401 | wstats->qual.noise = priv->spy_stat[0].noise; | 388 | wstats->qual.noise = priv->spy_data.spy_stat[0].noise; |
402 | wstats->qual.updated = priv->spy_stat[0].updated; | 389 | wstats->qual.updated = priv->spy_data.spy_stat[0].updated; |
403 | } | 390 | } |
404 | } else { | 391 | } else { |
405 | struct { | 392 | struct { |
406 | u16 qual, signal, noise; | 393 | __le16 qual, signal, noise; |
407 | } __attribute__ ((packed)) cq; | 394 | } __attribute__ ((packed)) cq; |
408 | 395 | ||
409 | err = HERMES_READ_RECORD(hw, USER_BAP, | 396 | err = HERMES_READ_RECORD(hw, USER_BAP, |
@@ -629,16 +616,17 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
629 | struct orinoco_private *priv = netdev_priv(dev); | 616 | struct orinoco_private *priv = netdev_priv(dev); |
630 | struct net_device_stats *stats = &priv->stats; | 617 | struct net_device_stats *stats = &priv->stats; |
631 | u16 fid = hermes_read_regn(hw, TXCOMPLFID); | 618 | u16 fid = hermes_read_regn(hw, TXCOMPLFID); |
619 | u16 status; | ||
632 | struct hermes_tx_descriptor_802_11 hdr; | 620 | struct hermes_tx_descriptor_802_11 hdr; |
633 | int err = 0; | 621 | int err = 0; |
634 | 622 | ||
635 | if (fid == DUMMY_FID) | 623 | if (fid == DUMMY_FID) |
636 | return; /* Nothing's really happened */ | 624 | return; /* Nothing's really happened */ |
637 | 625 | ||
638 | /* Read the frame header */ | 626 | /* Read part of the frame header - we need status and addr1 */ |
639 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, | 627 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, |
640 | sizeof(struct hermes_tx_descriptor) + | 628 | offsetof(struct hermes_tx_descriptor_802_11, |
641 | sizeof(struct ieee80211_hdr), | 629 | addr2), |
642 | fid, 0); | 630 | fid, 0); |
643 | 631 | ||
644 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); | 632 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); |
@@ -658,8 +646,8 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
658 | * exceeded, because that's the only status that really mean | 646 | * exceeded, because that's the only status that really mean |
659 | * that this particular node went away. | 647 | * that this particular node went away. |
660 | * Other errors means that *we* screwed up. - Jean II */ | 648 | * Other errors means that *we* screwed up. - Jean II */ |
661 | hdr.status = le16_to_cpu(hdr.status); | 649 | status = le16_to_cpu(hdr.status); |
662 | if (hdr.status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) { | 650 | if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) { |
663 | union iwreq_data wrqu; | 651 | union iwreq_data wrqu; |
664 | 652 | ||
665 | /* Copy 802.11 dest address. | 653 | /* Copy 802.11 dest address. |
@@ -718,18 +706,13 @@ static inline int is_ethersnap(void *_hdr) | |||
718 | static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, | 706 | static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, |
719 | int level, int noise) | 707 | int level, int noise) |
720 | { | 708 | { |
721 | struct orinoco_private *priv = netdev_priv(dev); | 709 | struct iw_quality wstats; |
722 | int i; | 710 | wstats.level = level - 0x95; |
723 | 711 | wstats.noise = noise - 0x95; | |
724 | /* Gather wireless spy statistics: for each packet, compare the | 712 | wstats.qual = (level > noise) ? (level - noise) : 0; |
725 | * source address with out list, and if match, get the stats... */ | 713 | wstats.updated = 7; |
726 | for (i = 0; i < priv->spy_number; i++) | 714 | /* Update spy records */ |
727 | if (!memcmp(mac, priv->spy_address[i], ETH_ALEN)) { | 715 | 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 | } | 716 | } |
734 | 717 | ||
735 | static void orinoco_stat_gather(struct net_device *dev, | 718 | static void orinoco_stat_gather(struct net_device *dev, |
@@ -1050,7 +1033,7 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1050 | unsigned long flags; | 1033 | unsigned long flags; |
1051 | struct join_req { | 1034 | struct join_req { |
1052 | u8 bssid[ETH_ALEN]; | 1035 | u8 bssid[ETH_ALEN]; |
1053 | u16 channel; | 1036 | __le16 channel; |
1054 | } __attribute__ ((packed)) req; | 1037 | } __attribute__ ((packed)) req; |
1055 | const int atom_len = offsetof(struct prism2_scan_apinfo, atim); | 1038 | const int atom_len = offsetof(struct prism2_scan_apinfo, atim); |
1056 | struct prism2_scan_apinfo *atom = NULL; | 1039 | struct prism2_scan_apinfo *atom = NULL; |
@@ -1065,7 +1048,7 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1065 | return; | 1048 | return; |
1066 | 1049 | ||
1067 | if (orinoco_lock(priv, &flags) != 0) | 1050 | if (orinoco_lock(priv, &flags) != 0) |
1068 | goto out; | 1051 | goto fail_lock; |
1069 | 1052 | ||
1070 | /* Sanity checks in case user changed something in the meantime */ | 1053 | /* Sanity checks in case user changed something in the meantime */ |
1071 | if (! priv->bssid_fixed) | 1054 | if (! priv->bssid_fixed) |
@@ -1110,8 +1093,10 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1110 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); | 1093 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); |
1111 | 1094 | ||
1112 | out: | 1095 | out: |
1113 | kfree(buf); | ||
1114 | orinoco_unlock(priv, &flags); | 1096 | orinoco_unlock(priv, &flags); |
1097 | |||
1098 | fail_lock: | ||
1099 | kfree(buf); | ||
1115 | } | 1100 | } |
1116 | 1101 | ||
1117 | /* Send new BSSID to userspace */ | 1102 | /* Send new BSSID to userspace */ |
@@ -1129,12 +1114,14 @@ static void orinoco_send_wevents(struct net_device *dev) | |||
1129 | err = hermes_read_ltv(hw, IRQ_BAP, HERMES_RID_CURRENTBSSID, | 1114 | err = hermes_read_ltv(hw, IRQ_BAP, HERMES_RID_CURRENTBSSID, |
1130 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); | 1115 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); |
1131 | if (err != 0) | 1116 | if (err != 0) |
1132 | return; | 1117 | goto out; |
1133 | 1118 | ||
1134 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 1119 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
1135 | 1120 | ||
1136 | /* Send event to user space */ | 1121 | /* Send event to user space */ |
1137 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 1122 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); |
1123 | |||
1124 | out: | ||
1138 | orinoco_unlock(priv, &flags); | 1125 | orinoco_unlock(priv, &flags); |
1139 | } | 1126 | } |
1140 | 1127 | ||
@@ -1143,8 +1130,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1143 | struct orinoco_private *priv = netdev_priv(dev); | 1130 | struct orinoco_private *priv = netdev_priv(dev); |
1144 | u16 infofid; | 1131 | u16 infofid; |
1145 | struct { | 1132 | struct { |
1146 | u16 len; | 1133 | __le16 len; |
1147 | u16 type; | 1134 | __le16 type; |
1148 | } __attribute__ ((packed)) info; | 1135 | } __attribute__ ((packed)) info; |
1149 | int len, type; | 1136 | int len, type; |
1150 | int err; | 1137 | int err; |
@@ -2459,6 +2446,10 @@ struct net_device *alloc_orinocodev(int sizeof_card, | |||
2459 | dev->get_stats = orinoco_get_stats; | 2446 | dev->get_stats = orinoco_get_stats; |
2460 | dev->ethtool_ops = &orinoco_ethtool_ops; | 2447 | dev->ethtool_ops = &orinoco_ethtool_ops; |
2461 | dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; | 2448 | dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; |
2449 | #ifdef WIRELESS_SPY | ||
2450 | priv->wireless_data.spy_data = &priv->spy_data; | ||
2451 | dev->wireless_data = &priv->wireless_data; | ||
2452 | #endif | ||
2462 | dev->change_mtu = orinoco_change_mtu; | 2453 | dev->change_mtu = orinoco_change_mtu; |
2463 | dev->set_multicast_list = orinoco_set_multicast_list; | 2454 | dev->set_multicast_list = orinoco_set_multicast_list; |
2464 | /* we use the default eth_mac_addr for setting the MAC addr */ | 2455 | /* we use the default eth_mac_addr for setting the MAC addr */ |
@@ -2830,7 +2821,7 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev, | |||
2830 | } | 2821 | } |
2831 | } | 2822 | } |
2832 | 2823 | ||
2833 | if ((priv->iw_mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){ | 2824 | if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))){ |
2834 | /* Quality stats meaningless in ad-hoc mode */ | 2825 | /* Quality stats meaningless in ad-hoc mode */ |
2835 | } else { | 2826 | } else { |
2836 | range->max_qual.qual = 0x8b - 0x2f; | 2827 | range->max_qual.qual = 0x8b - 0x2f; |
@@ -2877,6 +2868,14 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev, | |||
2877 | range->min_r_time = 0; | 2868 | range->min_r_time = 0; |
2878 | range->max_r_time = 65535 * 1000; /* ??? */ | 2869 | range->max_r_time = 65535 * 1000; /* ??? */ |
2879 | 2870 | ||
2871 | /* Event capability (kernel) */ | ||
2872 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); | ||
2873 | /* Event capability (driver) */ | ||
2874 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); | ||
2875 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); | ||
2876 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); | ||
2877 | IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP); | ||
2878 | |||
2880 | TRACE_EXIT(dev->name); | 2879 | TRACE_EXIT(dev->name); |
2881 | 2880 | ||
2882 | return 0; | 2881 | return 0; |
@@ -3836,92 +3835,6 @@ static int orinoco_ioctl_getrid(struct net_device *dev, | |||
3836 | return err; | 3835 | return err; |
3837 | } | 3836 | } |
3838 | 3837 | ||
3839 | /* Spy is used for link quality/strength measurements in Ad-Hoc mode | ||
3840 | * Jean II */ | ||
3841 | static int orinoco_ioctl_setspy(struct net_device *dev, | ||
3842 | struct iw_request_info *info, | ||
3843 | struct iw_point *srq, | ||
3844 | char *extra) | ||
3845 | |||
3846 | { | ||
3847 | struct orinoco_private *priv = netdev_priv(dev); | ||
3848 | struct sockaddr *address = (struct sockaddr *) extra; | ||
3849 | int number = srq->length; | ||
3850 | int i; | ||
3851 | unsigned long flags; | ||
3852 | |||
3853 | /* Make sure nobody mess with the structure while we do */ | ||
3854 | if (orinoco_lock(priv, &flags) != 0) | ||
3855 | return -EBUSY; | ||
3856 | |||
3857 | /* orinoco_lock() doesn't disable interrupts, so make sure the | ||
3858 | * interrupt rx path don't get confused while we copy */ | ||
3859 | priv->spy_number = 0; | ||
3860 | |||
3861 | if (number > 0) { | ||
3862 | /* Extract the addresses */ | ||
3863 | for (i = 0; i < number; i++) | ||
3864 | memcpy(priv->spy_address[i], address[i].sa_data, | ||
3865 | ETH_ALEN); | ||
3866 | /* Reset stats */ | ||
3867 | memset(priv->spy_stat, 0, | ||
3868 | sizeof(struct iw_quality) * IW_MAX_SPY); | ||
3869 | /* Set number of addresses */ | ||
3870 | priv->spy_number = number; | ||
3871 | } | ||
3872 | |||
3873 | /* Now, let the others play */ | ||
3874 | orinoco_unlock(priv, &flags); | ||
3875 | |||
3876 | /* Do NOT call commit handler */ | ||
3877 | return 0; | ||
3878 | } | ||
3879 | |||
3880 | static int orinoco_ioctl_getspy(struct net_device *dev, | ||
3881 | struct iw_request_info *info, | ||
3882 | struct iw_point *srq, | ||
3883 | char *extra) | ||
3884 | { | ||
3885 | struct orinoco_private *priv = netdev_priv(dev); | ||
3886 | struct sockaddr *address = (struct sockaddr *) extra; | ||
3887 | int number; | ||
3888 | int i; | ||
3889 | unsigned long flags; | ||
3890 | |||
3891 | if (orinoco_lock(priv, &flags) != 0) | ||
3892 | return -EBUSY; | ||
3893 | |||
3894 | number = priv->spy_number; | ||
3895 | /* Create address struct */ | ||
3896 | for (i = 0; i < number; i++) { | ||
3897 | memcpy(address[i].sa_data, priv->spy_address[i], ETH_ALEN); | ||
3898 | address[i].sa_family = AF_UNIX; | ||
3899 | } | ||
3900 | if (number > 0) { | ||
3901 | /* Create address struct */ | ||
3902 | for (i = 0; i < number; i++) { | ||
3903 | memcpy(address[i].sa_data, priv->spy_address[i], | ||
3904 | ETH_ALEN); | ||
3905 | address[i].sa_family = AF_UNIX; | ||
3906 | } | ||
3907 | /* Copy stats */ | ||
3908 | /* In theory, we should disable irqs while copying the stats | ||
3909 | * because the rx path might update it in the middle... | ||
3910 | * Bah, who care ? - Jean II */ | ||
3911 | memcpy(extra + (sizeof(struct sockaddr) * number), | ||
3912 | priv->spy_stat, sizeof(struct iw_quality) * number); | ||
3913 | } | ||
3914 | /* Reset updated flags. */ | ||
3915 | for (i = 0; i < number; i++) | ||
3916 | priv->spy_stat[i].updated = 0; | ||
3917 | |||
3918 | orinoco_unlock(priv, &flags); | ||
3919 | |||
3920 | srq->length = number; | ||
3921 | |||
3922 | return 0; | ||
3923 | } | ||
3924 | |||
3925 | /* Trigger a scan (look for other cells in the vicinity */ | 3838 | /* Trigger a scan (look for other cells in the vicinity */ |
3926 | static int orinoco_ioctl_setscan(struct net_device *dev, | 3839 | static int orinoco_ioctl_setscan(struct net_device *dev, |
3927 | struct iw_request_info *info, | 3840 | struct iw_request_info *info, |
@@ -3994,7 +3907,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev, | |||
3994 | HERMES_HOSTSCAN_SYMBOL_BCAST); | 3907 | HERMES_HOSTSCAN_SYMBOL_BCAST); |
3995 | break; | 3908 | break; |
3996 | case FIRMWARE_TYPE_INTERSIL: { | 3909 | case FIRMWARE_TYPE_INTERSIL: { |
3997 | u16 req[3]; | 3910 | __le16 req[3]; |
3998 | 3911 | ||
3999 | req[0] = cpu_to_le16(0x3fff); /* All channels */ | 3912 | req[0] = cpu_to_le16(0x3fff); /* All channels */ |
4000 | req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */ | 3913 | req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */ |
@@ -4068,7 +3981,7 @@ static inline int orinoco_translate_scan(struct net_device *dev, | |||
4068 | case FIRMWARE_TYPE_INTERSIL: | 3981 | case FIRMWARE_TYPE_INTERSIL: |
4069 | offset = 4; | 3982 | offset = 4; |
4070 | if (priv->has_hostscan) { | 3983 | if (priv->has_hostscan) { |
4071 | atom_len = le16_to_cpup((u16 *)scan); | 3984 | atom_len = le16_to_cpup((__le16 *)scan); |
4072 | /* Sanity check for atom_len */ | 3985 | /* Sanity check for atom_len */ |
4073 | if (atom_len < sizeof(struct prism2_scan_apinfo)) { | 3986 | if (atom_len < sizeof(struct prism2_scan_apinfo)) { |
4074 | printk(KERN_ERR "%s: Invalid atom_len in scan data: %d\n", | 3987 | printk(KERN_ERR "%s: Invalid atom_len in scan data: %d\n", |
@@ -4352,8 +4265,10 @@ static const iw_handler orinoco_handler[] = { | |||
4352 | [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens, | 4265 | [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens, |
4353 | [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens, | 4266 | [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens, |
4354 | [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange, | 4267 | [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange, |
4355 | [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setspy, | 4268 | [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_set_spy, |
4356 | [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getspy, | 4269 | [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_get_spy, |
4270 | [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_set_thrspy, | ||
4271 | [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_get_thrspy, | ||
4357 | [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap, | 4272 | [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap, |
4358 | [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap, | 4273 | [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap, |
4359 | [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan, | 4274 | [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan, |
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 2f213a7103fe..7a17bb31fc89 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h | |||
@@ -7,12 +7,11 @@ | |||
7 | #ifndef _ORINOCO_H | 7 | #ifndef _ORINOCO_H |
8 | #define _ORINOCO_H | 8 | #define _ORINOCO_H |
9 | 9 | ||
10 | #define DRIVER_VERSION "0.15rc2" | 10 | #define DRIVER_VERSION "0.15rc3" |
11 | 11 | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/spinlock.h> | ||
14 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
15 | #include <linux/wireless.h> | 13 | #include <linux/wireless.h> |
14 | #include <net/iw_handler.h> | ||
16 | #include <linux/version.h> | 15 | #include <linux/version.h> |
17 | 16 | ||
18 | #include "hermes.h" | 17 | #include "hermes.h" |
@@ -28,7 +27,7 @@ | |||
28 | #define ORINOCO_MAX_KEYS 4 | 27 | #define ORINOCO_MAX_KEYS 4 |
29 | 28 | ||
30 | struct orinoco_key { | 29 | struct orinoco_key { |
31 | u16 len; /* always stored as little-endian */ | 30 | __le16 len; /* always stored as little-endian */ |
32 | char data[ORINOCO_MAX_KEY_SIZE]; | 31 | char data[ORINOCO_MAX_KEY_SIZE]; |
33 | } __attribute__ ((packed)); | 32 | } __attribute__ ((packed)); |
34 | 33 | ||
@@ -36,14 +35,14 @@ struct header_struct { | |||
36 | /* 802.3 */ | 35 | /* 802.3 */ |
37 | u8 dest[ETH_ALEN]; | 36 | u8 dest[ETH_ALEN]; |
38 | u8 src[ETH_ALEN]; | 37 | u8 src[ETH_ALEN]; |
39 | u16 len; | 38 | __be16 len; |
40 | /* 802.2 */ | 39 | /* 802.2 */ |
41 | u8 dsap; | 40 | u8 dsap; |
42 | u8 ssap; | 41 | u8 ssap; |
43 | u8 ctrl; | 42 | u8 ctrl; |
44 | /* SNAP */ | 43 | /* SNAP */ |
45 | u8 oui[3]; | 44 | u8 oui[3]; |
46 | u16 ethertype; | 45 | unsigned short ethertype; |
47 | } __attribute__ ((packed)); | 46 | } __attribute__ ((packed)); |
48 | 47 | ||
49 | typedef enum { | 48 | typedef enum { |
@@ -112,9 +111,8 @@ struct orinoco_private { | |||
112 | u16 pm_on, pm_mcast, pm_period, pm_timeout; | 111 | u16 pm_on, pm_mcast, pm_period, pm_timeout; |
113 | u16 preamble; | 112 | u16 preamble; |
114 | #ifdef WIRELESS_SPY | 113 | #ifdef WIRELESS_SPY |
115 | int spy_number; | 114 | struct iw_spy_data spy_data; /* iwspy support */ |
116 | u_char spy_address[IW_MAX_SPY][ETH_ALEN]; | 115 | struct iw_public_data wireless_data; |
117 | struct iw_quality spy_stat[IW_MAX_SPY]; | ||
118 | #endif | 116 | #endif |
119 | 117 | ||
120 | /* Configuration dependent variables */ | 118 | /* Configuration dependent variables */ |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index bedd7f9f23e4..dc1128a00971 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -14,33 +14,16 @@ | |||
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 | |||
21 | #include <linux/module.h> | 17 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | 19 | #include <linux/init.h> |
24 | #include <linux/sched.h> | 20 | #include <linux/delay.h> |
25 | #include <linux/ptrace.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/string.h> | ||
28 | #include <linux/ioport.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/if_arp.h> | ||
31 | #include <linux/etherdevice.h> | ||
32 | #include <linux/wireless.h> | ||
33 | |||
34 | #include <pcmcia/cs_types.h> | 21 | #include <pcmcia/cs_types.h> |
35 | #include <pcmcia/cs.h> | 22 | #include <pcmcia/cs.h> |
36 | #include <pcmcia/cistpl.h> | 23 | #include <pcmcia/cistpl.h> |
37 | #include <pcmcia/cisreg.h> | 24 | #include <pcmcia/cisreg.h> |
38 | #include <pcmcia/ds.h> | 25 | #include <pcmcia/ds.h> |
39 | 26 | ||
40 | #include <asm/uaccess.h> | ||
41 | #include <asm/io.h> | ||
42 | #include <asm/system.h> | ||
43 | |||
44 | #include "orinoco.h" | 27 | #include "orinoco.h" |
45 | 28 | ||
46 | /********************************************************************/ | 29 | /********************************************************************/ |
@@ -97,17 +80,8 @@ static dev_link_t *dev_list; /* = NULL */ | |||
97 | /* Function prototypes */ | 80 | /* Function prototypes */ |
98 | /********************************************************************/ | 81 | /********************************************************************/ |
99 | 82 | ||
100 | /* device methods */ | 83 | static void orinoco_cs_release(dev_link_t *link); |
101 | static int orinoco_cs_hard_reset(struct orinoco_private *priv); | 84 | static void orinoco_cs_detach(dev_link_t *link); |
102 | |||
103 | /* PCMCIA gumpf */ | ||
104 | static void orinoco_cs_config(dev_link_t * link); | ||
105 | static void orinoco_cs_release(dev_link_t * link); | ||
106 | static int orinoco_cs_event(event_t event, int priority, | ||
107 | event_callback_args_t * args); | ||
108 | |||
109 | static dev_link_t *orinoco_cs_attach(void); | ||
110 | static void orinoco_cs_detach(dev_link_t *); | ||
111 | 85 | ||
112 | /********************************************************************/ | 86 | /********************************************************************/ |
113 | /* Device methods */ | 87 | /* Device methods */ |
@@ -603,49 +577,85 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
603 | "Pavel Roskin <proski@gnu.org>, et al)"; | 577 | "Pavel Roskin <proski@gnu.org>, et al)"; |
604 | 578 | ||
605 | static struct pcmcia_device_id orinoco_cs_ids[] = { | 579 | static struct pcmcia_device_id orinoco_cs_ids[] = { |
606 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), | 580 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */ |
607 | PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), | 581 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */ |
608 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), | 582 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */ |
609 | PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), | 583 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ |
610 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), | 584 | PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */ |
611 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), | 585 | PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */ |
612 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), | 586 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */ |
613 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), | 587 | PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */ |
614 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), | 588 | PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */ |
615 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), | 589 | PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */ |
616 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), | 590 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ |
617 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), | 591 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ |
618 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), | 592 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ |
619 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), | 593 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ |
620 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), | 594 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ |
621 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), | 595 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ |
622 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), | 596 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */ |
623 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), | 597 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ |
598 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ | ||
599 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ | ||
600 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ | ||
601 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ | ||
602 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ | ||
603 | PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */ | ||
604 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */ | ||
605 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */ | ||
606 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */ | ||
607 | 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), | 608 | 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), | 609 | PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), |
610 | PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2), | ||
611 | PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092), | ||
612 | PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f), | ||
613 | PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842), | ||
614 | 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), | 615 | PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), |
616 | PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb), | ||
628 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), | 617 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), |
618 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18), | ||
629 | PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), | 619 | PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), |
620 | PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b), | ||
621 | 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), | 622 | 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), | 623 | 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), | 624 | 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), | 625 | 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), | 626 | PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), |
627 | PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), | ||
628 | PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146), | ||
635 | PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), | 629 | PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), |
636 | PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), | 630 | PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), |
631 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), | ||
632 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), | ||
637 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), | 633 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), |
634 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77), | ||
635 | PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf), | ||
636 | PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2), | ||
637 | PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92), | ||
638 | PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395), | ||
638 | PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), | 639 | PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), |
639 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), | 640 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), |
640 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), | 641 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), |
641 | PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), | 642 | PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), |
642 | PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), | 643 | PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), |
644 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1), | ||
643 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), | 645 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), |
646 | PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), | ||
647 | PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6), | ||
648 | PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed), | ||
649 | 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), | 650 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), |
651 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178), | ||
645 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), | 652 | 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), | 653 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), |
647 | PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), | 654 | PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), |
648 | PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), | 655 | PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a), |
656 | PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), | ||
657 | PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39), | ||
658 | PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee), | ||
649 | PCMCIA_DEVICE_NULL, | 659 | PCMCIA_DEVICE_NULL, |
650 | }; | 660 | }; |
651 | MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); | 661 | MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); |
@@ -656,8 +666,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
656 | .name = DRIVER_NAME, | 666 | .name = DRIVER_NAME, |
657 | }, | 667 | }, |
658 | .attach = orinoco_cs_attach, | 668 | .attach = orinoco_cs_attach, |
659 | .event = orinoco_cs_event, | ||
660 | .detach = orinoco_cs_detach, | 669 | .detach = orinoco_cs_detach, |
670 | .event = orinoco_cs_event, | ||
661 | .id_table = orinoco_cs_ids, | 671 | .id_table = orinoco_cs_ids, |
662 | }; | 672 | }; |
663 | 673 | ||
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index 86fa58e5cfac..d8afd51ff8a5 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c | |||
@@ -40,29 +40,13 @@ | |||
40 | #define PFX DRIVER_NAME ": " | 40 | #define PFX DRIVER_NAME ": " |
41 | 41 | ||
42 | #include <linux/config.h> | 42 | #include <linux/config.h> |
43 | |||
44 | #include <linux/module.h> | 43 | #include <linux/module.h> |
45 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
46 | #include <linux/init.h> | 45 | #include <linux/init.h> |
47 | #include <linux/sched.h> | 46 | #include <linux/delay.h> |
48 | #include <linux/ptrace.h> | ||
49 | #include <linux/slab.h> | ||
50 | #include <linux/string.h> | ||
51 | #include <linux/timer.h> | ||
52 | #include <linux/ioport.h> | ||
53 | #include <asm/uaccess.h> | ||
54 | #include <asm/io.h> | ||
55 | #include <asm/system.h> | ||
56 | #include <linux/netdevice.h> | ||
57 | #include <linux/if_arp.h> | ||
58 | #include <linux/etherdevice.h> | ||
59 | #include <linux/list.h> | ||
60 | #include <linux/pci.h> | 47 | #include <linux/pci.h> |
61 | #include <linux/fcntl.h> | ||
62 | |||
63 | #include <pcmcia/cisreg.h> | 48 | #include <pcmcia/cisreg.h> |
64 | 49 | ||
65 | #include "hermes.h" | ||
66 | #include "orinoco.h" | 50 | #include "orinoco.h" |
67 | 51 | ||
68 | #define COR_OFFSET (0xe0) /* COR attribute offset of Prism2 PC card */ | 52 | #define COR_OFFSET (0xe0) /* COR attribute offset of Prism2 PC card */ |
@@ -108,7 +92,7 @@ static int nortel_pci_cor_reset(struct orinoco_private *priv) | |||
108 | return 0; | 92 | return 0; |
109 | } | 93 | } |
110 | 94 | ||
111 | int nortel_pci_hw_init(struct nortel_pci_card *card) | 95 | static int nortel_pci_hw_init(struct nortel_pci_card *card) |
112 | { | 96 | { |
113 | int i; | 97 | int i; |
114 | u32 reg; | 98 | u32 reg; |
diff --git a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c index 42e03438291b..5362c214fc8e 100644 --- a/drivers/net/wireless/orinoco_pci.c +++ b/drivers/net/wireless/orinoco_pci.c | |||
@@ -93,28 +93,12 @@ | |||
93 | #define PFX DRIVER_NAME ": " | 93 | #define PFX DRIVER_NAME ": " |
94 | 94 | ||
95 | #include <linux/config.h> | 95 | #include <linux/config.h> |
96 | |||
97 | #include <linux/module.h> | 96 | #include <linux/module.h> |
98 | #include <linux/kernel.h> | 97 | #include <linux/kernel.h> |
99 | #include <linux/init.h> | 98 | #include <linux/init.h> |
100 | #include <linux/sched.h> | 99 | #include <linux/delay.h> |
101 | #include <linux/ptrace.h> | ||
102 | #include <linux/slab.h> | ||
103 | #include <linux/string.h> | ||
104 | #include <linux/timer.h> | ||
105 | #include <linux/ioport.h> | ||
106 | #include <linux/netdevice.h> | ||
107 | #include <linux/if_arp.h> | ||
108 | #include <linux/etherdevice.h> | ||
109 | #include <linux/list.h> | ||
110 | #include <linux/pci.h> | 100 | #include <linux/pci.h> |
111 | #include <linux/fcntl.h> | ||
112 | |||
113 | #include <asm/uaccess.h> | ||
114 | #include <asm/io.h> | ||
115 | #include <asm/system.h> | ||
116 | 101 | ||
117 | #include "hermes.h" | ||
118 | #include "orinoco.h" | 102 | #include "orinoco.h" |
119 | 103 | ||
120 | /* All the magic there is from wlan-ng */ | 104 | /* All the magic there is from wlan-ng */ |
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c index 7ab05b89fb3f..210e73776545 100644 --- a/drivers/net/wireless/orinoco_plx.c +++ b/drivers/net/wireless/orinoco_plx.c | |||
@@ -117,29 +117,13 @@ | |||
117 | #define PFX DRIVER_NAME ": " | 117 | #define PFX DRIVER_NAME ": " |
118 | 118 | ||
119 | #include <linux/config.h> | 119 | #include <linux/config.h> |
120 | |||
121 | #include <linux/module.h> | 120 | #include <linux/module.h> |
122 | #include <linux/kernel.h> | 121 | #include <linux/kernel.h> |
123 | #include <linux/init.h> | 122 | #include <linux/init.h> |
124 | #include <linux/sched.h> | 123 | #include <linux/delay.h> |
125 | #include <linux/ptrace.h> | ||
126 | #include <linux/slab.h> | ||
127 | #include <linux/string.h> | ||
128 | #include <linux/timer.h> | ||
129 | #include <linux/ioport.h> | ||
130 | #include <asm/uaccess.h> | ||
131 | #include <asm/io.h> | ||
132 | #include <asm/system.h> | ||
133 | #include <linux/netdevice.h> | ||
134 | #include <linux/if_arp.h> | ||
135 | #include <linux/etherdevice.h> | ||
136 | #include <linux/list.h> | ||
137 | #include <linux/pci.h> | 124 | #include <linux/pci.h> |
138 | #include <linux/fcntl.h> | ||
139 | |||
140 | #include <pcmcia/cisreg.h> | 125 | #include <pcmcia/cisreg.h> |
141 | 126 | ||
142 | #include "hermes.h" | ||
143 | #include "orinoco.h" | 127 | #include "orinoco.h" |
144 | 128 | ||
145 | #define COR_OFFSET (0x3e0) /* COR attribute offset of Prism2 PC card */ | 129 | #define COR_OFFSET (0x3e0) /* COR attribute offset of Prism2 PC card */ |
diff --git a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c index 85893f42445b..5e68b7026186 100644 --- a/drivers/net/wireless/orinoco_tmd.c +++ b/drivers/net/wireless/orinoco_tmd.c | |||
@@ -53,29 +53,13 @@ | |||
53 | #define PFX DRIVER_NAME ": " | 53 | #define PFX DRIVER_NAME ": " |
54 | 54 | ||
55 | #include <linux/config.h> | 55 | #include <linux/config.h> |
56 | |||
57 | #include <linux/module.h> | 56 | #include <linux/module.h> |
58 | #include <linux/kernel.h> | 57 | #include <linux/kernel.h> |
59 | #include <linux/init.h> | 58 | #include <linux/init.h> |
60 | #include <linux/sched.h> | 59 | #include <linux/delay.h> |
61 | #include <linux/ptrace.h> | ||
62 | #include <linux/slab.h> | ||
63 | #include <linux/string.h> | ||
64 | #include <linux/timer.h> | ||
65 | #include <linux/ioport.h> | ||
66 | #include <asm/uaccess.h> | ||
67 | #include <asm/io.h> | ||
68 | #include <asm/system.h> | ||
69 | #include <linux/netdevice.h> | ||
70 | #include <linux/if_arp.h> | ||
71 | #include <linux/etherdevice.h> | ||
72 | #include <linux/list.h> | ||
73 | #include <linux/pci.h> | 60 | #include <linux/pci.h> |
74 | #include <linux/fcntl.h> | ||
75 | |||
76 | #include <pcmcia/cisreg.h> | 61 | #include <pcmcia/cisreg.h> |
77 | 62 | ||
78 | #include "hermes.h" | ||
79 | #include "orinoco.h" | 63 | #include "orinoco.h" |
80 | 64 | ||
81 | #define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ | 65 | #define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 9a8790e3580c..5c1a1adf1ff8 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -462,14 +462,12 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, | |||
462 | /* txpower is supported in dBm's */ | 462 | /* txpower is supported in dBm's */ |
463 | range->txpower_capa = IW_TXPOW_DBM; | 463 | range->txpower_capa = IW_TXPOW_DBM; |
464 | 464 | ||
465 | #if WIRELESS_EXT > 16 | ||
466 | /* Event capability (kernel + driver) */ | 465 | /* Event capability (kernel + driver) */ |
467 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | 466 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
468 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | | 467 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | |
469 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 468 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
470 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 469 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
471 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); | 470 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); |
472 | #endif /* WIRELESS_EXT > 16 */ | ||
473 | 471 | ||
474 | if (islpci_get_state(priv) < PRV_STATE_INIT) | 472 | if (islpci_get_state(priv) < PRV_STATE_INIT) |
475 | return 0; | 473 | return 0; |
@@ -693,14 +691,13 @@ prism54_get_scan(struct net_device *ndev, struct iw_request_info *info, | |||
693 | extra + dwrq->length, | 691 | extra + dwrq->length, |
694 | &(bsslist->bsslist[i]), | 692 | &(bsslist->bsslist[i]), |
695 | noise); | 693 | noise); |
696 | #if WIRELESS_EXT > 16 | 694 | |
697 | /* Check if there is space for one more entry */ | 695 | /* Check if there is space for one more entry */ |
698 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { | 696 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { |
699 | /* Ask user space to try again with a bigger buffer */ | 697 | /* Ask user space to try again with a bigger buffer */ |
700 | rvalue = -E2BIG; | 698 | rvalue = -E2BIG; |
701 | break; | 699 | break; |
702 | } | 700 | } |
703 | #endif /* WIRELESS_EXT > 16 */ | ||
704 | } | 701 | } |
705 | 702 | ||
706 | kfree(bsslist); | 703 | kfree(bsslist); |
@@ -2727,12 +2724,7 @@ const struct iw_handler_def prism54_handler_def = { | |||
2727 | .standard = (iw_handler *) prism54_handler, | 2724 | .standard = (iw_handler *) prism54_handler, |
2728 | .private = (iw_handler *) prism54_private_handler, | 2725 | .private = (iw_handler *) prism54_private_handler, |
2729 | .private_args = (struct iw_priv_args *) prism54_private_args, | 2726 | .private_args = (struct iw_priv_args *) prism54_private_args, |
2730 | #if WIRELESS_EXT > 16 | ||
2731 | .get_wireless_stats = prism54_get_wireless_stats, | 2727 | .get_wireless_stats = prism54_get_wireless_stats, |
2732 | #endif /* WIRELESS_EXT > 16 */ | ||
2733 | #if WIRELESS_EXT == 16 | ||
2734 | .spy_offset = offsetof(islpci_private, spy_data), | ||
2735 | #endif /* WIRELESS_EXT == 16 */ | ||
2736 | }; | 2728 | }; |
2737 | 2729 | ||
2738 | /* For wpa_supplicant */ | 2730 | /* For wpa_supplicant */ |
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 6f13d4a8e2d3..6c9584a9f284 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; |
@@ -839,13 +837,9 @@ islpci_setup(struct pci_dev *pdev) | |||
839 | priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? | 837 | priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? |
840 | priv->monitor_type : ARPHRD_ETHER; | 838 | priv->monitor_type : ARPHRD_ETHER; |
841 | 839 | ||
842 | #if WIRELESS_EXT > 16 | ||
843 | /* Add pointers to enable iwspy support. */ | 840 | /* Add pointers to enable iwspy support. */ |
844 | priv->wireless_data.spy_data = &priv->spy_data; | 841 | priv->wireless_data.spy_data = &priv->spy_data; |
845 | ndev->wireless_data = &priv->wireless_data; | 842 | ndev->wireless_data = &priv->wireless_data; |
846 | #else /* WIRELESS_EXT > 16 */ | ||
847 | ndev->get_wireless_stats = &prism54_get_wireless_stats; | ||
848 | #endif /* WIRELESS_EXT > 16 */ | ||
849 | 843 | ||
850 | /* save the start and end address of the PCI memory area */ | 844 | /* save the start and end address of the PCI memory area */ |
851 | ndev->mem_start = (unsigned long) priv->device_base; | 845 | ndev->mem_start = (unsigned long) priv->device_base; |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index 32a1019f1b36..efbed4397951 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -100,9 +100,7 @@ typedef struct { | |||
100 | 100 | ||
101 | struct iw_spy_data spy_data; /* iwspy support */ | 101 | struct iw_spy_data spy_data; /* iwspy support */ |
102 | 102 | ||
103 | #if WIRELESS_EXT > 16 | ||
104 | struct iw_public_data wireless_data; | 103 | struct iw_public_data wireless_data; |
105 | #endif /* WIRELESS_EXT > 16 */ | ||
106 | 104 | ||
107 | int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ | 105 | int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ |
108 | 106 | ||
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 | ||
1651 | static const iw_handler ray_handler[] = { | 1651 | static 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 | ||
1680 | static const iw_handler ray_private_handler[] = { | 1680 | static 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 | ||
1686 | static const struct iw_priv_args ray_private_args[] = { | 1686 | static 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..b1bbc8e8e91f 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -22,58 +22,23 @@ | |||
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 | |||
29 | #include <linux/module.h> | 25 | #include <linux/module.h> |
30 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
31 | #include <linux/init.h> | 27 | #include <linux/init.h> |
32 | #include <linux/sched.h> | 28 | #include <linux/delay.h> |
33 | #include <linux/ptrace.h> | 29 | #include <linux/firmware.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/string.h> | ||
36 | #include <linux/ioport.h> | ||
37 | #include <linux/netdevice.h> | ||
38 | #include <linux/if_arp.h> | ||
39 | #include <linux/etherdevice.h> | ||
40 | #include <linux/wireless.h> | ||
41 | |||
42 | #include <pcmcia/cs_types.h> | 30 | #include <pcmcia/cs_types.h> |
43 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
44 | #include <pcmcia/cistpl.h> | 32 | #include <pcmcia/cistpl.h> |
45 | #include <pcmcia/cisreg.h> | 33 | #include <pcmcia/cisreg.h> |
46 | #include <pcmcia/ds.h> | 34 | #include <pcmcia/ds.h> |
47 | 35 | ||
48 | #include <asm/uaccess.h> | ||
49 | #include <asm/io.h> | ||
50 | #include <asm/system.h> | ||
51 | |||
52 | #include "orinoco.h" | 36 | #include "orinoco.h" |
53 | 37 | ||
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> | ||
72 | static unsigned char *primsym; | 38 | static unsigned char *primsym; |
73 | static unsigned char *secsym; | 39 | static unsigned char *secsym; |
74 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 40 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
75 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 41 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; |
76 | #endif /* !SPECTRUM_FW_INCLUDED */ | ||
77 | 42 | ||
78 | /********************************************************************/ | 43 | /********************************************************************/ |
79 | /* Module stuff */ | 44 | /* Module stuff */ |
@@ -124,17 +89,8 @@ static dev_link_t *dev_list; /* = NULL */ | |||
124 | /* Function prototypes */ | 89 | /* Function prototypes */ |
125 | /********************************************************************/ | 90 | /********************************************************************/ |
126 | 91 | ||
127 | /* device methods */ | 92 | static void spectrum_cs_release(dev_link_t *link); |
128 | static int spectrum_cs_hard_reset(struct orinoco_private *priv); | 93 | static void spectrum_cs_detach(dev_link_t *link); |
129 | |||
130 | /* PCMCIA gumpf */ | ||
131 | static void spectrum_cs_config(dev_link_t * link); | ||
132 | static void spectrum_cs_release(dev_link_t * link); | ||
133 | static int spectrum_cs_event(event_t event, int priority, | ||
134 | event_callback_args_t * args); | ||
135 | |||
136 | static dev_link_t *spectrum_cs_attach(void); | ||
137 | static void spectrum_cs_detach(dev_link_t *); | ||
138 | 94 | ||
139 | /********************************************************************/ | 95 | /********************************************************************/ |
140 | /* Firmware downloader */ | 96 | /* Firmware downloader */ |
@@ -182,8 +138,8 @@ static void spectrum_cs_detach(dev_link_t *); | |||
182 | * Each block has the following structure. | 138 | * Each block has the following structure. |
183 | */ | 139 | */ |
184 | struct dblock { | 140 | struct dblock { |
185 | u32 _addr; /* adapter address where to write the block */ | 141 | __le32 _addr; /* adapter address where to write the block */ |
186 | u16 _len; /* length of the data only, in bytes */ | 142 | __le16 _len; /* length of the data only, in bytes */ |
187 | char data[0]; /* data to be written */ | 143 | char data[0]; /* data to be written */ |
188 | } __attribute__ ((packed)); | 144 | } __attribute__ ((packed)); |
189 | 145 | ||
@@ -193,9 +149,9 @@ struct dblock { | |||
193 | * items with matching ID should be written. | 149 | * items with matching ID should be written. |
194 | */ | 150 | */ |
195 | struct pdr { | 151 | struct pdr { |
196 | u32 _id; /* record ID */ | 152 | __le32 _id; /* record ID */ |
197 | u32 _addr; /* adapter address where to write the data */ | 153 | __le32 _addr; /* adapter address where to write the data */ |
198 | u32 _len; /* expected length of the data, in bytes */ | 154 | __le32 _len; /* expected length of the data, in bytes */ |
199 | char next[0]; /* next PDR starts here */ | 155 | char next[0]; /* next PDR starts here */ |
200 | } __attribute__ ((packed)); | 156 | } __attribute__ ((packed)); |
201 | 157 | ||
@@ -206,8 +162,8 @@ struct pdr { | |||
206 | * be plugged into the secondary firmware. | 162 | * be plugged into the secondary firmware. |
207 | */ | 163 | */ |
208 | struct pdi { | 164 | struct pdi { |
209 | u16 _len; /* length of ID and data, in words */ | 165 | __le16 _len; /* length of ID and data, in words */ |
210 | u16 _id; /* record ID */ | 166 | __le16 _id; /* record ID */ |
211 | char data[0]; /* plug data */ | 167 | char data[0]; /* plug data */ |
212 | } __attribute__ ((packed));; | 168 | } __attribute__ ((packed));; |
213 | 169 | ||
@@ -414,7 +370,7 @@ spectrum_plug_pdi(hermes_t *hw, struct pdr *first_pdr, struct pdi *pdi) | |||
414 | 370 | ||
415 | /* Read PDA from the adapter */ | 371 | /* Read PDA from the adapter */ |
416 | static int | 372 | static int |
417 | spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | 373 | spectrum_read_pda(hermes_t *hw, __le16 *pda, int pda_len) |
418 | { | 374 | { |
419 | int ret; | 375 | int ret; |
420 | int pda_size; | 376 | int pda_size; |
@@ -445,7 +401,7 @@ spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | |||
445 | /* Parse PDA and write the records into the adapter */ | 401 | /* Parse PDA and write the records into the adapter */ |
446 | static int | 402 | static int |
447 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, | 403 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, |
448 | u16 *pda) | 404 | __le16 *pda) |
449 | { | 405 | { |
450 | int ret; | 406 | int ret; |
451 | struct pdi *pdi; | 407 | struct pdi *pdi; |
@@ -511,7 +467,7 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link, | |||
511 | const struct dblock *first_block; | 467 | const struct dblock *first_block; |
512 | 468 | ||
513 | /* Plug Data Area (PDA) */ | 469 | /* Plug Data Area (PDA) */ |
514 | u16 pda[PDA_WORDS]; | 470 | __le16 pda[PDA_WORDS]; |
515 | 471 | ||
516 | /* Binary block begins after the 0x1A marker */ | 472 | /* Binary block begins after the 0x1A marker */ |
517 | ptr = image; | 473 | ptr = image; |
@@ -571,8 +527,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
571 | { | 527 | { |
572 | int ret; | 528 | int ret; |
573 | client_handle_t handle = link->handle; | 529 | client_handle_t handle = link->handle; |
574 | |||
575 | #ifndef SPECTRUM_FW_INCLUDED | ||
576 | const struct firmware *fw_entry; | 530 | const struct firmware *fw_entry; |
577 | 531 | ||
578 | if (request_firmware(&fw_entry, primary_fw_name, | 532 | if (request_firmware(&fw_entry, primary_fw_name, |
@@ -592,7 +546,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
592 | secondary_fw_name); | 546 | secondary_fw_name); |
593 | return -ENOENT; | 547 | return -ENOENT; |
594 | } | 548 | } |
595 | #endif | ||
596 | 549 | ||
597 | /* Load primary firmware */ | 550 | /* Load primary firmware */ |
598 | ret = spectrum_dl_image(hw, link, primsym); | 551 | ret = spectrum_dl_image(hw, link, primsym); |
@@ -1085,7 +1038,7 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
1085 | static struct pcmcia_device_id spectrum_cs_ids[] = { | 1038 | static struct pcmcia_device_id spectrum_cs_ids[] = { |
1086 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ | 1039 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ |
1087 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ | 1040 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ |
1088 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), /* Intel PRO/Wireless 2011B */ | 1041 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ |
1089 | PCMCIA_DEVICE_NULL, | 1042 | PCMCIA_DEVICE_NULL, |
1090 | }; | 1043 | }; |
1091 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); | 1044 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); |
@@ -1096,8 +1049,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
1096 | .name = DRIVER_NAME, | 1049 | .name = DRIVER_NAME, |
1097 | }, | 1050 | }, |
1098 | .attach = spectrum_cs_attach, | 1051 | .attach = spectrum_cs_attach, |
1099 | .event = spectrum_cs_event, | ||
1100 | .detach = spectrum_cs_detach, | 1052 | .detach = spectrum_cs_detach, |
1053 | .event = spectrum_cs_event, | ||
1101 | .id_table = spectrum_cs_ids, | 1054 | .id_table = spectrum_cs_ids, |
1102 | }; | 1055 | }; |
1103 | 1056 | ||
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 7a5e20a17890..b0d8b5b03152 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -430,7 +430,6 @@ static void fee_read(unsigned long ioaddr, /* I/O port of the card */ | |||
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | #ifdef WIRELESS_EXT /* if the wireless extension exists in the kernel */ | ||
434 | 433 | ||
435 | /*------------------------------------------------------------------*/ | 434 | /*------------------------------------------------------------------*/ |
436 | /* | 435 | /* |
@@ -514,7 +513,6 @@ static void fee_write(unsigned long ioaddr, /* I/O port of the card */ | |||
514 | fee_wait(ioaddr, 10, 100); | 513 | fee_wait(ioaddr, 10, 100); |
515 | #endif /* EEPROM_IS_PROTECTED */ | 514 | #endif /* EEPROM_IS_PROTECTED */ |
516 | } | 515 | } |
517 | #endif /* WIRELESS_EXT */ | ||
518 | 516 | ||
519 | /************************ I82586 SUBROUTINES *************************/ | 517 | /************************ I82586 SUBROUTINES *************************/ |
520 | /* | 518 | /* |
@@ -973,11 +971,9 @@ static void wv_mmc_show(struct net_device * dev) | |||
973 | mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m)); | 971 | mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m)); |
974 | mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0); | 972 | mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0); |
975 | 973 | ||
976 | #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */ | ||
977 | /* Don't forget to update statistics */ | 974 | /* Don't forget to update statistics */ |
978 | lp->wstats.discard.nwid += | 975 | lp->wstats.discard.nwid += |
979 | (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; | 976 | (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; |
980 | #endif /* WIRELESS_EXT */ | ||
981 | 977 | ||
982 | printk(KERN_DEBUG "##### WaveLAN modem status registers: #####\n"); | 978 | printk(KERN_DEBUG "##### WaveLAN modem status registers: #####\n"); |
983 | #ifdef DEBUG_SHOW_UNUSED | 979 | #ifdef DEBUG_SHOW_UNUSED |
@@ -1499,7 +1495,6 @@ static int wavelan_set_mac_address(struct net_device * dev, void *addr) | |||
1499 | } | 1495 | } |
1500 | #endif /* SET_MAC_ADDRESS */ | 1496 | #endif /* SET_MAC_ADDRESS */ |
1501 | 1497 | ||
1502 | #ifdef WIRELESS_EXT /* if wireless extensions exist in the kernel */ | ||
1503 | 1498 | ||
1504 | /*------------------------------------------------------------------*/ | 1499 | /*------------------------------------------------------------------*/ |
1505 | /* | 1500 | /* |
@@ -2473,7 +2468,6 @@ static iw_stats *wavelan_get_wireless_stats(struct net_device * dev) | |||
2473 | #endif | 2468 | #endif |
2474 | return &lp->wstats; | 2469 | return &lp->wstats; |
2475 | } | 2470 | } |
2476 | #endif /* WIRELESS_EXT */ | ||
2477 | 2471 | ||
2478 | /************************* PACKET RECEPTION *************************/ | 2472 | /************************* PACKET RECEPTION *************************/ |
2479 | /* | 2473 | /* |
@@ -4194,11 +4188,9 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr) | |||
4194 | dev->set_mac_address = &wavelan_set_mac_address; | 4188 | dev->set_mac_address = &wavelan_set_mac_address; |
4195 | #endif /* SET_MAC_ADDRESS */ | 4189 | #endif /* SET_MAC_ADDRESS */ |
4196 | 4190 | ||
4197 | #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */ | ||
4198 | dev->wireless_handlers = &wavelan_handler_def; | 4191 | dev->wireless_handlers = &wavelan_handler_def; |
4199 | lp->wireless_data.spy_data = &lp->spy_data; | 4192 | lp->wireless_data.spy_data = &lp->spy_data; |
4200 | dev->wireless_data = &lp->wireless_data; | 4193 | dev->wireless_data = &lp->wireless_data; |
4201 | #endif | ||
4202 | 4194 | ||
4203 | dev->mtu = WAVELAN_MTU; | 4195 | dev->mtu = WAVELAN_MTU; |
4204 | 4196 | ||
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h index 509ff22a6caa..166e28b9a4f7 100644 --- a/drivers/net/wireless/wavelan.p.h +++ b/drivers/net/wireless/wavelan.p.h | |||
@@ -409,11 +409,9 @@ | |||
409 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */ | 409 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */ |
410 | #undef SET_MAC_ADDRESS /* Experimental */ | 410 | #undef SET_MAC_ADDRESS /* Experimental */ |
411 | 411 | ||
412 | #ifdef WIRELESS_EXT /* If wireless extensions exist in the kernel */ | ||
413 | /* Warning: this stuff will slow down the driver. */ | 412 | /* Warning: this stuff will slow down the driver. */ |
414 | #define WIRELESS_SPY /* Enable spying addresses. */ | 413 | #define WIRELESS_SPY /* Enable spying addresses. */ |
415 | #undef HISTOGRAM /* Enable histogram of signal level. */ | 414 | #undef HISTOGRAM /* Enable histogram of signal level. */ |
416 | #endif | ||
417 | 415 | ||
418 | /****************************** DEBUG ******************************/ | 416 | /****************************** DEBUG ******************************/ |
419 | 417 | ||
@@ -506,12 +504,10 @@ struct net_local | |||
506 | u_short tx_first_free; | 504 | u_short tx_first_free; |
507 | u_short tx_first_in_use; | 505 | u_short tx_first_in_use; |
508 | 506 | ||
509 | #ifdef WIRELESS_EXT | ||
510 | iw_stats wstats; /* Wireless-specific statistics */ | 507 | iw_stats wstats; /* Wireless-specific statistics */ |
511 | 508 | ||
512 | struct iw_spy_data spy_data; | 509 | struct iw_spy_data spy_data; |
513 | struct iw_public_data wireless_data; | 510 | struct iw_public_data wireless_data; |
514 | #endif | ||
515 | 511 | ||
516 | #ifdef HISTOGRAM | 512 | #ifdef HISTOGRAM |
517 | int his_number; /* number of intervals */ | 513 | int his_number; /* number of intervals */ |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 183c4732ef65..4b3c98f5c564 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -415,7 +415,6 @@ fee_read(u_long base, /* i/o port of the card */ | |||
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
419 | 418 | ||
420 | /*------------------------------------------------------------------*/ | 419 | /*------------------------------------------------------------------*/ |
421 | /* | 420 | /* |
@@ -500,7 +499,6 @@ fee_write(u_long base, /* i/o port of the card */ | |||
500 | fee_wait(base, 10, 100); | 499 | fee_wait(base, 10, 100); |
501 | #endif /* EEPROM_IS_PROTECTED */ | 500 | #endif /* EEPROM_IS_PROTECTED */ |
502 | } | 501 | } |
503 | #endif /* WIRELESS_EXT */ | ||
504 | 502 | ||
505 | /******************* WaveLAN Roaming routines... ********************/ | 503 | /******************* WaveLAN Roaming routines... ********************/ |
506 | 504 | ||
@@ -1161,10 +1159,8 @@ wv_mmc_show(struct net_device * dev) | |||
1161 | mmc_read(base, 0, (u_char *)&m, sizeof(m)); | 1159 | mmc_read(base, 0, (u_char *)&m, sizeof(m)); |
1162 | mmc_out(base, mmwoff(0, mmw_freeze), 0); | 1160 | mmc_out(base, mmwoff(0, mmw_freeze), 0); |
1163 | 1161 | ||
1164 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
1165 | /* Don't forget to update statistics */ | 1162 | /* Don't forget to update statistics */ |
1166 | lp->wstats.discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; | 1163 | lp->wstats.discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; |
1167 | #endif /* WIRELESS_EXT */ | ||
1168 | 1164 | ||
1169 | spin_unlock_irqrestore(&lp->spinlock, flags); | 1165 | spin_unlock_irqrestore(&lp->spinlock, flags); |
1170 | 1166 | ||
@@ -1550,7 +1546,6 @@ wavelan_set_mac_address(struct net_device * dev, | |||
1550 | } | 1546 | } |
1551 | #endif /* SET_MAC_ADDRESS */ | 1547 | #endif /* SET_MAC_ADDRESS */ |
1552 | 1548 | ||
1553 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
1554 | 1549 | ||
1555 | /*------------------------------------------------------------------*/ | 1550 | /*------------------------------------------------------------------*/ |
1556 | /* | 1551 | /* |
@@ -2793,7 +2788,6 @@ wavelan_get_wireless_stats(struct net_device * dev) | |||
2793 | #endif | 2788 | #endif |
2794 | return &lp->wstats; | 2789 | return &lp->wstats; |
2795 | } | 2790 | } |
2796 | #endif /* WIRELESS_EXT */ | ||
2797 | 2791 | ||
2798 | /************************* PACKET RECEPTION *************************/ | 2792 | /************************* PACKET RECEPTION *************************/ |
2799 | /* | 2793 | /* |
@@ -4679,11 +4673,9 @@ wavelan_attach(void) | |||
4679 | dev->watchdog_timeo = WATCHDOG_JIFFIES; | 4673 | dev->watchdog_timeo = WATCHDOG_JIFFIES; |
4680 | SET_ETHTOOL_OPS(dev, &ops); | 4674 | SET_ETHTOOL_OPS(dev, &ops); |
4681 | 4675 | ||
4682 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
4683 | dev->wireless_handlers = &wavelan_handler_def; | 4676 | dev->wireless_handlers = &wavelan_handler_def; |
4684 | lp->wireless_data.spy_data = &lp->spy_data; | 4677 | lp->wireless_data.spy_data = &lp->spy_data; |
4685 | dev->wireless_data = &lp->wireless_data; | 4678 | dev->wireless_data = &lp->wireless_data; |
4686 | #endif | ||
4687 | 4679 | ||
4688 | /* Other specific data */ | 4680 | /* Other specific data */ |
4689 | dev->mtu = WAVELAN_MTU; | 4681 | dev->mtu = WAVELAN_MTU; |
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index 01d882be8790..724a715089c9 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h | |||
@@ -472,11 +472,9 @@ | |||
472 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical) */ | 472 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical) */ |
473 | #undef SET_MAC_ADDRESS /* Experimental */ | 473 | #undef SET_MAC_ADDRESS /* Experimental */ |
474 | 474 | ||
475 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
476 | /* Warning : these stuff will slow down the driver... */ | 475 | /* Warning : these stuff will slow down the driver... */ |
477 | #define WIRELESS_SPY /* Enable spying addresses */ | 476 | #define WIRELESS_SPY /* Enable spying addresses */ |
478 | #undef HISTOGRAM /* Enable histogram of sig level... */ | 477 | #undef HISTOGRAM /* Enable histogram of sig level... */ |
479 | #endif | ||
480 | 478 | ||
481 | /****************************** DEBUG ******************************/ | 479 | /****************************** DEBUG ******************************/ |
482 | 480 | ||
@@ -624,12 +622,10 @@ struct net_local | |||
624 | int rfp; /* Last DMA machine receive pointer */ | 622 | int rfp; /* Last DMA machine receive pointer */ |
625 | int overrunning; /* Receiver overrun flag */ | 623 | int overrunning; /* Receiver overrun flag */ |
626 | 624 | ||
627 | #ifdef WIRELESS_EXT | ||
628 | iw_stats wstats; /* Wireless specific stats */ | 625 | iw_stats wstats; /* Wireless specific stats */ |
629 | 626 | ||
630 | struct iw_spy_data spy_data; | 627 | struct iw_spy_data spy_data; |
631 | struct iw_public_data wireless_data; | 628 | struct iw_public_data wireless_data; |
632 | #endif | ||
633 | 629 | ||
634 | #ifdef HISTOGRAM | 630 | #ifdef HISTOGRAM |
635 | int his_number; /* Number of intervals */ | 631 | int his_number; /* Number of intervals */ |
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 | ||
549 | struct wl3501_80211_tx_hdr { | 549 | struct 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 | /* |
diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h index 04fa7dff079c..300d704bdb9a 100644 --- a/include/linux/cyclomx.h +++ b/include/linux/cyclomx.h | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <linux/cycx_x25.h> | 37 | #include <linux/cycx_x25.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0) | ||
41 | |||
42 | /* Adapter Data Space. | 40 | /* Adapter Data Space. |
43 | * This structure is needed because we handle multiple cards, otherwise | 41 | * This structure is needed because we handle multiple cards, otherwise |
44 | * static data would do it. | 42 | * static data would do it. |
diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h index 6621df86a748..12fe6b0bfcff 100644 --- a/include/linux/cycx_drv.h +++ b/include/linux/cycx_drv.h | |||
@@ -60,6 +60,5 @@ extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len); | |||
60 | extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len); | 60 | extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len); |
61 | extern int cycx_exec(void __iomem *addr); | 61 | extern int cycx_exec(void __iomem *addr); |
62 | 62 | ||
63 | extern void cycx_inten(struct cycx_hw *hw); | ||
64 | extern void cycx_intr(struct cycx_hw *hw); | 63 | extern void cycx_intr(struct cycx_hw *hw); |
65 | #endif /* _CYCX_DRV_H */ | 64 | #endif /* _CYCX_DRV_H */ |
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h index 2ef0b21517fb..1c7a0dd5536a 100644 --- a/include/linux/ibmtr.h +++ b/include/linux/ibmtr.h | |||
@@ -7,8 +7,8 @@ | |||
7 | /* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ | 7 | /* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ |
8 | 8 | ||
9 | #define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */ | 9 | #define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */ |
10 | #define TR_RST_TIME (HZ/20) /* 5 on PC = 50 ms */ | 10 | #define TR_RST_TIME (msecs_to_jiffies(50)) /* 5 on PC = 50 ms */ |
11 | #define TR_BUSY_INTERVAL (HZ/5) /* 5 on PC = 200 ms */ | 11 | #define TR_BUSY_INTERVAL (msecs_to_jiffies(200)) /* 5 on PC = 200 ms */ |
12 | #define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ | 12 | #define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ |
13 | 13 | ||
14 | #define TR_ISA 1 | 14 | #define TR_ISA 1 |
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 0856548a2a08..a8b1a2071838 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
@@ -84,6 +84,7 @@ | |||
84 | #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ | 84 | #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ |
85 | #define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ | 85 | #define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ |
86 | #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ | 86 | #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ |
87 | #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ | ||
87 | 88 | ||
88 | #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ | 89 | #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ |
89 | #define ARPHRD_NONE 0xFFFE /* zero header length */ | 90 | #define ARPHRD_NONE 0xFFFE /* zero header length */ |
diff --git a/include/linux/mii.h b/include/linux/mii.h index 9b8d0476988a..68f5a0f392dd 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h | |||
@@ -158,6 +158,7 @@ extern int mii_link_ok (struct mii_if_info *mii); | |||
158 | extern int mii_nway_restart (struct mii_if_info *mii); | 158 | extern int mii_nway_restart (struct mii_if_info *mii); |
159 | extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); | 159 | extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); |
160 | extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); | 160 | extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); |
161 | extern int mii_check_gmii_support(struct mii_if_info *mii); | ||
161 | extern void mii_check_link (struct mii_if_info *mii); | 162 | extern void mii_check_link (struct mii_if_info *mii); |
162 | extern unsigned int mii_check_media (struct mii_if_info *mii, | 163 | extern unsigned int mii_check_media (struct mii_if_info *mii, |
163 | unsigned int ok_to_print, | 164 | unsigned int ok_to_print, |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 368e4c825ff1..a9281b24c40b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -873,11 +873,9 @@ static inline void netif_rx_complete(struct net_device *dev) | |||
873 | 873 | ||
874 | static inline void netif_poll_disable(struct net_device *dev) | 874 | static inline void netif_poll_disable(struct net_device *dev) |
875 | { | 875 | { |
876 | while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) { | 876 | while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) |
877 | /* No hurry. */ | 877 | /* No hurry. */ |
878 | current->state = TASK_INTERRUPTIBLE; | 878 | schedule_timeout_interruptible(1); |
879 | schedule_timeout(1); | ||
880 | } | ||
881 | } | 879 | } |
882 | 880 | ||
883 | static inline void netif_poll_enable(struct net_device *dev) | 881 | static inline void netif_poll_enable(struct net_device *dev) |
diff --git a/include/linux/sdladrv.h b/include/linux/sdladrv.h index 78f634007fc6..c85e103d5e7b 100644 --- a/include/linux/sdladrv.h +++ b/include/linux/sdladrv.h | |||
@@ -52,12 +52,8 @@ typedef struct sdlahw | |||
52 | 52 | ||
53 | extern int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len); | 53 | extern int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len); |
54 | extern int sdla_down (sdlahw_t* hw); | 54 | extern int sdla_down (sdlahw_t* hw); |
55 | extern int sdla_inten (sdlahw_t* hw); | ||
56 | extern int sdla_intde (sdlahw_t* hw); | ||
57 | extern int sdla_intack (sdlahw_t* hw); | ||
58 | extern void S514_intack (sdlahw_t* hw, u32 int_status); | 55 | extern void S514_intack (sdlahw_t* hw, u32 int_status); |
59 | extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status); | 56 | extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status); |
60 | extern int sdla_intr (sdlahw_t* hw); | ||
61 | extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr); | 57 | extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr); |
62 | extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, | 58 | extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, |
63 | unsigned len); | 59 | unsigned len); |
diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h index 167d956c492b..dae9860091dd 100644 --- a/include/linux/wanpipe.h +++ b/include/linux/wanpipe.h | |||
@@ -265,15 +265,6 @@ typedef struct { | |||
265 | #include <linux/tty_driver.h> | 265 | #include <linux/tty_driver.h> |
266 | #include <linux/tty_flip.h> | 266 | #include <linux/tty_flip.h> |
267 | 267 | ||
268 | |||
269 | #define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0) | ||
270 | #define is_alpha(ch) ((((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'z')||\ | ||
271 | ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'Z'))?1:0) | ||
272 | #define is_hex_digit(ch) ((((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')||\ | ||
273 | ((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'f')||\ | ||
274 | ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'F'))?1:0) | ||
275 | |||
276 | |||
277 | /****** Data Structures *****************************************************/ | 268 | /****** Data Structures *****************************************************/ |
278 | 269 | ||
279 | /* Adapter Data Space. | 270 | /* Adapter Data Space. |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index dc36b1be6745..4851756202c5 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -11,19 +11,26 @@ | |||
11 | * | 11 | * |
12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | 12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos |
13 | * <jketreno@linux.intel.com> | 13 | * <jketreno@linux.intel.com> |
14 | * Copyright (c) 2004, Intel Corporation | 14 | * Copyright (c) 2004-2005, Intel Corporation |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or modify | 16 | * This program is free software; you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License version 2 as | 17 | * it under the terms of the GNU General Public License version 2 as |
18 | * published by the Free Software Foundation. See README and COPYING for | 18 | * published by the Free Software Foundation. See README and COPYING for |
19 | * more details. | 19 | * more details. |
20 | * | ||
21 | * API Version History | ||
22 | * 1.0.x -- Initial version | ||
23 | * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs, | ||
24 | * various structure changes, and crypto API init method | ||
20 | */ | 25 | */ |
21 | #ifndef IEEE80211_H | 26 | #ifndef IEEE80211_H |
22 | #define IEEE80211_H | 27 | #define IEEE80211_H |
23 | #include <linux/if_ether.h> /* ETH_ALEN */ | 28 | #include <linux/if_ether.h> /* ETH_ALEN */ |
24 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
25 | #include <linux/wireless.h> | 30 | #include <linux/wireless.h> |
26 | 31 | ||
32 | #define IEEE80211_VERSION "git-1.1.5" | ||
33 | |||
27 | #define IEEE80211_DATA_LEN 2304 | 34 | #define IEEE80211_DATA_LEN 2304 |
28 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
29 | 6.2.1.1.2. | 36 | 6.2.1.1.2. |
@@ -33,34 +40,13 @@ | |||
33 | represents the 2304 bytes of real data, plus a possible 8 bytes of | 40 | represents the 2304 bytes of real data, plus a possible 8 bytes of |
34 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ | 41 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ |
35 | 42 | ||
36 | |||
37 | #define IEEE80211_HLEN 30 | ||
38 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
39 | |||
40 | struct ieee80211_hdr { | ||
41 | __le16 frame_ctl; | ||
42 | __le16 duration_id; | ||
43 | u8 addr1[ETH_ALEN]; | ||
44 | u8 addr2[ETH_ALEN]; | ||
45 | u8 addr3[ETH_ALEN]; | ||
46 | __le16 seq_ctl; | ||
47 | u8 addr4[ETH_ALEN]; | ||
48 | } __attribute__ ((packed)); | ||
49 | |||
50 | struct ieee80211_hdr_3addr { | ||
51 | __le16 frame_ctl; | ||
52 | __le16 duration_id; | ||
53 | u8 addr1[ETH_ALEN]; | ||
54 | u8 addr2[ETH_ALEN]; | ||
55 | u8 addr3[ETH_ALEN]; | ||
56 | __le16 seq_ctl; | ||
57 | } __attribute__ ((packed)); | ||
58 | |||
59 | #define IEEE80211_1ADDR_LEN 10 | 43 | #define IEEE80211_1ADDR_LEN 10 |
60 | #define IEEE80211_2ADDR_LEN 16 | 44 | #define IEEE80211_2ADDR_LEN 16 |
61 | #define IEEE80211_3ADDR_LEN 24 | 45 | #define IEEE80211_3ADDR_LEN 24 |
62 | #define IEEE80211_4ADDR_LEN 30 | 46 | #define IEEE80211_4ADDR_LEN 30 |
63 | #define IEEE80211_FCS_LEN 4 | 47 | #define IEEE80211_FCS_LEN 4 |
48 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
49 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
64 | 50 | ||
65 | #define MIN_FRAG_THRESHOLD 256U | 51 | #define MIN_FRAG_THRESHOLD 256U |
66 | #define MAX_FRAG_THRESHOLD 2346U | 52 | #define MAX_FRAG_THRESHOLD 2346U |
@@ -113,11 +99,11 @@ struct ieee80211_hdr_3addr { | |||
113 | #define IEEE80211_STYPE_CFACK 0x0050 | 99 | #define IEEE80211_STYPE_CFACK 0x0050 |
114 | #define IEEE80211_STYPE_CFPOLL 0x0060 | 100 | #define IEEE80211_STYPE_CFPOLL 0x0060 |
115 | #define IEEE80211_STYPE_CFACKPOLL 0x0070 | 101 | #define IEEE80211_STYPE_CFACKPOLL 0x0070 |
102 | #define IEEE80211_STYPE_QOS_DATA 0x0080 | ||
116 | 103 | ||
117 | #define IEEE80211_SCTL_FRAG 0x000F | 104 | #define IEEE80211_SCTL_FRAG 0x000F |
118 | #define IEEE80211_SCTL_SEQ 0xFFF0 | 105 | #define IEEE80211_SCTL_SEQ 0xFFF0 |
119 | 106 | ||
120 | |||
121 | /* debug macros */ | 107 | /* debug macros */ |
122 | 108 | ||
123 | #ifdef CONFIG_IEEE80211_DEBUG | 109 | #ifdef CONFIG_IEEE80211_DEBUG |
@@ -128,8 +114,7 @@ do { if (ieee80211_debug_level & (level)) \ | |||
128 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 114 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) |
129 | #else | 115 | #else |
130 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 116 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
131 | #endif /* CONFIG_IEEE80211_DEBUG */ | 117 | #endif /* CONFIG_IEEE80211_DEBUG */ |
132 | |||
133 | 118 | ||
134 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ | 119 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ |
135 | 120 | ||
@@ -140,7 +125,6 @@ do { if (ieee80211_debug_level & (level)) \ | |||
140 | * messages. It should never be used for passing essid to user space. */ | 125 | * messages. It should never be used for passing essid to user space. */ |
141 | const char *escape_essid(const char *essid, u8 essid_len); | 126 | const char *escape_essid(const char *essid, u8 essid_len); |
142 | 127 | ||
143 | |||
144 | /* | 128 | /* |
145 | * To use the debug system: | 129 | * To use the debug system: |
146 | * | 130 | * |
@@ -177,6 +161,7 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
177 | 161 | ||
178 | #define IEEE80211_DL_TX (1<<8) | 162 | #define IEEE80211_DL_TX (1<<8) |
179 | #define IEEE80211_DL_RX (1<<9) | 163 | #define IEEE80211_DL_RX (1<<9) |
164 | #define IEEE80211_DL_QOS (1<<31) | ||
180 | 165 | ||
181 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) | 166 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) |
182 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) | 167 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) |
@@ -190,9 +175,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
190 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) | 175 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) |
191 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) | 176 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) |
192 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) | 177 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) |
178 | #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) | ||
193 | #include <linux/netdevice.h> | 179 | #include <linux/netdevice.h> |
194 | #include <linux/wireless.h> | 180 | #include <linux/wireless.h> |
195 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ | 181 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ |
196 | 182 | ||
197 | #ifndef WIRELESS_SPY | 183 | #ifndef WIRELESS_SPY |
198 | #define WIRELESS_SPY /* enable iwspy support */ | 184 | #define WIRELESS_SPY /* enable iwspy support */ |
@@ -200,10 +186,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
200 | #include <net/iw_handler.h> /* new driver API */ | 186 | #include <net/iw_handler.h> /* new driver API */ |
201 | 187 | ||
202 | #ifndef ETH_P_PAE | 188 | #ifndef ETH_P_PAE |
203 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | 189 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
204 | #endif /* ETH_P_PAE */ | 190 | #endif /* ETH_P_PAE */ |
205 | 191 | ||
206 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ | 192 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ |
207 | 193 | ||
208 | #ifndef ETH_P_80211_RAW | 194 | #ifndef ETH_P_80211_RAW |
209 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) | 195 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) |
@@ -215,10 +201,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
215 | 201 | ||
216 | struct ieee80211_snap_hdr { | 202 | struct ieee80211_snap_hdr { |
217 | 203 | ||
218 | u8 dsap; /* always 0xAA */ | 204 | u8 dsap; /* always 0xAA */ |
219 | u8 ssap; /* always 0xAA */ | 205 | u8 ssap; /* always 0xAA */ |
220 | u8 ctrl; /* always 0x03 */ | 206 | u8 ctrl; /* always 0x03 */ |
221 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ | 207 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ |
222 | 208 | ||
223 | } __attribute__ ((packed)); | 209 | } __attribute__ ((packed)); |
224 | 210 | ||
@@ -246,8 +232,9 @@ struct ieee80211_snap_hdr { | |||
246 | #define WLAN_CAPABILITY_PBCC (1<<6) | 232 | #define WLAN_CAPABILITY_PBCC (1<<6) |
247 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) | 233 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) |
248 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) | 234 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) |
235 | #define WLAN_CAPABILITY_QOS (1<<9) | ||
249 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 236 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
250 | #define WLAN_CAPABILITY_OSSS_OFDM (1<<13) | 237 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
251 | 238 | ||
252 | /* Status codes */ | 239 | /* Status codes */ |
253 | enum ieee80211_statuscode { | 240 | enum ieee80211_statuscode { |
@@ -312,14 +299,12 @@ enum ieee80211_reasoncode { | |||
312 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 299 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
313 | }; | 300 | }; |
314 | 301 | ||
315 | |||
316 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 302 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
317 | #define IEEE80211_STATMASK_RSSI (1<<1) | 303 | #define IEEE80211_STATMASK_RSSI (1<<1) |
318 | #define IEEE80211_STATMASK_NOISE (1<<2) | 304 | #define IEEE80211_STATMASK_NOISE (1<<2) |
319 | #define IEEE80211_STATMASK_RATE (1<<3) | 305 | #define IEEE80211_STATMASK_RATE (1<<3) |
320 | #define IEEE80211_STATMASK_WEMASK 0x7 | 306 | #define IEEE80211_STATMASK_WEMASK 0x7 |
321 | 307 | ||
322 | |||
323 | #define IEEE80211_CCK_MODULATION (1<<0) | 308 | #define IEEE80211_CCK_MODULATION (1<<0) |
324 | #define IEEE80211_OFDM_MODULATION (1<<1) | 309 | #define IEEE80211_OFDM_MODULATION (1<<1) |
325 | 310 | ||
@@ -377,9 +362,6 @@ enum ieee80211_reasoncode { | |||
377 | #define IEEE80211_NUM_CCK_RATES 4 | 362 | #define IEEE80211_NUM_CCK_RATES 4 |
378 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 | 363 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 |
379 | 364 | ||
380 | |||
381 | |||
382 | |||
383 | /* NOTE: This data is for statistical purposes; not all hardware provides this | 365 | /* NOTE: This data is for statistical purposes; not all hardware provides this |
384 | * information for frames received. Not setting these will not cause | 366 | * information for frames received. Not setting these will not cause |
385 | * any adverse affects. */ | 367 | * any adverse affects. */ |
@@ -388,7 +370,7 @@ struct ieee80211_rx_stats { | |||
388 | s8 rssi; | 370 | s8 rssi; |
389 | u8 signal; | 371 | u8 signal; |
390 | u8 noise; | 372 | u8 noise; |
391 | u16 rate; /* in 100 kbps */ | 373 | u16 rate; /* in 100 kbps */ |
392 | u8 received_channel; | 374 | u8 received_channel; |
393 | u8 control; | 375 | u8 control; |
394 | u8 mask; | 376 | u8 mask; |
@@ -439,38 +421,44 @@ struct ieee80211_device; | |||
439 | 421 | ||
440 | #include "ieee80211_crypt.h" | 422 | #include "ieee80211_crypt.h" |
441 | 423 | ||
442 | #define SEC_KEY_1 (1<<0) | 424 | #define SEC_KEY_1 (1<<0) |
443 | #define SEC_KEY_2 (1<<1) | 425 | #define SEC_KEY_2 (1<<1) |
444 | #define SEC_KEY_3 (1<<2) | 426 | #define SEC_KEY_3 (1<<2) |
445 | #define SEC_KEY_4 (1<<3) | 427 | #define SEC_KEY_4 (1<<3) |
446 | #define SEC_ACTIVE_KEY (1<<4) | 428 | #define SEC_ACTIVE_KEY (1<<4) |
447 | #define SEC_AUTH_MODE (1<<5) | 429 | #define SEC_AUTH_MODE (1<<5) |
448 | #define SEC_UNICAST_GROUP (1<<6) | 430 | #define SEC_UNICAST_GROUP (1<<6) |
449 | #define SEC_LEVEL (1<<7) | 431 | #define SEC_LEVEL (1<<7) |
450 | #define SEC_ENABLED (1<<8) | 432 | #define SEC_ENABLED (1<<8) |
451 | 433 | #define SEC_ENCRYPT (1<<9) | |
452 | #define SEC_LEVEL_0 0 /* None */ | 434 | |
453 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ | 435 | #define SEC_LEVEL_0 0 /* None */ |
454 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ | 436 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ |
455 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ | 437 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ |
456 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | 438 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ |
457 | 439 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | |
458 | #define WEP_KEYS 4 | 440 | |
459 | #define WEP_KEY_LEN 13 | 441 | #define SEC_ALG_NONE 0 |
442 | #define SEC_ALG_WEP 1 | ||
443 | #define SEC_ALG_TKIP 2 | ||
444 | #define SEC_ALG_CCMP 3 | ||
445 | |||
446 | #define WEP_KEYS 4 | ||
447 | #define WEP_KEY_LEN 13 | ||
448 | #define SCM_KEY_LEN 32 | ||
449 | #define SCM_TEMPORAL_KEY_LENGTH 16 | ||
460 | 450 | ||
461 | struct ieee80211_security { | 451 | struct ieee80211_security { |
462 | u16 active_key:2, | 452 | u16 active_key:2, |
463 | enabled:1, | 453 | enabled:1, |
464 | auth_mode:2, | 454 | auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1; |
465 | auth_algo:4, | 455 | u8 encode_alg[WEP_KEYS]; |
466 | unicast_uses_group:1; | ||
467 | u8 key_sizes[WEP_KEYS]; | 456 | u8 key_sizes[WEP_KEYS]; |
468 | u8 keys[WEP_KEYS][WEP_KEY_LEN]; | 457 | u8 keys[WEP_KEYS][SCM_KEY_LEN]; |
469 | u8 level; | 458 | u8 level; |
470 | u16 flags; | 459 | u16 flags; |
471 | } __attribute__ ((packed)); | 460 | } __attribute__ ((packed)); |
472 | 461 | ||
473 | |||
474 | /* | 462 | /* |
475 | 463 | ||
476 | 802.11 data frame from AP | 464 | 802.11 data frame from AP |
@@ -494,7 +482,7 @@ enum ieee80211_mfie { | |||
494 | MFIE_TYPE_RATES = 1, | 482 | MFIE_TYPE_RATES = 1, |
495 | MFIE_TYPE_FH_SET = 2, | 483 | MFIE_TYPE_FH_SET = 2, |
496 | MFIE_TYPE_DS_SET = 3, | 484 | MFIE_TYPE_DS_SET = 3, |
497 | MFIE_TYPE_CF_SET = 4, | 485 | MFIE_TYPE_CF_SET = 4, |
498 | MFIE_TYPE_TIM = 5, | 486 | MFIE_TYPE_TIM = 5, |
499 | MFIE_TYPE_IBSS_SET = 6, | 487 | MFIE_TYPE_IBSS_SET = 6, |
500 | MFIE_TYPE_COUNTRY = 7, | 488 | MFIE_TYPE_COUNTRY = 7, |
@@ -516,11 +504,75 @@ enum ieee80211_mfie { | |||
516 | MFIE_TYPE_RSN = 48, | 504 | MFIE_TYPE_RSN = 48, |
517 | MFIE_TYPE_RATES_EX = 50, | 505 | MFIE_TYPE_RATES_EX = 50, |
518 | MFIE_TYPE_GENERIC = 221, | 506 | MFIE_TYPE_GENERIC = 221, |
507 | MFIE_TYPE_QOS_PARAMETER = 222, | ||
519 | }; | 508 | }; |
520 | 509 | ||
521 | struct ieee80211_info_element_hdr { | 510 | /* Minimal header; can be used for passing 802.11 frames with sufficient |
522 | u8 id; | 511 | * information to determine what type of underlying data type is actually |
523 | u8 len; | 512 | * stored in the data. */ |
513 | struct ieee80211_hdr { | ||
514 | __le16 frame_ctl; | ||
515 | __le16 duration_id; | ||
516 | u8 payload[0]; | ||
517 | } __attribute__ ((packed)); | ||
518 | |||
519 | struct ieee80211_hdr_1addr { | ||
520 | __le16 frame_ctl; | ||
521 | __le16 duration_id; | ||
522 | u8 addr1[ETH_ALEN]; | ||
523 | u8 payload[0]; | ||
524 | } __attribute__ ((packed)); | ||
525 | |||
526 | struct ieee80211_hdr_2addr { | ||
527 | __le16 frame_ctl; | ||
528 | __le16 duration_id; | ||
529 | u8 addr1[ETH_ALEN]; | ||
530 | u8 addr2[ETH_ALEN]; | ||
531 | u8 payload[0]; | ||
532 | } __attribute__ ((packed)); | ||
533 | |||
534 | struct ieee80211_hdr_3addr { | ||
535 | __le16 frame_ctl; | ||
536 | __le16 duration_id; | ||
537 | u8 addr1[ETH_ALEN]; | ||
538 | u8 addr2[ETH_ALEN]; | ||
539 | u8 addr3[ETH_ALEN]; | ||
540 | __le16 seq_ctl; | ||
541 | u8 payload[0]; | ||
542 | } __attribute__ ((packed)); | ||
543 | |||
544 | struct ieee80211_hdr_4addr { | ||
545 | __le16 frame_ctl; | ||
546 | __le16 duration_id; | ||
547 | u8 addr1[ETH_ALEN]; | ||
548 | u8 addr2[ETH_ALEN]; | ||
549 | u8 addr3[ETH_ALEN]; | ||
550 | __le16 seq_ctl; | ||
551 | u8 addr4[ETH_ALEN]; | ||
552 | u8 payload[0]; | ||
553 | } __attribute__ ((packed)); | ||
554 | |||
555 | struct ieee80211_hdr_3addrqos { | ||
556 | __le16 frame_ctl; | ||
557 | __le16 duration_id; | ||
558 | u8 addr1[ETH_ALEN]; | ||
559 | u8 addr2[ETH_ALEN]; | ||
560 | u8 addr3[ETH_ALEN]; | ||
561 | __le16 seq_ctl; | ||
562 | u8 payload[0]; | ||
563 | __le16 qos_ctl; | ||
564 | } __attribute__ ((packed)); | ||
565 | |||
566 | struct ieee80211_hdr_4addrqos { | ||
567 | __le16 frame_ctl; | ||
568 | __le16 duration_id; | ||
569 | u8 addr1[ETH_ALEN]; | ||
570 | u8 addr2[ETH_ALEN]; | ||
571 | u8 addr3[ETH_ALEN]; | ||
572 | __le16 seq_ctl; | ||
573 | u8 addr4[ETH_ALEN]; | ||
574 | u8 payload[0]; | ||
575 | __le16 qos_ctl; | ||
524 | } __attribute__ ((packed)); | 576 | } __attribute__ ((packed)); |
525 | 577 | ||
526 | struct ieee80211_info_element { | 578 | struct ieee80211_info_element { |
@@ -546,49 +598,77 @@ struct ieee80211_info_element { | |||
546 | u16 status; | 598 | u16 status; |
547 | */ | 599 | */ |
548 | 600 | ||
549 | struct ieee80211_authentication { | 601 | struct ieee80211_auth { |
550 | struct ieee80211_hdr_3addr header; | 602 | struct ieee80211_hdr_3addr header; |
551 | __le16 algorithm; | 603 | __le16 algorithm; |
552 | __le16 transaction; | 604 | __le16 transaction; |
553 | __le16 status; | 605 | __le16 status; |
554 | struct ieee80211_info_element info_element; | 606 | /* challenge */ |
607 | struct ieee80211_info_element info_element[0]; | ||
608 | } __attribute__ ((packed)); | ||
609 | |||
610 | struct ieee80211_disassoc { | ||
611 | struct ieee80211_hdr_3addr header; | ||
612 | __le16 reason; | ||
555 | } __attribute__ ((packed)); | 613 | } __attribute__ ((packed)); |
556 | 614 | ||
615 | /* Alias deauth for disassoc */ | ||
616 | #define ieee82011_deauth ieee80211_disassoc | ||
617 | |||
618 | struct ieee80211_probe_request { | ||
619 | struct ieee80211_hdr_3addr header; | ||
620 | /* SSID, supported rates */ | ||
621 | struct ieee80211_info_element info_element[0]; | ||
622 | } __attribute__ ((packed)); | ||
557 | 623 | ||
558 | struct ieee80211_probe_response { | 624 | struct ieee80211_probe_response { |
559 | struct ieee80211_hdr_3addr header; | 625 | struct ieee80211_hdr_3addr header; |
560 | u32 time_stamp[2]; | 626 | u32 time_stamp[2]; |
561 | __le16 beacon_interval; | 627 | __le16 beacon_interval; |
562 | __le16 capability; | 628 | __le16 capability; |
563 | struct ieee80211_info_element info_element; | 629 | /* SSID, supported rates, FH params, DS params, |
630 | * CF params, IBSS params, TIM (if beacon), RSN */ | ||
631 | struct ieee80211_info_element info_element[0]; | ||
632 | } __attribute__ ((packed)); | ||
633 | |||
634 | /* Alias beacon for probe_response */ | ||
635 | #define ieee80211_beacon ieee80211_probe_response | ||
636 | |||
637 | struct ieee80211_assoc_request { | ||
638 | struct ieee80211_hdr_3addr header; | ||
639 | __le16 capability; | ||
640 | __le16 listen_interval; | ||
641 | /* SSID, supported rates, RSN */ | ||
642 | struct ieee80211_info_element info_element[0]; | ||
564 | } __attribute__ ((packed)); | 643 | } __attribute__ ((packed)); |
565 | 644 | ||
566 | struct ieee80211_assoc_request_frame { | 645 | struct ieee80211_reassoc_request { |
646 | struct ieee80211_hdr_3addr header; | ||
567 | __le16 capability; | 647 | __le16 capability; |
568 | __le16 listen_interval; | 648 | __le16 listen_interval; |
569 | u8 current_ap[ETH_ALEN]; | 649 | u8 current_ap[ETH_ALEN]; |
570 | struct ieee80211_info_element info_element; | 650 | struct ieee80211_info_element info_element[0]; |
571 | } __attribute__ ((packed)); | 651 | } __attribute__ ((packed)); |
572 | 652 | ||
573 | struct ieee80211_assoc_response_frame { | 653 | struct ieee80211_assoc_response { |
574 | struct ieee80211_hdr_3addr header; | 654 | struct ieee80211_hdr_3addr header; |
575 | __le16 capability; | 655 | __le16 capability; |
576 | __le16 status; | 656 | __le16 status; |
577 | __le16 aid; | 657 | __le16 aid; |
578 | struct ieee80211_info_element info_element; /* supported rates */ | 658 | /* supported rates */ |
659 | struct ieee80211_info_element info_element[0]; | ||
579 | } __attribute__ ((packed)); | 660 | } __attribute__ ((packed)); |
580 | 661 | ||
581 | |||
582 | struct ieee80211_txb { | 662 | struct ieee80211_txb { |
583 | u8 nr_frags; | 663 | u8 nr_frags; |
584 | u8 encrypted; | 664 | u8 encrypted; |
585 | u16 reserved; | 665 | u8 rts_included; |
586 | u16 frag_size; | 666 | u8 reserved; |
587 | u16 payload_size; | 667 | __le16 frag_size; |
668 | __le16 payload_size; | ||
588 | struct sk_buff *fragments[0]; | 669 | struct sk_buff *fragments[0]; |
589 | }; | 670 | }; |
590 | 671 | ||
591 | |||
592 | /* SWEEP TABLE ENTRIES NUMBER */ | 672 | /* SWEEP TABLE ENTRIES NUMBER */ |
593 | #define MAX_SWEEP_TAB_ENTRIES 42 | 673 | #define MAX_SWEEP_TAB_ENTRIES 42 |
594 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 | 674 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 |
@@ -604,9 +684,68 @@ struct ieee80211_txb { | |||
604 | 684 | ||
605 | #define MAX_WPA_IE_LEN 64 | 685 | #define MAX_WPA_IE_LEN 64 |
606 | 686 | ||
607 | #define NETWORK_EMPTY_ESSID (1<<0) | 687 | #define NETWORK_EMPTY_ESSID (1<<0) |
608 | #define NETWORK_HAS_OFDM (1<<1) | 688 | #define NETWORK_HAS_OFDM (1<<1) |
609 | #define NETWORK_HAS_CCK (1<<2) | 689 | #define NETWORK_HAS_CCK (1<<2) |
690 | |||
691 | /* QoS structure */ | ||
692 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) | ||
693 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) | ||
694 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | NETWORK_HAS_QOS_INFORMATION) | ||
695 | |||
696 | #define QOS_QUEUE_NUM 4 | ||
697 | #define QOS_OUI_LEN 3 | ||
698 | #define QOS_OUI_TYPE 2 | ||
699 | #define QOS_ELEMENT_ID 221 | ||
700 | #define QOS_OUI_INFO_SUB_TYPE 0 | ||
701 | #define QOS_OUI_PARAM_SUB_TYPE 1 | ||
702 | #define QOS_VERSION_1 1 | ||
703 | #define QOS_AIFSN_MIN_VALUE 2 | ||
704 | |||
705 | struct ieee80211_qos_information_element { | ||
706 | u8 elementID; | ||
707 | u8 length; | ||
708 | u8 qui[QOS_OUI_LEN]; | ||
709 | u8 qui_type; | ||
710 | u8 qui_subtype; | ||
711 | u8 version; | ||
712 | u8 ac_info; | ||
713 | } __attribute__ ((packed)); | ||
714 | |||
715 | struct ieee80211_qos_ac_parameter { | ||
716 | u8 aci_aifsn; | ||
717 | u8 ecw_min_max; | ||
718 | __le16 tx_op_limit; | ||
719 | } __attribute__ ((packed)); | ||
720 | |||
721 | struct ieee80211_qos_parameter_info { | ||
722 | struct ieee80211_qos_information_element info_element; | ||
723 | u8 reserved; | ||
724 | struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; | ||
725 | } __attribute__ ((packed)); | ||
726 | |||
727 | struct ieee80211_qos_parameters { | ||
728 | __le16 cw_min[QOS_QUEUE_NUM]; | ||
729 | __le16 cw_max[QOS_QUEUE_NUM]; | ||
730 | u8 aifs[QOS_QUEUE_NUM]; | ||
731 | u8 flag[QOS_QUEUE_NUM]; | ||
732 | __le16 tx_op_limit[QOS_QUEUE_NUM]; | ||
733 | } __attribute__ ((packed)); | ||
734 | |||
735 | struct ieee80211_qos_data { | ||
736 | struct ieee80211_qos_parameters parameters; | ||
737 | int active; | ||
738 | int supported; | ||
739 | u8 param_count; | ||
740 | u8 old_param_count; | ||
741 | }; | ||
742 | |||
743 | struct ieee80211_tim_parameters { | ||
744 | u8 tim_count; | ||
745 | u8 tim_period; | ||
746 | } __attribute__ ((packed)); | ||
747 | |||
748 | /*******************************************************/ | ||
610 | 749 | ||
611 | struct ieee80211_network { | 750 | struct ieee80211_network { |
612 | /* These entries are used to identify a unique network */ | 751 | /* These entries are used to identify a unique network */ |
@@ -616,6 +755,8 @@ struct ieee80211_network { | |||
616 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | 755 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
617 | u8 ssid_len; | 756 | u8 ssid_len; |
618 | 757 | ||
758 | struct ieee80211_qos_data qos_data; | ||
759 | |||
619 | /* These are network statistics */ | 760 | /* These are network statistics */ |
620 | struct ieee80211_rx_stats stats; | 761 | struct ieee80211_rx_stats stats; |
621 | u16 capability; | 762 | u16 capability; |
@@ -631,10 +772,12 @@ struct ieee80211_network { | |||
631 | u16 beacon_interval; | 772 | u16 beacon_interval; |
632 | u16 listen_interval; | 773 | u16 listen_interval; |
633 | u16 atim_window; | 774 | u16 atim_window; |
775 | u8 erp_value; | ||
634 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 776 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
635 | size_t wpa_ie_len; | 777 | size_t wpa_ie_len; |
636 | u8 rsn_ie[MAX_WPA_IE_LEN]; | 778 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
637 | size_t rsn_ie_len; | 779 | size_t rsn_ie_len; |
780 | struct ieee80211_tim_parameters tim; | ||
638 | struct list_head list; | 781 | struct list_head list; |
639 | }; | 782 | }; |
640 | 783 | ||
@@ -651,17 +794,52 @@ enum ieee80211_state { | |||
651 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | 794 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
652 | #define DEFAULT_FTS 2346 | 795 | #define DEFAULT_FTS 2346 |
653 | 796 | ||
654 | |||
655 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 797 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
656 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | 798 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) |
799 | #define CFG_IEEE80211_RTS (1<<2) | ||
800 | |||
801 | #define IEEE80211_24GHZ_MIN_CHANNEL 1 | ||
802 | #define IEEE80211_24GHZ_MAX_CHANNEL 14 | ||
803 | #define IEEE80211_24GHZ_CHANNELS 14 | ||
804 | |||
805 | #define IEEE80211_52GHZ_MIN_CHANNEL 36 | ||
806 | #define IEEE80211_52GHZ_MAX_CHANNEL 165 | ||
807 | #define IEEE80211_52GHZ_CHANNELS 32 | ||
808 | |||
809 | enum { | ||
810 | IEEE80211_CH_PASSIVE_ONLY = (1 << 0), | ||
811 | IEEE80211_CH_B_ONLY = (1 << 2), | ||
812 | IEEE80211_CH_NO_IBSS = (1 << 3), | ||
813 | IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), | ||
814 | IEEE80211_CH_RADAR_DETECT = (1 << 5), | ||
815 | IEEE80211_CH_INVALID = (1 << 6), | ||
816 | }; | ||
817 | |||
818 | struct ieee80211_channel { | ||
819 | u32 freq; | ||
820 | u8 channel; | ||
821 | u8 flags; | ||
822 | u8 max_power; | ||
823 | }; | ||
824 | |||
825 | struct ieee80211_geo { | ||
826 | u8 name[4]; | ||
827 | u8 bg_channels; | ||
828 | u8 a_channels; | ||
829 | struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS]; | ||
830 | struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS]; | ||
831 | }; | ||
657 | 832 | ||
658 | struct ieee80211_device { | 833 | struct ieee80211_device { |
659 | struct net_device *dev; | 834 | struct net_device *dev; |
835 | struct ieee80211_security sec; | ||
660 | 836 | ||
661 | /* Bookkeeping structures */ | 837 | /* Bookkeeping structures */ |
662 | struct net_device_stats stats; | 838 | struct net_device_stats stats; |
663 | struct ieee80211_stats ieee_stats; | 839 | struct ieee80211_stats ieee_stats; |
664 | 840 | ||
841 | struct ieee80211_geo geo; | ||
842 | |||
665 | /* Probe / Beacon management */ | 843 | /* Probe / Beacon management */ |
666 | struct list_head network_free_list; | 844 | struct list_head network_free_list; |
667 | struct list_head network_list; | 845 | struct list_head network_list; |
@@ -669,62 +847,102 @@ struct ieee80211_device { | |||
669 | int scans; | 847 | int scans; |
670 | int scan_age; | 848 | int scan_age; |
671 | 849 | ||
672 | int iw_mode; /* operating mode (IW_MODE_*) */ | 850 | int iw_mode; /* operating mode (IW_MODE_*) */ |
851 | struct iw_spy_data spy_data; /* iwspy support */ | ||
673 | 852 | ||
674 | spinlock_t lock; | 853 | spinlock_t lock; |
675 | 854 | ||
676 | int tx_headroom; /* Set to size of any additional room needed at front | 855 | int tx_headroom; /* Set to size of any additional room needed at front |
677 | * of allocated Tx SKBs */ | 856 | * of allocated Tx SKBs */ |
678 | u32 config; | 857 | u32 config; |
679 | 858 | ||
680 | /* WEP and other encryption related settings at the device level */ | 859 | /* WEP and other encryption related settings at the device level */ |
681 | int open_wep; /* Set to 1 to allow unencrypted frames */ | 860 | int open_wep; /* Set to 1 to allow unencrypted frames */ |
682 | 861 | ||
683 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on | 862 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on |
684 | * WEP key changes */ | 863 | * WEP key changes */ |
685 | 864 | ||
686 | /* If the host performs {en,de}cryption, then set to 1 */ | 865 | /* If the host performs {en,de}cryption, then set to 1 */ |
687 | int host_encrypt; | 866 | int host_encrypt; |
867 | int host_encrypt_msdu; | ||
688 | int host_decrypt; | 868 | int host_decrypt; |
689 | int ieee802_1x; /* is IEEE 802.1X used */ | 869 | /* host performs multicast decryption */ |
870 | int host_mc_decrypt; | ||
871 | |||
872 | int host_open_frag; | ||
873 | int host_build_iv; | ||
874 | int ieee802_1x; /* is IEEE 802.1X used */ | ||
690 | 875 | ||
691 | /* WPA data */ | 876 | /* WPA data */ |
692 | int wpa_enabled; | 877 | int wpa_enabled; |
693 | int drop_unencrypted; | 878 | int drop_unencrypted; |
694 | int tkip_countermeasures; | ||
695 | int privacy_invoked; | 879 | int privacy_invoked; |
696 | size_t wpa_ie_len; | 880 | size_t wpa_ie_len; |
697 | u8 *wpa_ie; | 881 | u8 *wpa_ie; |
698 | 882 | ||
699 | struct list_head crypt_deinit_list; | 883 | struct list_head crypt_deinit_list; |
700 | struct ieee80211_crypt_data *crypt[WEP_KEYS]; | 884 | struct ieee80211_crypt_data *crypt[WEP_KEYS]; |
701 | int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ | 885 | int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ |
702 | struct timer_list crypt_deinit_timer; | 886 | struct timer_list crypt_deinit_timer; |
887 | int crypt_quiesced; | ||
703 | 888 | ||
704 | int bcrx_sta_key; /* use individual keys to override default keys even | 889 | int bcrx_sta_key; /* use individual keys to override default keys even |
705 | * with RX of broad/multicast frames */ | 890 | * with RX of broad/multicast frames */ |
706 | 891 | ||
707 | /* Fragmentation structures */ | 892 | /* Fragmentation structures */ |
708 | struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; | 893 | struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; |
709 | unsigned int frag_next_idx; | 894 | unsigned int frag_next_idx; |
710 | u16 fts; /* Fragmentation Threshold */ | 895 | u16 fts; /* Fragmentation Threshold */ |
896 | u16 rts; /* RTS threshold */ | ||
711 | 897 | ||
712 | /* Association info */ | 898 | /* Association info */ |
713 | u8 bssid[ETH_ALEN]; | 899 | u8 bssid[ETH_ALEN]; |
714 | 900 | ||
715 | enum ieee80211_state state; | 901 | enum ieee80211_state state; |
716 | 902 | ||
717 | int mode; /* A, B, G */ | 903 | int mode; /* A, B, G */ |
718 | int modulation; /* CCK, OFDM */ | 904 | int modulation; /* CCK, OFDM */ |
719 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ | 905 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ |
720 | int abg_ture; /* ABG flag */ | 906 | int abg_true; /* ABG flag */ |
907 | |||
908 | int perfect_rssi; | ||
909 | int worst_rssi; | ||
721 | 910 | ||
722 | /* Callback functions */ | 911 | /* Callback functions */ |
723 | void (*set_security)(struct net_device *dev, | 912 | void (*set_security) (struct net_device * dev, |
724 | struct ieee80211_security *sec); | 913 | struct ieee80211_security * sec); |
725 | int (*hard_start_xmit)(struct ieee80211_txb *txb, | 914 | int (*hard_start_xmit) (struct ieee80211_txb * txb, |
726 | struct net_device *dev); | 915 | struct net_device * dev, int pri); |
727 | int (*reset_port)(struct net_device *dev); | 916 | int (*reset_port) (struct net_device * dev); |
917 | int (*is_queue_full) (struct net_device * dev, int pri); | ||
918 | |||
919 | int (*handle_management) (struct net_device * dev, | ||
920 | struct ieee80211_network * network, u16 type); | ||
921 | |||
922 | /* Typical STA methods */ | ||
923 | int (*handle_auth) (struct net_device * dev, | ||
924 | struct ieee80211_auth * auth); | ||
925 | int (*handle_deauth) (struct net_device * dev, | ||
926 | struct ieee80211_auth * auth); | ||
927 | int (*handle_disassoc) (struct net_device * dev, | ||
928 | struct ieee80211_disassoc * assoc); | ||
929 | int (*handle_beacon) (struct net_device * dev, | ||
930 | struct ieee80211_beacon * beacon, | ||
931 | struct ieee80211_network * network); | ||
932 | int (*handle_probe_response) (struct net_device * dev, | ||
933 | struct ieee80211_probe_response * resp, | ||
934 | struct ieee80211_network * network); | ||
935 | int (*handle_probe_request) (struct net_device * dev, | ||
936 | struct ieee80211_probe_request * req, | ||
937 | struct ieee80211_rx_stats * stats); | ||
938 | int (*handle_assoc_response) (struct net_device * dev, | ||
939 | struct ieee80211_assoc_response * resp, | ||
940 | struct ieee80211_network * network); | ||
941 | |||
942 | /* Typical AP methods */ | ||
943 | int (*handle_assoc_request) (struct net_device * dev); | ||
944 | int (*handle_reassoc_request) (struct net_device * dev, | ||
945 | struct ieee80211_reassoc_request * req); | ||
728 | 946 | ||
729 | /* This must be the last item so that it points to the data | 947 | /* This must be the last item so that it points to the data |
730 | * allocated beyond this structure by alloc_ieee80211 */ | 948 | * allocated beyond this structure by alloc_ieee80211 */ |
@@ -736,12 +954,12 @@ struct ieee80211_device { | |||
736 | #define IEEE_G (1<<2) | 954 | #define IEEE_G (1<<2) |
737 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) | 955 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) |
738 | 956 | ||
739 | extern inline void *ieee80211_priv(struct net_device *dev) | 957 | static inline void *ieee80211_priv(struct net_device *dev) |
740 | { | 958 | { |
741 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | 959 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; |
742 | } | 960 | } |
743 | 961 | ||
744 | extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | 962 | static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) |
745 | { | 963 | { |
746 | /* Single white space is for Linksys APs */ | 964 | /* Single white space is for Linksys APs */ |
747 | if (essid_len == 1 && essid[0] == ' ') | 965 | if (essid_len == 1 && essid[0] == ' ') |
@@ -757,7 +975,8 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | |||
757 | return 1; | 975 | return 1; |
758 | } | 976 | } |
759 | 977 | ||
760 | extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) | 978 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, |
979 | int mode) | ||
761 | { | 980 | { |
762 | /* | 981 | /* |
763 | * It is possible for both access points and our device to support | 982 | * It is possible for both access points and our device to support |
@@ -783,14 +1002,17 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod | |||
783 | return 0; | 1002 | return 0; |
784 | } | 1003 | } |
785 | 1004 | ||
786 | extern inline int ieee80211_get_hdrlen(u16 fc) | 1005 | static inline int ieee80211_get_hdrlen(u16 fc) |
787 | { | 1006 | { |
788 | int hdrlen = IEEE80211_3ADDR_LEN; | 1007 | int hdrlen = IEEE80211_3ADDR_LEN; |
1008 | u16 stype = WLAN_FC_GET_STYPE(fc); | ||
789 | 1009 | ||
790 | switch (WLAN_FC_GET_TYPE(fc)) { | 1010 | switch (WLAN_FC_GET_TYPE(fc)) { |
791 | case IEEE80211_FTYPE_DATA: | 1011 | case IEEE80211_FTYPE_DATA: |
792 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | 1012 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) |
793 | hdrlen = IEEE80211_4ADDR_LEN; | 1013 | hdrlen = IEEE80211_4ADDR_LEN; |
1014 | if (stype & IEEE80211_STYPE_QOS_DATA) | ||
1015 | hdrlen += 2; | ||
794 | break; | 1016 | break; |
795 | case IEEE80211_FTYPE_CTL: | 1017 | case IEEE80211_FTYPE_CTL: |
796 | switch (WLAN_FC_GET_STYPE(fc)) { | 1018 | switch (WLAN_FC_GET_STYPE(fc)) { |
@@ -808,7 +1030,20 @@ extern inline int ieee80211_get_hdrlen(u16 fc) | |||
808 | return hdrlen; | 1030 | return hdrlen; |
809 | } | 1031 | } |
810 | 1032 | ||
1033 | static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) | ||
1034 | { | ||
1035 | switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { | ||
1036 | case IEEE80211_1ADDR_LEN: | ||
1037 | return ((struct ieee80211_hdr_1addr *)hdr)->payload; | ||
1038 | case IEEE80211_2ADDR_LEN: | ||
1039 | return ((struct ieee80211_hdr_2addr *)hdr)->payload; | ||
1040 | case IEEE80211_3ADDR_LEN: | ||
1041 | return ((struct ieee80211_hdr_3addr *)hdr)->payload; | ||
1042 | case IEEE80211_4ADDR_LEN: | ||
1043 | return ((struct ieee80211_hdr_4addr *)hdr)->payload; | ||
1044 | } | ||
811 | 1045 | ||
1046 | } | ||
812 | 1047 | ||
813 | /* ieee80211.c */ | 1048 | /* ieee80211.c */ |
814 | extern void free_ieee80211(struct net_device *dev); | 1049 | extern void free_ieee80211(struct net_device *dev); |
@@ -817,18 +1052,30 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv); | |||
817 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | 1052 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); |
818 | 1053 | ||
819 | /* ieee80211_tx.c */ | 1054 | /* ieee80211_tx.c */ |
820 | extern int ieee80211_xmit(struct sk_buff *skb, | 1055 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); |
821 | struct net_device *dev); | ||
822 | extern void ieee80211_txb_free(struct ieee80211_txb *); | 1056 | extern void ieee80211_txb_free(struct ieee80211_txb *); |
823 | 1057 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | |
1058 | struct ieee80211_hdr *frame, int len); | ||
824 | 1059 | ||
825 | /* ieee80211_rx.c */ | 1060 | /* ieee80211_rx.c */ |
826 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1061 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
827 | struct ieee80211_rx_stats *rx_stats); | 1062 | struct ieee80211_rx_stats *rx_stats); |
828 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | 1063 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
829 | struct ieee80211_hdr *header, | 1064 | struct ieee80211_hdr_4addr *header, |
830 | struct ieee80211_rx_stats *stats); | 1065 | struct ieee80211_rx_stats *stats); |
831 | 1066 | ||
1067 | /* ieee80211_geo.c */ | ||
1068 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device | ||
1069 | *ieee); | ||
1070 | extern int ieee80211_set_geo(struct ieee80211_device *ieee, | ||
1071 | const struct ieee80211_geo *geo); | ||
1072 | |||
1073 | extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, | ||
1074 | u8 channel); | ||
1075 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, | ||
1076 | u8 channel); | ||
1077 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); | ||
1078 | |||
832 | /* ieee80211_wx.c */ | 1079 | /* ieee80211_wx.c */ |
833 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | 1080 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
834 | struct iw_request_info *info, | 1081 | struct iw_request_info *info, |
@@ -839,17 +1086,21 @@ extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
839 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | 1086 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, |
840 | struct iw_request_info *info, | 1087 | struct iw_request_info *info, |
841 | union iwreq_data *wrqu, char *key); | 1088 | union iwreq_data *wrqu, char *key); |
842 | 1089 | extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | |
843 | 1090 | struct iw_request_info *info, | |
844 | extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | 1091 | union iwreq_data *wrqu, char *extra); |
1092 | extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | ||
1093 | struct iw_request_info *info, | ||
1094 | union iwreq_data *wrqu, char *extra); | ||
1095 | |||
1096 | static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | ||
845 | { | 1097 | { |
846 | ieee->scans++; | 1098 | ieee->scans++; |
847 | } | 1099 | } |
848 | 1100 | ||
849 | extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) | 1101 | static inline int ieee80211_get_scans(struct ieee80211_device *ieee) |
850 | { | 1102 | { |
851 | return ieee->scans; | 1103 | return ieee->scans; |
852 | } | 1104 | } |
853 | 1105 | ||
854 | 1106 | #endif /* IEEE80211_H */ | |
855 | #endif /* IEEE80211_H */ | ||
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index b58a3bcc0dc0..0c9d859d912e 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -25,16 +25,22 @@ | |||
25 | 25 | ||
26 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
27 | 27 | ||
28 | enum { | ||
29 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1<<0), | ||
30 | }; | ||
31 | |||
28 | struct ieee80211_crypto_ops { | 32 | struct ieee80211_crypto_ops { |
29 | const char *name; | 33 | const char *name; |
30 | 34 | ||
31 | /* init new crypto context (e.g., allocate private data space, | 35 | /* init new crypto context (e.g., allocate private data space, |
32 | * select IV, etc.); returns NULL on failure or pointer to allocated | 36 | * select IV, etc.); returns NULL on failure or pointer to allocated |
33 | * private data on success */ | 37 | * private data on success */ |
34 | void * (*init)(int keyidx); | 38 | void *(*init) (int keyidx); |
35 | 39 | ||
36 | /* deinitialize crypto context and free allocated private data */ | 40 | /* deinitialize crypto context and free allocated private data */ |
37 | void (*deinit)(void *priv); | 41 | void (*deinit) (void *priv); |
42 | |||
43 | int (*build_iv) (struct sk_buff * skb, int hdr_len, void *priv); | ||
38 | 44 | ||
39 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | 45 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
40 | * value from decrypt_mpdu is passed as the keyidx value for | 46 | * value from decrypt_mpdu is passed as the keyidx value for |
@@ -42,34 +48,39 @@ struct ieee80211_crypto_ops { | |||
42 | * encryption; if not, error will be returned; these functions are | 48 | * encryption; if not, error will be returned; these functions are |
43 | * called for all MPDUs (i.e., fragments). | 49 | * called for all MPDUs (i.e., fragments). |
44 | */ | 50 | */ |
45 | int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); | 51 | int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); |
46 | int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); | 52 | int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); |
47 | 53 | ||
48 | /* These functions are called for full MSDUs, i.e. full frames. | 54 | /* These functions are called for full MSDUs, i.e. full frames. |
49 | * These can be NULL if full MSDU operations are not needed. */ | 55 | * These can be NULL if full MSDU operations are not needed. */ |
50 | int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); | 56 | int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv); |
51 | int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, | 57 | int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len, |
52 | void *priv); | 58 | void *priv); |
53 | 59 | ||
54 | int (*set_key)(void *key, int len, u8 *seq, void *priv); | 60 | int (*set_key) (void *key, int len, u8 * seq, void *priv); |
55 | int (*get_key)(void *key, int len, u8 *seq, void *priv); | 61 | int (*get_key) (void *key, int len, u8 * seq, void *priv); |
56 | 62 | ||
57 | /* procfs handler for printing out key information and possible | 63 | /* procfs handler for printing out key information and possible |
58 | * statistics */ | 64 | * statistics */ |
59 | char * (*print_stats)(char *p, void *priv); | 65 | char *(*print_stats) (char *p, void *priv); |
66 | |||
67 | /* Crypto specific flag get/set for configuration settings */ | ||
68 | unsigned long (*get_flags)(void *priv); | ||
69 | unsigned long (*set_flags)(unsigned long flags, void *priv); | ||
60 | 70 | ||
61 | /* maximum number of bytes added by encryption; encrypt buf is | 71 | /* maximum number of bytes added by encryption; encrypt buf is |
62 | * allocated with extra_prefix_len bytes, copy of in_buf, and | 72 | * allocated with extra_prefix_len bytes, copy of in_buf, and |
63 | * extra_postfix_len; encrypt need not use all this space, but | 73 | * extra_postfix_len; encrypt need not use all this space, but |
64 | * the result must start at the beginning of the buffer and correct | 74 | * the result must start at the beginning of the buffer and correct |
65 | * length must be returned */ | 75 | * length must be returned */ |
66 | int extra_prefix_len, extra_postfix_len; | 76 | int extra_mpdu_prefix_len, extra_mpdu_postfix_len; |
77 | int extra_msdu_prefix_len, extra_msdu_postfix_len; | ||
67 | 78 | ||
68 | struct module *owner; | 79 | struct module *owner; |
69 | }; | 80 | }; |
70 | 81 | ||
71 | struct ieee80211_crypt_data { | 82 | struct ieee80211_crypt_data { |
72 | struct list_head list; /* delayed deletion list */ | 83 | struct list_head list; /* delayed deletion list */ |
73 | struct ieee80211_crypto_ops *ops; | 84 | struct ieee80211_crypto_ops *ops; |
74 | void *priv; | 85 | void *priv; |
75 | atomic_t refcnt; | 86 | atomic_t refcnt; |
@@ -77,10 +88,11 @@ struct ieee80211_crypt_data { | |||
77 | 88 | ||
78 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | 89 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); |
79 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | 90 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); |
80 | struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); | 91 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); |
81 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | 92 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); |
82 | void ieee80211_crypt_deinit_handler(unsigned long); | 93 | void ieee80211_crypt_deinit_handler(unsigned long); |
83 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | 94 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, |
84 | struct ieee80211_crypt_data **crypt); | 95 | struct ieee80211_crypt_data **crypt); |
96 | void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); | ||
85 | 97 | ||
86 | #endif | 98 | #endif |
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h new file mode 100644 index 000000000000..429b73892a5f --- /dev/null +++ b/include/net/ieee80211_radiotap.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ | ||
2 | /* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ | ||
3 | |||
4 | /*- | ||
5 | * Copyright (c) 2003, 2004 David Young. All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions | ||
9 | * are met: | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of David Young may not be used to endorse or promote | ||
16 | * products derived from this software without specific prior | ||
17 | * written permission. | ||
18 | * | ||
19 | * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY | ||
20 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID | ||
23 | * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
30 | * OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Modifications to fit into the linux IEEE 802.11 stack, | ||
35 | * Mike Kershaw (dragorn@kismetwireless.net) | ||
36 | */ | ||
37 | |||
38 | #ifndef IEEE80211RADIOTAP_H | ||
39 | #define IEEE80211RADIOTAP_H | ||
40 | |||
41 | #include <linux/if_ether.h> | ||
42 | #include <linux/kernel.h> | ||
43 | |||
44 | /* Radiotap header version (from official NetBSD feed) */ | ||
45 | #define IEEE80211RADIOTAP_VERSION "1.5" | ||
46 | /* Base version of the radiotap packet header data */ | ||
47 | #define PKTHDR_RADIOTAP_VERSION 0 | ||
48 | |||
49 | /* A generic radio capture format is desirable. There is one for | ||
50 | * Linux, but it is neither rigidly defined (there were not even | ||
51 | * units given for some fields) nor easily extensible. | ||
52 | * | ||
53 | * I suggest the following extensible radio capture format. It is | ||
54 | * based on a bitmap indicating which fields are present. | ||
55 | * | ||
56 | * I am trying to describe precisely what the application programmer | ||
57 | * should expect in the following, and for that reason I tell the | ||
58 | * units and origin of each measurement (where it applies), or else I | ||
59 | * use sufficiently weaselly language ("is a monotonically nondecreasing | ||
60 | * function of...") that I cannot set false expectations for lawyerly | ||
61 | * readers. | ||
62 | */ | ||
63 | |||
64 | /* XXX tcpdump/libpcap do not tolerate variable-length headers, | ||
65 | * yet, so we pad every radiotap header to 64 bytes. Ugh. | ||
66 | */ | ||
67 | #define IEEE80211_RADIOTAP_HDRLEN 64 | ||
68 | |||
69 | /* The radio capture header precedes the 802.11 header. */ | ||
70 | struct ieee80211_radiotap_header { | ||
71 | u8 it_version; /* Version 0. Only increases | ||
72 | * for drastic changes, | ||
73 | * introduction of compatible | ||
74 | * new fields does not count. | ||
75 | */ | ||
76 | u8 it_pad; | ||
77 | u16 it_len; /* length of the whole | ||
78 | * header in bytes, including | ||
79 | * it_version, it_pad, | ||
80 | * it_len, and data fields. | ||
81 | */ | ||
82 | u32 it_present; /* A bitmap telling which | ||
83 | * fields are present. Set bit 31 | ||
84 | * (0x80000000) to extend the | ||
85 | * bitmap by another 32 bits. | ||
86 | * Additional extensions are made | ||
87 | * by setting bit 31. | ||
88 | */ | ||
89 | }; | ||
90 | |||
91 | /* Name Data type Units | ||
92 | * ---- --------- ----- | ||
93 | * | ||
94 | * IEEE80211_RADIOTAP_TSFT u64 microseconds | ||
95 | * | ||
96 | * Value in microseconds of the MAC's 64-bit 802.11 Time | ||
97 | * Synchronization Function timer when the first bit of the | ||
98 | * MPDU arrived at the MAC. For received frames, only. | ||
99 | * | ||
100 | * IEEE80211_RADIOTAP_CHANNEL 2 x u16 MHz, bitmap | ||
101 | * | ||
102 | * Tx/Rx frequency in MHz, followed by flags (see below). | ||
103 | * | ||
104 | * IEEE80211_RADIOTAP_FHSS u16 see below | ||
105 | * | ||
106 | * For frequency-hopping radios, the hop set (first byte) | ||
107 | * and pattern (second byte). | ||
108 | * | ||
109 | * IEEE80211_RADIOTAP_RATE u8 500kb/s | ||
110 | * | ||
111 | * Tx/Rx data rate | ||
112 | * | ||
113 | * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from | ||
114 | * one milliwatt (dBm) | ||
115 | * | ||
116 | * RF signal power at the antenna, decibel difference from | ||
117 | * one milliwatt. | ||
118 | * | ||
119 | * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from | ||
120 | * one milliwatt (dBm) | ||
121 | * | ||
122 | * RF noise power at the antenna, decibel difference from one | ||
123 | * milliwatt. | ||
124 | * | ||
125 | * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) | ||
126 | * | ||
127 | * RF signal power at the antenna, decibel difference from an | ||
128 | * arbitrary, fixed reference. | ||
129 | * | ||
130 | * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) | ||
131 | * | ||
132 | * RF noise power at the antenna, decibel difference from an | ||
133 | * arbitrary, fixed reference point. | ||
134 | * | ||
135 | * IEEE80211_RADIOTAP_LOCK_QUALITY u16 unitless | ||
136 | * | ||
137 | * Quality of Barker code lock. Unitless. Monotonically | ||
138 | * nondecreasing with "better" lock strength. Called "Signal | ||
139 | * Quality" in datasheets. (Is there a standard way to measure | ||
140 | * this?) | ||
141 | * | ||
142 | * IEEE80211_RADIOTAP_TX_ATTENUATION u16 unitless | ||
143 | * | ||
144 | * Transmit power expressed as unitless distance from max | ||
145 | * power set at factory calibration. 0 is max power. | ||
146 | * Monotonically nondecreasing with lower power levels. | ||
147 | * | ||
148 | * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u16 decibels (dB) | ||
149 | * | ||
150 | * Transmit power expressed as decibel distance from max power | ||
151 | * set at factory calibration. 0 is max power. Monotonically | ||
152 | * nondecreasing with lower power levels. | ||
153 | * | ||
154 | * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from | ||
155 | * one milliwatt (dBm) | ||
156 | * | ||
157 | * Transmit power expressed as dBm (decibels from a 1 milliwatt | ||
158 | * reference). This is the absolute power level measured at | ||
159 | * the antenna port. | ||
160 | * | ||
161 | * IEEE80211_RADIOTAP_FLAGS u8 bitmap | ||
162 | * | ||
163 | * Properties of transmitted and received frames. See flags | ||
164 | * defined below. | ||
165 | * | ||
166 | * IEEE80211_RADIOTAP_ANTENNA u8 antenna index | ||
167 | * | ||
168 | * Unitless indication of the Rx/Tx antenna for this packet. | ||
169 | * The first antenna is antenna 0. | ||
170 | * | ||
171 | * IEEE80211_RADIOTAP_FCS u32 data | ||
172 | * | ||
173 | * FCS from frame in network byte order. | ||
174 | */ | ||
175 | enum ieee80211_radiotap_type { | ||
176 | IEEE80211_RADIOTAP_TSFT = 0, | ||
177 | IEEE80211_RADIOTAP_FLAGS = 1, | ||
178 | IEEE80211_RADIOTAP_RATE = 2, | ||
179 | IEEE80211_RADIOTAP_CHANNEL = 3, | ||
180 | IEEE80211_RADIOTAP_FHSS = 4, | ||
181 | IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, | ||
182 | IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, | ||
183 | IEEE80211_RADIOTAP_LOCK_QUALITY = 7, | ||
184 | IEEE80211_RADIOTAP_TX_ATTENUATION = 8, | ||
185 | IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, | ||
186 | IEEE80211_RADIOTAP_DBM_TX_POWER = 10, | ||
187 | IEEE80211_RADIOTAP_ANTENNA = 11, | ||
188 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, | ||
189 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13, | ||
190 | IEEE80211_RADIOTAP_EXT = 31, | ||
191 | }; | ||
192 | |||
193 | /* Channel flags. */ | ||
194 | #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ | ||
195 | #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ | ||
196 | #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ | ||
197 | #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ | ||
198 | #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ | ||
199 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ | ||
200 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ | ||
201 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ | ||
202 | |||
203 | /* For IEEE80211_RADIOTAP_FLAGS */ | ||
204 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received | ||
205 | * during CFP | ||
206 | */ | ||
207 | #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received | ||
208 | * with short | ||
209 | * preamble | ||
210 | */ | ||
211 | #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received | ||
212 | * with WEP encryption | ||
213 | */ | ||
214 | #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received | ||
215 | * with fragmentation | ||
216 | */ | ||
217 | #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ | ||
218 | #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between | ||
219 | * 802.11 header and payload | ||
220 | * (to 32-bit boundary) | ||
221 | */ | ||
222 | |||
223 | /* Ugly macro to convert literal channel numbers into their mhz equivalents | ||
224 | * There are certianly some conditions that will break this (like feeding it '30') | ||
225 | * but they shouldn't arise since nothing talks on channel 30. */ | ||
226 | #define ieee80211chan2mhz(x) \ | ||
227 | (((x) <= 14) ? \ | ||
228 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ | ||
229 | ((x) + 1000) * 5) | ||
230 | |||
231 | #endif /* IEEE80211_RADIOTAP_H */ | ||
diff --git a/include/net/syncppp.h b/include/net/syncppp.h index 614cb6ba564e..877efa434700 100644 --- a/include/net/syncppp.h +++ b/include/net/syncppp.h | |||
@@ -86,7 +86,6 @@ static inline struct sppp *sppp_of(struct net_device *dev) | |||
86 | 86 | ||
87 | void sppp_attach (struct ppp_device *pd); | 87 | void sppp_attach (struct ppp_device *pd); |
88 | void sppp_detach (struct net_device *dev); | 88 | void sppp_detach (struct net_device *dev); |
89 | void sppp_input (struct net_device *dev, struct sk_buff *m); | ||
90 | int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); | 89 | int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); |
91 | struct sk_buff *sppp_dequeue (struct net_device *dev); | 90 | struct sk_buff *sppp_dequeue (struct net_device *dev); |
92 | int sppp_isempty (struct net_device *dev); | 91 | int sppp_isempty (struct net_device *dev); |
diff --git a/net/ieee80211/Makefile b/net/ieee80211/Makefile index a6ccac5baea8..f988417121da 100644 --- a/net/ieee80211/Makefile +++ b/net/ieee80211/Makefile | |||
@@ -7,5 +7,6 @@ ieee80211-objs := \ | |||
7 | ieee80211_module.o \ | 7 | ieee80211_module.o \ |
8 | ieee80211_tx.o \ | 8 | ieee80211_tx.o \ |
9 | ieee80211_rx.o \ | 9 | ieee80211_rx.o \ |
10 | ieee80211_wx.o | 10 | ieee80211_wx.o \ |
11 | ieee80211_geo.o | ||
11 | 12 | ||
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index 61a9d92e455b..f3b6aa3be638 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c | |||
@@ -41,6 +41,12 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | |||
41 | { | 41 | { |
42 | struct list_head *ptr, *n; | 42 | struct list_head *ptr, *n; |
43 | struct ieee80211_crypt_data *entry; | 43 | struct ieee80211_crypt_data *entry; |
44 | unsigned long flags; | ||
45 | |||
46 | spin_lock_irqsave(&ieee->lock, flags); | ||
47 | |||
48 | if (list_empty(&ieee->crypt_deinit_list)) | ||
49 | goto unlock; | ||
44 | 50 | ||
45 | for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; | 51 | for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; |
46 | ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { | 52 | ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { |
@@ -57,6 +63,18 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | |||
57 | } | 63 | } |
58 | kfree(entry); | 64 | kfree(entry); |
59 | } | 65 | } |
66 | unlock: | ||
67 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
68 | } | ||
69 | |||
70 | /* After this, crypt_deinit_list won't accept new members */ | ||
71 | void ieee80211_crypt_quiescing(struct ieee80211_device *ieee) | ||
72 | { | ||
73 | unsigned long flags; | ||
74 | |||
75 | spin_lock_irqsave(&ieee->lock, flags); | ||
76 | ieee->crypt_quiesced = 1; | ||
77 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
60 | } | 78 | } |
61 | 79 | ||
62 | void ieee80211_crypt_deinit_handler(unsigned long data) | 80 | void ieee80211_crypt_deinit_handler(unsigned long data) |
@@ -64,16 +82,16 @@ void ieee80211_crypt_deinit_handler(unsigned long data) | |||
64 | struct ieee80211_device *ieee = (struct ieee80211_device *)data; | 82 | struct ieee80211_device *ieee = (struct ieee80211_device *)data; |
65 | unsigned long flags; | 83 | unsigned long flags; |
66 | 84 | ||
67 | spin_lock_irqsave(&ieee->lock, flags); | ||
68 | ieee80211_crypt_deinit_entries(ieee, 0); | 85 | ieee80211_crypt_deinit_entries(ieee, 0); |
69 | if (!list_empty(&ieee->crypt_deinit_list)) { | 86 | |
87 | spin_lock_irqsave(&ieee->lock, flags); | ||
88 | if (!list_empty(&ieee->crypt_deinit_list) && !ieee->crypt_quiesced) { | ||
70 | printk(KERN_DEBUG "%s: entries remaining in delayed crypt " | 89 | printk(KERN_DEBUG "%s: entries remaining in delayed crypt " |
71 | "deletion list\n", ieee->dev->name); | 90 | "deletion list\n", ieee->dev->name); |
72 | ieee->crypt_deinit_timer.expires = jiffies + HZ; | 91 | ieee->crypt_deinit_timer.expires = jiffies + HZ; |
73 | add_timer(&ieee->crypt_deinit_timer); | 92 | add_timer(&ieee->crypt_deinit_timer); |
74 | } | 93 | } |
75 | spin_unlock_irqrestore(&ieee->lock, flags); | 94 | spin_unlock_irqrestore(&ieee->lock, flags); |
76 | |||
77 | } | 95 | } |
78 | 96 | ||
79 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | 97 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, |
@@ -93,10 +111,12 @@ void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | |||
93 | * locking. */ | 111 | * locking. */ |
94 | 112 | ||
95 | spin_lock_irqsave(&ieee->lock, flags); | 113 | spin_lock_irqsave(&ieee->lock, flags); |
96 | list_add(&tmp->list, &ieee->crypt_deinit_list); | 114 | if (!ieee->crypt_quiesced) { |
97 | if (!timer_pending(&ieee->crypt_deinit_timer)) { | 115 | list_add(&tmp->list, &ieee->crypt_deinit_list); |
98 | ieee->crypt_deinit_timer.expires = jiffies + HZ; | 116 | if (!timer_pending(&ieee->crypt_deinit_timer)) { |
99 | add_timer(&ieee->crypt_deinit_timer); | 117 | ieee->crypt_deinit_timer.expires = jiffies + HZ; |
118 | add_timer(&ieee->crypt_deinit_timer); | ||
119 | } | ||
100 | } | 120 | } |
101 | spin_unlock_irqrestore(&ieee->lock, flags); | 121 | spin_unlock_irqrestore(&ieee->lock, flags); |
102 | } | 122 | } |
@@ -191,18 +211,18 @@ static void ieee80211_crypt_null_deinit(void *priv) | |||
191 | } | 211 | } |
192 | 212 | ||
193 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { | 213 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { |
194 | .name = "NULL", | 214 | .name = "NULL", |
195 | .init = ieee80211_crypt_null_init, | 215 | .init = ieee80211_crypt_null_init, |
196 | .deinit = ieee80211_crypt_null_deinit, | 216 | .deinit = ieee80211_crypt_null_deinit, |
197 | .encrypt_mpdu = NULL, | 217 | .encrypt_mpdu = NULL, |
198 | .decrypt_mpdu = NULL, | 218 | .decrypt_mpdu = NULL, |
199 | .encrypt_msdu = NULL, | 219 | .encrypt_msdu = NULL, |
200 | .decrypt_msdu = NULL, | 220 | .decrypt_msdu = NULL, |
201 | .set_key = NULL, | 221 | .set_key = NULL, |
202 | .get_key = NULL, | 222 | .get_key = NULL, |
203 | .extra_prefix_len = 0, | 223 | .extra_mpdu_prefix_len = 0, |
204 | .extra_postfix_len = 0, | 224 | .extra_mpdu_postfix_len = 0, |
205 | .owner = THIS_MODULE, | 225 | .owner = THIS_MODULE, |
206 | }; | 226 | }; |
207 | 227 | ||
208 | static int __init ieee80211_crypto_init(void) | 228 | static int __init ieee80211_crypto_init(void) |
@@ -249,6 +269,7 @@ static void __exit ieee80211_crypto_deinit(void) | |||
249 | EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); | 269 | EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); |
250 | EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); | 270 | EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); |
251 | EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); | 271 | EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); |
272 | EXPORT_SYMBOL(ieee80211_crypt_quiescing); | ||
252 | 273 | ||
253 | EXPORT_SYMBOL(ieee80211_register_crypto_ops); | 274 | EXPORT_SYMBOL(ieee80211_register_crypto_ops); |
254 | EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); | 275 | EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index 8fc13f45971e..05a853c13012 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -119,7 +119,7 @@ static inline void xor_block(u8 * b, u8 * a, size_t len) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static void ccmp_init_blocks(struct crypto_tfm *tfm, | 121 | static void ccmp_init_blocks(struct crypto_tfm *tfm, |
122 | struct ieee80211_hdr *hdr, | 122 | struct ieee80211_hdr_4addr *hdr, |
123 | u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0) | 123 | u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0) |
124 | { | 124 | { |
125 | u8 *pos, qc = 0; | 125 | u8 *pos, qc = 0; |
@@ -191,26 +191,18 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
191 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | 191 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
192 | } | 192 | } |
193 | 193 | ||
194 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 194 | static int ieee80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, void *priv) |
195 | { | 195 | { |
196 | struct ieee80211_ccmp_data *key = priv; | 196 | struct ieee80211_ccmp_data *key = priv; |
197 | int data_len, i, blocks, last, len; | 197 | int i; |
198 | u8 *pos, *mic; | 198 | u8 *pos; |
199 | struct ieee80211_hdr *hdr; | ||
200 | u8 *b0 = key->tx_b0; | ||
201 | u8 *b = key->tx_b; | ||
202 | u8 *e = key->tx_e; | ||
203 | u8 *s0 = key->tx_s0; | ||
204 | 199 | ||
205 | if (skb_headroom(skb) < CCMP_HDR_LEN || | 200 | if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) |
206 | skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len) | ||
207 | return -1; | 201 | return -1; |
208 | 202 | ||
209 | data_len = skb->len - hdr_len; | ||
210 | pos = skb_push(skb, CCMP_HDR_LEN); | 203 | pos = skb_push(skb, CCMP_HDR_LEN); |
211 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); | 204 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); |
212 | pos += hdr_len; | 205 | pos += hdr_len; |
213 | mic = skb_put(skb, CCMP_MIC_LEN); | ||
214 | 206 | ||
215 | i = CCMP_PN_LEN - 1; | 207 | i = CCMP_PN_LEN - 1; |
216 | while (i >= 0) { | 208 | while (i >= 0) { |
@@ -229,7 +221,31 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
229 | *pos++ = key->tx_pn[1]; | 221 | *pos++ = key->tx_pn[1]; |
230 | *pos++ = key->tx_pn[0]; | 222 | *pos++ = key->tx_pn[0]; |
231 | 223 | ||
232 | hdr = (struct ieee80211_hdr *)skb->data; | 224 | return CCMP_HDR_LEN; |
225 | } | ||
226 | |||
227 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
228 | { | ||
229 | struct ieee80211_ccmp_data *key = priv; | ||
230 | int data_len, i, blocks, last, len; | ||
231 | u8 *pos, *mic; | ||
232 | struct ieee80211_hdr_4addr *hdr; | ||
233 | u8 *b0 = key->tx_b0; | ||
234 | u8 *b = key->tx_b; | ||
235 | u8 *e = key->tx_e; | ||
236 | u8 *s0 = key->tx_s0; | ||
237 | |||
238 | if (skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len) | ||
239 | return -1; | ||
240 | |||
241 | data_len = skb->len - hdr_len; | ||
242 | len = ieee80211_ccmp_hdr(skb, hdr_len, priv); | ||
243 | if (len < 0) | ||
244 | return -1; | ||
245 | |||
246 | pos = skb->data + hdr_len + CCMP_HDR_LEN; | ||
247 | mic = skb_put(skb, CCMP_MIC_LEN); | ||
248 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
233 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); | 249 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); |
234 | 250 | ||
235 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 251 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; |
@@ -258,7 +274,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
258 | { | 274 | { |
259 | struct ieee80211_ccmp_data *key = priv; | 275 | struct ieee80211_ccmp_data *key = priv; |
260 | u8 keyidx, *pos; | 276 | u8 keyidx, *pos; |
261 | struct ieee80211_hdr *hdr; | 277 | struct ieee80211_hdr_4addr *hdr; |
262 | u8 *b0 = key->rx_b0; | 278 | u8 *b0 = key->rx_b0; |
263 | u8 *b = key->rx_b; | 279 | u8 *b = key->rx_b; |
264 | u8 *a = key->rx_a; | 280 | u8 *a = key->rx_a; |
@@ -272,7 +288,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
272 | return -1; | 288 | return -1; |
273 | } | 289 | } |
274 | 290 | ||
275 | hdr = (struct ieee80211_hdr *)skb->data; | 291 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
276 | pos = skb->data + hdr_len; | 292 | pos = skb->data + hdr_len; |
277 | keyidx = pos[3]; | 293 | keyidx = pos[3]; |
278 | if (!(keyidx & (1 << 5))) { | 294 | if (!(keyidx & (1 << 5))) { |
@@ -426,19 +442,20 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) | |||
426 | } | 442 | } |
427 | 443 | ||
428 | static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { | 444 | static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { |
429 | .name = "CCMP", | 445 | .name = "CCMP", |
430 | .init = ieee80211_ccmp_init, | 446 | .init = ieee80211_ccmp_init, |
431 | .deinit = ieee80211_ccmp_deinit, | 447 | .deinit = ieee80211_ccmp_deinit, |
432 | .encrypt_mpdu = ieee80211_ccmp_encrypt, | 448 | .build_iv = ieee80211_ccmp_hdr, |
433 | .decrypt_mpdu = ieee80211_ccmp_decrypt, | 449 | .encrypt_mpdu = ieee80211_ccmp_encrypt, |
434 | .encrypt_msdu = NULL, | 450 | .decrypt_mpdu = ieee80211_ccmp_decrypt, |
435 | .decrypt_msdu = NULL, | 451 | .encrypt_msdu = NULL, |
436 | .set_key = ieee80211_ccmp_set_key, | 452 | .decrypt_msdu = NULL, |
437 | .get_key = ieee80211_ccmp_get_key, | 453 | .set_key = ieee80211_ccmp_set_key, |
438 | .print_stats = ieee80211_ccmp_print_stats, | 454 | .get_key = ieee80211_ccmp_get_key, |
439 | .extra_prefix_len = CCMP_HDR_LEN, | 455 | .print_stats = ieee80211_ccmp_print_stats, |
440 | .extra_postfix_len = CCMP_MIC_LEN, | 456 | .extra_mpdu_prefix_len = CCMP_HDR_LEN, |
441 | .owner = THIS_MODULE, | 457 | .extra_mpdu_postfix_len = CCMP_MIC_LEN, |
458 | .owner = THIS_MODULE, | ||
442 | }; | 459 | }; |
443 | 460 | ||
444 | static int __init ieee80211_crypto_ccmp_init(void) | 461 | static int __init ieee80211_crypto_ccmp_init(void) |
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index d4f9164be1a1..2e34f29b7956 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -59,8 +59,24 @@ struct ieee80211_tkip_data { | |||
59 | 59 | ||
60 | /* scratch buffers for virt_to_page() (crypto API) */ | 60 | /* scratch buffers for virt_to_page() (crypto API) */ |
61 | u8 rx_hdr[16], tx_hdr[16]; | 61 | u8 rx_hdr[16], tx_hdr[16]; |
62 | |||
63 | unsigned long flags; | ||
62 | }; | 64 | }; |
63 | 65 | ||
66 | static unsigned long ieee80211_tkip_set_flags(unsigned long flags, void *priv) | ||
67 | { | ||
68 | struct ieee80211_tkip_data *_priv = priv; | ||
69 | unsigned long old_flags = _priv->flags; | ||
70 | _priv->flags = flags; | ||
71 | return old_flags; | ||
72 | } | ||
73 | |||
74 | static unsigned long ieee80211_tkip_get_flags(void *priv) | ||
75 | { | ||
76 | struct ieee80211_tkip_data *_priv = priv; | ||
77 | return _priv->flags; | ||
78 | } | ||
79 | |||
64 | static void *ieee80211_tkip_init(int key_idx) | 80 | static void *ieee80211_tkip_init(int key_idx) |
65 | { | 81 | { |
66 | struct ieee80211_tkip_data *priv; | 82 | struct ieee80211_tkip_data *priv; |
@@ -69,6 +85,7 @@ static void *ieee80211_tkip_init(int key_idx) | |||
69 | if (priv == NULL) | 85 | if (priv == NULL) |
70 | goto fail; | 86 | goto fail; |
71 | memset(priv, 0, sizeof(*priv)); | 87 | memset(priv, 0, sizeof(*priv)); |
88 | |||
72 | priv->key_idx = key_idx; | 89 | priv->key_idx = key_idx; |
73 | 90 | ||
74 | priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); | 91 | priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); |
@@ -255,25 +272,27 @@ static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK, | |||
255 | #endif | 272 | #endif |
256 | } | 273 | } |
257 | 274 | ||
258 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 275 | static u8 *ieee80211_tkip_hdr(struct sk_buff *skb, int hdr_len, void *priv) |
259 | { | 276 | { |
260 | struct ieee80211_tkip_data *tkey = priv; | 277 | struct ieee80211_tkip_data *tkey = priv; |
261 | int len; | 278 | int len; |
262 | u8 rc4key[16], *pos, *icv; | 279 | u8 *rc4key, *pos, *icv; |
263 | struct ieee80211_hdr *hdr; | 280 | struct ieee80211_hdr_4addr *hdr; |
264 | u32 crc; | 281 | u32 crc; |
265 | struct scatterlist sg; | ||
266 | 282 | ||
267 | if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || | 283 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
268 | skb->len < hdr_len) | 284 | |
269 | return -1; | 285 | if (skb_headroom(skb) < 8 || skb->len < hdr_len) |
286 | return NULL; | ||
270 | 287 | ||
271 | hdr = (struct ieee80211_hdr *)skb->data; | ||
272 | if (!tkey->tx_phase1_done) { | 288 | if (!tkey->tx_phase1_done) { |
273 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, | 289 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, |
274 | tkey->tx_iv32); | 290 | tkey->tx_iv32); |
275 | tkey->tx_phase1_done = 1; | 291 | tkey->tx_phase1_done = 1; |
276 | } | 292 | } |
293 | rc4key = kmalloc(16, GFP_ATOMIC); | ||
294 | if (!rc4key) | ||
295 | return NULL; | ||
277 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); | 296 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); |
278 | 297 | ||
279 | len = skb->len - hdr_len; | 298 | len = skb->len - hdr_len; |
@@ -282,9 +301,9 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
282 | pos += hdr_len; | 301 | pos += hdr_len; |
283 | icv = skb_put(skb, 4); | 302 | icv = skb_put(skb, 4); |
284 | 303 | ||
285 | *pos++ = rc4key[0]; | 304 | *pos++ = *rc4key; |
286 | *pos++ = rc4key[1]; | 305 | *pos++ = *(rc4key + 1); |
287 | *pos++ = rc4key[2]; | 306 | *pos++ = *(rc4key + 2); |
288 | *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; | 307 | *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; |
289 | *pos++ = tkey->tx_iv32 & 0xff; | 308 | *pos++ = tkey->tx_iv32 & 0xff; |
290 | *pos++ = (tkey->tx_iv32 >> 8) & 0xff; | 309 | *pos++ = (tkey->tx_iv32 >> 8) & 0xff; |
@@ -297,6 +316,38 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
297 | icv[2] = crc >> 16; | 316 | icv[2] = crc >> 16; |
298 | icv[3] = crc >> 24; | 317 | icv[3] = crc >> 24; |
299 | 318 | ||
319 | return rc4key; | ||
320 | } | ||
321 | |||
322 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
323 | { | ||
324 | struct ieee80211_tkip_data *tkey = priv; | ||
325 | int len; | ||
326 | const u8 *rc4key; | ||
327 | u8 *pos; | ||
328 | struct scatterlist sg; | ||
329 | |||
330 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | ||
331 | if (net_ratelimit()) { | ||
332 | struct ieee80211_hdr_4addr *hdr = | ||
333 | (struct ieee80211_hdr_4addr *)skb->data; | ||
334 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | ||
335 | "TX packet to " MAC_FMT "\n", | ||
336 | MAC_ARG(hdr->addr1)); | ||
337 | } | ||
338 | return -1; | ||
339 | } | ||
340 | |||
341 | if (skb_tailroom(skb) < 4 || skb->len < hdr_len) | ||
342 | return -1; | ||
343 | |||
344 | len = skb->len - hdr_len; | ||
345 | pos = skb->data + hdr_len; | ||
346 | |||
347 | rc4key = ieee80211_tkip_hdr(skb, hdr_len, priv); | ||
348 | if (!rc4key) | ||
349 | return -1; | ||
350 | |||
300 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); | 351 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); |
301 | sg.page = virt_to_page(pos); | 352 | sg.page = virt_to_page(pos); |
302 | sg.offset = offset_in_page(pos); | 353 | sg.offset = offset_in_page(pos); |
@@ -319,16 +370,26 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
319 | u8 keyidx, *pos; | 370 | u8 keyidx, *pos; |
320 | u32 iv32; | 371 | u32 iv32; |
321 | u16 iv16; | 372 | u16 iv16; |
322 | struct ieee80211_hdr *hdr; | 373 | struct ieee80211_hdr_4addr *hdr; |
323 | u8 icv[4]; | 374 | u8 icv[4]; |
324 | u32 crc; | 375 | u32 crc; |
325 | struct scatterlist sg; | 376 | struct scatterlist sg; |
326 | int plen; | 377 | int plen; |
327 | 378 | ||
379 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
380 | |||
381 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | ||
382 | if (net_ratelimit()) { | ||
383 | printk(KERN_DEBUG "TKIP countermeasures: dropped " | ||
384 | "received packet from " MAC_FMT "\n", | ||
385 | MAC_ARG(hdr->addr2)); | ||
386 | } | ||
387 | return -1; | ||
388 | } | ||
389 | |||
328 | if (skb->len < hdr_len + 8 + 4) | 390 | if (skb->len < hdr_len + 8 + 4) |
329 | return -1; | 391 | return -1; |
330 | 392 | ||
331 | hdr = (struct ieee80211_hdr *)skb->data; | ||
332 | pos = skb->data + hdr_len; | 393 | pos = skb->data + hdr_len; |
333 | keyidx = pos[3]; | 394 | keyidx = pos[3]; |
334 | if (!(keyidx & (1 << 5))) { | 395 | if (!(keyidx & (1 << 5))) { |
@@ -441,9 +502,9 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr, | |||
441 | 502 | ||
442 | static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) | 503 | static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) |
443 | { | 504 | { |
444 | struct ieee80211_hdr *hdr11; | 505 | struct ieee80211_hdr_4addr *hdr11; |
445 | 506 | ||
446 | hdr11 = (struct ieee80211_hdr *)skb->data; | 507 | hdr11 = (struct ieee80211_hdr_4addr *)skb->data; |
447 | switch (le16_to_cpu(hdr11->frame_ctl) & | 508 | switch (le16_to_cpu(hdr11->frame_ctl) & |
448 | (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { | 509 | (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { |
449 | case IEEE80211_FCTL_TODS: | 510 | case IEEE80211_FCTL_TODS: |
@@ -490,9 +551,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, | |||
490 | return 0; | 551 | return 0; |
491 | } | 552 | } |
492 | 553 | ||
493 | #if WIRELESS_EXT >= 18 | ||
494 | static void ieee80211_michael_mic_failure(struct net_device *dev, | 554 | static void ieee80211_michael_mic_failure(struct net_device *dev, |
495 | struct ieee80211_hdr *hdr, int keyidx) | 555 | struct ieee80211_hdr_4addr *hdr, |
556 | int keyidx) | ||
496 | { | 557 | { |
497 | union iwreq_data wrqu; | 558 | union iwreq_data wrqu; |
498 | struct iw_michaelmicfailure ev; | 559 | struct iw_michaelmicfailure ev; |
@@ -510,28 +571,6 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, | |||
510 | wrqu.data.length = sizeof(ev); | 571 | wrqu.data.length = sizeof(ev); |
511 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev); | 572 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev); |
512 | } | 573 | } |
513 | #elif WIRELESS_EXT >= 15 | ||
514 | static void ieee80211_michael_mic_failure(struct net_device *dev, | ||
515 | struct ieee80211_hdr *hdr, int keyidx) | ||
516 | { | ||
517 | union iwreq_data wrqu; | ||
518 | char buf[128]; | ||
519 | |||
520 | /* TODO: needed parameters: count, keyid, key type, TSC */ | ||
521 | sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" | ||
522 | MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", | ||
523 | MAC_ARG(hdr->addr2)); | ||
524 | memset(&wrqu, 0, sizeof(wrqu)); | ||
525 | wrqu.data.length = strlen(buf); | ||
526 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | ||
527 | } | ||
528 | #else /* WIRELESS_EXT >= 15 */ | ||
529 | static inline void ieee80211_michael_mic_failure(struct net_device *dev, | ||
530 | struct ieee80211_hdr *hdr, | ||
531 | int keyidx) | ||
532 | { | ||
533 | } | ||
534 | #endif /* WIRELESS_EXT >= 15 */ | ||
535 | 574 | ||
536 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | 575 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, |
537 | int hdr_len, void *priv) | 576 | int hdr_len, void *priv) |
@@ -547,8 +586,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
547 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) | 586 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) |
548 | return -1; | 587 | return -1; |
549 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { | 588 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { |
550 | struct ieee80211_hdr *hdr; | 589 | struct ieee80211_hdr_4addr *hdr; |
551 | hdr = (struct ieee80211_hdr *)skb->data; | 590 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
552 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " | 591 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " |
553 | "MSDU from " MAC_FMT " keyidx=%d\n", | 592 | "MSDU from " MAC_FMT " keyidx=%d\n", |
554 | skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), | 593 | skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), |
@@ -654,19 +693,22 @@ static char *ieee80211_tkip_print_stats(char *p, void *priv) | |||
654 | } | 693 | } |
655 | 694 | ||
656 | static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | 695 | static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { |
657 | .name = "TKIP", | 696 | .name = "TKIP", |
658 | .init = ieee80211_tkip_init, | 697 | .init = ieee80211_tkip_init, |
659 | .deinit = ieee80211_tkip_deinit, | 698 | .deinit = ieee80211_tkip_deinit, |
660 | .encrypt_mpdu = ieee80211_tkip_encrypt, | 699 | .encrypt_mpdu = ieee80211_tkip_encrypt, |
661 | .decrypt_mpdu = ieee80211_tkip_decrypt, | 700 | .decrypt_mpdu = ieee80211_tkip_decrypt, |
662 | .encrypt_msdu = ieee80211_michael_mic_add, | 701 | .encrypt_msdu = ieee80211_michael_mic_add, |
663 | .decrypt_msdu = ieee80211_michael_mic_verify, | 702 | .decrypt_msdu = ieee80211_michael_mic_verify, |
664 | .set_key = ieee80211_tkip_set_key, | 703 | .set_key = ieee80211_tkip_set_key, |
665 | .get_key = ieee80211_tkip_get_key, | 704 | .get_key = ieee80211_tkip_get_key, |
666 | .print_stats = ieee80211_tkip_print_stats, | 705 | .print_stats = ieee80211_tkip_print_stats, |
667 | .extra_prefix_len = 4 + 4, /* IV + ExtIV */ | 706 | .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */ |
668 | .extra_postfix_len = 8 + 4, /* MIC + ICV */ | 707 | .extra_mpdu_postfix_len = 4, /* ICV */ |
669 | .owner = THIS_MODULE, | 708 | .extra_msdu_postfix_len = 8, /* MIC */ |
709 | .get_flags = ieee80211_tkip_get_flags, | ||
710 | .set_flags = ieee80211_tkip_set_flags, | ||
711 | .owner = THIS_MODULE, | ||
670 | }; | 712 | }; |
671 | 713 | ||
672 | static int __init ieee80211_crypto_tkip_init(void) | 714 | static int __init ieee80211_crypto_tkip_init(void) |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index b4d2514a0902..7c08ed2f2628 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -229,19 +229,19 @@ static char *prism2_wep_print_stats(char *p, void *priv) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | 231 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { |
232 | .name = "WEP", | 232 | .name = "WEP", |
233 | .init = prism2_wep_init, | 233 | .init = prism2_wep_init, |
234 | .deinit = prism2_wep_deinit, | 234 | .deinit = prism2_wep_deinit, |
235 | .encrypt_mpdu = prism2_wep_encrypt, | 235 | .encrypt_mpdu = prism2_wep_encrypt, |
236 | .decrypt_mpdu = prism2_wep_decrypt, | 236 | .decrypt_mpdu = prism2_wep_decrypt, |
237 | .encrypt_msdu = NULL, | 237 | .encrypt_msdu = NULL, |
238 | .decrypt_msdu = NULL, | 238 | .decrypt_msdu = NULL, |
239 | .set_key = prism2_wep_set_key, | 239 | .set_key = prism2_wep_set_key, |
240 | .get_key = prism2_wep_get_key, | 240 | .get_key = prism2_wep_get_key, |
241 | .print_stats = prism2_wep_print_stats, | 241 | .print_stats = prism2_wep_print_stats, |
242 | .extra_prefix_len = 4, /* IV */ | 242 | .extra_mpdu_prefix_len = 4, /* IV */ |
243 | .extra_postfix_len = 4, /* ICV */ | 243 | .extra_mpdu_postfix_len = 4, /* ICV */ |
244 | .owner = THIS_MODULE, | 244 | .owner = THIS_MODULE, |
245 | }; | 245 | }; |
246 | 246 | ||
247 | static int __init ieee80211_crypto_wep_init(void) | 247 | static int __init ieee80211_crypto_wep_init(void) |
diff --git a/net/ieee80211/ieee80211_geo.c b/net/ieee80211/ieee80211_geo.c new file mode 100644 index 000000000000..c4b54ef8f6d5 --- /dev/null +++ b/net/ieee80211/ieee80211_geo.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /****************************************************************************** | ||
2 | |||
3 | Copyright(c) 2005 Intel Corporation. All rights reserved. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify it | ||
6 | under the terms of version 2 of the GNU General Public License as | ||
7 | published by the Free Software Foundation. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along with | ||
15 | this program; if not, write to the Free Software Foundation, Inc., 59 | ||
16 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | |||
18 | The full GNU General Public License is included in this distribution in the | ||
19 | file called LICENSE. | ||
20 | |||
21 | Contact Information: | ||
22 | James P. Ketrenos <ipw2100-admin@linux.intel.com> | ||
23 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
24 | |||
25 | ******************************************************************************/ | ||
26 | #include <linux/compiler.h> | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/if_arp.h> | ||
30 | #include <linux/in6.h> | ||
31 | #include <linux/in.h> | ||
32 | #include <linux/ip.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/netdevice.h> | ||
36 | #include <linux/proc_fs.h> | ||
37 | #include <linux/skbuff.h> | ||
38 | #include <linux/slab.h> | ||
39 | #include <linux/tcp.h> | ||
40 | #include <linux/types.h> | ||
41 | #include <linux/version.h> | ||
42 | #include <linux/wireless.h> | ||
43 | #include <linux/etherdevice.h> | ||
44 | #include <asm/uaccess.h> | ||
45 | |||
46 | #include <net/ieee80211.h> | ||
47 | |||
48 | int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | ||
49 | { | ||
50 | int i; | ||
51 | |||
52 | /* Driver needs to initialize the geography map before using | ||
53 | * these helper functions */ | ||
54 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
55 | |||
56 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
57 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
58 | /* NOTE: If G mode is currently supported but | ||
59 | * this is a B only channel, we don't see it | ||
60 | * as valid. */ | ||
61 | if ((ieee->geo.bg[i].channel == channel) && | ||
62 | (!(ieee->mode & IEEE_G) || | ||
63 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | ||
64 | return IEEE80211_24GHZ_BAND; | ||
65 | |||
66 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
67 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
68 | if (ieee->geo.a[i].channel == channel) | ||
69 | return IEEE80211_52GHZ_BAND; | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel) | ||
75 | { | ||
76 | int i; | ||
77 | |||
78 | /* Driver needs to initialize the geography map before using | ||
79 | * these helper functions */ | ||
80 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
81 | |||
82 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
83 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
84 | if (ieee->geo.bg[i].channel == channel) | ||
85 | return i; | ||
86 | |||
87 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
88 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
89 | if (ieee->geo.a[i].channel == channel) | ||
90 | return i; | ||
91 | |||
92 | return -1; | ||
93 | } | ||
94 | |||
95 | u8 ieee80211_freq_to_channel(struct ieee80211_device * ieee, u32 freq) | ||
96 | { | ||
97 | int i; | ||
98 | |||
99 | /* Driver needs to initialize the geography map before using | ||
100 | * these helper functions */ | ||
101 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
102 | |||
103 | freq /= 100000; | ||
104 | |||
105 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
106 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
107 | if (ieee->geo.bg[i].freq == freq) | ||
108 | return ieee->geo.bg[i].channel; | ||
109 | |||
110 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
111 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
112 | if (ieee->geo.a[i].freq == freq) | ||
113 | return ieee->geo.a[i].channel; | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | int ieee80211_set_geo(struct ieee80211_device *ieee, | ||
119 | const struct ieee80211_geo *geo) | ||
120 | { | ||
121 | memcpy(ieee->geo.name, geo->name, 3); | ||
122 | ieee->geo.name[3] = '\0'; | ||
123 | ieee->geo.bg_channels = geo->bg_channels; | ||
124 | ieee->geo.a_channels = geo->a_channels; | ||
125 | memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * | ||
126 | sizeof(struct ieee80211_channel)); | ||
127 | memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * | ||
128 | sizeof(struct ieee80211_channel)); | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee) | ||
133 | { | ||
134 | return &ieee->geo; | ||
135 | } | ||
136 | |||
137 | EXPORT_SYMBOL(ieee80211_is_valid_channel); | ||
138 | EXPORT_SYMBOL(ieee80211_freq_to_channel); | ||
139 | EXPORT_SYMBOL(ieee80211_channel_to_index); | ||
140 | EXPORT_SYMBOL(ieee80211_set_geo); | ||
141 | EXPORT_SYMBOL(ieee80211_get_geo); | ||
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 6059e9e37123..f66d792cd204 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Copyright(c) 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2004-2005 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | Portions of this file are based on the WEP enablement code provided by the | 5 | Portions of this file are based on the WEP enablement code provided by the |
6 | Host AP project hostap-drivers v0.1.3 | 6 | Host AP project hostap-drivers v0.1.3 |
@@ -53,12 +53,15 @@ | |||
53 | 53 | ||
54 | #include <net/ieee80211.h> | 54 | #include <net/ieee80211.h> |
55 | 55 | ||
56 | MODULE_DESCRIPTION("802.11 data/management/control stack"); | 56 | #define DRV_DESCRIPTION "802.11 data/management/control stack" |
57 | MODULE_AUTHOR | 57 | #define DRV_NAME "ieee80211" |
58 | ("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); | 58 | #define DRV_VERSION IEEE80211_VERSION |
59 | MODULE_LICENSE("GPL"); | 59 | #define DRV_COPYRIGHT "Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>" |
60 | 60 | ||
61 | #define DRV_NAME "ieee80211" | 61 | MODULE_VERSION(DRV_VERSION); |
62 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | ||
63 | MODULE_AUTHOR(DRV_COPYRIGHT); | ||
64 | MODULE_LICENSE("GPL"); | ||
62 | 65 | ||
63 | static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) | 66 | static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) |
64 | { | 67 | { |
@@ -126,26 +129,34 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
126 | 129 | ||
127 | /* Default fragmentation threshold is maximum payload size */ | 130 | /* Default fragmentation threshold is maximum payload size */ |
128 | ieee->fts = DEFAULT_FTS; | 131 | ieee->fts = DEFAULT_FTS; |
132 | ieee->rts = DEFAULT_FTS; | ||
129 | ieee->scan_age = DEFAULT_MAX_SCAN_AGE; | 133 | ieee->scan_age = DEFAULT_MAX_SCAN_AGE; |
130 | ieee->open_wep = 1; | 134 | ieee->open_wep = 1; |
131 | 135 | ||
132 | /* Default to enabling full open WEP with host based encrypt/decrypt */ | 136 | /* Default to enabling full open WEP with host based encrypt/decrypt */ |
133 | ieee->host_encrypt = 1; | 137 | ieee->host_encrypt = 1; |
134 | ieee->host_decrypt = 1; | 138 | ieee->host_decrypt = 1; |
139 | ieee->host_mc_decrypt = 1; | ||
140 | |||
141 | /* Host fragementation in Open mode. Default is enabled. | ||
142 | * Note: host fragmentation is always enabled if host encryption | ||
143 | * is enabled. For cards can do hardware encryption, they must do | ||
144 | * hardware fragmentation as well. So we don't need a variable | ||
145 | * like host_enc_frag. */ | ||
146 | ieee->host_open_frag = 1; | ||
135 | ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ | 147 | ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ |
136 | 148 | ||
137 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); | 149 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); |
138 | init_timer(&ieee->crypt_deinit_timer); | 150 | init_timer(&ieee->crypt_deinit_timer); |
139 | ieee->crypt_deinit_timer.data = (unsigned long)ieee; | 151 | ieee->crypt_deinit_timer.data = (unsigned long)ieee; |
140 | ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; | 152 | ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; |
153 | ieee->crypt_quiesced = 0; | ||
141 | 154 | ||
142 | spin_lock_init(&ieee->lock); | 155 | spin_lock_init(&ieee->lock); |
143 | 156 | ||
144 | ieee->wpa_enabled = 0; | 157 | ieee->wpa_enabled = 0; |
145 | ieee->tkip_countermeasures = 0; | ||
146 | ieee->drop_unencrypted = 0; | 158 | ieee->drop_unencrypted = 0; |
147 | ieee->privacy_invoked = 0; | 159 | ieee->privacy_invoked = 0; |
148 | ieee->ieee802_1x = 1; | ||
149 | 160 | ||
150 | return dev; | 161 | return dev; |
151 | 162 | ||
@@ -161,6 +172,7 @@ void free_ieee80211(struct net_device *dev) | |||
161 | 172 | ||
162 | int i; | 173 | int i; |
163 | 174 | ||
175 | ieee80211_crypt_quiescing(ieee); | ||
164 | del_timer_sync(&ieee->crypt_deinit_timer); | 176 | del_timer_sync(&ieee->crypt_deinit_timer); |
165 | ieee80211_crypt_deinit_entries(ieee, 1); | 177 | ieee80211_crypt_deinit_entries(ieee, 1); |
166 | 178 | ||
@@ -195,38 +207,26 @@ static int show_debug_level(char *page, char **start, off_t offset, | |||
195 | static int store_debug_level(struct file *file, const char __user * buffer, | 207 | static int store_debug_level(struct file *file, const char __user * buffer, |
196 | unsigned long count, void *data) | 208 | unsigned long count, void *data) |
197 | { | 209 | { |
198 | char buf[] = "0x00000000"; | 210 | char buf[] = "0x00000000\n"; |
199 | char *p = (char *)buf; | 211 | unsigned long len = min((unsigned long)sizeof(buf) - 1, count); |
200 | unsigned long val; | 212 | unsigned long val; |
201 | 213 | ||
202 | if (count > sizeof(buf) - 1) | 214 | if (copy_from_user(buf, buffer, len)) |
203 | count = sizeof(buf) - 1; | ||
204 | |||
205 | if (copy_from_user(buf, buffer, count)) | ||
206 | return count; | 215 | return count; |
207 | buf[count] = 0; | 216 | buf[len] = 0; |
208 | /* | 217 | if (sscanf(buf, "%li", &val) != 1) |
209 | * what a FPOS... What, sscanf(buf, "%i", &val) would be too | ||
210 | * scary? | ||
211 | */ | ||
212 | if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { | ||
213 | p++; | ||
214 | if (p[0] == 'x' || p[0] == 'X') | ||
215 | p++; | ||
216 | val = simple_strtoul(p, &p, 16); | ||
217 | } else | ||
218 | val = simple_strtoul(p, &p, 10); | ||
219 | if (p == buf) | ||
220 | printk(KERN_INFO DRV_NAME | 218 | printk(KERN_INFO DRV_NAME |
221 | ": %s is not in hex or decimal form.\n", buf); | 219 | ": %s is not in hex or decimal form.\n", buf); |
222 | else | 220 | else |
223 | ieee80211_debug_level = val; | 221 | ieee80211_debug_level = val; |
224 | 222 | ||
225 | return strlen(buf); | 223 | return strnlen(buf, len); |
226 | } | 224 | } |
225 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
227 | 226 | ||
228 | static int __init ieee80211_init(void) | 227 | static int __init ieee80211_init(void) |
229 | { | 228 | { |
229 | #ifdef CONFIG_IEEE80211_DEBUG | ||
230 | struct proc_dir_entry *e; | 230 | struct proc_dir_entry *e; |
231 | 231 | ||
232 | ieee80211_debug_level = debug; | 232 | ieee80211_debug_level = debug; |
@@ -246,26 +246,33 @@ static int __init ieee80211_init(void) | |||
246 | e->read_proc = show_debug_level; | 246 | e->read_proc = show_debug_level; |
247 | e->write_proc = store_debug_level; | 247 | e->write_proc = store_debug_level; |
248 | e->data = NULL; | 248 | e->data = NULL; |
249 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
250 | |||
251 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); | ||
252 | printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); | ||
249 | 253 | ||
250 | return 0; | 254 | return 0; |
251 | } | 255 | } |
252 | 256 | ||
253 | static void __exit ieee80211_exit(void) | 257 | static void __exit ieee80211_exit(void) |
254 | { | 258 | { |
259 | #ifdef CONFIG_IEEE80211_DEBUG | ||
255 | if (ieee80211_proc) { | 260 | if (ieee80211_proc) { |
256 | remove_proc_entry("debug_level", ieee80211_proc); | 261 | remove_proc_entry("debug_level", ieee80211_proc); |
257 | remove_proc_entry(DRV_NAME, proc_net); | 262 | remove_proc_entry(DRV_NAME, proc_net); |
258 | ieee80211_proc = NULL; | 263 | ieee80211_proc = NULL; |
259 | } | 264 | } |
265 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
260 | } | 266 | } |
261 | 267 | ||
268 | #ifdef CONFIG_IEEE80211_DEBUG | ||
262 | #include <linux/moduleparam.h> | 269 | #include <linux/moduleparam.h> |
263 | module_param(debug, int, 0444); | 270 | module_param(debug, int, 0444); |
264 | MODULE_PARM_DESC(debug, "debug output mask"); | 271 | MODULE_PARM_DESC(debug, "debug output mask"); |
272 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
265 | 273 | ||
266 | module_exit(ieee80211_exit); | 274 | module_exit(ieee80211_exit); |
267 | module_init(ieee80211_init); | 275 | module_init(ieee80211_init); |
268 | #endif | ||
269 | 276 | ||
270 | const char *escape_essid(const char *essid, u8 essid_len) | 277 | const char *escape_essid(const char *essid, u8 essid_len) |
271 | { | 278 | { |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index f7dcd854139e..fcf05bf677b8 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | 5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen |
6 | * <jkmaline@cc.hut.fi> | 6 | * <jkmaline@cc.hut.fi> |
7 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | 7 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> |
8 | * Copyright (c) 2004, Intel Corporation | 8 | * Copyright (c) 2004-2005, Intel Corporation |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -87,7 +87,7 @@ static struct ieee80211_frag_entry *ieee80211_frag_cache_find(struct | |||
87 | 87 | ||
88 | /* Called only as a tasklet (software IRQ) */ | 88 | /* Called only as a tasklet (software IRQ) */ |
89 | static struct sk_buff *ieee80211_frag_cache_get(struct ieee80211_device *ieee, | 89 | static struct sk_buff *ieee80211_frag_cache_get(struct ieee80211_device *ieee, |
90 | struct ieee80211_hdr *hdr) | 90 | struct ieee80211_hdr_4addr *hdr) |
91 | { | 91 | { |
92 | struct sk_buff *skb = NULL; | 92 | struct sk_buff *skb = NULL; |
93 | u16 sc; | 93 | u16 sc; |
@@ -101,7 +101,7 @@ static struct sk_buff *ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
101 | if (frag == 0) { | 101 | if (frag == 0) { |
102 | /* Reserve enough space to fit maximum frame length */ | 102 | /* Reserve enough space to fit maximum frame length */ |
103 | skb = dev_alloc_skb(ieee->dev->mtu + | 103 | skb = dev_alloc_skb(ieee->dev->mtu + |
104 | sizeof(struct ieee80211_hdr) + | 104 | sizeof(struct ieee80211_hdr_4addr) + |
105 | 8 /* LLC */ + | 105 | 8 /* LLC */ + |
106 | 2 /* alignment */ + | 106 | 2 /* alignment */ + |
107 | 8 /* WEP */ + ETH_ALEN /* WDS */ ); | 107 | 8 /* WEP */ + ETH_ALEN /* WDS */ ); |
@@ -138,7 +138,7 @@ static struct sk_buff *ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
138 | 138 | ||
139 | /* Called only as a tasklet (software IRQ) */ | 139 | /* Called only as a tasklet (software IRQ) */ |
140 | static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | 140 | static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, |
141 | struct ieee80211_hdr *hdr) | 141 | struct ieee80211_hdr_4addr *hdr) |
142 | { | 142 | { |
143 | u16 sc; | 143 | u16 sc; |
144 | unsigned int seq; | 144 | unsigned int seq; |
@@ -176,7 +176,7 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
176 | ieee->dev->name); | 176 | ieee->dev->name); |
177 | return 0; | 177 | return 0; |
178 | /* | 178 | /* |
179 | hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr *) | 179 | hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr_4addr *) |
180 | skb->data);*/ | 180 | skb->data);*/ |
181 | } | 181 | } |
182 | 182 | ||
@@ -232,13 +232,13 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | |||
232 | { | 232 | { |
233 | struct net_device *dev = ieee->dev; | 233 | struct net_device *dev = ieee->dev; |
234 | u16 fc, ethertype; | 234 | u16 fc, ethertype; |
235 | struct ieee80211_hdr *hdr; | 235 | struct ieee80211_hdr_3addr *hdr; |
236 | u8 *pos; | 236 | u8 *pos; |
237 | 237 | ||
238 | if (skb->len < 24) | 238 | if (skb->len < 24) |
239 | return 0; | 239 | return 0; |
240 | 240 | ||
241 | hdr = (struct ieee80211_hdr *)skb->data; | 241 | hdr = (struct ieee80211_hdr_3addr *)skb->data; |
242 | fc = le16_to_cpu(hdr->frame_ctl); | 242 | fc = le16_to_cpu(hdr->frame_ctl); |
243 | 243 | ||
244 | /* check that the frame is unicast frame to us */ | 244 | /* check that the frame is unicast frame to us */ |
@@ -271,26 +271,15 @@ static inline int | |||
271 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | 271 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, |
272 | struct ieee80211_crypt_data *crypt) | 272 | struct ieee80211_crypt_data *crypt) |
273 | { | 273 | { |
274 | struct ieee80211_hdr *hdr; | 274 | struct ieee80211_hdr_3addr *hdr; |
275 | int res, hdrlen; | 275 | int res, hdrlen; |
276 | 276 | ||
277 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | 277 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) |
278 | return 0; | 278 | return 0; |
279 | 279 | ||
280 | hdr = (struct ieee80211_hdr *)skb->data; | 280 | hdr = (struct ieee80211_hdr_3addr *)skb->data; |
281 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 281 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
282 | 282 | ||
283 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | ||
284 | if (ieee->tkip_countermeasures && strcmp(crypt->ops->name, "TKIP") == 0) { | ||
285 | if (net_ratelimit()) { | ||
286 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | ||
287 | "received packet from " MAC_FMT "\n", | ||
288 | ieee->dev->name, MAC_ARG(hdr->addr2)); | ||
289 | } | ||
290 | return -1; | ||
291 | } | ||
292 | #endif | ||
293 | |||
294 | atomic_inc(&crypt->refcnt); | 283 | atomic_inc(&crypt->refcnt); |
295 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); | 284 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); |
296 | atomic_dec(&crypt->refcnt); | 285 | atomic_dec(&crypt->refcnt); |
@@ -314,13 +303,13 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | |||
314 | struct sk_buff *skb, int keyidx, | 303 | struct sk_buff *skb, int keyidx, |
315 | struct ieee80211_crypt_data *crypt) | 304 | struct ieee80211_crypt_data *crypt) |
316 | { | 305 | { |
317 | struct ieee80211_hdr *hdr; | 306 | struct ieee80211_hdr_3addr *hdr; |
318 | int res, hdrlen; | 307 | int res, hdrlen; |
319 | 308 | ||
320 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | 309 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) |
321 | return 0; | 310 | return 0; |
322 | 311 | ||
323 | hdr = (struct ieee80211_hdr *)skb->data; | 312 | hdr = (struct ieee80211_hdr_3addr *)skb->data; |
324 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 313 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
325 | 314 | ||
326 | atomic_inc(&crypt->refcnt); | 315 | atomic_inc(&crypt->refcnt); |
@@ -343,7 +332,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
343 | struct ieee80211_rx_stats *rx_stats) | 332 | struct ieee80211_rx_stats *rx_stats) |
344 | { | 333 | { |
345 | struct net_device *dev = ieee->dev; | 334 | struct net_device *dev = ieee->dev; |
346 | struct ieee80211_hdr *hdr; | 335 | struct ieee80211_hdr_4addr *hdr; |
347 | size_t hdrlen; | 336 | size_t hdrlen; |
348 | u16 fc, type, stype, sc; | 337 | u16 fc, type, stype, sc; |
349 | struct net_device_stats *stats; | 338 | struct net_device_stats *stats; |
@@ -363,7 +352,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
363 | struct ieee80211_crypt_data *crypt = NULL; | 352 | struct ieee80211_crypt_data *crypt = NULL; |
364 | int keyidx = 0; | 353 | int keyidx = 0; |
365 | 354 | ||
366 | hdr = (struct ieee80211_hdr *)skb->data; | 355 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
367 | stats = &ieee->stats; | 356 | stats = &ieee->stats; |
368 | 357 | ||
369 | if (skb->len < 10) { | 358 | if (skb->len < 10) { |
@@ -378,35 +367,50 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
378 | frag = WLAN_GET_SEQ_FRAG(sc); | 367 | frag = WLAN_GET_SEQ_FRAG(sc); |
379 | hdrlen = ieee80211_get_hdrlen(fc); | 368 | hdrlen = ieee80211_get_hdrlen(fc); |
380 | 369 | ||
381 | #ifdef NOT_YET | ||
382 | #if WIRELESS_EXT > 15 | ||
383 | /* Put this code here so that we avoid duplicating it in all | 370 | /* Put this code here so that we avoid duplicating it in all |
384 | * Rx paths. - Jean II */ | 371 | * Rx paths. - Jean II */ |
385 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ | 372 | #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ |
386 | /* If spy monitoring on */ | 373 | /* If spy monitoring on */ |
387 | if (iface->spy_data.spy_number > 0) { | 374 | if (ieee->spy_data.spy_number > 0) { |
388 | struct iw_quality wstats; | 375 | struct iw_quality wstats; |
389 | wstats.level = rx_stats->signal; | 376 | |
390 | wstats.noise = rx_stats->noise; | 377 | wstats.updated = 0; |
391 | wstats.updated = 6; /* No qual value */ | 378 | if (rx_stats->mask & IEEE80211_STATMASK_RSSI) { |
379 | wstats.level = rx_stats->rssi; | ||
380 | wstats.updated |= IW_QUAL_LEVEL_UPDATED; | ||
381 | } else | ||
382 | wstats.updated |= IW_QUAL_LEVEL_INVALID; | ||
383 | |||
384 | if (rx_stats->mask & IEEE80211_STATMASK_NOISE) { | ||
385 | wstats.noise = rx_stats->noise; | ||
386 | wstats.updated |= IW_QUAL_NOISE_UPDATED; | ||
387 | } else | ||
388 | wstats.updated |= IW_QUAL_NOISE_INVALID; | ||
389 | |||
390 | if (rx_stats->mask & IEEE80211_STATMASK_SIGNAL) { | ||
391 | wstats.qual = rx_stats->signal; | ||
392 | wstats.updated |= IW_QUAL_QUAL_UPDATED; | ||
393 | } else | ||
394 | wstats.updated |= IW_QUAL_QUAL_INVALID; | ||
395 | |||
392 | /* Update spy records */ | 396 | /* Update spy records */ |
393 | wireless_spy_update(dev, hdr->addr2, &wstats); | 397 | wireless_spy_update(ieee->dev, hdr->addr2, &wstats); |
394 | } | 398 | } |
395 | #endif /* IW_WIRELESS_SPY */ | 399 | #endif /* IW_WIRELESS_SPY */ |
396 | #endif /* WIRELESS_EXT > 15 */ | 400 | |
401 | #ifdef NOT_YET | ||
397 | hostap_update_rx_stats(local->ap, hdr, rx_stats); | 402 | hostap_update_rx_stats(local->ap, hdr, rx_stats); |
398 | #endif | 403 | #endif |
399 | 404 | ||
400 | #if WIRELESS_EXT > 15 | ||
401 | if (ieee->iw_mode == IW_MODE_MONITOR) { | 405 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
402 | ieee80211_monitor_rx(ieee, skb, rx_stats); | 406 | ieee80211_monitor_rx(ieee, skb, rx_stats); |
403 | stats->rx_packets++; | 407 | stats->rx_packets++; |
404 | stats->rx_bytes += skb->len; | 408 | stats->rx_bytes += skb->len; |
405 | return 1; | 409 | return 1; |
406 | } | 410 | } |
407 | #endif | ||
408 | 411 | ||
409 | if (ieee->host_decrypt) { | 412 | if (is_multicast_ether_addr(hdr->addr1) ? ieee->host_mc_decrypt : |
413 | ieee->host_decrypt) { | ||
410 | int idx = 0; | 414 | int idx = 0; |
411 | if (skb->len >= hdrlen + 3) | 415 | if (skb->len >= hdrlen + 3) |
412 | idx = skb->data[hdrlen + 3] >> 6; | 416 | idx = skb->data[hdrlen + 3] >> 6; |
@@ -531,6 +535,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
531 | 535 | ||
532 | /* Nullfunc frames may have PS-bit set, so they must be passed to | 536 | /* Nullfunc frames may have PS-bit set, so they must be passed to |
533 | * hostap_handle_sta_rx() before being dropped here. */ | 537 | * hostap_handle_sta_rx() before being dropped here. */ |
538 | |||
539 | stype &= ~IEEE80211_STYPE_QOS_DATA; | ||
540 | |||
534 | if (stype != IEEE80211_STYPE_DATA && | 541 | if (stype != IEEE80211_STYPE_DATA && |
535 | stype != IEEE80211_STYPE_DATA_CFACK && | 542 | stype != IEEE80211_STYPE_DATA_CFACK && |
536 | stype != IEEE80211_STYPE_DATA_CFPOLL && | 543 | stype != IEEE80211_STYPE_DATA_CFPOLL && |
@@ -549,7 +556,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
549 | (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) | 556 | (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) |
550 | goto rx_dropped; | 557 | goto rx_dropped; |
551 | 558 | ||
552 | hdr = (struct ieee80211_hdr *)skb->data; | 559 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
553 | 560 | ||
554 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 561 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
555 | // PR: FIXME: hostap has additional conditions in the "if" below: | 562 | // PR: FIXME: hostap has additional conditions in the "if" below: |
@@ -603,7 +610,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
603 | /* this was the last fragment and the frame will be | 610 | /* this was the last fragment and the frame will be |
604 | * delivered, so remove skb from fragment cache */ | 611 | * delivered, so remove skb from fragment cache */ |
605 | skb = frag_skb; | 612 | skb = frag_skb; |
606 | hdr = (struct ieee80211_hdr *)skb->data; | 613 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
607 | ieee80211_frag_cache_invalidate(ieee, hdr); | 614 | ieee80211_frag_cache_invalidate(ieee, hdr); |
608 | } | 615 | } |
609 | 616 | ||
@@ -613,7 +620,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
613 | ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) | 620 | ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) |
614 | goto rx_dropped; | 621 | goto rx_dropped; |
615 | 622 | ||
616 | hdr = (struct ieee80211_hdr *)skb->data; | 623 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
617 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { | 624 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { |
618 | if ( /*ieee->ieee802_1x && */ | 625 | if ( /*ieee->ieee802_1x && */ |
619 | ieee80211_is_eapol_frame(ieee, skb)) { | 626 | ieee80211_is_eapol_frame(ieee, skb)) { |
@@ -755,6 +762,264 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
755 | 762 | ||
756 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 | 763 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 |
757 | 764 | ||
765 | static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; | ||
766 | |||
767 | /* | ||
768 | * Make ther structure we read from the beacon packet has | ||
769 | * the right values | ||
770 | */ | ||
771 | static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element | ||
772 | *info_element, int sub_type) | ||
773 | { | ||
774 | |||
775 | if (info_element->qui_subtype != sub_type) | ||
776 | return -1; | ||
777 | if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN)) | ||
778 | return -1; | ||
779 | if (info_element->qui_type != QOS_OUI_TYPE) | ||
780 | return -1; | ||
781 | if (info_element->version != QOS_VERSION_1) | ||
782 | return -1; | ||
783 | |||
784 | return 0; | ||
785 | } | ||
786 | |||
787 | /* | ||
788 | * Parse a QoS parameter element | ||
789 | */ | ||
790 | static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info | ||
791 | *element_param, struct ieee80211_info_element | ||
792 | *info_element) | ||
793 | { | ||
794 | int ret = 0; | ||
795 | u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2; | ||
796 | |||
797 | if ((info_element == NULL) || (element_param == NULL)) | ||
798 | return -1; | ||
799 | |||
800 | if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) { | ||
801 | memcpy(element_param->info_element.qui, info_element->data, | ||
802 | info_element->len); | ||
803 | element_param->info_element.elementID = info_element->id; | ||
804 | element_param->info_element.length = info_element->len; | ||
805 | } else | ||
806 | ret = -1; | ||
807 | if (ret == 0) | ||
808 | ret = ieee80211_verify_qos_info(&element_param->info_element, | ||
809 | QOS_OUI_PARAM_SUB_TYPE); | ||
810 | return ret; | ||
811 | } | ||
812 | |||
813 | /* | ||
814 | * Parse a QoS information element | ||
815 | */ | ||
816 | static int ieee80211_read_qos_info_element(struct | ||
817 | ieee80211_qos_information_element | ||
818 | *element_info, struct ieee80211_info_element | ||
819 | *info_element) | ||
820 | { | ||
821 | int ret = 0; | ||
822 | u16 size = sizeof(struct ieee80211_qos_information_element) - 2; | ||
823 | |||
824 | if (element_info == NULL) | ||
825 | return -1; | ||
826 | if (info_element == NULL) | ||
827 | return -1; | ||
828 | |||
829 | if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { | ||
830 | memcpy(element_info->qui, info_element->data, | ||
831 | info_element->len); | ||
832 | element_info->elementID = info_element->id; | ||
833 | element_info->length = info_element->len; | ||
834 | } else | ||
835 | ret = -1; | ||
836 | |||
837 | if (ret == 0) | ||
838 | ret = ieee80211_verify_qos_info(element_info, | ||
839 | QOS_OUI_INFO_SUB_TYPE); | ||
840 | return ret; | ||
841 | } | ||
842 | |||
843 | /* | ||
844 | * Write QoS parameters from the ac parameters. | ||
845 | */ | ||
846 | static int ieee80211_qos_convert_ac_to_parameters(struct | ||
847 | ieee80211_qos_parameter_info | ||
848 | *param_elm, struct | ||
849 | ieee80211_qos_parameters | ||
850 | *qos_param) | ||
851 | { | ||
852 | int rc = 0; | ||
853 | int i; | ||
854 | struct ieee80211_qos_ac_parameter *ac_params; | ||
855 | u32 txop; | ||
856 | u8 cw_min; | ||
857 | u8 cw_max; | ||
858 | |||
859 | for (i = 0; i < QOS_QUEUE_NUM; i++) { | ||
860 | ac_params = &(param_elm->ac_params_record[i]); | ||
861 | |||
862 | qos_param->aifs[i] = (ac_params->aci_aifsn) & 0x0F; | ||
863 | qos_param->aifs[i] -= (qos_param->aifs[i] < 2) ? 0 : 2; | ||
864 | |||
865 | cw_min = ac_params->ecw_min_max & 0x0F; | ||
866 | qos_param->cw_min[i] = (u16) ((1 << cw_min) - 1); | ||
867 | |||
868 | cw_max = (ac_params->ecw_min_max & 0xF0) >> 4; | ||
869 | qos_param->cw_max[i] = (u16) ((1 << cw_max) - 1); | ||
870 | |||
871 | qos_param->flag[i] = | ||
872 | (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; | ||
873 | |||
874 | txop = le16_to_cpu(ac_params->tx_op_limit) * 32; | ||
875 | qos_param->tx_op_limit[i] = (u16) txop; | ||
876 | } | ||
877 | return rc; | ||
878 | } | ||
879 | |||
880 | /* | ||
881 | * we have a generic data element which it may contain QoS information or | ||
882 | * parameters element. check the information element length to decide | ||
883 | * which type to read | ||
884 | */ | ||
885 | static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element | ||
886 | *info_element, | ||
887 | struct ieee80211_network *network) | ||
888 | { | ||
889 | int rc = 0; | ||
890 | struct ieee80211_qos_parameters *qos_param = NULL; | ||
891 | struct ieee80211_qos_information_element qos_info_element; | ||
892 | |||
893 | rc = ieee80211_read_qos_info_element(&qos_info_element, info_element); | ||
894 | |||
895 | if (rc == 0) { | ||
896 | network->qos_data.param_count = qos_info_element.ac_info & 0x0F; | ||
897 | network->flags |= NETWORK_HAS_QOS_INFORMATION; | ||
898 | } else { | ||
899 | struct ieee80211_qos_parameter_info param_element; | ||
900 | |||
901 | rc = ieee80211_read_qos_param_element(¶m_element, | ||
902 | info_element); | ||
903 | if (rc == 0) { | ||
904 | qos_param = &(network->qos_data.parameters); | ||
905 | ieee80211_qos_convert_ac_to_parameters(¶m_element, | ||
906 | qos_param); | ||
907 | network->flags |= NETWORK_HAS_QOS_PARAMETERS; | ||
908 | network->qos_data.param_count = | ||
909 | param_element.info_element.ac_info & 0x0F; | ||
910 | } | ||
911 | } | ||
912 | |||
913 | if (rc == 0) { | ||
914 | IEEE80211_DEBUG_QOS("QoS is supported\n"); | ||
915 | network->qos_data.supported = 1; | ||
916 | } | ||
917 | return rc; | ||
918 | } | ||
919 | |||
920 | static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct ieee80211_assoc_response | ||
921 | *frame, struct ieee80211_rx_stats *stats) | ||
922 | { | ||
923 | struct ieee80211_network network_resp; | ||
924 | struct ieee80211_network *network = &network_resp; | ||
925 | struct ieee80211_info_element *info_element; | ||
926 | struct net_device *dev = ieee->dev; | ||
927 | u16 left; | ||
928 | |||
929 | network->flags = 0; | ||
930 | network->qos_data.active = 0; | ||
931 | network->qos_data.supported = 0; | ||
932 | network->qos_data.param_count = 0; | ||
933 | network->qos_data.old_param_count = 0; | ||
934 | |||
935 | //network->atim_window = le16_to_cpu(frame->aid) & (0x3FFF); | ||
936 | network->atim_window = le16_to_cpu(frame->aid); | ||
937 | network->listen_interval = le16_to_cpu(frame->status); | ||
938 | |||
939 | info_element = frame->info_element; | ||
940 | left = stats->len - sizeof(*frame); | ||
941 | |||
942 | while (left >= sizeof(struct ieee80211_info_element)) { | ||
943 | if (sizeof(struct ieee80211_info_element) + | ||
944 | info_element->len > left) { | ||
945 | IEEE80211_DEBUG_QOS("ASSOC RESP: parse failed: " | ||
946 | "info_element->len + 2 > left : " | ||
947 | "info_element->len+2=%zd left=%d, id=%d.\n", | ||
948 | info_element->len + | ||
949 | sizeof(struct | ||
950 | ieee80211_info_element), | ||
951 | left, info_element->id); | ||
952 | return 1; | ||
953 | } | ||
954 | |||
955 | switch (info_element->id) { | ||
956 | case MFIE_TYPE_SSID: | ||
957 | if (ieee80211_is_empty_essid(info_element->data, | ||
958 | info_element->len)) { | ||
959 | network->flags |= NETWORK_EMPTY_ESSID; | ||
960 | break; | ||
961 | } | ||
962 | |||
963 | network->ssid_len = min(info_element->len, | ||
964 | (u8) IW_ESSID_MAX_SIZE); | ||
965 | memcpy(network->ssid, info_element->data, | ||
966 | network->ssid_len); | ||
967 | if (network->ssid_len < IW_ESSID_MAX_SIZE) | ||
968 | memset(network->ssid + network->ssid_len, 0, | ||
969 | IW_ESSID_MAX_SIZE - network->ssid_len); | ||
970 | |||
971 | IEEE80211_DEBUG_QOS("MFIE_TYPE_SSID: '%s' len=%d.\n", | ||
972 | network->ssid, network->ssid_len); | ||
973 | break; | ||
974 | |||
975 | case MFIE_TYPE_TIM: | ||
976 | IEEE80211_DEBUG_QOS("MFIE_TYPE_TIM: ignored\n"); | ||
977 | break; | ||
978 | |||
979 | case MFIE_TYPE_IBSS_SET: | ||
980 | IEEE80211_DEBUG_QOS("MFIE_TYPE_IBSS_SET: ignored\n"); | ||
981 | break; | ||
982 | |||
983 | case MFIE_TYPE_CHALLENGE: | ||
984 | IEEE80211_DEBUG_QOS("MFIE_TYPE_CHALLENGE: ignored\n"); | ||
985 | break; | ||
986 | |||
987 | case MFIE_TYPE_GENERIC: | ||
988 | IEEE80211_DEBUG_QOS("MFIE_TYPE_GENERIC: %d bytes\n", | ||
989 | info_element->len); | ||
990 | ieee80211_parse_qos_info_param_IE(info_element, | ||
991 | network); | ||
992 | break; | ||
993 | |||
994 | case MFIE_TYPE_RSN: | ||
995 | IEEE80211_DEBUG_QOS("MFIE_TYPE_RSN: %d bytes\n", | ||
996 | info_element->len); | ||
997 | break; | ||
998 | |||
999 | case MFIE_TYPE_QOS_PARAMETER: | ||
1000 | printk("QoS Error need to parse QOS_PARAMETER IE\n"); | ||
1001 | break; | ||
1002 | |||
1003 | default: | ||
1004 | IEEE80211_DEBUG_QOS("unsupported IE %d\n", | ||
1005 | info_element->id); | ||
1006 | break; | ||
1007 | } | ||
1008 | |||
1009 | left -= sizeof(struct ieee80211_info_element) + | ||
1010 | info_element->len; | ||
1011 | info_element = (struct ieee80211_info_element *) | ||
1012 | &info_element->data[info_element->len]; | ||
1013 | } | ||
1014 | |||
1015 | if (ieee->handle_assoc_response != NULL) | ||
1016 | ieee->handle_assoc_response(dev, frame, network); | ||
1017 | |||
1018 | return 0; | ||
1019 | } | ||
1020 | |||
1021 | /***************************************************/ | ||
1022 | |||
758 | static inline int ieee80211_is_ofdm_rate(u8 rate) | 1023 | static inline int ieee80211_is_ofdm_rate(u8 rate) |
759 | { | 1024 | { |
760 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | 1025 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { |
@@ -771,8 +1036,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate) | |||
771 | return 0; | 1036 | return 0; |
772 | } | 1037 | } |
773 | 1038 | ||
774 | static inline int ieee80211_network_init(struct ieee80211_device *ieee, | 1039 | static inline int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response |
775 | struct ieee80211_probe_response | ||
776 | *beacon, | 1040 | *beacon, |
777 | struct ieee80211_network *network, | 1041 | struct ieee80211_network *network, |
778 | struct ieee80211_rx_stats *stats) | 1042 | struct ieee80211_rx_stats *stats) |
@@ -784,14 +1048,17 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
784 | struct ieee80211_info_element *info_element; | 1048 | struct ieee80211_info_element *info_element; |
785 | u16 left; | 1049 | u16 left; |
786 | u8 i; | 1050 | u8 i; |
1051 | network->qos_data.active = 0; | ||
1052 | network->qos_data.supported = 0; | ||
1053 | network->qos_data.param_count = 0; | ||
787 | 1054 | ||
788 | /* Pull out fixed field data */ | 1055 | /* Pull out fixed field data */ |
789 | memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); | 1056 | memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); |
790 | network->capability = beacon->capability; | 1057 | network->capability = le16_to_cpu(beacon->capability); |
791 | network->last_scanned = jiffies; | 1058 | network->last_scanned = jiffies; |
792 | network->time_stamp[0] = beacon->time_stamp[0]; | 1059 | network->time_stamp[0] = le32_to_cpu(beacon->time_stamp[0]); |
793 | network->time_stamp[1] = beacon->time_stamp[1]; | 1060 | network->time_stamp[1] = le32_to_cpu(beacon->time_stamp[1]); |
794 | network->beacon_interval = beacon->beacon_interval; | 1061 | network->beacon_interval = le16_to_cpu(beacon->beacon_interval); |
795 | /* Where to pull this? beacon->listen_interval; */ | 1062 | /* Where to pull this? beacon->listen_interval; */ |
796 | network->listen_interval = 0x0A; | 1063 | network->listen_interval = 0x0A; |
797 | network->rates_len = network->rates_ex_len = 0; | 1064 | network->rates_len = network->rates_ex_len = 0; |
@@ -799,6 +1066,8 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
799 | network->ssid_len = 0; | 1066 | network->ssid_len = 0; |
800 | network->flags = 0; | 1067 | network->flags = 0; |
801 | network->atim_window = 0; | 1068 | network->atim_window = 0; |
1069 | network->erp_value = (network->capability & WLAN_CAPABILITY_IBSS) ? | ||
1070 | 0x3 : 0x0; | ||
802 | 1071 | ||
803 | if (stats->freq == IEEE80211_52GHZ_BAND) { | 1072 | if (stats->freq == IEEE80211_52GHZ_BAND) { |
804 | /* for A band (No DS info) */ | 1073 | /* for A band (No DS info) */ |
@@ -809,15 +1078,13 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
809 | network->wpa_ie_len = 0; | 1078 | network->wpa_ie_len = 0; |
810 | network->rsn_ie_len = 0; | 1079 | network->rsn_ie_len = 0; |
811 | 1080 | ||
812 | info_element = &beacon->info_element; | 1081 | info_element = beacon->info_element; |
813 | left = stats->len - ((void *)info_element - (void *)beacon); | 1082 | left = stats->len - sizeof(*beacon); |
814 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { | 1083 | while (left >= sizeof(*info_element)) { |
815 | if (sizeof(struct ieee80211_info_element_hdr) + | 1084 | if (sizeof(*info_element) + info_element->len > left) { |
816 | info_element->len > left) { | ||
817 | IEEE80211_DEBUG_SCAN | 1085 | IEEE80211_DEBUG_SCAN |
818 | ("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%Zd left=%d.\n", | 1086 | ("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%Zd left=%d.\n", |
819 | info_element->len + | 1087 | info_element->len + sizeof(*info_element), left); |
820 | sizeof(struct ieee80211_info_element), left); | ||
821 | return 1; | 1088 | return 1; |
822 | } | 1089 | } |
823 | 1090 | ||
@@ -845,15 +1112,14 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
845 | #ifdef CONFIG_IEEE80211_DEBUG | 1112 | #ifdef CONFIG_IEEE80211_DEBUG |
846 | p = rates_str; | 1113 | p = rates_str; |
847 | #endif | 1114 | #endif |
848 | network->rates_len = | 1115 | network->rates_len = min(info_element->len, |
849 | min(info_element->len, MAX_RATES_LENGTH); | 1116 | MAX_RATES_LENGTH); |
850 | for (i = 0; i < network->rates_len; i++) { | 1117 | for (i = 0; i < network->rates_len; i++) { |
851 | network->rates[i] = info_element->data[i]; | 1118 | network->rates[i] = info_element->data[i]; |
852 | #ifdef CONFIG_IEEE80211_DEBUG | 1119 | #ifdef CONFIG_IEEE80211_DEBUG |
853 | p += snprintf(p, | 1120 | p += snprintf(p, sizeof(rates_str) - |
854 | sizeof(rates_str) - (p - | 1121 | (p - rates_str), "%02X ", |
855 | rates_str), | 1122 | network->rates[i]); |
856 | "%02X ", network->rates[i]); | ||
857 | #endif | 1123 | #endif |
858 | if (ieee80211_is_ofdm_rate | 1124 | if (ieee80211_is_ofdm_rate |
859 | (info_element->data[i])) { | 1125 | (info_element->data[i])) { |
@@ -873,15 +1139,14 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
873 | #ifdef CONFIG_IEEE80211_DEBUG | 1139 | #ifdef CONFIG_IEEE80211_DEBUG |
874 | p = rates_str; | 1140 | p = rates_str; |
875 | #endif | 1141 | #endif |
876 | network->rates_ex_len = | 1142 | network->rates_ex_len = min(info_element->len, |
877 | min(info_element->len, MAX_RATES_EX_LENGTH); | 1143 | MAX_RATES_EX_LENGTH); |
878 | for (i = 0; i < network->rates_ex_len; i++) { | 1144 | for (i = 0; i < network->rates_ex_len; i++) { |
879 | network->rates_ex[i] = info_element->data[i]; | 1145 | network->rates_ex[i] = info_element->data[i]; |
880 | #ifdef CONFIG_IEEE80211_DEBUG | 1146 | #ifdef CONFIG_IEEE80211_DEBUG |
881 | p += snprintf(p, | 1147 | p += snprintf(p, sizeof(rates_str) - |
882 | sizeof(rates_str) - (p - | 1148 | (p - rates_str), "%02X ", |
883 | rates_str), | 1149 | network->rates[i]); |
884 | "%02X ", network->rates[i]); | ||
885 | #endif | 1150 | #endif |
886 | if (ieee80211_is_ofdm_rate | 1151 | if (ieee80211_is_ofdm_rate |
887 | (info_element->data[i])) { | 1152 | (info_element->data[i])) { |
@@ -916,8 +1181,16 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
916 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_TIM: ignored\n"); | 1181 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_TIM: ignored\n"); |
917 | break; | 1182 | break; |
918 | 1183 | ||
1184 | case MFIE_TYPE_ERP_INFO: | ||
1185 | network->erp_value = info_element->data[0]; | ||
1186 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_ERP_SET: %d\n", | ||
1187 | network->erp_value); | ||
1188 | break; | ||
1189 | |||
919 | case MFIE_TYPE_IBSS_SET: | 1190 | case MFIE_TYPE_IBSS_SET: |
920 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n"); | 1191 | network->atim_window = info_element->data[0]; |
1192 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: %d\n", | ||
1193 | network->atim_window); | ||
921 | break; | 1194 | break; |
922 | 1195 | ||
923 | case MFIE_TYPE_CHALLENGE: | 1196 | case MFIE_TYPE_CHALLENGE: |
@@ -927,6 +1200,10 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
927 | case MFIE_TYPE_GENERIC: | 1200 | case MFIE_TYPE_GENERIC: |
928 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", | 1201 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", |
929 | info_element->len); | 1202 | info_element->len); |
1203 | if (!ieee80211_parse_qos_info_param_IE(info_element, | ||
1204 | network)) | ||
1205 | break; | ||
1206 | |||
930 | if (info_element->len >= 4 && | 1207 | if (info_element->len >= 4 && |
931 | info_element->data[0] == 0x00 && | 1208 | info_element->data[0] == 0x00 && |
932 | info_element->data[1] == 0x50 && | 1209 | info_element->data[1] == 0x50 && |
@@ -948,14 +1225,18 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |||
948 | network->rsn_ie_len); | 1225 | network->rsn_ie_len); |
949 | break; | 1226 | break; |
950 | 1227 | ||
1228 | case MFIE_TYPE_QOS_PARAMETER: | ||
1229 | printk(KERN_ERR | ||
1230 | "QoS Error need to parse QOS_PARAMETER IE\n"); | ||
1231 | break; | ||
1232 | |||
951 | default: | 1233 | default: |
952 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", | 1234 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", |
953 | info_element->id); | 1235 | info_element->id); |
954 | break; | 1236 | break; |
955 | } | 1237 | } |
956 | 1238 | ||
957 | left -= sizeof(struct ieee80211_info_element_hdr) + | 1239 | left -= sizeof(*info_element) + info_element->len; |
958 | info_element->len; | ||
959 | info_element = (struct ieee80211_info_element *) | 1240 | info_element = (struct ieee80211_info_element *) |
960 | &info_element->data[info_element->len]; | 1241 | &info_element->data[info_element->len]; |
961 | } | 1242 | } |
@@ -1002,6 +1283,9 @@ static inline int is_same_network(struct ieee80211_network *src, | |||
1002 | static inline void update_network(struct ieee80211_network *dst, | 1283 | static inline void update_network(struct ieee80211_network *dst, |
1003 | struct ieee80211_network *src) | 1284 | struct ieee80211_network *src) |
1004 | { | 1285 | { |
1286 | int qos_active; | ||
1287 | u8 old_param; | ||
1288 | |||
1005 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); | 1289 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); |
1006 | dst->capability = src->capability; | 1290 | dst->capability = src->capability; |
1007 | memcpy(dst->rates, src->rates, src->rates_len); | 1291 | memcpy(dst->rates, src->rates, src->rates_len); |
@@ -1017,6 +1301,7 @@ static inline void update_network(struct ieee80211_network *dst, | |||
1017 | dst->beacon_interval = src->beacon_interval; | 1301 | dst->beacon_interval = src->beacon_interval; |
1018 | dst->listen_interval = src->listen_interval; | 1302 | dst->listen_interval = src->listen_interval; |
1019 | dst->atim_window = src->atim_window; | 1303 | dst->atim_window = src->atim_window; |
1304 | dst->erp_value = src->erp_value; | ||
1020 | 1305 | ||
1021 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); | 1306 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); |
1022 | dst->wpa_ie_len = src->wpa_ie_len; | 1307 | dst->wpa_ie_len = src->wpa_ie_len; |
@@ -1024,22 +1309,48 @@ static inline void update_network(struct ieee80211_network *dst, | |||
1024 | dst->rsn_ie_len = src->rsn_ie_len; | 1309 | dst->rsn_ie_len = src->rsn_ie_len; |
1025 | 1310 | ||
1026 | dst->last_scanned = jiffies; | 1311 | dst->last_scanned = jiffies; |
1312 | qos_active = src->qos_data.active; | ||
1313 | old_param = dst->qos_data.old_param_count; | ||
1314 | if (dst->flags & NETWORK_HAS_QOS_MASK) | ||
1315 | memcpy(&dst->qos_data, &src->qos_data, | ||
1316 | sizeof(struct ieee80211_qos_data)); | ||
1317 | else { | ||
1318 | dst->qos_data.supported = src->qos_data.supported; | ||
1319 | dst->qos_data.param_count = src->qos_data.param_count; | ||
1320 | } | ||
1321 | |||
1322 | if (dst->qos_data.supported == 1) { | ||
1323 | if (dst->ssid_len) | ||
1324 | IEEE80211_DEBUG_QOS | ||
1325 | ("QoS the network %s is QoS supported\n", | ||
1326 | dst->ssid); | ||
1327 | else | ||
1328 | IEEE80211_DEBUG_QOS | ||
1329 | ("QoS the network is QoS supported\n"); | ||
1330 | } | ||
1331 | dst->qos_data.active = qos_active; | ||
1332 | dst->qos_data.old_param_count = old_param; | ||
1333 | |||
1027 | /* dst->last_associate is not overwritten */ | 1334 | /* dst->last_associate is not overwritten */ |
1028 | } | 1335 | } |
1029 | 1336 | ||
1337 | static inline int is_beacon(int fc) | ||
1338 | { | ||
1339 | return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); | ||
1340 | } | ||
1341 | |||
1030 | static inline void ieee80211_process_probe_response(struct ieee80211_device | 1342 | static inline void ieee80211_process_probe_response(struct ieee80211_device |
1031 | *ieee, | 1343 | *ieee, struct |
1032 | struct | ||
1033 | ieee80211_probe_response | 1344 | ieee80211_probe_response |
1034 | *beacon, | 1345 | *beacon, struct ieee80211_rx_stats |
1035 | struct ieee80211_rx_stats | ||
1036 | *stats) | 1346 | *stats) |
1037 | { | 1347 | { |
1348 | struct net_device *dev = ieee->dev; | ||
1038 | struct ieee80211_network network; | 1349 | struct ieee80211_network network; |
1039 | struct ieee80211_network *target; | 1350 | struct ieee80211_network *target; |
1040 | struct ieee80211_network *oldest = NULL; | 1351 | struct ieee80211_network *oldest = NULL; |
1041 | #ifdef CONFIG_IEEE80211_DEBUG | 1352 | #ifdef CONFIG_IEEE80211_DEBUG |
1042 | struct ieee80211_info_element *info_element = &beacon->info_element; | 1353 | struct ieee80211_info_element *info_element = beacon->info_element; |
1043 | #endif | 1354 | #endif |
1044 | unsigned long flags; | 1355 | unsigned long flags; |
1045 | 1356 | ||
@@ -1070,10 +1381,10 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device | |||
1070 | escape_essid(info_element->data, | 1381 | escape_essid(info_element->data, |
1071 | info_element->len), | 1382 | info_element->len), |
1072 | MAC_ARG(beacon->header.addr3), | 1383 | MAC_ARG(beacon->header.addr3), |
1073 | WLAN_FC_GET_STYPE(beacon->header. | 1384 | is_beacon(le16_to_cpu |
1074 | frame_ctl) == | 1385 | (beacon->header. |
1075 | IEEE80211_STYPE_PROBE_RESP ? | 1386 | frame_ctl)) ? |
1076 | "PROBE RESPONSE" : "BEACON"); | 1387 | "BEACON" : "PROBE RESPONSE"); |
1077 | return; | 1388 | return; |
1078 | } | 1389 | } |
1079 | 1390 | ||
@@ -1122,10 +1433,10 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device | |||
1122 | escape_essid(network.ssid, | 1433 | escape_essid(network.ssid, |
1123 | network.ssid_len), | 1434 | network.ssid_len), |
1124 | MAC_ARG(network.bssid), | 1435 | MAC_ARG(network.bssid), |
1125 | WLAN_FC_GET_STYPE(beacon->header. | 1436 | is_beacon(le16_to_cpu |
1126 | frame_ctl) == | 1437 | (beacon->header. |
1127 | IEEE80211_STYPE_PROBE_RESP ? | 1438 | frame_ctl)) ? |
1128 | "PROBE RESPONSE" : "BEACON"); | 1439 | "BEACON" : "PROBE RESPONSE"); |
1129 | #endif | 1440 | #endif |
1130 | memcpy(target, &network, sizeof(*target)); | 1441 | memcpy(target, &network, sizeof(*target)); |
1131 | list_add_tail(&target->list, &ieee->network_list); | 1442 | list_add_tail(&target->list, &ieee->network_list); |
@@ -1134,34 +1445,60 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device | |||
1134 | escape_essid(target->ssid, | 1445 | escape_essid(target->ssid, |
1135 | target->ssid_len), | 1446 | target->ssid_len), |
1136 | MAC_ARG(target->bssid), | 1447 | MAC_ARG(target->bssid), |
1137 | WLAN_FC_GET_STYPE(beacon->header. | 1448 | is_beacon(le16_to_cpu |
1138 | frame_ctl) == | 1449 | (beacon->header. |
1139 | IEEE80211_STYPE_PROBE_RESP ? | 1450 | frame_ctl)) ? |
1140 | "PROBE RESPONSE" : "BEACON"); | 1451 | "BEACON" : "PROBE RESPONSE"); |
1141 | update_network(target, &network); | 1452 | update_network(target, &network); |
1142 | } | 1453 | } |
1143 | 1454 | ||
1144 | spin_unlock_irqrestore(&ieee->lock, flags); | 1455 | spin_unlock_irqrestore(&ieee->lock, flags); |
1456 | |||
1457 | if (is_beacon(le16_to_cpu(beacon->header.frame_ctl))) { | ||
1458 | if (ieee->handle_beacon != NULL) | ||
1459 | ieee->handle_beacon(dev, beacon, &network); | ||
1460 | } else { | ||
1461 | if (ieee->handle_probe_response != NULL) | ||
1462 | ieee->handle_probe_response(dev, beacon, &network); | ||
1463 | } | ||
1145 | } | 1464 | } |
1146 | 1465 | ||
1147 | void ieee80211_rx_mgt(struct ieee80211_device *ieee, | 1466 | void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
1148 | struct ieee80211_hdr *header, | 1467 | struct ieee80211_hdr_4addr *header, |
1149 | struct ieee80211_rx_stats *stats) | 1468 | struct ieee80211_rx_stats *stats) |
1150 | { | 1469 | { |
1151 | switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { | 1470 | switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) { |
1152 | case IEEE80211_STYPE_ASSOC_RESP: | 1471 | case IEEE80211_STYPE_ASSOC_RESP: |
1153 | IEEE80211_DEBUG_MGMT("received ASSOCIATION RESPONSE (%d)\n", | 1472 | IEEE80211_DEBUG_MGMT("received ASSOCIATION RESPONSE (%d)\n", |
1154 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1473 | WLAN_FC_GET_STYPE(le16_to_cpu |
1474 | (header->frame_ctl))); | ||
1475 | ieee80211_handle_assoc_resp(ieee, | ||
1476 | (struct ieee80211_assoc_response *) | ||
1477 | header, stats); | ||
1155 | break; | 1478 | break; |
1156 | 1479 | ||
1157 | case IEEE80211_STYPE_REASSOC_RESP: | 1480 | case IEEE80211_STYPE_REASSOC_RESP: |
1158 | IEEE80211_DEBUG_MGMT("received REASSOCIATION RESPONSE (%d)\n", | 1481 | IEEE80211_DEBUG_MGMT("received REASSOCIATION RESPONSE (%d)\n", |
1159 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1482 | WLAN_FC_GET_STYPE(le16_to_cpu |
1483 | (header->frame_ctl))); | ||
1484 | break; | ||
1485 | |||
1486 | case IEEE80211_STYPE_PROBE_REQ: | ||
1487 | IEEE80211_DEBUG_MGMT("recieved auth (%d)\n", | ||
1488 | WLAN_FC_GET_STYPE(le16_to_cpu | ||
1489 | (header->frame_ctl))); | ||
1490 | |||
1491 | if (ieee->handle_probe_request != NULL) | ||
1492 | ieee->handle_probe_request(ieee->dev, | ||
1493 | (struct | ||
1494 | ieee80211_probe_request *) | ||
1495 | header, stats); | ||
1160 | break; | 1496 | break; |
1161 | 1497 | ||
1162 | case IEEE80211_STYPE_PROBE_RESP: | 1498 | case IEEE80211_STYPE_PROBE_RESP: |
1163 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", | 1499 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", |
1164 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1500 | WLAN_FC_GET_STYPE(le16_to_cpu |
1501 | (header->frame_ctl))); | ||
1165 | IEEE80211_DEBUG_SCAN("Probe response\n"); | 1502 | IEEE80211_DEBUG_SCAN("Probe response\n"); |
1166 | ieee80211_process_probe_response(ieee, | 1503 | ieee80211_process_probe_response(ieee, |
1167 | (struct | 1504 | (struct |
@@ -1171,20 +1508,46 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1171 | 1508 | ||
1172 | case IEEE80211_STYPE_BEACON: | 1509 | case IEEE80211_STYPE_BEACON: |
1173 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", | 1510 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", |
1174 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1511 | WLAN_FC_GET_STYPE(le16_to_cpu |
1512 | (header->frame_ctl))); | ||
1175 | IEEE80211_DEBUG_SCAN("Beacon\n"); | 1513 | IEEE80211_DEBUG_SCAN("Beacon\n"); |
1176 | ieee80211_process_probe_response(ieee, | 1514 | ieee80211_process_probe_response(ieee, |
1177 | (struct | 1515 | (struct |
1178 | ieee80211_probe_response *) | 1516 | ieee80211_probe_response *) |
1179 | header, stats); | 1517 | header, stats); |
1180 | break; | 1518 | break; |
1519 | case IEEE80211_STYPE_AUTH: | ||
1520 | |||
1521 | IEEE80211_DEBUG_MGMT("recieved auth (%d)\n", | ||
1522 | WLAN_FC_GET_STYPE(le16_to_cpu | ||
1523 | (header->frame_ctl))); | ||
1524 | |||
1525 | if (ieee->handle_auth != NULL) | ||
1526 | ieee->handle_auth(ieee->dev, | ||
1527 | (struct ieee80211_auth *)header); | ||
1528 | break; | ||
1181 | 1529 | ||
1530 | case IEEE80211_STYPE_DISASSOC: | ||
1531 | if (ieee->handle_disassoc != NULL) | ||
1532 | ieee->handle_disassoc(ieee->dev, | ||
1533 | (struct ieee80211_disassoc *) | ||
1534 | header); | ||
1535 | break; | ||
1536 | |||
1537 | case IEEE80211_STYPE_DEAUTH: | ||
1538 | printk("DEAUTH from AP\n"); | ||
1539 | if (ieee->handle_deauth != NULL) | ||
1540 | ieee->handle_deauth(ieee->dev, (struct ieee80211_auth *) | ||
1541 | header); | ||
1542 | break; | ||
1182 | default: | 1543 | default: |
1183 | IEEE80211_DEBUG_MGMT("received UNKNOWN (%d)\n", | 1544 | IEEE80211_DEBUG_MGMT("received UNKNOWN (%d)\n", |
1184 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1545 | WLAN_FC_GET_STYPE(le16_to_cpu |
1546 | (header->frame_ctl))); | ||
1185 | IEEE80211_WARNING("%s: Unknown management packet: %d\n", | 1547 | IEEE80211_WARNING("%s: Unknown management packet: %d\n", |
1186 | ieee->dev->name, | 1548 | ieee->dev->name, |
1187 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1549 | WLAN_FC_GET_STYPE(le16_to_cpu |
1550 | (header->frame_ctl))); | ||
1188 | break; | 1551 | break; |
1189 | } | 1552 | } |
1190 | } | 1553 | } |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index f9153671168e..e860777ab8d3 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
@@ -128,7 +128,7 @@ payload of each frame is reduced to 492 bytes. | |||
128 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; | 128 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; |
129 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; | 129 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; |
130 | 130 | ||
131 | static inline int ieee80211_put_snap(u8 * data, u16 h_proto) | 131 | static inline int ieee80211_copy_snap(u8 * data, u16 h_proto) |
132 | { | 132 | { |
133 | struct ieee80211_snap_hdr *snap; | 133 | struct ieee80211_snap_hdr *snap; |
134 | u8 *oui; | 134 | u8 *oui; |
@@ -157,31 +157,11 @@ static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, | |||
157 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; | 157 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; |
158 | int res; | 158 | int res; |
159 | 159 | ||
160 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | ||
161 | struct ieee80211_hdr *header; | ||
162 | |||
163 | if (ieee->tkip_countermeasures && | ||
164 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { | ||
165 | header = (struct ieee80211_hdr *)frag->data; | ||
166 | if (net_ratelimit()) { | ||
167 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | ||
168 | "TX packet to " MAC_FMT "\n", | ||
169 | ieee->dev->name, MAC_ARG(header->addr1)); | ||
170 | } | ||
171 | return -1; | ||
172 | } | ||
173 | #endif | ||
174 | /* To encrypt, frame format is: | 160 | /* To encrypt, frame format is: |
175 | * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ | 161 | * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ |
176 | |||
177 | // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. | ||
178 | /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so | ||
179 | * call both MSDU and MPDU encryption functions from here. */ | ||
180 | atomic_inc(&crypt->refcnt); | 162 | atomic_inc(&crypt->refcnt); |
181 | res = 0; | 163 | res = 0; |
182 | if (crypt->ops->encrypt_msdu) | 164 | if (crypt->ops->encrypt_mpdu) |
183 | res = crypt->ops->encrypt_msdu(frag, hdr_len, crypt->priv); | ||
184 | if (res == 0 && crypt->ops->encrypt_mpdu) | ||
185 | res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); | 165 | res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); |
186 | 166 | ||
187 | atomic_dec(&crypt->refcnt); | 167 | atomic_dec(&crypt->refcnt); |
@@ -236,25 +216,31 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, | |||
236 | return txb; | 216 | return txb; |
237 | } | 217 | } |
238 | 218 | ||
239 | /* SKBs are added to the ieee->tx_queue. */ | 219 | /* Incoming skb is converted to a txb which consists of |
220 | * a block of 802.11 fragment packets (stored as skbs) */ | ||
240 | int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | 221 | int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) |
241 | { | 222 | { |
242 | struct ieee80211_device *ieee = netdev_priv(dev); | 223 | struct ieee80211_device *ieee = netdev_priv(dev); |
243 | struct ieee80211_txb *txb = NULL; | 224 | struct ieee80211_txb *txb = NULL; |
244 | struct ieee80211_hdr *frag_hdr; | 225 | struct ieee80211_hdr_3addr *frag_hdr; |
245 | int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; | 226 | int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, |
227 | rts_required; | ||
246 | unsigned long flags; | 228 | unsigned long flags; |
247 | struct net_device_stats *stats = &ieee->stats; | 229 | struct net_device_stats *stats = &ieee->stats; |
248 | int ether_type, encrypt; | 230 | int ether_type, encrypt, host_encrypt, host_encrypt_msdu, host_build_iv; |
249 | int bytes, fc, hdr_len; | 231 | int bytes, fc, hdr_len; |
250 | struct sk_buff *skb_frag; | 232 | struct sk_buff *skb_frag; |
251 | struct ieee80211_hdr header = { /* Ensure zero initialized */ | 233 | struct ieee80211_hdr_3addr header = { /* Ensure zero initialized */ |
252 | .duration_id = 0, | 234 | .duration_id = 0, |
253 | .seq_ctl = 0 | 235 | .seq_ctl = 0 |
254 | }; | 236 | }; |
255 | u8 dest[ETH_ALEN], src[ETH_ALEN]; | 237 | u8 dest[ETH_ALEN], src[ETH_ALEN]; |
256 | |||
257 | struct ieee80211_crypt_data *crypt; | 238 | struct ieee80211_crypt_data *crypt; |
239 | int priority = skb->priority; | ||
240 | int snapped = 0; | ||
241 | |||
242 | if (ieee->is_queue_full && (*ieee->is_queue_full) (dev, priority)) | ||
243 | return NETDEV_TX_BUSY; | ||
258 | 244 | ||
259 | spin_lock_irqsave(&ieee->lock, flags); | 245 | spin_lock_irqsave(&ieee->lock, flags); |
260 | 246 | ||
@@ -276,7 +262,11 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
276 | crypt = ieee->crypt[ieee->tx_keyidx]; | 262 | crypt = ieee->crypt[ieee->tx_keyidx]; |
277 | 263 | ||
278 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && | 264 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && |
279 | ieee->host_encrypt && crypt && crypt->ops; | 265 | ieee->sec.encrypt; |
266 | |||
267 | host_encrypt = ieee->host_encrypt && encrypt; | ||
268 | host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt; | ||
269 | host_build_iv = ieee->host_build_iv && encrypt; | ||
280 | 270 | ||
281 | if (!encrypt && ieee->ieee802_1x && | 271 | if (!encrypt && ieee->ieee802_1x && |
282 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { | 272 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { |
@@ -285,8 +275,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
285 | } | 275 | } |
286 | 276 | ||
287 | /* Save source and destination addresses */ | 277 | /* Save source and destination addresses */ |
288 | memcpy(&dest, skb->data, ETH_ALEN); | 278 | memcpy(dest, skb->data, ETH_ALEN); |
289 | memcpy(&src, skb->data + ETH_ALEN, ETH_ALEN); | 279 | memcpy(src, skb->data + ETH_ALEN, ETH_ALEN); |
290 | 280 | ||
291 | /* Advance the SKB to the start of the payload */ | 281 | /* Advance the SKB to the start of the payload */ |
292 | skb_pull(skb, sizeof(struct ethhdr)); | 282 | skb_pull(skb, sizeof(struct ethhdr)); |
@@ -294,7 +284,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
294 | /* Determine total amount of storage required for TXB packets */ | 284 | /* Determine total amount of storage required for TXB packets */ |
295 | bytes = skb->len + SNAP_SIZE + sizeof(u16); | 285 | bytes = skb->len + SNAP_SIZE + sizeof(u16); |
296 | 286 | ||
297 | if (encrypt) | 287 | if (host_encrypt) |
298 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | 288 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
299 | IEEE80211_FCTL_PROTECTED; | 289 | IEEE80211_FCTL_PROTECTED; |
300 | else | 290 | else |
@@ -302,50 +292,90 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
302 | 292 | ||
303 | if (ieee->iw_mode == IW_MODE_INFRA) { | 293 | if (ieee->iw_mode == IW_MODE_INFRA) { |
304 | fc |= IEEE80211_FCTL_TODS; | 294 | fc |= IEEE80211_FCTL_TODS; |
305 | /* To DS: Addr1 = BSSID, Addr2 = SA, | 295 | /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ |
306 | Addr3 = DA */ | 296 | memcpy(header.addr1, ieee->bssid, ETH_ALEN); |
307 | memcpy(&header.addr1, ieee->bssid, ETH_ALEN); | 297 | memcpy(header.addr2, src, ETH_ALEN); |
308 | memcpy(&header.addr2, &src, ETH_ALEN); | 298 | memcpy(header.addr3, dest, ETH_ALEN); |
309 | memcpy(&header.addr3, &dest, ETH_ALEN); | ||
310 | } else if (ieee->iw_mode == IW_MODE_ADHOC) { | 299 | } else if (ieee->iw_mode == IW_MODE_ADHOC) { |
311 | /* not From/To DS: Addr1 = DA, Addr2 = SA, | 300 | /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */ |
312 | Addr3 = BSSID */ | 301 | memcpy(header.addr1, dest, ETH_ALEN); |
313 | memcpy(&header.addr1, dest, ETH_ALEN); | 302 | memcpy(header.addr2, src, ETH_ALEN); |
314 | memcpy(&header.addr2, src, ETH_ALEN); | 303 | memcpy(header.addr3, ieee->bssid, ETH_ALEN); |
315 | memcpy(&header.addr3, ieee->bssid, ETH_ALEN); | ||
316 | } | 304 | } |
317 | header.frame_ctl = cpu_to_le16(fc); | 305 | header.frame_ctl = cpu_to_le16(fc); |
318 | hdr_len = IEEE80211_3ADDR_LEN; | 306 | hdr_len = IEEE80211_3ADDR_LEN; |
319 | 307 | ||
320 | /* Determine fragmentation size based on destination (multicast | 308 | /* Encrypt msdu first on the whole data packet. */ |
321 | * and broadcast are not fragmented) */ | 309 | if ((host_encrypt || host_encrypt_msdu) && |
322 | if (is_multicast_ether_addr(dest) || is_broadcast_ether_addr(dest)) | 310 | crypt && crypt->ops && crypt->ops->encrypt_msdu) { |
323 | frag_size = MAX_FRAG_THRESHOLD; | 311 | int res = 0; |
324 | else | 312 | int len = bytes + hdr_len + crypt->ops->extra_msdu_prefix_len + |
325 | frag_size = ieee->fts; | 313 | crypt->ops->extra_msdu_postfix_len; |
314 | struct sk_buff *skb_new = dev_alloc_skb(len); | ||
315 | |||
316 | if (unlikely(!skb_new)) | ||
317 | goto failed; | ||
318 | |||
319 | skb_reserve(skb_new, crypt->ops->extra_msdu_prefix_len); | ||
320 | memcpy(skb_put(skb_new, hdr_len), &header, hdr_len); | ||
321 | snapped = 1; | ||
322 | ieee80211_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), | ||
323 | ether_type); | ||
324 | memcpy(skb_put(skb_new, skb->len), skb->data, skb->len); | ||
325 | res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv); | ||
326 | if (res < 0) { | ||
327 | IEEE80211_ERROR("msdu encryption failed\n"); | ||
328 | dev_kfree_skb_any(skb_new); | ||
329 | goto failed; | ||
330 | } | ||
331 | dev_kfree_skb_any(skb); | ||
332 | skb = skb_new; | ||
333 | bytes += crypt->ops->extra_msdu_prefix_len + | ||
334 | crypt->ops->extra_msdu_postfix_len; | ||
335 | skb_pull(skb, hdr_len); | ||
336 | } | ||
326 | 337 | ||
327 | /* Determine amount of payload per fragment. Regardless of if | 338 | if (host_encrypt || ieee->host_open_frag) { |
328 | * this stack is providing the full 802.11 header, one will | 339 | /* Determine fragmentation size based on destination (multicast |
329 | * eventually be affixed to this fragment -- so we must account for | 340 | * and broadcast are not fragmented) */ |
330 | * it when determining the amount of payload space. */ | 341 | if (is_multicast_ether_addr(dest)) |
331 | bytes_per_frag = frag_size - IEEE80211_3ADDR_LEN; | 342 | frag_size = MAX_FRAG_THRESHOLD; |
332 | if (ieee->config & | 343 | else |
333 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | 344 | frag_size = ieee->fts; |
334 | bytes_per_frag -= IEEE80211_FCS_LEN; | 345 | |
335 | 346 | /* Determine amount of payload per fragment. Regardless of if | |
336 | /* Each fragment may need to have room for encryptiong pre/postfix */ | 347 | * this stack is providing the full 802.11 header, one will |
337 | if (encrypt) | 348 | * eventually be affixed to this fragment -- so we must account |
338 | bytes_per_frag -= crypt->ops->extra_prefix_len + | 349 | * for it when determining the amount of payload space. */ |
339 | crypt->ops->extra_postfix_len; | 350 | bytes_per_frag = frag_size - IEEE80211_3ADDR_LEN; |
340 | 351 | if (ieee->config & | |
341 | /* Number of fragments is the total bytes_per_frag / | 352 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
342 | * payload_per_fragment */ | 353 | bytes_per_frag -= IEEE80211_FCS_LEN; |
343 | nr_frags = bytes / bytes_per_frag; | 354 | |
344 | bytes_last_frag = bytes % bytes_per_frag; | 355 | /* Each fragment may need to have room for encryptiong |
345 | if (bytes_last_frag) | 356 | * pre/postfix */ |
357 | if (host_encrypt) | ||
358 | bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + | ||
359 | crypt->ops->extra_mpdu_postfix_len; | ||
360 | |||
361 | /* Number of fragments is the total | ||
362 | * bytes_per_frag / payload_per_fragment */ | ||
363 | nr_frags = bytes / bytes_per_frag; | ||
364 | bytes_last_frag = bytes % bytes_per_frag; | ||
365 | if (bytes_last_frag) | ||
366 | nr_frags++; | ||
367 | else | ||
368 | bytes_last_frag = bytes_per_frag; | ||
369 | } else { | ||
370 | nr_frags = 1; | ||
371 | bytes_per_frag = bytes_last_frag = bytes; | ||
372 | frag_size = bytes + IEEE80211_3ADDR_LEN; | ||
373 | } | ||
374 | |||
375 | rts_required = (frag_size > ieee->rts | ||
376 | && ieee->config & CFG_IEEE80211_RTS); | ||
377 | if (rts_required) | ||
346 | nr_frags++; | 378 | nr_frags++; |
347 | else | ||
348 | bytes_last_frag = bytes_per_frag; | ||
349 | 379 | ||
350 | /* When we allocate the TXB we allocate enough space for the reserve | 380 | /* When we allocate the TXB we allocate enough space for the reserve |
351 | * and full fragment bytes (bytes_per_frag doesn't include prefix, | 381 | * and full fragment bytes (bytes_per_frag doesn't include prefix, |
@@ -357,15 +387,47 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
357 | goto failed; | 387 | goto failed; |
358 | } | 388 | } |
359 | txb->encrypted = encrypt; | 389 | txb->encrypted = encrypt; |
360 | txb->payload_size = bytes; | 390 | if (host_encrypt) |
391 | txb->payload_size = frag_size * (nr_frags - 1) + | ||
392 | bytes_last_frag; | ||
393 | else | ||
394 | txb->payload_size = bytes; | ||
395 | |||
396 | if (rts_required) { | ||
397 | skb_frag = txb->fragments[0]; | ||
398 | frag_hdr = | ||
399 | (struct ieee80211_hdr_3addr *)skb_put(skb_frag, hdr_len); | ||
400 | |||
401 | /* | ||
402 | * Set header frame_ctl to the RTS. | ||
403 | */ | ||
404 | header.frame_ctl = | ||
405 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); | ||
406 | memcpy(frag_hdr, &header, hdr_len); | ||
361 | 407 | ||
362 | for (i = 0; i < nr_frags; i++) { | 408 | /* |
409 | * Restore header frame_ctl to the original data setting. | ||
410 | */ | ||
411 | header.frame_ctl = cpu_to_le16(fc); | ||
412 | |||
413 | if (ieee->config & | ||
414 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | ||
415 | skb_put(skb_frag, 4); | ||
416 | |||
417 | txb->rts_included = 1; | ||
418 | i = 1; | ||
419 | } else | ||
420 | i = 0; | ||
421 | |||
422 | for (; i < nr_frags; i++) { | ||
363 | skb_frag = txb->fragments[i]; | 423 | skb_frag = txb->fragments[i]; |
364 | 424 | ||
365 | if (encrypt) | 425 | if (host_encrypt || host_build_iv) |
366 | skb_reserve(skb_frag, crypt->ops->extra_prefix_len); | 426 | skb_reserve(skb_frag, |
427 | crypt->ops->extra_mpdu_prefix_len); | ||
367 | 428 | ||
368 | frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); | 429 | frag_hdr = |
430 | (struct ieee80211_hdr_3addr *)skb_put(skb_frag, hdr_len); | ||
369 | memcpy(frag_hdr, &header, hdr_len); | 431 | memcpy(frag_hdr, &header, hdr_len); |
370 | 432 | ||
371 | /* If this is not the last fragment, then add the MOREFRAGS | 433 | /* If this is not the last fragment, then add the MOREFRAGS |
@@ -379,11 +441,10 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
379 | bytes = bytes_last_frag; | 441 | bytes = bytes_last_frag; |
380 | } | 442 | } |
381 | 443 | ||
382 | /* Put a SNAP header on the first fragment */ | 444 | if (i == 0 && !snapped) { |
383 | if (i == 0) { | 445 | ieee80211_copy_snap(skb_put |
384 | ieee80211_put_snap(skb_put | 446 | (skb_frag, SNAP_SIZE + sizeof(u16)), |
385 | (skb_frag, SNAP_SIZE + sizeof(u16)), | 447 | ether_type); |
386 | ether_type); | ||
387 | bytes -= SNAP_SIZE + sizeof(u16); | 448 | bytes -= SNAP_SIZE + sizeof(u16); |
388 | } | 449 | } |
389 | 450 | ||
@@ -394,8 +455,19 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
394 | 455 | ||
395 | /* Encryption routine will move the header forward in order | 456 | /* Encryption routine will move the header forward in order |
396 | * to insert the IV between the header and the payload */ | 457 | * to insert the IV between the header and the payload */ |
397 | if (encrypt) | 458 | if (host_encrypt) |
398 | ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); | 459 | ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); |
460 | else if (host_build_iv) { | ||
461 | struct ieee80211_crypt_data *crypt; | ||
462 | |||
463 | crypt = ieee->crypt[ieee->tx_keyidx]; | ||
464 | atomic_inc(&crypt->refcnt); | ||
465 | if (crypt->ops->build_iv) | ||
466 | crypt->ops->build_iv(skb_frag, hdr_len, | ||
467 | crypt->priv); | ||
468 | atomic_dec(&crypt->refcnt); | ||
469 | } | ||
470 | |||
399 | if (ieee->config & | 471 | if (ieee->config & |
400 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | 472 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
401 | skb_put(skb_frag, 4); | 473 | skb_put(skb_frag, 4); |
@@ -407,11 +479,20 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
407 | dev_kfree_skb_any(skb); | 479 | dev_kfree_skb_any(skb); |
408 | 480 | ||
409 | if (txb) { | 481 | if (txb) { |
410 | if ((*ieee->hard_start_xmit) (txb, dev) == 0) { | 482 | int ret = (*ieee->hard_start_xmit) (txb, dev, priority); |
483 | if (ret == 0) { | ||
411 | stats->tx_packets++; | 484 | stats->tx_packets++; |
412 | stats->tx_bytes += txb->payload_size; | 485 | stats->tx_bytes += txb->payload_size; |
413 | return 0; | 486 | return 0; |
414 | } | 487 | } |
488 | |||
489 | if (ret == NETDEV_TX_BUSY) { | ||
490 | printk(KERN_ERR "%s: NETDEV_TX_BUSY returned; " | ||
491 | "driver should report queue full via " | ||
492 | "ieee_device->is_queue_full.\n", | ||
493 | ieee->dev->name); | ||
494 | } | ||
495 | |||
415 | ieee80211_txb_free(txb); | 496 | ieee80211_txb_free(txb); |
416 | } | 497 | } |
417 | 498 | ||
@@ -422,7 +503,72 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
422 | netif_stop_queue(dev); | 503 | netif_stop_queue(dev); |
423 | stats->tx_errors++; | 504 | stats->tx_errors++; |
424 | return 1; | 505 | return 1; |
506 | } | ||
507 | |||
508 | /* Incoming 802.11 strucure is converted to a TXB | ||
509 | * a block of 802.11 fragment packets (stored as skbs) */ | ||
510 | int ieee80211_tx_frame(struct ieee80211_device *ieee, | ||
511 | struct ieee80211_hdr *frame, int len) | ||
512 | { | ||
513 | struct ieee80211_txb *txb = NULL; | ||
514 | unsigned long flags; | ||
515 | struct net_device_stats *stats = &ieee->stats; | ||
516 | struct sk_buff *skb_frag; | ||
517 | int priority = -1; | ||
518 | |||
519 | spin_lock_irqsave(&ieee->lock, flags); | ||
425 | 520 | ||
521 | /* If there is no driver handler to take the TXB, dont' bother | ||
522 | * creating it... */ | ||
523 | if (!ieee->hard_start_xmit) { | ||
524 | printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name); | ||
525 | goto success; | ||
526 | } | ||
527 | |||
528 | if (unlikely(len < 24)) { | ||
529 | printk(KERN_WARNING "%s: skb too small (%d).\n", | ||
530 | ieee->dev->name, len); | ||
531 | goto success; | ||
532 | } | ||
533 | |||
534 | /* When we allocate the TXB we allocate enough space for the reserve | ||
535 | * and full fragment bytes (bytes_per_frag doesn't include prefix, | ||
536 | * postfix, header, FCS, etc.) */ | ||
537 | txb = ieee80211_alloc_txb(1, len, GFP_ATOMIC); | ||
538 | if (unlikely(!txb)) { | ||
539 | printk(KERN_WARNING "%s: Could not allocate TXB\n", | ||
540 | ieee->dev->name); | ||
541 | goto failed; | ||
542 | } | ||
543 | txb->encrypted = 0; | ||
544 | txb->payload_size = len; | ||
545 | |||
546 | skb_frag = txb->fragments[0]; | ||
547 | |||
548 | memcpy(skb_put(skb_frag, len), frame, len); | ||
549 | |||
550 | if (ieee->config & | ||
551 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | ||
552 | skb_put(skb_frag, 4); | ||
553 | |||
554 | success: | ||
555 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
556 | |||
557 | if (txb) { | ||
558 | if ((*ieee->hard_start_xmit) (txb, ieee->dev, priority) == 0) { | ||
559 | stats->tx_packets++; | ||
560 | stats->tx_bytes += txb->payload_size; | ||
561 | return 0; | ||
562 | } | ||
563 | ieee80211_txb_free(txb); | ||
564 | } | ||
565 | return 0; | ||
566 | |||
567 | failed: | ||
568 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
569 | stats->tx_errors++; | ||
570 | return 1; | ||
426 | } | 571 | } |
427 | 572 | ||
573 | EXPORT_SYMBOL(ieee80211_tx_frame); | ||
428 | EXPORT_SYMBOL(ieee80211_txb_free); | 574 | EXPORT_SYMBOL(ieee80211_txb_free); |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 94882f39b072..ee7a70a13250 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2004-2005 Intel Corporation. All rights reserved. |
4 | 4 | ||
5 | Portions of this file are based on the WEP enablement code provided by the | 5 | Portions of this file are based on the WEP enablement code provided by the |
6 | Host AP project hostap-drivers v0.1.3 | 6 | Host AP project hostap-drivers v0.1.3 |
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/kmod.h> | 33 | #include <linux/kmod.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/jiffies.h> | ||
35 | 36 | ||
36 | #include <net/ieee80211.h> | 37 | #include <net/ieee80211.h> |
37 | #include <linux/wireless.h> | 38 | #include <linux/wireless.h> |
@@ -140,18 +141,38 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
140 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 141 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
141 | 142 | ||
142 | /* Add quality statistics */ | 143 | /* Add quality statistics */ |
143 | /* TODO: Fix these values... */ | ||
144 | iwe.cmd = IWEVQUAL; | 144 | iwe.cmd = IWEVQUAL; |
145 | iwe.u.qual.qual = network->stats.signal; | 145 | iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | |
146 | iwe.u.qual.level = network->stats.rssi; | 146 | IW_QUAL_NOISE_UPDATED; |
147 | iwe.u.qual.noise = network->stats.noise; | 147 | |
148 | iwe.u.qual.updated = network->stats.mask & IEEE80211_STATMASK_WEMASK; | 148 | if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) { |
149 | if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) | 149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | |
150 | iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; | 150 | IW_QUAL_LEVEL_INVALID; |
151 | if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) | 151 | iwe.u.qual.qual = 0; |
152 | iwe.u.qual.level = 0; | ||
153 | } else { | ||
154 | iwe.u.qual.level = network->stats.rssi; | ||
155 | iwe.u.qual.qual = | ||
156 | (100 * | ||
157 | (ieee->perfect_rssi - ieee->worst_rssi) * | ||
158 | (ieee->perfect_rssi - ieee->worst_rssi) - | ||
159 | (ieee->perfect_rssi - network->stats.rssi) * | ||
160 | (15 * (ieee->perfect_rssi - ieee->worst_rssi) + | ||
161 | 62 * (ieee->perfect_rssi - network->stats.rssi))) / | ||
162 | ((ieee->perfect_rssi - ieee->worst_rssi) * | ||
163 | (ieee->perfect_rssi - ieee->worst_rssi)); | ||
164 | if (iwe.u.qual.qual > 100) | ||
165 | iwe.u.qual.qual = 100; | ||
166 | else if (iwe.u.qual.qual < 1) | ||
167 | iwe.u.qual.qual = 0; | ||
168 | } | ||
169 | |||
170 | if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) { | ||
152 | iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; | 171 | iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; |
153 | if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) | 172 | iwe.u.qual.noise = 0; |
154 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; | 173 | } else { |
174 | iwe.u.qual.noise = network->stats.noise; | ||
175 | } | ||
155 | 176 | ||
156 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); | 177 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); |
157 | 178 | ||
@@ -162,7 +183,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
162 | if (iwe.u.data.length) | 183 | if (iwe.u.data.length) |
163 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 184 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
164 | 185 | ||
165 | if (ieee->wpa_enabled && network->wpa_ie_len) { | 186 | if (network->wpa_ie_len) { |
166 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 187 | char buf[MAX_WPA_IE_LEN * 2 + 30]; |
167 | 188 | ||
168 | u8 *p = buf; | 189 | u8 *p = buf; |
@@ -177,7 +198,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
177 | start = iwe_stream_add_point(start, stop, &iwe, buf); | 198 | start = iwe_stream_add_point(start, stop, &iwe, buf); |
178 | } | 199 | } |
179 | 200 | ||
180 | if (ieee->wpa_enabled && network->rsn_ie_len) { | 201 | if (network->rsn_ie_len) { |
181 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 202 | char buf[MAX_WPA_IE_LEN * 2 + 30]; |
182 | 203 | ||
183 | u8 *p = buf; | 204 | u8 *p = buf; |
@@ -197,8 +218,8 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
197 | iwe.cmd = IWEVCUSTOM; | 218 | iwe.cmd = IWEVCUSTOM; |
198 | p = custom; | 219 | p = custom; |
199 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), | 220 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), |
200 | " Last beacon: %lums ago", | 221 | " Last beacon: %dms ago", |
201 | (jiffies - network->last_scanned) / (HZ / 100)); | 222 | jiffies_to_msecs(jiffies - network->last_scanned)); |
202 | iwe.u.data.length = p - custom; | 223 | iwe.u.data.length = p - custom; |
203 | if (iwe.u.data.length) | 224 | if (iwe.u.data.length) |
204 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 225 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
@@ -228,13 +249,13 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | |||
228 | ev = ipw2100_translate_scan(ieee, ev, stop, network); | 249 | ev = ipw2100_translate_scan(ieee, ev, stop, network); |
229 | else | 250 | else |
230 | IEEE80211_DEBUG_SCAN("Not showing network '%s (" | 251 | IEEE80211_DEBUG_SCAN("Not showing network '%s (" |
231 | MAC_FMT ")' due to age (%lums).\n", | 252 | MAC_FMT ")' due to age (%dms).\n", |
232 | escape_essid(network->ssid, | 253 | escape_essid(network->ssid, |
233 | network->ssid_len), | 254 | network->ssid_len), |
234 | MAC_ARG(network->bssid), | 255 | MAC_ARG(network->bssid), |
235 | (jiffies - | 256 | jiffies_to_msecs(jiffies - |
236 | network->last_scanned) / (HZ / | 257 | network-> |
237 | 100)); | 258 | last_scanned)); |
238 | } | 259 | } |
239 | 260 | ||
240 | spin_unlock_irqrestore(&ieee->lock, flags); | 261 | spin_unlock_irqrestore(&ieee->lock, flags); |
@@ -258,6 +279,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
258 | }; | 279 | }; |
259 | int i, key, key_provided, len; | 280 | int i, key, key_provided, len; |
260 | struct ieee80211_crypt_data **crypt; | 281 | struct ieee80211_crypt_data **crypt; |
282 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt; | ||
261 | 283 | ||
262 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); | 284 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); |
263 | 285 | ||
@@ -298,15 +320,17 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
298 | 320 | ||
299 | if (i == WEP_KEYS) { | 321 | if (i == WEP_KEYS) { |
300 | sec.enabled = 0; | 322 | sec.enabled = 0; |
323 | sec.encrypt = 0; | ||
301 | sec.level = SEC_LEVEL_0; | 324 | sec.level = SEC_LEVEL_0; |
302 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | 325 | sec.flags |= SEC_ENABLED | SEC_LEVEL | SEC_ENCRYPT; |
303 | } | 326 | } |
304 | 327 | ||
305 | goto done; | 328 | goto done; |
306 | } | 329 | } |
307 | 330 | ||
308 | sec.enabled = 1; | 331 | sec.enabled = 1; |
309 | sec.flags |= SEC_ENABLED; | 332 | sec.encrypt = 1; |
333 | sec.flags |= SEC_ENABLED | SEC_ENCRYPT; | ||
310 | 334 | ||
311 | if (*crypt != NULL && (*crypt)->ops != NULL && | 335 | if (*crypt != NULL && (*crypt)->ops != NULL && |
312 | strcmp((*crypt)->ops->name, "WEP") != 0) { | 336 | strcmp((*crypt)->ops->name, "WEP") != 0) { |
@@ -315,7 +339,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
315 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 339 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
316 | } | 340 | } |
317 | 341 | ||
318 | if (*crypt == NULL) { | 342 | if (*crypt == NULL && host_crypto) { |
319 | struct ieee80211_crypt_data *new_crypt; | 343 | struct ieee80211_crypt_data *new_crypt; |
320 | 344 | ||
321 | /* take WEP into use */ | 345 | /* take WEP into use */ |
@@ -355,49 +379,56 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
355 | key, escape_essid(sec.keys[key], len), | 379 | key, escape_essid(sec.keys[key], len), |
356 | erq->length, len); | 380 | erq->length, len); |
357 | sec.key_sizes[key] = len; | 381 | sec.key_sizes[key] = len; |
358 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, | 382 | if (*crypt) |
359 | (*crypt)->priv); | 383 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, |
384 | (*crypt)->priv); | ||
360 | sec.flags |= (1 << key); | 385 | sec.flags |= (1 << key); |
361 | /* This ensures a key will be activated if no key is | 386 | /* This ensures a key will be activated if no key is |
362 | * explicitely set */ | 387 | * explicitely set */ |
363 | if (key == sec.active_key) | 388 | if (key == sec.active_key) |
364 | sec.flags |= SEC_ACTIVE_KEY; | 389 | sec.flags |= SEC_ACTIVE_KEY; |
390 | |||
365 | } else { | 391 | } else { |
366 | len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, | 392 | if (host_crypto) { |
367 | NULL, (*crypt)->priv); | 393 | len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, |
368 | if (len == 0) { | 394 | NULL, (*crypt)->priv); |
369 | /* Set a default key of all 0 */ | 395 | if (len == 0) { |
370 | IEEE80211_DEBUG_WX("Setting key %d to all zero.\n", | 396 | /* Set a default key of all 0 */ |
371 | key); | 397 | IEEE80211_DEBUG_WX("Setting key %d to all " |
372 | memset(sec.keys[key], 0, 13); | 398 | "zero.\n", key); |
373 | (*crypt)->ops->set_key(sec.keys[key], 13, NULL, | 399 | memset(sec.keys[key], 0, 13); |
374 | (*crypt)->priv); | 400 | (*crypt)->ops->set_key(sec.keys[key], 13, NULL, |
375 | sec.key_sizes[key] = 13; | 401 | (*crypt)->priv); |
376 | sec.flags |= (1 << key); | 402 | sec.key_sizes[key] = 13; |
403 | sec.flags |= (1 << key); | ||
404 | } | ||
377 | } | 405 | } |
378 | |||
379 | /* No key data - just set the default TX key index */ | 406 | /* No key data - just set the default TX key index */ |
380 | if (key_provided) { | 407 | if (key_provided) { |
381 | IEEE80211_DEBUG_WX | 408 | IEEE80211_DEBUG_WX("Setting key %d to default Tx " |
382 | ("Setting key %d to default Tx key.\n", key); | 409 | "key.\n", key); |
383 | ieee->tx_keyidx = key; | 410 | ieee->tx_keyidx = key; |
384 | sec.active_key = key; | 411 | sec.active_key = key; |
385 | sec.flags |= SEC_ACTIVE_KEY; | 412 | sec.flags |= SEC_ACTIVE_KEY; |
386 | } | 413 | } |
387 | } | 414 | } |
388 | 415 | if (erq->flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) { | |
389 | done: | 416 | ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); |
390 | ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); | 417 | sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : |
391 | sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; | 418 | WLAN_AUTH_SHARED_KEY; |
392 | sec.flags |= SEC_AUTH_MODE; | 419 | sec.flags |= SEC_AUTH_MODE; |
393 | IEEE80211_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ? | 420 | IEEE80211_DEBUG_WX("Auth: %s\n", |
394 | "OPEN" : "SHARED KEY"); | 421 | sec.auth_mode == WLAN_AUTH_OPEN ? |
422 | "OPEN" : "SHARED KEY"); | ||
423 | } | ||
395 | 424 | ||
396 | /* For now we just support WEP, so only set that security level... | 425 | /* For now we just support WEP, so only set that security level... |
397 | * TODO: When WPA is added this is one place that needs to change */ | 426 | * TODO: When WPA is added this is one place that needs to change */ |
398 | sec.flags |= SEC_LEVEL; | 427 | sec.flags |= SEC_LEVEL; |
399 | sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ | 428 | sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ |
429 | sec.encode_alg[key] = SEC_ALG_WEP; | ||
400 | 430 | ||
431 | done: | ||
401 | if (ieee->set_security) | 432 | if (ieee->set_security) |
402 | ieee->set_security(dev, &sec); | 433 | ieee->set_security(dev, &sec); |
403 | 434 | ||
@@ -422,6 +453,7 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
422 | struct iw_point *erq = &(wrqu->encoding); | 453 | struct iw_point *erq = &(wrqu->encoding); |
423 | int len, key; | 454 | int len, key; |
424 | struct ieee80211_crypt_data *crypt; | 455 | struct ieee80211_crypt_data *crypt; |
456 | struct ieee80211_security *sec = &ieee->sec; | ||
425 | 457 | ||
426 | IEEE80211_DEBUG_WX("GET_ENCODE\n"); | 458 | IEEE80211_DEBUG_WX("GET_ENCODE\n"); |
427 | 459 | ||
@@ -436,23 +468,16 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
436 | crypt = ieee->crypt[key]; | 468 | crypt = ieee->crypt[key]; |
437 | erq->flags = key + 1; | 469 | erq->flags = key + 1; |
438 | 470 | ||
439 | if (crypt == NULL || crypt->ops == NULL) { | 471 | if (!sec->enabled) { |
440 | erq->length = 0; | 472 | erq->length = 0; |
441 | erq->flags |= IW_ENCODE_DISABLED; | 473 | erq->flags |= IW_ENCODE_DISABLED; |
442 | return 0; | 474 | return 0; |
443 | } | 475 | } |
444 | 476 | ||
445 | if (strcmp(crypt->ops->name, "WEP") != 0) { | 477 | len = sec->key_sizes[key]; |
446 | /* only WEP is supported with wireless extensions, so just | 478 | memcpy(keybuf, sec->keys[key], len); |
447 | * report that encryption is used */ | ||
448 | erq->length = 0; | ||
449 | erq->flags |= IW_ENCODE_ENABLED; | ||
450 | return 0; | ||
451 | } | ||
452 | 479 | ||
453 | len = crypt->ops->get_key(keybuf, WEP_KEY_LEN, NULL, crypt->priv); | ||
454 | erq->length = (len >= 0 ? len : 0); | 480 | erq->length = (len >= 0 ? len : 0); |
455 | |||
456 | erq->flags |= IW_ENCODE_ENABLED; | 481 | erq->flags |= IW_ENCODE_ENABLED; |
457 | 482 | ||
458 | if (ieee->open_wep) | 483 | if (ieee->open_wep) |
@@ -463,6 +488,240 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
463 | return 0; | 488 | return 0; |
464 | } | 489 | } |
465 | 490 | ||
491 | int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | ||
492 | struct iw_request_info *info, | ||
493 | union iwreq_data *wrqu, char *extra) | ||
494 | { | ||
495 | struct net_device *dev = ieee->dev; | ||
496 | struct iw_point *encoding = &wrqu->encoding; | ||
497 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
498 | int i, idx, ret = 0; | ||
499 | int group_key = 0; | ||
500 | const char *alg, *module; | ||
501 | struct ieee80211_crypto_ops *ops; | ||
502 | struct ieee80211_crypt_data **crypt; | ||
503 | |||
504 | struct ieee80211_security sec = { | ||
505 | .flags = 0, | ||
506 | }; | ||
507 | |||
508 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
509 | if (idx) { | ||
510 | if (idx < 1 || idx > WEP_KEYS) | ||
511 | return -EINVAL; | ||
512 | idx--; | ||
513 | } else | ||
514 | idx = ieee->tx_keyidx; | ||
515 | |||
516 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { | ||
517 | crypt = &ieee->crypt[idx]; | ||
518 | group_key = 1; | ||
519 | } else { | ||
520 | if (idx != 0) | ||
521 | return -EINVAL; | ||
522 | if (ieee->iw_mode == IW_MODE_INFRA) | ||
523 | crypt = &ieee->crypt[idx]; | ||
524 | else | ||
525 | return -EINVAL; | ||
526 | } | ||
527 | |||
528 | sec.flags |= SEC_ENABLED | SEC_ENCRYPT; | ||
529 | if ((encoding->flags & IW_ENCODE_DISABLED) || | ||
530 | ext->alg == IW_ENCODE_ALG_NONE) { | ||
531 | if (*crypt) | ||
532 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
533 | |||
534 | for (i = 0; i < WEP_KEYS; i++) | ||
535 | if (ieee->crypt[i] != NULL) | ||
536 | break; | ||
537 | |||
538 | if (i == WEP_KEYS) { | ||
539 | sec.enabled = 0; | ||
540 | sec.encrypt = 0; | ||
541 | sec.level = SEC_LEVEL_0; | ||
542 | sec.flags |= SEC_LEVEL; | ||
543 | } | ||
544 | goto done; | ||
545 | } | ||
546 | |||
547 | sec.enabled = 1; | ||
548 | sec.encrypt = 1; | ||
549 | |||
550 | if (group_key ? !ieee->host_mc_decrypt : | ||
551 | !(ieee->host_encrypt || ieee->host_decrypt || | ||
552 | ieee->host_encrypt_msdu)) | ||
553 | goto skip_host_crypt; | ||
554 | |||
555 | switch (ext->alg) { | ||
556 | case IW_ENCODE_ALG_WEP: | ||
557 | alg = "WEP"; | ||
558 | module = "ieee80211_crypt_wep"; | ||
559 | break; | ||
560 | case IW_ENCODE_ALG_TKIP: | ||
561 | alg = "TKIP"; | ||
562 | module = "ieee80211_crypt_tkip"; | ||
563 | break; | ||
564 | case IW_ENCODE_ALG_CCMP: | ||
565 | alg = "CCMP"; | ||
566 | module = "ieee80211_crypt_ccmp"; | ||
567 | break; | ||
568 | default: | ||
569 | IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", | ||
570 | dev->name, ext->alg); | ||
571 | ret = -EINVAL; | ||
572 | goto done; | ||
573 | } | ||
574 | |||
575 | ops = ieee80211_get_crypto_ops(alg); | ||
576 | if (ops == NULL) { | ||
577 | request_module(module); | ||
578 | ops = ieee80211_get_crypto_ops(alg); | ||
579 | } | ||
580 | if (ops == NULL) { | ||
581 | IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", | ||
582 | dev->name, ext->alg); | ||
583 | ret = -EINVAL; | ||
584 | goto done; | ||
585 | } | ||
586 | |||
587 | if (*crypt == NULL || (*crypt)->ops != ops) { | ||
588 | struct ieee80211_crypt_data *new_crypt; | ||
589 | |||
590 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
591 | |||
592 | new_crypt = (struct ieee80211_crypt_data *) | ||
593 | kmalloc(sizeof(*new_crypt), GFP_KERNEL); | ||
594 | if (new_crypt == NULL) { | ||
595 | ret = -ENOMEM; | ||
596 | goto done; | ||
597 | } | ||
598 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
599 | new_crypt->ops = ops; | ||
600 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) | ||
601 | new_crypt->priv = new_crypt->ops->init(idx); | ||
602 | if (new_crypt->priv == NULL) { | ||
603 | kfree(new_crypt); | ||
604 | ret = -EINVAL; | ||
605 | goto done; | ||
606 | } | ||
607 | *crypt = new_crypt; | ||
608 | } | ||
609 | |||
610 | if (ext->key_len > 0 && (*crypt)->ops->set_key && | ||
611 | (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, | ||
612 | (*crypt)->priv) < 0) { | ||
613 | IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); | ||
614 | ret = -EINVAL; | ||
615 | goto done; | ||
616 | } | ||
617 | |||
618 | skip_host_crypt: | ||
619 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | ||
620 | ieee->tx_keyidx = idx; | ||
621 | sec.active_key = idx; | ||
622 | sec.flags |= SEC_ACTIVE_KEY; | ||
623 | } | ||
624 | |||
625 | if (ext->alg != IW_ENCODE_ALG_NONE) { | ||
626 | memcpy(sec.keys[idx], ext->key, ext->key_len); | ||
627 | sec.key_sizes[idx] = ext->key_len; | ||
628 | sec.flags |= (1 << idx); | ||
629 | if (ext->alg == IW_ENCODE_ALG_WEP) { | ||
630 | sec.encode_alg[idx] = SEC_ALG_WEP; | ||
631 | sec.flags |= SEC_LEVEL; | ||
632 | sec.level = SEC_LEVEL_1; | ||
633 | } else if (ext->alg == IW_ENCODE_ALG_TKIP) { | ||
634 | sec.encode_alg[idx] = SEC_ALG_TKIP; | ||
635 | sec.flags |= SEC_LEVEL; | ||
636 | sec.level = SEC_LEVEL_2; | ||
637 | } else if (ext->alg == IW_ENCODE_ALG_CCMP) { | ||
638 | sec.encode_alg[idx] = SEC_ALG_CCMP; | ||
639 | sec.flags |= SEC_LEVEL; | ||
640 | sec.level = SEC_LEVEL_3; | ||
641 | } | ||
642 | /* Don't set sec level for group keys. */ | ||
643 | if (group_key) | ||
644 | sec.flags &= ~SEC_LEVEL; | ||
645 | } | ||
646 | done: | ||
647 | if (ieee->set_security) | ||
648 | ieee->set_security(ieee->dev, &sec); | ||
649 | |||
650 | /* | ||
651 | * Do not reset port if card is in Managed mode since resetting will | ||
652 | * generate new IEEE 802.11 authentication which may end up in looping | ||
653 | * with IEEE 802.1X. If your hardware requires a reset after WEP | ||
654 | * configuration (for example... Prism2), implement the reset_port in | ||
655 | * the callbacks structures used to initialize the 802.11 stack. | ||
656 | */ | ||
657 | if (ieee->reset_on_keychange && | ||
658 | ieee->iw_mode != IW_MODE_INFRA && | ||
659 | ieee->reset_port && ieee->reset_port(dev)) { | ||
660 | IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); | ||
661 | return -EINVAL; | ||
662 | } | ||
663 | |||
664 | return ret; | ||
665 | } | ||
666 | |||
667 | int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | ||
668 | struct iw_request_info *info, | ||
669 | union iwreq_data *wrqu, char *extra) | ||
670 | { | ||
671 | struct iw_point *encoding = &wrqu->encoding; | ||
672 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
673 | struct ieee80211_security *sec = &ieee->sec; | ||
674 | int idx, max_key_len; | ||
675 | |||
676 | max_key_len = encoding->length - sizeof(*ext); | ||
677 | if (max_key_len < 0) | ||
678 | return -EINVAL; | ||
679 | |||
680 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
681 | if (idx) { | ||
682 | if (idx < 1 || idx > WEP_KEYS) | ||
683 | return -EINVAL; | ||
684 | idx--; | ||
685 | } else | ||
686 | idx = ieee->tx_keyidx; | ||
687 | |||
688 | if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | ||
689 | if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) | ||
690 | return -EINVAL; | ||
691 | |||
692 | encoding->flags = idx + 1; | ||
693 | memset(ext, 0, sizeof(*ext)); | ||
694 | |||
695 | if (!sec->enabled) { | ||
696 | ext->alg = IW_ENCODE_ALG_NONE; | ||
697 | ext->key_len = 0; | ||
698 | encoding->flags |= IW_ENCODE_DISABLED; | ||
699 | } else { | ||
700 | if (sec->encode_alg[idx] == SEC_ALG_WEP) | ||
701 | ext->alg = IW_ENCODE_ALG_WEP; | ||
702 | else if (sec->encode_alg[idx] == SEC_ALG_TKIP) | ||
703 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
704 | else if (sec->encode_alg[idx] == SEC_ALG_CCMP) | ||
705 | ext->alg = IW_ENCODE_ALG_CCMP; | ||
706 | else | ||
707 | return -EINVAL; | ||
708 | |||
709 | ext->key_len = sec->key_sizes[idx]; | ||
710 | memcpy(ext->key, sec->keys[idx], ext->key_len); | ||
711 | encoding->flags |= IW_ENCODE_ENABLED; | ||
712 | if (ext->key_len && | ||
713 | (ext->alg == IW_ENCODE_ALG_TKIP || | ||
714 | ext->alg == IW_ENCODE_ALG_CCMP)) | ||
715 | ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; | ||
716 | |||
717 | } | ||
718 | |||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | EXPORT_SYMBOL(ieee80211_wx_set_encodeext); | ||
723 | EXPORT_SYMBOL(ieee80211_wx_get_encodeext); | ||
724 | |||
466 | EXPORT_SYMBOL(ieee80211_wx_get_scan); | 725 | EXPORT_SYMBOL(ieee80211_wx_get_scan); |
467 | EXPORT_SYMBOL(ieee80211_wx_set_encode); | 726 | EXPORT_SYMBOL(ieee80211_wx_set_encode); |
468 | EXPORT_SYMBOL(ieee80211_wx_get_encode); | 727 | EXPORT_SYMBOL(ieee80211_wx_get_encode); |