diff options
Diffstat (limited to 'drivers/net')
58 files changed, 8735 insertions, 3364 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1958d9e16a3a..5c69d57f8548 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -447,7 +447,7 @@ config NET_SB1250_MAC | |||
447 | 447 | ||
448 | config SGI_IOC3_ETH | 448 | config SGI_IOC3_ETH |
449 | bool "SGI IOC3 Ethernet" | 449 | bool "SGI IOC3 Ethernet" |
450 | depends on NET_ETHERNET && PCI && SGI_IP27 && BROKEN | 450 | depends on NET_ETHERNET && PCI && SGI_IP27 |
451 | select CRC32 | 451 | select CRC32 |
452 | select MII | 452 | select MII |
453 | help | 453 | help |
@@ -2523,6 +2523,19 @@ config PPP_BSDCOMP | |||
2523 | module; it is called bsd_comp and will show up in the directory | 2523 | module; it is called bsd_comp and will show up in the directory |
2524 | modules once you have said "make modules". If unsure, say N. | 2524 | modules once you have said "make modules". If unsure, say N. |
2525 | 2525 | ||
2526 | config PPP_MPPE | ||
2527 | tristate "PPP MPPE compression (encryption) (EXPERIMENTAL)" | ||
2528 | depends on PPP && EXPERIMENTAL | ||
2529 | select CRYPTO | ||
2530 | select CRYPTO_SHA1 | ||
2531 | select CRYPTO_ARC4 | ||
2532 | ---help--- | ||
2533 | Support for the MPPE Encryption protocol, as employed by the | ||
2534 | Microsoft Point-to-Point Tunneling Protocol. | ||
2535 | |||
2536 | See http://pptpclient.sourceforge.net/ for information on | ||
2537 | configuring PPTP clients and servers to utilize this method. | ||
2538 | |||
2526 | config PPPOE | 2539 | config PPPOE |
2527 | tristate "PPP over Ethernet (EXPERIMENTAL)" | 2540 | tristate "PPP over Ethernet (EXPERIMENTAL)" |
2528 | depends on EXPERIMENTAL && PPP | 2541 | depends on EXPERIMENTAL && PPP |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 7c313cb341b8..4cffd34442aa 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -112,6 +112,7 @@ obj-$(CONFIG_PPP_ASYNC) += ppp_async.o | |||
112 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o | 112 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o |
113 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o | 113 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o |
114 | obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o | 114 | obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o |
115 | obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o | ||
115 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o | 116 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o |
116 | 117 | ||
117 | obj-$(CONFIG_SLIP) += slip.o | 118 | obj-$(CONFIG_SLIP) += slip.o |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 0ee3e27969c6..c53848f787eb 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/version.h> | ||
22 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
23 | 22 | ||
24 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
@@ -29,8 +28,8 @@ | |||
29 | 28 | ||
30 | #define DRV_MODULE_NAME "b44" | 29 | #define DRV_MODULE_NAME "b44" |
31 | #define PFX DRV_MODULE_NAME ": " | 30 | #define PFX DRV_MODULE_NAME ": " |
32 | #define DRV_MODULE_VERSION "0.95" | 31 | #define DRV_MODULE_VERSION "0.96" |
33 | #define DRV_MODULE_RELDATE "Aug 3, 2004" | 32 | #define DRV_MODULE_RELDATE "Nov 8, 2005" |
34 | 33 | ||
35 | #define B44_DEF_MSG_ENABLE \ | 34 | #define B44_DEF_MSG_ENABLE \ |
36 | (NETIF_MSG_DRV | \ | 35 | (NETIF_MSG_DRV | \ |
@@ -102,14 +101,16 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl); | |||
102 | static void b44_halt(struct b44 *); | 101 | static void b44_halt(struct b44 *); |
103 | static void b44_init_rings(struct b44 *); | 102 | static void b44_init_rings(struct b44 *); |
104 | static void b44_init_hw(struct b44 *); | 103 | static void b44_init_hw(struct b44 *); |
105 | static int b44_poll(struct net_device *dev, int *budget); | ||
106 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
107 | static void b44_poll_controller(struct net_device *dev); | ||
108 | #endif | ||
109 | 104 | ||
110 | static int dma_desc_align_mask; | 105 | static int dma_desc_align_mask; |
111 | static int dma_desc_sync_size; | 106 | static int dma_desc_sync_size; |
112 | 107 | ||
108 | static const char b44_gstrings[][ETH_GSTRING_LEN] = { | ||
109 | #define _B44(x...) # x, | ||
110 | B44_STAT_REG_DECLARE | ||
111 | #undef _B44 | ||
112 | }; | ||
113 | |||
113 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, | 114 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, |
114 | dma_addr_t dma_base, | 115 | dma_addr_t dma_base, |
115 | unsigned long offset, | 116 | unsigned long offset, |
@@ -502,7 +503,10 @@ static void b44_stats_update(struct b44 *bp) | |||
502 | for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { | 503 | for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { |
503 | *val++ += br32(bp, reg); | 504 | *val++ += br32(bp, reg); |
504 | } | 505 | } |
505 | val = &bp->hw_stats.rx_good_octets; | 506 | |
507 | /* Pad */ | ||
508 | reg += 8*4UL; | ||
509 | |||
506 | for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { | 510 | for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { |
507 | *val++ += br32(bp, reg); | 511 | *val++ += br32(bp, reg); |
508 | } | 512 | } |
@@ -653,7 +657,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
653 | 657 | ||
654 | /* Hardware bug work-around, the chip is unable to do PCI DMA | 658 | /* Hardware bug work-around, the chip is unable to do PCI DMA |
655 | to/from anything above 1GB :-( */ | 659 | to/from anything above 1GB :-( */ |
656 | if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { | 660 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
657 | /* Sigh... */ | 661 | /* Sigh... */ |
658 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 662 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); |
659 | dev_kfree_skb_any(skb); | 663 | dev_kfree_skb_any(skb); |
@@ -663,7 +667,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
663 | mapping = pci_map_single(bp->pdev, skb->data, | 667 | mapping = pci_map_single(bp->pdev, skb->data, |
664 | RX_PKT_BUF_SZ, | 668 | RX_PKT_BUF_SZ, |
665 | PCI_DMA_FROMDEVICE); | 669 | PCI_DMA_FROMDEVICE); |
666 | if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { | 670 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
667 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 671 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); |
668 | dev_kfree_skb_any(skb); | 672 | dev_kfree_skb_any(skb); |
669 | return -ENOMEM; | 673 | return -ENOMEM; |
@@ -890,11 +894,10 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
890 | { | 894 | { |
891 | struct net_device *dev = dev_id; | 895 | struct net_device *dev = dev_id; |
892 | struct b44 *bp = netdev_priv(dev); | 896 | struct b44 *bp = netdev_priv(dev); |
893 | unsigned long flags; | ||
894 | u32 istat, imask; | 897 | u32 istat, imask; |
895 | int handled = 0; | 898 | int handled = 0; |
896 | 899 | ||
897 | spin_lock_irqsave(&bp->lock, flags); | 900 | spin_lock(&bp->lock); |
898 | 901 | ||
899 | istat = br32(bp, B44_ISTAT); | 902 | istat = br32(bp, B44_ISTAT); |
900 | imask = br32(bp, B44_IMASK); | 903 | imask = br32(bp, B44_IMASK); |
@@ -905,6 +908,12 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
905 | istat &= imask; | 908 | istat &= imask; |
906 | if (istat) { | 909 | if (istat) { |
907 | handled = 1; | 910 | handled = 1; |
911 | |||
912 | if (unlikely(!netif_running(dev))) { | ||
913 | printk(KERN_INFO "%s: late interrupt.\n", dev->name); | ||
914 | goto irq_ack; | ||
915 | } | ||
916 | |||
908 | if (netif_rx_schedule_prep(dev)) { | 917 | if (netif_rx_schedule_prep(dev)) { |
909 | /* NOTE: These writes are posted by the readback of | 918 | /* NOTE: These writes are posted by the readback of |
910 | * the ISTAT register below. | 919 | * the ISTAT register below. |
@@ -917,10 +926,11 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
917 | dev->name); | 926 | dev->name); |
918 | } | 927 | } |
919 | 928 | ||
929 | irq_ack: | ||
920 | bw32(bp, B44_ISTAT, istat); | 930 | bw32(bp, B44_ISTAT, istat); |
921 | br32(bp, B44_ISTAT); | 931 | br32(bp, B44_ISTAT); |
922 | } | 932 | } |
923 | spin_unlock_irqrestore(&bp->lock, flags); | 933 | spin_unlock(&bp->lock); |
924 | return IRQ_RETVAL(handled); | 934 | return IRQ_RETVAL(handled); |
925 | } | 935 | } |
926 | 936 | ||
@@ -948,6 +958,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
948 | { | 958 | { |
949 | struct b44 *bp = netdev_priv(dev); | 959 | struct b44 *bp = netdev_priv(dev); |
950 | struct sk_buff *bounce_skb; | 960 | struct sk_buff *bounce_skb; |
961 | int rc = NETDEV_TX_OK; | ||
951 | dma_addr_t mapping; | 962 | dma_addr_t mapping; |
952 | u32 len, entry, ctrl; | 963 | u32 len, entry, ctrl; |
953 | 964 | ||
@@ -957,29 +968,28 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
957 | /* This is a hard error, log it. */ | 968 | /* This is a hard error, log it. */ |
958 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { | 969 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { |
959 | netif_stop_queue(dev); | 970 | netif_stop_queue(dev); |
960 | spin_unlock_irq(&bp->lock); | ||
961 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", | 971 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", |
962 | dev->name); | 972 | dev->name); |
963 | return 1; | 973 | goto err_out; |
964 | } | 974 | } |
965 | 975 | ||
966 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); | 976 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); |
967 | if(mapping+len > B44_DMA_MASK) { | 977 | if (mapping + len > B44_DMA_MASK) { |
968 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ | 978 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ |
969 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | 979 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); |
970 | 980 | ||
971 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, | 981 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, |
972 | GFP_ATOMIC|GFP_DMA); | 982 | GFP_ATOMIC|GFP_DMA); |
973 | if (!bounce_skb) | 983 | if (!bounce_skb) |
974 | return NETDEV_TX_BUSY; | 984 | goto err_out; |
975 | 985 | ||
976 | mapping = pci_map_single(bp->pdev, bounce_skb->data, | 986 | mapping = pci_map_single(bp->pdev, bounce_skb->data, |
977 | len, PCI_DMA_TODEVICE); | 987 | len, PCI_DMA_TODEVICE); |
978 | if(mapping+len > B44_DMA_MASK) { | 988 | if (mapping + len > B44_DMA_MASK) { |
979 | pci_unmap_single(bp->pdev, mapping, | 989 | pci_unmap_single(bp->pdev, mapping, |
980 | len, PCI_DMA_TODEVICE); | 990 | len, PCI_DMA_TODEVICE); |
981 | dev_kfree_skb_any(bounce_skb); | 991 | dev_kfree_skb_any(bounce_skb); |
982 | return NETDEV_TX_BUSY; | 992 | goto err_out; |
983 | } | 993 | } |
984 | 994 | ||
985 | memcpy(skb_put(bounce_skb, len), skb->data, skb->len); | 995 | memcpy(skb_put(bounce_skb, len), skb->data, skb->len); |
@@ -1019,11 +1029,16 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1019 | if (TX_BUFFS_AVAIL(bp) < 1) | 1029 | if (TX_BUFFS_AVAIL(bp) < 1) |
1020 | netif_stop_queue(dev); | 1030 | netif_stop_queue(dev); |
1021 | 1031 | ||
1032 | dev->trans_start = jiffies; | ||
1033 | |||
1034 | out_unlock: | ||
1022 | spin_unlock_irq(&bp->lock); | 1035 | spin_unlock_irq(&bp->lock); |
1023 | 1036 | ||
1024 | dev->trans_start = jiffies; | 1037 | return rc; |
1025 | 1038 | ||
1026 | return 0; | 1039 | err_out: |
1040 | rc = NETDEV_TX_BUSY; | ||
1041 | goto out_unlock; | ||
1027 | } | 1042 | } |
1028 | 1043 | ||
1029 | static int b44_change_mtu(struct net_device *dev, int new_mtu) | 1044 | static int b44_change_mtu(struct net_device *dev, int new_mtu) |
@@ -1097,8 +1112,7 @@ static void b44_free_rings(struct b44 *bp) | |||
1097 | * | 1112 | * |
1098 | * The chip has been shut down and the driver detached from | 1113 | * The chip has been shut down and the driver detached from |
1099 | * the networking, so no interrupts or new tx packets will | 1114 | * the networking, so no interrupts or new tx packets will |
1100 | * end up in the driver. bp->lock is not held and we are not | 1115 | * end up in the driver. |
1101 | * in an interrupt context and thus may sleep. | ||
1102 | */ | 1116 | */ |
1103 | static void b44_init_rings(struct b44 *bp) | 1117 | static void b44_init_rings(struct b44 *bp) |
1104 | { | 1118 | { |
@@ -1170,16 +1184,14 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1170 | int size; | 1184 | int size; |
1171 | 1185 | ||
1172 | size = B44_RX_RING_SIZE * sizeof(struct ring_info); | 1186 | size = B44_RX_RING_SIZE * sizeof(struct ring_info); |
1173 | bp->rx_buffers = kmalloc(size, GFP_KERNEL); | 1187 | bp->rx_buffers = kzalloc(size, GFP_KERNEL); |
1174 | if (!bp->rx_buffers) | 1188 | if (!bp->rx_buffers) |
1175 | goto out_err; | 1189 | goto out_err; |
1176 | memset(bp->rx_buffers, 0, size); | ||
1177 | 1190 | ||
1178 | size = B44_TX_RING_SIZE * sizeof(struct ring_info); | 1191 | size = B44_TX_RING_SIZE * sizeof(struct ring_info); |
1179 | bp->tx_buffers = kmalloc(size, GFP_KERNEL); | 1192 | bp->tx_buffers = kzalloc(size, GFP_KERNEL); |
1180 | if (!bp->tx_buffers) | 1193 | if (!bp->tx_buffers) |
1181 | goto out_err; | 1194 | goto out_err; |
1182 | memset(bp->tx_buffers, 0, size); | ||
1183 | 1195 | ||
1184 | size = DMA_TABLE_BYTES; | 1196 | size = DMA_TABLE_BYTES; |
1185 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); | 1197 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); |
@@ -1190,10 +1202,10 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1190 | struct dma_desc *rx_ring; | 1202 | struct dma_desc *rx_ring; |
1191 | dma_addr_t rx_ring_dma; | 1203 | dma_addr_t rx_ring_dma; |
1192 | 1204 | ||
1193 | if (!(rx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | 1205 | rx_ring = kzalloc(size, GFP_KERNEL); |
1206 | if (!rx_ring) | ||
1194 | goto out_err; | 1207 | goto out_err; |
1195 | 1208 | ||
1196 | memset(rx_ring, 0, size); | ||
1197 | rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, | 1209 | rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, |
1198 | DMA_TABLE_BYTES, | 1210 | DMA_TABLE_BYTES, |
1199 | DMA_BIDIRECTIONAL); | 1211 | DMA_BIDIRECTIONAL); |
@@ -1216,10 +1228,10 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1216 | struct dma_desc *tx_ring; | 1228 | struct dma_desc *tx_ring; |
1217 | dma_addr_t tx_ring_dma; | 1229 | dma_addr_t tx_ring_dma; |
1218 | 1230 | ||
1219 | if (!(tx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | 1231 | tx_ring = kzalloc(size, GFP_KERNEL); |
1232 | if (!tx_ring) | ||
1220 | goto out_err; | 1233 | goto out_err; |
1221 | 1234 | ||
1222 | memset(tx_ring, 0, size); | ||
1223 | tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, | 1235 | tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, |
1224 | DMA_TABLE_BYTES, | 1236 | DMA_TABLE_BYTES, |
1225 | DMA_TO_DEVICE); | 1237 | DMA_TO_DEVICE); |
@@ -1382,22 +1394,21 @@ static int b44_open(struct net_device *dev) | |||
1382 | 1394 | ||
1383 | err = b44_alloc_consistent(bp); | 1395 | err = b44_alloc_consistent(bp); |
1384 | if (err) | 1396 | if (err) |
1385 | return err; | 1397 | goto out; |
1386 | |||
1387 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); | ||
1388 | if (err) | ||
1389 | goto err_out_free; | ||
1390 | |||
1391 | spin_lock_irq(&bp->lock); | ||
1392 | 1398 | ||
1393 | b44_init_rings(bp); | 1399 | b44_init_rings(bp); |
1394 | b44_init_hw(bp); | 1400 | b44_init_hw(bp); |
1395 | bp->flags |= B44_FLAG_INIT_COMPLETE; | ||
1396 | 1401 | ||
1397 | netif_carrier_off(dev); | 1402 | netif_carrier_off(dev); |
1398 | b44_check_phy(bp); | 1403 | b44_check_phy(bp); |
1399 | 1404 | ||
1400 | spin_unlock_irq(&bp->lock); | 1405 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); |
1406 | if (unlikely(err < 0)) { | ||
1407 | b44_chip_reset(bp); | ||
1408 | b44_free_rings(bp); | ||
1409 | b44_free_consistent(bp); | ||
1410 | goto out; | ||
1411 | } | ||
1401 | 1412 | ||
1402 | init_timer(&bp->timer); | 1413 | init_timer(&bp->timer); |
1403 | bp->timer.expires = jiffies + HZ; | 1414 | bp->timer.expires = jiffies + HZ; |
@@ -1406,11 +1417,7 @@ static int b44_open(struct net_device *dev) | |||
1406 | add_timer(&bp->timer); | 1417 | add_timer(&bp->timer); |
1407 | 1418 | ||
1408 | b44_enable_ints(bp); | 1419 | b44_enable_ints(bp); |
1409 | 1420 | out: | |
1410 | return 0; | ||
1411 | |||
1412 | err_out_free: | ||
1413 | b44_free_consistent(bp); | ||
1414 | return err; | 1421 | return err; |
1415 | } | 1422 | } |
1416 | 1423 | ||
@@ -1445,6 +1452,8 @@ static int b44_close(struct net_device *dev) | |||
1445 | 1452 | ||
1446 | netif_stop_queue(dev); | 1453 | netif_stop_queue(dev); |
1447 | 1454 | ||
1455 | netif_poll_disable(dev); | ||
1456 | |||
1448 | del_timer_sync(&bp->timer); | 1457 | del_timer_sync(&bp->timer); |
1449 | 1458 | ||
1450 | spin_lock_irq(&bp->lock); | 1459 | spin_lock_irq(&bp->lock); |
@@ -1454,13 +1463,14 @@ static int b44_close(struct net_device *dev) | |||
1454 | #endif | 1463 | #endif |
1455 | b44_halt(bp); | 1464 | b44_halt(bp); |
1456 | b44_free_rings(bp); | 1465 | b44_free_rings(bp); |
1457 | bp->flags &= ~B44_FLAG_INIT_COMPLETE; | ||
1458 | netif_carrier_off(bp->dev); | 1466 | netif_carrier_off(bp->dev); |
1459 | 1467 | ||
1460 | spin_unlock_irq(&bp->lock); | 1468 | spin_unlock_irq(&bp->lock); |
1461 | 1469 | ||
1462 | free_irq(dev->irq, dev); | 1470 | free_irq(dev->irq, dev); |
1463 | 1471 | ||
1472 | netif_poll_enable(dev); | ||
1473 | |||
1464 | b44_free_consistent(bp); | 1474 | b44_free_consistent(bp); |
1465 | 1475 | ||
1466 | return 0; | 1476 | return 0; |
@@ -1525,8 +1535,6 @@ static void __b44_set_rx_mode(struct net_device *dev) | |||
1525 | { | 1535 | { |
1526 | struct b44 *bp = netdev_priv(dev); | 1536 | struct b44 *bp = netdev_priv(dev); |
1527 | u32 val; | 1537 | u32 val; |
1528 | int i=0; | ||
1529 | unsigned char zero[6] = {0,0,0,0,0,0}; | ||
1530 | 1538 | ||
1531 | val = br32(bp, B44_RXCONFIG); | 1539 | val = br32(bp, B44_RXCONFIG); |
1532 | val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); | 1540 | val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); |
@@ -1534,14 +1542,17 @@ static void __b44_set_rx_mode(struct net_device *dev) | |||
1534 | val |= RXCONFIG_PROMISC; | 1542 | val |= RXCONFIG_PROMISC; |
1535 | bw32(bp, B44_RXCONFIG, val); | 1543 | bw32(bp, B44_RXCONFIG, val); |
1536 | } else { | 1544 | } else { |
1545 | unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; | ||
1546 | int i = 0; | ||
1547 | |||
1537 | __b44_set_mac_addr(bp); | 1548 | __b44_set_mac_addr(bp); |
1538 | 1549 | ||
1539 | if (dev->flags & IFF_ALLMULTI) | 1550 | if (dev->flags & IFF_ALLMULTI) |
1540 | val |= RXCONFIG_ALLMULTI; | 1551 | val |= RXCONFIG_ALLMULTI; |
1541 | else | 1552 | else |
1542 | i=__b44_load_mcast(bp, dev); | 1553 | i = __b44_load_mcast(bp, dev); |
1543 | 1554 | ||
1544 | for(;i<64;i++) { | 1555 | for (; i < 64; i++) { |
1545 | __b44_cam_write(bp, zero, i); | 1556 | __b44_cam_write(bp, zero, i); |
1546 | } | 1557 | } |
1547 | bw32(bp, B44_RXCONFIG, val); | 1558 | bw32(bp, B44_RXCONFIG, val); |
@@ -1605,7 +1616,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1605 | { | 1616 | { |
1606 | struct b44 *bp = netdev_priv(dev); | 1617 | struct b44 *bp = netdev_priv(dev); |
1607 | 1618 | ||
1608 | if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) | 1619 | if (!netif_running(dev)) |
1609 | return -EAGAIN; | 1620 | return -EAGAIN; |
1610 | cmd->supported = (SUPPORTED_Autoneg); | 1621 | cmd->supported = (SUPPORTED_Autoneg); |
1611 | cmd->supported |= (SUPPORTED_100baseT_Half | | 1622 | cmd->supported |= (SUPPORTED_100baseT_Half | |
@@ -1643,7 +1654,7 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1643 | { | 1654 | { |
1644 | struct b44 *bp = netdev_priv(dev); | 1655 | struct b44 *bp = netdev_priv(dev); |
1645 | 1656 | ||
1646 | if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) | 1657 | if (!netif_running(dev)) |
1647 | return -EAGAIN; | 1658 | return -EAGAIN; |
1648 | 1659 | ||
1649 | /* We do not support gigabit. */ | 1660 | /* We do not support gigabit. */ |
@@ -1773,6 +1784,37 @@ static int b44_set_pauseparam(struct net_device *dev, | |||
1773 | return 0; | 1784 | return 0; |
1774 | } | 1785 | } |
1775 | 1786 | ||
1787 | static void b44_get_strings(struct net_device *dev, u32 stringset, u8 *data) | ||
1788 | { | ||
1789 | switch(stringset) { | ||
1790 | case ETH_SS_STATS: | ||
1791 | memcpy(data, *b44_gstrings, sizeof(b44_gstrings)); | ||
1792 | break; | ||
1793 | } | ||
1794 | } | ||
1795 | |||
1796 | static int b44_get_stats_count(struct net_device *dev) | ||
1797 | { | ||
1798 | return ARRAY_SIZE(b44_gstrings); | ||
1799 | } | ||
1800 | |||
1801 | static void b44_get_ethtool_stats(struct net_device *dev, | ||
1802 | struct ethtool_stats *stats, u64 *data) | ||
1803 | { | ||
1804 | struct b44 *bp = netdev_priv(dev); | ||
1805 | u32 *val = &bp->hw_stats.tx_good_octets; | ||
1806 | u32 i; | ||
1807 | |||
1808 | spin_lock_irq(&bp->lock); | ||
1809 | |||
1810 | b44_stats_update(bp); | ||
1811 | |||
1812 | for (i = 0; i < ARRAY_SIZE(b44_gstrings); i++) | ||
1813 | *data++ = *val++; | ||
1814 | |||
1815 | spin_unlock_irq(&bp->lock); | ||
1816 | } | ||
1817 | |||
1776 | static struct ethtool_ops b44_ethtool_ops = { | 1818 | static struct ethtool_ops b44_ethtool_ops = { |
1777 | .get_drvinfo = b44_get_drvinfo, | 1819 | .get_drvinfo = b44_get_drvinfo, |
1778 | .get_settings = b44_get_settings, | 1820 | .get_settings = b44_get_settings, |
@@ -1785,6 +1827,9 @@ static struct ethtool_ops b44_ethtool_ops = { | |||
1785 | .set_pauseparam = b44_set_pauseparam, | 1827 | .set_pauseparam = b44_set_pauseparam, |
1786 | .get_msglevel = b44_get_msglevel, | 1828 | .get_msglevel = b44_get_msglevel, |
1787 | .set_msglevel = b44_set_msglevel, | 1829 | .set_msglevel = b44_set_msglevel, |
1830 | .get_strings = b44_get_strings, | ||
1831 | .get_stats_count = b44_get_stats_count, | ||
1832 | .get_ethtool_stats = b44_get_ethtool_stats, | ||
1788 | .get_perm_addr = ethtool_op_get_perm_addr, | 1833 | .get_perm_addr = ethtool_op_get_perm_addr, |
1789 | }; | 1834 | }; |
1790 | 1835 | ||
@@ -1893,9 +1938,9 @@ static int __devinit b44_init_one(struct pci_dev *pdev, | |||
1893 | 1938 | ||
1894 | err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); | 1939 | err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); |
1895 | if (err) { | 1940 | if (err) { |
1896 | printk(KERN_ERR PFX "No usable DMA configuration, " | 1941 | printk(KERN_ERR PFX "No usable DMA configuration, " |
1897 | "aborting.\n"); | 1942 | "aborting.\n"); |
1898 | goto err_out_free_res; | 1943 | goto err_out_free_res; |
1899 | } | 1944 | } |
1900 | 1945 | ||
1901 | b44reg_base = pci_resource_start(pdev, 0); | 1946 | b44reg_base = pci_resource_start(pdev, 0); |
@@ -1917,10 +1962,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev, | |||
1917 | bp = netdev_priv(dev); | 1962 | bp = netdev_priv(dev); |
1918 | bp->pdev = pdev; | 1963 | bp->pdev = pdev; |
1919 | bp->dev = dev; | 1964 | bp->dev = dev; |
1920 | if (b44_debug >= 0) | 1965 | |
1921 | bp->msg_enable = (1 << b44_debug) - 1; | 1966 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); |
1922 | else | ||
1923 | bp->msg_enable = B44_DEF_MSG_ENABLE; | ||
1924 | 1967 | ||
1925 | spin_lock_init(&bp->lock); | 1968 | spin_lock_init(&bp->lock); |
1926 | 1969 | ||
@@ -2010,17 +2053,14 @@ err_out_disable_pdev: | |||
2010 | static void __devexit b44_remove_one(struct pci_dev *pdev) | 2053 | static void __devexit b44_remove_one(struct pci_dev *pdev) |
2011 | { | 2054 | { |
2012 | struct net_device *dev = pci_get_drvdata(pdev); | 2055 | struct net_device *dev = pci_get_drvdata(pdev); |
2056 | struct b44 *bp = netdev_priv(dev); | ||
2013 | 2057 | ||
2014 | if (dev) { | 2058 | unregister_netdev(dev); |
2015 | struct b44 *bp = netdev_priv(dev); | 2059 | iounmap(bp->regs); |
2016 | 2060 | free_netdev(dev); | |
2017 | unregister_netdev(dev); | 2061 | pci_release_regions(pdev); |
2018 | iounmap(bp->regs); | 2062 | pci_disable_device(pdev); |
2019 | free_netdev(dev); | 2063 | pci_set_drvdata(pdev, NULL); |
2020 | pci_release_regions(pdev); | ||
2021 | pci_disable_device(pdev); | ||
2022 | pci_set_drvdata(pdev, NULL); | ||
2023 | } | ||
2024 | } | 2064 | } |
2025 | 2065 | ||
2026 | static int b44_suspend(struct pci_dev *pdev, pm_message_t state) | 2066 | static int b44_suspend(struct pci_dev *pdev, pm_message_t state) |
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 593cb0ad4100..b178662978f3 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -346,29 +346,63 @@ struct ring_info { | |||
346 | 346 | ||
347 | #define B44_MCAST_TABLE_SIZE 32 | 347 | #define B44_MCAST_TABLE_SIZE 32 |
348 | 348 | ||
349 | #define B44_STAT_REG_DECLARE \ | ||
350 | _B44(tx_good_octets) \ | ||
351 | _B44(tx_good_pkts) \ | ||
352 | _B44(tx_octets) \ | ||
353 | _B44(tx_pkts) \ | ||
354 | _B44(tx_broadcast_pkts) \ | ||
355 | _B44(tx_multicast_pkts) \ | ||
356 | _B44(tx_len_64) \ | ||
357 | _B44(tx_len_65_to_127) \ | ||
358 | _B44(tx_len_128_to_255) \ | ||
359 | _B44(tx_len_256_to_511) \ | ||
360 | _B44(tx_len_512_to_1023) \ | ||
361 | _B44(tx_len_1024_to_max) \ | ||
362 | _B44(tx_jabber_pkts) \ | ||
363 | _B44(tx_oversize_pkts) \ | ||
364 | _B44(tx_fragment_pkts) \ | ||
365 | _B44(tx_underruns) \ | ||
366 | _B44(tx_total_cols) \ | ||
367 | _B44(tx_single_cols) \ | ||
368 | _B44(tx_multiple_cols) \ | ||
369 | _B44(tx_excessive_cols) \ | ||
370 | _B44(tx_late_cols) \ | ||
371 | _B44(tx_defered) \ | ||
372 | _B44(tx_carrier_lost) \ | ||
373 | _B44(tx_pause_pkts) \ | ||
374 | _B44(rx_good_octets) \ | ||
375 | _B44(rx_good_pkts) \ | ||
376 | _B44(rx_octets) \ | ||
377 | _B44(rx_pkts) \ | ||
378 | _B44(rx_broadcast_pkts) \ | ||
379 | _B44(rx_multicast_pkts) \ | ||
380 | _B44(rx_len_64) \ | ||
381 | _B44(rx_len_65_to_127) \ | ||
382 | _B44(rx_len_128_to_255) \ | ||
383 | _B44(rx_len_256_to_511) \ | ||
384 | _B44(rx_len_512_to_1023) \ | ||
385 | _B44(rx_len_1024_to_max) \ | ||
386 | _B44(rx_jabber_pkts) \ | ||
387 | _B44(rx_oversize_pkts) \ | ||
388 | _B44(rx_fragment_pkts) \ | ||
389 | _B44(rx_missed_pkts) \ | ||
390 | _B44(rx_crc_align_errs) \ | ||
391 | _B44(rx_undersize) \ | ||
392 | _B44(rx_crc_errs) \ | ||
393 | _B44(rx_align_errs) \ | ||
394 | _B44(rx_symbol_errs) \ | ||
395 | _B44(rx_pause_pkts) \ | ||
396 | _B44(rx_nonpause_pkts) | ||
397 | |||
349 | /* SW copy of device statistics, kept up to date by periodic timer | 398 | /* SW copy of device statistics, kept up to date by periodic timer |
350 | * which probes HW values. Must have same relative layout as HW | 399 | * which probes HW values. Check b44_stats_update if you mess with |
351 | * register above, because b44_stats_update depends upon this. | 400 | * the layout |
352 | */ | 401 | */ |
353 | struct b44_hw_stats { | 402 | struct b44_hw_stats { |
354 | u32 tx_good_octets, tx_good_pkts, tx_octets; | 403 | #define _B44(x) u32 x; |
355 | u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts; | 404 | B44_STAT_REG_DECLARE |
356 | u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255; | 405 | #undef _B44 |
357 | u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max; | ||
358 | u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts; | ||
359 | u32 tx_underruns, tx_total_cols, tx_single_cols; | ||
360 | u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols; | ||
361 | u32 tx_defered, tx_carrier_lost, tx_pause_pkts; | ||
362 | u32 __pad1[8]; | ||
363 | |||
364 | u32 rx_good_octets, rx_good_pkts, rx_octets; | ||
365 | u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts; | ||
366 | u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255; | ||
367 | u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max; | ||
368 | u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts; | ||
369 | u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize; | ||
370 | u32 rx_crc_errs, rx_align_errs, rx_symbol_errs; | ||
371 | u32 rx_pause_pkts, rx_nonpause_pkts; | ||
372 | }; | 406 | }; |
373 | 407 | ||
374 | struct b44 { | 408 | struct b44 { |
@@ -386,7 +420,6 @@ struct b44 { | |||
386 | 420 | ||
387 | u32 dma_offset; | 421 | u32 dma_offset; |
388 | u32 flags; | 422 | u32 flags; |
389 | #define B44_FLAG_INIT_COMPLETE 0x00000001 | ||
390 | #define B44_FLAG_BUGGY_TXPTR 0x00000002 | 423 | #define B44_FLAG_BUGGY_TXPTR 0x00000002 |
391 | #define B44_FLAG_REORDER_BUG 0x00000004 | 424 | #define B44_FLAG_REORDER_BUG 0x00000004 |
392 | #define B44_FLAG_PAUSE_AUTO 0x00008000 | 425 | #define B44_FLAG_PAUSE_AUTO 0x00008000 |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8032126fd589..94cec3cf2a13 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1604,35 +1604,27 @@ static int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_ | |||
1604 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) | 1604 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) |
1605 | 1605 | ||
1606 | /* | 1606 | /* |
1607 | * Compute the features available to the bonding device by | 1607 | * Compute the common dev->feature set available to all slaves. Some |
1608 | * intersection of all of the slave devices' BOND_INTERSECT_FEATURES. | 1608 | * feature bits are managed elsewhere, so preserve feature bits set on |
1609 | * Call this after attaching or detaching a slave to update the | 1609 | * master device that are not part of the examined set. |
1610 | * bond's features. | ||
1611 | */ | 1610 | */ |
1612 | static int bond_compute_features(struct bonding *bond) | 1611 | static int bond_compute_features(struct bonding *bond) |
1613 | { | 1612 | { |
1614 | int i; | 1613 | unsigned long features = BOND_INTERSECT_FEATURES; |
1615 | struct slave *slave; | 1614 | struct slave *slave; |
1616 | struct net_device *bond_dev = bond->dev; | 1615 | struct net_device *bond_dev = bond->dev; |
1617 | int features = bond->bond_features; | 1616 | int i; |
1618 | 1617 | ||
1619 | bond_for_each_slave(bond, slave, i) { | 1618 | bond_for_each_slave(bond, slave, i) |
1620 | struct net_device * slave_dev = slave->dev; | 1619 | features &= (slave->dev->features & BOND_INTERSECT_FEATURES); |
1621 | if (i == 0) { | ||
1622 | features |= BOND_INTERSECT_FEATURES; | ||
1623 | } | ||
1624 | features &= | ||
1625 | ~(~slave_dev->features & BOND_INTERSECT_FEATURES); | ||
1626 | } | ||
1627 | 1620 | ||
1628 | /* turn off NETIF_F_SG if we need a csum and h/w can't do it */ | ||
1629 | if ((features & NETIF_F_SG) && | 1621 | if ((features & NETIF_F_SG) && |
1630 | !(features & (NETIF_F_IP_CSUM | | 1622 | !(features & (NETIF_F_IP_CSUM | |
1631 | NETIF_F_NO_CSUM | | 1623 | NETIF_F_NO_CSUM | |
1632 | NETIF_F_HW_CSUM))) { | 1624 | NETIF_F_HW_CSUM))) |
1633 | features &= ~NETIF_F_SG; | 1625 | features &= ~NETIF_F_SG; |
1634 | } | ||
1635 | 1626 | ||
1627 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); | ||
1636 | bond_dev->features = features; | 1628 | bond_dev->features = features; |
1637 | 1629 | ||
1638 | return 0; | 1630 | return 0; |
@@ -4561,8 +4553,6 @@ static int __init bond_init(struct net_device *bond_dev, struct bond_params *par | |||
4561 | NETIF_F_HW_VLAN_RX | | 4553 | NETIF_F_HW_VLAN_RX | |
4562 | NETIF_F_HW_VLAN_FILTER); | 4554 | NETIF_F_HW_VLAN_FILTER); |
4563 | 4555 | ||
4564 | bond->bond_features = bond_dev->features; | ||
4565 | |||
4566 | #ifdef CONFIG_PROC_FS | 4556 | #ifdef CONFIG_PROC_FS |
4567 | bond_create_proc_entry(bond); | 4557 | bond_create_proc_entry(bond); |
4568 | #endif | 4558 | #endif |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index bbf9da8af624..1433e91db0f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -40,8 +40,8 @@ | |||
40 | #include "bond_3ad.h" | 40 | #include "bond_3ad.h" |
41 | #include "bond_alb.h" | 41 | #include "bond_alb.h" |
42 | 42 | ||
43 | #define DRV_VERSION "2.6.4" | 43 | #define DRV_VERSION "2.6.5" |
44 | #define DRV_RELDATE "September 26, 2005" | 44 | #define DRV_RELDATE "November 4, 2005" |
45 | #define DRV_NAME "bonding" | 45 | #define DRV_NAME "bonding" |
46 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 46 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
47 | 47 | ||
@@ -211,9 +211,6 @@ struct bonding { | |||
211 | struct bond_params params; | 211 | struct bond_params params; |
212 | struct list_head vlan_list; | 212 | struct list_head vlan_list; |
213 | struct vlan_group *vlgrp; | 213 | struct vlan_group *vlgrp; |
214 | /* the features the bonding device supports, independently | ||
215 | * of any slaves */ | ||
216 | int bond_features; | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | /** | 216 | /** |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 50f43dbf31ae..1f7ca453bb4a 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -67,7 +67,6 @@ | |||
67 | */ | 67 | */ |
68 | 68 | ||
69 | #include <linux/config.h> | 69 | #include <linux/config.h> |
70 | #include <linux/version.h> | ||
71 | 70 | ||
72 | #include <linux/module.h> | 71 | #include <linux/module.h> |
73 | #include <linux/kernel.h> | 72 | #include <linux/kernel.h> |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index b68b9cad76e9..64105e4eaf31 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -409,7 +409,6 @@ static irqreturn_t e100nw_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
409 | static void e100_rx(struct net_device *dev); | 409 | static void e100_rx(struct net_device *dev); |
410 | static int e100_close(struct net_device *dev); | 410 | static int e100_close(struct net_device *dev); |
411 | static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 411 | static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
412 | static int e100_ethtool_ioctl(struct net_device* dev, struct ifreq *ifr); | ||
413 | static int e100_set_config(struct net_device* dev, struct ifmap* map); | 412 | static int e100_set_config(struct net_device* dev, struct ifmap* map); |
414 | static void e100_tx_timeout(struct net_device *dev); | 413 | static void e100_tx_timeout(struct net_device *dev); |
415 | static struct net_device_stats *e100_get_stats(struct net_device *dev); | 414 | static struct net_device_stats *e100_get_stats(struct net_device *dev); |
@@ -436,6 +435,8 @@ static void e100_reset_transceiver(struct net_device* net); | |||
436 | static void e100_clear_network_leds(unsigned long dummy); | 435 | static void e100_clear_network_leds(unsigned long dummy); |
437 | static void e100_set_network_leds(int active); | 436 | static void e100_set_network_leds(int active); |
438 | 437 | ||
438 | static struct ethtool_ops e100_ethtool_ops; | ||
439 | |||
439 | static void broadcom_check_speed(struct net_device* dev); | 440 | static void broadcom_check_speed(struct net_device* dev); |
440 | static void broadcom_check_duplex(struct net_device* dev); | 441 | static void broadcom_check_duplex(struct net_device* dev); |
441 | static void tdk_check_speed(struct net_device* dev); | 442 | static void tdk_check_speed(struct net_device* dev); |
@@ -495,6 +496,7 @@ etrax_ethernet_init(void) | |||
495 | dev->get_stats = e100_get_stats; | 496 | dev->get_stats = e100_get_stats; |
496 | dev->set_multicast_list = set_multicast_list; | 497 | dev->set_multicast_list = set_multicast_list; |
497 | dev->set_mac_address = e100_set_mac_address; | 498 | dev->set_mac_address = e100_set_mac_address; |
499 | dev->ethtool_ops = &e100_ethtool_ops; | ||
498 | dev->do_ioctl = e100_ioctl; | 500 | dev->do_ioctl = e100_ioctl; |
499 | dev->set_config = e100_set_config; | 501 | dev->set_config = e100_set_config; |
500 | dev->tx_timeout = e100_tx_timeout; | 502 | dev->tx_timeout = e100_tx_timeout; |
@@ -1448,8 +1450,6 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1448 | 1450 | ||
1449 | spin_lock(&np->lock); /* Preempt protection */ | 1451 | spin_lock(&np->lock); /* Preempt protection */ |
1450 | switch (cmd) { | 1452 | switch (cmd) { |
1451 | case SIOCETHTOOL: | ||
1452 | return e100_ethtool_ioctl(dev,ifr); | ||
1453 | case SIOCGMIIPHY: /* Get PHY address */ | 1453 | case SIOCGMIIPHY: /* Get PHY address */ |
1454 | data->phy_id = mdio_phy_addr; | 1454 | data->phy_id = mdio_phy_addr; |
1455 | break; | 1455 | break; |
@@ -1486,88 +1486,81 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1486 | return 0; | 1486 | return 0; |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | static int | 1489 | static int e100_set_settings(struct net_device *dev, |
1490 | e100_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr) | 1490 | struct ethtool_cmd *ecmd) |
1491 | { | 1491 | { |
1492 | struct ethtool_cmd ecmd; | 1492 | ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | |
1493 | |||
1494 | if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) | ||
1495 | return -EFAULT; | ||
1496 | |||
1497 | switch (ecmd.cmd) { | ||
1498 | case ETHTOOL_GSET: | ||
1499 | { | ||
1500 | memset((void *) &ecmd, 0, sizeof (ecmd)); | ||
1501 | ecmd.supported = | ||
1502 | SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | | ||
1503 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | | 1493 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
1504 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; | 1494 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; |
1505 | ecmd.port = PORT_TP; | 1495 | ecmd->port = PORT_TP; |
1506 | ecmd.transceiver = XCVR_EXTERNAL; | 1496 | ecmd->transceiver = XCVR_EXTERNAL; |
1507 | ecmd.phy_address = mdio_phy_addr; | 1497 | ecmd->phy_address = mdio_phy_addr; |
1508 | ecmd.speed = current_speed; | 1498 | ecmd->speed = current_speed; |
1509 | ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | 1499 | ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; |
1510 | ecmd.advertising = ADVERTISED_TP; | 1500 | ecmd->advertising = ADVERTISED_TP; |
1511 | if (current_duplex == autoneg && current_speed_selection == 0) | 1501 | |
1512 | ecmd.advertising |= ADVERTISED_Autoneg; | 1502 | if (current_duplex == autoneg && current_speed_selection == 0) |
1513 | else { | 1503 | ecmd->advertising |= ADVERTISED_Autoneg; |
1514 | ecmd.advertising |= | 1504 | else { |
1515 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | 1505 | ecmd->advertising |= |
1516 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | 1506 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
1517 | if (current_speed_selection == 10) | 1507 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; |
1518 | ecmd.advertising &= ~(ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full); | 1508 | if (current_speed_selection == 10) |
1519 | else if (current_speed_selection == 100) | 1509 | ecmd->advertising &= ~(ADVERTISED_100baseT_Half | |
1520 | ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full); | 1510 | ADVERTISED_100baseT_Full); |
1521 | if (current_duplex == half) | 1511 | else if (current_speed_selection == 100) |
1522 | ecmd.advertising &= ~(ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Full); | 1512 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | |
1523 | else if (current_duplex == full) | 1513 | ADVERTISED_10baseT_Full); |
1524 | ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_100baseT_Half); | 1514 | if (current_duplex == half) |
1525 | } | 1515 | ecmd->advertising &= ~(ADVERTISED_10baseT_Full | |
1526 | ecmd.autoneg = AUTONEG_ENABLE; | 1516 | ADVERTISED_100baseT_Full); |
1527 | if (copy_to_user(ifr->ifr_data, &ecmd, sizeof (ecmd))) | 1517 | else if (current_duplex == full) |
1528 | return -EFAULT; | 1518 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | |
1529 | } | 1519 | ADVERTISED_100baseT_Half); |
1530 | break; | 1520 | } |
1531 | case ETHTOOL_SSET: | 1521 | |
1532 | { | 1522 | ecmd->autoneg = AUTONEG_ENABLE; |
1533 | if (!capable(CAP_NET_ADMIN)) { | 1523 | return 0; |
1534 | return -EPERM; | 1524 | } |
1535 | } | 1525 | |
1536 | if (ecmd.autoneg == AUTONEG_ENABLE) { | 1526 | static int e100_set_settings(struct net_device *dev, |
1537 | e100_set_duplex(dev, autoneg); | 1527 | struct ethtool_cmd *ecmd) |
1538 | e100_set_speed(dev, 0); | 1528 | { |
1539 | } else { | 1529 | if (ecmd->autoneg == AUTONEG_ENABLE) { |
1540 | e100_set_duplex(dev, ecmd.duplex == DUPLEX_HALF ? half : full); | 1530 | e100_set_duplex(dev, autoneg); |
1541 | e100_set_speed(dev, ecmd.speed == SPEED_10 ? 10: 100); | 1531 | e100_set_speed(dev, 0); |
1542 | } | 1532 | } else { |
1543 | } | 1533 | e100_set_duplex(dev, ecmd->duplex == DUPLEX_HALF ? half : full); |
1544 | break; | 1534 | e100_set_speed(dev, ecmd->speed == SPEED_10 ? 10: 100); |
1545 | case ETHTOOL_GDRVINFO: | ||
1546 | { | ||
1547 | struct ethtool_drvinfo info; | ||
1548 | memset((void *) &info, 0, sizeof (info)); | ||
1549 | strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1); | ||
1550 | strncpy(info.version, "$Revision: 1.31 $", sizeof(info.version) - 1); | ||
1551 | strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1); | ||
1552 | strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1); | ||
1553 | info.regdump_len = 0; | ||
1554 | info.eedump_len = 0; | ||
1555 | info.testinfo_len = 0; | ||
1556 | if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) | ||
1557 | return -EFAULT; | ||
1558 | } | ||
1559 | break; | ||
1560 | case ETHTOOL_NWAY_RST: | ||
1561 | if (current_duplex == autoneg && current_speed_selection == 0) | ||
1562 | e100_negotiate(dev); | ||
1563 | break; | ||
1564 | default: | ||
1565 | return -EOPNOTSUPP; | ||
1566 | break; | ||
1567 | } | 1535 | } |
1536 | |||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1540 | static void e100_get_drvinfo(struct net_device *dev, | ||
1541 | struct ethtool_drvinfo *info) | ||
1542 | { | ||
1543 | strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); | ||
1544 | strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); | ||
1545 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); | ||
1546 | strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); | ||
1547 | } | ||
1548 | |||
1549 | static int e100_nway_reset(struct net_device *dev) | ||
1550 | { | ||
1551 | if (current_duplex == autoneg && current_speed_selection == 0) | ||
1552 | e100_negotiate(dev); | ||
1568 | return 0; | 1553 | return 0; |
1569 | } | 1554 | } |
1570 | 1555 | ||
1556 | static struct ethtool_ops e100_ethtool_ops = { | ||
1557 | .get_settings = e100_get_settings, | ||
1558 | .set_settings = e100_set_settings, | ||
1559 | .get_drvinfo = e100_get_drvinfo, | ||
1560 | .nway_reset = e100_nway_reset, | ||
1561 | .get_link = ethtool_op_get_link, | ||
1562 | }; | ||
1563 | |||
1571 | static int | 1564 | static int |
1572 | e100_set_config(struct net_device *dev, struct ifmap *map) | 1565 | e100_set_config(struct net_device *dev, struct ifmap *map) |
1573 | { | 1566 | { |
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 7809838e6c4c..2a290cc397ad 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -1549,7 +1549,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- | |||
1549 | static int __init dgrs_init_module (void) | 1549 | static int __init dgrs_init_module (void) |
1550 | { | 1550 | { |
1551 | int i; | 1551 | int i; |
1552 | int eisacount = 0, pcicount = 0; | 1552 | int cardcount = 0; |
1553 | 1553 | ||
1554 | /* | 1554 | /* |
1555 | * Command line variable overrides | 1555 | * Command line variable overrides |
@@ -1591,15 +1591,13 @@ static int __init dgrs_init_module (void) | |||
1591 | * Find and configure all the cards | 1591 | * Find and configure all the cards |
1592 | */ | 1592 | */ |
1593 | #ifdef CONFIG_EISA | 1593 | #ifdef CONFIG_EISA |
1594 | eisacount = eisa_driver_register(&dgrs_eisa_driver); | 1594 | cardcount = eisa_driver_register(&dgrs_eisa_driver); |
1595 | if (eisacount < 0) | 1595 | if (cardcount < 0) |
1596 | return eisacount; | 1596 | return cardcount; |
1597 | #endif | ||
1598 | #ifdef CONFIG_PCI | ||
1599 | pcicount = pci_register_driver(&dgrs_pci_driver); | ||
1600 | if (pcicount) | ||
1601 | return pcicount; | ||
1602 | #endif | 1597 | #endif |
1598 | cardcount = pci_register_driver(&dgrs_pci_driver); | ||
1599 | if (cardcount) | ||
1600 | return cardcount; | ||
1603 | return 0; | 1601 | return 0; |
1604 | } | 1602 | } |
1605 | 1603 | ||
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index c0af6fb1fbba..f8c9bcdab68b 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -60,7 +60,6 @@ | |||
60 | #include <linux/etherdevice.h> | 60 | #include <linux/etherdevice.h> |
61 | #include <linux/init.h> | 61 | #include <linux/init.h> |
62 | #include <linux/skbuff.h> | 62 | #include <linux/skbuff.h> |
63 | #include <linux/version.h> | ||
64 | #include <linux/spinlock.h> | 63 | #include <linux/spinlock.h> |
65 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
66 | #include <linux/mii.h> | 65 | #include <linux/mii.h> |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index eb169a8e8773..7a6aeae2c9fa 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1478,7 +1478,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1478 | 1478 | ||
1479 | if(pci_dma_mapping_error(rx->dma_addr)) { | 1479 | if(pci_dma_mapping_error(rx->dma_addr)) { |
1480 | dev_kfree_skb_any(rx->skb); | 1480 | dev_kfree_skb_any(rx->skb); |
1481 | rx->skb = 0; | 1481 | rx->skb = NULL; |
1482 | rx->dma_addr = 0; | 1482 | rx->dma_addr = 0; |
1483 | return -ENOMEM; | 1483 | return -ENOMEM; |
1484 | } | 1484 | } |
@@ -1764,7 +1764,7 @@ static int e100_up(struct nic *nic) | |||
1764 | if((err = e100_hw_init(nic))) | 1764 | if((err = e100_hw_init(nic))) |
1765 | goto err_clean_cbs; | 1765 | goto err_clean_cbs; |
1766 | e100_set_multicast_list(nic->netdev); | 1766 | e100_set_multicast_list(nic->netdev); |
1767 | e100_start_receiver(nic, 0); | 1767 | e100_start_receiver(nic, NULL); |
1768 | mod_timer(&nic->watchdog, jiffies); | 1768 | mod_timer(&nic->watchdog, jiffies); |
1769 | if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, | 1769 | if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, |
1770 | nic->netdev->name, nic->netdev))) | 1770 | nic->netdev->name, nic->netdev))) |
@@ -1844,7 +1844,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) | |||
1844 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, | 1844 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, |
1845 | BMCR_LOOPBACK); | 1845 | BMCR_LOOPBACK); |
1846 | 1846 | ||
1847 | e100_start_receiver(nic, 0); | 1847 | e100_start_receiver(nic, NULL); |
1848 | 1848 | ||
1849 | if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { | 1849 | if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { |
1850 | err = -ENOMEM; | 1850 | err = -ENOMEM; |
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index 1105543b9d88..e7ec96c964a9 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <linux/mii.h> | 4 | #include <linux/mii.h> |
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/version.h> | ||
8 | #include <linux/list.h> | 7 | #include <linux/list.h> |
9 | 8 | ||
10 | #include <linux/fs_enet_pd.h> | 9 | #include <linux/fs_enet_pd.h> |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 962580f2c4ab..54d294ad6df5 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -90,7 +90,6 @@ | |||
90 | #include <asm/irq.h> | 90 | #include <asm/irq.h> |
91 | #include <asm/uaccess.h> | 91 | #include <asm/uaccess.h> |
92 | #include <linux/module.h> | 92 | #include <linux/module.h> |
93 | #include <linux/version.h> | ||
94 | #include <linux/dma-mapping.h> | 93 | #include <linux/dma-mapping.h> |
95 | #include <linux/crc32.h> | 94 | #include <linux/crc32.h> |
96 | #include <linux/mii.h> | 95 | #include <linux/mii.h> |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index c77ca6c0d04a..220084e53341 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
44 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/version.h> | ||
47 | #include <linux/crc32.h> | 46 | #include <linux/crc32.h> |
48 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
49 | #include <linux/ethtool.h> | 48 | #include <linux/ethtool.h> |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 68e3578e7613..5a2d810ce575 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/version.h> | ||
38 | #include <linux/crc32.h> | 37 | #include <linux/crc32.h> |
39 | #include <asm/types.h> | 38 | #include <asm/types.h> |
40 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 5a74d3d3dbe1..7263395d78bb 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/version.h> | ||
36 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
37 | #include <asm/ocp.h> | 36 | #include <asm/ocp.h> |
38 | #include <linux/crc32.h> | 37 | #include <linux/crc32.h> |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index b71fab6e34f4..e92c17f6931c 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -96,7 +96,6 @@ | |||
96 | 96 | ||
97 | #undef HP100_MULTICAST_FILTER /* Need to be debugged... */ | 97 | #undef HP100_MULTICAST_FILTER /* Need to be debugged... */ |
98 | 98 | ||
99 | #include <linux/version.h> | ||
100 | #include <linux/module.h> | 99 | #include <linux/module.h> |
101 | #include <linux/kernel.h> | 100 | #include <linux/kernel.h> |
102 | #include <linux/string.h> | 101 | #include <linux/string.h> |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 94239f67f3a3..be191d80ef9c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | #include <linux/config.h> | 36 | #include <linux/config.h> |
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/version.h> | ||
39 | #include <linux/types.h> | 38 | #include <linux/types.h> |
40 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
41 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 49e5467bdd73..6a3129bc15a6 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -46,10 +46,8 @@ | |||
46 | #include <linux/udp.h> | 46 | #include <linux/udp.h> |
47 | 47 | ||
48 | #ifdef CONFIG_SERIAL_8250 | 48 | #ifdef CONFIG_SERIAL_8250 |
49 | #include <linux/serial.h> | 49 | #include <linux/serial_core.h> |
50 | #include <asm/serial.h> | 50 | #include <linux/serial_8250.h> |
51 | #define IOC3_BAUD (22000000 / (3*16)) | ||
52 | #define IOC3_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | ||
53 | #endif | 51 | #endif |
54 | 52 | ||
55 | #include <linux/netdevice.h> | 53 | #include <linux/netdevice.h> |
@@ -1146,12 +1144,11 @@ static inline int ioc3_is_menet(struct pci_dev *pdev) | |||
1146 | * around ioc3 oddities in this respect. | 1144 | * around ioc3 oddities in this respect. |
1147 | * | 1145 | * |
1148 | * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. | 1146 | * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. |
1149 | * (IOC3_BAUD = (22000000 / (3*16))) | ||
1150 | */ | 1147 | */ |
1151 | 1148 | ||
1152 | static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | 1149 | static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) |
1153 | { | 1150 | { |
1154 | struct serial_struct req; | 1151 | struct uart_port port; |
1155 | 1152 | ||
1156 | /* | 1153 | /* |
1157 | * We need to recognice and treat the fourth MENET serial as it | 1154 | * We need to recognice and treat the fourth MENET serial as it |
@@ -1165,20 +1162,25 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | |||
1165 | if (ioc3_is_menet(pdev) && PCI_SLOT(pdev->devfn) == 3) | 1162 | if (ioc3_is_menet(pdev) && PCI_SLOT(pdev->devfn) == 3) |
1166 | return; | 1163 | return; |
1167 | 1164 | ||
1168 | /* Register to interrupt zero because we share the interrupt with | 1165 | /* |
1169 | the serial driver which we don't properly support yet. */ | 1166 | * Register to interrupt zero because we share the interrupt with |
1170 | memset(&req, 0, sizeof(req)); | 1167 | * the serial driver which we don't properly support yet. |
1171 | req.irq = 0; | 1168 | * |
1172 | req.flags = IOC3_COM_FLAGS; | 1169 | * Can't use UPF_IOREMAP as the whole of IOC3 resources have already |
1173 | req.io_type = SERIAL_IO_MEM; | 1170 | * been registered. |
1174 | req.iomem_reg_shift = 0; | 1171 | */ |
1175 | req.baud_base = IOC3_BAUD; | 1172 | memset(&port, 0, sizeof(port)); |
1176 | 1173 | port.irq = 0; | |
1177 | req.iomem_base = (unsigned char *) &ioc3->sregs.uarta; | 1174 | port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; |
1178 | register_serial(&req); | 1175 | port.iotype = UPIO_MEM; |
1179 | 1176 | port.regshift = 0; | |
1180 | req.iomem_base = (unsigned char *) &ioc3->sregs.uartb; | 1177 | port.uartclk = 22000000 / 3; |
1181 | register_serial(&req); | 1178 | |
1179 | port.membase = (unsigned char *) &ioc3->sregs.uarta; | ||
1180 | serial8250_register_port(&port); | ||
1181 | |||
1182 | port.membase = (unsigned char *) &ioc3->sregs.uartb; | ||
1183 | serial8250_register_port(&port); | ||
1182 | } | 1184 | } |
1183 | #endif | 1185 | #endif |
1184 | 1186 | ||
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 0282771b1cbb..3137592d60c0 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1459,8 +1459,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1459 | */ | 1459 | */ |
1460 | IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ | 1460 | IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ |
1461 | ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); | 1461 | ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); |
1462 | if (!in_interrupt () && !capable (CAP_NET_ADMIN)) | 1462 | if (!in_interrupt () && !capable (CAP_NET_ADMIN)) { |
1463 | return -EPERM; | 1463 | ret = -EPERM; |
1464 | goto out; | ||
1465 | } | ||
1464 | 1466 | ||
1465 | /* self->speed=irq->ifr_baudrate; */ | 1467 | /* self->speed=irq->ifr_baudrate; */ |
1466 | /* toshoboe_setbaud(self); */ | 1468 | /* toshoboe_setbaud(self); */ |
@@ -1470,8 +1472,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1470 | case SIOCSMEDIABUSY: /* Set media busy */ | 1472 | case SIOCSMEDIABUSY: /* Set media busy */ |
1471 | IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ | 1473 | IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ |
1472 | ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); | 1474 | ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); |
1473 | if (!capable (CAP_NET_ADMIN)) | 1475 | if (!capable (CAP_NET_ADMIN)) { |
1474 | return -EPERM; | 1476 | ret = -EPERM; |
1477 | goto out; | ||
1478 | } | ||
1475 | irda_device_set_media_busy (self->netdev, TRUE); | 1479 | irda_device_set_media_busy (self->netdev, TRUE); |
1476 | break; | 1480 | break; |
1477 | case SIOCGRECEIVING: /* Check if we are receiving right now */ | 1481 | case SIOCGRECEIVING: /* Check if we are receiving right now */ |
@@ -1483,7 +1487,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1483 | IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); | 1487 | IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); |
1484 | ret = -EOPNOTSUPP; | 1488 | ret = -EOPNOTSUPP; |
1485 | } | 1489 | } |
1486 | 1490 | out: | |
1487 | spin_unlock_irqrestore(&self->spinlock, flags); | 1491 | spin_unlock_irqrestore(&self->spinlock, flags); |
1488 | return ret; | 1492 | return ret; |
1489 | 1493 | ||
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index d86d8f055a6c..77eadf84cb2c 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -58,7 +58,6 @@ | |||
58 | 58 | ||
59 | #include <linux/config.h> | 59 | #include <linux/config.h> |
60 | #include <linux/module.h> | 60 | #include <linux/module.h> |
61 | #include <linux/version.h> | ||
62 | #include <linux/types.h> | 61 | #include <linux/types.h> |
63 | #include <linux/errno.h> | 62 | #include <linux/errno.h> |
64 | #include <linux/ioport.h> | 63 | #include <linux/ioport.h> |
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c index ce5761816a64..d8c99f038fa0 100644 --- a/drivers/net/mac8390.c +++ b/drivers/net/mac8390.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * and fixed access to Sonic Sys card which masquerades as a Farallon | 15 | * and fixed access to Sonic Sys card which masquerades as a Farallon |
16 | * by rayk@knightsmanor.org */ | 16 | * by rayk@knightsmanor.org */ |
17 | 17 | ||
18 | #include <linux/version.h> | ||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/types.h> | 20 | #include <linux/types.h> |
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index bcfda5192da0..f769f9b626ea 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __MV643XX_ETH_H__ | 1 | #ifndef __MV643XX_ETH_H__ |
2 | #define __MV643XX_ETH_H__ | 2 | #define __MV643XX_ETH_H__ |
3 | 3 | ||
4 | #include <linux/version.h> | ||
5 | #include <linux/module.h> | 4 | #include <linux/module.h> |
6 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
7 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index a3c3fc9c0d8a..f857ae94d261 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -110,7 +110,6 @@ | |||
110 | #include <linux/init.h> | 110 | #include <linux/init.h> |
111 | #include <linux/ip.h> /* for iph */ | 111 | #include <linux/ip.h> /* for iph */ |
112 | #include <linux/in.h> /* for IPPROTO_... */ | 112 | #include <linux/in.h> /* for IPPROTO_... */ |
113 | #include <linux/eeprom.h> | ||
114 | #include <linux/compiler.h> | 113 | #include <linux/compiler.h> |
115 | #include <linux/prefetch.h> | 114 | #include <linux/prefetch.h> |
116 | #include <linux/ethtool.h> | 115 | #include <linux/ethtool.h> |
@@ -445,7 +444,6 @@ struct ns83820 { | |||
445 | 444 | ||
446 | u32 MEAR_cache; | 445 | u32 MEAR_cache; |
447 | u32 IMR_cache; | 446 | u32 IMR_cache; |
448 | struct eeprom ee; | ||
449 | 447 | ||
450 | unsigned linkstate; | 448 | unsigned linkstate; |
451 | 449 | ||
@@ -1558,15 +1556,13 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) | |||
1558 | unsigned i; | 1556 | unsigned i; |
1559 | for (i=0; i<3; i++) { | 1557 | for (i=0; i<3; i++) { |
1560 | u32 data; | 1558 | u32 data; |
1561 | #if 0 /* I've left this in as an example of how to use eeprom.h */ | 1559 | |
1562 | data = eeprom_readw(&dev->ee, 0xa + 2 - i); | ||
1563 | #else | ||
1564 | /* Read from the perfect match memory: this is loaded by | 1560 | /* Read from the perfect match memory: this is loaded by |
1565 | * the chip from the EEPROM via the EELOAD self test. | 1561 | * the chip from the EEPROM via the EELOAD self test. |
1566 | */ | 1562 | */ |
1567 | writel(i*2, dev->base + RFCR); | 1563 | writel(i*2, dev->base + RFCR); |
1568 | data = readl(dev->base + RFDR); | 1564 | data = readl(dev->base + RFDR); |
1569 | #endif | 1565 | |
1570 | *mac++ = data; | 1566 | *mac++ = data; |
1571 | *mac++ = data >> 8; | 1567 | *mac++ = data >> 8; |
1572 | } | 1568 | } |
@@ -1851,8 +1847,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1851 | spin_lock_init(&dev->misc_lock); | 1847 | spin_lock_init(&dev->misc_lock); |
1852 | dev->pci_dev = pci_dev; | 1848 | dev->pci_dev = pci_dev; |
1853 | 1849 | ||
1854 | dev->ee.cache = &dev->MEAR_cache; | ||
1855 | dev->ee.lock = &dev->misc_lock; | ||
1856 | SET_MODULE_OWNER(ndev); | 1850 | SET_MODULE_OWNER(ndev); |
1857 | SET_NETDEV_DEV(ndev, &pci_dev->dev); | 1851 | SET_NETDEV_DEV(ndev, &pci_dev->dev); |
1858 | 1852 | ||
@@ -1887,9 +1881,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ | |||
1887 | 1881 | ||
1888 | dev->IMR_cache = 0; | 1882 | dev->IMR_cache = 0; |
1889 | 1883 | ||
1890 | setup_ee_mem_bitbanger(&dev->ee, dev->base + MEAR, 3, 2, 1, 0, | ||
1891 | 0); | ||
1892 | |||
1893 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, | 1884 | err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, |
1894 | DRV_NAME, ndev); | 1885 | DRV_NAME, ndev); |
1895 | if (err) { | 1886 | if (err) { |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 59e8183c639e..400f652282d7 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <asm/string.h> | ||
34 | 35 | ||
35 | #define PPP_VERSION "2.4.2" | 36 | #define PPP_VERSION "2.4.2" |
36 | 37 | ||
@@ -835,8 +836,11 @@ process_input_packet(struct asyncppp *ap) | |||
835 | err: | 836 | err: |
836 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ | 837 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ |
837 | ap->state = SC_PREV_ERROR; | 838 | ap->state = SC_PREV_ERROR; |
838 | if (skb) | 839 | if (skb) { |
840 | /* make skb appear as freshly allocated */ | ||
839 | skb_trim(skb, 0); | 841 | skb_trim(skb, 0); |
842 | skb_reserve(skb, - skb_headroom(skb)); | ||
843 | } | ||
840 | } | 844 | } |
841 | 845 | ||
842 | /* Called when the tty driver has data for us. Runs parallel with the | 846 | /* Called when the tty driver has data for us. Runs parallel with the |
@@ -889,10 +893,17 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
889 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 893 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
890 | if (skb == 0) | 894 | if (skb == 0) |
891 | goto nomem; | 895 | goto nomem; |
892 | /* Try to get the payload 4-byte aligned */ | 896 | ap->rpkt = skb; |
897 | } | ||
898 | if (skb->len == 0) { | ||
899 | /* Try to get the payload 4-byte aligned. | ||
900 | * This should match the | ||
901 | * PPP_ALLSTATIONS/PPP_UI/compressed tests in | ||
902 | * process_input_packet, but we do not have | ||
903 | * enough chars here to test buf[1] and buf[2]. | ||
904 | */ | ||
893 | if (buf[0] != PPP_ALLSTATIONS) | 905 | if (buf[0] != PPP_ALLSTATIONS) |
894 | skb_reserve(skb, 2 + (buf[0] & 1)); | 906 | skb_reserve(skb, 2 + (buf[0] & 1)); |
895 | ap->rpkt = skb; | ||
896 | } | 907 | } |
897 | if (n > skb_tailroom(skb)) { | 908 | if (n > skb_tailroom(skb)) { |
898 | /* packet overflowed MRU */ | 909 | /* packet overflowed MRU */ |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index d3c9958b00d0..50430f79f8cf 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -137,13 +137,14 @@ struct ppp { | |||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * Bits in flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, | 139 | * Bits in flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, |
140 | * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP. | 140 | * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP, |
141 | * SC_MUST_COMP | ||
141 | * Bits in rstate: SC_DECOMP_RUN, SC_DC_ERROR, SC_DC_FERROR. | 142 | * Bits in rstate: SC_DECOMP_RUN, SC_DC_ERROR, SC_DC_FERROR. |
142 | * Bits in xstate: SC_COMP_RUN | 143 | * Bits in xstate: SC_COMP_RUN |
143 | */ | 144 | */ |
144 | #define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ | 145 | #define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ |
145 | |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ | 146 | |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ |
146 | |SC_COMP_TCP|SC_REJ_COMP_TCP) | 147 | |SC_COMP_TCP|SC_REJ_COMP_TCP|SC_MUST_COMP) |
147 | 148 | ||
148 | /* | 149 | /* |
149 | * Private data structure for each channel. | 150 | * Private data structure for each channel. |
@@ -1027,6 +1028,56 @@ ppp_xmit_process(struct ppp *ppp) | |||
1027 | ppp_xmit_unlock(ppp); | 1028 | ppp_xmit_unlock(ppp); |
1028 | } | 1029 | } |
1029 | 1030 | ||
1031 | static inline struct sk_buff * | ||
1032 | pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) | ||
1033 | { | ||
1034 | struct sk_buff *new_skb; | ||
1035 | int len; | ||
1036 | int new_skb_size = ppp->dev->mtu + | ||
1037 | ppp->xcomp->comp_extra + ppp->dev->hard_header_len; | ||
1038 | int compressor_skb_size = ppp->dev->mtu + | ||
1039 | ppp->xcomp->comp_extra + PPP_HDRLEN; | ||
1040 | new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); | ||
1041 | if (!new_skb) { | ||
1042 | if (net_ratelimit()) | ||
1043 | printk(KERN_ERR "PPP: no memory (comp pkt)\n"); | ||
1044 | return NULL; | ||
1045 | } | ||
1046 | if (ppp->dev->hard_header_len > PPP_HDRLEN) | ||
1047 | skb_reserve(new_skb, | ||
1048 | ppp->dev->hard_header_len - PPP_HDRLEN); | ||
1049 | |||
1050 | /* compressor still expects A/C bytes in hdr */ | ||
1051 | len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, | ||
1052 | new_skb->data, skb->len + 2, | ||
1053 | compressor_skb_size); | ||
1054 | if (len > 0 && (ppp->flags & SC_CCP_UP)) { | ||
1055 | kfree_skb(skb); | ||
1056 | skb = new_skb; | ||
1057 | skb_put(skb, len); | ||
1058 | skb_pull(skb, 2); /* pull off A/C bytes */ | ||
1059 | } else if (len == 0) { | ||
1060 | /* didn't compress, or CCP not up yet */ | ||
1061 | kfree_skb(new_skb); | ||
1062 | new_skb = skb; | ||
1063 | } else { | ||
1064 | /* | ||
1065 | * (len < 0) | ||
1066 | * MPPE requires that we do not send unencrypted | ||
1067 | * frames. The compressor will return -1 if we | ||
1068 | * should drop the frame. We cannot simply test | ||
1069 | * the compress_proto because MPPE and MPPC share | ||
1070 | * the same number. | ||
1071 | */ | ||
1072 | if (net_ratelimit()) | ||
1073 | printk(KERN_ERR "ppp: compressor dropped pkt\n"); | ||
1074 | kfree_skb(skb); | ||
1075 | kfree_skb(new_skb); | ||
1076 | new_skb = NULL; | ||
1077 | } | ||
1078 | return new_skb; | ||
1079 | } | ||
1080 | |||
1030 | /* | 1081 | /* |
1031 | * Compress and send a frame. | 1082 | * Compress and send a frame. |
1032 | * The caller should have locked the xmit path, | 1083 | * The caller should have locked the xmit path, |
@@ -1113,29 +1164,14 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1113 | /* try to do packet compression */ | 1164 | /* try to do packet compression */ |
1114 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 | 1165 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 |
1115 | && proto != PPP_LCP && proto != PPP_CCP) { | 1166 | && proto != PPP_LCP && proto != PPP_CCP) { |
1116 | new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len, | 1167 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { |
1117 | GFP_ATOMIC); | 1168 | if (net_ratelimit()) |
1118 | if (new_skb == 0) { | 1169 | printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n"); |
1119 | printk(KERN_ERR "PPP: no memory (comp pkt)\n"); | ||
1120 | goto drop; | 1170 | goto drop; |
1121 | } | 1171 | } |
1122 | if (ppp->dev->hard_header_len > PPP_HDRLEN) | 1172 | skb = pad_compress_skb(ppp, skb); |
1123 | skb_reserve(new_skb, | 1173 | if (!skb) |
1124 | ppp->dev->hard_header_len - PPP_HDRLEN); | 1174 | goto drop; |
1125 | |||
1126 | /* compressor still expects A/C bytes in hdr */ | ||
1127 | len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, | ||
1128 | new_skb->data, skb->len + 2, | ||
1129 | ppp->dev->mtu + PPP_HDRLEN); | ||
1130 | if (len > 0 && (ppp->flags & SC_CCP_UP)) { | ||
1131 | kfree_skb(skb); | ||
1132 | skb = new_skb; | ||
1133 | skb_put(skb, len); | ||
1134 | skb_pull(skb, 2); /* pull off A/C bytes */ | ||
1135 | } else { | ||
1136 | /* didn't compress, or CCP not up yet */ | ||
1137 | kfree_skb(new_skb); | ||
1138 | } | ||
1139 | } | 1175 | } |
1140 | 1176 | ||
1141 | /* | 1177 | /* |
@@ -1155,7 +1191,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1155 | return; | 1191 | return; |
1156 | 1192 | ||
1157 | drop: | 1193 | drop: |
1158 | kfree_skb(skb); | 1194 | if (skb) |
1195 | kfree_skb(skb); | ||
1159 | ++ppp->stats.tx_errors; | 1196 | ++ppp->stats.tx_errors; |
1160 | } | 1197 | } |
1161 | 1198 | ||
@@ -1552,6 +1589,9 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1552 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) | 1589 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) |
1553 | skb = ppp_decompress_frame(ppp, skb); | 1590 | skb = ppp_decompress_frame(ppp, skb); |
1554 | 1591 | ||
1592 | if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR) | ||
1593 | goto err; | ||
1594 | |||
1555 | proto = PPP_PROTO(skb); | 1595 | proto = PPP_PROTO(skb); |
1556 | switch (proto) { | 1596 | switch (proto) { |
1557 | case PPP_VJC_COMP: | 1597 | case PPP_VJC_COMP: |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c new file mode 100644 index 000000000000..1985d1b57c45 --- /dev/null +++ b/drivers/net/ppp_mppe.c | |||
@@ -0,0 +1,724 @@ | |||
1 | /* | ||
2 | * ppp_mppe.c - interface MPPE to the PPP code. | ||
3 | * This version is for use with Linux kernel 2.6.14+ | ||
4 | * | ||
5 | * By Frank Cusack <fcusack@fcusack.com>. | ||
6 | * Copyright (c) 2002,2003,2004 Google, Inc. | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * License: | ||
10 | * Permission to use, copy, modify, and distribute this software and its | ||
11 | * documentation is hereby granted, provided that the above copyright | ||
12 | * notice appears in all copies. This software is provided without any | ||
13 | * warranty, express or implied. | ||
14 | * | ||
15 | * ALTERNATIVELY, provided that this notice is retained in full, this product | ||
16 | * may be distributed under the terms of the GNU General Public License (GPL), | ||
17 | * in which case the provisions of the GPL apply INSTEAD OF those given above. | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License as published by | ||
21 | * the Free Software Foundation; either version 2 of the License, or | ||
22 | * (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
32 | * | ||
33 | * | ||
34 | * Changelog: | ||
35 | * 08/12/05 - Matt Domsch <Matt_Domsch@dell.com> | ||
36 | * Only need extra skb padding on transmit, not receive. | ||
37 | * 06/18/04 - Matt Domsch <Matt_Domsch@dell.com>, Oleg Makarenko <mole@quadra.ru> | ||
38 | * Use Linux kernel 2.6 arc4 and sha1 routines rather than | ||
39 | * providing our own. | ||
40 | * 2/15/04 - TS: added #include <version.h> and testing for Kernel | ||
41 | * version before using | ||
42 | * MOD_DEC_USAGE_COUNT/MOD_INC_USAGE_COUNT which are | ||
43 | * deprecated in 2.6 | ||
44 | */ | ||
45 | |||
46 | #include <linux/config.h> | ||
47 | #include <linux/module.h> | ||
48 | #include <linux/kernel.h> | ||
49 | #include <linux/version.h> | ||
50 | #include <linux/init.h> | ||
51 | #include <linux/types.h> | ||
52 | #include <linux/slab.h> | ||
53 | #include <linux/string.h> | ||
54 | #include <linux/crypto.h> | ||
55 | #include <linux/mm.h> | ||
56 | #include <linux/ppp_defs.h> | ||
57 | #include <linux/ppp-comp.h> | ||
58 | #include <asm/scatterlist.h> | ||
59 | |||
60 | #include "ppp_mppe.h" | ||
61 | |||
62 | MODULE_AUTHOR("Frank Cusack <fcusack@fcusack.com>"); | ||
63 | MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); | ||
64 | MODULE_LICENSE("Dual BSD/GPL"); | ||
65 | MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); | ||
66 | MODULE_VERSION("1.0.2"); | ||
67 | |||
68 | static void | ||
69 | setup_sg(struct scatterlist *sg, const void *address, unsigned int length) | ||
70 | { | ||
71 | sg[0].page = virt_to_page(address); | ||
72 | sg[0].offset = offset_in_page(address); | ||
73 | sg[0].length = length; | ||
74 | } | ||
75 | |||
76 | #define SHA1_PAD_SIZE 40 | ||
77 | |||
78 | /* | ||
79 | * kernel crypto API needs its arguments to be in kmalloc'd memory, not in the module | ||
80 | * static data area. That means sha_pad needs to be kmalloc'd. | ||
81 | */ | ||
82 | |||
83 | struct sha_pad { | ||
84 | unsigned char sha_pad1[SHA1_PAD_SIZE]; | ||
85 | unsigned char sha_pad2[SHA1_PAD_SIZE]; | ||
86 | }; | ||
87 | static struct sha_pad *sha_pad; | ||
88 | |||
89 | static inline void sha_pad_init(struct sha_pad *shapad) | ||
90 | { | ||
91 | memset(shapad->sha_pad1, 0x00, sizeof(shapad->sha_pad1)); | ||
92 | memset(shapad->sha_pad2, 0xF2, sizeof(shapad->sha_pad2)); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * State for an MPPE (de)compressor. | ||
97 | */ | ||
98 | struct ppp_mppe_state { | ||
99 | struct crypto_tfm *arc4; | ||
100 | struct crypto_tfm *sha1; | ||
101 | unsigned char *sha1_digest; | ||
102 | unsigned char master_key[MPPE_MAX_KEY_LEN]; | ||
103 | unsigned char session_key[MPPE_MAX_KEY_LEN]; | ||
104 | unsigned keylen; /* key length in bytes */ | ||
105 | /* NB: 128-bit == 16, 40-bit == 8! */ | ||
106 | /* If we want to support 56-bit, */ | ||
107 | /* the unit has to change to bits */ | ||
108 | unsigned char bits; /* MPPE control bits */ | ||
109 | unsigned ccount; /* 12-bit coherency count (seqno) */ | ||
110 | unsigned stateful; /* stateful mode flag */ | ||
111 | int discard; /* stateful mode packet loss flag */ | ||
112 | int sanity_errors; /* take down LCP if too many */ | ||
113 | int unit; | ||
114 | int debug; | ||
115 | struct compstat stats; | ||
116 | }; | ||
117 | |||
118 | /* struct ppp_mppe_state.bits definitions */ | ||
119 | #define MPPE_BIT_A 0x80 /* Encryption table were (re)inititalized */ | ||
120 | #define MPPE_BIT_B 0x40 /* MPPC only (not implemented) */ | ||
121 | #define MPPE_BIT_C 0x20 /* MPPC only (not implemented) */ | ||
122 | #define MPPE_BIT_D 0x10 /* This is an encrypted frame */ | ||
123 | |||
124 | #define MPPE_BIT_FLUSHED MPPE_BIT_A | ||
125 | #define MPPE_BIT_ENCRYPTED MPPE_BIT_D | ||
126 | |||
127 | #define MPPE_BITS(p) ((p)[4] & 0xf0) | ||
128 | #define MPPE_CCOUNT(p) ((((p)[4] & 0x0f) << 8) + (p)[5]) | ||
129 | #define MPPE_CCOUNT_SPACE 0x1000 /* The size of the ccount space */ | ||
130 | |||
131 | #define MPPE_OVHD 2 /* MPPE overhead/packet */ | ||
132 | #define SANITY_MAX 1600 /* Max bogon factor we will tolerate */ | ||
133 | |||
134 | /* | ||
135 | * Key Derivation, from RFC 3078, RFC 3079. | ||
136 | * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079. | ||
137 | */ | ||
138 | static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *InterimKey) | ||
139 | { | ||
140 | struct scatterlist sg[4]; | ||
141 | |||
142 | setup_sg(&sg[0], state->master_key, state->keylen); | ||
143 | setup_sg(&sg[1], sha_pad->sha_pad1, sizeof(sha_pad->sha_pad1)); | ||
144 | setup_sg(&sg[2], state->session_key, state->keylen); | ||
145 | setup_sg(&sg[3], sha_pad->sha_pad2, sizeof(sha_pad->sha_pad2)); | ||
146 | |||
147 | crypto_digest_digest (state->sha1, sg, 4, state->sha1_digest); | ||
148 | |||
149 | memcpy(InterimKey, state->sha1_digest, state->keylen); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * Perform the MPPE rekey algorithm, from RFC 3078, sec. 7.3. | ||
154 | * Well, not what's written there, but rather what they meant. | ||
155 | */ | ||
156 | static void mppe_rekey(struct ppp_mppe_state * state, int initial_key) | ||
157 | { | ||
158 | unsigned char InterimKey[MPPE_MAX_KEY_LEN]; | ||
159 | struct scatterlist sg_in[1], sg_out[1]; | ||
160 | |||
161 | get_new_key_from_sha(state, InterimKey); | ||
162 | if (!initial_key) { | ||
163 | crypto_cipher_setkey(state->arc4, InterimKey, state->keylen); | ||
164 | setup_sg(sg_in, InterimKey, state->keylen); | ||
165 | setup_sg(sg_out, state->session_key, state->keylen); | ||
166 | if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, | ||
167 | state->keylen) != 0) { | ||
168 | printk(KERN_WARNING "mppe_rekey: cipher_encrypt failed\n"); | ||
169 | } | ||
170 | } else { | ||
171 | memcpy(state->session_key, InterimKey, state->keylen); | ||
172 | } | ||
173 | if (state->keylen == 8) { | ||
174 | /* See RFC 3078 */ | ||
175 | state->session_key[0] = 0xd1; | ||
176 | state->session_key[1] = 0x26; | ||
177 | state->session_key[2] = 0x9e; | ||
178 | } | ||
179 | crypto_cipher_setkey(state->arc4, state->session_key, state->keylen); | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * Allocate space for a (de)compressor. | ||
184 | */ | ||
185 | static void *mppe_alloc(unsigned char *options, int optlen) | ||
186 | { | ||
187 | struct ppp_mppe_state *state; | ||
188 | unsigned int digestsize; | ||
189 | |||
190 | if (optlen != CILEN_MPPE + sizeof(state->master_key) | ||
191 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) | ||
192 | goto out; | ||
193 | |||
194 | state = (struct ppp_mppe_state *) kmalloc(sizeof(*state), GFP_KERNEL); | ||
195 | if (state == NULL) | ||
196 | goto out; | ||
197 | |||
198 | memset(state, 0, sizeof(*state)); | ||
199 | |||
200 | state->arc4 = crypto_alloc_tfm("arc4", 0); | ||
201 | if (!state->arc4) | ||
202 | goto out_free; | ||
203 | |||
204 | state->sha1 = crypto_alloc_tfm("sha1", 0); | ||
205 | if (!state->sha1) | ||
206 | goto out_free; | ||
207 | |||
208 | digestsize = crypto_tfm_alg_digestsize(state->sha1); | ||
209 | if (digestsize < MPPE_MAX_KEY_LEN) | ||
210 | goto out_free; | ||
211 | |||
212 | state->sha1_digest = kmalloc(digestsize, GFP_KERNEL); | ||
213 | if (!state->sha1_digest) | ||
214 | goto out_free; | ||
215 | |||
216 | /* Save keys. */ | ||
217 | memcpy(state->master_key, &options[CILEN_MPPE], | ||
218 | sizeof(state->master_key)); | ||
219 | memcpy(state->session_key, state->master_key, | ||
220 | sizeof(state->master_key)); | ||
221 | |||
222 | /* | ||
223 | * We defer initial key generation until mppe_init(), as mppe_alloc() | ||
224 | * is called frequently during negotiation. | ||
225 | */ | ||
226 | |||
227 | return (void *)state; | ||
228 | |||
229 | out_free: | ||
230 | if (state->sha1_digest) | ||
231 | kfree(state->sha1_digest); | ||
232 | if (state->sha1) | ||
233 | crypto_free_tfm(state->sha1); | ||
234 | if (state->arc4) | ||
235 | crypto_free_tfm(state->arc4); | ||
236 | kfree(state); | ||
237 | out: | ||
238 | return NULL; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Deallocate space for a (de)compressor. | ||
243 | */ | ||
244 | static void mppe_free(void *arg) | ||
245 | { | ||
246 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
247 | if (state) { | ||
248 | if (state->sha1_digest) | ||
249 | kfree(state->sha1_digest); | ||
250 | if (state->sha1) | ||
251 | crypto_free_tfm(state->sha1); | ||
252 | if (state->arc4) | ||
253 | crypto_free_tfm(state->arc4); | ||
254 | kfree(state); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | /* | ||
259 | * Initialize (de)compressor state. | ||
260 | */ | ||
261 | static int | ||
262 | mppe_init(void *arg, unsigned char *options, int optlen, int unit, int debug, | ||
263 | const char *debugstr) | ||
264 | { | ||
265 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
266 | unsigned char mppe_opts; | ||
267 | |||
268 | if (optlen != CILEN_MPPE | ||
269 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) | ||
270 | return 0; | ||
271 | |||
272 | MPPE_CI_TO_OPTS(&options[2], mppe_opts); | ||
273 | if (mppe_opts & MPPE_OPT_128) | ||
274 | state->keylen = 16; | ||
275 | else if (mppe_opts & MPPE_OPT_40) | ||
276 | state->keylen = 8; | ||
277 | else { | ||
278 | printk(KERN_WARNING "%s[%d]: unknown key length\n", debugstr, | ||
279 | unit); | ||
280 | return 0; | ||
281 | } | ||
282 | if (mppe_opts & MPPE_OPT_STATEFUL) | ||
283 | state->stateful = 1; | ||
284 | |||
285 | /* Generate the initial session key. */ | ||
286 | mppe_rekey(state, 1); | ||
287 | |||
288 | if (debug) { | ||
289 | int i; | ||
290 | char mkey[sizeof(state->master_key) * 2 + 1]; | ||
291 | char skey[sizeof(state->session_key) * 2 + 1]; | ||
292 | |||
293 | printk(KERN_DEBUG "%s[%d]: initialized with %d-bit %s mode\n", | ||
294 | debugstr, unit, (state->keylen == 16) ? 128 : 40, | ||
295 | (state->stateful) ? "stateful" : "stateless"); | ||
296 | |||
297 | for (i = 0; i < sizeof(state->master_key); i++) | ||
298 | sprintf(mkey + i * 2, "%02x", state->master_key[i]); | ||
299 | for (i = 0; i < sizeof(state->session_key); i++) | ||
300 | sprintf(skey + i * 2, "%02x", state->session_key[i]); | ||
301 | printk(KERN_DEBUG | ||
302 | "%s[%d]: keys: master: %s initial session: %s\n", | ||
303 | debugstr, unit, mkey, skey); | ||
304 | } | ||
305 | |||
306 | /* | ||
307 | * Initialize the coherency count. The initial value is not specified | ||
308 | * in RFC 3078, but we can make a reasonable assumption that it will | ||
309 | * start at 0. Setting it to the max here makes the comp/decomp code | ||
310 | * do the right thing (determined through experiment). | ||
311 | */ | ||
312 | state->ccount = MPPE_CCOUNT_SPACE - 1; | ||
313 | |||
314 | /* | ||
315 | * Note that even though we have initialized the key table, we don't | ||
316 | * set the FLUSHED bit. This is contrary to RFC 3078, sec. 3.1. | ||
317 | */ | ||
318 | state->bits = MPPE_BIT_ENCRYPTED; | ||
319 | |||
320 | state->unit = unit; | ||
321 | state->debug = debug; | ||
322 | |||
323 | return 1; | ||
324 | } | ||
325 | |||
326 | static int | ||
327 | mppe_comp_init(void *arg, unsigned char *options, int optlen, int unit, | ||
328 | int hdrlen, int debug) | ||
329 | { | ||
330 | /* ARGSUSED */ | ||
331 | return mppe_init(arg, options, optlen, unit, debug, "mppe_comp_init"); | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * We received a CCP Reset-Request (actually, we are sending a Reset-Ack), | ||
336 | * tell the compressor to rekey. Note that we MUST NOT rekey for | ||
337 | * every CCP Reset-Request; we only rekey on the next xmit packet. | ||
338 | * We might get multiple CCP Reset-Requests if our CCP Reset-Ack is lost. | ||
339 | * So, rekeying for every CCP Reset-Request is broken as the peer will not | ||
340 | * know how many times we've rekeyed. (If we rekey and THEN get another | ||
341 | * CCP Reset-Request, we must rekey again.) | ||
342 | */ | ||
343 | static void mppe_comp_reset(void *arg) | ||
344 | { | ||
345 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
346 | |||
347 | state->bits |= MPPE_BIT_FLUSHED; | ||
348 | } | ||
349 | |||
350 | /* | ||
351 | * Compress (encrypt) a packet. | ||
352 | * It's strange to call this a compressor, since the output is always | ||
353 | * MPPE_OVHD + 2 bytes larger than the input. | ||
354 | */ | ||
355 | static int | ||
356 | mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, | ||
357 | int isize, int osize) | ||
358 | { | ||
359 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
360 | int proto; | ||
361 | struct scatterlist sg_in[1], sg_out[1]; | ||
362 | |||
363 | /* | ||
364 | * Check that the protocol is in the range we handle. | ||
365 | */ | ||
366 | proto = PPP_PROTOCOL(ibuf); | ||
367 | if (proto < 0x0021 || proto > 0x00fa) | ||
368 | return 0; | ||
369 | |||
370 | /* Make sure we have enough room to generate an encrypted packet. */ | ||
371 | if (osize < isize + MPPE_OVHD + 2) { | ||
372 | /* Drop the packet if we should encrypt it, but can't. */ | ||
373 | printk(KERN_DEBUG "mppe_compress[%d]: osize too small! " | ||
374 | "(have: %d need: %d)\n", state->unit, | ||
375 | osize, osize + MPPE_OVHD + 2); | ||
376 | return -1; | ||
377 | } | ||
378 | |||
379 | osize = isize + MPPE_OVHD + 2; | ||
380 | |||
381 | /* | ||
382 | * Copy over the PPP header and set control bits. | ||
383 | */ | ||
384 | obuf[0] = PPP_ADDRESS(ibuf); | ||
385 | obuf[1] = PPP_CONTROL(ibuf); | ||
386 | obuf[2] = PPP_COMP >> 8; /* isize + MPPE_OVHD + 1 */ | ||
387 | obuf[3] = PPP_COMP; /* isize + MPPE_OVHD + 2 */ | ||
388 | obuf += PPP_HDRLEN; | ||
389 | |||
390 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
391 | if (state->debug >= 7) | ||
392 | printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit, | ||
393 | state->ccount); | ||
394 | obuf[0] = state->ccount >> 8; | ||
395 | obuf[1] = state->ccount & 0xff; | ||
396 | |||
397 | if (!state->stateful || /* stateless mode */ | ||
398 | ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ | ||
399 | (state->bits & MPPE_BIT_FLUSHED)) { /* CCP Reset-Request */ | ||
400 | /* We must rekey */ | ||
401 | if (state->debug && state->stateful) | ||
402 | printk(KERN_DEBUG "mppe_compress[%d]: rekeying\n", | ||
403 | state->unit); | ||
404 | mppe_rekey(state, 0); | ||
405 | state->bits |= MPPE_BIT_FLUSHED; | ||
406 | } | ||
407 | obuf[0] |= state->bits; | ||
408 | state->bits &= ~MPPE_BIT_FLUSHED; /* reset for next xmit */ | ||
409 | |||
410 | obuf += MPPE_OVHD; | ||
411 | ibuf += 2; /* skip to proto field */ | ||
412 | isize -= 2; | ||
413 | |||
414 | /* Encrypt packet */ | ||
415 | setup_sg(sg_in, ibuf, isize); | ||
416 | setup_sg(sg_out, obuf, osize); | ||
417 | if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, isize) != 0) { | ||
418 | printk(KERN_DEBUG "crypto_cypher_encrypt failed\n"); | ||
419 | return -1; | ||
420 | } | ||
421 | |||
422 | state->stats.unc_bytes += isize; | ||
423 | state->stats.unc_packets++; | ||
424 | state->stats.comp_bytes += osize; | ||
425 | state->stats.comp_packets++; | ||
426 | |||
427 | return osize; | ||
428 | } | ||
429 | |||
430 | /* | ||
431 | * Since every frame grows by MPPE_OVHD + 2 bytes, this is always going | ||
432 | * to look bad ... and the longer the link is up the worse it will get. | ||
433 | */ | ||
434 | static void mppe_comp_stats(void *arg, struct compstat *stats) | ||
435 | { | ||
436 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
437 | |||
438 | *stats = state->stats; | ||
439 | } | ||
440 | |||
441 | static int | ||
442 | mppe_decomp_init(void *arg, unsigned char *options, int optlen, int unit, | ||
443 | int hdrlen, int mru, int debug) | ||
444 | { | ||
445 | /* ARGSUSED */ | ||
446 | return mppe_init(arg, options, optlen, unit, debug, "mppe_decomp_init"); | ||
447 | } | ||
448 | |||
449 | /* | ||
450 | * We received a CCP Reset-Ack. Just ignore it. | ||
451 | */ | ||
452 | static void mppe_decomp_reset(void *arg) | ||
453 | { | ||
454 | /* ARGSUSED */ | ||
455 | return; | ||
456 | } | ||
457 | |||
458 | /* | ||
459 | * Decompress (decrypt) an MPPE packet. | ||
460 | */ | ||
461 | static int | ||
462 | mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf, | ||
463 | int osize) | ||
464 | { | ||
465 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
466 | unsigned ccount; | ||
467 | int flushed = MPPE_BITS(ibuf) & MPPE_BIT_FLUSHED; | ||
468 | int sanity = 0; | ||
469 | struct scatterlist sg_in[1], sg_out[1]; | ||
470 | |||
471 | if (isize <= PPP_HDRLEN + MPPE_OVHD) { | ||
472 | if (state->debug) | ||
473 | printk(KERN_DEBUG | ||
474 | "mppe_decompress[%d]: short pkt (%d)\n", | ||
475 | state->unit, isize); | ||
476 | return DECOMP_ERROR; | ||
477 | } | ||
478 | |||
479 | /* | ||
480 | * Make sure we have enough room to decrypt the packet. | ||
481 | * Note that for our test we only subtract 1 byte whereas in | ||
482 | * mppe_compress() we added 2 bytes (+MPPE_OVHD); | ||
483 | * this is to account for possible PFC. | ||
484 | */ | ||
485 | if (osize < isize - MPPE_OVHD - 1) { | ||
486 | printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! " | ||
487 | "(have: %d need: %d)\n", state->unit, | ||
488 | osize, isize - MPPE_OVHD - 1); | ||
489 | return DECOMP_ERROR; | ||
490 | } | ||
491 | osize = isize - MPPE_OVHD - 2; /* assume no PFC */ | ||
492 | |||
493 | ccount = MPPE_CCOUNT(ibuf); | ||
494 | if (state->debug >= 7) | ||
495 | printk(KERN_DEBUG "mppe_decompress[%d]: ccount %d\n", | ||
496 | state->unit, ccount); | ||
497 | |||
498 | /* sanity checks -- terminate with extreme prejudice */ | ||
499 | if (!(MPPE_BITS(ibuf) & MPPE_BIT_ENCRYPTED)) { | ||
500 | printk(KERN_DEBUG | ||
501 | "mppe_decompress[%d]: ENCRYPTED bit not set!\n", | ||
502 | state->unit); | ||
503 | state->sanity_errors += 100; | ||
504 | sanity = 1; | ||
505 | } | ||
506 | if (!state->stateful && !flushed) { | ||
507 | printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set in " | ||
508 | "stateless mode!\n", state->unit); | ||
509 | state->sanity_errors += 100; | ||
510 | sanity = 1; | ||
511 | } | ||
512 | if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) { | ||
513 | printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set on " | ||
514 | "flag packet!\n", state->unit); | ||
515 | state->sanity_errors += 100; | ||
516 | sanity = 1; | ||
517 | } | ||
518 | |||
519 | if (sanity) { | ||
520 | if (state->sanity_errors < SANITY_MAX) | ||
521 | return DECOMP_ERROR; | ||
522 | else | ||
523 | /* | ||
524 | * Take LCP down if the peer is sending too many bogons. | ||
525 | * We don't want to do this for a single or just a few | ||
526 | * instances since it could just be due to packet corruption. | ||
527 | */ | ||
528 | return DECOMP_FATALERROR; | ||
529 | } | ||
530 | |||
531 | /* | ||
532 | * Check the coherency count. | ||
533 | */ | ||
534 | |||
535 | if (!state->stateful) { | ||
536 | /* RFC 3078, sec 8.1. Rekey for every packet. */ | ||
537 | while (state->ccount != ccount) { | ||
538 | mppe_rekey(state, 0); | ||
539 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
540 | } | ||
541 | } else { | ||
542 | /* RFC 3078, sec 8.2. */ | ||
543 | if (!state->discard) { | ||
544 | /* normal state */ | ||
545 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
546 | if (ccount != state->ccount) { | ||
547 | /* | ||
548 | * (ccount > state->ccount) | ||
549 | * Packet loss detected, enter the discard state. | ||
550 | * Signal the peer to rekey (by sending a CCP Reset-Request). | ||
551 | */ | ||
552 | state->discard = 1; | ||
553 | return DECOMP_ERROR; | ||
554 | } | ||
555 | } else { | ||
556 | /* discard state */ | ||
557 | if (!flushed) { | ||
558 | /* ccp.c will be silent (no additional CCP Reset-Requests). */ | ||
559 | return DECOMP_ERROR; | ||
560 | } else { | ||
561 | /* Rekey for every missed "flag" packet. */ | ||
562 | while ((ccount & ~0xff) != | ||
563 | (state->ccount & ~0xff)) { | ||
564 | mppe_rekey(state, 0); | ||
565 | state->ccount = | ||
566 | (state->ccount + | ||
567 | 256) % MPPE_CCOUNT_SPACE; | ||
568 | } | ||
569 | |||
570 | /* reset */ | ||
571 | state->discard = 0; | ||
572 | state->ccount = ccount; | ||
573 | /* | ||
574 | * Another problem with RFC 3078 here. It implies that the | ||
575 | * peer need not send a Reset-Ack packet. But RFC 1962 | ||
576 | * requires it. Hopefully, M$ does send a Reset-Ack; even | ||
577 | * though it isn't required for MPPE synchronization, it is | ||
578 | * required to reset CCP state. | ||
579 | */ | ||
580 | } | ||
581 | } | ||
582 | if (flushed) | ||
583 | mppe_rekey(state, 0); | ||
584 | } | ||
585 | |||
586 | /* | ||
587 | * Fill in the first part of the PPP header. The protocol field | ||
588 | * comes from the decrypted data. | ||
589 | */ | ||
590 | obuf[0] = PPP_ADDRESS(ibuf); /* +1 */ | ||
591 | obuf[1] = PPP_CONTROL(ibuf); /* +1 */ | ||
592 | obuf += 2; | ||
593 | ibuf += PPP_HDRLEN + MPPE_OVHD; | ||
594 | isize -= PPP_HDRLEN + MPPE_OVHD; /* -6 */ | ||
595 | /* net osize: isize-4 */ | ||
596 | |||
597 | /* | ||
598 | * Decrypt the first byte in order to check if it is | ||
599 | * a compressed or uncompressed protocol field. | ||
600 | */ | ||
601 | setup_sg(sg_in, ibuf, 1); | ||
602 | setup_sg(sg_out, obuf, 1); | ||
603 | if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, 1) != 0) { | ||
604 | printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); | ||
605 | return DECOMP_ERROR; | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | * Do PFC decompression. | ||
610 | * This would be nicer if we were given the actual sk_buff | ||
611 | * instead of a char *. | ||
612 | */ | ||
613 | if ((obuf[0] & 0x01) != 0) { | ||
614 | obuf[1] = obuf[0]; | ||
615 | obuf[0] = 0; | ||
616 | obuf++; | ||
617 | osize++; | ||
618 | } | ||
619 | |||
620 | /* And finally, decrypt the rest of the packet. */ | ||
621 | setup_sg(sg_in, ibuf + 1, isize - 1); | ||
622 | setup_sg(sg_out, obuf + 1, osize - 1); | ||
623 | if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, isize - 1) != 0) { | ||
624 | printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); | ||
625 | return DECOMP_ERROR; | ||
626 | } | ||
627 | |||
628 | state->stats.unc_bytes += osize; | ||
629 | state->stats.unc_packets++; | ||
630 | state->stats.comp_bytes += isize; | ||
631 | state->stats.comp_packets++; | ||
632 | |||
633 | /* good packet credit */ | ||
634 | state->sanity_errors >>= 1; | ||
635 | |||
636 | return osize; | ||
637 | } | ||
638 | |||
639 | /* | ||
640 | * Incompressible data has arrived (this should never happen!). | ||
641 | * We should probably drop the link if the protocol is in the range | ||
642 | * of what should be encrypted. At the least, we should drop this | ||
643 | * packet. (How to do this?) | ||
644 | */ | ||
645 | static void mppe_incomp(void *arg, unsigned char *ibuf, int icnt) | ||
646 | { | ||
647 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
648 | |||
649 | if (state->debug && | ||
650 | (PPP_PROTOCOL(ibuf) >= 0x0021 && PPP_PROTOCOL(ibuf) <= 0x00fa)) | ||
651 | printk(KERN_DEBUG | ||
652 | "mppe_incomp[%d]: incompressible (unencrypted) data! " | ||
653 | "(proto %04x)\n", state->unit, PPP_PROTOCOL(ibuf)); | ||
654 | |||
655 | state->stats.inc_bytes += icnt; | ||
656 | state->stats.inc_packets++; | ||
657 | state->stats.unc_bytes += icnt; | ||
658 | state->stats.unc_packets++; | ||
659 | } | ||
660 | |||
661 | /************************************************************* | ||
662 | * Module interface table | ||
663 | *************************************************************/ | ||
664 | |||
665 | /* | ||
666 | * Procedures exported to if_ppp.c. | ||
667 | */ | ||
668 | static struct compressor ppp_mppe = { | ||
669 | .compress_proto = CI_MPPE, | ||
670 | .comp_alloc = mppe_alloc, | ||
671 | .comp_free = mppe_free, | ||
672 | .comp_init = mppe_comp_init, | ||
673 | .comp_reset = mppe_comp_reset, | ||
674 | .compress = mppe_compress, | ||
675 | .comp_stat = mppe_comp_stats, | ||
676 | .decomp_alloc = mppe_alloc, | ||
677 | .decomp_free = mppe_free, | ||
678 | .decomp_init = mppe_decomp_init, | ||
679 | .decomp_reset = mppe_decomp_reset, | ||
680 | .decompress = mppe_decompress, | ||
681 | .incomp = mppe_incomp, | ||
682 | .decomp_stat = mppe_comp_stats, | ||
683 | .owner = THIS_MODULE, | ||
684 | .comp_extra = MPPE_PAD, | ||
685 | }; | ||
686 | |||
687 | /* | ||
688 | * ppp_mppe_init() | ||
689 | * | ||
690 | * Prior to allowing load, try to load the arc4 and sha1 crypto | ||
691 | * libraries. The actual use will be allocated later, but | ||
692 | * this way the module will fail to insmod if they aren't available. | ||
693 | */ | ||
694 | |||
695 | static int __init ppp_mppe_init(void) | ||
696 | { | ||
697 | int answer; | ||
698 | if (!(crypto_alg_available("arc4", 0) && | ||
699 | crypto_alg_available("sha1", 0))) | ||
700 | return -ENODEV; | ||
701 | |||
702 | sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); | ||
703 | if (!sha_pad) | ||
704 | return -ENOMEM; | ||
705 | sha_pad_init(sha_pad); | ||
706 | |||
707 | answer = ppp_register_compressor(&ppp_mppe); | ||
708 | |||
709 | if (answer == 0) | ||
710 | printk(KERN_INFO "PPP MPPE Compression module registered\n"); | ||
711 | else | ||
712 | kfree(sha_pad); | ||
713 | |||
714 | return answer; | ||
715 | } | ||
716 | |||
717 | static void __exit ppp_mppe_cleanup(void) | ||
718 | { | ||
719 | ppp_unregister_compressor(&ppp_mppe); | ||
720 | kfree(sha_pad); | ||
721 | } | ||
722 | |||
723 | module_init(ppp_mppe_init); | ||
724 | module_exit(ppp_mppe_cleanup); | ||
diff --git a/drivers/net/ppp_mppe.h b/drivers/net/ppp_mppe.h new file mode 100644 index 000000000000..7a14e058c668 --- /dev/null +++ b/drivers/net/ppp_mppe.h | |||
@@ -0,0 +1,86 @@ | |||
1 | #define MPPE_PAD 4 /* MPPE growth per frame */ | ||
2 | #define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */ | ||
3 | |||
4 | /* option bits for ccp_options.mppe */ | ||
5 | #define MPPE_OPT_40 0x01 /* 40 bit */ | ||
6 | #define MPPE_OPT_128 0x02 /* 128 bit */ | ||
7 | #define MPPE_OPT_STATEFUL 0x04 /* stateful mode */ | ||
8 | /* unsupported opts */ | ||
9 | #define MPPE_OPT_56 0x08 /* 56 bit */ | ||
10 | #define MPPE_OPT_MPPC 0x10 /* MPPC compression */ | ||
11 | #define MPPE_OPT_D 0x20 /* Unknown */ | ||
12 | #define MPPE_OPT_UNSUPPORTED (MPPE_OPT_56|MPPE_OPT_MPPC|MPPE_OPT_D) | ||
13 | #define MPPE_OPT_UNKNOWN 0x40 /* Bits !defined in RFC 3078 were set */ | ||
14 | |||
15 | /* | ||
16 | * This is not nice ... the alternative is a bitfield struct though. | ||
17 | * And unfortunately, we cannot share the same bits for the option | ||
18 | * names above since C and H are the same bit. We could do a u_int32 | ||
19 | * but then we have to do a htonl() all the time and/or we still need | ||
20 | * to know which octet is which. | ||
21 | */ | ||
22 | #define MPPE_C_BIT 0x01 /* MPPC */ | ||
23 | #define MPPE_D_BIT 0x10 /* Obsolete, usage unknown */ | ||
24 | #define MPPE_L_BIT 0x20 /* 40-bit */ | ||
25 | #define MPPE_S_BIT 0x40 /* 128-bit */ | ||
26 | #define MPPE_M_BIT 0x80 /* 56-bit, not supported */ | ||
27 | #define MPPE_H_BIT 0x01 /* Stateless (in a different byte) */ | ||
28 | |||
29 | /* Does not include H bit; used for least significant octet only. */ | ||
30 | #define MPPE_ALL_BITS (MPPE_D_BIT|MPPE_L_BIT|MPPE_S_BIT|MPPE_M_BIT|MPPE_H_BIT) | ||
31 | |||
32 | /* Build a CI from mppe opts (see RFC 3078) */ | ||
33 | #define MPPE_OPTS_TO_CI(opts, ci) \ | ||
34 | do { \ | ||
35 | u_char *ptr = ci; /* u_char[4] */ \ | ||
36 | \ | ||
37 | /* H bit */ \ | ||
38 | if (opts & MPPE_OPT_STATEFUL) \ | ||
39 | *ptr++ = 0x0; \ | ||
40 | else \ | ||
41 | *ptr++ = MPPE_H_BIT; \ | ||
42 | *ptr++ = 0; \ | ||
43 | *ptr++ = 0; \ | ||
44 | \ | ||
45 | /* S,L bits */ \ | ||
46 | *ptr = 0; \ | ||
47 | if (opts & MPPE_OPT_128) \ | ||
48 | *ptr |= MPPE_S_BIT; \ | ||
49 | if (opts & MPPE_OPT_40) \ | ||
50 | *ptr |= MPPE_L_BIT; \ | ||
51 | /* M,D,C bits not supported */ \ | ||
52 | } while (/* CONSTCOND */ 0) | ||
53 | |||
54 | /* The reverse of the above */ | ||
55 | #define MPPE_CI_TO_OPTS(ci, opts) \ | ||
56 | do { \ | ||
57 | u_char *ptr = ci; /* u_char[4] */ \ | ||
58 | \ | ||
59 | opts = 0; \ | ||
60 | \ | ||
61 | /* H bit */ \ | ||
62 | if (!(ptr[0] & MPPE_H_BIT)) \ | ||
63 | opts |= MPPE_OPT_STATEFUL; \ | ||
64 | \ | ||
65 | /* S,L bits */ \ | ||
66 | if (ptr[3] & MPPE_S_BIT) \ | ||
67 | opts |= MPPE_OPT_128; \ | ||
68 | if (ptr[3] & MPPE_L_BIT) \ | ||
69 | opts |= MPPE_OPT_40; \ | ||
70 | \ | ||
71 | /* M,D,C bits */ \ | ||
72 | if (ptr[3] & MPPE_M_BIT) \ | ||
73 | opts |= MPPE_OPT_56; \ | ||
74 | if (ptr[3] & MPPE_D_BIT) \ | ||
75 | opts |= MPPE_OPT_D; \ | ||
76 | if (ptr[3] & MPPE_C_BIT) \ | ||
77 | opts |= MPPE_OPT_MPPC; \ | ||
78 | \ | ||
79 | /* Other bits */ \ | ||
80 | if (ptr[0] & ~MPPE_H_BIT) \ | ||
81 | opts |= MPPE_OPT_UNKNOWN; \ | ||
82 | if (ptr[1] || ptr[2]) \ | ||
83 | opts |= MPPE_OPT_UNKNOWN; \ | ||
84 | if (ptr[3] & ~MPPE_ALL_BITS) \ | ||
85 | opts |= MPPE_OPT_UNKNOWN; \ | ||
86 | } while (/* CONSTCOND */ 0) | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 0745dd9d01f3..e57df8dfe6b4 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -55,7 +55,6 @@ | |||
55 | #include <linux/timex.h> | 55 | #include <linux/timex.h> |
56 | #include <linux/sched.h> | 56 | #include <linux/sched.h> |
57 | #include <linux/ethtool.h> | 57 | #include <linux/ethtool.h> |
58 | #include <linux/version.h> | ||
59 | #include <linux/workqueue.h> | 58 | #include <linux/workqueue.h> |
60 | #include <linux/if_vlan.h> | 59 | #include <linux/if_vlan.h> |
61 | 60 | ||
@@ -1532,7 +1531,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1532 | #define LINK_UP_DOWN_INTERRUPT 1 | 1531 | #define LINK_UP_DOWN_INTERRUPT 1 |
1533 | #define MAC_RMAC_ERR_TIMER 2 | 1532 | #define MAC_RMAC_ERR_TIMER 2 |
1534 | 1533 | ||
1535 | int s2io_link_fault_indication(nic_t *nic) | 1534 | static int s2io_link_fault_indication(nic_t *nic) |
1536 | { | 1535 | { |
1537 | if (nic->intr_type != INTA) | 1536 | if (nic->intr_type != INTA) |
1538 | return MAC_RMAC_ERR_TIMER; | 1537 | return MAC_RMAC_ERR_TIMER; |
@@ -1864,7 +1863,7 @@ static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag) | |||
1864 | * | 1863 | * |
1865 | */ | 1864 | */ |
1866 | 1865 | ||
1867 | void fix_mac_address(nic_t * sp) | 1866 | static void fix_mac_address(nic_t * sp) |
1868 | { | 1867 | { |
1869 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 1868 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
1870 | u64 val64; | 1869 | u64 val64; |
@@ -2160,7 +2159,7 @@ int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) | |||
2160 | * SUCCESS on success or an appropriate -ve value on failure. | 2159 | * SUCCESS on success or an appropriate -ve value on failure. |
2161 | */ | 2160 | */ |
2162 | 2161 | ||
2163 | int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | 2162 | static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) |
2164 | { | 2163 | { |
2165 | struct net_device *dev = nic->dev; | 2164 | struct net_device *dev = nic->dev; |
2166 | struct sk_buff *skb; | 2165 | struct sk_buff *skb; |
@@ -2831,7 +2830,7 @@ static void alarm_intr_handler(struct s2io_nic *nic) | |||
2831 | * SUCCESS on success and FAILURE on failure. | 2830 | * SUCCESS on success and FAILURE on failure. |
2832 | */ | 2831 | */ |
2833 | 2832 | ||
2834 | int wait_for_cmd_complete(nic_t * sp) | 2833 | static int wait_for_cmd_complete(nic_t * sp) |
2835 | { | 2834 | { |
2836 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 2835 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
2837 | int ret = FAILURE, cnt = 0; | 2836 | int ret = FAILURE, cnt = 0; |
@@ -3077,7 +3076,7 @@ int s2io_set_swapper(nic_t * sp) | |||
3077 | return SUCCESS; | 3076 | return SUCCESS; |
3078 | } | 3077 | } |
3079 | 3078 | ||
3080 | int wait_for_msix_trans(nic_t *nic, int i) | 3079 | static int wait_for_msix_trans(nic_t *nic, int i) |
3081 | { | 3080 | { |
3082 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | 3081 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3083 | u64 val64; | 3082 | u64 val64; |
@@ -3116,7 +3115,7 @@ void restore_xmsi_data(nic_t *nic) | |||
3116 | } | 3115 | } |
3117 | } | 3116 | } |
3118 | 3117 | ||
3119 | void store_xmsi_data(nic_t *nic) | 3118 | static void store_xmsi_data(nic_t *nic) |
3120 | { | 3119 | { |
3121 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | 3120 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3122 | u64 val64, addr, data; | 3121 | u64 val64, addr, data; |
@@ -3288,7 +3287,7 @@ int s2io_enable_msi_x(nic_t *nic) | |||
3288 | * file on failure. | 3287 | * file on failure. |
3289 | */ | 3288 | */ |
3290 | 3289 | ||
3291 | int s2io_open(struct net_device *dev) | 3290 | static int s2io_open(struct net_device *dev) |
3292 | { | 3291 | { |
3293 | nic_t *sp = dev->priv; | 3292 | nic_t *sp = dev->priv; |
3294 | int err = 0; | 3293 | int err = 0; |
@@ -3418,7 +3417,7 @@ hw_init_failed: | |||
3418 | * file on failure. | 3417 | * file on failure. |
3419 | */ | 3418 | */ |
3420 | 3419 | ||
3421 | int s2io_close(struct net_device *dev) | 3420 | static int s2io_close(struct net_device *dev) |
3422 | { | 3421 | { |
3423 | nic_t *sp = dev->priv; | 3422 | nic_t *sp = dev->priv; |
3424 | int i; | 3423 | int i; |
@@ -3467,7 +3466,7 @@ int s2io_close(struct net_device *dev) | |||
3467 | * 0 on success & 1 on failure. | 3466 | * 0 on success & 1 on failure. |
3468 | */ | 3467 | */ |
3469 | 3468 | ||
3470 | int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | 3469 | static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) |
3471 | { | 3470 | { |
3472 | nic_t *sp = dev->priv; | 3471 | nic_t *sp = dev->priv; |
3473 | u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; | 3472 | u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; |
@@ -3913,7 +3912,7 @@ static void s2io_updt_stats(nic_t *sp) | |||
3913 | * pointer to the updated net_device_stats structure. | 3912 | * pointer to the updated net_device_stats structure. |
3914 | */ | 3913 | */ |
3915 | 3914 | ||
3916 | struct net_device_stats *s2io_get_stats(struct net_device *dev) | 3915 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) |
3917 | { | 3916 | { |
3918 | nic_t *sp = dev->priv; | 3917 | nic_t *sp = dev->priv; |
3919 | mac_info_t *mac_control; | 3918 | mac_info_t *mac_control; |
@@ -5106,19 +5105,20 @@ static void s2io_get_ethtool_stats(struct net_device *dev, | |||
5106 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; | 5105 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; |
5107 | } | 5106 | } |
5108 | 5107 | ||
5109 | int s2io_ethtool_get_regs_len(struct net_device *dev) | 5108 | static int s2io_ethtool_get_regs_len(struct net_device *dev) |
5110 | { | 5109 | { |
5111 | return (XENA_REG_SPACE); | 5110 | return (XENA_REG_SPACE); |
5112 | } | 5111 | } |
5113 | 5112 | ||
5114 | 5113 | ||
5115 | u32 s2io_ethtool_get_rx_csum(struct net_device * dev) | 5114 | static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) |
5116 | { | 5115 | { |
5117 | nic_t *sp = dev->priv; | 5116 | nic_t *sp = dev->priv; |
5118 | 5117 | ||
5119 | return (sp->rx_csum); | 5118 | return (sp->rx_csum); |
5120 | } | 5119 | } |
5121 | int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | 5120 | |
5121 | static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | ||
5122 | { | 5122 | { |
5123 | nic_t *sp = dev->priv; | 5123 | nic_t *sp = dev->priv; |
5124 | 5124 | ||
@@ -5129,17 +5129,19 @@ int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | |||
5129 | 5129 | ||
5130 | return 0; | 5130 | return 0; |
5131 | } | 5131 | } |
5132 | int s2io_get_eeprom_len(struct net_device *dev) | 5132 | |
5133 | static int s2io_get_eeprom_len(struct net_device *dev) | ||
5133 | { | 5134 | { |
5134 | return (XENA_EEPROM_SPACE); | 5135 | return (XENA_EEPROM_SPACE); |
5135 | } | 5136 | } |
5136 | 5137 | ||
5137 | int s2io_ethtool_self_test_count(struct net_device *dev) | 5138 | static int s2io_ethtool_self_test_count(struct net_device *dev) |
5138 | { | 5139 | { |
5139 | return (S2IO_TEST_LEN); | 5140 | return (S2IO_TEST_LEN); |
5140 | } | 5141 | } |
5141 | void s2io_ethtool_get_strings(struct net_device *dev, | 5142 | |
5142 | u32 stringset, u8 * data) | 5143 | static void s2io_ethtool_get_strings(struct net_device *dev, |
5144 | u32 stringset, u8 * data) | ||
5143 | { | 5145 | { |
5144 | switch (stringset) { | 5146 | switch (stringset) { |
5145 | case ETH_SS_TEST: | 5147 | case ETH_SS_TEST: |
@@ -5155,7 +5157,7 @@ static int s2io_ethtool_get_stats_count(struct net_device *dev) | |||
5155 | return (S2IO_STAT_LEN); | 5157 | return (S2IO_STAT_LEN); |
5156 | } | 5158 | } |
5157 | 5159 | ||
5158 | int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | 5160 | static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) |
5159 | { | 5161 | { |
5160 | if (data) | 5162 | if (data) |
5161 | dev->features |= NETIF_F_IP_CSUM; | 5163 | dev->features |= NETIF_F_IP_CSUM; |
@@ -5208,7 +5210,7 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
5208 | * function always return EOPNOTSUPPORTED | 5210 | * function always return EOPNOTSUPPORTED |
5209 | */ | 5211 | */ |
5210 | 5212 | ||
5211 | int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 5213 | static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
5212 | { | 5214 | { |
5213 | return -EOPNOTSUPP; | 5215 | return -EOPNOTSUPP; |
5214 | } | 5216 | } |
@@ -5224,7 +5226,7 @@ int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
5224 | * file on failure. | 5226 | * file on failure. |
5225 | */ | 5227 | */ |
5226 | 5228 | ||
5227 | int s2io_change_mtu(struct net_device *dev, int new_mtu) | 5229 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) |
5228 | { | 5230 | { |
5229 | nic_t *sp = dev->priv; | 5231 | nic_t *sp = dev->priv; |
5230 | 5232 | ||
diff --git a/drivers/net/sk98lin/h/skdrv1st.h b/drivers/net/sk98lin/h/skdrv1st.h index 308440bd0e12..91b8d4f45904 100644 --- a/drivers/net/sk98lin/h/skdrv1st.h +++ b/drivers/net/sk98lin/h/skdrv1st.h | |||
@@ -39,9 +39,6 @@ | |||
39 | #ifndef __INC_SKDRV1ST_H | 39 | #ifndef __INC_SKDRV1ST_H |
40 | #define __INC_SKDRV1ST_H | 40 | #define __INC_SKDRV1ST_H |
41 | 41 | ||
42 | /* Check kernel version */ | ||
43 | #include <linux/version.h> | ||
44 | |||
45 | typedef struct s_AC SK_AC; | 42 | typedef struct s_AC SK_AC; |
46 | 43 | ||
47 | /* Set card versions */ | 44 | /* Set card versions */ |
diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c index 4c56b8d8221b..e5d6d95960c7 100644 --- a/drivers/net/sk_mca.c +++ b/drivers/net/sk_mca.c | |||
@@ -93,7 +93,6 @@ History: | |||
93 | #include <linux/mca-legacy.h> | 93 | #include <linux/mca-legacy.h> |
94 | #include <linux/init.h> | 94 | #include <linux/init.h> |
95 | #include <linux/module.h> | 95 | #include <linux/module.h> |
96 | #include <linux/version.h> | ||
97 | #include <linux/netdevice.h> | 96 | #include <linux/netdevice.h> |
98 | #include <linux/etherdevice.h> | 97 | #include <linux/etherdevice.h> |
99 | #include <linux/skbuff.h> | 98 | #include <linux/skbuff.h> |
diff --git a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h index 7e7c99582746..d6fa1823dfa6 100644 --- a/drivers/net/sk_mca.h +++ b/drivers/net/sk_mca.h | |||
@@ -1,5 +1,3 @@ | |||
1 | #include <linux/version.h> | ||
2 | |||
3 | #ifndef _SK_MCA_INCLUDE_ | 1 | #ifndef _SK_MCA_INCLUDE_ |
4 | #define _SK_MCA_INCLUDE_ | 2 | #define _SK_MCA_INCLUDE_ |
5 | 3 | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 572f121b1f4e..596c93b12daa 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -37,12 +37,13 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/crc32.h> | 38 | #include <linux/crc32.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <linux/mii.h> | ||
40 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
41 | 42 | ||
42 | #include "skge.h" | 43 | #include "skge.h" |
43 | 44 | ||
44 | #define DRV_NAME "skge" | 45 | #define DRV_NAME "skge" |
45 | #define DRV_VERSION "1.1" | 46 | #define DRV_VERSION "1.2" |
46 | #define PFX DRV_NAME " " | 47 | #define PFX DRV_NAME " " |
47 | 48 | ||
48 | #define DEFAULT_TX_RING_SIZE 128 | 49 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -88,8 +89,8 @@ MODULE_DEVICE_TABLE(pci, skge_id_table); | |||
88 | static int skge_up(struct net_device *dev); | 89 | static int skge_up(struct net_device *dev); |
89 | static int skge_down(struct net_device *dev); | 90 | static int skge_down(struct net_device *dev); |
90 | static void skge_tx_clean(struct skge_port *skge); | 91 | static void skge_tx_clean(struct skge_port *skge); |
91 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 92 | static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
92 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 93 | static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
93 | static void genesis_get_stats(struct skge_port *skge, u64 *data); | 94 | static void genesis_get_stats(struct skge_port *skge, u64 *data); |
94 | static void yukon_get_stats(struct skge_port *skge, u64 *data); | 95 | static void yukon_get_stats(struct skge_port *skge, u64 *data); |
95 | static void yukon_init(struct skge_hw *hw, int port); | 96 | static void yukon_init(struct skge_hw *hw, int port); |
@@ -129,7 +130,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
129 | regs->len - B3_RI_WTO_R1); | 130 | regs->len - B3_RI_WTO_R1); |
130 | } | 131 | } |
131 | 132 | ||
132 | /* Wake on Lan only supported on Yukon chps with rev 1 or above */ | 133 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
133 | static int wol_supported(const struct skge_hw *hw) | 134 | static int wol_supported(const struct skge_hw *hw) |
134 | { | 135 | { |
135 | return !((hw->chip_id == CHIP_ID_GENESIS || | 136 | return !((hw->chip_id == CHIP_ID_GENESIS || |
@@ -169,8 +170,8 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
169 | return 0; | 170 | return 0; |
170 | } | 171 | } |
171 | 172 | ||
172 | /* Determine supported/adverised modes based on hardware. | 173 | /* Determine supported/advertised modes based on hardware. |
173 | * Note: ethtoool ADVERTISED_xxx == SUPPORTED_xxx | 174 | * Note: ethtool ADVERTISED_xxx == SUPPORTED_xxx |
174 | */ | 175 | */ |
175 | static u32 skge_supported_modes(const struct skge_hw *hw) | 176 | static u32 skge_supported_modes(const struct skge_hw *hw) |
176 | { | 177 | { |
@@ -531,13 +532,13 @@ static inline u32 hwkhz(const struct skge_hw *hw) | |||
531 | return 78215; /* or: 78.125 MHz */ | 532 | return 78215; /* or: 78.125 MHz */ |
532 | } | 533 | } |
533 | 534 | ||
534 | /* Chip hz to microseconds */ | 535 | /* Chip HZ to microseconds */ |
535 | static inline u32 skge_clk2usec(const struct skge_hw *hw, u32 ticks) | 536 | static inline u32 skge_clk2usec(const struct skge_hw *hw, u32 ticks) |
536 | { | 537 | { |
537 | return (ticks * 1000) / hwkhz(hw); | 538 | return (ticks * 1000) / hwkhz(hw); |
538 | } | 539 | } |
539 | 540 | ||
540 | /* Microseconds to chip hz */ | 541 | /* Microseconds to chip HZ */ |
541 | static inline u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec) | 542 | static inline u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec) |
542 | { | 543 | { |
543 | return hwkhz(hw) * usec / 1000; | 544 | return hwkhz(hw) * usec / 1000; |
@@ -883,32 +884,37 @@ static void skge_link_down(struct skge_port *skge) | |||
883 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); | 884 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); |
884 | } | 885 | } |
885 | 886 | ||
886 | static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) | 887 | static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) |
887 | { | 888 | { |
888 | int i; | 889 | int i; |
889 | u16 v; | ||
890 | 890 | ||
891 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); | 891 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); |
892 | v = xm_read16(hw, port, XM_PHY_DATA); | 892 | xm_read16(hw, port, XM_PHY_DATA); |
893 | 893 | ||
894 | /* Need to wait for external PHY */ | 894 | /* Need to wait for external PHY */ |
895 | for (i = 0; i < PHY_RETRIES; i++) { | 895 | for (i = 0; i < PHY_RETRIES; i++) { |
896 | udelay(1); | 896 | udelay(1); |
897 | if (xm_read16(hw, port, XM_MMU_CMD) | 897 | if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) |
898 | & XM_MMU_PHY_RDY) | ||
899 | goto ready; | 898 | goto ready; |
900 | } | 899 | } |
901 | 900 | ||
902 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | 901 | return -ETIMEDOUT; |
903 | hw->dev[port]->name); | ||
904 | return 0; | ||
905 | ready: | 902 | ready: |
906 | v = xm_read16(hw, port, XM_PHY_DATA); | 903 | *val = xm_read16(hw, port, XM_PHY_DATA); |
907 | 904 | ||
905 | return 0; | ||
906 | } | ||
907 | |||
908 | static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
909 | { | ||
910 | u16 v = 0; | ||
911 | if (__xm_phy_read(hw, port, reg, &v)) | ||
912 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | ||
913 | hw->dev[port]->name); | ||
908 | return v; | 914 | return v; |
909 | } | 915 | } |
910 | 916 | ||
911 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | 917 | static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
912 | { | 918 | { |
913 | int i; | 919 | int i; |
914 | 920 | ||
@@ -918,19 +924,11 @@ static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | |||
918 | goto ready; | 924 | goto ready; |
919 | udelay(1); | 925 | udelay(1); |
920 | } | 926 | } |
921 | printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", | 927 | return -EIO; |
922 | hw->dev[port]->name); | ||
923 | |||
924 | 928 | ||
925 | ready: | 929 | ready: |
926 | xm_write16(hw, port, XM_PHY_DATA, val); | 930 | xm_write16(hw, port, XM_PHY_DATA, val); |
927 | for (i = 0; i < PHY_RETRIES; i++) { | 931 | return 0; |
928 | udelay(1); | ||
929 | if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) | ||
930 | return; | ||
931 | } | ||
932 | printk(KERN_WARNING PFX "%s: phy write timed out\n", | ||
933 | hw->dev[port]->name); | ||
934 | } | 932 | } |
935 | 933 | ||
936 | static void genesis_init(struct skge_hw *hw) | 934 | static void genesis_init(struct skge_hw *hw) |
@@ -1165,7 +1163,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo) | |||
1165 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); | 1163 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); |
1166 | xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); | 1164 | xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); |
1167 | 1165 | ||
1168 | /* Use link status change interrrupt */ | 1166 | /* Use link status change interrupt */ |
1169 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); | 1167 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); |
1170 | 1168 | ||
1171 | bcom_check_link(hw, port); | 1169 | bcom_check_link(hw, port); |
@@ -1205,7 +1203,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1205 | skge_write32(hw, B2_GP_IO, r); | 1203 | skge_write32(hw, B2_GP_IO, r); |
1206 | skge_read32(hw, B2_GP_IO); | 1204 | skge_read32(hw, B2_GP_IO); |
1207 | 1205 | ||
1208 | /* Enable GMII interfac */ | 1206 | /* Enable GMII interface */ |
1209 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); | 1207 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); |
1210 | 1208 | ||
1211 | bcom_phy_init(skge, jumbo); | 1209 | bcom_phy_init(skge, jumbo); |
@@ -1256,7 +1254,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1256 | * that jumbo frames larger than 8192 bytes will be | 1254 | * that jumbo frames larger than 8192 bytes will be |
1257 | * truncated. Disabling all bad frame filtering causes | 1255 | * truncated. Disabling all bad frame filtering causes |
1258 | * the RX FIFO to operate in streaming mode, in which | 1256 | * the RX FIFO to operate in streaming mode, in which |
1259 | * case the XMAC will start transfering frames out of the | 1257 | * case the XMAC will start transferring frames out of the |
1260 | * RX FIFO as soon as the FIFO threshold is reached. | 1258 | * RX FIFO as soon as the FIFO threshold is reached. |
1261 | */ | 1259 | */ |
1262 | xm_write32(hw, port, XM_MODE, XM_DEF_MODE); | 1260 | xm_write32(hw, port, XM_MODE, XM_DEF_MODE); |
@@ -1323,7 +1321,7 @@ static void genesis_stop(struct skge_port *skge) | |||
1323 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); | 1321 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); |
1324 | 1322 | ||
1325 | /* | 1323 | /* |
1326 | * If the transfer stucks at the MAC the STOP command will not | 1324 | * If the transfer sticks at the MAC the STOP command will not |
1327 | * terminate if we don't flush the XMAC's transmit FIFO ! | 1325 | * terminate if we don't flush the XMAC's transmit FIFO ! |
1328 | */ | 1326 | */ |
1329 | xm_write32(hw, port, XM_MODE, | 1327 | xm_write32(hw, port, XM_MODE, |
@@ -1400,42 +1398,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) | |||
1400 | } | 1398 | } |
1401 | } | 1399 | } |
1402 | 1400 | ||
1403 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | ||
1404 | { | ||
1405 | int i; | ||
1406 | |||
1407 | gma_write16(hw, port, GM_SMI_DATA, val); | ||
1408 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1409 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); | ||
1410 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1411 | udelay(1); | ||
1412 | |||
1413 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | ||
1414 | break; | ||
1415 | } | ||
1416 | } | ||
1417 | |||
1418 | static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
1419 | { | ||
1420 | int i; | ||
1421 | |||
1422 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1423 | GM_SMI_CT_PHY_AD(hw->phy_addr) | ||
1424 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | ||
1425 | |||
1426 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1427 | udelay(1); | ||
1428 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) | ||
1429 | goto ready; | ||
1430 | } | ||
1431 | |||
1432 | printk(KERN_WARNING PFX "%s: phy read timeout\n", | ||
1433 | hw->dev[port]->name); | ||
1434 | return 0; | ||
1435 | ready: | ||
1436 | return gma_read16(hw, port, GM_SMI_DATA); | ||
1437 | } | ||
1438 | |||
1439 | static void genesis_link_up(struct skge_port *skge) | 1401 | static void genesis_link_up(struct skge_port *skge) |
1440 | { | 1402 | { |
1441 | struct skge_hw *hw = skge->hw; | 1403 | struct skge_hw *hw = skge->hw; |
@@ -1549,7 +1511,55 @@ static inline void bcom_phy_intr(struct skge_port *skge) | |||
1549 | 1511 | ||
1550 | } | 1512 | } |
1551 | 1513 | ||
1552 | /* Marvell Phy Initailization */ | 1514 | static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
1515 | { | ||
1516 | int i; | ||
1517 | |||
1518 | gma_write16(hw, port, GM_SMI_DATA, val); | ||
1519 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1520 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); | ||
1521 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1522 | udelay(1); | ||
1523 | |||
1524 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | ||
1525 | return 0; | ||
1526 | } | ||
1527 | |||
1528 | printk(KERN_WARNING PFX "%s: phy write timeout\n", | ||
1529 | hw->dev[port]->name); | ||
1530 | return -EIO; | ||
1531 | } | ||
1532 | |||
1533 | static int __gm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) | ||
1534 | { | ||
1535 | int i; | ||
1536 | |||
1537 | gma_write16(hw, port, GM_SMI_CTRL, | ||
1538 | GM_SMI_CT_PHY_AD(hw->phy_addr) | ||
1539 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | ||
1540 | |||
1541 | for (i = 0; i < PHY_RETRIES; i++) { | ||
1542 | udelay(1); | ||
1543 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) | ||
1544 | goto ready; | ||
1545 | } | ||
1546 | |||
1547 | return -ETIMEDOUT; | ||
1548 | ready: | ||
1549 | *val = gma_read16(hw, port, GM_SMI_DATA); | ||
1550 | return 0; | ||
1551 | } | ||
1552 | |||
1553 | static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) | ||
1554 | { | ||
1555 | u16 v = 0; | ||
1556 | if (__gm_phy_read(hw, port, reg, &v)) | ||
1557 | printk(KERN_WARNING PFX "%s: phy read timeout\n", | ||
1558 | hw->dev[port]->name); | ||
1559 | return v; | ||
1560 | } | ||
1561 | |||
1562 | /* Marvell Phy Initialization */ | ||
1553 | static void yukon_init(struct skge_hw *hw, int port) | 1563 | static void yukon_init(struct skge_hw *hw, int port) |
1554 | { | 1564 | { |
1555 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1565 | struct skge_port *skge = netdev_priv(hw->dev[port]); |
@@ -1794,6 +1804,25 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1794 | skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); | 1804 | skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); |
1795 | } | 1805 | } |
1796 | 1806 | ||
1807 | /* Go into power down mode */ | ||
1808 | static void yukon_suspend(struct skge_hw *hw, int port) | ||
1809 | { | ||
1810 | u16 ctrl; | ||
1811 | |||
1812 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); | ||
1813 | ctrl |= PHY_M_PC_POL_R_DIS; | ||
1814 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); | ||
1815 | |||
1816 | ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); | ||
1817 | ctrl |= PHY_CT_RESET; | ||
1818 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | ||
1819 | |||
1820 | /* switch IEEE compatible power down mode on */ | ||
1821 | ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); | ||
1822 | ctrl |= PHY_CT_PDOWN; | ||
1823 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | ||
1824 | } | ||
1825 | |||
1797 | static void yukon_stop(struct skge_port *skge) | 1826 | static void yukon_stop(struct skge_port *skge) |
1798 | { | 1827 | { |
1799 | struct skge_hw *hw = skge->hw; | 1828 | struct skge_hw *hw = skge->hw; |
@@ -1807,14 +1836,7 @@ static void yukon_stop(struct skge_port *skge) | |||
1807 | & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); | 1836 | & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); |
1808 | gma_read16(hw, port, GM_GP_CTRL); | 1837 | gma_read16(hw, port, GM_GP_CTRL); |
1809 | 1838 | ||
1810 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1839 | yukon_suspend(hw, port); |
1811 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) { | ||
1812 | u32 io = skge_read32(hw, B2_GP_IO); | ||
1813 | |||
1814 | io |= GP_DIR_9 | GP_IO_9; | ||
1815 | skge_write32(hw, B2_GP_IO, io); | ||
1816 | skge_read32(hw, B2_GP_IO); | ||
1817 | } | ||
1818 | 1840 | ||
1819 | /* set GPHY Control reset */ | 1841 | /* set GPHY Control reset */ |
1820 | skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); | 1842 | skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
@@ -1997,6 +2019,51 @@ static void yukon_phy_intr(struct skge_port *skge) | |||
1997 | /* XXX restart autonegotiation? */ | 2019 | /* XXX restart autonegotiation? */ |
1998 | } | 2020 | } |
1999 | 2021 | ||
2022 | /* Basic MII support */ | ||
2023 | static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | ||
2024 | { | ||
2025 | struct mii_ioctl_data *data = if_mii(ifr); | ||
2026 | struct skge_port *skge = netdev_priv(dev); | ||
2027 | struct skge_hw *hw = skge->hw; | ||
2028 | int err = -EOPNOTSUPP; | ||
2029 | |||
2030 | if (!netif_running(dev)) | ||
2031 | return -ENODEV; /* Phy still in reset */ | ||
2032 | |||
2033 | switch(cmd) { | ||
2034 | case SIOCGMIIPHY: | ||
2035 | data->phy_id = hw->phy_addr; | ||
2036 | |||
2037 | /* fallthru */ | ||
2038 | case SIOCGMIIREG: { | ||
2039 | u16 val = 0; | ||
2040 | spin_lock_bh(&hw->phy_lock); | ||
2041 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
2042 | err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | ||
2043 | else | ||
2044 | err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | ||
2045 | spin_unlock_bh(&hw->phy_lock); | ||
2046 | data->val_out = val; | ||
2047 | break; | ||
2048 | } | ||
2049 | |||
2050 | case SIOCSMIIREG: | ||
2051 | if (!capable(CAP_NET_ADMIN)) | ||
2052 | return -EPERM; | ||
2053 | |||
2054 | spin_lock_bh(&hw->phy_lock); | ||
2055 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
2056 | err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, | ||
2057 | data->val_in); | ||
2058 | else | ||
2059 | err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, | ||
2060 | data->val_in); | ||
2061 | spin_unlock_bh(&hw->phy_lock); | ||
2062 | break; | ||
2063 | } | ||
2064 | return err; | ||
2065 | } | ||
2066 | |||
2000 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) | 2067 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) |
2001 | { | 2068 | { |
2002 | u32 end; | 2069 | u32 end; |
@@ -2089,7 +2156,7 @@ static int skge_up(struct net_device *dev) | |||
2089 | hw->intr_mask |= portirqmask[port]; | 2156 | hw->intr_mask |= portirqmask[port]; |
2090 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2157 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2091 | 2158 | ||
2092 | /* Initialze MAC */ | 2159 | /* Initialize MAC */ |
2093 | spin_lock_bh(&hw->phy_lock); | 2160 | spin_lock_bh(&hw->phy_lock); |
2094 | if (hw->chip_id == CHIP_ID_GENESIS) | 2161 | if (hw->chip_id == CHIP_ID_GENESIS) |
2095 | genesis_mac_init(hw, port); | 2162 | genesis_mac_init(hw, port); |
@@ -2409,7 +2476,7 @@ static void yukon_set_multicast(struct net_device *dev) | |||
2409 | reg = gma_read16(hw, port, GM_RX_CTRL); | 2476 | reg = gma_read16(hw, port, GM_RX_CTRL); |
2410 | reg |= GM_RXCR_UCF_ENA; | 2477 | reg |= GM_RXCR_UCF_ENA; |
2411 | 2478 | ||
2412 | if (dev->flags & IFF_PROMISC) /* promiscious */ | 2479 | if (dev->flags & IFF_PROMISC) /* promiscuous */ |
2413 | reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); | 2480 | reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); |
2414 | else if (dev->flags & IFF_ALLMULTI) /* all multicast */ | 2481 | else if (dev->flags & IFF_ALLMULTI) /* all multicast */ |
2415 | memset(filter, 0xff, sizeof(filter)); | 2482 | memset(filter, 0xff, sizeof(filter)); |
@@ -2560,7 +2627,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2560 | unsigned int to_do = min(dev->quota, *budget); | 2627 | unsigned int to_do = min(dev->quota, *budget); |
2561 | unsigned int work_done = 0; | 2628 | unsigned int work_done = 0; |
2562 | 2629 | ||
2563 | for (e = ring->to_clean; work_done < to_do; e = e->next) { | 2630 | for (e = ring->to_clean; prefetch(e->next), work_done < to_do; e = e->next) { |
2564 | struct skge_rx_desc *rd = e->desc; | 2631 | struct skge_rx_desc *rd = e->desc; |
2565 | struct sk_buff *skb; | 2632 | struct sk_buff *skb; |
2566 | u32 control; | 2633 | u32 control; |
@@ -2593,11 +2660,11 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2593 | if (work_done >= to_do) | 2660 | if (work_done >= to_do) |
2594 | return 1; /* not done */ | 2661 | return 1; /* not done */ |
2595 | 2662 | ||
2596 | local_irq_disable(); | 2663 | netif_rx_complete(dev); |
2597 | __netif_rx_complete(dev); | ||
2598 | hw->intr_mask |= portirqmask[skge->port]; | 2664 | hw->intr_mask |= portirqmask[skge->port]; |
2599 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2665 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2600 | local_irq_enable(); | 2666 | skge_read32(hw, B0_IMSK); |
2667 | |||
2601 | return 0; | 2668 | return 0; |
2602 | } | 2669 | } |
2603 | 2670 | ||
@@ -2609,7 +2676,7 @@ static inline void skge_tx_intr(struct net_device *dev) | |||
2609 | struct skge_element *e; | 2676 | struct skge_element *e; |
2610 | 2677 | ||
2611 | spin_lock(&skge->tx_lock); | 2678 | spin_lock(&skge->tx_lock); |
2612 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { | 2679 | for (e = ring->to_clean; prefetch(e->next), e != ring->to_use; e = e->next) { |
2613 | struct skge_tx_desc *td = e->desc; | 2680 | struct skge_tx_desc *td = e->desc; |
2614 | u32 control; | 2681 | u32 control; |
2615 | 2682 | ||
@@ -2732,7 +2799,7 @@ static void skge_error_irq(struct skge_hw *hw) | |||
2732 | } | 2799 | } |
2733 | 2800 | ||
2734 | /* | 2801 | /* |
2735 | * Interrrupt from PHY are handled in tasklet (soft irq) | 2802 | * Interrupt from PHY are handled in tasklet (soft irq) |
2736 | * because accessing phy registers requires spin wait which might | 2803 | * because accessing phy registers requires spin wait which might |
2737 | * cause excess interrupt latency. | 2804 | * cause excess interrupt latency. |
2738 | */ | 2805 | */ |
@@ -2762,6 +2829,14 @@ static void skge_extirq(unsigned long data) | |||
2762 | local_irq_enable(); | 2829 | local_irq_enable(); |
2763 | } | 2830 | } |
2764 | 2831 | ||
2832 | static inline void skge_wakeup(struct net_device *dev) | ||
2833 | { | ||
2834 | struct skge_port *skge = netdev_priv(dev); | ||
2835 | |||
2836 | prefetch(skge->rx_ring.to_clean); | ||
2837 | netif_rx_schedule(dev); | ||
2838 | } | ||
2839 | |||
2765 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | 2840 | static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) |
2766 | { | 2841 | { |
2767 | struct skge_hw *hw = dev_id; | 2842 | struct skge_hw *hw = dev_id; |
@@ -2773,12 +2848,12 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2773 | status &= hw->intr_mask; | 2848 | status &= hw->intr_mask; |
2774 | if (status & IS_R1_F) { | 2849 | if (status & IS_R1_F) { |
2775 | hw->intr_mask &= ~IS_R1_F; | 2850 | hw->intr_mask &= ~IS_R1_F; |
2776 | netif_rx_schedule(hw->dev[0]); | 2851 | skge_wakeup(hw->dev[0]); |
2777 | } | 2852 | } |
2778 | 2853 | ||
2779 | if (status & IS_R2_F) { | 2854 | if (status & IS_R2_F) { |
2780 | hw->intr_mask &= ~IS_R2_F; | 2855 | hw->intr_mask &= ~IS_R2_F; |
2781 | netif_rx_schedule(hw->dev[1]); | 2856 | skge_wakeup(hw->dev[1]); |
2782 | } | 2857 | } |
2783 | 2858 | ||
2784 | if (status & IS_XA1_F) | 2859 | if (status & IS_XA1_F) |
@@ -2893,6 +2968,7 @@ static const char *skge_board_name(const struct skge_hw *hw) | |||
2893 | */ | 2968 | */ |
2894 | static int skge_reset(struct skge_hw *hw) | 2969 | static int skge_reset(struct skge_hw *hw) |
2895 | { | 2970 | { |
2971 | u32 reg; | ||
2896 | u16 ctst; | 2972 | u16 ctst; |
2897 | u8 t8, mac_cfg, pmd_type, phy_type; | 2973 | u8 t8, mac_cfg, pmd_type, phy_type; |
2898 | int i; | 2974 | int i; |
@@ -2971,6 +3047,7 @@ static int skge_reset(struct skge_hw *hw) | |||
2971 | /* switch power to VCC (WA for VAUX problem) */ | 3047 | /* switch power to VCC (WA for VAUX problem) */ |
2972 | skge_write8(hw, B0_POWER_CTRL, | 3048 | skge_write8(hw, B0_POWER_CTRL, |
2973 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); | 3049 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); |
3050 | |||
2974 | /* avoid boards with stuck Hardware error bits */ | 3051 | /* avoid boards with stuck Hardware error bits */ |
2975 | if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && | 3052 | if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && |
2976 | (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { | 3053 | (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { |
@@ -2978,6 +3055,14 @@ static int skge_reset(struct skge_hw *hw) | |||
2978 | hw->intr_mask &= ~IS_HW_ERR; | 3055 | hw->intr_mask &= ~IS_HW_ERR; |
2979 | } | 3056 | } |
2980 | 3057 | ||
3058 | /* Clear PHY COMA */ | ||
3059 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
3060 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®); | ||
3061 | reg &= ~PCI_PHY_COMA; | ||
3062 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg); | ||
3063 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3064 | |||
3065 | |||
2981 | for (i = 0; i < hw->ports; i++) { | 3066 | for (i = 0; i < hw->ports; i++) { |
2982 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 3067 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
2983 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); | 3068 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); |
@@ -3048,6 +3133,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3048 | SET_NETDEV_DEV(dev, &hw->pdev->dev); | 3133 | SET_NETDEV_DEV(dev, &hw->pdev->dev); |
3049 | dev->open = skge_up; | 3134 | dev->open = skge_up; |
3050 | dev->stop = skge_down; | 3135 | dev->stop = skge_down; |
3136 | dev->do_ioctl = skge_ioctl; | ||
3051 | dev->hard_start_xmit = skge_xmit_frame; | 3137 | dev->hard_start_xmit = skge_xmit_frame; |
3052 | dev->get_stats = skge_get_stats; | 3138 | dev->get_stats = skge_get_stats; |
3053 | if (hw->chip_id == CHIP_ID_GENESIS) | 3139 | if (hw->chip_id == CHIP_ID_GENESIS) |
@@ -3147,7 +3233,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3147 | } | 3233 | } |
3148 | 3234 | ||
3149 | #ifdef __BIG_ENDIAN | 3235 | #ifdef __BIG_ENDIAN |
3150 | /* byte swap decriptors in hardware */ | 3236 | /* byte swap descriptors in hardware */ |
3151 | { | 3237 | { |
3152 | u32 reg; | 3238 | u32 reg; |
3153 | 3239 | ||
@@ -3158,14 +3244,13 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3158 | #endif | 3244 | #endif |
3159 | 3245 | ||
3160 | err = -ENOMEM; | 3246 | err = -ENOMEM; |
3161 | hw = kmalloc(sizeof(*hw), GFP_KERNEL); | 3247 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |
3162 | if (!hw) { | 3248 | if (!hw) { |
3163 | printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", | 3249 | printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", |
3164 | pci_name(pdev)); | 3250 | pci_name(pdev)); |
3165 | goto err_out_free_regions; | 3251 | goto err_out_free_regions; |
3166 | } | 3252 | } |
3167 | 3253 | ||
3168 | memset(hw, 0, sizeof(*hw)); | ||
3169 | hw->pdev = pdev; | 3254 | hw->pdev = pdev; |
3170 | spin_lock_init(&hw->phy_lock); | 3255 | spin_lock_init(&hw->phy_lock); |
3171 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); | 3256 | tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); |
@@ -3188,7 +3273,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3188 | if (err) | 3273 | if (err) |
3189 | goto err_out_free_irq; | 3274 | goto err_out_free_irq; |
3190 | 3275 | ||
3191 | printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", | 3276 | printk(KERN_INFO PFX DRV_VERSION " addr 0x%lx irq %d chip %s rev %d\n", |
3192 | pci_resource_start(pdev, 0), pdev->irq, | 3277 | pci_resource_start(pdev, 0), pdev->irq, |
3193 | skge_board_name(hw), hw->chip_rev); | 3278 | skge_board_name(hw), hw->chip_rev); |
3194 | 3279 | ||
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 72c175b87a5a..ee123c15f545 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | /* PCI config registers */ | 7 | /* PCI config registers */ |
8 | #define PCI_DEV_REG1 0x40 | 8 | #define PCI_DEV_REG1 0x40 |
9 | #define PCI_PHY_COMA 0x8000000 | ||
10 | #define PCI_VIO 0x2000000 | ||
9 | #define PCI_DEV_REG2 0x44 | 11 | #define PCI_DEV_REG2 0x44 |
10 | #define PCI_REV_DESC 0x4 | 12 | #define PCI_REV_DESC 0x4 |
11 | 13 | ||
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 38b2b0a3ce96..d167deda9a53 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -147,7 +147,6 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when | |||
147 | #define DRV_RELDATE "October 3, 2005" | 147 | #define DRV_RELDATE "October 3, 2005" |
148 | 148 | ||
149 | #include <linux/config.h> | 149 | #include <linux/config.h> |
150 | #include <linux/version.h> | ||
151 | #include <linux/module.h> | 150 | #include <linux/module.h> |
152 | #include <linux/kernel.h> | 151 | #include <linux/kernel.h> |
153 | #include <linux/pci.h> | 152 | #include <linux/pci.h> |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index a368d08e7d19..82c6b757d306 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -61,7 +61,6 @@ | |||
61 | #include <linux/timer.h> | 61 | #include <linux/timer.h> |
62 | #include <linux/slab.h> | 62 | #include <linux/slab.h> |
63 | #include <linux/interrupt.h> | 63 | #include <linux/interrupt.h> |
64 | #include <linux/version.h> | ||
65 | #include <linux/string.h> | 64 | #include <linux/string.h> |
66 | #include <linux/wait.h> | 65 | #include <linux/wait.h> |
67 | #include <asm/io.h> | 66 | #include <asm/io.h> |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 6afc6e5dee9b..340ab4ee4b67 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4535,9 +4535,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) { | |||
4535 | StatusRid status_rid; | 4535 | StatusRid status_rid; |
4536 | int i; | 4536 | int i; |
4537 | 4537 | ||
4538 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4538 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4539 | return -ENOMEM; | 4539 | return -ENOMEM; |
4540 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4541 | data = (struct proc_data *)file->private_data; | 4540 | data = (struct proc_data *)file->private_data; |
4542 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4541 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4543 | kfree (file->private_data); | 4542 | kfree (file->private_data); |
@@ -4615,9 +4614,8 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4615 | int i, j; | 4614 | int i, j; |
4616 | u32 *vals = stats.vals; | 4615 | u32 *vals = stats.vals; |
4617 | 4616 | ||
4618 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4617 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4619 | return -ENOMEM; | 4618 | return -ENOMEM; |
4620 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4621 | data = (struct proc_data *)file->private_data; | 4619 | data = (struct proc_data *)file->private_data; |
4622 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { | 4620 | if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { |
4623 | kfree (file->private_data); | 4621 | kfree (file->private_data); |
@@ -4881,20 +4879,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
4881 | struct airo_info *ai = dev->priv; | 4879 | struct airo_info *ai = dev->priv; |
4882 | int i; | 4880 | int i; |
4883 | 4881 | ||
4884 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4882 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
4885 | return -ENOMEM; | 4883 | return -ENOMEM; |
4886 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
4887 | data = (struct proc_data *)file->private_data; | 4884 | data = (struct proc_data *)file->private_data; |
4888 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4885 | if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { |
4889 | kfree (file->private_data); | 4886 | kfree (file->private_data); |
4890 | return -ENOMEM; | 4887 | return -ENOMEM; |
4891 | } | 4888 | } |
4892 | if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { | 4889 | if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { |
4893 | kfree (data->rbuffer); | 4890 | kfree (data->rbuffer); |
4894 | kfree (file->private_data); | 4891 | kfree (file->private_data); |
4895 | return -ENOMEM; | 4892 | return -ENOMEM; |
4896 | } | 4893 | } |
4897 | memset( data->wbuffer, 0, 2048 ); | ||
4898 | data->maxwritelen = 2048; | 4894 | data->maxwritelen = 2048; |
4899 | data->on_close = proc_config_on_close; | 4895 | data->on_close = proc_config_on_close; |
4900 | 4896 | ||
@@ -5155,24 +5151,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { | |||
5155 | int j=0; | 5151 | int j=0; |
5156 | int rc; | 5152 | int rc; |
5157 | 5153 | ||
5158 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5154 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5159 | return -ENOMEM; | 5155 | return -ENOMEM; |
5160 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5161 | memset(&wkr, 0, sizeof(wkr)); | 5156 | memset(&wkr, 0, sizeof(wkr)); |
5162 | data = (struct proc_data *)file->private_data; | 5157 | data = (struct proc_data *)file->private_data; |
5163 | if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) { | 5158 | if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { |
5164 | kfree (file->private_data); | 5159 | kfree (file->private_data); |
5165 | return -ENOMEM; | 5160 | return -ENOMEM; |
5166 | } | 5161 | } |
5167 | memset(data->rbuffer, 0, 180); | ||
5168 | data->writelen = 0; | 5162 | data->writelen = 0; |
5169 | data->maxwritelen = 80; | 5163 | data->maxwritelen = 80; |
5170 | if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) { | 5164 | if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { |
5171 | kfree (data->rbuffer); | 5165 | kfree (data->rbuffer); |
5172 | kfree (file->private_data); | 5166 | kfree (file->private_data); |
5173 | return -ENOMEM; | 5167 | return -ENOMEM; |
5174 | } | 5168 | } |
5175 | memset( data->wbuffer, 0, 80 ); | ||
5176 | data->on_close = proc_wepkey_on_close; | 5169 | data->on_close = proc_wepkey_on_close; |
5177 | 5170 | ||
5178 | ptr = data->rbuffer; | 5171 | ptr = data->rbuffer; |
@@ -5203,9 +5196,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5203 | char *ptr; | 5196 | char *ptr; |
5204 | SsidRid SSID_rid; | 5197 | SsidRid SSID_rid; |
5205 | 5198 | ||
5206 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5199 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5207 | return -ENOMEM; | 5200 | return -ENOMEM; |
5208 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5209 | data = (struct proc_data *)file->private_data; | 5201 | data = (struct proc_data *)file->private_data; |
5210 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5202 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5211 | kfree (file->private_data); | 5203 | kfree (file->private_data); |
@@ -5213,12 +5205,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { | |||
5213 | } | 5205 | } |
5214 | data->writelen = 0; | 5206 | data->writelen = 0; |
5215 | data->maxwritelen = 33*3; | 5207 | data->maxwritelen = 33*3; |
5216 | if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) { | 5208 | if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) { |
5217 | kfree (data->rbuffer); | 5209 | kfree (data->rbuffer); |
5218 | kfree (file->private_data); | 5210 | kfree (file->private_data); |
5219 | return -ENOMEM; | 5211 | return -ENOMEM; |
5220 | } | 5212 | } |
5221 | memset( data->wbuffer, 0, 33*3 ); | ||
5222 | data->on_close = proc_SSID_on_close; | 5213 | data->on_close = proc_SSID_on_close; |
5223 | 5214 | ||
5224 | readSsidRid(ai, &SSID_rid); | 5215 | readSsidRid(ai, &SSID_rid); |
@@ -5247,9 +5238,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5247 | char *ptr; | 5238 | char *ptr; |
5248 | APListRid APList_rid; | 5239 | APListRid APList_rid; |
5249 | 5240 | ||
5250 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5241 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5251 | return -ENOMEM; | 5242 | return -ENOMEM; |
5252 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5253 | data = (struct proc_data *)file->private_data; | 5243 | data = (struct proc_data *)file->private_data; |
5254 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { | 5244 | if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { |
5255 | kfree (file->private_data); | 5245 | kfree (file->private_data); |
@@ -5257,12 +5247,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5257 | } | 5247 | } |
5258 | data->writelen = 0; | 5248 | data->writelen = 0; |
5259 | data->maxwritelen = 4*6*3; | 5249 | data->maxwritelen = 4*6*3; |
5260 | if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { | 5250 | if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { |
5261 | kfree (data->rbuffer); | 5251 | kfree (data->rbuffer); |
5262 | kfree (file->private_data); | 5252 | kfree (file->private_data); |
5263 | return -ENOMEM; | 5253 | return -ENOMEM; |
5264 | } | 5254 | } |
5265 | memset( data->wbuffer, 0, data->maxwritelen ); | ||
5266 | data->on_close = proc_APList_on_close; | 5255 | data->on_close = proc_APList_on_close; |
5267 | 5256 | ||
5268 | readAPListRid(ai, &APList_rid); | 5257 | readAPListRid(ai, &APList_rid); |
@@ -5297,9 +5286,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { | |||
5297 | /* If doLoseSync is not 1, we won't do a Lose Sync */ | 5286 | /* If doLoseSync is not 1, we won't do a Lose Sync */ |
5298 | int doLoseSync = -1; | 5287 | int doLoseSync = -1; |
5299 | 5288 | ||
5300 | if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 5289 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5301 | return -ENOMEM; | 5290 | return -ENOMEM; |
5302 | memset(file->private_data, 0, sizeof(struct proc_data)); | ||
5303 | data = (struct proc_data *)file->private_data; | 5291 | data = (struct proc_data *)file->private_data; |
5304 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { | 5292 | if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { |
5305 | kfree (file->private_data); | 5293 | kfree (file->private_data); |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 96ed8da8661d..e328547599dc 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -170,12 +170,11 @@ static dev_link_t *airo_attach(void) | |||
170 | DEBUG(0, "airo_attach()\n"); | 170 | DEBUG(0, "airo_attach()\n"); |
171 | 171 | ||
172 | /* Initialize the dev_link_t structure */ | 172 | /* Initialize the dev_link_t structure */ |
173 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 173 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
174 | if (!link) { | 174 | if (!link) { |
175 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 175 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
176 | return NULL; | 176 | return NULL; |
177 | } | 177 | } |
178 | memset(link, 0, sizeof(struct dev_link_t)); | ||
179 | 178 | ||
180 | /* Interrupt setup */ | 179 | /* Interrupt setup */ |
181 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 180 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -194,13 +193,12 @@ static dev_link_t *airo_attach(void) | |||
194 | link->conf.IntType = INT_MEMORY_AND_IO; | 193 | link->conf.IntType = INT_MEMORY_AND_IO; |
195 | 194 | ||
196 | /* Allocate space for private device-specific data */ | 195 | /* Allocate space for private device-specific data */ |
197 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 196 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
198 | if (!local) { | 197 | if (!local) { |
199 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 198 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
200 | kfree (link); | 199 | kfree (link); |
201 | return NULL; | 200 | return NULL; |
202 | } | 201 | } |
203 | memset(local, 0, sizeof(local_info_t)); | ||
204 | link->priv = local; | 202 | link->priv = local; |
205 | 203 | ||
206 | /* Register with Card Services */ | 204 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 1fbe027d26b6..a3e23527fe7f 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -2217,7 +2217,7 @@ static int atmel_get_range(struct net_device *dev, | |||
2217 | int k,i,j; | 2217 | int k,i,j; |
2218 | 2218 | ||
2219 | dwrq->length = sizeof(struct iw_range); | 2219 | dwrq->length = sizeof(struct iw_range); |
2220 | memset(range, 0, sizeof(range)); | 2220 | memset(range, 0, sizeof(struct iw_range)); |
2221 | range->min_nwid = 0x0000; | 2221 | range->min_nwid = 0x0000; |
2222 | range->max_nwid = 0x0000; | 2222 | range->max_nwid = 0x0000; |
2223 | range->num_channels = 0; | 2223 | range->num_channels = 0; |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 195cb36619e8..1bd13146c644 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void) | |||
180 | DEBUG(0, "atmel_attach()\n"); | 180 | DEBUG(0, "atmel_attach()\n"); |
181 | 181 | ||
182 | /* Initialize the dev_link_t structure */ | 182 | /* Initialize the dev_link_t structure */ |
183 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 183 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
184 | if (!link) { | 184 | if (!link) { |
185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 185 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
186 | return NULL; | 186 | return NULL; |
187 | } | 187 | } |
188 | memset(link, 0, sizeof(struct dev_link_t)); | ||
189 | 188 | ||
190 | /* Interrupt setup */ | 189 | /* Interrupt setup */ |
191 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 190 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void) | |||
204 | link->conf.IntType = INT_MEMORY_AND_IO; | 203 | link->conf.IntType = INT_MEMORY_AND_IO; |
205 | 204 | ||
206 | /* Allocate space for private device-specific data */ | 205 | /* Allocate space for private device-specific data */ |
207 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 206 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
208 | if (!local) { | 207 | if (!local) { |
209 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 208 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
210 | kfree (link); | 209 | kfree (link); |
211 | return NULL; | 210 | return NULL; |
212 | } | 211 | } |
213 | memset(local, 0, sizeof(local_info_t)); | ||
214 | link->priv = local; | 212 | link->priv = local; |
215 | 213 | ||
216 | /* Register with Card Services */ | 214 | /* Register with Card Services */ |
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c index 6a96cd9f2685..3d2ea61033be 100644 --- a/drivers/net/wireless/hostap/hostap.c +++ b/drivers/net/wireless/hostap/hostap.c | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #include <linux/version.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 59fc15572395..abfae7fedebc 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | #include <linux/config.h> | 33 | #include <linux/config.h> |
34 | #include <linux/version.h> | ||
35 | 34 | ||
36 | #include <asm/delay.h> | 35 | #include <asm/delay.h> |
37 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index da0c80fb941c..2e85bdced2dd 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Andy Warner <andyw@pobox.com> */ | 5 | * Andy Warner <andyw@pobox.com> */ |
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <linux/version.h> | ||
9 | #include <linux/module.h> | 8 | #include <linux/module.h> |
10 | #include <linux/init.h> | 9 | #include <linux/init.h> |
11 | #include <linux/if.h> | 10 | #include <linux/if.h> |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 78d67b408b2f..94fe2449f099 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | 9 | ||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <linux/version.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
14 | #include <linux/if.h> | 13 | #include <linux/if.h> |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..a2e6214169e9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -167,17 +167,16 @@ that only one external action is invoked at a time. | |||
167 | 167 | ||
168 | #include "ipw2100.h" | 168 | #include "ipw2100.h" |
169 | 169 | ||
170 | #define IPW2100_VERSION "1.1.0" | 170 | #define IPW2100_VERSION "1.1.3" |
171 | 171 | ||
172 | #define DRV_NAME "ipw2100" | 172 | #define DRV_NAME "ipw2100" |
173 | #define DRV_VERSION IPW2100_VERSION | 173 | #define DRV_VERSION IPW2100_VERSION |
174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" | 174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" |
175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" | 175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" |
176 | |||
177 | 176 | ||
178 | /* Debugging stuff */ | 177 | /* Debugging stuff */ |
179 | #ifdef CONFIG_IPW_DEBUG | 178 | #ifdef CONFIG_IPW_DEBUG |
180 | #define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ | 179 | #define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ |
181 | #endif | 180 | #endif |
182 | 181 | ||
183 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 182 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
@@ -220,18 +219,18 @@ do { \ | |||
220 | } while (0) | 219 | } while (0) |
221 | #else | 220 | #else |
222 | #define IPW_DEBUG(level, message...) do {} while (0) | 221 | #define IPW_DEBUG(level, message...) do {} while (0) |
223 | #endif /* CONFIG_IPW_DEBUG */ | 222 | #endif /* CONFIG_IPW_DEBUG */ |
224 | 223 | ||
225 | #ifdef CONFIG_IPW_DEBUG | 224 | #ifdef CONFIG_IPW_DEBUG |
226 | static const char *command_types[] = { | 225 | static const char *command_types[] = { |
227 | "undefined", | 226 | "undefined", |
228 | "unused", /* HOST_ATTENTION */ | 227 | "unused", /* HOST_ATTENTION */ |
229 | "HOST_COMPLETE", | 228 | "HOST_COMPLETE", |
230 | "unused", /* SLEEP */ | 229 | "unused", /* SLEEP */ |
231 | "unused", /* HOST_POWER_DOWN */ | 230 | "unused", /* HOST_POWER_DOWN */ |
232 | "unused", | 231 | "unused", |
233 | "SYSTEM_CONFIG", | 232 | "SYSTEM_CONFIG", |
234 | "unused", /* SET_IMR */ | 233 | "unused", /* SET_IMR */ |
235 | "SSID", | 234 | "SSID", |
236 | "MANDATORY_BSSID", | 235 | "MANDATORY_BSSID", |
237 | "AUTHENTICATION_TYPE", | 236 | "AUTHENTICATION_TYPE", |
@@ -277,17 +276,16 @@ static const char *command_types[] = { | |||
277 | "GROUP_ORDINALS", | 276 | "GROUP_ORDINALS", |
278 | "SHORT_RETRY_LIMIT", | 277 | "SHORT_RETRY_LIMIT", |
279 | "LONG_RETRY_LIMIT", | 278 | "LONG_RETRY_LIMIT", |
280 | "unused", /* SAVE_CALIBRATION */ | 279 | "unused", /* SAVE_CALIBRATION */ |
281 | "unused", /* RESTORE_CALIBRATION */ | 280 | "unused", /* RESTORE_CALIBRATION */ |
282 | "undefined", | 281 | "undefined", |
283 | "undefined", | 282 | "undefined", |
284 | "undefined", | 283 | "undefined", |
285 | "HOST_PRE_POWER_DOWN", | 284 | "HOST_PRE_POWER_DOWN", |
286 | "unused", /* HOST_INTERRUPT_COALESCING */ | 285 | "unused", /* HOST_INTERRUPT_COALESCING */ |
287 | "undefined", | 286 | "undefined", |
288 | "CARD_DISABLE_PHY_OFF", | 287 | "CARD_DISABLE_PHY_OFF", |
289 | "MSDU_TX_RATES" | 288 | "MSDU_TX_RATES" "undefined", |
290 | "undefined", | ||
291 | "undefined", | 289 | "undefined", |
292 | "SET_STATION_STAT_BITS", | 290 | "SET_STATION_STAT_BITS", |
293 | "CLEAR_STATIONS_STAT_BITS", | 291 | "CLEAR_STATIONS_STAT_BITS", |
@@ -298,7 +296,6 @@ static const char *command_types[] = { | |||
298 | }; | 296 | }; |
299 | #endif | 297 | #endif |
300 | 298 | ||
301 | |||
302 | /* Pre-decl until we get the code solid and then we can clean it up */ | 299 | /* Pre-decl until we get the code solid and then we can clean it up */ |
303 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); | 300 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); |
304 | static void ipw2100_tx_send_data(struct ipw2100_priv *priv); | 301 | static void ipw2100_tx_send_data(struct ipw2100_priv *priv); |
@@ -321,11 +318,10 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, | |||
321 | static int ipw2100_ucode_download(struct ipw2100_priv *priv, | 318 | static int ipw2100_ucode_download(struct ipw2100_priv *priv, |
322 | struct ipw2100_fw *fw); | 319 | struct ipw2100_fw *fw); |
323 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv); | 320 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv); |
324 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev); | 321 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); |
325 | static struct iw_handler_def ipw2100_wx_handler_def; | 322 | static struct iw_handler_def ipw2100_wx_handler_def; |
326 | 323 | ||
327 | 324 | static inline void read_register(struct net_device *dev, u32 reg, u32 * val) | |
328 | static inline void read_register(struct net_device *dev, u32 reg, u32 *val) | ||
329 | { | 325 | { |
330 | *val = readl((void __iomem *)(dev->base_addr + reg)); | 326 | *val = readl((void __iomem *)(dev->base_addr + reg)); |
331 | IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); | 327 | IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); |
@@ -337,13 +333,14 @@ static inline void write_register(struct net_device *dev, u32 reg, u32 val) | |||
337 | IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); | 333 | IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); |
338 | } | 334 | } |
339 | 335 | ||
340 | static inline void read_register_word(struct net_device *dev, u32 reg, u16 *val) | 336 | static inline void read_register_word(struct net_device *dev, u32 reg, |
337 | u16 * val) | ||
341 | { | 338 | { |
342 | *val = readw((void __iomem *)(dev->base_addr + reg)); | 339 | *val = readw((void __iomem *)(dev->base_addr + reg)); |
343 | IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); | 340 | IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); |
344 | } | 341 | } |
345 | 342 | ||
346 | static inline void read_register_byte(struct net_device *dev, u32 reg, u8 *val) | 343 | static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) |
347 | { | 344 | { |
348 | *val = readb((void __iomem *)(dev->base_addr + reg)); | 345 | *val = readb((void __iomem *)(dev->base_addr + reg)); |
349 | IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); | 346 | IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); |
@@ -355,14 +352,13 @@ static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) | |||
355 | IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); | 352 | IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); |
356 | } | 353 | } |
357 | 354 | ||
358 | |||
359 | static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) | 355 | static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) |
360 | { | 356 | { |
361 | writeb(val, (void __iomem *)(dev->base_addr + reg)); | 357 | writeb(val, (void __iomem *)(dev->base_addr + reg)); |
362 | IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); | 358 | IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); |
363 | } | 359 | } |
364 | 360 | ||
365 | static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 *val) | 361 | static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) |
366 | { | 362 | { |
367 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 363 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
368 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 364 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -376,7 +372,7 @@ static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) | |||
376 | write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); | 372 | write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); |
377 | } | 373 | } |
378 | 374 | ||
379 | static inline void read_nic_word(struct net_device *dev, u32 addr, u16 *val) | 375 | static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) |
380 | { | 376 | { |
381 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 377 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
382 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 378 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -390,7 +386,7 @@ static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) | |||
390 | write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); | 386 | write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); |
391 | } | 387 | } |
392 | 388 | ||
393 | static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 *val) | 389 | static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) |
394 | { | 390 | { |
395 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 391 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
396 | addr & IPW_REG_INDIRECT_ADDR_MASK); | 392 | addr & IPW_REG_INDIRECT_ADDR_MASK); |
@@ -416,7 +412,7 @@ static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) | |||
416 | } | 412 | } |
417 | 413 | ||
418 | static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | 414 | static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, |
419 | const u8 *buf) | 415 | const u8 * buf) |
420 | { | 416 | { |
421 | u32 aligned_addr; | 417 | u32 aligned_addr; |
422 | u32 aligned_len; | 418 | u32 aligned_len; |
@@ -431,32 +427,30 @@ static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | |||
431 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 427 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
432 | aligned_addr); | 428 | aligned_addr); |
433 | for (i = dif_len; i < 4; i++, buf++) | 429 | for (i = dif_len; i < 4; i++, buf++) |
434 | write_register_byte( | 430 | write_register_byte(dev, |
435 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, | 431 | IPW_REG_INDIRECT_ACCESS_DATA + i, |
436 | *buf); | 432 | *buf); |
437 | 433 | ||
438 | len -= dif_len; | 434 | len -= dif_len; |
439 | aligned_addr += 4; | 435 | aligned_addr += 4; |
440 | } | 436 | } |
441 | 437 | ||
442 | /* read DWs through autoincrement registers */ | 438 | /* read DWs through autoincrement registers */ |
443 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, | 439 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); |
444 | aligned_addr); | ||
445 | aligned_len = len & (~0x3); | 440 | aligned_len = len & (~0x3); |
446 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 441 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
447 | write_register( | 442 | write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); |
448 | dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *)buf); | ||
449 | 443 | ||
450 | /* copy the last nibble */ | 444 | /* copy the last nibble */ |
451 | dif_len = len - aligned_len; | 445 | dif_len = len - aligned_len; |
452 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); | 446 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); |
453 | for (i = 0; i < dif_len; i++, buf++) | 447 | for (i = 0; i < dif_len; i++, buf++) |
454 | write_register_byte( | 448 | write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, |
455 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, *buf); | 449 | *buf); |
456 | } | 450 | } |
457 | 451 | ||
458 | static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, | 452 | static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, |
459 | u8 *buf) | 453 | u8 * buf) |
460 | { | 454 | { |
461 | u32 aligned_addr; | 455 | u32 aligned_addr; |
462 | u32 aligned_len; | 456 | u32 aligned_len; |
@@ -471,39 +465,38 @@ static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, | |||
471 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 465 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, |
472 | aligned_addr); | 466 | aligned_addr); |
473 | for (i = dif_len; i < 4; i++, buf++) | 467 | for (i = dif_len; i < 4; i++, buf++) |
474 | read_register_byte( | 468 | read_register_byte(dev, |
475 | dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); | 469 | IPW_REG_INDIRECT_ACCESS_DATA + i, |
470 | buf); | ||
476 | 471 | ||
477 | len -= dif_len; | 472 | len -= dif_len; |
478 | aligned_addr += 4; | 473 | aligned_addr += 4; |
479 | } | 474 | } |
480 | 475 | ||
481 | /* read DWs through autoincrement registers */ | 476 | /* read DWs through autoincrement registers */ |
482 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, | 477 | write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); |
483 | aligned_addr); | ||
484 | aligned_len = len & (~0x3); | 478 | aligned_len = len & (~0x3); |
485 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 479 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
486 | read_register(dev, IPW_REG_AUTOINCREMENT_DATA, | 480 | read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); |
487 | (u32 *)buf); | ||
488 | 481 | ||
489 | /* copy the last nibble */ | 482 | /* copy the last nibble */ |
490 | dif_len = len - aligned_len; | 483 | dif_len = len - aligned_len; |
491 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, | 484 | write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); |
492 | aligned_addr); | ||
493 | for (i = 0; i < dif_len; i++, buf++) | 485 | for (i = 0; i < dif_len; i++, buf++) |
494 | read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + | 486 | read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); |
495 | i, buf); | ||
496 | } | 487 | } |
497 | 488 | ||
498 | static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) | 489 | static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) |
499 | { | 490 | { |
500 | return (dev->base_addr && | 491 | return (dev->base_addr && |
501 | (readl((void __iomem *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START)) | 492 | (readl |
493 | ((void __iomem *)(dev->base_addr + | ||
494 | IPW_REG_DOA_DEBUG_AREA_START)) | ||
502 | == IPW_DATA_DOA_DEBUG_VALUE)); | 495 | == IPW_DATA_DOA_DEBUG_VALUE)); |
503 | } | 496 | } |
504 | 497 | ||
505 | static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | 498 | static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, |
506 | void *val, u32 *len) | 499 | void *val, u32 * len) |
507 | { | 500 | { |
508 | struct ipw2100_ordinals *ordinals = &priv->ordinals; | 501 | struct ipw2100_ordinals *ordinals = &priv->ordinals; |
509 | u32 addr; | 502 | u32 addr; |
@@ -529,8 +522,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
529 | return -EINVAL; | 522 | return -EINVAL; |
530 | } | 523 | } |
531 | 524 | ||
532 | read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), | 525 | read_nic_dword(priv->net_dev, |
533 | &addr); | 526 | ordinals->table1_addr + (ord << 2), &addr); |
534 | read_nic_dword(priv->net_dev, addr, val); | 527 | read_nic_dword(priv->net_dev, addr, val); |
535 | 528 | ||
536 | *len = IPW_ORD_TAB_1_ENTRY_SIZE; | 529 | *len = IPW_ORD_TAB_1_ENTRY_SIZE; |
@@ -543,8 +536,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
543 | ord -= IPW_START_ORD_TAB_2; | 536 | ord -= IPW_START_ORD_TAB_2; |
544 | 537 | ||
545 | /* get the address of statistic */ | 538 | /* get the address of statistic */ |
546 | read_nic_dword(priv->net_dev, ordinals->table2_addr + (ord << 3), | 539 | read_nic_dword(priv->net_dev, |
547 | &addr); | 540 | ordinals->table2_addr + (ord << 3), &addr); |
548 | 541 | ||
549 | /* get the second DW of statistics ; | 542 | /* get the second DW of statistics ; |
550 | * two 16-bit words - first is length, second is count */ | 543 | * two 16-bit words - first is length, second is count */ |
@@ -553,10 +546,10 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
553 | &field_info); | 546 | &field_info); |
554 | 547 | ||
555 | /* get each entry length */ | 548 | /* get each entry length */ |
556 | field_len = *((u16 *)&field_info); | 549 | field_len = *((u16 *) & field_info); |
557 | 550 | ||
558 | /* get number of entries */ | 551 | /* get number of entries */ |
559 | field_count = *(((u16 *)&field_info) + 1); | 552 | field_count = *(((u16 *) & field_info) + 1); |
560 | 553 | ||
561 | /* abort if no enought memory */ | 554 | /* abort if no enought memory */ |
562 | total_length = field_len * field_count; | 555 | total_length = field_len * field_count; |
@@ -581,8 +574,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, | |||
581 | return -EINVAL; | 574 | return -EINVAL; |
582 | } | 575 | } |
583 | 576 | ||
584 | static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | 577 | static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, |
585 | u32 *len) | 578 | u32 * len) |
586 | { | 579 | { |
587 | struct ipw2100_ordinals *ordinals = &priv->ordinals; | 580 | struct ipw2100_ordinals *ordinals = &priv->ordinals; |
588 | u32 addr; | 581 | u32 addr; |
@@ -594,8 +587,8 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | |||
594 | return -EINVAL; | 587 | return -EINVAL; |
595 | } | 588 | } |
596 | 589 | ||
597 | read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), | 590 | read_nic_dword(priv->net_dev, |
598 | &addr); | 591 | ordinals->table1_addr + (ord << 2), &addr); |
599 | 592 | ||
600 | write_nic_dword(priv->net_dev, addr, *val); | 593 | write_nic_dword(priv->net_dev, addr, *val); |
601 | 594 | ||
@@ -612,7 +605,7 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, | |||
612 | } | 605 | } |
613 | 606 | ||
614 | static char *snprint_line(char *buf, size_t count, | 607 | static char *snprint_line(char *buf, size_t count, |
615 | const u8 *data, u32 len, u32 ofs) | 608 | const u8 * data, u32 len, u32 ofs) |
616 | { | 609 | { |
617 | int out, i, j, l; | 610 | int out, i, j, l; |
618 | char c; | 611 | char c; |
@@ -646,7 +639,7 @@ static char *snprint_line(char *buf, size_t count, | |||
646 | return buf; | 639 | return buf; |
647 | } | 640 | } |
648 | 641 | ||
649 | static void printk_buf(int level, const u8 *data, u32 len) | 642 | static void printk_buf(int level, const u8 * data, u32 len) |
650 | { | 643 | { |
651 | char line[81]; | 644 | char line[81]; |
652 | u32 ofs = 0; | 645 | u32 ofs = 0; |
@@ -662,8 +655,6 @@ static void printk_buf(int level, const u8 *data, u32 len) | |||
662 | } | 655 | } |
663 | } | 656 | } |
664 | 657 | ||
665 | |||
666 | |||
667 | #define MAX_RESET_BACKOFF 10 | 658 | #define MAX_RESET_BACKOFF 10 |
668 | 659 | ||
669 | static inline void schedule_reset(struct ipw2100_priv *priv) | 660 | static inline void schedule_reset(struct ipw2100_priv *priv) |
@@ -703,7 +694,7 @@ static inline void schedule_reset(struct ipw2100_priv *priv) | |||
703 | 694 | ||
704 | #define HOST_COMPLETE_TIMEOUT (2 * HZ) | 695 | #define HOST_COMPLETE_TIMEOUT (2 * HZ) |
705 | static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | 696 | static int ipw2100_hw_send_command(struct ipw2100_priv *priv, |
706 | struct host_command * cmd) | 697 | struct host_command *cmd) |
707 | { | 698 | { |
708 | struct list_head *element; | 699 | struct list_head *element; |
709 | struct ipw2100_tx_packet *packet; | 700 | struct ipw2100_tx_packet *packet; |
@@ -713,25 +704,28 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
713 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", | 704 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", |
714 | command_types[cmd->host_command], cmd->host_command, | 705 | command_types[cmd->host_command], cmd->host_command, |
715 | cmd->host_command_length); | 706 | cmd->host_command_length); |
716 | printk_buf(IPW_DL_HC, (u8*)cmd->host_command_parameters, | 707 | printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, |
717 | cmd->host_command_length); | 708 | cmd->host_command_length); |
718 | 709 | ||
719 | spin_lock_irqsave(&priv->low_lock, flags); | 710 | spin_lock_irqsave(&priv->low_lock, flags); |
720 | 711 | ||
721 | if (priv->fatal_error) { | 712 | if (priv->fatal_error) { |
722 | IPW_DEBUG_INFO("Attempt to send command while hardware in fatal error condition.\n"); | 713 | IPW_DEBUG_INFO |
714 | ("Attempt to send command while hardware in fatal error condition.\n"); | ||
723 | err = -EIO; | 715 | err = -EIO; |
724 | goto fail_unlock; | 716 | goto fail_unlock; |
725 | } | 717 | } |
726 | 718 | ||
727 | if (!(priv->status & STATUS_RUNNING)) { | 719 | if (!(priv->status & STATUS_RUNNING)) { |
728 | IPW_DEBUG_INFO("Attempt to send command while hardware is not running.\n"); | 720 | IPW_DEBUG_INFO |
721 | ("Attempt to send command while hardware is not running.\n"); | ||
729 | err = -EIO; | 722 | err = -EIO; |
730 | goto fail_unlock; | 723 | goto fail_unlock; |
731 | } | 724 | } |
732 | 725 | ||
733 | if (priv->status & STATUS_CMD_ACTIVE) { | 726 | if (priv->status & STATUS_CMD_ACTIVE) { |
734 | IPW_DEBUG_INFO("Attempt to send command while another command is pending.\n"); | 727 | IPW_DEBUG_INFO |
728 | ("Attempt to send command while another command is pending.\n"); | ||
735 | err = -EBUSY; | 729 | err = -EBUSY; |
736 | goto fail_unlock; | 730 | goto fail_unlock; |
737 | } | 731 | } |
@@ -752,7 +746,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
752 | /* initialize the firmware command packet */ | 746 | /* initialize the firmware command packet */ |
753 | packet->info.c_struct.cmd->host_command_reg = cmd->host_command; | 747 | packet->info.c_struct.cmd->host_command_reg = cmd->host_command; |
754 | packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; | 748 | packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; |
755 | packet->info.c_struct.cmd->host_command_len_reg = cmd->host_command_length; | 749 | packet->info.c_struct.cmd->host_command_len_reg = |
750 | cmd->host_command_length; | ||
756 | packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; | 751 | packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; |
757 | 752 | ||
758 | memcpy(packet->info.c_struct.cmd->host_command_params_reg, | 753 | memcpy(packet->info.c_struct.cmd->host_command_params_reg, |
@@ -776,13 +771,15 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
776 | * then there is a problem. | 771 | * then there is a problem. |
777 | */ | 772 | */ |
778 | 773 | ||
779 | err = wait_event_interruptible_timeout( | 774 | err = |
780 | priv->wait_command_queue, !(priv->status & STATUS_CMD_ACTIVE), | 775 | wait_event_interruptible_timeout(priv->wait_command_queue, |
781 | HOST_COMPLETE_TIMEOUT); | 776 | !(priv-> |
777 | status & STATUS_CMD_ACTIVE), | ||
778 | HOST_COMPLETE_TIMEOUT); | ||
782 | 779 | ||
783 | if (err == 0) { | 780 | if (err == 0) { |
784 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", | 781 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", |
785 | HOST_COMPLETE_TIMEOUT / (HZ / 100)); | 782 | 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); |
786 | priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; | 783 | priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; |
787 | priv->status &= ~STATUS_CMD_ACTIVE; | 784 | priv->status &= ~STATUS_CMD_ACTIVE; |
788 | schedule_reset(priv); | 785 | schedule_reset(priv); |
@@ -804,13 +801,12 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
804 | 801 | ||
805 | return 0; | 802 | return 0; |
806 | 803 | ||
807 | fail_unlock: | 804 | fail_unlock: |
808 | spin_unlock_irqrestore(&priv->low_lock, flags); | 805 | spin_unlock_irqrestore(&priv->low_lock, flags); |
809 | 806 | ||
810 | return err; | 807 | return err; |
811 | } | 808 | } |
812 | 809 | ||
813 | |||
814 | /* | 810 | /* |
815 | * Verify the values and data access of the hardware | 811 | * Verify the values and data access of the hardware |
816 | * No locks needed or used. No functions called. | 812 | * No locks needed or used. No functions called. |
@@ -825,8 +821,7 @@ static int ipw2100_verify(struct ipw2100_priv *priv) | |||
825 | 821 | ||
826 | /* Domain 0 check - all values should be DOA_DEBUG */ | 822 | /* Domain 0 check - all values should be DOA_DEBUG */ |
827 | for (address = IPW_REG_DOA_DEBUG_AREA_START; | 823 | for (address = IPW_REG_DOA_DEBUG_AREA_START; |
828 | address < IPW_REG_DOA_DEBUG_AREA_END; | 824 | address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { |
829 | address += sizeof(u32)) { | ||
830 | read_register(priv->net_dev, address, &data1); | 825 | read_register(priv->net_dev, address, &data1); |
831 | if (data1 != IPW_DATA_DOA_DEBUG_VALUE) | 826 | if (data1 != IPW_DATA_DOA_DEBUG_VALUE) |
832 | return -EIO; | 827 | return -EIO; |
@@ -898,7 +893,6 @@ static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) | |||
898 | return -EIO; | 893 | return -EIO; |
899 | } | 894 | } |
900 | 895 | ||
901 | |||
902 | /********************************************************************* | 896 | /********************************************************************* |
903 | Procedure : sw_reset_and_clock | 897 | Procedure : sw_reset_and_clock |
904 | Purpose : Asserts s/w reset, asserts clock initialization | 898 | Purpose : Asserts s/w reset, asserts clock initialization |
@@ -975,17 +969,16 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
975 | 969 | ||
976 | if (priv->fatal_error) { | 970 | if (priv->fatal_error) { |
977 | IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " | 971 | IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " |
978 | "fatal error %d. Interface must be brought down.\n", | 972 | "fatal error %d. Interface must be brought down.\n", |
979 | priv->net_dev->name, priv->fatal_error); | 973 | priv->net_dev->name, priv->fatal_error); |
980 | return -EINVAL; | 974 | return -EINVAL; |
981 | } | 975 | } |
982 | |||
983 | #ifdef CONFIG_PM | 976 | #ifdef CONFIG_PM |
984 | if (!ipw2100_firmware.version) { | 977 | if (!ipw2100_firmware.version) { |
985 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); | 978 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); |
986 | if (err) { | 979 | if (err) { |
987 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", | 980 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", |
988 | priv->net_dev->name, err); | 981 | priv->net_dev->name, err); |
989 | priv->fatal_error = IPW2100_ERR_FW_LOAD; | 982 | priv->fatal_error = IPW2100_ERR_FW_LOAD; |
990 | goto fail; | 983 | goto fail; |
991 | } | 984 | } |
@@ -994,7 +987,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
994 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); | 987 | err = ipw2100_get_firmware(priv, &ipw2100_firmware); |
995 | if (err) { | 988 | if (err) { |
996 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", | 989 | IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", |
997 | priv->net_dev->name, err); | 990 | priv->net_dev->name, err); |
998 | priv->fatal_error = IPW2100_ERR_FW_LOAD; | 991 | priv->fatal_error = IPW2100_ERR_FW_LOAD; |
999 | goto fail; | 992 | goto fail; |
1000 | } | 993 | } |
@@ -1005,21 +998,20 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1005 | err = sw_reset_and_clock(priv); | 998 | err = sw_reset_and_clock(priv); |
1006 | if (err) { | 999 | if (err) { |
1007 | IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", | 1000 | IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", |
1008 | priv->net_dev->name, err); | 1001 | priv->net_dev->name, err); |
1009 | goto fail; | 1002 | goto fail; |
1010 | } | 1003 | } |
1011 | 1004 | ||
1012 | err = ipw2100_verify(priv); | 1005 | err = ipw2100_verify(priv); |
1013 | if (err) { | 1006 | if (err) { |
1014 | IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", | 1007 | IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", |
1015 | priv->net_dev->name, err); | 1008 | priv->net_dev->name, err); |
1016 | goto fail; | 1009 | goto fail; |
1017 | } | 1010 | } |
1018 | 1011 | ||
1019 | /* Hold ARC */ | 1012 | /* Hold ARC */ |
1020 | write_nic_dword(priv->net_dev, | 1013 | write_nic_dword(priv->net_dev, |
1021 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, | 1014 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); |
1022 | 0x80000000); | ||
1023 | 1015 | ||
1024 | /* allow ARC to run */ | 1016 | /* allow ARC to run */ |
1025 | write_register(priv->net_dev, IPW_REG_RESET_REG, 0); | 1017 | write_register(priv->net_dev, IPW_REG_RESET_REG, 0); |
@@ -1034,13 +1026,13 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1034 | 1026 | ||
1035 | /* release ARC */ | 1027 | /* release ARC */ |
1036 | write_nic_dword(priv->net_dev, | 1028 | write_nic_dword(priv->net_dev, |
1037 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, | 1029 | IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); |
1038 | 0x00000000); | ||
1039 | 1030 | ||
1040 | /* s/w reset and clock stabilization (again!!!) */ | 1031 | /* s/w reset and clock stabilization (again!!!) */ |
1041 | err = sw_reset_and_clock(priv); | 1032 | err = sw_reset_and_clock(priv); |
1042 | if (err) { | 1033 | if (err) { |
1043 | printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n", | 1034 | printk(KERN_ERR DRV_NAME |
1035 | ": %s: sw_reset_and_clock failed: %d\n", | ||
1044 | priv->net_dev->name, err); | 1036 | priv->net_dev->name, err); |
1045 | goto fail; | 1037 | goto fail; |
1046 | } | 1038 | } |
@@ -1049,10 +1041,9 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1049 | err = ipw2100_fw_download(priv, &ipw2100_firmware); | 1041 | err = ipw2100_fw_download(priv, &ipw2100_firmware); |
1050 | if (err) { | 1042 | if (err) { |
1051 | IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", | 1043 | IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", |
1052 | priv->net_dev->name, err); | 1044 | priv->net_dev->name, err); |
1053 | goto fail; | 1045 | goto fail; |
1054 | } | 1046 | } |
1055 | |||
1056 | #ifndef CONFIG_PM | 1047 | #ifndef CONFIG_PM |
1057 | /* | 1048 | /* |
1058 | * When the .resume method of the driver is called, the other | 1049 | * When the .resume method of the driver is called, the other |
@@ -1084,7 +1075,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) | |||
1084 | 1075 | ||
1085 | return 0; | 1076 | return 0; |
1086 | 1077 | ||
1087 | fail: | 1078 | fail: |
1088 | ipw2100_release_firmware(priv, &ipw2100_firmware); | 1079 | ipw2100_release_firmware(priv, &ipw2100_firmware); |
1089 | return err; | 1080 | return err; |
1090 | } | 1081 | } |
@@ -1105,7 +1096,6 @@ static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) | |||
1105 | write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); | 1096 | write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); |
1106 | } | 1097 | } |
1107 | 1098 | ||
1108 | |||
1109 | static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) | 1099 | static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) |
1110 | { | 1100 | { |
1111 | struct ipw2100_ordinals *ord = &priv->ordinals; | 1101 | struct ipw2100_ordinals *ord = &priv->ordinals; |
@@ -1177,11 +1167,10 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1177 | * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 | 1167 | * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 |
1178 | */ | 1168 | */ |
1179 | len = sizeof(addr); | 1169 | len = sizeof(addr); |
1180 | if (ipw2100_get_ordinal( | 1170 | if (ipw2100_get_ordinal |
1181 | priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, | 1171 | (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { |
1182 | &addr, &len)) { | ||
1183 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1172 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1184 | __LINE__); | 1173 | __LINE__); |
1185 | return -EIO; | 1174 | return -EIO; |
1186 | } | 1175 | } |
1187 | 1176 | ||
@@ -1194,7 +1183,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1194 | priv->eeprom_version = (val >> 24) & 0xFF; | 1183 | priv->eeprom_version = (val >> 24) & 0xFF; |
1195 | IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); | 1184 | IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); |
1196 | 1185 | ||
1197 | /* | 1186 | /* |
1198 | * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware | 1187 | * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware |
1199 | * | 1188 | * |
1200 | * notice that the EEPROM bit is reverse polarity, i.e. | 1189 | * notice that the EEPROM bit is reverse polarity, i.e. |
@@ -1206,8 +1195,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) | |||
1206 | priv->hw_features |= HW_FEATURE_RFKILL; | 1195 | priv->hw_features |= HW_FEATURE_RFKILL; |
1207 | 1196 | ||
1208 | IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", | 1197 | IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", |
1209 | (priv->hw_features & HW_FEATURE_RFKILL) ? | 1198 | (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); |
1210 | "" : "not "); | ||
1211 | 1199 | ||
1212 | return 0; | 1200 | return 0; |
1213 | } | 1201 | } |
@@ -1234,7 +1222,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1234 | * fw & dino ucode | 1222 | * fw & dino ucode |
1235 | */ | 1223 | */ |
1236 | if (ipw2100_download_firmware(priv)) { | 1224 | if (ipw2100_download_firmware(priv)) { |
1237 | printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n", | 1225 | printk(KERN_ERR DRV_NAME |
1226 | ": %s: Failed to power on the adapter.\n", | ||
1238 | priv->net_dev->name); | 1227 | priv->net_dev->name); |
1239 | return -EIO; | 1228 | return -EIO; |
1240 | } | 1229 | } |
@@ -1293,7 +1282,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1293 | i ? "SUCCESS" : "FAILED"); | 1282 | i ? "SUCCESS" : "FAILED"); |
1294 | 1283 | ||
1295 | if (!i) { | 1284 | if (!i) { |
1296 | printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n", | 1285 | printk(KERN_WARNING DRV_NAME |
1286 | ": %s: Firmware did not initialize.\n", | ||
1297 | priv->net_dev->name); | 1287 | priv->net_dev->name); |
1298 | return -EIO; | 1288 | return -EIO; |
1299 | } | 1289 | } |
@@ -1326,7 +1316,6 @@ static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) | |||
1326 | priv->fatal_error = 0; | 1316 | priv->fatal_error = 0; |
1327 | } | 1317 | } |
1328 | 1318 | ||
1329 | |||
1330 | /* NOTE: Our interrupt is disabled when this method is called */ | 1319 | /* NOTE: Our interrupt is disabled when this method is called */ |
1331 | static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | 1320 | static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) |
1332 | { | 1321 | { |
@@ -1350,19 +1339,19 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | |||
1350 | 1339 | ||
1351 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) | 1340 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) |
1352 | break; | 1341 | break; |
1353 | } while(i--); | 1342 | } while (i--); |
1354 | 1343 | ||
1355 | priv->status &= ~STATUS_RESET_PENDING; | 1344 | priv->status &= ~STATUS_RESET_PENDING; |
1356 | 1345 | ||
1357 | if (!i) { | 1346 | if (!i) { |
1358 | IPW_DEBUG_INFO("exit - waited too long for master assert stop\n"); | 1347 | IPW_DEBUG_INFO |
1348 | ("exit - waited too long for master assert stop\n"); | ||
1359 | return -EIO; | 1349 | return -EIO; |
1360 | } | 1350 | } |
1361 | 1351 | ||
1362 | write_register(priv->net_dev, IPW_REG_RESET_REG, | 1352 | write_register(priv->net_dev, IPW_REG_RESET_REG, |
1363 | IPW_AUX_HOST_RESET_REG_SW_RESET); | 1353 | IPW_AUX_HOST_RESET_REG_SW_RESET); |
1364 | 1354 | ||
1365 | |||
1366 | /* Reset any fatal_error conditions */ | 1355 | /* Reset any fatal_error conditions */ |
1367 | ipw2100_reset_fatalerror(priv); | 1356 | ipw2100_reset_fatalerror(priv); |
1368 | 1357 | ||
@@ -1415,7 +1404,6 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) | |||
1415 | return -EIO; | 1404 | return -EIO; |
1416 | } | 1405 | } |
1417 | 1406 | ||
1418 | |||
1419 | static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | 1407 | static int ipw2100_enable_adapter(struct ipw2100_priv *priv) |
1420 | { | 1408 | { |
1421 | struct host_command cmd = { | 1409 | struct host_command cmd = { |
@@ -1445,9 +1433,8 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
1445 | 1433 | ||
1446 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); | 1434 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); |
1447 | if (err) { | 1435 | if (err) { |
1448 | IPW_DEBUG_INFO( | 1436 | IPW_DEBUG_INFO("%s: card not responding to init command.\n", |
1449 | "%s: card not responding to init command.\n", | 1437 | priv->net_dev->name); |
1450 | priv->net_dev->name); | ||
1451 | goto fail_up; | 1438 | goto fail_up; |
1452 | } | 1439 | } |
1453 | 1440 | ||
@@ -1456,7 +1443,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
1456 | queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); | 1443 | queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); |
1457 | } | 1444 | } |
1458 | 1445 | ||
1459 | fail_up: | 1446 | fail_up: |
1460 | up(&priv->adapter_sem); | 1447 | up(&priv->adapter_sem); |
1461 | return err; | 1448 | return err; |
1462 | } | 1449 | } |
@@ -1488,7 +1475,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | |||
1488 | 1475 | ||
1489 | err = ipw2100_hw_phy_off(priv); | 1476 | err = ipw2100_hw_phy_off(priv); |
1490 | if (err) | 1477 | if (err) |
1491 | printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err); | 1478 | printk(KERN_WARNING DRV_NAME |
1479 | ": Error disabling radio %d\n", err); | ||
1492 | 1480 | ||
1493 | /* | 1481 | /* |
1494 | * If in D0-standby mode going directly to D3 may cause a | 1482 | * If in D0-standby mode going directly to D3 may cause a |
@@ -1566,7 +1554,6 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | |||
1566 | return 0; | 1554 | return 0; |
1567 | } | 1555 | } |
1568 | 1556 | ||
1569 | |||
1570 | static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | 1557 | static int ipw2100_disable_adapter(struct ipw2100_priv *priv) |
1571 | { | 1558 | { |
1572 | struct host_command cmd = { | 1559 | struct host_command cmd = { |
@@ -1593,19 +1580,21 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | |||
1593 | 1580 | ||
1594 | err = ipw2100_hw_send_command(priv, &cmd); | 1581 | err = ipw2100_hw_send_command(priv, &cmd); |
1595 | if (err) { | 1582 | if (err) { |
1596 | printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n"); | 1583 | printk(KERN_WARNING DRV_NAME |
1584 | ": exit - failed to send CARD_DISABLE command\n"); | ||
1597 | goto fail_up; | 1585 | goto fail_up; |
1598 | } | 1586 | } |
1599 | 1587 | ||
1600 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); | 1588 | err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); |
1601 | if (err) { | 1589 | if (err) { |
1602 | printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n"); | 1590 | printk(KERN_WARNING DRV_NAME |
1591 | ": exit - card failed to change to DISABLED\n"); | ||
1603 | goto fail_up; | 1592 | goto fail_up; |
1604 | } | 1593 | } |
1605 | 1594 | ||
1606 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); | 1595 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); |
1607 | 1596 | ||
1608 | fail_up: | 1597 | fail_up: |
1609 | up(&priv->adapter_sem); | 1598 | up(&priv->adapter_sem); |
1610 | return err; | 1599 | return err; |
1611 | } | 1600 | } |
@@ -1627,7 +1616,7 @@ static int ipw2100_set_scan_options(struct ipw2100_priv *priv) | |||
1627 | 1616 | ||
1628 | if (!(priv->config & CFG_ASSOCIATE)) | 1617 | if (!(priv->config & CFG_ASSOCIATE)) |
1629 | cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; | 1618 | cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; |
1630 | if ((priv->sec.flags & SEC_ENABLED) && priv->sec.enabled) | 1619 | if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) |
1631 | cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; | 1620 | cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; |
1632 | if (priv->config & CFG_PASSIVE_SCAN) | 1621 | if (priv->config & CFG_PASSIVE_SCAN) |
1633 | cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; | 1622 | cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; |
@@ -1709,8 +1698,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1709 | (priv->status & STATUS_RESET_PENDING)) { | 1698 | (priv->status & STATUS_RESET_PENDING)) { |
1710 | /* Power cycle the card ... */ | 1699 | /* Power cycle the card ... */ |
1711 | if (ipw2100_power_cycle_adapter(priv)) { | 1700 | if (ipw2100_power_cycle_adapter(priv)) { |
1712 | printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n", | 1701 | printk(KERN_WARNING DRV_NAME |
1713 | priv->net_dev->name); | 1702 | ": %s: Could not cycle adapter.\n", |
1703 | priv->net_dev->name); | ||
1714 | rc = 1; | 1704 | rc = 1; |
1715 | goto exit; | 1705 | goto exit; |
1716 | } | 1706 | } |
@@ -1719,8 +1709,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1719 | 1709 | ||
1720 | /* Load the firmware, start the clocks, etc. */ | 1710 | /* Load the firmware, start the clocks, etc. */ |
1721 | if (ipw2100_start_adapter(priv)) { | 1711 | if (ipw2100_start_adapter(priv)) { |
1722 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n", | 1712 | printk(KERN_ERR DRV_NAME |
1723 | priv->net_dev->name); | 1713 | ": %s: Failed to start the firmware.\n", |
1714 | priv->net_dev->name); | ||
1724 | rc = 1; | 1715 | rc = 1; |
1725 | goto exit; | 1716 | goto exit; |
1726 | } | 1717 | } |
@@ -1729,16 +1720,18 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1729 | 1720 | ||
1730 | /* Determine capabilities of this particular HW configuration */ | 1721 | /* Determine capabilities of this particular HW configuration */ |
1731 | if (ipw2100_get_hw_features(priv)) { | 1722 | if (ipw2100_get_hw_features(priv)) { |
1732 | printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n", | 1723 | printk(KERN_ERR DRV_NAME |
1733 | priv->net_dev->name); | 1724 | ": %s: Failed to determine HW features.\n", |
1725 | priv->net_dev->name); | ||
1734 | rc = 1; | 1726 | rc = 1; |
1735 | goto exit; | 1727 | goto exit; |
1736 | } | 1728 | } |
1737 | 1729 | ||
1738 | lock = LOCK_NONE; | 1730 | lock = LOCK_NONE; |
1739 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { | 1731 | if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { |
1740 | printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n", | 1732 | printk(KERN_ERR DRV_NAME |
1741 | priv->net_dev->name); | 1733 | ": %s: Failed to clear ordinal lock.\n", |
1734 | priv->net_dev->name); | ||
1742 | rc = 1; | 1735 | rc = 1; |
1743 | goto exit; | 1736 | goto exit; |
1744 | } | 1737 | } |
@@ -1764,7 +1757,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1764 | * HOST_COMPLETE */ | 1757 | * HOST_COMPLETE */ |
1765 | if (ipw2100_adapter_setup(priv)) { | 1758 | if (ipw2100_adapter_setup(priv)) { |
1766 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", | 1759 | printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", |
1767 | priv->net_dev->name); | 1760 | priv->net_dev->name); |
1768 | rc = 1; | 1761 | rc = 1; |
1769 | goto exit; | 1762 | goto exit; |
1770 | } | 1763 | } |
@@ -1773,20 +1766,19 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1773 | /* Enable the adapter - sends HOST_COMPLETE */ | 1766 | /* Enable the adapter - sends HOST_COMPLETE */ |
1774 | if (ipw2100_enable_adapter(priv)) { | 1767 | if (ipw2100_enable_adapter(priv)) { |
1775 | printk(KERN_ERR DRV_NAME ": " | 1768 | printk(KERN_ERR DRV_NAME ": " |
1776 | "%s: failed in call to enable adapter.\n", | 1769 | "%s: failed in call to enable adapter.\n", |
1777 | priv->net_dev->name); | 1770 | priv->net_dev->name); |
1778 | ipw2100_hw_stop_adapter(priv); | 1771 | ipw2100_hw_stop_adapter(priv); |
1779 | rc = 1; | 1772 | rc = 1; |
1780 | goto exit; | 1773 | goto exit; |
1781 | } | 1774 | } |
1782 | 1775 | ||
1783 | |||
1784 | /* Start a scan . . . */ | 1776 | /* Start a scan . . . */ |
1785 | ipw2100_set_scan_options(priv); | 1777 | ipw2100_set_scan_options(priv); |
1786 | ipw2100_start_scan(priv); | 1778 | ipw2100_start_scan(priv); |
1787 | } | 1779 | } |
1788 | 1780 | ||
1789 | exit: | 1781 | exit: |
1790 | return rc; | 1782 | return rc; |
1791 | } | 1783 | } |
1792 | 1784 | ||
@@ -1802,8 +1794,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
1802 | unsigned long flags; | 1794 | unsigned long flags; |
1803 | union iwreq_data wrqu = { | 1795 | union iwreq_data wrqu = { |
1804 | .ap_addr = { | 1796 | .ap_addr = { |
1805 | .sa_family = ARPHRD_ETHER | 1797 | .sa_family = ARPHRD_ETHER} |
1806 | } | ||
1807 | }; | 1798 | }; |
1808 | int associated = priv->status & STATUS_ASSOCIATED; | 1799 | int associated = priv->status & STATUS_ASSOCIATED; |
1809 | 1800 | ||
@@ -1842,7 +1833,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
1842 | 1833 | ||
1843 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 1834 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
1844 | if (priv->config & CFG_C3_DISABLED) { | 1835 | if (priv->config & CFG_C3_DISABLED) { |
1845 | IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); | 1836 | IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); |
1846 | acpi_set_cstate_limit(priv->cstate_limit); | 1837 | acpi_set_cstate_limit(priv->cstate_limit); |
1847 | priv->config &= ~CFG_C3_DISABLED; | 1838 | priv->config &= ~CFG_C3_DISABLED; |
1848 | } | 1839 | } |
@@ -1862,14 +1853,12 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
1862 | unsigned long flags; | 1853 | unsigned long flags; |
1863 | union iwreq_data wrqu = { | 1854 | union iwreq_data wrqu = { |
1864 | .ap_addr = { | 1855 | .ap_addr = { |
1865 | .sa_family = ARPHRD_ETHER | 1856 | .sa_family = ARPHRD_ETHER} |
1866 | } | ||
1867 | }; | 1857 | }; |
1868 | int associated = priv->status & STATUS_ASSOCIATED; | 1858 | int associated = priv->status & STATUS_ASSOCIATED; |
1869 | 1859 | ||
1870 | spin_lock_irqsave(&priv->low_lock, flags); | 1860 | spin_lock_irqsave(&priv->low_lock, flags); |
1871 | IPW_DEBUG_INFO(DRV_NAME ": %s: Restarting adapter.\n", | 1861 | IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); |
1872 | priv->net_dev->name); | ||
1873 | priv->resets++; | 1862 | priv->resets++; |
1874 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); | 1863 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); |
1875 | priv->status |= STATUS_SECURITY_UPDATED; | 1864 | priv->status |= STATUS_SECURITY_UPDATED; |
@@ -1894,7 +1883,6 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
1894 | 1883 | ||
1895 | } | 1884 | } |
1896 | 1885 | ||
1897 | |||
1898 | static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | 1886 | static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) |
1899 | { | 1887 | { |
1900 | 1888 | ||
@@ -1904,7 +1892,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1904 | u32 txrate; | 1892 | u32 txrate; |
1905 | u32 chan; | 1893 | u32 chan; |
1906 | char *txratename; | 1894 | char *txratename; |
1907 | u8 bssid[ETH_ALEN]; | 1895 | u8 bssid[ETH_ALEN]; |
1908 | 1896 | ||
1909 | /* | 1897 | /* |
1910 | * TBD: BSSID is usually 00:00:00:00:00:00 here and not | 1898 | * TBD: BSSID is usually 00:00:00:00:00:00 here and not |
@@ -1918,16 +1906,15 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1918 | essid, &essid_len); | 1906 | essid, &essid_len); |
1919 | if (ret) { | 1907 | if (ret) { |
1920 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1908 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1921 | __LINE__); | 1909 | __LINE__); |
1922 | return; | 1910 | return; |
1923 | } | 1911 | } |
1924 | 1912 | ||
1925 | len = sizeof(u32); | 1913 | len = sizeof(u32); |
1926 | ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, | 1914 | ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); |
1927 | &txrate, &len); | ||
1928 | if (ret) { | 1915 | if (ret) { |
1929 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1916 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1930 | __LINE__); | 1917 | __LINE__); |
1931 | return; | 1918 | return; |
1932 | } | 1919 | } |
1933 | 1920 | ||
@@ -1935,19 +1922,18 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1935 | ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); | 1922 | ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); |
1936 | if (ret) { | 1923 | if (ret) { |
1937 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1924 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1938 | __LINE__); | 1925 | __LINE__); |
1939 | return; | 1926 | return; |
1940 | } | 1927 | } |
1941 | len = ETH_ALEN; | 1928 | len = ETH_ALEN; |
1942 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); | 1929 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); |
1943 | if (ret) { | 1930 | if (ret) { |
1944 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", | 1931 | IPW_DEBUG_INFO("failed querying ordinals at line %d\n", |
1945 | __LINE__); | 1932 | __LINE__); |
1946 | return; | 1933 | return; |
1947 | } | 1934 | } |
1948 | memcpy(priv->ieee->bssid, bssid, ETH_ALEN); | 1935 | memcpy(priv->ieee->bssid, bssid, ETH_ALEN); |
1949 | 1936 | ||
1950 | |||
1951 | switch (txrate) { | 1937 | switch (txrate) { |
1952 | case TX_RATE_1_MBIT: | 1938 | case TX_RATE_1_MBIT: |
1953 | txratename = "1Mbps"; | 1939 | txratename = "1Mbps"; |
@@ -1974,7 +1960,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1974 | 1960 | ||
1975 | /* now we copy read ssid into dev */ | 1961 | /* now we copy read ssid into dev */ |
1976 | if (!(priv->config & CFG_STATIC_ESSID)) { | 1962 | if (!(priv->config & CFG_STATIC_ESSID)) { |
1977 | priv->essid_len = min((u8)essid_len, (u8)IW_ESSID_MAX_SIZE); | 1963 | priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); |
1978 | memcpy(priv->essid, essid, priv->essid_len); | 1964 | memcpy(priv->essid, essid, priv->essid_len); |
1979 | } | 1965 | } |
1980 | priv->channel = chan; | 1966 | priv->channel = chan; |
@@ -1986,7 +1972,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) | |||
1986 | queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); | 1972 | queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); |
1987 | } | 1973 | } |
1988 | 1974 | ||
1989 | |||
1990 | static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | 1975 | static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, |
1991 | int length, int batch_mode) | 1976 | int length, int batch_mode) |
1992 | { | 1977 | { |
@@ -2001,8 +1986,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2001 | IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); | 1986 | IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); |
2002 | 1987 | ||
2003 | if (ssid_len) | 1988 | if (ssid_len) |
2004 | memcpy((char*)cmd.host_command_parameters, | 1989 | memcpy(cmd.host_command_parameters, essid, ssid_len); |
2005 | essid, ssid_len); | ||
2006 | 1990 | ||
2007 | if (!batch_mode) { | 1991 | if (!batch_mode) { |
2008 | err = ipw2100_disable_adapter(priv); | 1992 | err = ipw2100_disable_adapter(priv); |
@@ -2014,7 +1998,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2014 | * disable auto association -- so we cheat by setting a bogus SSID */ | 1998 | * disable auto association -- so we cheat by setting a bogus SSID */ |
2015 | if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { | 1999 | if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { |
2016 | int i; | 2000 | int i; |
2017 | u8 *bogus = (u8*)cmd.host_command_parameters; | 2001 | u8 *bogus = (u8 *) cmd.host_command_parameters; |
2018 | for (i = 0; i < IW_ESSID_MAX_SIZE; i++) | 2002 | for (i = 0; i < IW_ESSID_MAX_SIZE; i++) |
2019 | bogus[i] = 0x18 + i; | 2003 | bogus[i] = 0x18 + i; |
2020 | cmd.host_command_length = IW_ESSID_MAX_SIZE; | 2004 | cmd.host_command_length = IW_ESSID_MAX_SIZE; |
@@ -2025,8 +2009,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, | |||
2025 | 2009 | ||
2026 | err = ipw2100_hw_send_command(priv, &cmd); | 2010 | err = ipw2100_hw_send_command(priv, &cmd); |
2027 | if (!err) { | 2011 | if (!err) { |
2028 | memset(priv->essid + ssid_len, 0, | 2012 | memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); |
2029 | IW_ESSID_MAX_SIZE - ssid_len); | ||
2030 | memcpy(priv->essid, essid, ssid_len); | 2013 | memcpy(priv->essid, essid, ssid_len); |
2031 | priv->essid_len = ssid_len; | 2014 | priv->essid_len = ssid_len; |
2032 | } | 2015 | } |
@@ -2071,14 +2054,14 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) | |||
2071 | static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) | 2054 | static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) |
2072 | { | 2055 | { |
2073 | IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", | 2056 | IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", |
2074 | priv->net_dev->name); | 2057 | priv->net_dev->name); |
2075 | 2058 | ||
2076 | /* RF_KILL is now enabled (else we wouldn't be here) */ | 2059 | /* RF_KILL is now enabled (else we wouldn't be here) */ |
2077 | priv->status |= STATUS_RF_KILL_HW; | 2060 | priv->status |= STATUS_RF_KILL_HW; |
2078 | 2061 | ||
2079 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 2062 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
2080 | if (priv->config & CFG_C3_DISABLED) { | 2063 | if (priv->config & CFG_C3_DISABLED) { |
2081 | IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); | 2064 | IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); |
2082 | acpi_set_cstate_limit(priv->cstate_limit); | 2065 | acpi_set_cstate_limit(priv->cstate_limit); |
2083 | priv->config &= ~CFG_C3_DISABLED; | 2066 | priv->config &= ~CFG_C3_DISABLED; |
2084 | } | 2067 | } |
@@ -2102,16 +2085,16 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) | |||
2102 | #define IPW2100_HANDLER(v, f) { v, f, # v } | 2085 | #define IPW2100_HANDLER(v, f) { v, f, # v } |
2103 | struct ipw2100_status_indicator { | 2086 | struct ipw2100_status_indicator { |
2104 | int status; | 2087 | int status; |
2105 | void (*cb)(struct ipw2100_priv *priv, u32 status); | 2088 | void (*cb) (struct ipw2100_priv * priv, u32 status); |
2106 | char *name; | 2089 | char *name; |
2107 | }; | 2090 | }; |
2108 | #else | 2091 | #else |
2109 | #define IPW2100_HANDLER(v, f) { v, f } | 2092 | #define IPW2100_HANDLER(v, f) { v, f } |
2110 | struct ipw2100_status_indicator { | 2093 | struct ipw2100_status_indicator { |
2111 | int status; | 2094 | int status; |
2112 | void (*cb)(struct ipw2100_priv *priv, u32 status); | 2095 | void (*cb) (struct ipw2100_priv * priv, u32 status); |
2113 | }; | 2096 | }; |
2114 | #endif /* CONFIG_IPW_DEBUG */ | 2097 | #endif /* CONFIG_IPW_DEBUG */ |
2115 | 2098 | ||
2116 | static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) | 2099 | static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) |
2117 | { | 2100 | { |
@@ -2135,7 +2118,6 @@ static const struct ipw2100_status_indicator status_handlers[] = { | |||
2135 | IPW2100_HANDLER(-1, NULL) | 2118 | IPW2100_HANDLER(-1, NULL) |
2136 | }; | 2119 | }; |
2137 | 2120 | ||
2138 | |||
2139 | static void isr_status_change(struct ipw2100_priv *priv, int status) | 2121 | static void isr_status_change(struct ipw2100_priv *priv, int status) |
2140 | { | 2122 | { |
2141 | int i; | 2123 | int i; |
@@ -2153,7 +2135,7 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) | |||
2153 | for (i = 0; status_handlers[i].status != -1; i++) { | 2135 | for (i = 0; status_handlers[i].status != -1; i++) { |
2154 | if (status == status_handlers[i].status) { | 2136 | if (status == status_handlers[i].status) { |
2155 | IPW_DEBUG_NOTIF("Status change: %s\n", | 2137 | IPW_DEBUG_NOTIF("Status change: %s\n", |
2156 | status_handlers[i].name); | 2138 | status_handlers[i].name); |
2157 | if (status_handlers[i].cb) | 2139 | if (status_handlers[i].cb) |
2158 | status_handlers[i].cb(priv, status); | 2140 | status_handlers[i].cb(priv, status); |
2159 | priv->wstats.status = status; | 2141 | priv->wstats.status = status; |
@@ -2164,9 +2146,8 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) | |||
2164 | IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); | 2146 | IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); |
2165 | } | 2147 | } |
2166 | 2148 | ||
2167 | static void isr_rx_complete_command( | 2149 | static void isr_rx_complete_command(struct ipw2100_priv *priv, |
2168 | struct ipw2100_priv *priv, | 2150 | struct ipw2100_cmd_header *cmd) |
2169 | struct ipw2100_cmd_header *cmd) | ||
2170 | { | 2151 | { |
2171 | #ifdef CONFIG_IPW_DEBUG | 2152 | #ifdef CONFIG_IPW_DEBUG |
2172 | if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { | 2153 | if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { |
@@ -2196,10 +2177,8 @@ static const char *frame_types[] = { | |||
2196 | }; | 2177 | }; |
2197 | #endif | 2178 | #endif |
2198 | 2179 | ||
2199 | 2180 | static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv, | |
2200 | static inline int ipw2100_alloc_skb( | 2181 | struct ipw2100_rx_packet *packet) |
2201 | struct ipw2100_priv *priv, | ||
2202 | struct ipw2100_rx_packet *packet) | ||
2203 | { | 2182 | { |
2204 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); | 2183 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); |
2205 | if (!packet->skb) | 2184 | if (!packet->skb) |
@@ -2215,7 +2194,6 @@ static inline int ipw2100_alloc_skb( | |||
2215 | return 0; | 2194 | return 0; |
2216 | } | 2195 | } |
2217 | 2196 | ||
2218 | |||
2219 | #define SEARCH_ERROR 0xffffffff | 2197 | #define SEARCH_ERROR 0xffffffff |
2220 | #define SEARCH_FAIL 0xfffffffe | 2198 | #define SEARCH_FAIL 0xfffffffe |
2221 | #define SEARCH_SUCCESS 0xfffffff0 | 2199 | #define SEARCH_SUCCESS 0xfffffff0 |
@@ -2229,10 +2207,10 @@ static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | |||
2229 | if (priv->snapshot[0]) | 2207 | if (priv->snapshot[0]) |
2230 | return 1; | 2208 | return 1; |
2231 | for (i = 0; i < 0x30; i++) { | 2209 | for (i = 0; i < 0x30; i++) { |
2232 | priv->snapshot[i] = (u8*)kmalloc(0x1000, GFP_ATOMIC); | 2210 | priv->snapshot[i] = (u8 *) kmalloc(0x1000, GFP_ATOMIC); |
2233 | if (!priv->snapshot[i]) { | 2211 | if (!priv->snapshot[i]) { |
2234 | IPW_DEBUG_INFO("%s: Error allocating snapshot " | 2212 | IPW_DEBUG_INFO("%s: Error allocating snapshot " |
2235 | "buffer %d\n", priv->net_dev->name, i); | 2213 | "buffer %d\n", priv->net_dev->name, i); |
2236 | while (i > 0) | 2214 | while (i > 0) |
2237 | kfree(priv->snapshot[--i]); | 2215 | kfree(priv->snapshot[--i]); |
2238 | priv->snapshot[0] = NULL; | 2216 | priv->snapshot[0] = NULL; |
@@ -2253,7 +2231,7 @@ static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv) | |||
2253 | priv->snapshot[0] = NULL; | 2231 | priv->snapshot[0] = NULL; |
2254 | } | 2232 | } |
2255 | 2233 | ||
2256 | static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | 2234 | static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, |
2257 | size_t len, int mode) | 2235 | size_t len, int mode) |
2258 | { | 2236 | { |
2259 | u32 i, j; | 2237 | u32 i, j; |
@@ -2270,9 +2248,9 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | |||
2270 | for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { | 2248 | for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { |
2271 | read_nic_dword(priv->net_dev, i, &tmp); | 2249 | read_nic_dword(priv->net_dev, i, &tmp); |
2272 | if (mode == SEARCH_SNAPSHOT) | 2250 | if (mode == SEARCH_SNAPSHOT) |
2273 | *(u32 *)SNAPSHOT_ADDR(i) = tmp; | 2251 | *(u32 *) SNAPSHOT_ADDR(i) = tmp; |
2274 | if (ret == SEARCH_FAIL) { | 2252 | if (ret == SEARCH_FAIL) { |
2275 | d = (u8*)&tmp; | 2253 | d = (u8 *) & tmp; |
2276 | for (j = 0; j < 4; j++) { | 2254 | for (j = 0; j < 4; j++) { |
2277 | if (*s != *d) { | 2255 | if (*s != *d) { |
2278 | s = in_buf; | 2256 | s = in_buf; |
@@ -2310,8 +2288,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, | |||
2310 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; | 2288 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; |
2311 | #endif | 2289 | #endif |
2312 | 2290 | ||
2313 | static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | 2291 | static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) |
2314 | int i) | ||
2315 | { | 2292 | { |
2316 | #ifdef CONFIG_IPW_DEBUG_C3 | 2293 | #ifdef CONFIG_IPW_DEBUG_C3 |
2317 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2294 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
@@ -2322,11 +2299,11 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2322 | int limit; | 2299 | int limit; |
2323 | #endif | 2300 | #endif |
2324 | 2301 | ||
2325 | IPW_DEBUG_INFO(DRV_NAME ": PCI latency error detected at " | 2302 | IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", |
2326 | "0x%04zX.\n", i * sizeof(struct ipw2100_status)); | 2303 | i * sizeof(struct ipw2100_status)); |
2327 | 2304 | ||
2328 | #ifdef ACPI_CSTATE_LIMIT_DEFINED | 2305 | #ifdef ACPI_CSTATE_LIMIT_DEFINED |
2329 | IPW_DEBUG_INFO(DRV_NAME ": Disabling C3 transitions.\n"); | 2306 | IPW_DEBUG_INFO(": Disabling C3 transitions.\n"); |
2330 | limit = acpi_get_cstate_limit(); | 2307 | limit = acpi_get_cstate_limit(); |
2331 | if (limit > 2) { | 2308 | if (limit > 2) { |
2332 | priv->cstate_limit = limit; | 2309 | priv->cstate_limit = limit; |
@@ -2346,9 +2323,9 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2346 | 2323 | ||
2347 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) | 2324 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) |
2348 | break; | 2325 | break; |
2349 | } while (j--); | 2326 | } while (j--); |
2350 | 2327 | ||
2351 | match = ipw2100_match_buf(priv, (u8*)status, | 2328 | match = ipw2100_match_buf(priv, (u8 *) status, |
2352 | sizeof(struct ipw2100_status), | 2329 | sizeof(struct ipw2100_status), |
2353 | SEARCH_SNAPSHOT); | 2330 | SEARCH_SNAPSHOT); |
2354 | if (match < SEARCH_SUCCESS) | 2331 | if (match < SEARCH_SUCCESS) |
@@ -2360,7 +2337,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, | |||
2360 | IPW_DEBUG_INFO("%s: No DMA status match in " | 2337 | IPW_DEBUG_INFO("%s: No DMA status match in " |
2361 | "Firmware.\n", priv->net_dev->name); | 2338 | "Firmware.\n", priv->net_dev->name); |
2362 | 2339 | ||
2363 | printk_buf((u8*)priv->status_queue.drv, | 2340 | printk_buf((u8 *) priv->status_queue.drv, |
2364 | sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); | 2341 | sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); |
2365 | #endif | 2342 | #endif |
2366 | 2343 | ||
@@ -2392,26 +2369,26 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, | |||
2392 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | 2369 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); |
2393 | return; | 2370 | return; |
2394 | } | 2371 | } |
2395 | 2372 | #ifdef CONFIG_IPW2100_MONITOR | |
2396 | if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && | 2373 | if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && |
2374 | priv->config & CFG_CRC_CHECK && | ||
2397 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { | 2375 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { |
2398 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); | 2376 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); |
2399 | priv->ieee->stats.rx_errors++; | 2377 | priv->ieee->stats.rx_errors++; |
2400 | return; | 2378 | return; |
2401 | } | 2379 | } |
2380 | #endif | ||
2402 | 2381 | ||
2403 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && | 2382 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && |
2404 | !(priv->status & STATUS_ASSOCIATED))) { | 2383 | !(priv->status & STATUS_ASSOCIATED))) { |
2405 | IPW_DEBUG_DROP("Dropping packet while not associated.\n"); | 2384 | IPW_DEBUG_DROP("Dropping packet while not associated.\n"); |
2406 | priv->wstats.discard.misc++; | 2385 | priv->wstats.discard.misc++; |
2407 | return; | 2386 | return; |
2408 | } | 2387 | } |
2409 | 2388 | ||
2410 | |||
2411 | pci_unmap_single(priv->pci_dev, | 2389 | pci_unmap_single(priv->pci_dev, |
2412 | packet->dma_addr, | 2390 | packet->dma_addr, |
2413 | sizeof(struct ipw2100_rx), | 2391 | sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); |
2414 | PCI_DMA_FROMDEVICE); | ||
2415 | 2392 | ||
2416 | skb_put(packet->skb, status->frame_size); | 2393 | skb_put(packet->skb, status->frame_size); |
2417 | 2394 | ||
@@ -2438,8 +2415,8 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, | |||
2438 | /* We need to allocate a new SKB and attach it to the RDB. */ | 2415 | /* We need to allocate a new SKB and attach it to the RDB. */ |
2439 | if (unlikely(ipw2100_alloc_skb(priv, packet))) { | 2416 | if (unlikely(ipw2100_alloc_skb(priv, packet))) { |
2440 | printk(KERN_WARNING DRV_NAME ": " | 2417 | printk(KERN_WARNING DRV_NAME ": " |
2441 | "%s: Unable to allocate SKB onto RBD ring - disabling " | 2418 | "%s: Unable to allocate SKB onto RBD ring - disabling " |
2442 | "adapter.\n", priv->net_dev->name); | 2419 | "adapter.\n", priv->net_dev->name); |
2443 | /* TODO: schedule adapter shutdown */ | 2420 | /* TODO: schedule adapter shutdown */ |
2444 | IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); | 2421 | IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); |
2445 | } | 2422 | } |
@@ -2534,11 +2511,11 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2534 | 2511 | ||
2535 | /* Sync the DMA for the STATUS buffer so CPU is sure to get | 2512 | /* Sync the DMA for the STATUS buffer so CPU is sure to get |
2536 | * the correct values */ | 2513 | * the correct values */ |
2537 | pci_dma_sync_single_for_cpu( | 2514 | pci_dma_sync_single_for_cpu(priv->pci_dev, |
2538 | priv->pci_dev, | 2515 | sq->nic + |
2539 | sq->nic + sizeof(struct ipw2100_status) * i, | 2516 | sizeof(struct ipw2100_status) * i, |
2540 | sizeof(struct ipw2100_status), | 2517 | sizeof(struct ipw2100_status), |
2541 | PCI_DMA_FROMDEVICE); | 2518 | PCI_DMA_FROMDEVICE); |
2542 | 2519 | ||
2543 | /* Sync the DMA for the RX buffer so CPU is sure to get | 2520 | /* Sync the DMA for the RX buffer so CPU is sure to get |
2544 | * the correct values */ | 2521 | * the correct values */ |
@@ -2552,8 +2529,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2552 | } | 2529 | } |
2553 | 2530 | ||
2554 | u = packet->rxp; | 2531 | u = packet->rxp; |
2555 | frame_type = sq->drv[i].status_fields & | 2532 | frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; |
2556 | STATUS_TYPE_MASK; | ||
2557 | stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; | 2533 | stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; |
2558 | stats.len = sq->drv[i].frame_size; | 2534 | stats.len = sq->drv[i].frame_size; |
2559 | 2535 | ||
@@ -2562,16 +2538,14 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2562 | stats.mask |= IEEE80211_STATMASK_RSSI; | 2538 | stats.mask |= IEEE80211_STATMASK_RSSI; |
2563 | stats.freq = IEEE80211_24GHZ_BAND; | 2539 | stats.freq = IEEE80211_24GHZ_BAND; |
2564 | 2540 | ||
2565 | IPW_DEBUG_RX( | 2541 | IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", |
2566 | "%s: '%s' frame type received (%d).\n", | 2542 | priv->net_dev->name, frame_types[frame_type], |
2567 | priv->net_dev->name, frame_types[frame_type], | 2543 | stats.len); |
2568 | stats.len); | ||
2569 | 2544 | ||
2570 | switch (frame_type) { | 2545 | switch (frame_type) { |
2571 | case COMMAND_STATUS_VAL: | 2546 | case COMMAND_STATUS_VAL: |
2572 | /* Reset Rx watchdog */ | 2547 | /* Reset Rx watchdog */ |
2573 | isr_rx_complete_command( | 2548 | isr_rx_complete_command(priv, &u->rx_data.command); |
2574 | priv, &u->rx_data.command); | ||
2575 | break; | 2549 | break; |
2576 | 2550 | ||
2577 | case STATUS_CHANGE_VAL: | 2551 | case STATUS_CHANGE_VAL: |
@@ -2588,12 +2562,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2588 | #endif | 2562 | #endif |
2589 | if (stats.len < sizeof(u->rx_data.header)) | 2563 | if (stats.len < sizeof(u->rx_data.header)) |
2590 | break; | 2564 | break; |
2591 | switch (WLAN_FC_GET_TYPE(u->rx_data.header. | 2565 | switch (WLAN_FC_GET_TYPE(u->rx_data.header.frame_ctl)) { |
2592 | frame_ctl)) { | ||
2593 | case IEEE80211_FTYPE_MGMT: | 2566 | case IEEE80211_FTYPE_MGMT: |
2594 | ieee80211_rx_mgt(priv->ieee, | 2567 | ieee80211_rx_mgt(priv->ieee, |
2595 | &u->rx_data.header, | 2568 | &u->rx_data.header, &stats); |
2596 | &stats); | ||
2597 | break; | 2569 | break; |
2598 | 2570 | ||
2599 | case IEEE80211_FTYPE_CTL: | 2571 | case IEEE80211_FTYPE_CTL: |
@@ -2607,7 +2579,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2607 | break; | 2579 | break; |
2608 | } | 2580 | } |
2609 | 2581 | ||
2610 | increment: | 2582 | increment: |
2611 | /* clear status field associated with this RBD */ | 2583 | /* clear status field associated with this RBD */ |
2612 | rxq->drv[i].status.info.field = 0; | 2584 | rxq->drv[i].status.info.field = 0; |
2613 | 2585 | ||
@@ -2619,12 +2591,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2619 | rxq->next = (i ? i : rxq->entries) - 1; | 2591 | rxq->next = (i ? i : rxq->entries) - 1; |
2620 | 2592 | ||
2621 | write_register(priv->net_dev, | 2593 | write_register(priv->net_dev, |
2622 | IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, | 2594 | IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); |
2623 | rxq->next); | ||
2624 | } | 2595 | } |
2625 | } | 2596 | } |
2626 | 2597 | ||
2627 | |||
2628 | /* | 2598 | /* |
2629 | * __ipw2100_tx_process | 2599 | * __ipw2100_tx_process |
2630 | * | 2600 | * |
@@ -2667,7 +2637,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2667 | static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | 2637 | static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) |
2668 | { | 2638 | { |
2669 | struct ipw2100_bd_queue *txq = &priv->tx_queue; | 2639 | struct ipw2100_bd_queue *txq = &priv->tx_queue; |
2670 | struct ipw2100_bd *tbd; | 2640 | struct ipw2100_bd *tbd; |
2671 | struct list_head *element; | 2641 | struct list_head *element; |
2672 | struct ipw2100_tx_packet *packet; | 2642 | struct ipw2100_tx_packet *packet; |
2673 | int descriptors_used; | 2643 | int descriptors_used; |
@@ -2680,7 +2650,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2680 | element = priv->fw_pend_list.next; | 2650 | element = priv->fw_pend_list.next; |
2681 | 2651 | ||
2682 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 2652 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2683 | tbd = &txq->drv[packet->index]; | 2653 | tbd = &txq->drv[packet->index]; |
2684 | 2654 | ||
2685 | /* Determine how many TBD entries must be finished... */ | 2655 | /* Determine how many TBD entries must be finished... */ |
2686 | switch (packet->type) { | 2656 | switch (packet->type) { |
@@ -2693,14 +2663,14 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2693 | case DATA: | 2663 | case DATA: |
2694 | /* DATA uses two slots; advance and loop position. */ | 2664 | /* DATA uses two slots; advance and loop position. */ |
2695 | descriptors_used = tbd->num_fragments; | 2665 | descriptors_used = tbd->num_fragments; |
2696 | frag_num = tbd->num_fragments - 1; | 2666 | frag_num = tbd->num_fragments - 1; |
2697 | e = txq->oldest + frag_num; | 2667 | e = txq->oldest + frag_num; |
2698 | e %= txq->entries; | 2668 | e %= txq->entries; |
2699 | break; | 2669 | break; |
2700 | 2670 | ||
2701 | default: | 2671 | default: |
2702 | printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", | 2672 | printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", |
2703 | priv->net_dev->name); | 2673 | priv->net_dev->name); |
2704 | return 0; | 2674 | return 0; |
2705 | } | 2675 | } |
2706 | 2676 | ||
@@ -2716,13 +2686,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2716 | printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", | 2686 | printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", |
2717 | priv->net_dev->name); | 2687 | priv->net_dev->name); |
2718 | 2688 | ||
2719 | /* | 2689 | /* |
2720 | * txq->next is the index of the last packet written txq->oldest is | 2690 | * txq->next is the index of the last packet written txq->oldest is |
2721 | * the index of the r is the index of the next packet to be read by | 2691 | * the index of the r is the index of the next packet to be read by |
2722 | * firmware | 2692 | * firmware |
2723 | */ | 2693 | */ |
2724 | 2694 | ||
2725 | |||
2726 | /* | 2695 | /* |
2727 | * Quick graphic to help you visualize the following | 2696 | * Quick graphic to help you visualize the following |
2728 | * if / else statement | 2697 | * if / else statement |
@@ -2750,23 +2719,20 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2750 | #ifdef CONFIG_IPW_DEBUG | 2719 | #ifdef CONFIG_IPW_DEBUG |
2751 | { | 2720 | { |
2752 | int i = txq->oldest; | 2721 | int i = txq->oldest; |
2753 | IPW_DEBUG_TX( | 2722 | IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, |
2754 | "TX%d V=%p P=%04X T=%04X L=%d\n", i, | 2723 | &txq->drv[i], |
2755 | &txq->drv[i], | 2724 | (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), |
2756 | (u32)(txq->nic + i * sizeof(struct ipw2100_bd)), | 2725 | txq->drv[i].host_addr, txq->drv[i].buf_length); |
2757 | txq->drv[i].host_addr, | ||
2758 | txq->drv[i].buf_length); | ||
2759 | 2726 | ||
2760 | if (packet->type == DATA) { | 2727 | if (packet->type == DATA) { |
2761 | i = (i + 1) % txq->entries; | 2728 | i = (i + 1) % txq->entries; |
2762 | 2729 | ||
2763 | IPW_DEBUG_TX( | 2730 | IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, |
2764 | "TX%d V=%p P=%04X T=%04X L=%d\n", i, | 2731 | &txq->drv[i], |
2765 | &txq->drv[i], | 2732 | (u32) (txq->nic + i * |
2766 | (u32)(txq->nic + i * | 2733 | sizeof(struct ipw2100_bd)), |
2767 | sizeof(struct ipw2100_bd)), | 2734 | (u32) txq->drv[i].host_addr, |
2768 | (u32)txq->drv[i].host_addr, | 2735 | txq->drv[i].buf_length); |
2769 | txq->drv[i].buf_length); | ||
2770 | } | 2736 | } |
2771 | } | 2737 | } |
2772 | #endif | 2738 | #endif |
@@ -2780,23 +2746,18 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2780 | priv->net_dev->name, txq->oldest, packet->index); | 2746 | priv->net_dev->name, txq->oldest, packet->index); |
2781 | 2747 | ||
2782 | /* DATA packet; we have to unmap and free the SKB */ | 2748 | /* DATA packet; we have to unmap and free the SKB */ |
2783 | priv->ieee->stats.tx_packets++; | ||
2784 | for (i = 0; i < frag_num; i++) { | 2749 | for (i = 0; i < frag_num; i++) { |
2785 | tbd = &txq->drv[(packet->index + 1 + i) % | 2750 | tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; |
2786 | txq->entries]; | ||
2787 | 2751 | ||
2788 | IPW_DEBUG_TX( | 2752 | IPW_DEBUG_TX("TX%d P=%08x L=%d\n", |
2789 | "TX%d P=%08x L=%d\n", | 2753 | (packet->index + 1 + i) % txq->entries, |
2790 | (packet->index + 1 + i) % txq->entries, | 2754 | tbd->host_addr, tbd->buf_length); |
2791 | tbd->host_addr, tbd->buf_length); | ||
2792 | 2755 | ||
2793 | pci_unmap_single(priv->pci_dev, | 2756 | pci_unmap_single(priv->pci_dev, |
2794 | tbd->host_addr, | 2757 | tbd->host_addr, |
2795 | tbd->buf_length, | 2758 | tbd->buf_length, PCI_DMA_TODEVICE); |
2796 | PCI_DMA_TODEVICE); | ||
2797 | } | 2759 | } |
2798 | 2760 | ||
2799 | priv->ieee->stats.tx_bytes += packet->info.d_struct.txb->payload_size; | ||
2800 | ieee80211_txb_free(packet->info.d_struct.txb); | 2761 | ieee80211_txb_free(packet->info.d_struct.txb); |
2801 | packet->info.d_struct.txb = NULL; | 2762 | packet->info.d_struct.txb = NULL; |
2802 | 2763 | ||
@@ -2805,13 +2766,8 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2805 | 2766 | ||
2806 | /* We have a free slot in the Tx queue, so wake up the | 2767 | /* We have a free slot in the Tx queue, so wake up the |
2807 | * transmit layer if it is stopped. */ | 2768 | * transmit layer if it is stopped. */ |
2808 | if (priv->status & STATUS_ASSOCIATED && | 2769 | if (priv->status & STATUS_ASSOCIATED) |
2809 | netif_queue_stopped(priv->net_dev)) { | ||
2810 | IPW_DEBUG_INFO(KERN_INFO | ||
2811 | "%s: Waking net queue.\n", | ||
2812 | priv->net_dev->name); | ||
2813 | netif_wake_queue(priv->net_dev); | 2770 | netif_wake_queue(priv->net_dev); |
2814 | } | ||
2815 | 2771 | ||
2816 | /* A packet was processed by the hardware, so update the | 2772 | /* A packet was processed by the hardware, so update the |
2817 | * watchdog */ | 2773 | * watchdog */ |
@@ -2829,11 +2785,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2829 | #ifdef CONFIG_IPW_DEBUG | 2785 | #ifdef CONFIG_IPW_DEBUG |
2830 | if (packet->info.c_struct.cmd->host_command_reg < | 2786 | if (packet->info.c_struct.cmd->host_command_reg < |
2831 | sizeof(command_types) / sizeof(*command_types)) | 2787 | sizeof(command_types) / sizeof(*command_types)) |
2832 | IPW_DEBUG_TX( | 2788 | IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", |
2833 | "Command '%s (%d)' processed: %d.\n", | 2789 | command_types[packet->info.c_struct.cmd-> |
2834 | command_types[packet->info.c_struct.cmd->host_command_reg], | 2790 | host_command_reg], |
2835 | packet->info.c_struct.cmd->host_command_reg, | 2791 | packet->info.c_struct.cmd-> |
2836 | packet->info.c_struct.cmd->cmd_status_reg); | 2792 | host_command_reg, |
2793 | packet->info.c_struct.cmd->cmd_status_reg); | ||
2837 | #endif | 2794 | #endif |
2838 | 2795 | ||
2839 | list_add_tail(element, &priv->msg_free_list); | 2796 | list_add_tail(element, &priv->msg_free_list); |
@@ -2848,17 +2805,17 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | |||
2848 | SET_STAT(&priv->txq_stat, txq->available); | 2805 | SET_STAT(&priv->txq_stat, txq->available); |
2849 | 2806 | ||
2850 | IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", | 2807 | IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", |
2851 | jiffies - packet->jiffy_start); | 2808 | jiffies - packet->jiffy_start); |
2852 | 2809 | ||
2853 | return (!list_empty(&priv->fw_pend_list)); | 2810 | return (!list_empty(&priv->fw_pend_list)); |
2854 | } | 2811 | } |
2855 | 2812 | ||
2856 | |||
2857 | static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) | 2813 | static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) |
2858 | { | 2814 | { |
2859 | int i = 0; | 2815 | int i = 0; |
2860 | 2816 | ||
2861 | while (__ipw2100_tx_process(priv) && i < 200) i++; | 2817 | while (__ipw2100_tx_process(priv) && i < 200) |
2818 | i++; | ||
2862 | 2819 | ||
2863 | if (i == 200) { | 2820 | if (i == 200) { |
2864 | printk(KERN_WARNING DRV_NAME ": " | 2821 | printk(KERN_WARNING DRV_NAME ": " |
@@ -2867,7 +2824,6 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) | |||
2867 | } | 2824 | } |
2868 | } | 2825 | } |
2869 | 2826 | ||
2870 | |||
2871 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | 2827 | static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) |
2872 | { | 2828 | { |
2873 | struct list_head *element; | 2829 | struct list_head *element; |
@@ -2892,13 +2848,12 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2892 | list_del(element); | 2848 | list_del(element); |
2893 | DEC_STAT(&priv->msg_pend_stat); | 2849 | DEC_STAT(&priv->msg_pend_stat); |
2894 | 2850 | ||
2895 | packet = list_entry(element, | 2851 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2896 | struct ipw2100_tx_packet, list); | ||
2897 | 2852 | ||
2898 | IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", | 2853 | IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", |
2899 | &txq->drv[txq->next], | 2854 | &txq->drv[txq->next], |
2900 | (void*)(txq->nic + txq->next * | 2855 | (void *)(txq->nic + txq->next * |
2901 | sizeof(struct ipw2100_bd))); | 2856 | sizeof(struct ipw2100_bd))); |
2902 | 2857 | ||
2903 | packet->index = txq->next; | 2858 | packet->index = txq->next; |
2904 | 2859 | ||
@@ -2911,8 +2866,8 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2911 | * with f/w debug version */ | 2866 | * with f/w debug version */ |
2912 | tbd->num_fragments = 1; | 2867 | tbd->num_fragments = 1; |
2913 | tbd->status.info.field = | 2868 | tbd->status.info.field = |
2914 | IPW_BD_STATUS_TX_FRAME_COMMAND | | 2869 | IPW_BD_STATUS_TX_FRAME_COMMAND | |
2915 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; | 2870 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; |
2916 | 2871 | ||
2917 | /* update TBD queue counters */ | 2872 | /* update TBD queue counters */ |
2918 | txq->next++; | 2873 | txq->next++; |
@@ -2934,7 +2889,6 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) | |||
2934 | } | 2889 | } |
2935 | } | 2890 | } |
2936 | 2891 | ||
2937 | |||
2938 | /* | 2892 | /* |
2939 | * ipw2100_tx_send_data | 2893 | * ipw2100_tx_send_data |
2940 | * | 2894 | * |
@@ -2946,7 +2900,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2946 | struct ipw2100_bd_queue *txq = &priv->tx_queue; | 2900 | struct ipw2100_bd_queue *txq = &priv->tx_queue; |
2947 | struct ipw2100_bd *tbd; | 2901 | struct ipw2100_bd *tbd; |
2948 | int next = txq->next; | 2902 | int next = txq->next; |
2949 | int i = 0; | 2903 | int i = 0; |
2950 | struct ipw2100_data_header *ipw_hdr; | 2904 | struct ipw2100_data_header *ipw_hdr; |
2951 | struct ieee80211_hdr_3addr *hdr; | 2905 | struct ieee80211_hdr_3addr *hdr; |
2952 | 2906 | ||
@@ -2958,20 +2912,18 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2958 | * maintained between the r and w indexes | 2912 | * maintained between the r and w indexes |
2959 | */ | 2913 | */ |
2960 | element = priv->tx_pend_list.next; | 2914 | element = priv->tx_pend_list.next; |
2961 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 2915 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
2962 | 2916 | ||
2963 | if (unlikely(1 + packet->info.d_struct.txb->nr_frags > | 2917 | if (unlikely(1 + packet->info.d_struct.txb->nr_frags > |
2964 | IPW_MAX_BDS)) { | 2918 | IPW_MAX_BDS)) { |
2965 | /* TODO: Support merging buffers if more than | 2919 | /* TODO: Support merging buffers if more than |
2966 | * IPW_MAX_BDS are used */ | 2920 | * IPW_MAX_BDS are used */ |
2967 | IPW_DEBUG_INFO( | 2921 | IPW_DEBUG_INFO("%s: Maximum BD theshold exceeded. " |
2968 | "%s: Maximum BD theshold exceeded. " | 2922 | "Increase fragmentation level.\n", |
2969 | "Increase fragmentation level.\n", | 2923 | priv->net_dev->name); |
2970 | priv->net_dev->name); | ||
2971 | } | 2924 | } |
2972 | 2925 | ||
2973 | if (txq->available <= 3 + | 2926 | if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { |
2974 | packet->info.d_struct.txb->nr_frags) { | ||
2975 | IPW_DEBUG_TX("no room in tx_queue\n"); | 2927 | IPW_DEBUG_TX("no room in tx_queue\n"); |
2976 | break; | 2928 | break; |
2977 | } | 2929 | } |
@@ -2985,7 +2937,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2985 | 2937 | ||
2986 | ipw_hdr = packet->info.d_struct.data; | 2938 | ipw_hdr = packet->info.d_struct.data; |
2987 | hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> | 2939 | hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> |
2988 | fragments[0]->data; | 2940 | fragments[0]->data; |
2989 | 2941 | ||
2990 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { | 2942 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { |
2991 | /* To DS: Addr1 = BSSID, Addr2 = SA, | 2943 | /* To DS: Addr1 = BSSID, Addr2 = SA, |
@@ -3007,7 +2959,8 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3007 | ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; | 2959 | ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; |
3008 | if (packet->info.d_struct.txb->nr_frags > 1) | 2960 | if (packet->info.d_struct.txb->nr_frags > 1) |
3009 | ipw_hdr->fragment_size = | 2961 | ipw_hdr->fragment_size = |
3010 | packet->info.d_struct.txb->frag_size - IEEE80211_3ADDR_LEN; | 2962 | packet->info.d_struct.txb->frag_size - |
2963 | IEEE80211_3ADDR_LEN; | ||
3011 | else | 2964 | else |
3012 | ipw_hdr->fragment_size = 0; | 2965 | ipw_hdr->fragment_size = 0; |
3013 | 2966 | ||
@@ -3015,54 +2968,53 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3015 | tbd->buf_length = sizeof(struct ipw2100_data_header); | 2968 | tbd->buf_length = sizeof(struct ipw2100_data_header); |
3016 | tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; | 2969 | tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; |
3017 | tbd->status.info.field = | 2970 | tbd->status.info.field = |
3018 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2971 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3019 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; | 2972 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; |
3020 | txq->next++; | 2973 | txq->next++; |
3021 | txq->next %= txq->entries; | 2974 | txq->next %= txq->entries; |
3022 | 2975 | ||
3023 | IPW_DEBUG_TX( | 2976 | IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", |
3024 | "data header tbd TX%d P=%08x L=%d\n", | 2977 | packet->index, tbd->host_addr, tbd->buf_length); |
3025 | packet->index, tbd->host_addr, | ||
3026 | tbd->buf_length); | ||
3027 | #ifdef CONFIG_IPW_DEBUG | 2978 | #ifdef CONFIG_IPW_DEBUG |
3028 | if (packet->info.d_struct.txb->nr_frags > 1) | 2979 | if (packet->info.d_struct.txb->nr_frags > 1) |
3029 | IPW_DEBUG_FRAG("fragment Tx: %d frames\n", | 2980 | IPW_DEBUG_FRAG("fragment Tx: %d frames\n", |
3030 | packet->info.d_struct.txb->nr_frags); | 2981 | packet->info.d_struct.txb->nr_frags); |
3031 | #endif | 2982 | #endif |
3032 | 2983 | ||
3033 | for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { | 2984 | for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { |
3034 | tbd = &txq->drv[txq->next]; | 2985 | tbd = &txq->drv[txq->next]; |
3035 | if (i == packet->info.d_struct.txb->nr_frags - 1) | 2986 | if (i == packet->info.d_struct.txb->nr_frags - 1) |
3036 | tbd->status.info.field = | 2987 | tbd->status.info.field = |
3037 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2988 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3038 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; | 2989 | IPW_BD_STATUS_TX_INTERRUPT_ENABLE; |
3039 | else | 2990 | else |
3040 | tbd->status.info.field = | 2991 | tbd->status.info.field = |
3041 | IPW_BD_STATUS_TX_FRAME_802_3 | | 2992 | IPW_BD_STATUS_TX_FRAME_802_3 | |
3042 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; | 2993 | IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; |
3043 | 2994 | ||
3044 | tbd->buf_length = packet->info.d_struct.txb-> | 2995 | tbd->buf_length = packet->info.d_struct.txb-> |
3045 | fragments[i]->len - IEEE80211_3ADDR_LEN; | 2996 | fragments[i]->len - IEEE80211_3ADDR_LEN; |
3046 | 2997 | ||
3047 | tbd->host_addr = pci_map_single( | 2998 | tbd->host_addr = pci_map_single(priv->pci_dev, |
3048 | priv->pci_dev, | 2999 | packet->info.d_struct. |
3049 | packet->info.d_struct.txb->fragments[i]->data + | 3000 | txb->fragments[i]-> |
3050 | IEEE80211_3ADDR_LEN, | 3001 | data + |
3051 | tbd->buf_length, | 3002 | IEEE80211_3ADDR_LEN, |
3052 | PCI_DMA_TODEVICE); | 3003 | tbd->buf_length, |
3004 | PCI_DMA_TODEVICE); | ||
3053 | 3005 | ||
3054 | IPW_DEBUG_TX( | 3006 | IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", |
3055 | "data frag tbd TX%d P=%08x L=%d\n", | 3007 | txq->next, tbd->host_addr, |
3056 | txq->next, tbd->host_addr, tbd->buf_length); | 3008 | tbd->buf_length); |
3057 | 3009 | ||
3058 | pci_dma_sync_single_for_device( | 3010 | pci_dma_sync_single_for_device(priv->pci_dev, |
3059 | priv->pci_dev, tbd->host_addr, | 3011 | tbd->host_addr, |
3060 | tbd->buf_length, | 3012 | tbd->buf_length, |
3061 | PCI_DMA_TODEVICE); | 3013 | PCI_DMA_TODEVICE); |
3062 | 3014 | ||
3063 | txq->next++; | 3015 | txq->next++; |
3064 | txq->next %= txq->entries; | 3016 | txq->next %= txq->entries; |
3065 | } | 3017 | } |
3066 | 3018 | ||
3067 | txq->available -= 1 + packet->info.d_struct.txb->nr_frags; | 3019 | txq->available -= 1 + packet->info.d_struct.txb->nr_frags; |
3068 | SET_STAT(&priv->txq_stat, txq->available); | 3020 | SET_STAT(&priv->txq_stat, txq->available); |
@@ -3078,7 +3030,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
3078 | IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, | 3030 | IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, |
3079 | txq->next); | 3031 | txq->next); |
3080 | } | 3032 | } |
3081 | return; | 3033 | return; |
3082 | } | 3034 | } |
3083 | 3035 | ||
3084 | static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | 3036 | static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) |
@@ -3106,11 +3058,9 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3106 | 3058 | ||
3107 | if (inta & IPW2100_INTA_FATAL_ERROR) { | 3059 | if (inta & IPW2100_INTA_FATAL_ERROR) { |
3108 | printk(KERN_WARNING DRV_NAME | 3060 | printk(KERN_WARNING DRV_NAME |
3109 | ": Fatal interrupt. Scheduling firmware restart.\n"); | 3061 | ": Fatal interrupt. Scheduling firmware restart.\n"); |
3110 | priv->inta_other++; | 3062 | priv->inta_other++; |
3111 | write_register( | 3063 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); |
3112 | dev, IPW_REG_INTA, | ||
3113 | IPW2100_INTA_FATAL_ERROR); | ||
3114 | 3064 | ||
3115 | read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); | 3065 | read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); |
3116 | IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", | 3066 | IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", |
@@ -3125,11 +3075,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3125 | } | 3075 | } |
3126 | 3076 | ||
3127 | if (inta & IPW2100_INTA_PARITY_ERROR) { | 3077 | if (inta & IPW2100_INTA_PARITY_ERROR) { |
3128 | printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n"); | 3078 | printk(KERN_ERR DRV_NAME |
3079 | ": ***** PARITY ERROR INTERRUPT !!!! \n"); | ||
3129 | priv->inta_other++; | 3080 | priv->inta_other++; |
3130 | write_register( | 3081 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); |
3131 | dev, IPW_REG_INTA, | ||
3132 | IPW2100_INTA_PARITY_ERROR); | ||
3133 | } | 3082 | } |
3134 | 3083 | ||
3135 | if (inta & IPW2100_INTA_RX_TRANSFER) { | 3084 | if (inta & IPW2100_INTA_RX_TRANSFER) { |
@@ -3137,9 +3086,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3137 | 3086 | ||
3138 | priv->rx_interrupts++; | 3087 | priv->rx_interrupts++; |
3139 | 3088 | ||
3140 | write_register( | 3089 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); |
3141 | dev, IPW_REG_INTA, | ||
3142 | IPW2100_INTA_RX_TRANSFER); | ||
3143 | 3090 | ||
3144 | __ipw2100_rx_process(priv); | 3091 | __ipw2100_rx_process(priv); |
3145 | __ipw2100_tx_complete(priv); | 3092 | __ipw2100_tx_complete(priv); |
@@ -3150,8 +3097,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3150 | 3097 | ||
3151 | priv->tx_interrupts++; | 3098 | priv->tx_interrupts++; |
3152 | 3099 | ||
3153 | write_register(dev, IPW_REG_INTA, | 3100 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); |
3154 | IPW2100_INTA_TX_TRANSFER); | ||
3155 | 3101 | ||
3156 | __ipw2100_tx_complete(priv); | 3102 | __ipw2100_tx_complete(priv); |
3157 | ipw2100_tx_send_commands(priv); | 3103 | ipw2100_tx_send_commands(priv); |
@@ -3161,9 +3107,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3161 | if (inta & IPW2100_INTA_TX_COMPLETE) { | 3107 | if (inta & IPW2100_INTA_TX_COMPLETE) { |
3162 | IPW_DEBUG_ISR("TX complete\n"); | 3108 | IPW_DEBUG_ISR("TX complete\n"); |
3163 | priv->inta_other++; | 3109 | priv->inta_other++; |
3164 | write_register( | 3110 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); |
3165 | dev, IPW_REG_INTA, | ||
3166 | IPW2100_INTA_TX_COMPLETE); | ||
3167 | 3111 | ||
3168 | __ipw2100_tx_complete(priv); | 3112 | __ipw2100_tx_complete(priv); |
3169 | } | 3113 | } |
@@ -3171,9 +3115,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3171 | if (inta & IPW2100_INTA_EVENT_INTERRUPT) { | 3115 | if (inta & IPW2100_INTA_EVENT_INTERRUPT) { |
3172 | /* ipw2100_handle_event(dev); */ | 3116 | /* ipw2100_handle_event(dev); */ |
3173 | priv->inta_other++; | 3117 | priv->inta_other++; |
3174 | write_register( | 3118 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); |
3175 | dev, IPW_REG_INTA, | ||
3176 | IPW2100_INTA_EVENT_INTERRUPT); | ||
3177 | } | 3119 | } |
3178 | 3120 | ||
3179 | if (inta & IPW2100_INTA_FW_INIT_DONE) { | 3121 | if (inta & IPW2100_INTA_FW_INIT_DONE) { |
@@ -3183,30 +3125,25 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3183 | read_register(dev, IPW_REG_INTA, &tmp); | 3125 | read_register(dev, IPW_REG_INTA, &tmp); |
3184 | if (tmp & (IPW2100_INTA_FATAL_ERROR | | 3126 | if (tmp & (IPW2100_INTA_FATAL_ERROR | |
3185 | IPW2100_INTA_PARITY_ERROR)) { | 3127 | IPW2100_INTA_PARITY_ERROR)) { |
3186 | write_register( | 3128 | write_register(dev, IPW_REG_INTA, |
3187 | dev, IPW_REG_INTA, | 3129 | IPW2100_INTA_FATAL_ERROR | |
3188 | IPW2100_INTA_FATAL_ERROR | | 3130 | IPW2100_INTA_PARITY_ERROR); |
3189 | IPW2100_INTA_PARITY_ERROR); | ||
3190 | } | 3131 | } |
3191 | 3132 | ||
3192 | write_register(dev, IPW_REG_INTA, | 3133 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); |
3193 | IPW2100_INTA_FW_INIT_DONE); | ||
3194 | } | 3134 | } |
3195 | 3135 | ||
3196 | if (inta & IPW2100_INTA_STATUS_CHANGE) { | 3136 | if (inta & IPW2100_INTA_STATUS_CHANGE) { |
3197 | IPW_DEBUG_ISR("Status change interrupt\n"); | 3137 | IPW_DEBUG_ISR("Status change interrupt\n"); |
3198 | priv->inta_other++; | 3138 | priv->inta_other++; |
3199 | write_register( | 3139 | write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); |
3200 | dev, IPW_REG_INTA, | ||
3201 | IPW2100_INTA_STATUS_CHANGE); | ||
3202 | } | 3140 | } |
3203 | 3141 | ||
3204 | if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { | 3142 | if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { |
3205 | IPW_DEBUG_ISR("slave host mode interrupt\n"); | 3143 | IPW_DEBUG_ISR("slave host mode interrupt\n"); |
3206 | priv->inta_other++; | 3144 | priv->inta_other++; |
3207 | write_register( | 3145 | write_register(dev, IPW_REG_INTA, |
3208 | dev, IPW_REG_INTA, | 3146 | IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); |
3209 | IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); | ||
3210 | } | 3147 | } |
3211 | 3148 | ||
3212 | priv->in_isr--; | 3149 | priv->in_isr--; |
@@ -3217,9 +3154,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) | |||
3217 | IPW_DEBUG_ISR("exit\n"); | 3154 | IPW_DEBUG_ISR("exit\n"); |
3218 | } | 3155 | } |
3219 | 3156 | ||
3220 | 3157 | static irqreturn_t ipw2100_interrupt(int irq, void *data, struct pt_regs *regs) | |
3221 | static irqreturn_t ipw2100_interrupt(int irq, void *data, | ||
3222 | struct pt_regs *regs) | ||
3223 | { | 3158 | { |
3224 | struct ipw2100_priv *priv = data; | 3159 | struct ipw2100_priv *priv = data; |
3225 | u32 inta, inta_mask; | 3160 | u32 inta, inta_mask; |
@@ -3227,7 +3162,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, | |||
3227 | if (!data) | 3162 | if (!data) |
3228 | return IRQ_NONE; | 3163 | return IRQ_NONE; |
3229 | 3164 | ||
3230 | spin_lock(&priv->low_lock); | 3165 | spin_lock(&priv->low_lock); |
3231 | 3166 | ||
3232 | /* We check to see if we should be ignoring interrupts before | 3167 | /* We check to see if we should be ignoring interrupts before |
3233 | * we touch the hardware. During ucode load if we try and handle | 3168 | * we touch the hardware. During ucode load if we try and handle |
@@ -3261,10 +3196,10 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, | |||
3261 | ipw2100_disable_interrupts(priv); | 3196 | ipw2100_disable_interrupts(priv); |
3262 | 3197 | ||
3263 | tasklet_schedule(&priv->irq_tasklet); | 3198 | tasklet_schedule(&priv->irq_tasklet); |
3264 | spin_unlock(&priv->low_lock); | 3199 | spin_unlock(&priv->low_lock); |
3265 | 3200 | ||
3266 | return IRQ_HANDLED; | 3201 | return IRQ_HANDLED; |
3267 | none: | 3202 | none: |
3268 | spin_unlock(&priv->low_lock); | 3203 | spin_unlock(&priv->low_lock); |
3269 | return IRQ_NONE; | 3204 | return IRQ_NONE; |
3270 | } | 3205 | } |
@@ -3294,10 +3229,8 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, | |||
3294 | 3229 | ||
3295 | packet->info.d_struct.txb = txb; | 3230 | packet->info.d_struct.txb = txb; |
3296 | 3231 | ||
3297 | IPW_DEBUG_TX("Sending fragment (%d bytes):\n", | 3232 | IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); |
3298 | txb->fragments[0]->len); | 3233 | printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); |
3299 | printk_buf(IPW_DL_TX, txb->fragments[0]->data, | ||
3300 | txb->fragments[0]->len); | ||
3301 | 3234 | ||
3302 | packet->jiffy_start = jiffies; | 3235 | packet->jiffy_start = jiffies; |
3303 | 3236 | ||
@@ -3312,22 +3245,23 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, | |||
3312 | spin_unlock_irqrestore(&priv->low_lock, flags); | 3245 | spin_unlock_irqrestore(&priv->low_lock, flags); |
3313 | return 0; | 3246 | return 0; |
3314 | 3247 | ||
3315 | fail_unlock: | 3248 | fail_unlock: |
3316 | netif_stop_queue(dev); | 3249 | netif_stop_queue(dev); |
3317 | spin_unlock_irqrestore(&priv->low_lock, flags); | 3250 | spin_unlock_irqrestore(&priv->low_lock, flags); |
3318 | return 1; | 3251 | return 1; |
3319 | } | 3252 | } |
3320 | 3253 | ||
3321 | |||
3322 | static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | 3254 | static int ipw2100_msg_allocate(struct ipw2100_priv *priv) |
3323 | { | 3255 | { |
3324 | int i, j, err = -EINVAL; | 3256 | int i, j, err = -EINVAL; |
3325 | void *v; | 3257 | void *v; |
3326 | dma_addr_t p; | 3258 | dma_addr_t p; |
3327 | 3259 | ||
3328 | priv->msg_buffers = (struct ipw2100_tx_packet *)kmalloc( | 3260 | priv->msg_buffers = |
3329 | IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), | 3261 | (struct ipw2100_tx_packet *)kmalloc(IPW_COMMAND_POOL_SIZE * |
3330 | GFP_KERNEL); | 3262 | sizeof(struct |
3263 | ipw2100_tx_packet), | ||
3264 | GFP_KERNEL); | ||
3331 | if (!priv->msg_buffers) { | 3265 | if (!priv->msg_buffers) { |
3332 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " | 3266 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " |
3333 | "buffers.\n", priv->net_dev->name); | 3267 | "buffers.\n", priv->net_dev->name); |
@@ -3335,15 +3269,12 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3335 | } | 3269 | } |
3336 | 3270 | ||
3337 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { | 3271 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { |
3338 | v = pci_alloc_consistent( | 3272 | v = pci_alloc_consistent(priv->pci_dev, |
3339 | priv->pci_dev, | 3273 | sizeof(struct ipw2100_cmd_header), &p); |
3340 | sizeof(struct ipw2100_cmd_header), | ||
3341 | &p); | ||
3342 | if (!v) { | 3274 | if (!v) { |
3343 | printk(KERN_ERR DRV_NAME ": " | 3275 | printk(KERN_ERR DRV_NAME ": " |
3344 | "%s: PCI alloc failed for msg " | 3276 | "%s: PCI alloc failed for msg " |
3345 | "buffers.\n", | 3277 | "buffers.\n", priv->net_dev->name); |
3346 | priv->net_dev->name); | ||
3347 | err = -ENOMEM; | 3278 | err = -ENOMEM; |
3348 | break; | 3279 | break; |
3349 | } | 3280 | } |
@@ -3352,7 +3283,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3352 | 3283 | ||
3353 | priv->msg_buffers[i].type = COMMAND; | 3284 | priv->msg_buffers[i].type = COMMAND; |
3354 | priv->msg_buffers[i].info.c_struct.cmd = | 3285 | priv->msg_buffers[i].info.c_struct.cmd = |
3355 | (struct ipw2100_cmd_header*)v; | 3286 | (struct ipw2100_cmd_header *)v; |
3356 | priv->msg_buffers[i].info.c_struct.cmd_phys = p; | 3287 | priv->msg_buffers[i].info.c_struct.cmd_phys = p; |
3357 | } | 3288 | } |
3358 | 3289 | ||
@@ -3360,11 +3291,11 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) | |||
3360 | return 0; | 3291 | return 0; |
3361 | 3292 | ||
3362 | for (j = 0; j < i; j++) { | 3293 | for (j = 0; j < i; j++) { |
3363 | pci_free_consistent( | 3294 | pci_free_consistent(priv->pci_dev, |
3364 | priv->pci_dev, | 3295 | sizeof(struct ipw2100_cmd_header), |
3365 | sizeof(struct ipw2100_cmd_header), | 3296 | priv->msg_buffers[j].info.c_struct.cmd, |
3366 | priv->msg_buffers[j].info.c_struct.cmd, | 3297 | priv->msg_buffers[j].info.c_struct. |
3367 | priv->msg_buffers[j].info.c_struct.cmd_phys); | 3298 | cmd_phys); |
3368 | } | 3299 | } |
3369 | 3300 | ||
3370 | kfree(priv->msg_buffers); | 3301 | kfree(priv->msg_buffers); |
@@ -3398,7 +3329,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv) | |||
3398 | pci_free_consistent(priv->pci_dev, | 3329 | pci_free_consistent(priv->pci_dev, |
3399 | sizeof(struct ipw2100_cmd_header), | 3330 | sizeof(struct ipw2100_cmd_header), |
3400 | priv->msg_buffers[i].info.c_struct.cmd, | 3331 | priv->msg_buffers[i].info.c_struct.cmd, |
3401 | priv->msg_buffers[i].info.c_struct.cmd_phys); | 3332 | priv->msg_buffers[i].info.c_struct. |
3333 | cmd_phys); | ||
3402 | } | 3334 | } |
3403 | 3335 | ||
3404 | kfree(priv->msg_buffers); | 3336 | kfree(priv->msg_buffers); |
@@ -3424,6 +3356,7 @@ static ssize_t show_pci(struct device *d, struct device_attribute *attr, | |||
3424 | 3356 | ||
3425 | return out - buf; | 3357 | return out - buf; |
3426 | } | 3358 | } |
3359 | |||
3427 | static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); | 3360 | static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); |
3428 | 3361 | ||
3429 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | 3362 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, |
@@ -3432,209 +3365,269 @@ static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | |||
3432 | struct ipw2100_priv *p = d->driver_data; | 3365 | struct ipw2100_priv *p = d->driver_data; |
3433 | return sprintf(buf, "0x%08x\n", (int)p->config); | 3366 | return sprintf(buf, "0x%08x\n", (int)p->config); |
3434 | } | 3367 | } |
3368 | |||
3435 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | 3369 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); |
3436 | 3370 | ||
3437 | static ssize_t show_status(struct device *d, struct device_attribute *attr, | 3371 | static ssize_t show_status(struct device *d, struct device_attribute *attr, |
3438 | char *buf) | 3372 | char *buf) |
3439 | { | 3373 | { |
3440 | struct ipw2100_priv *p = d->driver_data; | 3374 | struct ipw2100_priv *p = d->driver_data; |
3441 | return sprintf(buf, "0x%08x\n", (int)p->status); | 3375 | return sprintf(buf, "0x%08x\n", (int)p->status); |
3442 | } | 3376 | } |
3377 | |||
3443 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 3378 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
3444 | 3379 | ||
3445 | static ssize_t show_capability(struct device *d, struct device_attribute *attr, | 3380 | static ssize_t show_capability(struct device *d, struct device_attribute *attr, |
3446 | char *buf) | 3381 | char *buf) |
3447 | { | 3382 | { |
3448 | struct ipw2100_priv *p = d->driver_data; | 3383 | struct ipw2100_priv *p = d->driver_data; |
3449 | return sprintf(buf, "0x%08x\n", (int)p->capability); | 3384 | return sprintf(buf, "0x%08x\n", (int)p->capability); |
3450 | } | 3385 | } |
3451 | static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); | ||
3452 | 3386 | ||
3387 | static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); | ||
3453 | 3388 | ||
3454 | #define IPW2100_REG(x) { IPW_ ##x, #x } | 3389 | #define IPW2100_REG(x) { IPW_ ##x, #x } |
3455 | static const struct { | 3390 | static const struct { |
3456 | u32 addr; | 3391 | u32 addr; |
3457 | const char *name; | 3392 | const char *name; |
3458 | } hw_data[] = { | 3393 | } hw_data[] = { |
3459 | IPW2100_REG(REG_GP_CNTRL), | 3394 | IPW2100_REG(REG_GP_CNTRL), |
3460 | IPW2100_REG(REG_GPIO), | 3395 | IPW2100_REG(REG_GPIO), |
3461 | IPW2100_REG(REG_INTA), | 3396 | IPW2100_REG(REG_INTA), |
3462 | IPW2100_REG(REG_INTA_MASK), | 3397 | IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; |
3463 | IPW2100_REG(REG_RESET_REG), | ||
3464 | }; | ||
3465 | #define IPW2100_NIC(x, s) { x, #x, s } | 3398 | #define IPW2100_NIC(x, s) { x, #x, s } |
3466 | static const struct { | 3399 | static const struct { |
3467 | u32 addr; | 3400 | u32 addr; |
3468 | const char *name; | 3401 | const char *name; |
3469 | size_t size; | 3402 | size_t size; |
3470 | } nic_data[] = { | 3403 | } nic_data[] = { |
3471 | IPW2100_NIC(IPW2100_CONTROL_REG, 2), | 3404 | IPW2100_NIC(IPW2100_CONTROL_REG, 2), |
3472 | IPW2100_NIC(0x210014, 1), | 3405 | IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; |
3473 | IPW2100_NIC(0x210000, 1), | ||
3474 | }; | ||
3475 | #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } | 3406 | #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } |
3476 | static const struct { | 3407 | static const struct { |
3477 | u8 index; | 3408 | u8 index; |
3478 | const char *name; | 3409 | const char *name; |
3479 | const char *desc; | 3410 | const char *desc; |
3480 | } ord_data[] = { | 3411 | } ord_data[] = { |
3481 | IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), | 3412 | IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), |
3482 | IPW2100_ORD(STAT_TX_HOST_COMPLETE, "successful Host Tx's (MSDU)"), | 3413 | IPW2100_ORD(STAT_TX_HOST_COMPLETE, |
3483 | IPW2100_ORD(STAT_TX_DIR_DATA, "successful Directed Tx's (MSDU)"), | 3414 | "successful Host Tx's (MSDU)"), |
3484 | IPW2100_ORD(STAT_TX_DIR_DATA1, "successful Directed Tx's (MSDU) @ 1MB"), | 3415 | IPW2100_ORD(STAT_TX_DIR_DATA, |
3485 | IPW2100_ORD(STAT_TX_DIR_DATA2, "successful Directed Tx's (MSDU) @ 2MB"), | 3416 | "successful Directed Tx's (MSDU)"), |
3486 | IPW2100_ORD(STAT_TX_DIR_DATA5_5, "successful Directed Tx's (MSDU) @ 5_5MB"), | 3417 | IPW2100_ORD(STAT_TX_DIR_DATA1, |
3487 | IPW2100_ORD(STAT_TX_DIR_DATA11, "successful Directed Tx's (MSDU) @ 11MB"), | 3418 | "successful Directed Tx's (MSDU) @ 1MB"), |
3488 | IPW2100_ORD(STAT_TX_NODIR_DATA1, "successful Non_Directed Tx's (MSDU) @ 1MB"), | 3419 | IPW2100_ORD(STAT_TX_DIR_DATA2, |
3489 | IPW2100_ORD(STAT_TX_NODIR_DATA2, "successful Non_Directed Tx's (MSDU) @ 2MB"), | 3420 | "successful Directed Tx's (MSDU) @ 2MB"), |
3490 | IPW2100_ORD(STAT_TX_NODIR_DATA5_5, "successful Non_Directed Tx's (MSDU) @ 5.5MB"), | 3421 | IPW2100_ORD(STAT_TX_DIR_DATA5_5, |
3491 | IPW2100_ORD(STAT_TX_NODIR_DATA11, "successful Non_Directed Tx's (MSDU) @ 11MB"), | 3422 | "successful Directed Tx's (MSDU) @ 5_5MB"), |
3492 | IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), | 3423 | IPW2100_ORD(STAT_TX_DIR_DATA11, |
3493 | IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), | 3424 | "successful Directed Tx's (MSDU) @ 11MB"), |
3494 | IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), | 3425 | IPW2100_ORD(STAT_TX_NODIR_DATA1, |
3495 | IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), | 3426 | "successful Non_Directed Tx's (MSDU) @ 1MB"), |
3496 | IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), | 3427 | IPW2100_ORD(STAT_TX_NODIR_DATA2, |
3497 | IPW2100_ORD(STAT_TX_ASSN_RESP, "successful Association response Tx's"), | 3428 | "successful Non_Directed Tx's (MSDU) @ 2MB"), |
3498 | IPW2100_ORD(STAT_TX_REASSN, "successful Reassociation Tx's"), | 3429 | IPW2100_ORD(STAT_TX_NODIR_DATA5_5, |
3499 | IPW2100_ORD(STAT_TX_REASSN_RESP, "successful Reassociation response Tx's"), | 3430 | "successful Non_Directed Tx's (MSDU) @ 5.5MB"), |
3500 | IPW2100_ORD(STAT_TX_PROBE, "probes successfully transmitted"), | 3431 | IPW2100_ORD(STAT_TX_NODIR_DATA11, |
3501 | IPW2100_ORD(STAT_TX_PROBE_RESP, "probe responses successfully transmitted"), | 3432 | "successful Non_Directed Tx's (MSDU) @ 11MB"), |
3502 | IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), | 3433 | IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), |
3503 | IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), | 3434 | IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), |
3504 | IPW2100_ORD(STAT_TX_DISASSN, "successful Disassociation TX"), | 3435 | IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), |
3505 | IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), | 3436 | IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), |
3506 | IPW2100_ORD(STAT_TX_DEAUTH, "successful Deauthentication TX"), | 3437 | IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), |
3507 | IPW2100_ORD(STAT_TX_TOTAL_BYTES, "Total successful Tx data bytes"), | 3438 | IPW2100_ORD(STAT_TX_ASSN_RESP, |
3508 | IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), | 3439 | "successful Association response Tx's"), |
3509 | IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), | 3440 | IPW2100_ORD(STAT_TX_REASSN, |
3510 | IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), | 3441 | "successful Reassociation Tx's"), |
3511 | IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), | 3442 | IPW2100_ORD(STAT_TX_REASSN_RESP, |
3512 | IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), | 3443 | "successful Reassociation response Tx's"), |
3513 | IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), | 3444 | IPW2100_ORD(STAT_TX_PROBE, |
3514 | IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP,"times max tries in a hop failed"), | 3445 | "probes successfully transmitted"), |
3515 | IPW2100_ORD(STAT_TX_DISASSN_FAIL, "times disassociation failed"), | 3446 | IPW2100_ORD(STAT_TX_PROBE_RESP, |
3516 | IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), | 3447 | "probe responses successfully transmitted"), |
3517 | IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), | 3448 | IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), |
3518 | IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), | 3449 | IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), |
3519 | IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), | 3450 | IPW2100_ORD(STAT_TX_DISASSN, |
3520 | IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), | 3451 | "successful Disassociation TX"), |
3521 | IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), | 3452 | IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), |
3522 | IPW2100_ORD(STAT_RX_DIR_DATA5_5, "directed packets at 5.5MB"), | 3453 | IPW2100_ORD(STAT_TX_DEAUTH, |
3523 | IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), | 3454 | "successful Deauthentication TX"), |
3524 | IPW2100_ORD(STAT_RX_NODIR_DATA,"nondirected packets"), | 3455 | IPW2100_ORD(STAT_TX_TOTAL_BYTES, |
3525 | IPW2100_ORD(STAT_RX_NODIR_DATA1, "nondirected packets at 1MB"), | 3456 | "Total successful Tx data bytes"), |
3526 | IPW2100_ORD(STAT_RX_NODIR_DATA2, "nondirected packets at 2MB"), | 3457 | IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), |
3527 | IPW2100_ORD(STAT_RX_NODIR_DATA5_5, "nondirected packets at 5.5MB"), | 3458 | IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), |
3528 | IPW2100_ORD(STAT_RX_NODIR_DATA11, "nondirected packets at 11MB"), | 3459 | IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), |
3529 | IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), | 3460 | IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), |
3530 | IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), | 3461 | IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), |
3531 | IPW2100_ORD(STAT_RX_CTS, "Rx CTS"), | 3462 | IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), |
3532 | IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), | 3463 | IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, |
3533 | IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), | 3464 | "times max tries in a hop failed"), |
3534 | IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), | 3465 | IPW2100_ORD(STAT_TX_DISASSN_FAIL, |
3535 | IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), | 3466 | "times disassociation failed"), |
3536 | IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), | 3467 | IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), |
3537 | IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), | 3468 | IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), |
3538 | IPW2100_ORD(STAT_RX_REASSN_RESP, "Reassociation response Rx's"), | 3469 | IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), |
3539 | IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), | 3470 | IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), |
3540 | IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), | 3471 | IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), |
3541 | IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), | 3472 | IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), |
3542 | IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), | 3473 | IPW2100_ORD(STAT_RX_DIR_DATA5_5, |
3543 | IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), | 3474 | "directed packets at 5.5MB"), |
3544 | IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), | 3475 | IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), |
3545 | IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), | 3476 | IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), |
3546 | IPW2100_ORD(STAT_RX_TOTAL_BYTES,"Total rx data bytes received"), | 3477 | IPW2100_ORD(STAT_RX_NODIR_DATA1, |
3547 | IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), | 3478 | "nondirected packets at 1MB"), |
3548 | IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), | 3479 | IPW2100_ORD(STAT_RX_NODIR_DATA2, |
3549 | IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), | 3480 | "nondirected packets at 2MB"), |
3550 | IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), | 3481 | IPW2100_ORD(STAT_RX_NODIR_DATA5_5, |
3551 | IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), | 3482 | "nondirected packets at 5.5MB"), |
3552 | IPW2100_ORD(STAT_RX_DUPLICATE1, "duplicate rx packets at 1MB"), | 3483 | IPW2100_ORD(STAT_RX_NODIR_DATA11, |
3553 | IPW2100_ORD(STAT_RX_DUPLICATE2, "duplicate rx packets at 2MB"), | 3484 | "nondirected packets at 11MB"), |
3554 | IPW2100_ORD(STAT_RX_DUPLICATE5_5, "duplicate rx packets at 5.5MB"), | 3485 | IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), |
3555 | IPW2100_ORD(STAT_RX_DUPLICATE11, "duplicate rx packets at 11MB"), | 3486 | IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, |
3556 | IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), | 3487 | "Rx CTS"), |
3557 | IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), | 3488 | IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), |
3558 | IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), | 3489 | IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), |
3559 | IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), | 3490 | IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), |
3560 | IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, "rx frames with invalid protocol"), | 3491 | IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), |
3561 | IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), | 3492 | IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), |
3562 | IPW2100_ORD(STAT_RX_NO_BUFFER, "rx frames rejected due to no buffer"), | 3493 | IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), |
3563 | IPW2100_ORD(STAT_RX_MISSING_FRAG, "rx frames dropped due to missing fragment"), | 3494 | IPW2100_ORD(STAT_RX_REASSN_RESP, |
3564 | IPW2100_ORD(STAT_RX_ORPHAN_FRAG, "rx frames dropped due to non-sequential fragment"), | 3495 | "Reassociation response Rx's"), |
3565 | IPW2100_ORD(STAT_RX_ORPHAN_FRAME, "rx frames dropped due to unmatched 1st frame"), | 3496 | IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), |
3566 | IPW2100_ORD(STAT_RX_FRAG_AGEOUT, "rx frames dropped due to uncompleted frame"), | 3497 | IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), |
3567 | IPW2100_ORD(STAT_RX_ICV_ERRORS, "ICV errors during decryption"), | 3498 | IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), |
3568 | IPW2100_ORD(STAT_PSP_SUSPENSION,"times adapter suspended"), | 3499 | IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), |
3569 | IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), | 3500 | IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), |
3570 | IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, "poll response timeouts"), | 3501 | IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), |
3571 | IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, "timeouts waiting for last {broad,multi}cast pkt"), | 3502 | IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), |
3572 | IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), | 3503 | IPW2100_ORD(STAT_RX_TOTAL_BYTES, |
3573 | IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), | 3504 | "Total rx data bytes received"), |
3574 | IPW2100_ORD(STAT_PSP_STATION_ID,"PSP Station ID"), | 3505 | IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), |
3575 | IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), | 3506 | IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), |
3576 | IPW2100_ORD(STAT_PERCENT_MISSED_BCNS,"current calculation of % missed beacons"), | 3507 | IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), |
3577 | IPW2100_ORD(STAT_PERCENT_RETRIES,"current calculation of % missed tx retries"), | 3508 | IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), |
3578 | IPW2100_ORD(ASSOCIATED_AP_PTR, "0 if not associated, else pointer to AP table entry"), | 3509 | IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), |
3579 | IPW2100_ORD(AVAILABLE_AP_CNT, "AP's decsribed in the AP table"), | 3510 | IPW2100_ORD(STAT_RX_DUPLICATE1, |
3580 | IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), | 3511 | "duplicate rx packets at 1MB"), |
3581 | IPW2100_ORD(STAT_AP_ASSNS, "associations"), | 3512 | IPW2100_ORD(STAT_RX_DUPLICATE2, |
3582 | IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), | 3513 | "duplicate rx packets at 2MB"), |
3583 | IPW2100_ORD(STAT_ASSN_RESP_FAIL,"failures due to response fail"), | 3514 | IPW2100_ORD(STAT_RX_DUPLICATE5_5, |
3584 | IPW2100_ORD(STAT_FULL_SCANS, "full scans"), | 3515 | "duplicate rx packets at 5.5MB"), |
3585 | IPW2100_ORD(CARD_DISABLED, "Card Disabled"), | 3516 | IPW2100_ORD(STAT_RX_DUPLICATE11, |
3586 | IPW2100_ORD(STAT_ROAM_INHIBIT, "times roaming was inhibited due to activity"), | 3517 | "duplicate rx packets at 11MB"), |
3587 | IPW2100_ORD(RSSI_AT_ASSN, "RSSI of associated AP at time of association"), | 3518 | IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), |
3588 | IPW2100_ORD(STAT_ASSN_CAUSE1, "reassociation: no probe response or TX on hop"), | 3519 | IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), |
3589 | IPW2100_ORD(STAT_ASSN_CAUSE2, "reassociation: poor tx/rx quality"), | 3520 | IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), |
3590 | IPW2100_ORD(STAT_ASSN_CAUSE3, "reassociation: tx/rx quality (excessive AP load"), | 3521 | IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), |
3591 | IPW2100_ORD(STAT_ASSN_CAUSE4, "reassociation: AP RSSI level"), | 3522 | IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, |
3592 | IPW2100_ORD(STAT_ASSN_CAUSE5, "reassociations due to load leveling"), | 3523 | "rx frames with invalid protocol"), |
3593 | IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), | 3524 | IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), |
3594 | IPW2100_ORD(STAT_AUTH_RESP_FAIL,"times authentication response failed"), | 3525 | IPW2100_ORD(STAT_RX_NO_BUFFER, |
3595 | IPW2100_ORD(STATION_TABLE_CNT, "entries in association table"), | 3526 | "rx frames rejected due to no buffer"), |
3596 | IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), | 3527 | IPW2100_ORD(STAT_RX_MISSING_FRAG, |
3597 | IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), | 3528 | "rx frames dropped due to missing fragment"), |
3598 | IPW2100_ORD(COUNTRY_CODE, "IEEE country code as recv'd from beacon"), | 3529 | IPW2100_ORD(STAT_RX_ORPHAN_FRAG, |
3599 | IPW2100_ORD(COUNTRY_CHANNELS, "channels suported by country"), | 3530 | "rx frames dropped due to non-sequential fragment"), |
3600 | IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), | 3531 | IPW2100_ORD(STAT_RX_ORPHAN_FRAME, |
3601 | IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), | 3532 | "rx frames dropped due to unmatched 1st frame"), |
3602 | IPW2100_ORD(ANTENNA_DIVERSITY, "TRUE if antenna diversity is disabled"), | 3533 | IPW2100_ORD(STAT_RX_FRAG_AGEOUT, |
3603 | IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), | 3534 | "rx frames dropped due to uncompleted frame"), |
3604 | IPW2100_ORD(OUR_FREQ, "current radio freq lower digits - channel ID"), | 3535 | IPW2100_ORD(STAT_RX_ICV_ERRORS, |
3605 | IPW2100_ORD(RTC_TIME, "current RTC time"), | 3536 | "ICV errors during decryption"), |
3606 | IPW2100_ORD(PORT_TYPE, "operating mode"), | 3537 | IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), |
3607 | IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), | 3538 | IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), |
3608 | IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), | 3539 | IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, |
3609 | IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), | 3540 | "poll response timeouts"), |
3610 | IPW2100_ORD(BASIC_RATES, "basic tx rates"), | 3541 | IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, |
3611 | IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), | 3542 | "timeouts waiting for last {broad,multi}cast pkt"), |
3612 | IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), | 3543 | IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), |
3613 | IPW2100_ORD(CAPABILITIES, "Management frame capability field"), | 3544 | IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), |
3614 | IPW2100_ORD(AUTH_TYPE, "Type of authentication"), | 3545 | IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), |
3615 | IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), | 3546 | IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), |
3616 | IPW2100_ORD(RTS_THRESHOLD, "Min packet length for RTS handshaking"), | 3547 | IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, |
3617 | IPW2100_ORD(INT_MODE, "International mode"), | 3548 | "current calculation of % missed beacons"), |
3618 | IPW2100_ORD(FRAGMENTATION_THRESHOLD, "protocol frag threshold"), | 3549 | IPW2100_ORD(STAT_PERCENT_RETRIES, |
3619 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, "EEPROM offset in SRAM"), | 3550 | "current calculation of % missed tx retries"), |
3620 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, "EEPROM size in SRAM"), | 3551 | IPW2100_ORD(ASSOCIATED_AP_PTR, |
3621 | IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), | 3552 | "0 if not associated, else pointer to AP table entry"), |
3622 | IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, "EEPROM IBSS 11b channel set"), | 3553 | IPW2100_ORD(AVAILABLE_AP_CNT, |
3623 | IPW2100_ORD(MAC_VERSION, "MAC Version"), | 3554 | "AP's decsribed in the AP table"), |
3624 | IPW2100_ORD(MAC_REVISION, "MAC Revision"), | 3555 | IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), |
3625 | IPW2100_ORD(RADIO_VERSION, "Radio Version"), | 3556 | IPW2100_ORD(STAT_AP_ASSNS, "associations"), |
3626 | IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), | 3557 | IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), |
3627 | IPW2100_ORD(UCODE_VERSION, "Ucode Version"), | 3558 | IPW2100_ORD(STAT_ASSN_RESP_FAIL, |
3628 | }; | 3559 | "failures due to response fail"), |
3629 | 3560 | IPW2100_ORD(STAT_FULL_SCANS, "full scans"), | |
3561 | IPW2100_ORD(CARD_DISABLED, "Card Disabled"), | ||
3562 | IPW2100_ORD(STAT_ROAM_INHIBIT, | ||
3563 | "times roaming was inhibited due to activity"), | ||
3564 | IPW2100_ORD(RSSI_AT_ASSN, | ||
3565 | "RSSI of associated AP at time of association"), | ||
3566 | IPW2100_ORD(STAT_ASSN_CAUSE1, | ||
3567 | "reassociation: no probe response or TX on hop"), | ||
3568 | IPW2100_ORD(STAT_ASSN_CAUSE2, | ||
3569 | "reassociation: poor tx/rx quality"), | ||
3570 | IPW2100_ORD(STAT_ASSN_CAUSE3, | ||
3571 | "reassociation: tx/rx quality (excessive AP load"), | ||
3572 | IPW2100_ORD(STAT_ASSN_CAUSE4, | ||
3573 | "reassociation: AP RSSI level"), | ||
3574 | IPW2100_ORD(STAT_ASSN_CAUSE5, | ||
3575 | "reassociations due to load leveling"), | ||
3576 | IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), | ||
3577 | IPW2100_ORD(STAT_AUTH_RESP_FAIL, | ||
3578 | "times authentication response failed"), | ||
3579 | IPW2100_ORD(STATION_TABLE_CNT, | ||
3580 | "entries in association table"), | ||
3581 | IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), | ||
3582 | IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), | ||
3583 | IPW2100_ORD(COUNTRY_CODE, | ||
3584 | "IEEE country code as recv'd from beacon"), | ||
3585 | IPW2100_ORD(COUNTRY_CHANNELS, | ||
3586 | "channels suported by country"), | ||
3587 | IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), | ||
3588 | IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), | ||
3589 | IPW2100_ORD(ANTENNA_DIVERSITY, | ||
3590 | "TRUE if antenna diversity is disabled"), | ||
3591 | IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), | ||
3592 | IPW2100_ORD(OUR_FREQ, | ||
3593 | "current radio freq lower digits - channel ID"), | ||
3594 | IPW2100_ORD(RTC_TIME, "current RTC time"), | ||
3595 | IPW2100_ORD(PORT_TYPE, "operating mode"), | ||
3596 | IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), | ||
3597 | IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), | ||
3598 | IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), | ||
3599 | IPW2100_ORD(BASIC_RATES, "basic tx rates"), | ||
3600 | IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), | ||
3601 | IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), | ||
3602 | IPW2100_ORD(CAPABILITIES, | ||
3603 | "Management frame capability field"), | ||
3604 | IPW2100_ORD(AUTH_TYPE, "Type of authentication"), | ||
3605 | IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), | ||
3606 | IPW2100_ORD(RTS_THRESHOLD, | ||
3607 | "Min packet length for RTS handshaking"), | ||
3608 | IPW2100_ORD(INT_MODE, "International mode"), | ||
3609 | IPW2100_ORD(FRAGMENTATION_THRESHOLD, | ||
3610 | "protocol frag threshold"), | ||
3611 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, | ||
3612 | "EEPROM offset in SRAM"), | ||
3613 | IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, | ||
3614 | "EEPROM size in SRAM"), | ||
3615 | IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), | ||
3616 | IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, | ||
3617 | "EEPROM IBSS 11b channel set"), | ||
3618 | IPW2100_ORD(MAC_VERSION, "MAC Version"), | ||
3619 | IPW2100_ORD(MAC_REVISION, "MAC Revision"), | ||
3620 | IPW2100_ORD(RADIO_VERSION, "Radio Version"), | ||
3621 | IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), | ||
3622 | IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; | ||
3630 | 3623 | ||
3631 | static ssize_t show_registers(struct device *d, struct device_attribute *attr, | 3624 | static ssize_t show_registers(struct device *d, struct device_attribute *attr, |
3632 | char *buf) | 3625 | char *buf) |
3633 | { | 3626 | { |
3634 | int i; | 3627 | int i; |
3635 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3628 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3636 | struct net_device *dev = priv->net_dev; | 3629 | struct net_device *dev = priv->net_dev; |
3637 | char * out = buf; | 3630 | char *out = buf; |
3638 | u32 val = 0; | 3631 | u32 val = 0; |
3639 | 3632 | ||
3640 | out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); | 3633 | out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); |
@@ -3647,15 +3640,15 @@ static ssize_t show_registers(struct device *d, struct device_attribute *attr, | |||
3647 | 3640 | ||
3648 | return out - buf; | 3641 | return out - buf; |
3649 | } | 3642 | } |
3650 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
3651 | 3643 | ||
3644 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
3652 | 3645 | ||
3653 | static ssize_t show_hardware(struct device *d, struct device_attribute *attr, | 3646 | static ssize_t show_hardware(struct device *d, struct device_attribute *attr, |
3654 | char *buf) | 3647 | char *buf) |
3655 | { | 3648 | { |
3656 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3649 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3657 | struct net_device *dev = priv->net_dev; | 3650 | struct net_device *dev = priv->net_dev; |
3658 | char * out = buf; | 3651 | char *out = buf; |
3659 | int i; | 3652 | int i; |
3660 | 3653 | ||
3661 | out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); | 3654 | out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); |
@@ -3688,11 +3681,11 @@ static ssize_t show_hardware(struct device *d, struct device_attribute *attr, | |||
3688 | } | 3681 | } |
3689 | return out - buf; | 3682 | return out - buf; |
3690 | } | 3683 | } |
3691 | static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); | ||
3692 | 3684 | ||
3685 | static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); | ||
3693 | 3686 | ||
3694 | static ssize_t show_memory(struct device *d, struct device_attribute *attr, | 3687 | static ssize_t show_memory(struct device *d, struct device_attribute *attr, |
3695 | char *buf) | 3688 | char *buf) |
3696 | { | 3689 | { |
3697 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3690 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3698 | struct net_device *dev = priv->net_dev; | 3691 | struct net_device *dev = priv->net_dev; |
@@ -3708,10 +3701,13 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3708 | /* sysfs provides us PAGE_SIZE buffer */ | 3701 | /* sysfs provides us PAGE_SIZE buffer */ |
3709 | while (len < PAGE_SIZE - 128 && loop < 0x30000) { | 3702 | while (len < PAGE_SIZE - 128 && loop < 0x30000) { |
3710 | 3703 | ||
3711 | if (priv->snapshot[0]) for (i = 0; i < 4; i++) | 3704 | if (priv->snapshot[0]) |
3712 | buffer[i] = *(u32 *)SNAPSHOT_ADDR(loop + i * 4); | 3705 | for (i = 0; i < 4; i++) |
3713 | else for (i = 0; i < 4; i++) | 3706 | buffer[i] = |
3714 | read_nic_dword(dev, loop + i * 4, &buffer[i]); | 3707 | *(u32 *) SNAPSHOT_ADDR(loop + i * 4); |
3708 | else | ||
3709 | for (i = 0; i < 4; i++) | ||
3710 | read_nic_dword(dev, loop + i * 4, &buffer[i]); | ||
3715 | 3711 | ||
3716 | if (priv->dump_raw) | 3712 | if (priv->dump_raw) |
3717 | len += sprintf(buf + len, | 3713 | len += sprintf(buf + len, |
@@ -3719,26 +3715,26 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3719 | "%c%c%c%c" | 3715 | "%c%c%c%c" |
3720 | "%c%c%c%c" | 3716 | "%c%c%c%c" |
3721 | "%c%c%c%c", | 3717 | "%c%c%c%c", |
3722 | ((u8*)buffer)[0x0], | 3718 | ((u8 *) buffer)[0x0], |
3723 | ((u8*)buffer)[0x1], | 3719 | ((u8 *) buffer)[0x1], |
3724 | ((u8*)buffer)[0x2], | 3720 | ((u8 *) buffer)[0x2], |
3725 | ((u8*)buffer)[0x3], | 3721 | ((u8 *) buffer)[0x3], |
3726 | ((u8*)buffer)[0x4], | 3722 | ((u8 *) buffer)[0x4], |
3727 | ((u8*)buffer)[0x5], | 3723 | ((u8 *) buffer)[0x5], |
3728 | ((u8*)buffer)[0x6], | 3724 | ((u8 *) buffer)[0x6], |
3729 | ((u8*)buffer)[0x7], | 3725 | ((u8 *) buffer)[0x7], |
3730 | ((u8*)buffer)[0x8], | 3726 | ((u8 *) buffer)[0x8], |
3731 | ((u8*)buffer)[0x9], | 3727 | ((u8 *) buffer)[0x9], |
3732 | ((u8*)buffer)[0xa], | 3728 | ((u8 *) buffer)[0xa], |
3733 | ((u8*)buffer)[0xb], | 3729 | ((u8 *) buffer)[0xb], |
3734 | ((u8*)buffer)[0xc], | 3730 | ((u8 *) buffer)[0xc], |
3735 | ((u8*)buffer)[0xd], | 3731 | ((u8 *) buffer)[0xd], |
3736 | ((u8*)buffer)[0xe], | 3732 | ((u8 *) buffer)[0xe], |
3737 | ((u8*)buffer)[0xf]); | 3733 | ((u8 *) buffer)[0xf]); |
3738 | else | 3734 | else |
3739 | len += sprintf(buf + len, "%s\n", | 3735 | len += sprintf(buf + len, "%s\n", |
3740 | snprint_line(line, sizeof(line), | 3736 | snprint_line(line, sizeof(line), |
3741 | (u8*)buffer, 16, loop)); | 3737 | (u8 *) buffer, 16, loop)); |
3742 | loop += 16; | 3738 | loop += 16; |
3743 | } | 3739 | } |
3744 | 3740 | ||
@@ -3746,44 +3742,44 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, | |||
3746 | } | 3742 | } |
3747 | 3743 | ||
3748 | static ssize_t store_memory(struct device *d, struct device_attribute *attr, | 3744 | static ssize_t store_memory(struct device *d, struct device_attribute *attr, |
3749 | const char *buf, size_t count) | 3745 | const char *buf, size_t count) |
3750 | { | 3746 | { |
3751 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3747 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3752 | struct net_device *dev = priv->net_dev; | 3748 | struct net_device *dev = priv->net_dev; |
3753 | const char *p = buf; | 3749 | const char *p = buf; |
3754 | 3750 | ||
3751 | (void) dev; /* kill unused-var warning for debug-only code */ | ||
3752 | |||
3755 | if (count < 1) | 3753 | if (count < 1) |
3756 | return count; | 3754 | return count; |
3757 | 3755 | ||
3758 | if (p[0] == '1' || | 3756 | if (p[0] == '1' || |
3759 | (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { | 3757 | (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { |
3760 | IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", | 3758 | IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", |
3761 | dev->name); | 3759 | dev->name); |
3762 | priv->dump_raw = 1; | 3760 | priv->dump_raw = 1; |
3763 | 3761 | ||
3764 | } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && | 3762 | } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && |
3765 | tolower(p[1]) == 'f')) { | 3763 | tolower(p[1]) == 'f')) { |
3766 | IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", | 3764 | IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", |
3767 | dev->name); | 3765 | dev->name); |
3768 | priv->dump_raw = 0; | 3766 | priv->dump_raw = 0; |
3769 | 3767 | ||
3770 | } else if (tolower(p[0]) == 'r') { | 3768 | } else if (tolower(p[0]) == 'r') { |
3771 | IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", | 3769 | IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); |
3772 | dev->name); | ||
3773 | ipw2100_snapshot_free(priv); | 3770 | ipw2100_snapshot_free(priv); |
3774 | 3771 | ||
3775 | } else | 3772 | } else |
3776 | IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " | 3773 | IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " |
3777 | "reset = clear memory snapshot\n", | 3774 | "reset = clear memory snapshot\n", dev->name); |
3778 | dev->name); | ||
3779 | 3775 | ||
3780 | return count; | 3776 | return count; |
3781 | } | 3777 | } |
3782 | static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory); | ||
3783 | 3778 | ||
3779 | static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); | ||
3784 | 3780 | ||
3785 | static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | 3781 | static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, |
3786 | char *buf) | 3782 | char *buf) |
3787 | { | 3783 | { |
3788 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3784 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3789 | u32 val = 0; | 3785 | u32 val = 0; |
@@ -3791,6 +3787,9 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | |||
3791 | u32 val_len; | 3787 | u32 val_len; |
3792 | static int loop = 0; | 3788 | static int loop = 0; |
3793 | 3789 | ||
3790 | if (priv->status & STATUS_RF_KILL_MASK) | ||
3791 | return 0; | ||
3792 | |||
3794 | if (loop >= sizeof(ord_data) / sizeof(*ord_data)) | 3793 | if (loop >= sizeof(ord_data) / sizeof(*ord_data)) |
3795 | loop = 0; | 3794 | loop = 0; |
3796 | 3795 | ||
@@ -3814,14 +3813,14 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, | |||
3814 | 3813 | ||
3815 | return len; | 3814 | return len; |
3816 | } | 3815 | } |
3817 | static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); | ||
3818 | 3816 | ||
3817 | static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); | ||
3819 | 3818 | ||
3820 | static ssize_t show_stats(struct device *d, struct device_attribute *attr, | 3819 | static ssize_t show_stats(struct device *d, struct device_attribute *attr, |
3821 | char *buf) | 3820 | char *buf) |
3822 | { | 3821 | { |
3823 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3822 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3824 | char * out = buf; | 3823 | char *out = buf; |
3825 | 3824 | ||
3826 | out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", | 3825 | out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", |
3827 | priv->interrupts, priv->tx_interrupts, | 3826 | priv->interrupts, priv->tx_interrupts, |
@@ -3835,8 +3834,8 @@ static ssize_t show_stats(struct device *d, struct device_attribute *attr, | |||
3835 | 3834 | ||
3836 | return out - buf; | 3835 | return out - buf; |
3837 | } | 3836 | } |
3838 | static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); | ||
3839 | 3837 | ||
3838 | static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); | ||
3840 | 3839 | ||
3841 | static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | 3840 | static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) |
3842 | { | 3841 | { |
@@ -3864,19 +3863,18 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | |||
3864 | priv->last_mode = priv->ieee->iw_mode; | 3863 | priv->last_mode = priv->ieee->iw_mode; |
3865 | priv->net_dev->type = ARPHRD_IEEE80211; | 3864 | priv->net_dev->type = ARPHRD_IEEE80211; |
3866 | break; | 3865 | break; |
3867 | #endif /* CONFIG_IPW2100_MONITOR */ | 3866 | #endif /* CONFIG_IPW2100_MONITOR */ |
3868 | } | 3867 | } |
3869 | 3868 | ||
3870 | priv->ieee->iw_mode = mode; | 3869 | priv->ieee->iw_mode = mode; |
3871 | 3870 | ||
3872 | #ifdef CONFIG_PM | 3871 | #ifdef CONFIG_PM |
3873 | /* Indicate ipw2100_download_firmware download firmware | 3872 | /* Indicate ipw2100_download_firmware download firmware |
3874 | * from disk instead of memory. */ | 3873 | * from disk instead of memory. */ |
3875 | ipw2100_firmware.version = 0; | 3874 | ipw2100_firmware.version = 0; |
3876 | #endif | 3875 | #endif |
3877 | 3876 | ||
3878 | printk(KERN_INFO "%s: Reseting on mode change.\n", | 3877 | printk(KERN_INFO "%s: Reseting on mode change.\n", priv->net_dev->name); |
3879 | priv->net_dev->name); | ||
3880 | priv->reset_backoff = 0; | 3878 | priv->reset_backoff = 0; |
3881 | schedule_reset(priv); | 3879 | schedule_reset(priv); |
3882 | 3880 | ||
@@ -3884,12 +3882,12 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | |||
3884 | } | 3882 | } |
3885 | 3883 | ||
3886 | static ssize_t show_internals(struct device *d, struct device_attribute *attr, | 3884 | static ssize_t show_internals(struct device *d, struct device_attribute *attr, |
3887 | char *buf) | 3885 | char *buf) |
3888 | { | 3886 | { |
3889 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3887 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3890 | int len = 0; | 3888 | int len = 0; |
3891 | 3889 | ||
3892 | #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" # y "\n", priv-> x) | 3890 | #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) |
3893 | 3891 | ||
3894 | if (priv->status & STATUS_ASSOCIATED) | 3892 | if (priv->status & STATUS_ASSOCIATED) |
3895 | len += sprintf(buf + len, "connected: %lu\n", | 3893 | len += sprintf(buf + len, "connected: %lu\n", |
@@ -3897,55 +3895,60 @@ static ssize_t show_internals(struct device *d, struct device_attribute *attr, | |||
3897 | else | 3895 | else |
3898 | len += sprintf(buf + len, "not connected\n"); | 3896 | len += sprintf(buf + len, "not connected\n"); |
3899 | 3897 | ||
3900 | DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], p); | 3898 | DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], "p"); |
3901 | DUMP_VAR(status, 08lx); | 3899 | DUMP_VAR(status, "08lx"); |
3902 | DUMP_VAR(config, 08lx); | 3900 | DUMP_VAR(config, "08lx"); |
3903 | DUMP_VAR(capability, 08lx); | 3901 | DUMP_VAR(capability, "08lx"); |
3904 | 3902 | ||
3905 | len += sprintf(buf + len, "last_rtc: %lu\n", (unsigned long)priv->last_rtc); | 3903 | len += |
3904 | sprintf(buf + len, "last_rtc: %lu\n", | ||
3905 | (unsigned long)priv->last_rtc); | ||
3906 | 3906 | ||
3907 | DUMP_VAR(fatal_error, d); | 3907 | DUMP_VAR(fatal_error, "d"); |
3908 | DUMP_VAR(stop_hang_check, d); | 3908 | DUMP_VAR(stop_hang_check, "d"); |
3909 | DUMP_VAR(stop_rf_kill, d); | 3909 | DUMP_VAR(stop_rf_kill, "d"); |
3910 | DUMP_VAR(messages_sent, d); | 3910 | DUMP_VAR(messages_sent, "d"); |
3911 | 3911 | ||
3912 | DUMP_VAR(tx_pend_stat.value, d); | 3912 | DUMP_VAR(tx_pend_stat.value, "d"); |
3913 | DUMP_VAR(tx_pend_stat.hi, d); | 3913 | DUMP_VAR(tx_pend_stat.hi, "d"); |
3914 | 3914 | ||
3915 | DUMP_VAR(tx_free_stat.value, d); | 3915 | DUMP_VAR(tx_free_stat.value, "d"); |
3916 | DUMP_VAR(tx_free_stat.lo, d); | 3916 | DUMP_VAR(tx_free_stat.lo, "d"); |
3917 | 3917 | ||
3918 | DUMP_VAR(msg_free_stat.value, d); | 3918 | DUMP_VAR(msg_free_stat.value, "d"); |
3919 | DUMP_VAR(msg_free_stat.lo, d); | 3919 | DUMP_VAR(msg_free_stat.lo, "d"); |
3920 | 3920 | ||
3921 | DUMP_VAR(msg_pend_stat.value, d); | 3921 | DUMP_VAR(msg_pend_stat.value, "d"); |
3922 | DUMP_VAR(msg_pend_stat.hi, d); | 3922 | DUMP_VAR(msg_pend_stat.hi, "d"); |
3923 | 3923 | ||
3924 | DUMP_VAR(fw_pend_stat.value, d); | 3924 | DUMP_VAR(fw_pend_stat.value, "d"); |
3925 | DUMP_VAR(fw_pend_stat.hi, d); | 3925 | DUMP_VAR(fw_pend_stat.hi, "d"); |
3926 | 3926 | ||
3927 | DUMP_VAR(txq_stat.value, d); | 3927 | DUMP_VAR(txq_stat.value, "d"); |
3928 | DUMP_VAR(txq_stat.lo, d); | 3928 | DUMP_VAR(txq_stat.lo, "d"); |
3929 | 3929 | ||
3930 | DUMP_VAR(ieee->scans, d); | 3930 | DUMP_VAR(ieee->scans, "d"); |
3931 | DUMP_VAR(reset_backoff, d); | 3931 | DUMP_VAR(reset_backoff, "d"); |
3932 | 3932 | ||
3933 | return len; | 3933 | return len; |
3934 | } | 3934 | } |
3935 | static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); | ||
3936 | 3935 | ||
3936 | static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); | ||
3937 | 3937 | ||
3938 | static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, | 3938 | static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, |
3939 | char *buf) | 3939 | char *buf) |
3940 | { | 3940 | { |
3941 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 3941 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
3942 | char essid[IW_ESSID_MAX_SIZE + 1]; | 3942 | char essid[IW_ESSID_MAX_SIZE + 1]; |
3943 | u8 bssid[ETH_ALEN]; | 3943 | u8 bssid[ETH_ALEN]; |
3944 | u32 chan = 0; | 3944 | u32 chan = 0; |
3945 | char * out = buf; | 3945 | char *out = buf; |
3946 | int length; | 3946 | int length; |
3947 | int ret; | 3947 | int ret; |
3948 | 3948 | ||
3949 | if (priv->status & STATUS_RF_KILL_MASK) | ||
3950 | return 0; | ||
3951 | |||
3949 | memset(essid, 0, sizeof(essid)); | 3952 | memset(essid, 0, sizeof(essid)); |
3950 | memset(bssid, 0, sizeof(bssid)); | 3953 | memset(bssid, 0, sizeof(bssid)); |
3951 | 3954 | ||
@@ -3976,8 +3979,8 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, | |||
3976 | 3979 | ||
3977 | return out - buf; | 3980 | return out - buf; |
3978 | } | 3981 | } |
3979 | static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); | ||
3980 | 3982 | ||
3983 | static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); | ||
3981 | 3984 | ||
3982 | #ifdef CONFIG_IPW_DEBUG | 3985 | #ifdef CONFIG_IPW_DEBUG |
3983 | static ssize_t show_debug_level(struct device_driver *d, char *buf) | 3986 | static ssize_t show_debug_level(struct device_driver *d, char *buf) |
@@ -3985,8 +3988,8 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) | |||
3985 | return sprintf(buf, "0x%08X\n", ipw2100_debug_level); | 3988 | return sprintf(buf, "0x%08X\n", ipw2100_debug_level); |
3986 | } | 3989 | } |
3987 | 3990 | ||
3988 | static ssize_t store_debug_level(struct device_driver *d, const char *buf, | 3991 | static ssize_t store_debug_level(struct device_driver *d, |
3989 | size_t count) | 3992 | const char *buf, size_t count) |
3990 | { | 3993 | { |
3991 | char *p = (char *)buf; | 3994 | char *p = (char *)buf; |
3992 | u32 val; | 3995 | u32 val; |
@@ -3999,28 +4002,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, | |||
3999 | } else | 4002 | } else |
4000 | val = simple_strtoul(p, &p, 10); | 4003 | val = simple_strtoul(p, &p, 10); |
4001 | if (p == buf) | 4004 | if (p == buf) |
4002 | IPW_DEBUG_INFO(DRV_NAME | 4005 | IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); |
4003 | ": %s is not in hex or decimal form.\n", buf); | ||
4004 | else | 4006 | else |
4005 | ipw2100_debug_level = val; | 4007 | ipw2100_debug_level = val; |
4006 | 4008 | ||
4007 | return strnlen(buf, count); | 4009 | return strnlen(buf, count); |
4008 | } | 4010 | } |
4011 | |||
4009 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, | 4012 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, |
4010 | store_debug_level); | 4013 | store_debug_level); |
4011 | #endif /* CONFIG_IPW_DEBUG */ | 4014 | #endif /* CONFIG_IPW_DEBUG */ |
4012 | |||
4013 | 4015 | ||
4014 | static ssize_t show_fatal_error(struct device *d, | 4016 | static ssize_t show_fatal_error(struct device *d, |
4015 | struct device_attribute *attr, char *buf) | 4017 | struct device_attribute *attr, char *buf) |
4016 | { | 4018 | { |
4017 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4019 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4018 | char *out = buf; | 4020 | char *out = buf; |
4019 | int i; | 4021 | int i; |
4020 | 4022 | ||
4021 | if (priv->fatal_error) | 4023 | if (priv->fatal_error) |
4022 | out += sprintf(out, "0x%08X\n", | 4024 | out += sprintf(out, "0x%08X\n", priv->fatal_error); |
4023 | priv->fatal_error); | ||
4024 | else | 4025 | else |
4025 | out += sprintf(out, "0\n"); | 4026 | out += sprintf(out, "0\n"); |
4026 | 4027 | ||
@@ -4038,24 +4039,26 @@ static ssize_t show_fatal_error(struct device *d, | |||
4038 | } | 4039 | } |
4039 | 4040 | ||
4040 | static ssize_t store_fatal_error(struct device *d, | 4041 | static ssize_t store_fatal_error(struct device *d, |
4041 | struct device_attribute *attr, const char *buf, size_t count) | 4042 | struct device_attribute *attr, const char *buf, |
4043 | size_t count) | ||
4042 | { | 4044 | { |
4043 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4045 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4044 | schedule_reset(priv); | 4046 | schedule_reset(priv); |
4045 | return count; | 4047 | return count; |
4046 | } | 4048 | } |
4047 | static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error); | ||
4048 | 4049 | ||
4050 | static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, | ||
4051 | store_fatal_error); | ||
4049 | 4052 | ||
4050 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, | 4053 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, |
4051 | char *buf) | 4054 | char *buf) |
4052 | { | 4055 | { |
4053 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4056 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4054 | return sprintf(buf, "%d\n", priv->ieee->scan_age); | 4057 | return sprintf(buf, "%d\n", priv->ieee->scan_age); |
4055 | } | 4058 | } |
4056 | 4059 | ||
4057 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | 4060 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, |
4058 | const char *buf, size_t count) | 4061 | const char *buf, size_t count) |
4059 | { | 4062 | { |
4060 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4063 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4061 | struct net_device *dev = priv->net_dev; | 4064 | struct net_device *dev = priv->net_dev; |
@@ -4065,6 +4068,8 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4065 | unsigned long val; | 4068 | unsigned long val; |
4066 | char *p = buffer; | 4069 | char *p = buffer; |
4067 | 4070 | ||
4071 | (void) dev; /* kill unused-var warning for debug-only code */ | ||
4072 | |||
4068 | IPW_DEBUG_INFO("enter\n"); | 4073 | IPW_DEBUG_INFO("enter\n"); |
4069 | 4074 | ||
4070 | strncpy(buffer, buf, len); | 4075 | strncpy(buffer, buf, len); |
@@ -4078,8 +4083,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4078 | } else | 4083 | } else |
4079 | val = simple_strtoul(p, &p, 10); | 4084 | val = simple_strtoul(p, &p, 10); |
4080 | if (p == buffer) { | 4085 | if (p == buffer) { |
4081 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", | 4086 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); |
4082 | dev->name); | ||
4083 | } else { | 4087 | } else { |
4084 | priv->ieee->scan_age = val; | 4088 | priv->ieee->scan_age = val; |
4085 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); | 4089 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); |
@@ -4088,11 +4092,11 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
4088 | IPW_DEBUG_INFO("exit\n"); | 4092 | IPW_DEBUG_INFO("exit\n"); |
4089 | return len; | 4093 | return len; |
4090 | } | 4094 | } |
4091 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); | ||
4092 | 4095 | ||
4096 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); | ||
4093 | 4097 | ||
4094 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | 4098 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, |
4095 | char *buf) | 4099 | char *buf) |
4096 | { | 4100 | { |
4097 | /* 0 - RF kill not enabled | 4101 | /* 0 - RF kill not enabled |
4098 | 1 - SW based RF kill active (sysfs) | 4102 | 1 - SW based RF kill active (sysfs) |
@@ -4100,7 +4104,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | |||
4100 | 3 - Both HW and SW baed RF kill active */ | 4104 | 3 - Both HW and SW baed RF kill active */ |
4101 | struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; | 4105 | struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; |
4102 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | | 4106 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | |
4103 | (rf_kill_active(priv) ? 0x2 : 0x0); | 4107 | (rf_kill_active(priv) ? 0x2 : 0x0); |
4104 | return sprintf(buf, "%i\n", val); | 4108 | return sprintf(buf, "%i\n", val); |
4105 | } | 4109 | } |
4106 | 4110 | ||
@@ -4108,7 +4112,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4108 | { | 4112 | { |
4109 | if ((disable_radio ? 1 : 0) == | 4113 | if ((disable_radio ? 1 : 0) == |
4110 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) | 4114 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) |
4111 | return 0 ; | 4115 | return 0; |
4112 | 4116 | ||
4113 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 4117 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
4114 | disable_radio ? "OFF" : "ON"); | 4118 | disable_radio ? "OFF" : "ON"); |
@@ -4126,8 +4130,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4126 | /* Make sure the RF_KILL check timer is running */ | 4130 | /* Make sure the RF_KILL check timer is running */ |
4127 | priv->stop_rf_kill = 0; | 4131 | priv->stop_rf_kill = 0; |
4128 | cancel_delayed_work(&priv->rf_kill); | 4132 | cancel_delayed_work(&priv->rf_kill); |
4129 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 4133 | queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); |
4130 | HZ); | ||
4131 | } else | 4134 | } else |
4132 | schedule_reset(priv); | 4135 | schedule_reset(priv); |
4133 | } | 4136 | } |
@@ -4137,14 +4140,14 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4137 | } | 4140 | } |
4138 | 4141 | ||
4139 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | 4142 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, |
4140 | const char *buf, size_t count) | 4143 | const char *buf, size_t count) |
4141 | { | 4144 | { |
4142 | struct ipw2100_priv *priv = dev_get_drvdata(d); | 4145 | struct ipw2100_priv *priv = dev_get_drvdata(d); |
4143 | ipw_radio_kill_sw(priv, buf[0] == '1'); | 4146 | ipw_radio_kill_sw(priv, buf[0] == '1'); |
4144 | return count; | 4147 | return count; |
4145 | } | 4148 | } |
4146 | static DEVICE_ATTR(rf_kill, S_IWUSR|S_IRUGO, show_rf_kill, store_rf_kill); | ||
4147 | 4149 | ||
4150 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | ||
4148 | 4151 | ||
4149 | static struct attribute *ipw2100_sysfs_entries[] = { | 4152 | static struct attribute *ipw2100_sysfs_entries[] = { |
4150 | &dev_attr_hardware.attr, | 4153 | &dev_attr_hardware.attr, |
@@ -4168,7 +4171,6 @@ static struct attribute_group ipw2100_attribute_group = { | |||
4168 | .attrs = ipw2100_sysfs_entries, | 4171 | .attrs = ipw2100_sysfs_entries, |
4169 | }; | 4172 | }; |
4170 | 4173 | ||
4171 | |||
4172 | static int status_queue_allocate(struct ipw2100_priv *priv, int entries) | 4174 | static int status_queue_allocate(struct ipw2100_priv *priv, int entries) |
4173 | { | 4175 | { |
4174 | struct ipw2100_status_queue *q = &priv->status_queue; | 4176 | struct ipw2100_status_queue *q = &priv->status_queue; |
@@ -4176,11 +4178,11 @@ static int status_queue_allocate(struct ipw2100_priv *priv, int entries) | |||
4176 | IPW_DEBUG_INFO("enter\n"); | 4178 | IPW_DEBUG_INFO("enter\n"); |
4177 | 4179 | ||
4178 | q->size = entries * sizeof(struct ipw2100_status); | 4180 | q->size = entries * sizeof(struct ipw2100_status); |
4179 | q->drv = (struct ipw2100_status *)pci_alloc_consistent( | 4181 | q->drv = |
4180 | priv->pci_dev, q->size, &q->nic); | 4182 | (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, |
4183 | q->size, &q->nic); | ||
4181 | if (!q->drv) { | 4184 | if (!q->drv) { |
4182 | IPW_DEBUG_WARNING( | 4185 | IPW_DEBUG_WARNING("Can not allocate status queue.\n"); |
4183 | "Can not allocate status queue.\n"); | ||
4184 | return -ENOMEM; | 4186 | return -ENOMEM; |
4185 | } | 4187 | } |
4186 | 4188 | ||
@@ -4196,9 +4198,9 @@ static void status_queue_free(struct ipw2100_priv *priv) | |||
4196 | IPW_DEBUG_INFO("enter\n"); | 4198 | IPW_DEBUG_INFO("enter\n"); |
4197 | 4199 | ||
4198 | if (priv->status_queue.drv) { | 4200 | if (priv->status_queue.drv) { |
4199 | pci_free_consistent( | 4201 | pci_free_consistent(priv->pci_dev, priv->status_queue.size, |
4200 | priv->pci_dev, priv->status_queue.size, | 4202 | priv->status_queue.drv, |
4201 | priv->status_queue.drv, priv->status_queue.nic); | 4203 | priv->status_queue.nic); |
4202 | priv->status_queue.drv = NULL; | 4204 | priv->status_queue.drv = NULL; |
4203 | } | 4205 | } |
4204 | 4206 | ||
@@ -4216,7 +4218,8 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, | |||
4216 | q->size = entries * sizeof(struct ipw2100_bd); | 4218 | q->size = entries * sizeof(struct ipw2100_bd); |
4217 | q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); | 4219 | q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); |
4218 | if (!q->drv) { | 4220 | if (!q->drv) { |
4219 | IPW_DEBUG_INFO("can't allocate shared memory for buffer descriptors\n"); | 4221 | IPW_DEBUG_INFO |
4222 | ("can't allocate shared memory for buffer descriptors\n"); | ||
4220 | return -ENOMEM; | 4223 | return -ENOMEM; |
4221 | } | 4224 | } |
4222 | memset(q->drv, 0, q->size); | 4225 | memset(q->drv, 0, q->size); |
@@ -4226,8 +4229,7 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, | |||
4226 | return 0; | 4229 | return 0; |
4227 | } | 4230 | } |
4228 | 4231 | ||
4229 | static void bd_queue_free(struct ipw2100_priv *priv, | 4232 | static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) |
4230 | struct ipw2100_bd_queue *q) | ||
4231 | { | 4233 | { |
4232 | IPW_DEBUG_INFO("enter\n"); | 4234 | IPW_DEBUG_INFO("enter\n"); |
4233 | 4235 | ||
@@ -4235,21 +4237,21 @@ static void bd_queue_free(struct ipw2100_priv *priv, | |||
4235 | return; | 4237 | return; |
4236 | 4238 | ||
4237 | if (q->drv) { | 4239 | if (q->drv) { |
4238 | pci_free_consistent(priv->pci_dev, | 4240 | pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); |
4239 | q->size, q->drv, q->nic); | ||
4240 | q->drv = NULL; | 4241 | q->drv = NULL; |
4241 | } | 4242 | } |
4242 | 4243 | ||
4243 | IPW_DEBUG_INFO("exit\n"); | 4244 | IPW_DEBUG_INFO("exit\n"); |
4244 | } | 4245 | } |
4245 | 4246 | ||
4246 | static void bd_queue_initialize( | 4247 | static void bd_queue_initialize(struct ipw2100_priv *priv, |
4247 | struct ipw2100_priv *priv, struct ipw2100_bd_queue * q, | 4248 | struct ipw2100_bd_queue *q, u32 base, u32 size, |
4248 | u32 base, u32 size, u32 r, u32 w) | 4249 | u32 r, u32 w) |
4249 | { | 4250 | { |
4250 | IPW_DEBUG_INFO("enter\n"); | 4251 | IPW_DEBUG_INFO("enter\n"); |
4251 | 4252 | ||
4252 | IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic); | 4253 | IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, |
4254 | (u32) q->nic); | ||
4253 | 4255 | ||
4254 | write_register(priv->net_dev, base, q->nic); | 4256 | write_register(priv->net_dev, base, q->nic); |
4255 | write_register(priv->net_dev, size, q->entries); | 4257 | write_register(priv->net_dev, size, q->entries); |
@@ -4285,32 +4287,38 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) | |||
4285 | err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); | 4287 | err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); |
4286 | if (err) { | 4288 | if (err) { |
4287 | IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", | 4289 | IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", |
4288 | priv->net_dev->name); | 4290 | priv->net_dev->name); |
4289 | return err; | 4291 | return err; |
4290 | } | 4292 | } |
4291 | 4293 | ||
4292 | priv->tx_buffers = (struct ipw2100_tx_packet *)kmalloc( | 4294 | priv->tx_buffers = |
4293 | TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), | 4295 | (struct ipw2100_tx_packet *)kmalloc(TX_PENDED_QUEUE_LENGTH * |
4294 | GFP_ATOMIC); | 4296 | sizeof(struct |
4297 | ipw2100_tx_packet), | ||
4298 | GFP_ATOMIC); | ||
4295 | if (!priv->tx_buffers) { | 4299 | if (!priv->tx_buffers) { |
4296 | printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n", | 4300 | printk(KERN_ERR DRV_NAME |
4301 | ": %s: alloc failed form tx buffers.\n", | ||
4297 | priv->net_dev->name); | 4302 | priv->net_dev->name); |
4298 | bd_queue_free(priv, &priv->tx_queue); | 4303 | bd_queue_free(priv, &priv->tx_queue); |
4299 | return -ENOMEM; | 4304 | return -ENOMEM; |
4300 | } | 4305 | } |
4301 | 4306 | ||
4302 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { | 4307 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { |
4303 | v = pci_alloc_consistent( | 4308 | v = pci_alloc_consistent(priv->pci_dev, |
4304 | priv->pci_dev, sizeof(struct ipw2100_data_header), &p); | 4309 | sizeof(struct ipw2100_data_header), |
4310 | &p); | ||
4305 | if (!v) { | 4311 | if (!v) { |
4306 | printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx " | 4312 | printk(KERN_ERR DRV_NAME |
4307 | "buffers.\n", priv->net_dev->name); | 4313 | ": %s: PCI alloc failed for tx " "buffers.\n", |
4314 | priv->net_dev->name); | ||
4308 | err = -ENOMEM; | 4315 | err = -ENOMEM; |
4309 | break; | 4316 | break; |
4310 | } | 4317 | } |
4311 | 4318 | ||
4312 | priv->tx_buffers[i].type = DATA; | 4319 | priv->tx_buffers[i].type = DATA; |
4313 | priv->tx_buffers[i].info.d_struct.data = (struct ipw2100_data_header*)v; | 4320 | priv->tx_buffers[i].info.d_struct.data = |
4321 | (struct ipw2100_data_header *)v; | ||
4314 | priv->tx_buffers[i].info.d_struct.data_phys = p; | 4322 | priv->tx_buffers[i].info.d_struct.data_phys = p; |
4315 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4323 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4316 | } | 4324 | } |
@@ -4319,11 +4327,11 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) | |||
4319 | return 0; | 4327 | return 0; |
4320 | 4328 | ||
4321 | for (j = 0; j < i; j++) { | 4329 | for (j = 0; j < i; j++) { |
4322 | pci_free_consistent( | 4330 | pci_free_consistent(priv->pci_dev, |
4323 | priv->pci_dev, | 4331 | sizeof(struct ipw2100_data_header), |
4324 | sizeof(struct ipw2100_data_header), | 4332 | priv->tx_buffers[j].info.d_struct.data, |
4325 | priv->tx_buffers[j].info.d_struct.data, | 4333 | priv->tx_buffers[j].info.d_struct. |
4326 | priv->tx_buffers[j].info.d_struct.data_phys); | 4334 | data_phys); |
4327 | } | 4335 | } |
4328 | 4336 | ||
4329 | kfree(priv->tx_buffers); | 4337 | kfree(priv->tx_buffers); |
@@ -4356,7 +4364,8 @@ static void ipw2100_tx_initialize(struct ipw2100_priv *priv) | |||
4356 | /* We simply drop any SKBs that have been queued for | 4364 | /* We simply drop any SKBs that have been queued for |
4357 | * transmit */ | 4365 | * transmit */ |
4358 | if (priv->tx_buffers[i].info.d_struct.txb) { | 4366 | if (priv->tx_buffers[i].info.d_struct.txb) { |
4359 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); | 4367 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. |
4368 | txb); | ||
4360 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4369 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4361 | } | 4370 | } |
4362 | 4371 | ||
@@ -4394,15 +4403,17 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) | |||
4394 | 4403 | ||
4395 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { | 4404 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { |
4396 | if (priv->tx_buffers[i].info.d_struct.txb) { | 4405 | if (priv->tx_buffers[i].info.d_struct.txb) { |
4397 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); | 4406 | ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. |
4407 | txb); | ||
4398 | priv->tx_buffers[i].info.d_struct.txb = NULL; | 4408 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
4399 | } | 4409 | } |
4400 | if (priv->tx_buffers[i].info.d_struct.data) | 4410 | if (priv->tx_buffers[i].info.d_struct.data) |
4401 | pci_free_consistent( | 4411 | pci_free_consistent(priv->pci_dev, |
4402 | priv->pci_dev, | 4412 | sizeof(struct ipw2100_data_header), |
4403 | sizeof(struct ipw2100_data_header), | 4413 | priv->tx_buffers[i].info.d_struct. |
4404 | priv->tx_buffers[i].info.d_struct.data, | 4414 | data, |
4405 | priv->tx_buffers[i].info.d_struct.data_phys); | 4415 | priv->tx_buffers[i].info.d_struct. |
4416 | data_phys); | ||
4406 | } | 4417 | } |
4407 | 4418 | ||
4408 | kfree(priv->tx_buffers); | 4419 | kfree(priv->tx_buffers); |
@@ -4411,8 +4422,6 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) | |||
4411 | IPW_DEBUG_INFO("exit\n"); | 4422 | IPW_DEBUG_INFO("exit\n"); |
4412 | } | 4423 | } |
4413 | 4424 | ||
4414 | |||
4415 | |||
4416 | static int ipw2100_rx_allocate(struct ipw2100_priv *priv) | 4425 | static int ipw2100_rx_allocate(struct ipw2100_priv *priv) |
4417 | { | 4426 | { |
4418 | int i, j, err = -EINVAL; | 4427 | int i, j, err = -EINVAL; |
@@ -4542,14 +4551,13 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv) | |||
4542 | 4551 | ||
4543 | int err; | 4552 | int err; |
4544 | 4553 | ||
4545 | err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, | 4554 | err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, mac, &length); |
4546 | mac, &length); | ||
4547 | if (err) { | 4555 | if (err) { |
4548 | IPW_DEBUG_INFO("MAC address read failed\n"); | 4556 | IPW_DEBUG_INFO("MAC address read failed\n"); |
4549 | return -EIO; | 4557 | return -EIO; |
4550 | } | 4558 | } |
4551 | IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", | 4559 | IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", |
4552 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | 4560 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
4553 | 4561 | ||
4554 | memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); | 4562 | memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); |
4555 | 4563 | ||
@@ -4576,8 +4584,7 @@ static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) | |||
4576 | IPW_DEBUG_INFO("enter\n"); | 4584 | IPW_DEBUG_INFO("enter\n"); |
4577 | 4585 | ||
4578 | if (priv->config & CFG_CUSTOM_MAC) { | 4586 | if (priv->config & CFG_CUSTOM_MAC) { |
4579 | memcpy(cmd.host_command_parameters, priv->mac_addr, | 4587 | memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); |
4580 | ETH_ALEN); | ||
4581 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); | 4588 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); |
4582 | } else | 4589 | } else |
4583 | memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, | 4590 | memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, |
@@ -4614,7 +4621,8 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, | |||
4614 | if (!batch_mode) { | 4621 | if (!batch_mode) { |
4615 | err = ipw2100_disable_adapter(priv); | 4622 | err = ipw2100_disable_adapter(priv); |
4616 | if (err) { | 4623 | if (err) { |
4617 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 4624 | printk(KERN_ERR DRV_NAME |
4625 | ": %s: Could not disable adapter %d\n", | ||
4618 | priv->net_dev->name, err); | 4626 | priv->net_dev->name, err); |
4619 | return err; | 4627 | return err; |
4620 | } | 4628 | } |
@@ -4629,7 +4637,6 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, | |||
4629 | return err; | 4637 | return err; |
4630 | } | 4638 | } |
4631 | 4639 | ||
4632 | |||
4633 | static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, | 4640 | static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, |
4634 | int batch_mode) | 4641 | int batch_mode) |
4635 | { | 4642 | { |
@@ -4660,8 +4667,7 @@ static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, | |||
4660 | 4667 | ||
4661 | err = ipw2100_hw_send_command(priv, &cmd); | 4668 | err = ipw2100_hw_send_command(priv, &cmd); |
4662 | if (err) { | 4669 | if (err) { |
4663 | IPW_DEBUG_INFO("Failed to set channel to %d", | 4670 | IPW_DEBUG_INFO("Failed to set channel to %d", channel); |
4664 | channel); | ||
4665 | return err; | 4671 | return err; |
4666 | } | 4672 | } |
4667 | 4673 | ||
@@ -4703,15 +4709,14 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) | |||
4703 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; | 4709 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; |
4704 | 4710 | ||
4705 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | | 4711 | cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | |
4706 | IPW_CFG_BSS_MASK | | 4712 | IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; |
4707 | IPW_CFG_802_1x_ENABLE; | ||
4708 | 4713 | ||
4709 | if (!(priv->config & CFG_LONG_PREAMBLE)) | 4714 | if (!(priv->config & CFG_LONG_PREAMBLE)) |
4710 | cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; | 4715 | cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; |
4711 | 4716 | ||
4712 | err = ipw2100_get_ordinal(priv, | 4717 | err = ipw2100_get_ordinal(priv, |
4713 | IPW_ORD_EEPROM_IBSS_11B_CHANNELS, | 4718 | IPW_ORD_EEPROM_IBSS_11B_CHANNELS, |
4714 | &ibss_mask, &len); | 4719 | &ibss_mask, &len); |
4715 | if (err) | 4720 | if (err) |
4716 | ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; | 4721 | ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; |
4717 | 4722 | ||
@@ -4719,7 +4724,7 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) | |||
4719 | cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; | 4724 | cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; |
4720 | 4725 | ||
4721 | /* 11b only */ | 4726 | /* 11b only */ |
4722 | /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A;*/ | 4727 | /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ |
4723 | 4728 | ||
4724 | err = ipw2100_hw_send_command(priv, &cmd); | 4729 | err = ipw2100_hw_send_command(priv, &cmd); |
4725 | if (err) | 4730 | if (err) |
@@ -4783,8 +4788,7 @@ static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, | |||
4783 | return 0; | 4788 | return 0; |
4784 | } | 4789 | } |
4785 | 4790 | ||
4786 | static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | 4791 | static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) |
4787 | int power_level) | ||
4788 | { | 4792 | { |
4789 | struct host_command cmd = { | 4793 | struct host_command cmd = { |
4790 | .host_command = POWER_MODE, | 4794 | .host_command = POWER_MODE, |
@@ -4805,11 +4809,10 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | |||
4805 | priv->power_mode = IPW_POWER_ENABLED | power_level; | 4809 | priv->power_mode = IPW_POWER_ENABLED | power_level; |
4806 | 4810 | ||
4807 | #ifdef CONFIG_IPW2100_TX_POWER | 4811 | #ifdef CONFIG_IPW2100_TX_POWER |
4808 | if (priv->port_type == IBSS && | 4812 | if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { |
4809 | priv->adhoc_power != DFTL_IBSS_TX_POWER) { | ||
4810 | /* Set beacon interval */ | 4813 | /* Set beacon interval */ |
4811 | cmd.host_command = TX_POWER_INDEX; | 4814 | cmd.host_command = TX_POWER_INDEX; |
4812 | cmd.host_command_parameters[0] = (u32)priv->adhoc_power; | 4815 | cmd.host_command_parameters[0] = (u32) priv->adhoc_power; |
4813 | 4816 | ||
4814 | err = ipw2100_hw_send_command(priv, &cmd); | 4817 | err = ipw2100_hw_send_command(priv, &cmd); |
4815 | if (err) | 4818 | if (err) |
@@ -4820,7 +4823,6 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, | |||
4820 | return 0; | 4823 | return 0; |
4821 | } | 4824 | } |
4822 | 4825 | ||
4823 | |||
4824 | static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) | 4826 | static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) |
4825 | { | 4827 | { |
4826 | struct host_command cmd = { | 4828 | struct host_command cmd = { |
@@ -4925,8 +4927,7 @@ static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) | |||
4925 | return 0; | 4927 | return 0; |
4926 | } | 4928 | } |
4927 | 4929 | ||
4928 | 4930 | static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, | |
4929 | static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | ||
4930 | int batch_mode) | 4931 | int batch_mode) |
4931 | { | 4932 | { |
4932 | struct host_command cmd = { | 4933 | struct host_command cmd = { |
@@ -4938,16 +4939,15 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | |||
4938 | 4939 | ||
4939 | #ifdef CONFIG_IPW_DEBUG | 4940 | #ifdef CONFIG_IPW_DEBUG |
4940 | if (bssid != NULL) | 4941 | if (bssid != NULL) |
4941 | IPW_DEBUG_HC( | 4942 | IPW_DEBUG_HC("MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", |
4942 | "MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", | 4943 | bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], |
4943 | bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], | 4944 | bssid[5]); |
4944 | bssid[5]); | ||
4945 | else | 4945 | else |
4946 | IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); | 4946 | IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); |
4947 | #endif | 4947 | #endif |
4948 | /* if BSSID is empty then we disable mandatory bssid mode */ | 4948 | /* if BSSID is empty then we disable mandatory bssid mode */ |
4949 | if (bssid != NULL) | 4949 | if (bssid != NULL) |
4950 | memcpy((u8 *)cmd.host_command_parameters, bssid, ETH_ALEN); | 4950 | memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); |
4951 | 4951 | ||
4952 | if (!batch_mode) { | 4952 | if (!batch_mode) { |
4953 | err = ipw2100_disable_adapter(priv); | 4953 | err = ipw2100_disable_adapter(priv); |
@@ -4963,7 +4963,6 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, | |||
4963 | return err; | 4963 | return err; |
4964 | } | 4964 | } |
4965 | 4965 | ||
4966 | #ifdef CONFIG_IEEE80211_WPA | ||
4967 | static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) | 4966 | static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) |
4968 | { | 4967 | { |
4969 | struct host_command cmd = { | 4968 | struct host_command cmd = { |
@@ -4987,42 +4986,10 @@ static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) | |||
4987 | 4986 | ||
4988 | return err; | 4987 | return err; |
4989 | } | 4988 | } |
4990 | #endif | ||
4991 | |||
4992 | /* | ||
4993 | * Pseudo code for setting up wpa_frame: | ||
4994 | */ | ||
4995 | #if 0 | ||
4996 | void x(struct ieee80211_assoc_frame *wpa_assoc) | ||
4997 | { | ||
4998 | struct ipw2100_wpa_assoc_frame frame; | ||
4999 | frame->fixed_ie_mask = IPW_WPA_CAPABILTIES | | ||
5000 | IPW_WPA_LISTENINTERVAL | | ||
5001 | IPW_WPA_AP_ADDRESS; | ||
5002 | frame->capab_info = wpa_assoc->capab_info; | ||
5003 | frame->lisen_interval = wpa_assoc->listent_interval; | ||
5004 | memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN); | ||
5005 | |||
5006 | /* UNKNOWN -- I'm not postivive about this part; don't have any WPA | ||
5007 | * setup here to test it with. | ||
5008 | * | ||
5009 | * Walk the IEs in the wpa_assoc and figure out the total size of all | ||
5010 | * that data. Stick that into frame->var_ie_len. Then memcpy() all of | ||
5011 | * the IEs from wpa_frame into frame. | ||
5012 | */ | ||
5013 | frame->var_ie_len = calculate_ie_len(wpa_assoc); | ||
5014 | memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); | ||
5015 | |||
5016 | ipw2100_set_wpa_ie(priv, &frame, 0); | ||
5017 | } | ||
5018 | #endif | ||
5019 | |||
5020 | |||
5021 | |||
5022 | 4989 | ||
5023 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *, | 4990 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *, |
5024 | struct ipw2100_wpa_assoc_frame *, int) | 4991 | struct ipw2100_wpa_assoc_frame *, int) |
5025 | __attribute__ ((unused)); | 4992 | __attribute__ ((unused)); |
5026 | 4993 | ||
5027 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, | 4994 | static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, |
5028 | struct ipw2100_wpa_assoc_frame *wpa_frame, | 4995 | struct ipw2100_wpa_assoc_frame *wpa_frame, |
@@ -5076,7 +5043,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5076 | .host_command_length = sizeof(struct security_info_params) | 5043 | .host_command_length = sizeof(struct security_info_params) |
5077 | }; | 5044 | }; |
5078 | struct security_info_params *security = | 5045 | struct security_info_params *security = |
5079 | (struct security_info_params *)&cmd.host_command_parameters; | 5046 | (struct security_info_params *)&cmd.host_command_parameters; |
5080 | int err; | 5047 | int err; |
5081 | memset(security, 0, sizeof(*security)); | 5048 | memset(security, 0, sizeof(*security)); |
5082 | 5049 | ||
@@ -5094,25 +5061,25 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5094 | break; | 5061 | break; |
5095 | case SEC_LEVEL_1: | 5062 | case SEC_LEVEL_1: |
5096 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5063 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5097 | IPW_WEP104_CIPHER; | 5064 | IPW_WEP104_CIPHER; |
5098 | break; | 5065 | break; |
5099 | case SEC_LEVEL_2: | 5066 | case SEC_LEVEL_2: |
5100 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5067 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5101 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; | 5068 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; |
5102 | break; | 5069 | break; |
5103 | case SEC_LEVEL_2_CKIP: | 5070 | case SEC_LEVEL_2_CKIP: |
5104 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5071 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5105 | IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; | 5072 | IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; |
5106 | break; | 5073 | break; |
5107 | case SEC_LEVEL_3: | 5074 | case SEC_LEVEL_3: |
5108 | security->allowed_ciphers = IPW_WEP40_CIPHER | | 5075 | security->allowed_ciphers = IPW_WEP40_CIPHER | |
5109 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; | 5076 | IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; |
5110 | break; | 5077 | break; |
5111 | } | 5078 | } |
5112 | 5079 | ||
5113 | IPW_DEBUG_HC( | 5080 | IPW_DEBUG_HC |
5114 | "SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", | 5081 | ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", |
5115 | security->auth_mode, security->allowed_ciphers, security_level); | 5082 | security->auth_mode, security->allowed_ciphers, security_level); |
5116 | 5083 | ||
5117 | security->replay_counters_number = 0; | 5084 | security->replay_counters_number = 0; |
5118 | 5085 | ||
@@ -5130,8 +5097,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, | |||
5130 | return err; | 5097 | return err; |
5131 | } | 5098 | } |
5132 | 5099 | ||
5133 | static int ipw2100_set_tx_power(struct ipw2100_priv *priv, | 5100 | static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) |
5134 | u32 tx_power) | ||
5135 | { | 5101 | { |
5136 | struct host_command cmd = { | 5102 | struct host_command cmd = { |
5137 | .host_command = TX_POWER_INDEX, | 5103 | .host_command = TX_POWER_INDEX, |
@@ -5140,6 +5106,10 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, | |||
5140 | }; | 5106 | }; |
5141 | int err = 0; | 5107 | int err = 0; |
5142 | 5108 | ||
5109 | if (tx_power != IPW_TX_POWER_DEFAULT) | ||
5110 | tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / | ||
5111 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | ||
5112 | |||
5143 | cmd.host_command_parameters[0] = tx_power; | 5113 | cmd.host_command_parameters[0] = tx_power; |
5144 | 5114 | ||
5145 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 5115 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
@@ -5185,7 +5155,6 @@ static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, | |||
5185 | return 0; | 5155 | return 0; |
5186 | } | 5156 | } |
5187 | 5157 | ||
5188 | |||
5189 | void ipw2100_queues_initialize(struct ipw2100_priv *priv) | 5158 | void ipw2100_queues_initialize(struct ipw2100_priv *priv) |
5190 | { | 5159 | { |
5191 | ipw2100_tx_initialize(priv); | 5160 | ipw2100_tx_initialize(priv); |
@@ -5203,13 +5172,12 @@ void ipw2100_queues_free(struct ipw2100_priv *priv) | |||
5203 | int ipw2100_queues_allocate(struct ipw2100_priv *priv) | 5172 | int ipw2100_queues_allocate(struct ipw2100_priv *priv) |
5204 | { | 5173 | { |
5205 | if (ipw2100_tx_allocate(priv) || | 5174 | if (ipw2100_tx_allocate(priv) || |
5206 | ipw2100_rx_allocate(priv) || | 5175 | ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) |
5207 | ipw2100_msg_allocate(priv)) | ||
5208 | goto fail; | 5176 | goto fail; |
5209 | 5177 | ||
5210 | return 0; | 5178 | return 0; |
5211 | 5179 | ||
5212 | fail: | 5180 | fail: |
5213 | ipw2100_tx_free(priv); | 5181 | ipw2100_tx_free(priv); |
5214 | ipw2100_rx_free(priv); | 5182 | ipw2100_rx_free(priv); |
5215 | ipw2100_msg_free(priv); | 5183 | ipw2100_msg_free(priv); |
@@ -5235,7 +5203,8 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, | |||
5235 | if (!batch_mode) { | 5203 | if (!batch_mode) { |
5236 | err = ipw2100_disable_adapter(priv); | 5204 | err = ipw2100_disable_adapter(priv); |
5237 | if (err) { | 5205 | if (err) { |
5238 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5206 | printk(KERN_ERR DRV_NAME |
5207 | ": %s: Could not disable adapter %d\n", | ||
5239 | priv->net_dev->name, err); | 5208 | priv->net_dev->name, err); |
5240 | return err; | 5209 | return err; |
5241 | } | 5210 | } |
@@ -5262,7 +5231,6 @@ struct ipw2100_wep_key { | |||
5262 | #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] | 5231 | #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] |
5263 | #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] | 5232 | #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] |
5264 | 5233 | ||
5265 | |||
5266 | /** | 5234 | /** |
5267 | * Set a the wep key | 5235 | * Set a the wep key |
5268 | * | 5236 | * |
@@ -5287,11 +5255,11 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, | |||
5287 | .host_command_sequence = 0, | 5255 | .host_command_sequence = 0, |
5288 | .host_command_length = sizeof(struct ipw2100_wep_key), | 5256 | .host_command_length = sizeof(struct ipw2100_wep_key), |
5289 | }; | 5257 | }; |
5290 | struct ipw2100_wep_key *wep_key = (void*)cmd.host_command_parameters; | 5258 | struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; |
5291 | int err; | 5259 | int err; |
5292 | 5260 | ||
5293 | IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", | 5261 | IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", |
5294 | idx, keylen, len); | 5262 | idx, keylen, len); |
5295 | 5263 | ||
5296 | /* NOTE: We don't check cached values in case the firmware was reset | 5264 | /* NOTE: We don't check cached values in case the firmware was reset |
5297 | * or some other problem is occuring. If the user is setting the key, | 5265 | * or some other problem is occuring. If the user is setting the key, |
@@ -5308,22 +5276,23 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, | |||
5308 | /* Will be optimized out on debug not being configured in */ | 5276 | /* Will be optimized out on debug not being configured in */ |
5309 | if (keylen == 0) | 5277 | if (keylen == 0) |
5310 | IPW_DEBUG_WEP("%s: Clearing key %d\n", | 5278 | IPW_DEBUG_WEP("%s: Clearing key %d\n", |
5311 | priv->net_dev->name, wep_key->idx); | 5279 | priv->net_dev->name, wep_key->idx); |
5312 | else if (keylen == 5) | 5280 | else if (keylen == 5) |
5313 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", | 5281 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", |
5314 | priv->net_dev->name, wep_key->idx, wep_key->len, | 5282 | priv->net_dev->name, wep_key->idx, wep_key->len, |
5315 | WEP_STR_64(wep_key->key)); | 5283 | WEP_STR_64(wep_key->key)); |
5316 | else | 5284 | else |
5317 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 | 5285 | IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 |
5318 | "\n", | 5286 | "\n", |
5319 | priv->net_dev->name, wep_key->idx, wep_key->len, | 5287 | priv->net_dev->name, wep_key->idx, wep_key->len, |
5320 | WEP_STR_128(wep_key->key)); | 5288 | WEP_STR_128(wep_key->key)); |
5321 | 5289 | ||
5322 | if (!batch_mode) { | 5290 | if (!batch_mode) { |
5323 | err = ipw2100_disable_adapter(priv); | 5291 | err = ipw2100_disable_adapter(priv); |
5324 | /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ | 5292 | /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ |
5325 | if (err) { | 5293 | if (err) { |
5326 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5294 | printk(KERN_ERR DRV_NAME |
5295 | ": %s: Could not disable adapter %d\n", | ||
5327 | priv->net_dev->name, err); | 5296 | priv->net_dev->name, err); |
5328 | return err; | 5297 | return err; |
5329 | } | 5298 | } |
@@ -5347,7 +5316,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5347 | .host_command = WEP_KEY_INDEX, | 5316 | .host_command = WEP_KEY_INDEX, |
5348 | .host_command_sequence = 0, | 5317 | .host_command_sequence = 0, |
5349 | .host_command_length = 4, | 5318 | .host_command_length = 4, |
5350 | .host_command_parameters = { idx }, | 5319 | .host_command_parameters = {idx}, |
5351 | }; | 5320 | }; |
5352 | int err; | 5321 | int err; |
5353 | 5322 | ||
@@ -5359,7 +5328,8 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5359 | if (!batch_mode) { | 5328 | if (!batch_mode) { |
5360 | err = ipw2100_disable_adapter(priv); | 5329 | err = ipw2100_disable_adapter(priv); |
5361 | if (err) { | 5330 | if (err) { |
5362 | printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", | 5331 | printk(KERN_ERR DRV_NAME |
5332 | ": %s: Could not disable adapter %d\n", | ||
5363 | priv->net_dev->name, err); | 5333 | priv->net_dev->name, err); |
5364 | return err; | 5334 | return err; |
5365 | } | 5335 | } |
@@ -5374,9 +5344,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, | |||
5374 | return err; | 5344 | return err; |
5375 | } | 5345 | } |
5376 | 5346 | ||
5377 | 5347 | static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) | |
5378 | static int ipw2100_configure_security(struct ipw2100_priv *priv, | ||
5379 | int batch_mode) | ||
5380 | { | 5348 | { |
5381 | int i, err, auth_mode, sec_level, use_group; | 5349 | int i, err, auth_mode, sec_level, use_group; |
5382 | 5350 | ||
@@ -5389,40 +5357,42 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, | |||
5389 | return err; | 5357 | return err; |
5390 | } | 5358 | } |
5391 | 5359 | ||
5392 | if (!priv->sec.enabled) { | 5360 | if (!priv->ieee->sec.enabled) { |
5393 | err = ipw2100_set_security_information( | 5361 | err = |
5394 | priv, IPW_AUTH_OPEN, SEC_LEVEL_0, 0, 1); | 5362 | ipw2100_set_security_information(priv, IPW_AUTH_OPEN, |
5363 | SEC_LEVEL_0, 0, 1); | ||
5395 | } else { | 5364 | } else { |
5396 | auth_mode = IPW_AUTH_OPEN; | 5365 | auth_mode = IPW_AUTH_OPEN; |
5397 | if ((priv->sec.flags & SEC_AUTH_MODE) && | 5366 | if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && |
5398 | (priv->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) | 5367 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) |
5399 | auth_mode = IPW_AUTH_SHARED; | 5368 | auth_mode = IPW_AUTH_SHARED; |
5400 | 5369 | ||
5401 | sec_level = SEC_LEVEL_0; | 5370 | sec_level = SEC_LEVEL_0; |
5402 | if (priv->sec.flags & SEC_LEVEL) | 5371 | if (priv->ieee->sec.flags & SEC_LEVEL) |
5403 | sec_level = priv->sec.level; | 5372 | sec_level = priv->ieee->sec.level; |
5404 | 5373 | ||
5405 | use_group = 0; | 5374 | use_group = 0; |
5406 | if (priv->sec.flags & SEC_UNICAST_GROUP) | 5375 | if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) |
5407 | use_group = priv->sec.unicast_uses_group; | 5376 | use_group = priv->ieee->sec.unicast_uses_group; |
5408 | 5377 | ||
5409 | err = ipw2100_set_security_information( | 5378 | err = |
5410 | priv, auth_mode, sec_level, use_group, 1); | 5379 | ipw2100_set_security_information(priv, auth_mode, sec_level, |
5380 | use_group, 1); | ||
5411 | } | 5381 | } |
5412 | 5382 | ||
5413 | if (err) | 5383 | if (err) |
5414 | goto exit; | 5384 | goto exit; |
5415 | 5385 | ||
5416 | if (priv->sec.enabled) { | 5386 | if (priv->ieee->sec.enabled) { |
5417 | for (i = 0; i < 4; i++) { | 5387 | for (i = 0; i < 4; i++) { |
5418 | if (!(priv->sec.flags & (1 << i))) { | 5388 | if (!(priv->ieee->sec.flags & (1 << i))) { |
5419 | memset(priv->sec.keys[i], 0, WEP_KEY_LEN); | 5389 | memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); |
5420 | priv->sec.key_sizes[i] = 0; | 5390 | priv->ieee->sec.key_sizes[i] = 0; |
5421 | } else { | 5391 | } else { |
5422 | err = ipw2100_set_key(priv, i, | 5392 | err = ipw2100_set_key(priv, i, |
5423 | priv->sec.keys[i], | 5393 | priv->ieee->sec.keys[i], |
5424 | priv->sec.key_sizes[i], | 5394 | priv->ieee->sec. |
5425 | 1); | 5395 | key_sizes[i], 1); |
5426 | if (err) | 5396 | if (err) |
5427 | goto exit; | 5397 | goto exit; |
5428 | } | 5398 | } |
@@ -5433,14 +5403,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, | |||
5433 | 5403 | ||
5434 | /* Always enable privacy so the Host can filter WEP packets if | 5404 | /* Always enable privacy so the Host can filter WEP packets if |
5435 | * encrypted data is sent up */ | 5405 | * encrypted data is sent up */ |
5436 | err = ipw2100_set_wep_flags( | 5406 | err = |
5437 | priv, priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, 1); | 5407 | ipw2100_set_wep_flags(priv, |
5408 | priv->ieee->sec. | ||
5409 | enabled ? IPW_PRIVACY_CAPABLE : 0, 1); | ||
5438 | if (err) | 5410 | if (err) |
5439 | goto exit; | 5411 | goto exit; |
5440 | 5412 | ||
5441 | priv->status &= ~STATUS_SECURITY_UPDATED; | 5413 | priv->status &= ~STATUS_SECURITY_UPDATED; |
5442 | 5414 | ||
5443 | exit: | 5415 | exit: |
5444 | if (!batch_mode) | 5416 | if (!batch_mode) |
5445 | ipw2100_enable_adapter(priv); | 5417 | ipw2100_enable_adapter(priv); |
5446 | 5418 | ||
@@ -5469,60 +5441,64 @@ static void shim__set_security(struct net_device *dev, | |||
5469 | 5441 | ||
5470 | for (i = 0; i < 4; i++) { | 5442 | for (i = 0; i < 4; i++) { |
5471 | if (sec->flags & (1 << i)) { | 5443 | if (sec->flags & (1 << i)) { |
5472 | priv->sec.key_sizes[i] = sec->key_sizes[i]; | 5444 | priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; |
5473 | if (sec->key_sizes[i] == 0) | 5445 | if (sec->key_sizes[i] == 0) |
5474 | priv->sec.flags &= ~(1 << i); | 5446 | priv->ieee->sec.flags &= ~(1 << i); |
5475 | else | 5447 | else |
5476 | memcpy(priv->sec.keys[i], sec->keys[i], | 5448 | memcpy(priv->ieee->sec.keys[i], sec->keys[i], |
5477 | sec->key_sizes[i]); | 5449 | sec->key_sizes[i]); |
5478 | priv->sec.flags |= (1 << i); | 5450 | if (sec->level == SEC_LEVEL_1) { |
5479 | priv->status |= STATUS_SECURITY_UPDATED; | 5451 | priv->ieee->sec.flags |= (1 << i); |
5452 | priv->status |= STATUS_SECURITY_UPDATED; | ||
5453 | } else | ||
5454 | priv->ieee->sec.flags &= ~(1 << i); | ||
5480 | } | 5455 | } |
5481 | } | 5456 | } |
5482 | 5457 | ||
5483 | if ((sec->flags & SEC_ACTIVE_KEY) && | 5458 | if ((sec->flags & SEC_ACTIVE_KEY) && |
5484 | priv->sec.active_key != sec->active_key) { | 5459 | priv->ieee->sec.active_key != sec->active_key) { |
5485 | if (sec->active_key <= 3) { | 5460 | if (sec->active_key <= 3) { |
5486 | priv->sec.active_key = sec->active_key; | 5461 | priv->ieee->sec.active_key = sec->active_key; |
5487 | priv->sec.flags |= SEC_ACTIVE_KEY; | 5462 | priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
5488 | } else | 5463 | } else |
5489 | priv->sec.flags &= ~SEC_ACTIVE_KEY; | 5464 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; |
5490 | 5465 | ||
5491 | priv->status |= STATUS_SECURITY_UPDATED; | 5466 | priv->status |= STATUS_SECURITY_UPDATED; |
5492 | } | 5467 | } |
5493 | 5468 | ||
5494 | if ((sec->flags & SEC_AUTH_MODE) && | 5469 | if ((sec->flags & SEC_AUTH_MODE) && |
5495 | (priv->sec.auth_mode != sec->auth_mode)) { | 5470 | (priv->ieee->sec.auth_mode != sec->auth_mode)) { |
5496 | priv->sec.auth_mode = sec->auth_mode; | 5471 | priv->ieee->sec.auth_mode = sec->auth_mode; |
5497 | priv->sec.flags |= SEC_AUTH_MODE; | 5472 | priv->ieee->sec.flags |= SEC_AUTH_MODE; |
5498 | priv->status |= STATUS_SECURITY_UPDATED; | 5473 | priv->status |= STATUS_SECURITY_UPDATED; |
5499 | } | 5474 | } |
5500 | 5475 | ||
5501 | if (sec->flags & SEC_ENABLED && | 5476 | if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { |
5502 | priv->sec.enabled != sec->enabled) { | 5477 | priv->ieee->sec.flags |= SEC_ENABLED; |
5503 | priv->sec.flags |= SEC_ENABLED; | 5478 | priv->ieee->sec.enabled = sec->enabled; |
5504 | priv->sec.enabled = sec->enabled; | ||
5505 | priv->status |= STATUS_SECURITY_UPDATED; | 5479 | priv->status |= STATUS_SECURITY_UPDATED; |
5506 | force_update = 1; | 5480 | force_update = 1; |
5507 | } | 5481 | } |
5508 | 5482 | ||
5509 | if (sec->flags & SEC_LEVEL && | 5483 | if (sec->flags & SEC_ENCRYPT) |
5510 | priv->sec.level != sec->level) { | 5484 | priv->ieee->sec.encrypt = sec->encrypt; |
5511 | priv->sec.level = sec->level; | 5485 | |
5512 | priv->sec.flags |= SEC_LEVEL; | 5486 | if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { |
5487 | priv->ieee->sec.level = sec->level; | ||
5488 | priv->ieee->sec.flags |= SEC_LEVEL; | ||
5513 | priv->status |= STATUS_SECURITY_UPDATED; | 5489 | priv->status |= STATUS_SECURITY_UPDATED; |
5514 | } | 5490 | } |
5515 | 5491 | ||
5516 | IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", | 5492 | IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", |
5517 | priv->sec.flags & (1<<8) ? '1' : '0', | 5493 | priv->ieee->sec.flags & (1 << 8) ? '1' : '0', |
5518 | priv->sec.flags & (1<<7) ? '1' : '0', | 5494 | priv->ieee->sec.flags & (1 << 7) ? '1' : '0', |
5519 | priv->sec.flags & (1<<6) ? '1' : '0', | 5495 | priv->ieee->sec.flags & (1 << 6) ? '1' : '0', |
5520 | priv->sec.flags & (1<<5) ? '1' : '0', | 5496 | priv->ieee->sec.flags & (1 << 5) ? '1' : '0', |
5521 | priv->sec.flags & (1<<4) ? '1' : '0', | 5497 | priv->ieee->sec.flags & (1 << 4) ? '1' : '0', |
5522 | priv->sec.flags & (1<<3) ? '1' : '0', | 5498 | priv->ieee->sec.flags & (1 << 3) ? '1' : '0', |
5523 | priv->sec.flags & (1<<2) ? '1' : '0', | 5499 | priv->ieee->sec.flags & (1 << 2) ? '1' : '0', |
5524 | priv->sec.flags & (1<<1) ? '1' : '0', | 5500 | priv->ieee->sec.flags & (1 << 1) ? '1' : '0', |
5525 | priv->sec.flags & (1<<0) ? '1' : '0'); | 5501 | priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); |
5526 | 5502 | ||
5527 | /* As a temporary work around to enable WPA until we figure out why | 5503 | /* As a temporary work around to enable WPA until we figure out why |
5528 | * wpa_supplicant toggles the security capability of the driver, which | 5504 | * wpa_supplicant toggles the security capability of the driver, which |
@@ -5531,7 +5507,7 @@ static void shim__set_security(struct net_device *dev, | |||
5531 | * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ | 5507 | * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ |
5532 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) | 5508 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) |
5533 | ipw2100_configure_security(priv, 0); | 5509 | ipw2100_configure_security(priv, 0); |
5534 | done: | 5510 | done: |
5535 | up(&priv->action_sem); | 5511 | up(&priv->action_sem); |
5536 | } | 5512 | } |
5537 | 5513 | ||
@@ -5556,7 +5532,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5556 | 5532 | ||
5557 | return 0; | 5533 | return 0; |
5558 | } | 5534 | } |
5559 | #endif /* CONFIG_IPW2100_MONITOR */ | 5535 | #endif /* CONFIG_IPW2100_MONITOR */ |
5560 | 5536 | ||
5561 | err = ipw2100_read_mac_address(priv); | 5537 | err = ipw2100_read_mac_address(priv); |
5562 | if (err) | 5538 | if (err) |
@@ -5576,7 +5552,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5576 | return err; | 5552 | return err; |
5577 | } | 5553 | } |
5578 | 5554 | ||
5579 | err = ipw2100_system_config(priv, batch_mode); | 5555 | err = ipw2100_system_config(priv, batch_mode); |
5580 | if (err) | 5556 | if (err) |
5581 | return err; | 5557 | return err; |
5582 | 5558 | ||
@@ -5614,8 +5590,10 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5614 | return err; | 5590 | return err; |
5615 | 5591 | ||
5616 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 5592 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
5617 | err = ipw2100_set_ibss_beacon_interval( | 5593 | err = |
5618 | priv, priv->beacon_interval, batch_mode); | 5594 | ipw2100_set_ibss_beacon_interval(priv, |
5595 | priv->beacon_interval, | ||
5596 | batch_mode); | ||
5619 | if (err) | 5597 | if (err) |
5620 | return err; | 5598 | return err; |
5621 | 5599 | ||
@@ -5625,18 +5603,17 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | |||
5625 | } | 5603 | } |
5626 | 5604 | ||
5627 | /* | 5605 | /* |
5628 | err = ipw2100_set_fragmentation_threshold( | 5606 | err = ipw2100_set_fragmentation_threshold( |
5629 | priv, priv->frag_threshold, batch_mode); | 5607 | priv, priv->frag_threshold, batch_mode); |
5630 | if (err) | 5608 | if (err) |
5631 | return err; | 5609 | return err; |
5632 | */ | 5610 | */ |
5633 | 5611 | ||
5634 | IPW_DEBUG_INFO("exit\n"); | 5612 | IPW_DEBUG_INFO("exit\n"); |
5635 | 5613 | ||
5636 | return 0; | 5614 | return 0; |
5637 | } | 5615 | } |
5638 | 5616 | ||
5639 | |||
5640 | /************************************************************************* | 5617 | /************************************************************************* |
5641 | * | 5618 | * |
5642 | * EXTERNALLY CALLED METHODS | 5619 | * EXTERNALLY CALLED METHODS |
@@ -5669,7 +5646,7 @@ static int ipw2100_set_address(struct net_device *dev, void *p) | |||
5669 | ipw2100_reset_adapter(priv); | 5646 | ipw2100_reset_adapter(priv); |
5670 | return 0; | 5647 | return 0; |
5671 | 5648 | ||
5672 | done: | 5649 | done: |
5673 | up(&priv->action_sem); | 5650 | up(&priv->action_sem); |
5674 | return err; | 5651 | return err; |
5675 | } | 5652 | } |
@@ -5708,7 +5685,7 @@ static int ipw2100_close(struct net_device *dev) | |||
5708 | /* Flush the TX queue ... */ | 5685 | /* Flush the TX queue ... */ |
5709 | while (!list_empty(&priv->tx_pend_list)) { | 5686 | while (!list_empty(&priv->tx_pend_list)) { |
5710 | element = priv->tx_pend_list.next; | 5687 | element = priv->tx_pend_list.next; |
5711 | packet = list_entry(element, struct ipw2100_tx_packet, list); | 5688 | packet = list_entry(element, struct ipw2100_tx_packet, list); |
5712 | 5689 | ||
5713 | list_del(element); | 5690 | list_del(element); |
5714 | DEC_STAT(&priv->tx_pend_stat); | 5691 | DEC_STAT(&priv->tx_pend_stat); |
@@ -5726,8 +5703,6 @@ static int ipw2100_close(struct net_device *dev) | |||
5726 | return 0; | 5703 | return 0; |
5727 | } | 5704 | } |
5728 | 5705 | ||
5729 | |||
5730 | |||
5731 | /* | 5706 | /* |
5732 | * TODO: Fix this function... its just wrong | 5707 | * TODO: Fix this function... its just wrong |
5733 | */ | 5708 | */ |
@@ -5747,7 +5722,6 @@ static void ipw2100_tx_timeout(struct net_device *dev) | |||
5747 | schedule_reset(priv); | 5722 | schedule_reset(priv); |
5748 | } | 5723 | } |
5749 | 5724 | ||
5750 | |||
5751 | /* | 5725 | /* |
5752 | * TODO: reimplement it so that it reads statistics | 5726 | * TODO: reimplement it so that it reads statistics |
5753 | * from the adapter using ordinal tables | 5727 | * from the adapter using ordinal tables |
@@ -5761,11 +5735,10 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) | |||
5761 | return &priv->ieee->stats; | 5735 | return &priv->ieee->stats; |
5762 | } | 5736 | } |
5763 | 5737 | ||
5764 | /* Support for wpa_supplicant. Will be replaced with WEXT once | 5738 | #if WIRELESS_EXT < 18 |
5765 | * they get WPA support. */ | 5739 | /* Support for wpa_supplicant before WE-18, deprecated. */ |
5766 | #ifdef CONFIG_IEEE80211_WPA | ||
5767 | 5740 | ||
5768 | /* following definitions must match definitions in driver_ipw2100.c */ | 5741 | /* following definitions must match definitions in driver_ipw.c */ |
5769 | 5742 | ||
5770 | #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 | 5743 | #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 |
5771 | 5744 | ||
@@ -5796,25 +5769,26 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) | |||
5796 | struct ipw2100_param { | 5769 | struct ipw2100_param { |
5797 | u32 cmd; | 5770 | u32 cmd; |
5798 | u8 sta_addr[ETH_ALEN]; | 5771 | u8 sta_addr[ETH_ALEN]; |
5799 | union { | 5772 | union { |
5800 | struct { | 5773 | struct { |
5801 | u8 name; | 5774 | u8 name; |
5802 | u32 value; | 5775 | u32 value; |
5803 | } wpa_param; | 5776 | } wpa_param; |
5804 | struct { | 5777 | struct { |
5805 | u32 len; | 5778 | u32 len; |
5806 | u8 *data; | 5779 | u8 reserved[32]; |
5780 | u8 data[0]; | ||
5807 | } wpa_ie; | 5781 | } wpa_ie; |
5808 | struct{ | 5782 | struct { |
5809 | int command; | 5783 | u32 command; |
5810 | int reason_code; | 5784 | u32 reason_code; |
5811 | } mlme; | 5785 | } mlme; |
5812 | struct { | 5786 | struct { |
5813 | u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; | 5787 | u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; |
5814 | u8 set_tx; | 5788 | u8 set_tx; |
5815 | u32 err; | 5789 | u32 err; |
5816 | u8 idx; | 5790 | u8 idx; |
5817 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ | 5791 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ |
5818 | u16 key_len; | 5792 | u16 key_len; |
5819 | u8 key[0]; | 5793 | u8 key[0]; |
5820 | } crypt; | 5794 | } crypt; |
@@ -5822,38 +5796,24 @@ struct ipw2100_param { | |||
5822 | } u; | 5796 | } u; |
5823 | }; | 5797 | }; |
5824 | 5798 | ||
5825 | /* end of driver_ipw2100.c code */ | 5799 | /* end of driver_ipw.c code */ |
5826 | 5800 | #endif /* WIRELESS_EXT < 18 */ | |
5827 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ | ||
5828 | 5801 | ||
5829 | struct ieee80211_device *ieee = priv->ieee; | 5802 | static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) |
5830 | struct ieee80211_security sec = { | 5803 | { |
5831 | .flags = SEC_LEVEL | SEC_ENABLED, | 5804 | /* This is called when wpa_supplicant loads and closes the driver |
5832 | }; | 5805 | * interface. */ |
5833 | int ret = 0; | 5806 | priv->ieee->wpa_enabled = value; |
5834 | 5807 | return 0; | |
5835 | ieee->wpa_enabled = value; | ||
5836 | |||
5837 | if (value){ | ||
5838 | sec.level = SEC_LEVEL_3; | ||
5839 | sec.enabled = 1; | ||
5840 | } else { | ||
5841 | sec.level = SEC_LEVEL_0; | ||
5842 | sec.enabled = 0; | ||
5843 | } | ||
5844 | |||
5845 | if (ieee->set_security) | ||
5846 | ieee->set_security(ieee->dev, &sec); | ||
5847 | else | ||
5848 | ret = -EOPNOTSUPP; | ||
5849 | |||
5850 | return ret; | ||
5851 | } | 5808 | } |
5852 | 5809 | ||
5853 | #define AUTH_ALG_OPEN_SYSTEM 0x1 | 5810 | #if WIRELESS_EXT < 18 |
5854 | #define AUTH_ALG_SHARED_KEY 0x2 | 5811 | #define IW_AUTH_ALG_OPEN_SYSTEM 0x1 |
5812 | #define IW_AUTH_ALG_SHARED_KEY 0x2 | ||
5813 | #endif | ||
5855 | 5814 | ||
5856 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | 5815 | static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) |
5816 | { | ||
5857 | 5817 | ||
5858 | struct ieee80211_device *ieee = priv->ieee; | 5818 | struct ieee80211_device *ieee = priv->ieee; |
5859 | struct ieee80211_security sec = { | 5819 | struct ieee80211_security sec = { |
@@ -5861,13 +5821,14 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | |||
5861 | }; | 5821 | }; |
5862 | int ret = 0; | 5822 | int ret = 0; |
5863 | 5823 | ||
5864 | if (value & AUTH_ALG_SHARED_KEY){ | 5824 | if (value & IW_AUTH_ALG_SHARED_KEY) { |
5865 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; | 5825 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; |
5866 | ieee->open_wep = 0; | 5826 | ieee->open_wep = 0; |
5867 | } else { | 5827 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
5868 | sec.auth_mode = WLAN_AUTH_OPEN; | 5828 | sec.auth_mode = WLAN_AUTH_OPEN; |
5869 | ieee->open_wep = 1; | 5829 | ieee->open_wep = 1; |
5870 | } | 5830 | } else |
5831 | return -EINVAL; | ||
5871 | 5832 | ||
5872 | if (ieee->set_security) | 5833 | if (ieee->set_security) |
5873 | ieee->set_security(ieee->dev, &sec); | 5834 | ieee->set_security(ieee->dev, &sec); |
@@ -5877,103 +5838,135 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ | |||
5877 | return ret; | 5838 | return ret; |
5878 | } | 5839 | } |
5879 | 5840 | ||
5841 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | ||
5842 | char *wpa_ie, int wpa_ie_len) | ||
5843 | { | ||
5880 | 5844 | ||
5881 | static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){ | 5845 | struct ipw2100_wpa_assoc_frame frame; |
5882 | |||
5883 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5884 | int ret=0; | ||
5885 | 5846 | ||
5886 | switch(name){ | 5847 | frame.fixed_ie_mask = 0; |
5887 | case IPW2100_PARAM_WPA_ENABLED: | ||
5888 | ret = ipw2100_wpa_enable(priv, value); | ||
5889 | break; | ||
5890 | 5848 | ||
5891 | case IPW2100_PARAM_TKIP_COUNTERMEASURES: | 5849 | /* copy WPA IE */ |
5892 | priv->ieee->tkip_countermeasures=value; | 5850 | memcpy(frame.var_ie, wpa_ie, wpa_ie_len); |
5893 | break; | 5851 | frame.var_ie_len = wpa_ie_len; |
5894 | 5852 | ||
5895 | case IPW2100_PARAM_DROP_UNENCRYPTED: | 5853 | /* make sure WPA is enabled */ |
5896 | priv->ieee->drop_unencrypted=value; | 5854 | ipw2100_wpa_enable(priv, 1); |
5897 | break; | 5855 | ipw2100_set_wpa_ie(priv, &frame, 0); |
5856 | } | ||
5898 | 5857 | ||
5899 | case IPW2100_PARAM_PRIVACY_INVOKED: | 5858 | #if WIRELESS_EXT < 18 |
5900 | priv->ieee->privacy_invoked=value; | 5859 | static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) |
5901 | break; | 5860 | { |
5861 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
5862 | struct ieee80211_crypt_data *crypt; | ||
5863 | unsigned long flags; | ||
5864 | int ret = 0; | ||
5902 | 5865 | ||
5903 | case IPW2100_PARAM_AUTH_ALGS: | 5866 | switch (name) { |
5904 | ret = ipw2100_wpa_set_auth_algs(priv, value); | 5867 | case IPW2100_PARAM_WPA_ENABLED: |
5905 | break; | 5868 | ret = ipw2100_wpa_enable(priv, value); |
5869 | break; | ||
5906 | 5870 | ||
5907 | case IPW2100_PARAM_IEEE_802_1X: | 5871 | case IPW2100_PARAM_TKIP_COUNTERMEASURES: |
5908 | priv->ieee->ieee802_1x=value; | 5872 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; |
5873 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
5909 | break; | 5874 | break; |
5910 | 5875 | ||
5911 | default: | 5876 | flags = crypt->ops->get_flags(crypt->priv); |
5912 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", | ||
5913 | dev->name, name); | ||
5914 | ret = -EOPNOTSUPP; | ||
5915 | } | ||
5916 | 5877 | ||
5917 | return ret; | 5878 | if (value) |
5918 | } | 5879 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; |
5880 | else | ||
5881 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
5919 | 5882 | ||
5920 | static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){ | 5883 | crypt->ops->set_flags(flags, crypt->priv); |
5921 | 5884 | ||
5922 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5885 | break; |
5923 | int ret=0; | ||
5924 | 5886 | ||
5925 | switch(command){ | 5887 | case IPW2100_PARAM_DROP_UNENCRYPTED:{ |
5926 | case IPW2100_MLME_STA_DEAUTH: | 5888 | /* See IW_AUTH_DROP_UNENCRYPTED handling for details */ |
5927 | // silently ignore | 5889 | struct ieee80211_security sec = { |
5890 | .flags = SEC_ENABLED, | ||
5891 | .enabled = value, | ||
5892 | }; | ||
5893 | priv->ieee->drop_unencrypted = value; | ||
5894 | /* We only change SEC_LEVEL for open mode. Others | ||
5895 | * are set by ipw_wpa_set_encryption. | ||
5896 | */ | ||
5897 | if (!value) { | ||
5898 | sec.flags |= SEC_LEVEL; | ||
5899 | sec.level = SEC_LEVEL_0; | ||
5900 | } else { | ||
5901 | sec.flags |= SEC_LEVEL; | ||
5902 | sec.level = SEC_LEVEL_1; | ||
5903 | } | ||
5904 | if (priv->ieee->set_security) | ||
5905 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
5928 | break; | 5906 | break; |
5907 | } | ||
5929 | 5908 | ||
5930 | case IPW2100_MLME_STA_DISASSOC: | 5909 | case IPW2100_PARAM_PRIVACY_INVOKED: |
5931 | ipw2100_disassociate_bssid(priv); | 5910 | priv->ieee->privacy_invoked = value; |
5932 | break; | 5911 | break; |
5933 | 5912 | ||
5934 | default: | 5913 | case IPW2100_PARAM_AUTH_ALGS: |
5935 | printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", | 5914 | ret = ipw2100_wpa_set_auth_algs(priv, value); |
5936 | dev->name, command); | 5915 | break; |
5937 | ret = -EOPNOTSUPP; | 5916 | |
5917 | case IPW2100_PARAM_IEEE_802_1X: | ||
5918 | priv->ieee->ieee802_1x = value; | ||
5919 | break; | ||
5920 | |||
5921 | default: | ||
5922 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", | ||
5923 | dev->name, name); | ||
5924 | ret = -EOPNOTSUPP; | ||
5938 | } | 5925 | } |
5939 | 5926 | ||
5940 | return ret; | 5927 | return ret; |
5941 | } | 5928 | } |
5942 | 5929 | ||
5930 | static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) | ||
5931 | { | ||
5943 | 5932 | ||
5944 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | 5933 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
5945 | char *wpa_ie, int wpa_ie_len){ | 5934 | int ret = 0; |
5946 | 5935 | ||
5947 | struct ipw2100_wpa_assoc_frame frame; | 5936 | switch (command) { |
5937 | case IPW2100_MLME_STA_DEAUTH: | ||
5938 | // silently ignore | ||
5939 | break; | ||
5948 | 5940 | ||
5949 | frame.fixed_ie_mask = 0; | 5941 | case IPW2100_MLME_STA_DISASSOC: |
5942 | ipw2100_disassociate_bssid(priv); | ||
5943 | break; | ||
5950 | 5944 | ||
5951 | /* copy WPA IE */ | 5945 | default: |
5952 | memcpy(frame.var_ie, wpa_ie, wpa_ie_len); | 5946 | printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", |
5953 | frame.var_ie_len = wpa_ie_len; | 5947 | dev->name, command); |
5948 | ret = -EOPNOTSUPP; | ||
5949 | } | ||
5954 | 5950 | ||
5955 | /* make sure WPA is enabled */ | 5951 | return ret; |
5956 | ipw2100_wpa_enable(priv, 1); | ||
5957 | ipw2100_set_wpa_ie(priv, &frame, 0); | ||
5958 | } | 5952 | } |
5959 | 5953 | ||
5960 | |||
5961 | static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, | 5954 | static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, |
5962 | struct ipw2100_param *param, int plen){ | 5955 | struct ipw2100_param *param, int plen) |
5956 | { | ||
5963 | 5957 | ||
5964 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5958 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
5965 | struct ieee80211_device *ieee = priv->ieee; | 5959 | struct ieee80211_device *ieee = priv->ieee; |
5966 | u8 *buf; | 5960 | u8 *buf; |
5967 | 5961 | ||
5968 | if (! ieee->wpa_enabled) | 5962 | if (!ieee->wpa_enabled) |
5969 | return -EOPNOTSUPP; | 5963 | return -EOPNOTSUPP; |
5970 | 5964 | ||
5971 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || | 5965 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || |
5972 | (param->u.wpa_ie.len && | 5966 | (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) |
5973 | param->u.wpa_ie.data==NULL)) | ||
5974 | return -EINVAL; | 5967 | return -EINVAL; |
5975 | 5968 | ||
5976 | if (param->u.wpa_ie.len){ | 5969 | if (param->u.wpa_ie.len) { |
5977 | buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); | 5970 | buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); |
5978 | if (buf == NULL) | 5971 | if (buf == NULL) |
5979 | return -ENOMEM; | 5972 | return -ENOMEM; |
@@ -5998,8 +5991,9 @@ static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, | |||
5998 | /* implementation borrowed from hostap driver */ | 5991 | /* implementation borrowed from hostap driver */ |
5999 | 5992 | ||
6000 | static int ipw2100_wpa_set_encryption(struct net_device *dev, | 5993 | static int ipw2100_wpa_set_encryption(struct net_device *dev, |
6001 | struct ipw2100_param *param, int param_len){ | 5994 | struct ipw2100_param *param, |
6002 | 5995 | int param_len) | |
5996 | { | ||
6003 | int ret = 0; | 5997 | int ret = 0; |
6004 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5998 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
6005 | struct ieee80211_device *ieee = priv->ieee; | 5999 | struct ieee80211_device *ieee = priv->ieee; |
@@ -6014,9 +6008,10 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6014 | param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; | 6008 | param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; |
6015 | 6009 | ||
6016 | if (param_len != | 6010 | if (param_len != |
6017 | (int) ((char *) param->u.crypt.key - (char *) param) + | 6011 | (int)((char *)param->u.crypt.key - (char *)param) + |
6018 | param->u.crypt.key_len){ | 6012 | param->u.crypt.key_len) { |
6019 | IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, param->u.crypt.key_len); | 6013 | IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, |
6014 | param->u.crypt.key_len); | ||
6020 | return -EINVAL; | 6015 | return -EINVAL; |
6021 | } | 6016 | } |
6022 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && | 6017 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && |
@@ -6029,17 +6024,19 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6029 | return -EINVAL; | 6024 | return -EINVAL; |
6030 | } | 6025 | } |
6031 | 6026 | ||
6027 | sec.flags |= SEC_ENABLED | SEC_ENCRYPT; | ||
6032 | if (strcmp(param->u.crypt.alg, "none") == 0) { | 6028 | if (strcmp(param->u.crypt.alg, "none") == 0) { |
6033 | if (crypt){ | 6029 | if (crypt) { |
6034 | sec.enabled = 0; | 6030 | sec.enabled = 0; |
6031 | sec.encrypt = 0; | ||
6035 | sec.level = SEC_LEVEL_0; | 6032 | sec.level = SEC_LEVEL_0; |
6036 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | 6033 | sec.flags |= SEC_LEVEL; |
6037 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 6034 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
6038 | } | 6035 | } |
6039 | goto done; | 6036 | goto done; |
6040 | } | 6037 | } |
6041 | sec.enabled = 1; | 6038 | sec.enabled = 1; |
6042 | sec.flags |= SEC_ENABLED; | 6039 | sec.encrypt = 1; |
6043 | 6040 | ||
6044 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | 6041 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
6045 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { | 6042 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { |
@@ -6054,7 +6051,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6054 | } | 6051 | } |
6055 | if (ops == NULL) { | 6052 | if (ops == NULL) { |
6056 | IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", | 6053 | IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", |
6057 | dev->name, param->u.crypt.alg); | 6054 | dev->name, param->u.crypt.alg); |
6058 | param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; | 6055 | param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; |
6059 | ret = -EINVAL; | 6056 | ret = -EINVAL; |
6060 | goto done; | 6057 | goto done; |
@@ -6065,21 +6062,20 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6065 | 6062 | ||
6066 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 6063 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
6067 | 6064 | ||
6068 | new_crypt = (struct ieee80211_crypt_data *) | 6065 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); |
6069 | kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); | ||
6070 | if (new_crypt == NULL) { | 6066 | if (new_crypt == NULL) { |
6071 | ret = -ENOMEM; | 6067 | ret = -ENOMEM; |
6072 | goto done; | 6068 | goto done; |
6073 | } | 6069 | } |
6074 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
6075 | new_crypt->ops = ops; | 6070 | new_crypt->ops = ops; |
6076 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) | 6071 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) |
6077 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); | 6072 | new_crypt->priv = |
6073 | new_crypt->ops->init(param->u.crypt.idx); | ||
6078 | 6074 | ||
6079 | if (new_crypt->priv == NULL) { | 6075 | if (new_crypt->priv == NULL) { |
6080 | kfree(new_crypt); | 6076 | kfree(new_crypt); |
6081 | param->u.crypt.err = | 6077 | param->u.crypt.err = |
6082 | IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; | 6078 | IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; |
6083 | ret = -EINVAL; | 6079 | ret = -EINVAL; |
6084 | goto done; | 6080 | goto done; |
6085 | } | 6081 | } |
@@ -6091,24 +6087,25 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6091 | (*crypt)->ops->set_key(param->u.crypt.key, | 6087 | (*crypt)->ops->set_key(param->u.crypt.key, |
6092 | param->u.crypt.key_len, param->u.crypt.seq, | 6088 | param->u.crypt.key_len, param->u.crypt.seq, |
6093 | (*crypt)->priv) < 0) { | 6089 | (*crypt)->priv) < 0) { |
6094 | IPW_DEBUG_INFO("%s: key setting failed\n", | 6090 | IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); |
6095 | dev->name); | ||
6096 | param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; | 6091 | param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; |
6097 | ret = -EINVAL; | 6092 | ret = -EINVAL; |
6098 | goto done; | 6093 | goto done; |
6099 | } | 6094 | } |
6100 | 6095 | ||
6101 | if (param->u.crypt.set_tx){ | 6096 | if (param->u.crypt.set_tx) { |
6102 | ieee->tx_keyidx = param->u.crypt.idx; | 6097 | ieee->tx_keyidx = param->u.crypt.idx; |
6103 | sec.active_key = param->u.crypt.idx; | 6098 | sec.active_key = param->u.crypt.idx; |
6104 | sec.flags |= SEC_ACTIVE_KEY; | 6099 | sec.flags |= SEC_ACTIVE_KEY; |
6105 | } | 6100 | } |
6106 | 6101 | ||
6107 | if (ops->name != NULL){ | 6102 | if (ops->name != NULL) { |
6108 | 6103 | ||
6109 | if (strcmp(ops->name, "WEP") == 0) { | 6104 | if (strcmp(ops->name, "WEP") == 0) { |
6110 | memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); | 6105 | memcpy(sec.keys[param->u.crypt.idx], |
6111 | sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; | 6106 | param->u.crypt.key, param->u.crypt.key_len); |
6107 | sec.key_sizes[param->u.crypt.idx] = | ||
6108 | param->u.crypt.key_len; | ||
6112 | sec.flags |= (1 << param->u.crypt.idx); | 6109 | sec.flags |= (1 << param->u.crypt.idx); |
6113 | sec.flags |= SEC_LEVEL; | 6110 | sec.flags |= SEC_LEVEL; |
6114 | sec.level = SEC_LEVEL_1; | 6111 | sec.level = SEC_LEVEL_1; |
@@ -6120,7 +6117,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6120 | sec.level = SEC_LEVEL_3; | 6117 | sec.level = SEC_LEVEL_3; |
6121 | } | 6118 | } |
6122 | } | 6119 | } |
6123 | done: | 6120 | done: |
6124 | if (ieee->set_security) | 6121 | if (ieee->set_security) |
6125 | ieee->set_security(ieee->dev, &sec); | 6122 | ieee->set_security(ieee->dev, &sec); |
6126 | 6123 | ||
@@ -6131,8 +6128,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6131 | * the callbacks structures used to initialize the 802.11 stack. */ | 6128 | * the callbacks structures used to initialize the 802.11 stack. */ |
6132 | if (ieee->reset_on_keychange && | 6129 | if (ieee->reset_on_keychange && |
6133 | ieee->iw_mode != IW_MODE_INFRA && | 6130 | ieee->iw_mode != IW_MODE_INFRA && |
6134 | ieee->reset_port && | 6131 | ieee->reset_port && ieee->reset_port(dev)) { |
6135 | ieee->reset_port(dev)) { | ||
6136 | IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); | 6132 | IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); |
6137 | param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; | 6133 | param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; |
6138 | return -EINVAL; | 6134 | return -EINVAL; |
@@ -6141,11 +6137,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, | |||
6141 | return ret; | 6137 | return ret; |
6142 | } | 6138 | } |
6143 | 6139 | ||
6144 | 6140 | static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) | |
6145 | static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | 6141 | { |
6146 | 6142 | ||
6147 | struct ipw2100_param *param; | 6143 | struct ipw2100_param *param; |
6148 | int ret=0; | 6144 | int ret = 0; |
6149 | 6145 | ||
6150 | IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); | 6146 | IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); |
6151 | 6147 | ||
@@ -6156,12 +6152,12 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6156 | if (param == NULL) | 6152 | if (param == NULL) |
6157 | return -ENOMEM; | 6153 | return -ENOMEM; |
6158 | 6154 | ||
6159 | if (copy_from_user(param, p->pointer, p->length)){ | 6155 | if (copy_from_user(param, p->pointer, p->length)) { |
6160 | kfree(param); | 6156 | kfree(param); |
6161 | return -EFAULT; | 6157 | return -EFAULT; |
6162 | } | 6158 | } |
6163 | 6159 | ||
6164 | switch (param->cmd){ | 6160 | switch (param->cmd) { |
6165 | 6161 | ||
6166 | case IPW2100_CMD_SET_WPA_PARAM: | 6162 | case IPW2100_CMD_SET_WPA_PARAM: |
6167 | ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, | 6163 | ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, |
@@ -6182,8 +6178,9 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6182 | break; | 6178 | break; |
6183 | 6179 | ||
6184 | default: | 6180 | default: |
6185 | printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n", | 6181 | printk(KERN_ERR DRV_NAME |
6186 | dev->name, param->cmd); | 6182 | ": %s: Unknown WPA supplicant request: %d\n", dev->name, |
6183 | param->cmd); | ||
6187 | ret = -EOPNOTSUPP; | 6184 | ret = -EOPNOTSUPP; |
6188 | 6185 | ||
6189 | } | 6186 | } |
@@ -6194,27 +6191,23 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ | |||
6194 | kfree(param); | 6191 | kfree(param); |
6195 | return ret; | 6192 | return ret; |
6196 | } | 6193 | } |
6197 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6198 | 6194 | ||
6199 | static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 6195 | static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
6200 | { | 6196 | { |
6201 | #ifdef CONFIG_IEEE80211_WPA | 6197 | struct iwreq *wrq = (struct iwreq *)rq; |
6202 | struct iwreq *wrq = (struct iwreq *) rq; | 6198 | int ret = -1; |
6203 | int ret=-1; | 6199 | switch (cmd) { |
6204 | switch (cmd){ | 6200 | case IPW2100_IOCTL_WPA_SUPPLICANT: |
6205 | case IPW2100_IOCTL_WPA_SUPPLICANT: | ||
6206 | ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); | 6201 | ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); |
6207 | return ret; | 6202 | return ret; |
6208 | 6203 | ||
6209 | default: | 6204 | default: |
6210 | return -EOPNOTSUPP; | 6205 | return -EOPNOTSUPP; |
6211 | } | 6206 | } |
6212 | 6207 | ||
6213 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6214 | |||
6215 | return -EOPNOTSUPP; | 6208 | return -EOPNOTSUPP; |
6216 | } | 6209 | } |
6217 | 6210 | #endif /* WIRELESS_EXT < 18 */ | |
6218 | 6211 | ||
6219 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, | 6212 | static void ipw_ethtool_get_drvinfo(struct net_device *dev, |
6220 | struct ethtool_drvinfo *info) | 6213 | struct ethtool_drvinfo *info) |
@@ -6236,14 +6229,13 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, | |||
6236 | 6229 | ||
6237 | static u32 ipw2100_ethtool_get_link(struct net_device *dev) | 6230 | static u32 ipw2100_ethtool_get_link(struct net_device *dev) |
6238 | { | 6231 | { |
6239 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 6232 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
6240 | return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; | 6233 | return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; |
6241 | } | 6234 | } |
6242 | 6235 | ||
6243 | |||
6244 | static struct ethtool_ops ipw2100_ethtool_ops = { | 6236 | static struct ethtool_ops ipw2100_ethtool_ops = { |
6245 | .get_link = ipw2100_ethtool_get_link, | 6237 | .get_link = ipw2100_ethtool_get_link, |
6246 | .get_drvinfo = ipw_ethtool_get_drvinfo, | 6238 | .get_drvinfo = ipw_ethtool_get_drvinfo, |
6247 | }; | 6239 | }; |
6248 | 6240 | ||
6249 | static void ipw2100_hang_check(void *adapter) | 6241 | static void ipw2100_hang_check(void *adapter) |
@@ -6288,7 +6280,6 @@ static void ipw2100_hang_check(void *adapter) | |||
6288 | spin_unlock_irqrestore(&priv->low_lock, flags); | 6280 | spin_unlock_irqrestore(&priv->low_lock, flags); |
6289 | } | 6281 | } |
6290 | 6282 | ||
6291 | |||
6292 | static void ipw2100_rf_kill(void *adapter) | 6283 | static void ipw2100_rf_kill(void *adapter) |
6293 | { | 6284 | { |
6294 | struct ipw2100_priv *priv = adapter; | 6285 | struct ipw2100_priv *priv = adapter; |
@@ -6313,7 +6304,7 @@ static void ipw2100_rf_kill(void *adapter) | |||
6313 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " | 6304 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " |
6314 | "enabled\n"); | 6305 | "enabled\n"); |
6315 | 6306 | ||
6316 | exit_unlock: | 6307 | exit_unlock: |
6317 | spin_unlock_irqrestore(&priv->low_lock, flags); | 6308 | spin_unlock_irqrestore(&priv->low_lock, flags); |
6318 | } | 6309 | } |
6319 | 6310 | ||
@@ -6321,11 +6312,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); | |||
6321 | 6312 | ||
6322 | /* Look into using netdev destructor to shutdown ieee80211? */ | 6313 | /* Look into using netdev destructor to shutdown ieee80211? */ |
6323 | 6314 | ||
6324 | static struct net_device *ipw2100_alloc_device( | 6315 | static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, |
6325 | struct pci_dev *pci_dev, | 6316 | void __iomem * base_addr, |
6326 | void __iomem *base_addr, | 6317 | unsigned long mem_start, |
6327 | unsigned long mem_start, | 6318 | unsigned long mem_len) |
6328 | unsigned long mem_len) | ||
6329 | { | 6319 | { |
6330 | struct ipw2100_priv *priv; | 6320 | struct ipw2100_priv *priv; |
6331 | struct net_device *dev; | 6321 | struct net_device *dev; |
@@ -6341,17 +6331,22 @@ static struct net_device *ipw2100_alloc_device( | |||
6341 | priv->ieee->hard_start_xmit = ipw2100_tx; | 6331 | priv->ieee->hard_start_xmit = ipw2100_tx; |
6342 | priv->ieee->set_security = shim__set_security; | 6332 | priv->ieee->set_security = shim__set_security; |
6343 | 6333 | ||
6334 | priv->ieee->perfect_rssi = -20; | ||
6335 | priv->ieee->worst_rssi = -85; | ||
6336 | |||
6344 | dev->open = ipw2100_open; | 6337 | dev->open = ipw2100_open; |
6345 | dev->stop = ipw2100_close; | 6338 | dev->stop = ipw2100_close; |
6346 | dev->init = ipw2100_net_init; | 6339 | dev->init = ipw2100_net_init; |
6340 | #if WIRELESS_EXT < 18 | ||
6347 | dev->do_ioctl = ipw2100_ioctl; | 6341 | dev->do_ioctl = ipw2100_ioctl; |
6342 | #endif | ||
6348 | dev->get_stats = ipw2100_stats; | 6343 | dev->get_stats = ipw2100_stats; |
6349 | dev->ethtool_ops = &ipw2100_ethtool_ops; | 6344 | dev->ethtool_ops = &ipw2100_ethtool_ops; |
6350 | dev->tx_timeout = ipw2100_tx_timeout; | 6345 | dev->tx_timeout = ipw2100_tx_timeout; |
6351 | dev->wireless_handlers = &ipw2100_wx_handler_def; | 6346 | dev->wireless_handlers = &ipw2100_wx_handler_def; |
6352 | dev->get_wireless_stats = ipw2100_wx_wireless_stats; | 6347 | dev->get_wireless_stats = ipw2100_wx_wireless_stats; |
6353 | dev->set_mac_address = ipw2100_set_address; | 6348 | dev->set_mac_address = ipw2100_set_address; |
6354 | dev->watchdog_timeo = 3*HZ; | 6349 | dev->watchdog_timeo = 3 * HZ; |
6355 | dev->irq = 0; | 6350 | dev->irq = 0; |
6356 | 6351 | ||
6357 | dev->base_addr = (unsigned long)base_addr; | 6352 | dev->base_addr = (unsigned long)base_addr; |
@@ -6364,22 +6359,19 @@ static struct net_device *ipw2100_alloc_device( | |||
6364 | * ends up causing problems. So, we just handle | 6359 | * ends up causing problems. So, we just handle |
6365 | * the WX extensions through the ipw2100_ioctl interface */ | 6360 | * the WX extensions through the ipw2100_ioctl interface */ |
6366 | 6361 | ||
6367 | |||
6368 | /* memset() puts everything to 0, so we only have explicitely set | 6362 | /* memset() puts everything to 0, so we only have explicitely set |
6369 | * those values that need to be something else */ | 6363 | * those values that need to be something else */ |
6370 | 6364 | ||
6371 | /* If power management is turned on, default to AUTO mode */ | 6365 | /* If power management is turned on, default to AUTO mode */ |
6372 | priv->power_mode = IPW_POWER_AUTO; | 6366 | priv->power_mode = IPW_POWER_AUTO; |
6373 | 6367 | ||
6374 | 6368 | #ifdef CONFIG_IPW2100_MONITOR | |
6375 | 6369 | priv->config |= CFG_CRC_CHECK; | |
6376 | #ifdef CONFIG_IEEE80211_WPA | 6370 | #endif |
6377 | priv->ieee->wpa_enabled = 0; | 6371 | priv->ieee->wpa_enabled = 0; |
6378 | priv->ieee->tkip_countermeasures = 0; | ||
6379 | priv->ieee->drop_unencrypted = 0; | 6372 | priv->ieee->drop_unencrypted = 0; |
6380 | priv->ieee->privacy_invoked = 0; | 6373 | priv->ieee->privacy_invoked = 0; |
6381 | priv->ieee->ieee802_1x = 1; | 6374 | priv->ieee->ieee802_1x = 1; |
6382 | #endif /* CONFIG_IEEE80211_WPA */ | ||
6383 | 6375 | ||
6384 | /* Set module parameters */ | 6376 | /* Set module parameters */ |
6385 | switch (mode) { | 6377 | switch (mode) { |
@@ -6401,8 +6393,7 @@ static struct net_device *ipw2100_alloc_device( | |||
6401 | priv->status |= STATUS_RF_KILL_SW; | 6393 | priv->status |= STATUS_RF_KILL_SW; |
6402 | 6394 | ||
6403 | if (channel != 0 && | 6395 | if (channel != 0 && |
6404 | ((channel >= REG_MIN_CHANNEL) && | 6396 | ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { |
6405 | (channel <= REG_MAX_CHANNEL))) { | ||
6406 | priv->config |= CFG_STATIC_CHANNEL; | 6397 | priv->config |= CFG_STATIC_CHANNEL; |
6407 | priv->channel = channel; | 6398 | priv->channel = channel; |
6408 | } | 6399 | } |
@@ -6441,12 +6432,8 @@ static struct net_device *ipw2100_alloc_device( | |||
6441 | INIT_LIST_HEAD(&priv->fw_pend_list); | 6432 | INIT_LIST_HEAD(&priv->fw_pend_list); |
6442 | INIT_STAT(&priv->fw_pend_stat); | 6433 | INIT_STAT(&priv->fw_pend_stat); |
6443 | 6434 | ||
6444 | |||
6445 | #ifdef CONFIG_SOFTWARE_SUSPEND2 | ||
6446 | priv->workqueue = create_workqueue(DRV_NAME, 0); | ||
6447 | #else | ||
6448 | priv->workqueue = create_workqueue(DRV_NAME); | 6435 | priv->workqueue = create_workqueue(DRV_NAME); |
6449 | #endif | 6436 | |
6450 | INIT_WORK(&priv->reset_work, | 6437 | INIT_WORK(&priv->reset_work, |
6451 | (void (*)(void *))ipw2100_reset_adapter, priv); | 6438 | (void (*)(void *))ipw2100_reset_adapter, priv); |
6452 | INIT_WORK(&priv->security_work, | 6439 | INIT_WORK(&priv->security_work, |
@@ -6535,7 +6522,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6535 | return err; | 6522 | return err; |
6536 | } | 6523 | } |
6537 | 6524 | ||
6538 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 6525 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
6539 | * PCI Tx retries from interfering with C3 CPU state */ | 6526 | * PCI Tx retries from interfering with C3 CPU state */ |
6540 | pci_read_config_dword(pci_dev, 0x40, &val); | 6527 | pci_read_config_dword(pci_dev, 0x40, &val); |
6541 | if ((val & 0x0000ff00) != 0) | 6528 | if ((val & 0x0000ff00) != 0) |
@@ -6566,12 +6553,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6566 | ipw2100_queues_initialize(priv); | 6553 | ipw2100_queues_initialize(priv); |
6567 | 6554 | ||
6568 | err = request_irq(pci_dev->irq, | 6555 | err = request_irq(pci_dev->irq, |
6569 | ipw2100_interrupt, SA_SHIRQ, | 6556 | ipw2100_interrupt, SA_SHIRQ, dev->name, priv); |
6570 | dev->name, priv); | ||
6571 | if (err) { | 6557 | if (err) { |
6572 | printk(KERN_WARNING DRV_NAME | 6558 | printk(KERN_WARNING DRV_NAME |
6573 | "Error calling request_irq: %d.\n", | 6559 | "Error calling request_irq: %d.\n", pci_dev->irq); |
6574 | pci_dev->irq); | ||
6575 | goto fail; | 6560 | goto fail; |
6576 | } | 6561 | } |
6577 | dev->irq = pci_dev->irq; | 6562 | dev->irq = pci_dev->irq; |
@@ -6606,7 +6591,6 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6606 | 6591 | ||
6607 | /* perform this after register_netdev so that dev->name is set */ | 6592 | /* perform this after register_netdev so that dev->name is set */ |
6608 | sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6593 | sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); |
6609 | netif_carrier_off(dev); | ||
6610 | 6594 | ||
6611 | /* If the RF Kill switch is disabled, go ahead and complete the | 6595 | /* If the RF Kill switch is disabled, go ahead and complete the |
6612 | * startup sequence */ | 6596 | * startup sequence */ |
@@ -6634,10 +6618,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6634 | 6618 | ||
6635 | return 0; | 6619 | return 0; |
6636 | 6620 | ||
6637 | fail_unlock: | 6621 | fail_unlock: |
6638 | up(&priv->action_sem); | 6622 | up(&priv->action_sem); |
6639 | 6623 | ||
6640 | fail: | 6624 | fail: |
6641 | if (dev) { | 6625 | if (dev) { |
6642 | if (registered) | 6626 | if (registered) |
6643 | unregister_netdev(dev); | 6627 | unregister_netdev(dev); |
@@ -6653,7 +6637,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6653 | 6637 | ||
6654 | /* These are safe to call even if they weren't allocated */ | 6638 | /* These are safe to call even if they weren't allocated */ |
6655 | ipw2100_queues_free(priv); | 6639 | ipw2100_queues_free(priv); |
6656 | sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6640 | sysfs_remove_group(&pci_dev->dev.kobj, |
6641 | &ipw2100_attribute_group); | ||
6657 | 6642 | ||
6658 | free_ieee80211(dev); | 6643 | free_ieee80211(dev); |
6659 | pci_set_drvdata(pci_dev, NULL); | 6644 | pci_set_drvdata(pci_dev, NULL); |
@@ -6679,7 +6664,8 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
6679 | priv->status &= ~STATUS_INITIALIZED; | 6664 | priv->status &= ~STATUS_INITIALIZED; |
6680 | 6665 | ||
6681 | dev = priv->net_dev; | 6666 | dev = priv->net_dev; |
6682 | sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); | 6667 | sysfs_remove_group(&pci_dev->dev.kobj, |
6668 | &ipw2100_attribute_group); | ||
6683 | 6669 | ||
6684 | #ifdef CONFIG_PM | 6670 | #ifdef CONFIG_PM |
6685 | if (ipw2100_firmware.version) | 6671 | if (ipw2100_firmware.version) |
@@ -6721,19 +6707,13 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
6721 | IPW_DEBUG_INFO("exit\n"); | 6707 | IPW_DEBUG_INFO("exit\n"); |
6722 | } | 6708 | } |
6723 | 6709 | ||
6724 | |||
6725 | #ifdef CONFIG_PM | 6710 | #ifdef CONFIG_PM |
6726 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) | ||
6727 | static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state) | ||
6728 | #else | ||
6729 | static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | 6711 | static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) |
6730 | #endif | ||
6731 | { | 6712 | { |
6732 | struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); | 6713 | struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); |
6733 | struct net_device *dev = priv->net_dev; | 6714 | struct net_device *dev = priv->net_dev; |
6734 | 6715 | ||
6735 | IPW_DEBUG_INFO("%s: Going into suspend...\n", | 6716 | IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); |
6736 | dev->name); | ||
6737 | 6717 | ||
6738 | down(&priv->action_sem); | 6718 | down(&priv->action_sem); |
6739 | if (priv->status & STATUS_INITIALIZED) { | 6719 | if (priv->status & STATUS_INITIALIZED) { |
@@ -6745,7 +6725,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
6745 | netif_device_detach(dev); | 6725 | netif_device_detach(dev); |
6746 | 6726 | ||
6747 | pci_save_state(pci_dev); | 6727 | pci_save_state(pci_dev); |
6748 | pci_disable_device (pci_dev); | 6728 | pci_disable_device(pci_dev); |
6749 | pci_set_power_state(pci_dev, PCI_D3hot); | 6729 | pci_set_power_state(pci_dev, PCI_D3hot); |
6750 | 6730 | ||
6751 | up(&priv->action_sem); | 6731 | up(&priv->action_sem); |
@@ -6764,8 +6744,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6764 | 6744 | ||
6765 | down(&priv->action_sem); | 6745 | down(&priv->action_sem); |
6766 | 6746 | ||
6767 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", | 6747 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); |
6768 | dev->name); | ||
6769 | 6748 | ||
6770 | pci_set_power_state(pci_dev, PCI_D0); | 6749 | pci_set_power_state(pci_dev, PCI_D0); |
6771 | pci_enable_device(pci_dev); | 6750 | pci_enable_device(pci_dev); |
@@ -6785,9 +6764,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6785 | * the queue of needed */ | 6764 | * the queue of needed */ |
6786 | netif_device_attach(dev); | 6765 | netif_device_attach(dev); |
6787 | 6766 | ||
6788 | /* Bring the device back up */ | 6767 | /* Bring the device back up */ |
6789 | if (!(priv->status & STATUS_RF_KILL_SW)) | 6768 | if (!(priv->status & STATUS_RF_KILL_SW)) |
6790 | ipw2100_up(priv, 0); | 6769 | ipw2100_up(priv, 0); |
6791 | 6770 | ||
6792 | up(&priv->action_sem); | 6771 | up(&priv->action_sem); |
6793 | 6772 | ||
@@ -6795,56 +6774,55 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
6795 | } | 6774 | } |
6796 | #endif | 6775 | #endif |
6797 | 6776 | ||
6798 | |||
6799 | #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } | 6777 | #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } |
6800 | 6778 | ||
6801 | static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { | 6779 | static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { |
6802 | IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ | 6780 | IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ |
6803 | IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ | 6781 | IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ |
6804 | IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ | 6782 | IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ |
6805 | IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ | 6783 | IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ |
6806 | IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ | 6784 | IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ |
6807 | IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ | 6785 | IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ |
6808 | IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ | 6786 | IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ |
6809 | IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ | 6787 | IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ |
6810 | IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ | 6788 | IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ |
6811 | IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ | 6789 | IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ |
6812 | IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ | 6790 | IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ |
6813 | IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ | 6791 | IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ |
6814 | IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ | 6792 | IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ |
6815 | 6793 | ||
6816 | IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ | 6794 | IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ |
6817 | IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ | 6795 | IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ |
6818 | IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ | 6796 | IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ |
6819 | IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ | 6797 | IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ |
6820 | IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ | 6798 | IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ |
6821 | 6799 | ||
6822 | IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ | 6800 | IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ |
6823 | IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ | 6801 | IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ |
6824 | IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ | 6802 | IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ |
6825 | IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ | 6803 | IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ |
6826 | IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ | 6804 | IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ |
6827 | IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ | 6805 | IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ |
6828 | IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ | 6806 | IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ |
6829 | 6807 | ||
6830 | IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ | 6808 | IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ |
6831 | 6809 | ||
6832 | IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ | 6810 | IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ |
6833 | IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ | 6811 | IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ |
6834 | IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ | 6812 | IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ |
6835 | IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ | 6813 | IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ |
6836 | IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ | 6814 | IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ |
6837 | IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ | 6815 | IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ |
6838 | IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ | 6816 | IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ |
6839 | 6817 | ||
6840 | IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ | 6818 | IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ |
6841 | IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ | 6819 | IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ |
6842 | IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ | 6820 | IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ |
6843 | IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ | 6821 | IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ |
6844 | IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ | 6822 | IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ |
6845 | IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ | 6823 | IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ |
6846 | 6824 | ||
6847 | IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ | 6825 | IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ |
6848 | {0,}, | 6826 | {0,}, |
6849 | }; | 6827 | }; |
6850 | 6828 | ||
@@ -6861,7 +6839,6 @@ static struct pci_driver ipw2100_pci_driver = { | |||
6861 | #endif | 6839 | #endif |
6862 | }; | 6840 | }; |
6863 | 6841 | ||
6864 | |||
6865 | /** | 6842 | /** |
6866 | * Initialize the ipw2100 driver/module | 6843 | * Initialize the ipw2100 driver/module |
6867 | * | 6844 | * |
@@ -6878,10 +6855,6 @@ static int __init ipw2100_init(void) | |||
6878 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); | 6855 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); |
6879 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); | 6856 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); |
6880 | 6857 | ||
6881 | #ifdef CONFIG_IEEE80211_NOWEP | ||
6882 | IPW_DEBUG_INFO(DRV_NAME ": Compiled with WEP disabled.\n"); | ||
6883 | #endif | ||
6884 | |||
6885 | ret = pci_module_init(&ipw2100_pci_driver); | 6858 | ret = pci_module_init(&ipw2100_pci_driver); |
6886 | 6859 | ||
6887 | #ifdef CONFIG_IPW_DEBUG | 6860 | #ifdef CONFIG_IPW_DEBUG |
@@ -6893,7 +6866,6 @@ static int __init ipw2100_init(void) | |||
6893 | return ret; | 6866 | return ret; |
6894 | } | 6867 | } |
6895 | 6868 | ||
6896 | |||
6897 | /** | 6869 | /** |
6898 | * Cleanup ipw2100 driver registration | 6870 | * Cleanup ipw2100 driver registration |
6899 | */ | 6871 | */ |
@@ -6949,7 +6921,6 @@ static int ipw2100_wx_get_name(struct net_device *dev, | |||
6949 | return 0; | 6921 | return 0; |
6950 | } | 6922 | } |
6951 | 6923 | ||
6952 | |||
6953 | static int ipw2100_wx_set_freq(struct net_device *dev, | 6924 | static int ipw2100_wx_set_freq(struct net_device *dev, |
6954 | struct iw_request_info *info, | 6925 | struct iw_request_info *info, |
6955 | union iwreq_data *wrqu, char *extra) | 6926 | union iwreq_data *wrqu, char *extra) |
@@ -6969,8 +6940,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
6969 | 6940 | ||
6970 | /* if setting by freq convert to channel */ | 6941 | /* if setting by freq convert to channel */ |
6971 | if (fwrq->e == 1) { | 6942 | if (fwrq->e == 1) { |
6972 | if ((fwrq->m >= (int) 2.412e8 && | 6943 | if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { |
6973 | fwrq->m <= (int) 2.487e8)) { | ||
6974 | int f = fwrq->m / 100000; | 6944 | int f = fwrq->m / 100000; |
6975 | int c = 0; | 6945 | int c = 0; |
6976 | 6946 | ||
@@ -6984,19 +6954,19 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
6984 | } | 6954 | } |
6985 | } | 6955 | } |
6986 | 6956 | ||
6987 | if (fwrq->e > 0 || fwrq->m > 1000) | 6957 | if (fwrq->e > 0 || fwrq->m > 1000) { |
6988 | return -EOPNOTSUPP; | 6958 | err = -EOPNOTSUPP; |
6989 | else { /* Set the channel */ | 6959 | goto done; |
6960 | } else { /* Set the channel */ | ||
6990 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 6961 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
6991 | err = ipw2100_set_channel(priv, fwrq->m, 0); | 6962 | err = ipw2100_set_channel(priv, fwrq->m, 0); |
6992 | } | 6963 | } |
6993 | 6964 | ||
6994 | done: | 6965 | done: |
6995 | up(&priv->action_sem); | 6966 | up(&priv->action_sem); |
6996 | return err; | 6967 | return err; |
6997 | } | 6968 | } |
6998 | 6969 | ||
6999 | |||
7000 | static int ipw2100_wx_get_freq(struct net_device *dev, | 6970 | static int ipw2100_wx_get_freq(struct net_device *dev, |
7001 | struct iw_request_info *info, | 6971 | struct iw_request_info *info, |
7002 | union iwreq_data *wrqu, char *extra) | 6972 | union iwreq_data *wrqu, char *extra) |
@@ -7045,7 +7015,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
7045 | case IW_MODE_MONITOR: | 7015 | case IW_MODE_MONITOR: |
7046 | err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); | 7016 | err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); |
7047 | break; | 7017 | break; |
7048 | #endif /* CONFIG_IPW2100_MONITOR */ | 7018 | #endif /* CONFIG_IPW2100_MONITOR */ |
7049 | case IW_MODE_ADHOC: | 7019 | case IW_MODE_ADHOC: |
7050 | err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); | 7020 | err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); |
7051 | break; | 7021 | break; |
@@ -7056,9 +7026,9 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
7056 | break; | 7026 | break; |
7057 | } | 7027 | } |
7058 | 7028 | ||
7059 | done: | 7029 | done: |
7060 | up(&priv->action_sem); | 7030 | up(&priv->action_sem); |
7061 | return err; | 7031 | return err; |
7062 | } | 7032 | } |
7063 | 7033 | ||
7064 | static int ipw2100_wx_get_mode(struct net_device *dev, | 7034 | static int ipw2100_wx_get_mode(struct net_device *dev, |
@@ -7077,7 +7047,6 @@ static int ipw2100_wx_get_mode(struct net_device *dev, | |||
7077 | return 0; | 7047 | return 0; |
7078 | } | 7048 | } |
7079 | 7049 | ||
7080 | |||
7081 | #define POWER_MODES 5 | 7050 | #define POWER_MODES 5 |
7082 | 7051 | ||
7083 | /* Values are in microsecond */ | 7052 | /* Values are in microsecond */ |
@@ -7124,19 +7093,19 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7124 | /* ~5 Mb/s real (802.11b) */ | 7093 | /* ~5 Mb/s real (802.11b) */ |
7125 | range->throughput = 5 * 1000 * 1000; | 7094 | range->throughput = 5 * 1000 * 1000; |
7126 | 7095 | ||
7127 | // range->sensitivity; /* signal level threshold range */ | 7096 | // range->sensitivity; /* signal level threshold range */ |
7128 | 7097 | ||
7129 | range->max_qual.qual = 100; | 7098 | range->max_qual.qual = 100; |
7130 | /* TODO: Find real max RSSI and stick here */ | 7099 | /* TODO: Find real max RSSI and stick here */ |
7131 | range->max_qual.level = 0; | 7100 | range->max_qual.level = 0; |
7132 | range->max_qual.noise = 0; | 7101 | range->max_qual.noise = 0; |
7133 | range->max_qual.updated = 7; /* Updated all three */ | 7102 | range->max_qual.updated = 7; /* Updated all three */ |
7134 | 7103 | ||
7135 | range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ | 7104 | range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ |
7136 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ | 7105 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ |
7137 | range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; | 7106 | range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; |
7138 | range->avg_qual.noise = 0; | 7107 | range->avg_qual.noise = 0; |
7139 | range->avg_qual.updated = 7; /* Updated all three */ | 7108 | range->avg_qual.updated = 7; /* Updated all three */ |
7140 | 7109 | ||
7141 | range->num_bitrates = RATE_COUNT; | 7110 | range->num_bitrates = RATE_COUNT; |
7142 | 7111 | ||
@@ -7150,61 +7119,62 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7150 | range->max_frag = MAX_FRAG_THRESHOLD; | 7119 | range->max_frag = MAX_FRAG_THRESHOLD; |
7151 | 7120 | ||
7152 | range->min_pmp = period_duration[0]; /* Minimal PM period */ | 7121 | range->min_pmp = period_duration[0]; /* Minimal PM period */ |
7153 | range->max_pmp = period_duration[POWER_MODES-1];/* Maximal PM period */ | 7122 | range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ |
7154 | range->min_pmt = timeout_duration[POWER_MODES-1]; /* Minimal PM timeout */ | 7123 | range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ |
7155 | range->max_pmt = timeout_duration[0];/* Maximal PM timeout */ | 7124 | range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ |
7156 | 7125 | ||
7157 | /* How to decode max/min PM period */ | 7126 | /* How to decode max/min PM period */ |
7158 | range->pmp_flags = IW_POWER_PERIOD; | 7127 | range->pmp_flags = IW_POWER_PERIOD; |
7159 | /* How to decode max/min PM period */ | 7128 | /* How to decode max/min PM period */ |
7160 | range->pmt_flags = IW_POWER_TIMEOUT; | 7129 | range->pmt_flags = IW_POWER_TIMEOUT; |
7161 | /* What PM options are supported */ | 7130 | /* What PM options are supported */ |
7162 | range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; | 7131 | range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; |
7163 | 7132 | ||
7164 | range->encoding_size[0] = 5; | 7133 | range->encoding_size[0] = 5; |
7165 | range->encoding_size[1] = 13; /* Different token sizes */ | 7134 | range->encoding_size[1] = 13; /* Different token sizes */ |
7166 | range->num_encoding_sizes = 2; /* Number of entry in the list */ | 7135 | range->num_encoding_sizes = 2; /* Number of entry in the list */ |
7167 | range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ | 7136 | range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ |
7168 | // range->encoding_login_index; /* token index for login token */ | 7137 | // range->encoding_login_index; /* token index for login token */ |
7169 | 7138 | ||
7170 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 7139 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
7171 | range->txpower_capa = IW_TXPOW_DBM; | 7140 | range->txpower_capa = IW_TXPOW_DBM; |
7172 | range->num_txpower = IW_MAX_TXPOWER; | 7141 | range->num_txpower = IW_MAX_TXPOWER; |
7173 | for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); i < IW_MAX_TXPOWER; | 7142 | for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); |
7174 | i++, level -= ((IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM) * 16) / | 7143 | i < IW_MAX_TXPOWER; |
7175 | (IW_MAX_TXPOWER - 1)) | 7144 | i++, level -= |
7145 | ((IPW_TX_POWER_MAX_DBM - | ||
7146 | IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) | ||
7176 | range->txpower[i] = level / 16; | 7147 | range->txpower[i] = level / 16; |
7177 | } else { | 7148 | } else { |
7178 | range->txpower_capa = 0; | 7149 | range->txpower_capa = 0; |
7179 | range->num_txpower = 0; | 7150 | range->num_txpower = 0; |
7180 | } | 7151 | } |
7181 | 7152 | ||
7182 | |||
7183 | /* Set the Wireless Extension versions */ | 7153 | /* Set the Wireless Extension versions */ |
7184 | range->we_version_compiled = WIRELESS_EXT; | 7154 | range->we_version_compiled = WIRELESS_EXT; |
7185 | range->we_version_source = 16; | 7155 | range->we_version_source = 16; |
7186 | 7156 | ||
7187 | // range->retry_capa; /* What retry options are supported */ | 7157 | // range->retry_capa; /* What retry options are supported */ |
7188 | // range->retry_flags; /* How to decode max/min retry limit */ | 7158 | // range->retry_flags; /* How to decode max/min retry limit */ |
7189 | // range->r_time_flags; /* How to decode max/min retry life */ | 7159 | // range->r_time_flags; /* How to decode max/min retry life */ |
7190 | // range->min_retry; /* Minimal number of retries */ | 7160 | // range->min_retry; /* Minimal number of retries */ |
7191 | // range->max_retry; /* Maximal number of retries */ | 7161 | // range->max_retry; /* Maximal number of retries */ |
7192 | // range->min_r_time; /* Minimal retry lifetime */ | 7162 | // range->min_r_time; /* Minimal retry lifetime */ |
7193 | // range->max_r_time; /* Maximal retry lifetime */ | 7163 | // range->max_r_time; /* Maximal retry lifetime */ |
7194 | 7164 | ||
7195 | range->num_channels = FREQ_COUNT; | 7165 | range->num_channels = FREQ_COUNT; |
7196 | 7166 | ||
7197 | val = 0; | 7167 | val = 0; |
7198 | for (i = 0; i < FREQ_COUNT; i++) { | 7168 | for (i = 0; i < FREQ_COUNT; i++) { |
7199 | // TODO: Include only legal frequencies for some countries | 7169 | // TODO: Include only legal frequencies for some countries |
7200 | // if (local->channel_mask & (1 << i)) { | 7170 | // if (local->channel_mask & (1 << i)) { |
7201 | range->freq[val].i = i + 1; | 7171 | range->freq[val].i = i + 1; |
7202 | range->freq[val].m = ipw2100_frequencies[i] * 100000; | 7172 | range->freq[val].m = ipw2100_frequencies[i] * 100000; |
7203 | range->freq[val].e = 1; | 7173 | range->freq[val].e = 1; |
7204 | val++; | 7174 | val++; |
7205 | // } | 7175 | // } |
7206 | if (val == IW_MAX_FREQUENCIES) | 7176 | if (val == IW_MAX_FREQUENCIES) |
7207 | break; | 7177 | break; |
7208 | } | 7178 | } |
7209 | range->num_frequency = val; | 7179 | range->num_frequency = val; |
7210 | 7180 | ||
@@ -7259,7 +7229,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev, | |||
7259 | wrqu->ap_addr.sa_data[4] & 0xff, | 7229 | wrqu->ap_addr.sa_data[4] & 0xff, |
7260 | wrqu->ap_addr.sa_data[5] & 0xff); | 7230 | wrqu->ap_addr.sa_data[5] & 0xff); |
7261 | 7231 | ||
7262 | done: | 7232 | done: |
7263 | up(&priv->action_sem); | 7233 | up(&priv->action_sem); |
7264 | return err; | 7234 | return err; |
7265 | } | 7235 | } |
@@ -7276,10 +7246,9 @@ static int ipw2100_wx_get_wap(struct net_device *dev, | |||
7276 | 7246 | ||
7277 | /* If we are associated, trying to associate, or have a statically | 7247 | /* If we are associated, trying to associate, or have a statically |
7278 | * configured BSSID then return that; otherwise return ANY */ | 7248 | * configured BSSID then return that; otherwise return ANY */ |
7279 | if (priv->config & CFG_STATIC_BSSID || | 7249 | if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { |
7280 | priv->status & STATUS_ASSOCIATED) { | ||
7281 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 7250 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
7282 | memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); | 7251 | memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); |
7283 | } else | 7252 | } else |
7284 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); | 7253 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); |
7285 | 7254 | ||
@@ -7293,7 +7262,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
7293 | union iwreq_data *wrqu, char *extra) | 7262 | union iwreq_data *wrqu, char *extra) |
7294 | { | 7263 | { |
7295 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7264 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7296 | char *essid = ""; /* ANY */ | 7265 | char *essid = ""; /* ANY */ |
7297 | int length = 0; | 7266 | int length = 0; |
7298 | int err = 0; | 7267 | int err = 0; |
7299 | 7268 | ||
@@ -7333,7 +7302,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
7333 | 7302 | ||
7334 | err = ipw2100_set_essid(priv, essid, length, 0); | 7303 | err = ipw2100_set_essid(priv, essid, length, 0); |
7335 | 7304 | ||
7336 | done: | 7305 | done: |
7337 | up(&priv->action_sem); | 7306 | up(&priv->action_sem); |
7338 | return err; | 7307 | return err; |
7339 | } | 7308 | } |
@@ -7350,17 +7319,16 @@ static int ipw2100_wx_get_essid(struct net_device *dev, | |||
7350 | 7319 | ||
7351 | /* If we are associated, trying to associate, or have a statically | 7320 | /* If we are associated, trying to associate, or have a statically |
7352 | * configured ESSID then return that; otherwise return ANY */ | 7321 | * configured ESSID then return that; otherwise return ANY */ |
7353 | if (priv->config & CFG_STATIC_ESSID || | 7322 | if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { |
7354 | priv->status & STATUS_ASSOCIATED) { | ||
7355 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 7323 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
7356 | escape_essid(priv->essid, priv->essid_len)); | 7324 | escape_essid(priv->essid, priv->essid_len)); |
7357 | memcpy(extra, priv->essid, priv->essid_len); | 7325 | memcpy(extra, priv->essid, priv->essid_len); |
7358 | wrqu->essid.length = priv->essid_len; | 7326 | wrqu->essid.length = priv->essid_len; |
7359 | wrqu->essid.flags = 1; /* active */ | 7327 | wrqu->essid.flags = 1; /* active */ |
7360 | } else { | 7328 | } else { |
7361 | IPW_DEBUG_WX("Getting essid: ANY\n"); | 7329 | IPW_DEBUG_WX("Getting essid: ANY\n"); |
7362 | wrqu->essid.length = 0; | 7330 | wrqu->essid.length = 0; |
7363 | wrqu->essid.flags = 0; /* active */ | 7331 | wrqu->essid.flags = 0; /* active */ |
7364 | } | 7332 | } |
7365 | 7333 | ||
7366 | return 0; | 7334 | return 0; |
@@ -7379,9 +7347,9 @@ static int ipw2100_wx_set_nick(struct net_device *dev, | |||
7379 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 7347 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
7380 | return -E2BIG; | 7348 | return -E2BIG; |
7381 | 7349 | ||
7382 | wrqu->data.length = min((size_t)wrqu->data.length, sizeof(priv->nick)); | 7350 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
7383 | memset(priv->nick, 0, sizeof(priv->nick)); | 7351 | memset(priv->nick, 0, sizeof(priv->nick)); |
7384 | memcpy(priv->nick, extra, wrqu->data.length); | 7352 | memcpy(priv->nick, extra, wrqu->data.length); |
7385 | 7353 | ||
7386 | IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); | 7354 | IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); |
7387 | 7355 | ||
@@ -7400,7 +7368,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev, | |||
7400 | 7368 | ||
7401 | wrqu->data.length = strlen(priv->nick) + 1; | 7369 | wrqu->data.length = strlen(priv->nick) + 1; |
7402 | memcpy(extra, priv->nick, wrqu->data.length); | 7370 | memcpy(extra, priv->nick, wrqu->data.length); |
7403 | wrqu->data.flags = 1; /* active */ | 7371 | wrqu->data.flags = 1; /* active */ |
7404 | 7372 | ||
7405 | IPW_DEBUG_WX("GET Nickname -> %s \n", extra); | 7373 | IPW_DEBUG_WX("GET Nickname -> %s \n", extra); |
7406 | 7374 | ||
@@ -7442,12 +7410,11 @@ static int ipw2100_wx_set_rate(struct net_device *dev, | |||
7442 | err = ipw2100_set_tx_rates(priv, rate, 0); | 7410 | err = ipw2100_set_tx_rates(priv, rate, 0); |
7443 | 7411 | ||
7444 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); | 7412 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); |
7445 | done: | 7413 | done: |
7446 | up(&priv->action_sem); | 7414 | up(&priv->action_sem); |
7447 | return err; | 7415 | return err; |
7448 | } | 7416 | } |
7449 | 7417 | ||
7450 | |||
7451 | static int ipw2100_wx_get_rate(struct net_device *dev, | 7418 | static int ipw2100_wx_get_rate(struct net_device *dev, |
7452 | struct iw_request_info *info, | 7419 | struct iw_request_info *info, |
7453 | union iwreq_data *wrqu, char *extra) | 7420 | union iwreq_data *wrqu, char *extra) |
@@ -7495,7 +7462,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev, | |||
7495 | 7462 | ||
7496 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 7463 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
7497 | 7464 | ||
7498 | done: | 7465 | done: |
7499 | up(&priv->action_sem); | 7466 | up(&priv->action_sem); |
7500 | return err; | 7467 | return err; |
7501 | } | 7468 | } |
@@ -7520,8 +7487,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
7520 | if (wrqu->rts.disabled) | 7487 | if (wrqu->rts.disabled) |
7521 | value = priv->rts_threshold | RTS_DISABLED; | 7488 | value = priv->rts_threshold | RTS_DISABLED; |
7522 | else { | 7489 | else { |
7523 | if (wrqu->rts.value < 1 || | 7490 | if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { |
7524 | wrqu->rts.value > 2304) { | ||
7525 | err = -EINVAL; | 7491 | err = -EINVAL; |
7526 | goto done; | 7492 | goto done; |
7527 | } | 7493 | } |
@@ -7531,7 +7497,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
7531 | err = ipw2100_set_rts_threshold(priv, value); | 7497 | err = ipw2100_set_rts_threshold(priv, value); |
7532 | 7498 | ||
7533 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); | 7499 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); |
7534 | done: | 7500 | done: |
7535 | up(&priv->action_sem); | 7501 | up(&priv->action_sem); |
7536 | return err; | 7502 | return err; |
7537 | } | 7503 | } |
@@ -7547,7 +7513,7 @@ static int ipw2100_wx_get_rts(struct net_device *dev, | |||
7547 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7513 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7548 | 7514 | ||
7549 | wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; | 7515 | wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; |
7550 | wrqu->rts.fixed = 1; /* no auto select */ | 7516 | wrqu->rts.fixed = 1; /* no auto select */ |
7551 | 7517 | ||
7552 | /* If RTS is set to the default value, then it is disabled */ | 7518 | /* If RTS is set to the default value, then it is disabled */ |
7553 | wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; | 7519 | wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; |
@@ -7574,8 +7540,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
7574 | wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) | 7540 | wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) |
7575 | return -EINVAL; | 7541 | return -EINVAL; |
7576 | 7542 | ||
7577 | value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / | 7543 | value = wrqu->txpower.value; |
7578 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | ||
7579 | } | 7544 | } |
7580 | 7545 | ||
7581 | down(&priv->action_sem); | 7546 | down(&priv->action_sem); |
@@ -7588,7 +7553,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
7588 | 7553 | ||
7589 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); | 7554 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); |
7590 | 7555 | ||
7591 | done: | 7556 | done: |
7592 | up(&priv->action_sem); | 7557 | up(&priv->action_sem); |
7593 | return err; | 7558 | return err; |
7594 | } | 7559 | } |
@@ -7615,11 +7580,7 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, | |||
7615 | } else { | 7580 | } else { |
7616 | wrqu->power.disabled = 0; | 7581 | wrqu->power.disabled = 0; |
7617 | wrqu->power.fixed = 1; | 7582 | wrqu->power.fixed = 1; |
7618 | wrqu->power.value = | 7583 | wrqu->power.value = priv->tx_power; |
7619 | (priv->tx_power * | ||
7620 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / | ||
7621 | (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + | ||
7622 | IPW_TX_POWER_MIN_DBM; | ||
7623 | } | 7584 | } |
7624 | 7585 | ||
7625 | wrqu->power.flags = IW_TXPOW_DBM; | 7586 | wrqu->power.flags = IW_TXPOW_DBM; |
@@ -7684,8 +7645,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7684 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7645 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7685 | int err = 0; | 7646 | int err = 0; |
7686 | 7647 | ||
7687 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || | 7648 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) |
7688 | wrqu->retry.disabled) | ||
7689 | return -EINVAL; | 7649 | return -EINVAL; |
7690 | 7650 | ||
7691 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) | 7651 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) |
@@ -7700,14 +7660,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7700 | if (wrqu->retry.flags & IW_RETRY_MIN) { | 7660 | if (wrqu->retry.flags & IW_RETRY_MIN) { |
7701 | err = ipw2100_set_short_retry(priv, wrqu->retry.value); | 7661 | err = ipw2100_set_short_retry(priv, wrqu->retry.value); |
7702 | IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", | 7662 | IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", |
7703 | wrqu->retry.value); | 7663 | wrqu->retry.value); |
7704 | goto done; | 7664 | goto done; |
7705 | } | 7665 | } |
7706 | 7666 | ||
7707 | if (wrqu->retry.flags & IW_RETRY_MAX) { | 7667 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
7708 | err = ipw2100_set_long_retry(priv, wrqu->retry.value); | 7668 | err = ipw2100_set_long_retry(priv, wrqu->retry.value); |
7709 | IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", | 7669 | IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", |
7710 | wrqu->retry.value); | 7670 | wrqu->retry.value); |
7711 | goto done; | 7671 | goto done; |
7712 | } | 7672 | } |
7713 | 7673 | ||
@@ -7717,7 +7677,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
7717 | 7677 | ||
7718 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); | 7678 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); |
7719 | 7679 | ||
7720 | done: | 7680 | done: |
7721 | up(&priv->action_sem); | 7681 | up(&priv->action_sem); |
7722 | return err; | 7682 | return err; |
7723 | } | 7683 | } |
@@ -7732,20 +7692,19 @@ static int ipw2100_wx_get_retry(struct net_device *dev, | |||
7732 | 7692 | ||
7733 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7693 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7734 | 7694 | ||
7735 | wrqu->retry.disabled = 0; /* can't be disabled */ | 7695 | wrqu->retry.disabled = 0; /* can't be disabled */ |
7736 | 7696 | ||
7737 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == | 7697 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) |
7738 | IW_RETRY_LIFETIME) | ||
7739 | return -EINVAL; | 7698 | return -EINVAL; |
7740 | 7699 | ||
7741 | if (wrqu->retry.flags & IW_RETRY_MAX) { | 7700 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
7742 | wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; | 7701 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; |
7743 | wrqu->retry.value = priv->long_retry_limit; | 7702 | wrqu->retry.value = priv->long_retry_limit; |
7744 | } else { | 7703 | } else { |
7745 | wrqu->retry.flags = | 7704 | wrqu->retry.flags = |
7746 | (priv->short_retry_limit != | 7705 | (priv->short_retry_limit != |
7747 | priv->long_retry_limit) ? | 7706 | priv->long_retry_limit) ? |
7748 | IW_RETRY_LIMIT & IW_RETRY_MIN : IW_RETRY_LIMIT; | 7707 | IW_RETRY_LIMIT | IW_RETRY_MIN : IW_RETRY_LIMIT; |
7749 | 7708 | ||
7750 | wrqu->retry.value = priv->short_retry_limit; | 7709 | wrqu->retry.value = priv->short_retry_limit; |
7751 | } | 7710 | } |
@@ -7769,15 +7728,14 @@ static int ipw2100_wx_set_scan(struct net_device *dev, | |||
7769 | } | 7728 | } |
7770 | 7729 | ||
7771 | IPW_DEBUG_WX("Initiating scan...\n"); | 7730 | IPW_DEBUG_WX("Initiating scan...\n"); |
7772 | if (ipw2100_set_scan_options(priv) || | 7731 | if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { |
7773 | ipw2100_start_scan(priv)) { | ||
7774 | IPW_DEBUG_WX("Start scan failed.\n"); | 7732 | IPW_DEBUG_WX("Start scan failed.\n"); |
7775 | 7733 | ||
7776 | /* TODO: Mark a scan as pending so when hardware initialized | 7734 | /* TODO: Mark a scan as pending so when hardware initialized |
7777 | * a scan starts */ | 7735 | * a scan starts */ |
7778 | } | 7736 | } |
7779 | 7737 | ||
7780 | done: | 7738 | done: |
7781 | up(&priv->action_sem); | 7739 | up(&priv->action_sem); |
7782 | return err; | 7740 | return err; |
7783 | } | 7741 | } |
@@ -7794,7 +7752,6 @@ static int ipw2100_wx_get_scan(struct net_device *dev, | |||
7794 | return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); | 7752 | return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); |
7795 | } | 7753 | } |
7796 | 7754 | ||
7797 | |||
7798 | /* | 7755 | /* |
7799 | * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c | 7756 | * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c |
7800 | */ | 7757 | */ |
@@ -7823,8 +7780,8 @@ static int ipw2100_wx_get_encode(struct net_device *dev, | |||
7823 | } | 7780 | } |
7824 | 7781 | ||
7825 | static int ipw2100_wx_set_power(struct net_device *dev, | 7782 | static int ipw2100_wx_set_power(struct net_device *dev, |
7826 | struct iw_request_info *info, | 7783 | struct iw_request_info *info, |
7827 | union iwreq_data *wrqu, char *extra) | 7784 | union iwreq_data *wrqu, char *extra) |
7828 | { | 7785 | { |
7829 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7786 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7830 | int err = 0; | 7787 | int err = 0; |
@@ -7843,11 +7800,11 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
7843 | } | 7800 | } |
7844 | 7801 | ||
7845 | switch (wrqu->power.flags & IW_POWER_MODE) { | 7802 | switch (wrqu->power.flags & IW_POWER_MODE) { |
7846 | case IW_POWER_ON: /* If not specified */ | 7803 | case IW_POWER_ON: /* If not specified */ |
7847 | case IW_POWER_MODE: /* If set all mask */ | 7804 | case IW_POWER_MODE: /* If set all mask */ |
7848 | case IW_POWER_ALL_R: /* If explicitely state all */ | 7805 | case IW_POWER_ALL_R: /* If explicitely state all */ |
7849 | break; | 7806 | break; |
7850 | default: /* Otherwise we don't support it */ | 7807 | default: /* Otherwise we don't support it */ |
7851 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 7808 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
7852 | wrqu->power.flags); | 7809 | wrqu->power.flags); |
7853 | err = -EOPNOTSUPP; | 7810 | err = -EOPNOTSUPP; |
@@ -7859,18 +7816,17 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
7859 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; | 7816 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; |
7860 | err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 7817 | err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
7861 | 7818 | ||
7862 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", | 7819 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
7863 | priv->power_mode); | ||
7864 | 7820 | ||
7865 | done: | 7821 | done: |
7866 | up(&priv->action_sem); | 7822 | up(&priv->action_sem); |
7867 | return err; | 7823 | return err; |
7868 | 7824 | ||
7869 | } | 7825 | } |
7870 | 7826 | ||
7871 | static int ipw2100_wx_get_power(struct net_device *dev, | 7827 | static int ipw2100_wx_get_power(struct net_device *dev, |
7872 | struct iw_request_info *info, | 7828 | struct iw_request_info *info, |
7873 | union iwreq_data *wrqu, char *extra) | 7829 | union iwreq_data *wrqu, char *extra) |
7874 | { | 7830 | { |
7875 | /* | 7831 | /* |
7876 | * This can be called at any time. No action lock required | 7832 | * This can be called at any time. No action lock required |
@@ -7878,9 +7834,9 @@ static int ipw2100_wx_get_power(struct net_device *dev, | |||
7878 | 7834 | ||
7879 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7835 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7880 | 7836 | ||
7881 | if (!(priv->power_mode & IPW_POWER_ENABLED)) { | 7837 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
7882 | wrqu->power.disabled = 1; | 7838 | wrqu->power.disabled = 1; |
7883 | } else { | 7839 | else { |
7884 | wrqu->power.disabled = 0; | 7840 | wrqu->power.disabled = 0; |
7885 | wrqu->power.flags = 0; | 7841 | wrqu->power.flags = 0; |
7886 | } | 7842 | } |
@@ -7890,6 +7846,269 @@ static int ipw2100_wx_get_power(struct net_device *dev, | |||
7890 | return 0; | 7846 | return 0; |
7891 | } | 7847 | } |
7892 | 7848 | ||
7849 | #if WIRELESS_EXT > 17 | ||
7850 | /* | ||
7851 | * WE-18 WPA support | ||
7852 | */ | ||
7853 | |||
7854 | /* SIOCSIWGENIE */ | ||
7855 | static int ipw2100_wx_set_genie(struct net_device *dev, | ||
7856 | struct iw_request_info *info, | ||
7857 | union iwreq_data *wrqu, char *extra) | ||
7858 | { | ||
7859 | |||
7860 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7861 | struct ieee80211_device *ieee = priv->ieee; | ||
7862 | u8 *buf; | ||
7863 | |||
7864 | if (!ieee->wpa_enabled) | ||
7865 | return -EOPNOTSUPP; | ||
7866 | |||
7867 | if (wrqu->data.length > MAX_WPA_IE_LEN || | ||
7868 | (wrqu->data.length && extra == NULL)) | ||
7869 | return -EINVAL; | ||
7870 | |||
7871 | if (wrqu->data.length) { | ||
7872 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); | ||
7873 | if (buf == NULL) | ||
7874 | return -ENOMEM; | ||
7875 | |||
7876 | memcpy(buf, extra, wrqu->data.length); | ||
7877 | kfree(ieee->wpa_ie); | ||
7878 | ieee->wpa_ie = buf; | ||
7879 | ieee->wpa_ie_len = wrqu->data.length; | ||
7880 | } else { | ||
7881 | kfree(ieee->wpa_ie); | ||
7882 | ieee->wpa_ie = NULL; | ||
7883 | ieee->wpa_ie_len = 0; | ||
7884 | } | ||
7885 | |||
7886 | ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | ||
7887 | |||
7888 | return 0; | ||
7889 | } | ||
7890 | |||
7891 | /* SIOCGIWGENIE */ | ||
7892 | static int ipw2100_wx_get_genie(struct net_device *dev, | ||
7893 | struct iw_request_info *info, | ||
7894 | union iwreq_data *wrqu, char *extra) | ||
7895 | { | ||
7896 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7897 | struct ieee80211_device *ieee = priv->ieee; | ||
7898 | |||
7899 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { | ||
7900 | wrqu->data.length = 0; | ||
7901 | return 0; | ||
7902 | } | ||
7903 | |||
7904 | if (wrqu->data.length < ieee->wpa_ie_len) | ||
7905 | return -E2BIG; | ||
7906 | |||
7907 | wrqu->data.length = ieee->wpa_ie_len; | ||
7908 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | ||
7909 | |||
7910 | return 0; | ||
7911 | } | ||
7912 | |||
7913 | /* SIOCSIWAUTH */ | ||
7914 | static int ipw2100_wx_set_auth(struct net_device *dev, | ||
7915 | struct iw_request_info *info, | ||
7916 | union iwreq_data *wrqu, char *extra) | ||
7917 | { | ||
7918 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
7919 | struct ieee80211_device *ieee = priv->ieee; | ||
7920 | struct iw_param *param = &wrqu->param; | ||
7921 | struct ieee80211_crypt_data *crypt; | ||
7922 | unsigned long flags; | ||
7923 | int ret = 0; | ||
7924 | |||
7925 | switch (param->flags & IW_AUTH_INDEX) { | ||
7926 | case IW_AUTH_WPA_VERSION: | ||
7927 | case IW_AUTH_CIPHER_PAIRWISE: | ||
7928 | case IW_AUTH_CIPHER_GROUP: | ||
7929 | case IW_AUTH_KEY_MGMT: | ||
7930 | /* | ||
7931 | * ipw2200 does not use these parameters | ||
7932 | */ | ||
7933 | break; | ||
7934 | |||
7935 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
7936 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
7937 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
7938 | break; | ||
7939 | |||
7940 | flags = crypt->ops->get_flags(crypt->priv); | ||
7941 | |||
7942 | if (param->value) | ||
7943 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
7944 | else | ||
7945 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
7946 | |||
7947 | crypt->ops->set_flags(flags, crypt->priv); | ||
7948 | |||
7949 | break; | ||
7950 | |||
7951 | case IW_AUTH_DROP_UNENCRYPTED:{ | ||
7952 | /* HACK: | ||
7953 | * | ||
7954 | * wpa_supplicant calls set_wpa_enabled when the driver | ||
7955 | * is loaded and unloaded, regardless of if WPA is being | ||
7956 | * used. No other calls are made which can be used to | ||
7957 | * determine if encryption will be used or not prior to | ||
7958 | * association being expected. If encryption is not being | ||
7959 | * used, drop_unencrypted is set to false, else true -- we | ||
7960 | * can use this to determine if the CAP_PRIVACY_ON bit should | ||
7961 | * be set. | ||
7962 | */ | ||
7963 | struct ieee80211_security sec = { | ||
7964 | .flags = SEC_ENABLED, | ||
7965 | .enabled = param->value, | ||
7966 | }; | ||
7967 | priv->ieee->drop_unencrypted = param->value; | ||
7968 | /* We only change SEC_LEVEL for open mode. Others | ||
7969 | * are set by ipw_wpa_set_encryption. | ||
7970 | */ | ||
7971 | if (!param->value) { | ||
7972 | sec.flags |= SEC_LEVEL; | ||
7973 | sec.level = SEC_LEVEL_0; | ||
7974 | } else { | ||
7975 | sec.flags |= SEC_LEVEL; | ||
7976 | sec.level = SEC_LEVEL_1; | ||
7977 | } | ||
7978 | if (priv->ieee->set_security) | ||
7979 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
7980 | break; | ||
7981 | } | ||
7982 | |||
7983 | case IW_AUTH_80211_AUTH_ALG: | ||
7984 | ret = ipw2100_wpa_set_auth_algs(priv, param->value); | ||
7985 | break; | ||
7986 | |||
7987 | case IW_AUTH_WPA_ENABLED: | ||
7988 | ret = ipw2100_wpa_enable(priv, param->value); | ||
7989 | break; | ||
7990 | |||
7991 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
7992 | ieee->ieee802_1x = param->value; | ||
7993 | break; | ||
7994 | |||
7995 | //case IW_AUTH_ROAMING_CONTROL: | ||
7996 | case IW_AUTH_PRIVACY_INVOKED: | ||
7997 | ieee->privacy_invoked = param->value; | ||
7998 | break; | ||
7999 | |||
8000 | default: | ||
8001 | return -EOPNOTSUPP; | ||
8002 | } | ||
8003 | return ret; | ||
8004 | } | ||
8005 | |||
8006 | /* SIOCGIWAUTH */ | ||
8007 | static int ipw2100_wx_get_auth(struct net_device *dev, | ||
8008 | struct iw_request_info *info, | ||
8009 | union iwreq_data *wrqu, char *extra) | ||
8010 | { | ||
8011 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8012 | struct ieee80211_device *ieee = priv->ieee; | ||
8013 | struct ieee80211_crypt_data *crypt; | ||
8014 | struct iw_param *param = &wrqu->param; | ||
8015 | int ret = 0; | ||
8016 | |||
8017 | switch (param->flags & IW_AUTH_INDEX) { | ||
8018 | case IW_AUTH_WPA_VERSION: | ||
8019 | case IW_AUTH_CIPHER_PAIRWISE: | ||
8020 | case IW_AUTH_CIPHER_GROUP: | ||
8021 | case IW_AUTH_KEY_MGMT: | ||
8022 | /* | ||
8023 | * wpa_supplicant will control these internally | ||
8024 | */ | ||
8025 | ret = -EOPNOTSUPP; | ||
8026 | break; | ||
8027 | |||
8028 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
8029 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
8030 | if (!crypt || !crypt->ops->get_flags) { | ||
8031 | IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " | ||
8032 | "crypt not set!\n"); | ||
8033 | break; | ||
8034 | } | ||
8035 | |||
8036 | param->value = (crypt->ops->get_flags(crypt->priv) & | ||
8037 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; | ||
8038 | |||
8039 | break; | ||
8040 | |||
8041 | case IW_AUTH_DROP_UNENCRYPTED: | ||
8042 | param->value = ieee->drop_unencrypted; | ||
8043 | break; | ||
8044 | |||
8045 | case IW_AUTH_80211_AUTH_ALG: | ||
8046 | param->value = priv->ieee->sec.auth_mode; | ||
8047 | break; | ||
8048 | |||
8049 | case IW_AUTH_WPA_ENABLED: | ||
8050 | param->value = ieee->wpa_enabled; | ||
8051 | break; | ||
8052 | |||
8053 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
8054 | param->value = ieee->ieee802_1x; | ||
8055 | break; | ||
8056 | |||
8057 | case IW_AUTH_ROAMING_CONTROL: | ||
8058 | case IW_AUTH_PRIVACY_INVOKED: | ||
8059 | param->value = ieee->privacy_invoked; | ||
8060 | break; | ||
8061 | |||
8062 | default: | ||
8063 | return -EOPNOTSUPP; | ||
8064 | } | ||
8065 | return 0; | ||
8066 | } | ||
8067 | |||
8068 | /* SIOCSIWENCODEEXT */ | ||
8069 | static int ipw2100_wx_set_encodeext(struct net_device *dev, | ||
8070 | struct iw_request_info *info, | ||
8071 | union iwreq_data *wrqu, char *extra) | ||
8072 | { | ||
8073 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8074 | return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); | ||
8075 | } | ||
8076 | |||
8077 | /* SIOCGIWENCODEEXT */ | ||
8078 | static int ipw2100_wx_get_encodeext(struct net_device *dev, | ||
8079 | struct iw_request_info *info, | ||
8080 | union iwreq_data *wrqu, char *extra) | ||
8081 | { | ||
8082 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8083 | return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); | ||
8084 | } | ||
8085 | |||
8086 | /* SIOCSIWMLME */ | ||
8087 | static int ipw2100_wx_set_mlme(struct net_device *dev, | ||
8088 | struct iw_request_info *info, | ||
8089 | union iwreq_data *wrqu, char *extra) | ||
8090 | { | ||
8091 | struct ipw2100_priv *priv = ieee80211_priv(dev); | ||
8092 | struct iw_mlme *mlme = (struct iw_mlme *)extra; | ||
8093 | u16 reason; | ||
8094 | |||
8095 | reason = cpu_to_le16(mlme->reason_code); | ||
8096 | |||
8097 | switch (mlme->cmd) { | ||
8098 | case IW_MLME_DEAUTH: | ||
8099 | // silently ignore | ||
8100 | break; | ||
8101 | |||
8102 | case IW_MLME_DISASSOC: | ||
8103 | ipw2100_disassociate_bssid(priv); | ||
8104 | break; | ||
8105 | |||
8106 | default: | ||
8107 | return -EOPNOTSUPP; | ||
8108 | } | ||
8109 | return 0; | ||
8110 | } | ||
8111 | #endif /* WIRELESS_EXT > 17 */ | ||
7893 | 8112 | ||
7894 | /* | 8113 | /* |
7895 | * | 8114 | * |
@@ -7923,7 +8142,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev, | |||
7923 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) | 8142 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) |
7924 | err = ipw2100_switch_mode(priv, priv->last_mode); | 8143 | err = ipw2100_switch_mode(priv, priv->last_mode); |
7925 | } | 8144 | } |
7926 | done: | 8145 | done: |
7927 | up(&priv->action_sem); | 8146 | up(&priv->action_sem); |
7928 | return err; | 8147 | return err; |
7929 | } | 8148 | } |
@@ -7958,7 +8177,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, | |||
7958 | 8177 | ||
7959 | if (priv->power_mode != mode) | 8178 | if (priv->power_mode != mode) |
7960 | err = ipw2100_set_power_mode(priv, mode); | 8179 | err = ipw2100_set_power_mode(priv, mode); |
7961 | done: | 8180 | done: |
7962 | up(&priv->action_sem); | 8181 | up(&priv->action_sem); |
7963 | return err; | 8182 | return err; |
7964 | } | 8183 | } |
@@ -7986,8 +8205,8 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, | |||
7986 | "Power save level: %d (None)", level); | 8205 | "Power save level: %d (None)", level); |
7987 | break; | 8206 | break; |
7988 | case IPW_POWER_AUTO: | 8207 | case IPW_POWER_AUTO: |
7989 | snprintf(extra, MAX_POWER_STRING, | 8208 | snprintf(extra, MAX_POWER_STRING, |
7990 | "Power save level: %d (Auto)", 0); | 8209 | "Power save level: %d (Auto)", 0); |
7991 | break; | 8210 | break; |
7992 | default: | 8211 | default: |
7993 | timeout = timeout_duration[level - 1] / 1000; | 8212 | timeout = timeout_duration[level - 1] / 1000; |
@@ -8004,7 +8223,6 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, | |||
8004 | return 0; | 8223 | return 0; |
8005 | } | 8224 | } |
8006 | 8225 | ||
8007 | |||
8008 | static int ipw2100_wx_set_preamble(struct net_device *dev, | 8226 | static int ipw2100_wx_set_preamble(struct net_device *dev, |
8009 | struct iw_request_info *info, | 8227 | struct iw_request_info *info, |
8010 | union iwreq_data *wrqu, char *extra) | 8228 | union iwreq_data *wrqu, char *extra) |
@@ -8029,14 +8247,14 @@ static int ipw2100_wx_set_preamble(struct net_device *dev, | |||
8029 | 8247 | ||
8030 | err = ipw2100_system_config(priv, 0); | 8248 | err = ipw2100_system_config(priv, 0); |
8031 | 8249 | ||
8032 | done: | 8250 | done: |
8033 | up(&priv->action_sem); | 8251 | up(&priv->action_sem); |
8034 | return err; | 8252 | return err; |
8035 | } | 8253 | } |
8036 | 8254 | ||
8037 | static int ipw2100_wx_get_preamble(struct net_device *dev, | 8255 | static int ipw2100_wx_get_preamble(struct net_device *dev, |
8038 | struct iw_request_info *info, | 8256 | struct iw_request_info *info, |
8039 | union iwreq_data *wrqu, char *extra) | 8257 | union iwreq_data *wrqu, char *extra) |
8040 | { | 8258 | { |
8041 | /* | 8259 | /* |
8042 | * This can be called at any time. No action lock required | 8260 | * This can be called at any time. No action lock required |
@@ -8052,54 +8270,116 @@ static int ipw2100_wx_get_preamble(struct net_device *dev, | |||
8052 | return 0; | 8270 | return 0; |
8053 | } | 8271 | } |
8054 | 8272 | ||
8055 | static iw_handler ipw2100_wx_handlers[] = | 8273 | #ifdef CONFIG_IPW2100_MONITOR |
8056 | { | 8274 | static int ipw2100_wx_set_crc_check(struct net_device *dev, |
8057 | NULL, /* SIOCSIWCOMMIT */ | 8275 | struct iw_request_info *info, |
8058 | ipw2100_wx_get_name, /* SIOCGIWNAME */ | 8276 | union iwreq_data *wrqu, char *extra) |
8059 | NULL, /* SIOCSIWNWID */ | 8277 | { |
8060 | NULL, /* SIOCGIWNWID */ | 8278 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
8061 | ipw2100_wx_set_freq, /* SIOCSIWFREQ */ | 8279 | int err, mode = *(int *)extra; |
8062 | ipw2100_wx_get_freq, /* SIOCGIWFREQ */ | 8280 | |
8063 | ipw2100_wx_set_mode, /* SIOCSIWMODE */ | 8281 | down(&priv->action_sem); |
8064 | ipw2100_wx_get_mode, /* SIOCGIWMODE */ | 8282 | if (!(priv->status & STATUS_INITIALIZED)) { |
8065 | NULL, /* SIOCSIWSENS */ | 8283 | err = -EIO; |
8066 | NULL, /* SIOCGIWSENS */ | 8284 | goto done; |
8067 | NULL, /* SIOCSIWRANGE */ | 8285 | } |
8068 | ipw2100_wx_get_range, /* SIOCGIWRANGE */ | 8286 | |
8069 | NULL, /* SIOCSIWPRIV */ | 8287 | if (mode == 1) |
8070 | NULL, /* SIOCGIWPRIV */ | 8288 | priv->config |= CFG_CRC_CHECK; |
8071 | NULL, /* SIOCSIWSTATS */ | 8289 | else if (mode == 0) |
8072 | NULL, /* SIOCGIWSTATS */ | 8290 | priv->config &= ~CFG_CRC_CHECK; |
8073 | NULL, /* SIOCSIWSPY */ | 8291 | else { |
8074 | NULL, /* SIOCGIWSPY */ | 8292 | err = -EINVAL; |
8075 | NULL, /* SIOCGIWTHRSPY */ | 8293 | goto done; |
8076 | NULL, /* SIOCWIWTHRSPY */ | 8294 | } |
8077 | ipw2100_wx_set_wap, /* SIOCSIWAP */ | 8295 | err = 0; |
8078 | ipw2100_wx_get_wap, /* SIOCGIWAP */ | 8296 | |
8079 | NULL, /* -- hole -- */ | 8297 | done: |
8080 | NULL, /* SIOCGIWAPLIST -- deprecated */ | 8298 | up(&priv->action_sem); |
8081 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ | 8299 | return err; |
8082 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ | 8300 | } |
8083 | ipw2100_wx_set_essid, /* SIOCSIWESSID */ | 8301 | |
8084 | ipw2100_wx_get_essid, /* SIOCGIWESSID */ | 8302 | static int ipw2100_wx_get_crc_check(struct net_device *dev, |
8085 | ipw2100_wx_set_nick, /* SIOCSIWNICKN */ | 8303 | struct iw_request_info *info, |
8086 | ipw2100_wx_get_nick, /* SIOCGIWNICKN */ | 8304 | union iwreq_data *wrqu, char *extra) |
8087 | NULL, /* -- hole -- */ | 8305 | { |
8088 | NULL, /* -- hole -- */ | 8306 | /* |
8089 | ipw2100_wx_set_rate, /* SIOCSIWRATE */ | 8307 | * This can be called at any time. No action lock required |
8090 | ipw2100_wx_get_rate, /* SIOCGIWRATE */ | 8308 | */ |
8091 | ipw2100_wx_set_rts, /* SIOCSIWRTS */ | 8309 | |
8092 | ipw2100_wx_get_rts, /* SIOCGIWRTS */ | 8310 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
8093 | ipw2100_wx_set_frag, /* SIOCSIWFRAG */ | 8311 | |
8094 | ipw2100_wx_get_frag, /* SIOCGIWFRAG */ | 8312 | if (priv->config & CFG_CRC_CHECK) |
8095 | ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ | 8313 | snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); |
8096 | ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ | 8314 | else |
8097 | ipw2100_wx_set_retry, /* SIOCSIWRETRY */ | 8315 | snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); |
8098 | ipw2100_wx_get_retry, /* SIOCGIWRETRY */ | 8316 | |
8099 | ipw2100_wx_set_encode, /* SIOCSIWENCODE */ | 8317 | return 0; |
8100 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ | 8318 | } |
8101 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ | 8319 | #endif /* CONFIG_IPW2100_MONITOR */ |
8102 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ | 8320 | |
8321 | static iw_handler ipw2100_wx_handlers[] = { | ||
8322 | NULL, /* SIOCSIWCOMMIT */ | ||
8323 | ipw2100_wx_get_name, /* SIOCGIWNAME */ | ||
8324 | NULL, /* SIOCSIWNWID */ | ||
8325 | NULL, /* SIOCGIWNWID */ | ||
8326 | ipw2100_wx_set_freq, /* SIOCSIWFREQ */ | ||
8327 | ipw2100_wx_get_freq, /* SIOCGIWFREQ */ | ||
8328 | ipw2100_wx_set_mode, /* SIOCSIWMODE */ | ||
8329 | ipw2100_wx_get_mode, /* SIOCGIWMODE */ | ||
8330 | NULL, /* SIOCSIWSENS */ | ||
8331 | NULL, /* SIOCGIWSENS */ | ||
8332 | NULL, /* SIOCSIWRANGE */ | ||
8333 | ipw2100_wx_get_range, /* SIOCGIWRANGE */ | ||
8334 | NULL, /* SIOCSIWPRIV */ | ||
8335 | NULL, /* SIOCGIWPRIV */ | ||
8336 | NULL, /* SIOCSIWSTATS */ | ||
8337 | NULL, /* SIOCGIWSTATS */ | ||
8338 | NULL, /* SIOCSIWSPY */ | ||
8339 | NULL, /* SIOCGIWSPY */ | ||
8340 | NULL, /* SIOCGIWTHRSPY */ | ||
8341 | NULL, /* SIOCWIWTHRSPY */ | ||
8342 | ipw2100_wx_set_wap, /* SIOCSIWAP */ | ||
8343 | ipw2100_wx_get_wap, /* SIOCGIWAP */ | ||
8344 | #if WIRELESS_EXT > 17 | ||
8345 | ipw2100_wx_set_mlme, /* SIOCSIWMLME */ | ||
8346 | #else | ||
8347 | NULL, /* -- hole -- */ | ||
8348 | #endif | ||
8349 | NULL, /* SIOCGIWAPLIST -- deprecated */ | ||
8350 | ipw2100_wx_set_scan, /* SIOCSIWSCAN */ | ||
8351 | ipw2100_wx_get_scan, /* SIOCGIWSCAN */ | ||
8352 | ipw2100_wx_set_essid, /* SIOCSIWESSID */ | ||
8353 | ipw2100_wx_get_essid, /* SIOCGIWESSID */ | ||
8354 | ipw2100_wx_set_nick, /* SIOCSIWNICKN */ | ||
8355 | ipw2100_wx_get_nick, /* SIOCGIWNICKN */ | ||
8356 | NULL, /* -- hole -- */ | ||
8357 | NULL, /* -- hole -- */ | ||
8358 | ipw2100_wx_set_rate, /* SIOCSIWRATE */ | ||
8359 | ipw2100_wx_get_rate, /* SIOCGIWRATE */ | ||
8360 | ipw2100_wx_set_rts, /* SIOCSIWRTS */ | ||
8361 | ipw2100_wx_get_rts, /* SIOCGIWRTS */ | ||
8362 | ipw2100_wx_set_frag, /* SIOCSIWFRAG */ | ||
8363 | ipw2100_wx_get_frag, /* SIOCGIWFRAG */ | ||
8364 | ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ | ||
8365 | ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ | ||
8366 | ipw2100_wx_set_retry, /* SIOCSIWRETRY */ | ||
8367 | ipw2100_wx_get_retry, /* SIOCGIWRETRY */ | ||
8368 | ipw2100_wx_set_encode, /* SIOCSIWENCODE */ | ||
8369 | ipw2100_wx_get_encode, /* SIOCGIWENCODE */ | ||
8370 | ipw2100_wx_set_power, /* SIOCSIWPOWER */ | ||
8371 | ipw2100_wx_get_power, /* SIOCGIWPOWER */ | ||
8372 | #if WIRELESS_EXT > 17 | ||
8373 | NULL, /* -- hole -- */ | ||
8374 | NULL, /* -- hole -- */ | ||
8375 | ipw2100_wx_set_genie, /* SIOCSIWGENIE */ | ||
8376 | ipw2100_wx_get_genie, /* SIOCGIWGENIE */ | ||
8377 | ipw2100_wx_set_auth, /* SIOCSIWAUTH */ | ||
8378 | ipw2100_wx_get_auth, /* SIOCGIWAUTH */ | ||
8379 | ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ | ||
8380 | ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ | ||
8381 | NULL, /* SIOCSIWPMKSA */ | ||
8382 | #endif | ||
8103 | }; | 8383 | }; |
8104 | 8384 | ||
8105 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV | 8385 | #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV |
@@ -8108,60 +8388,71 @@ static iw_handler ipw2100_wx_handlers[] = | |||
8108 | #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 | 8388 | #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 |
8109 | #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 | 8389 | #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 |
8110 | #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 | 8390 | #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 |
8391 | #define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 | ||
8392 | #define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 | ||
8111 | 8393 | ||
8112 | static const struct iw_priv_args ipw2100_private_args[] = { | 8394 | static const struct iw_priv_args ipw2100_private_args[] = { |
8113 | 8395 | ||
8114 | #ifdef CONFIG_IPW2100_MONITOR | 8396 | #ifdef CONFIG_IPW2100_MONITOR |
8115 | { | 8397 | { |
8116 | IPW2100_PRIV_SET_MONITOR, | 8398 | IPW2100_PRIV_SET_MONITOR, |
8117 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" | 8399 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, |
8118 | }, | ||
8119 | { | 8400 | { |
8120 | IPW2100_PRIV_RESET, | 8401 | IPW2100_PRIV_RESET, |
8121 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" | 8402 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, |
8122 | }, | 8403 | #endif /* CONFIG_IPW2100_MONITOR */ |
8123 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8124 | 8404 | ||
8125 | { | 8405 | { |
8126 | IPW2100_PRIV_SET_POWER, | 8406 | IPW2100_PRIV_SET_POWER, |
8127 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power" | 8407 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, |
8128 | }, | ||
8129 | { | 8408 | { |
8130 | IPW2100_PRIV_GET_POWER, | 8409 | IPW2100_PRIV_GET_POWER, |
8131 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, "get_power" | 8410 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, |
8132 | }, | 8411 | "get_power"}, |
8133 | { | 8412 | { |
8134 | IPW2100_PRIV_SET_LONGPREAMBLE, | 8413 | IPW2100_PRIV_SET_LONGPREAMBLE, |
8135 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" | 8414 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, |
8136 | }, | ||
8137 | { | 8415 | { |
8138 | IPW2100_PRIV_GET_LONGPREAMBLE, | 8416 | IPW2100_PRIV_GET_LONGPREAMBLE, |
8139 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble" | 8417 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, |
8140 | }, | 8418 | #ifdef CONFIG_IPW2100_MONITOR |
8419 | { | ||
8420 | IPW2100_PRIV_SET_CRC_CHECK, | ||
8421 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, | ||
8422 | { | ||
8423 | IPW2100_PRIV_GET_CRC_CHECK, | ||
8424 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, | ||
8425 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8141 | }; | 8426 | }; |
8142 | 8427 | ||
8143 | static iw_handler ipw2100_private_handler[] = { | 8428 | static iw_handler ipw2100_private_handler[] = { |
8144 | #ifdef CONFIG_IPW2100_MONITOR | 8429 | #ifdef CONFIG_IPW2100_MONITOR |
8145 | ipw2100_wx_set_promisc, | 8430 | ipw2100_wx_set_promisc, |
8146 | ipw2100_wx_reset, | 8431 | ipw2100_wx_reset, |
8147 | #else /* CONFIG_IPW2100_MONITOR */ | 8432 | #else /* CONFIG_IPW2100_MONITOR */ |
8148 | NULL, | 8433 | NULL, |
8149 | NULL, | 8434 | NULL, |
8150 | #endif /* CONFIG_IPW2100_MONITOR */ | 8435 | #endif /* CONFIG_IPW2100_MONITOR */ |
8151 | ipw2100_wx_set_powermode, | 8436 | ipw2100_wx_set_powermode, |
8152 | ipw2100_wx_get_powermode, | 8437 | ipw2100_wx_get_powermode, |
8153 | ipw2100_wx_set_preamble, | 8438 | ipw2100_wx_set_preamble, |
8154 | ipw2100_wx_get_preamble, | 8439 | ipw2100_wx_get_preamble, |
8440 | #ifdef CONFIG_IPW2100_MONITOR | ||
8441 | ipw2100_wx_set_crc_check, | ||
8442 | ipw2100_wx_get_crc_check, | ||
8443 | #else /* CONFIG_IPW2100_MONITOR */ | ||
8444 | NULL, | ||
8445 | NULL, | ||
8446 | #endif /* CONFIG_IPW2100_MONITOR */ | ||
8155 | }; | 8447 | }; |
8156 | 8448 | ||
8157 | static struct iw_handler_def ipw2100_wx_handler_def = | 8449 | static struct iw_handler_def ipw2100_wx_handler_def = { |
8158 | { | ||
8159 | .standard = ipw2100_wx_handlers, | 8450 | .standard = ipw2100_wx_handlers, |
8160 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), | 8451 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), |
8161 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), | 8452 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), |
8162 | .num_private_args = sizeof(ipw2100_private_args) / | 8453 | .num_private_args = sizeof(ipw2100_private_args) / |
8163 | sizeof(struct iw_priv_args), | 8454 | sizeof(struct iw_priv_args), |
8164 | .private = (iw_handler *)ipw2100_private_handler, | 8455 | .private = (iw_handler *) ipw2100_private_handler, |
8165 | .private_args = (struct iw_priv_args *)ipw2100_private_args, | 8456 | .private_args = (struct iw_priv_args *)ipw2100_private_args, |
8166 | }; | 8457 | }; |
8167 | 8458 | ||
@@ -8170,7 +8461,7 @@ static struct iw_handler_def ipw2100_wx_handler_def = | |||
8170 | * Called by /proc/net/wireless | 8461 | * Called by /proc/net/wireless |
8171 | * Also called by SIOCGIWSTATS | 8462 | * Also called by SIOCGIWSTATS |
8172 | */ | 8463 | */ |
8173 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | 8464 | static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) |
8174 | { | 8465 | { |
8175 | enum { | 8466 | enum { |
8176 | POOR = 30, | 8467 | POOR = 30, |
@@ -8190,7 +8481,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8190 | u32 ord_len = sizeof(u32); | 8481 | u32 ord_len = sizeof(u32); |
8191 | 8482 | ||
8192 | if (!priv) | 8483 | if (!priv) |
8193 | return (struct iw_statistics *) NULL; | 8484 | return (struct iw_statistics *)NULL; |
8194 | 8485 | ||
8195 | wstats = &priv->wstats; | 8486 | wstats = &priv->wstats; |
8196 | 8487 | ||
@@ -8207,7 +8498,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8207 | wstats->qual.noise = 0; | 8498 | wstats->qual.noise = 0; |
8208 | wstats->qual.updated = 7; | 8499 | wstats->qual.updated = 7; |
8209 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | | 8500 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | |
8210 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | 8501 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; |
8211 | return wstats; | 8502 | return wstats; |
8212 | } | 8503 | } |
8213 | 8504 | ||
@@ -8215,7 +8506,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8215 | &missed_beacons, &ord_len)) | 8506 | &missed_beacons, &ord_len)) |
8216 | goto fail_get_ordinal; | 8507 | goto fail_get_ordinal; |
8217 | 8508 | ||
8218 | /* If we don't have a connection the quality and level is 0*/ | 8509 | /* If we don't have a connection the quality and level is 0 */ |
8219 | if (!(priv->status & STATUS_ASSOCIATED)) { | 8510 | if (!(priv->status & STATUS_ASSOCIATED)) { |
8220 | wstats->qual.qual = 0; | 8511 | wstats->qual.qual = 0; |
8221 | wstats->qual.level = 0; | 8512 | wstats->qual.level = 0; |
@@ -8232,10 +8523,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8232 | rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; | 8523 | rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; |
8233 | else if (rssi < 30) | 8524 | else if (rssi < 30) |
8234 | rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / | 8525 | rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / |
8235 | 10 + GOOD; | 8526 | 10 + GOOD; |
8236 | else | 8527 | else |
8237 | rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / | 8528 | rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / |
8238 | 10 + VERY_GOOD; | 8529 | 10 + VERY_GOOD; |
8239 | 8530 | ||
8240 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, | 8531 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, |
8241 | &tx_retries, &ord_len)) | 8532 | &tx_retries, &ord_len)) |
@@ -8249,25 +8540,25 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8249 | tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; | 8540 | tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; |
8250 | else if (tx_retries > 50) | 8541 | else if (tx_retries > 50) |
8251 | tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / | 8542 | tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / |
8252 | 15 + GOOD; | 8543 | 15 + GOOD; |
8253 | else | 8544 | else |
8254 | tx_qual = (50 - tx_retries) * | 8545 | tx_qual = (50 - tx_retries) * |
8255 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 8546 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
8256 | 8547 | ||
8257 | if (missed_beacons > 50) | 8548 | if (missed_beacons > 50) |
8258 | beacon_qual = (60 - missed_beacons) * POOR / 10; | 8549 | beacon_qual = (60 - missed_beacons) * POOR / 10; |
8259 | else if (missed_beacons > 40) | 8550 | else if (missed_beacons > 40) |
8260 | beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / | 8551 | beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / |
8261 | 10 + POOR; | 8552 | 10 + POOR; |
8262 | else if (missed_beacons > 32) | 8553 | else if (missed_beacons > 32) |
8263 | beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / | 8554 | beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / |
8264 | 18 + FAIR; | 8555 | 18 + FAIR; |
8265 | else if (missed_beacons > 20) | 8556 | else if (missed_beacons > 20) |
8266 | beacon_qual = (32 - missed_beacons) * | 8557 | beacon_qual = (32 - missed_beacons) * |
8267 | (VERY_GOOD - GOOD) / 20 + GOOD; | 8558 | (VERY_GOOD - GOOD) / 20 + GOOD; |
8268 | else | 8559 | else |
8269 | beacon_qual = (20 - missed_beacons) * | 8560 | beacon_qual = (20 - missed_beacons) * |
8270 | (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; | 8561 | (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; |
8271 | 8562 | ||
8272 | quality = min(beacon_qual, min(tx_qual, rssi_qual)); | 8563 | quality = min(beacon_qual, min(tx_qual, rssi_qual)); |
8273 | 8564 | ||
@@ -8290,7 +8581,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8290 | wstats->qual.updated = 7; | 8581 | wstats->qual.updated = 7; |
8291 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; | 8582 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; |
8292 | 8583 | ||
8293 | /* FIXME: this is percent and not a # */ | 8584 | /* FIXME: this is percent and not a # */ |
8294 | wstats->miss.beacon = missed_beacons; | 8585 | wstats->miss.beacon = missed_beacons; |
8295 | 8586 | ||
8296 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, | 8587 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, |
@@ -8300,10 +8591,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) | |||
8300 | 8591 | ||
8301 | return wstats; | 8592 | return wstats; |
8302 | 8593 | ||
8303 | fail_get_ordinal: | 8594 | fail_get_ordinal: |
8304 | IPW_DEBUG_WX("failed querying ordinals.\n"); | 8595 | IPW_DEBUG_WX("failed querying ordinals.\n"); |
8305 | 8596 | ||
8306 | return (struct iw_statistics *) NULL; | 8597 | return (struct iw_statistics *)NULL; |
8307 | } | 8598 | } |
8308 | 8599 | ||
8309 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | 8600 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) |
@@ -8326,23 +8617,17 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8326 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || | 8617 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || |
8327 | priv->status & STATUS_RF_KILL_MASK || | 8618 | priv->status & STATUS_RF_KILL_MASK || |
8328 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, | 8619 | ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, |
8329 | &priv->bssid, &len)) { | 8620 | &priv->bssid, &len)) { |
8330 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | 8621 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); |
8331 | } else { | 8622 | } else { |
8332 | /* We now have the BSSID, so can finish setting to the full | 8623 | /* We now have the BSSID, so can finish setting to the full |
8333 | * associated state */ | 8624 | * associated state */ |
8334 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | 8625 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); |
8335 | memcpy(&priv->ieee->bssid, priv->bssid, ETH_ALEN); | 8626 | memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); |
8336 | priv->status &= ~STATUS_ASSOCIATING; | 8627 | priv->status &= ~STATUS_ASSOCIATING; |
8337 | priv->status |= STATUS_ASSOCIATED; | 8628 | priv->status |= STATUS_ASSOCIATED; |
8338 | netif_carrier_on(priv->net_dev); | 8629 | netif_carrier_on(priv->net_dev); |
8339 | if (netif_queue_stopped(priv->net_dev)) { | 8630 | netif_wake_queue(priv->net_dev); |
8340 | IPW_DEBUG_INFO("Waking net queue.\n"); | ||
8341 | netif_wake_queue(priv->net_dev); | ||
8342 | } else { | ||
8343 | IPW_DEBUG_INFO("Starting net queue.\n"); | ||
8344 | netif_start_queue(priv->net_dev); | ||
8345 | } | ||
8346 | } | 8631 | } |
8347 | 8632 | ||
8348 | if (!(priv->status & STATUS_ASSOCIATED)) { | 8633 | if (!(priv->status & STATUS_ASSOCIATED)) { |
@@ -8351,7 +8636,8 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8351 | /* This is a disassociation event, so kick the firmware to | 8636 | /* This is a disassociation event, so kick the firmware to |
8352 | * look for another AP */ | 8637 | * look for another AP */ |
8353 | if (priv->config & CFG_STATIC_ESSID) | 8638 | if (priv->config & CFG_STATIC_ESSID) |
8354 | ipw2100_set_essid(priv, priv->essid, priv->essid_len, 0); | 8639 | ipw2100_set_essid(priv, priv->essid, priv->essid_len, |
8640 | 0); | ||
8355 | else | 8641 | else |
8356 | ipw2100_set_essid(priv, NULL, 0, 0); | 8642 | ipw2100_set_essid(priv, NULL, 0, 0); |
8357 | up(&priv->action_sem); | 8643 | up(&priv->action_sem); |
@@ -8374,7 +8660,6 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
8374 | 8660 | ||
8375 | #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" | 8661 | #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" |
8376 | 8662 | ||
8377 | |||
8378 | /* | 8663 | /* |
8379 | 8664 | ||
8380 | BINARY FIRMWARE HEADER FORMAT | 8665 | BINARY FIRMWARE HEADER FORMAT |
@@ -8396,12 +8681,10 @@ struct ipw2100_fw_header { | |||
8396 | unsigned int uc_size; | 8681 | unsigned int uc_size; |
8397 | } __attribute__ ((packed)); | 8682 | } __attribute__ ((packed)); |
8398 | 8683 | ||
8399 | |||
8400 | |||
8401 | static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) | 8684 | static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) |
8402 | { | 8685 | { |
8403 | struct ipw2100_fw_header *h = | 8686 | struct ipw2100_fw_header *h = |
8404 | (struct ipw2100_fw_header *)fw->fw_entry->data; | 8687 | (struct ipw2100_fw_header *)fw->fw_entry->data; |
8405 | 8688 | ||
8406 | if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { | 8689 | if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { |
8407 | printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " | 8690 | printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " |
@@ -8420,7 +8703,6 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) | |||
8420 | return 0; | 8703 | return 0; |
8421 | } | 8704 | } |
8422 | 8705 | ||
8423 | |||
8424 | static int ipw2100_get_firmware(struct ipw2100_priv *priv, | 8706 | static int ipw2100_get_firmware(struct ipw2100_priv *priv, |
8425 | struct ipw2100_fw *fw) | 8707 | struct ipw2100_fw *fw) |
8426 | { | 8708 | { |
@@ -8428,7 +8710,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, | |||
8428 | int rc; | 8710 | int rc; |
8429 | 8711 | ||
8430 | IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", | 8712 | IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", |
8431 | priv->net_dev->name); | 8713 | priv->net_dev->name); |
8432 | 8714 | ||
8433 | switch (priv->ieee->iw_mode) { | 8715 | switch (priv->ieee->iw_mode) { |
8434 | case IW_MODE_ADHOC: | 8716 | case IW_MODE_ADHOC: |
@@ -8454,7 +8736,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, | |||
8454 | return rc; | 8736 | return rc; |
8455 | } | 8737 | } |
8456 | IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, | 8738 | IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, |
8457 | fw->fw_entry->size); | 8739 | fw->fw_entry->size); |
8458 | 8740 | ||
8459 | ipw2100_mod_firmware_load(fw); | 8741 | ipw2100_mod_firmware_load(fw); |
8460 | 8742 | ||
@@ -8470,7 +8752,6 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, | |||
8470 | fw->fw_entry = NULL; | 8752 | fw->fw_entry = NULL; |
8471 | } | 8753 | } |
8472 | 8754 | ||
8473 | |||
8474 | static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, | 8755 | static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, |
8475 | size_t max) | 8756 | size_t max) |
8476 | { | 8757 | { |
@@ -8479,8 +8760,7 @@ static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, | |||
8479 | u32 tmp; | 8760 | u32 tmp; |
8480 | int i; | 8761 | int i; |
8481 | /* firmware version is an ascii string (max len of 14) */ | 8762 | /* firmware version is an ascii string (max len of 14) */ |
8482 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, | 8763 | if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) |
8483 | ver, &len)) | ||
8484 | return -EIO; | 8764 | return -EIO; |
8485 | tmp = max; | 8765 | tmp = max; |
8486 | if (len >= max) | 8766 | if (len >= max) |
@@ -8497,8 +8777,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, | |||
8497 | u32 ver; | 8777 | u32 ver; |
8498 | u32 len = sizeof(ver); | 8778 | u32 len = sizeof(ver); |
8499 | /* microcode version is a 32 bit integer */ | 8779 | /* microcode version is a 32 bit integer */ |
8500 | if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, | 8780 | if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) |
8501 | &ver, &len)) | ||
8502 | return -EIO; | 8781 | return -EIO; |
8503 | return snprintf(buf, max, "%08X", ver); | 8782 | return snprintf(buf, max, "%08X", ver); |
8504 | } | 8783 | } |
@@ -8506,8 +8785,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, | |||
8506 | /* | 8785 | /* |
8507 | * On exit, the firmware will have been freed from the fw list | 8786 | * On exit, the firmware will have been freed from the fw list |
8508 | */ | 8787 | */ |
8509 | static int ipw2100_fw_download(struct ipw2100_priv *priv, | 8788 | static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) |
8510 | struct ipw2100_fw *fw) | ||
8511 | { | 8789 | { |
8512 | /* firmware is constructed of N contiguous entries, each entry is | 8790 | /* firmware is constructed of N contiguous entries, each entry is |
8513 | * structured as: | 8791 | * structured as: |
@@ -8515,7 +8793,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8515 | * offset sie desc | 8793 | * offset sie desc |
8516 | * 0 4 address to write to | 8794 | * 0 4 address to write to |
8517 | * 4 2 length of data run | 8795 | * 4 2 length of data run |
8518 | * 6 length data | 8796 | * 6 length data |
8519 | */ | 8797 | */ |
8520 | unsigned int addr; | 8798 | unsigned int addr; |
8521 | unsigned short len; | 8799 | unsigned short len; |
@@ -8524,12 +8802,12 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8524 | unsigned int firmware_data_left = fw->fw.size; | 8802 | unsigned int firmware_data_left = fw->fw.size; |
8525 | 8803 | ||
8526 | while (firmware_data_left > 0) { | 8804 | while (firmware_data_left > 0) { |
8527 | addr = *(u32 *)(firmware_data); | 8805 | addr = *(u32 *) (firmware_data); |
8528 | firmware_data += 4; | 8806 | firmware_data += 4; |
8529 | firmware_data_left -= 4; | 8807 | firmware_data_left -= 4; |
8530 | 8808 | ||
8531 | len = *(u16 *)(firmware_data); | 8809 | len = *(u16 *) (firmware_data); |
8532 | firmware_data += 2; | 8810 | firmware_data += 2; |
8533 | firmware_data_left -= 2; | 8811 | firmware_data_left -= 2; |
8534 | 8812 | ||
8535 | if (len > 32) { | 8813 | if (len > 32) { |
@@ -8540,7 +8818,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, | |||
8540 | } | 8818 | } |
8541 | 8819 | ||
8542 | write_nic_memory(priv->net_dev, addr, len, firmware_data); | 8820 | write_nic_memory(priv->net_dev, addr, len, firmware_data); |
8543 | firmware_data += len; | 8821 | firmware_data += len; |
8544 | firmware_data_left -= len; | 8822 | firmware_data_left -= len; |
8545 | } | 8823 | } |
8546 | 8824 | ||
@@ -8654,21 +8932,19 @@ static int ipw2100_ucode_download(struct ipw2100_priv *priv, | |||
8654 | for (i = 0; i < 30; i++) { | 8932 | for (i = 0; i < 30; i++) { |
8655 | /* Read alive response structure */ | 8933 | /* Read alive response structure */ |
8656 | for (j = 0; | 8934 | for (j = 0; |
8657 | j < (sizeof(struct symbol_alive_response) >> 1); | 8935 | j < (sizeof(struct symbol_alive_response) >> 1); j++) |
8658 | j++) | 8936 | read_nic_word(dev, 0x210004, ((u16 *) & response) + j); |
8659 | read_nic_word(dev, 0x210004, | ||
8660 | ((u16 *)&response) + j); | ||
8661 | 8937 | ||
8662 | if ((response.cmd_id == 1) && | 8938 | if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) |
8663 | (response.ucode_valid == 0x1)) | ||
8664 | break; | 8939 | break; |
8665 | udelay(10); | 8940 | udelay(10); |
8666 | } | 8941 | } |
8667 | 8942 | ||
8668 | if (i == 30) { | 8943 | if (i == 30) { |
8669 | printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n", | 8944 | printk(KERN_ERR DRV_NAME |
8945 | ": %s: No response from Symbol - hw not alive\n", | ||
8670 | dev->name); | 8946 | dev->name); |
8671 | printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response)); | 8947 | printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); |
8672 | return -EIO; | 8948 | return -EIO; |
8673 | } | 8949 | } |
8674 | 8950 | ||
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index c9e99ce15d66..140fdf2a0a09 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2004 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 |
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/socket.h> | 37 | #include <linux/socket.h> |
38 | #include <linux/if_arp.h> | 38 | #include <linux/if_arp.h> |
39 | #include <linux/wireless.h> | 39 | #include <linux/wireless.h> |
40 | #include <linux/version.h> | ||
41 | #include <net/iw_handler.h> // new driver API | 40 | #include <net/iw_handler.h> // new driver API |
42 | 41 | ||
43 | #include <net/ieee80211.h> | 42 | #include <net/ieee80211.h> |
@@ -93,7 +92,6 @@ struct ipw2100_rx_packet; | |||
93 | #define IPW_DL_IOCTL (1<<14) | 92 | #define IPW_DL_IOCTL (1<<14) |
94 | #define IPW_DL_RF_KILL (1<<17) | 93 | #define IPW_DL_RF_KILL (1<<17) |
95 | 94 | ||
96 | |||
97 | #define IPW_DL_MANAGE (1<<15) | 95 | #define IPW_DL_MANAGE (1<<15) |
98 | #define IPW_DL_FW (1<<16) | 96 | #define IPW_DL_FW (1<<16) |
99 | 97 | ||
@@ -156,7 +154,9 @@ extern const char *band_str[]; | |||
156 | 154 | ||
157 | struct bd_status { | 155 | struct bd_status { |
158 | union { | 156 | union { |
159 | struct { u8 nlf:1, txType:2, intEnabled:1, reserved:4;} fields; | 157 | struct { |
158 | u8 nlf:1, txType:2, intEnabled:1, reserved:4; | ||
159 | } fields; | ||
160 | u8 field; | 160 | u8 field; |
161 | } info; | 161 | } info; |
162 | } __attribute__ ((packed)); | 162 | } __attribute__ ((packed)); |
@@ -165,7 +165,7 @@ struct ipw2100_bd { | |||
165 | u32 host_addr; | 165 | u32 host_addr; |
166 | u32 buf_length; | 166 | u32 buf_length; |
167 | struct bd_status status; | 167 | struct bd_status status; |
168 | /* number of fragments for frame (should be set only for | 168 | /* number of fragments for frame (should be set only for |
169 | * 1st TBD) */ | 169 | * 1st TBD) */ |
170 | u8 num_fragments; | 170 | u8 num_fragments; |
171 | u8 reserved[6]; | 171 | u8 reserved[6]; |
@@ -293,10 +293,10 @@ struct ipw2100_cmd_header { | |||
293 | struct ipw2100_data_header { | 293 | struct ipw2100_data_header { |
294 | u32 host_command_reg; | 294 | u32 host_command_reg; |
295 | u32 host_command_reg1; | 295 | u32 host_command_reg1; |
296 | u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver | 296 | u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver |
297 | u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC | 297 | u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC |
298 | u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key | 298 | u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key |
299 | u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV | 299 | u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV |
300 | u8 key[16]; | 300 | u8 key[16]; |
301 | u8 reserved[10]; // f/w reserved | 301 | u8 reserved[10]; // f/w reserved |
302 | u8 src_addr[ETH_ALEN]; | 302 | u8 src_addr[ETH_ALEN]; |
@@ -306,14 +306,13 @@ struct ipw2100_data_header { | |||
306 | 306 | ||
307 | /* Host command data structure */ | 307 | /* Host command data structure */ |
308 | struct host_command { | 308 | struct host_command { |
309 | u32 host_command; // COMMAND ID | 309 | u32 host_command; // COMMAND ID |
310 | u32 host_command1; // COMMAND ID | 310 | u32 host_command1; // COMMAND ID |
311 | u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) | 311 | u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) |
312 | u32 host_command_length; // LENGTH | 312 | u32 host_command_length; // LENGTH |
313 | u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS | 313 | u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS |
314 | } __attribute__ ((packed)); | 314 | } __attribute__ ((packed)); |
315 | 315 | ||
316 | |||
317 | typedef enum { | 316 | typedef enum { |
318 | POWER_ON_RESET, | 317 | POWER_ON_RESET, |
319 | EXIT_POWER_DOWN_RESET, | 318 | EXIT_POWER_DOWN_RESET, |
@@ -328,17 +327,16 @@ enum { | |||
328 | RX | 327 | RX |
329 | }; | 328 | }; |
330 | 329 | ||
331 | |||
332 | struct ipw2100_tx_packet { | 330 | struct ipw2100_tx_packet { |
333 | int type; | 331 | int type; |
334 | int index; | 332 | int index; |
335 | union { | 333 | union { |
336 | struct { /* COMMAND */ | 334 | struct { /* COMMAND */ |
337 | struct ipw2100_cmd_header* cmd; | 335 | struct ipw2100_cmd_header *cmd; |
338 | dma_addr_t cmd_phys; | 336 | dma_addr_t cmd_phys; |
339 | } c_struct; | 337 | } c_struct; |
340 | struct { /* DATA */ | 338 | struct { /* DATA */ |
341 | struct ipw2100_data_header* data; | 339 | struct ipw2100_data_header *data; |
342 | dma_addr_t data_phys; | 340 | dma_addr_t data_phys; |
343 | struct ieee80211_txb *txb; | 341 | struct ieee80211_txb *txb; |
344 | } d_struct; | 342 | } d_struct; |
@@ -348,7 +346,6 @@ struct ipw2100_tx_packet { | |||
348 | struct list_head list; | 346 | struct list_head list; |
349 | }; | 347 | }; |
350 | 348 | ||
351 | |||
352 | struct ipw2100_rx_packet { | 349 | struct ipw2100_rx_packet { |
353 | struct ipw2100_rx *rxp; | 350 | struct ipw2100_rx *rxp; |
354 | dma_addr_t dma_addr; | 351 | dma_addr_t dma_addr; |
@@ -432,13 +429,13 @@ enum { | |||
432 | }; | 429 | }; |
433 | 430 | ||
434 | #define STATUS_POWERED (1<<0) | 431 | #define STATUS_POWERED (1<<0) |
435 | #define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ | 432 | #define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ |
436 | #define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ | 433 | #define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ |
437 | #define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ | 434 | #define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ |
438 | #define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ | 435 | #define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ |
439 | #define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ | 436 | #define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ |
440 | #define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ | 437 | #define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ |
441 | #define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ | 438 | #define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ |
442 | #define STATUS_INT_ENABLED (1<<11) | 439 | #define STATUS_INT_ENABLED (1<<11) |
443 | #define STATUS_RF_KILL_HW (1<<12) | 440 | #define STATUS_RF_KILL_HW (1<<12) |
444 | #define STATUS_RF_KILL_SW (1<<13) | 441 | #define STATUS_RF_KILL_SW (1<<13) |
@@ -451,9 +448,7 @@ enum { | |||
451 | #define STATUS_SCAN_COMPLETE (1<<26) | 448 | #define STATUS_SCAN_COMPLETE (1<<26) |
452 | #define STATUS_WX_EVENT_PENDING (1<<27) | 449 | #define STATUS_WX_EVENT_PENDING (1<<27) |
453 | #define STATUS_RESET_PENDING (1<<29) | 450 | #define STATUS_RESET_PENDING (1<<29) |
454 | #define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ | 451 | #define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ |
455 | |||
456 | |||
457 | 452 | ||
458 | /* Internal NIC states */ | 453 | /* Internal NIC states */ |
459 | #define IPW_STATE_INITIALIZED (1<<0) | 454 | #define IPW_STATE_INITIALIZED (1<<0) |
@@ -469,11 +464,9 @@ enum { | |||
469 | #define IPW_STATE_POWER_DOWN (1<<10) | 464 | #define IPW_STATE_POWER_DOWN (1<<10) |
470 | #define IPW_STATE_SCANNING (1<<11) | 465 | #define IPW_STATE_SCANNING (1<<11) |
471 | 466 | ||
472 | 467 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ | |
473 | 468 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | |
474 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ | 469 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ |
475 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | ||
476 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ | ||
477 | #define CFG_CUSTOM_MAC (1<<3) | 470 | #define CFG_CUSTOM_MAC (1<<3) |
478 | #define CFG_LONG_PREAMBLE (1<<4) | 471 | #define CFG_LONG_PREAMBLE (1<<4) |
479 | #define CFG_ASSOCIATE (1<<6) | 472 | #define CFG_ASSOCIATE (1<<6) |
@@ -481,14 +474,17 @@ enum { | |||
481 | #define CFG_ADHOC_CREATE (1<<8) | 474 | #define CFG_ADHOC_CREATE (1<<8) |
482 | #define CFG_C3_DISABLED (1<<9) | 475 | #define CFG_C3_DISABLED (1<<9) |
483 | #define CFG_PASSIVE_SCAN (1<<10) | 476 | #define CFG_PASSIVE_SCAN (1<<10) |
477 | #ifdef CONFIG_IPW2100_MONITOR | ||
478 | #define CFG_CRC_CHECK (1<<11) | ||
479 | #endif | ||
484 | 480 | ||
485 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ | 481 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ |
486 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ | 482 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ |
487 | 483 | ||
488 | struct ipw2100_priv { | 484 | struct ipw2100_priv { |
489 | 485 | ||
490 | int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ | 486 | int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ |
491 | int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ | 487 | int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ |
492 | 488 | ||
493 | struct ieee80211_device *ieee; | 489 | struct ieee80211_device *ieee; |
494 | unsigned long status; | 490 | unsigned long status; |
@@ -519,19 +515,16 @@ struct ipw2100_priv { | |||
519 | unsigned long hw_features; | 515 | unsigned long hw_features; |
520 | int hangs; | 516 | int hangs; |
521 | u32 last_rtc; | 517 | u32 last_rtc; |
522 | int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ | 518 | int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ |
523 | u8* snapshot[0x30]; | 519 | u8 *snapshot[0x30]; |
524 | 520 | ||
525 | u8 mandatory_bssid_mac[ETH_ALEN]; | 521 | u8 mandatory_bssid_mac[ETH_ALEN]; |
526 | u8 mac_addr[ETH_ALEN]; | 522 | u8 mac_addr[ETH_ALEN]; |
527 | 523 | ||
528 | int power_mode; | 524 | int power_mode; |
529 | 525 | ||
530 | /* WEP data */ | ||
531 | struct ieee80211_security sec; | ||
532 | int messages_sent; | 526 | int messages_sent; |
533 | 527 | ||
534 | |||
535 | int short_retry_limit; | 528 | int short_retry_limit; |
536 | int long_retry_limit; | 529 | int long_retry_limit; |
537 | 530 | ||
@@ -599,7 +592,6 @@ struct ipw2100_priv { | |||
599 | wait_queue_head_t wait_command_queue; | 592 | wait_queue_head_t wait_command_queue; |
600 | }; | 593 | }; |
601 | 594 | ||
602 | |||
603 | /********************************************************* | 595 | /********************************************************* |
604 | * Host Command -> From Driver to FW | 596 | * Host Command -> From Driver to FW |
605 | *********************************************************/ | 597 | *********************************************************/ |
@@ -646,7 +638,6 @@ struct ipw2100_priv { | |||
646 | #define CARD_DISABLE_PHY_OFF 61 | 638 | #define CARD_DISABLE_PHY_OFF 61 |
647 | #define MSDU_TX_RATES 62 | 639 | #define MSDU_TX_RATES 62 |
648 | 640 | ||
649 | |||
650 | /* Rogue AP Detection */ | 641 | /* Rogue AP Detection */ |
651 | #define SET_STATION_STAT_BITS 64 | 642 | #define SET_STATION_STAT_BITS 64 |
652 | #define CLEAR_STATIONS_STAT_BITS 65 | 643 | #define CLEAR_STATIONS_STAT_BITS 65 |
@@ -655,8 +646,6 @@ struct ipw2100_priv { | |||
655 | #define DISASSOCIATION_BSSID 68 | 646 | #define DISASSOCIATION_BSSID 68 |
656 | #define SET_WPA_IE 69 | 647 | #define SET_WPA_IE 69 |
657 | 648 | ||
658 | |||
659 | |||
660 | /* system configuration bit mask: */ | 649 | /* system configuration bit mask: */ |
661 | #define IPW_CFG_MONITOR 0x00004 | 650 | #define IPW_CFG_MONITOR 0x00004 |
662 | #define IPW_CFG_PREAMBLE_AUTO 0x00010 | 651 | #define IPW_CFG_PREAMBLE_AUTO 0x00010 |
@@ -704,7 +693,7 @@ struct ipw2100_priv { | |||
704 | #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) | 693 | #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) |
705 | #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 | 694 | #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 |
706 | #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 | 695 | #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 |
707 | #define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 | 696 | #define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 |
708 | #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 | 697 | #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 |
709 | #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 | 698 | #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 |
710 | #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 | 699 | #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 |
@@ -784,9 +773,6 @@ struct ipw2100_priv { | |||
784 | #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli | 773 | #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli |
785 | #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli | 774 | #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli |
786 | 775 | ||
787 | |||
788 | |||
789 | |||
790 | #define IPW_HEADER_802_11_SIZE sizeof(struct ieee80211_hdr_3addr) | 776 | #define IPW_HEADER_802_11_SIZE sizeof(struct ieee80211_hdr_3addr) |
791 | #define IPW_MAX_80211_PAYLOAD_SIZE 2304U | 777 | #define IPW_MAX_80211_PAYLOAD_SIZE 2304U |
792 | #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 | 778 | #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 |
@@ -843,8 +829,8 @@ struct ipw2100_rx { | |||
843 | #define IPW_TX_POWER_MIN_DBM (-12) | 829 | #define IPW_TX_POWER_MIN_DBM (-12) |
844 | #define IPW_TX_POWER_MAX_DBM 16 | 830 | #define IPW_TX_POWER_MAX_DBM 16 |
845 | 831 | ||
846 | #define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan | 832 | #define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan |
847 | #define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan | 833 | #define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan |
848 | 834 | ||
849 | #define REG_MIN_CHANNEL 0 | 835 | #define REG_MIN_CHANNEL 0 |
850 | #define REG_MAX_CHANNEL 14 | 836 | #define REG_MAX_CHANNEL 14 |
@@ -856,7 +842,6 @@ struct ipw2100_rx { | |||
856 | #define DIVERSITY_ANTENNA_A 1 // Use antenna A | 842 | #define DIVERSITY_ANTENNA_A 1 // Use antenna A |
857 | #define DIVERSITY_ANTENNA_B 2 // Use antenna B | 843 | #define DIVERSITY_ANTENNA_B 2 // Use antenna B |
858 | 844 | ||
859 | |||
860 | #define HOST_COMMAND_WAIT 0 | 845 | #define HOST_COMMAND_WAIT 0 |
861 | #define HOST_COMMAND_NO_WAIT 1 | 846 | #define HOST_COMMAND_NO_WAIT 1 |
862 | 847 | ||
@@ -873,10 +858,9 @@ struct ipw2100_rx { | |||
873 | #define TYPE_ASSOCIATION_REQUEST 0x0013 | 858 | #define TYPE_ASSOCIATION_REQUEST 0x0013 |
874 | #define TYPE_REASSOCIATION_REQUEST 0x0014 | 859 | #define TYPE_REASSOCIATION_REQUEST 0x0014 |
875 | 860 | ||
876 | 861 | #define HW_FEATURE_RFKILL 0x0001 | |
877 | #define HW_FEATURE_RFKILL (0x0001) | 862 | #define RF_KILLSWITCH_OFF 1 |
878 | #define RF_KILLSWITCH_OFF (1) | 863 | #define RF_KILLSWITCH_ON 0 |
879 | #define RF_KILLSWITCH_ON (0) | ||
880 | 864 | ||
881 | #define IPW_COMMAND_POOL_SIZE 40 | 865 | #define IPW_COMMAND_POOL_SIZE 40 |
882 | 866 | ||
@@ -895,7 +879,7 @@ struct ipw2100_rx { | |||
895 | // Fixed size data: Ordinal Table 1 | 879 | // Fixed size data: Ordinal Table 1 |
896 | typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | 880 | typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW |
897 | // Transmit statistics | 881 | // Transmit statistics |
898 | IPW_ORD_STAT_TX_HOST_REQUESTS = 1,// # of requested Host Tx's (MSDU) | 882 | IPW_ORD_STAT_TX_HOST_REQUESTS = 1, // # of requested Host Tx's (MSDU) |
899 | IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) | 883 | IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) |
900 | IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) | 884 | IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) |
901 | 885 | ||
@@ -905,42 +889,42 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
905 | IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB | 889 | IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB |
906 | IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB | 890 | IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB |
907 | 891 | ||
908 | IPW_ORD_STAT_TX_NODIR_DATA1 = 13,// # of successful Non_Directed Tx's (MSDU) @ 1MB | 892 | IPW_ORD_STAT_TX_NODIR_DATA1 = 13, // # of successful Non_Directed Tx's (MSDU) @ 1MB |
909 | IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB | 893 | IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB |
910 | IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB | 894 | IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB |
911 | IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB | 895 | IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB |
912 | 896 | ||
913 | IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's | 897 | IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's |
914 | IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS | 898 | IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS |
915 | IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS | 899 | IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS |
916 | IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK | 900 | IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK |
917 | IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's | 901 | IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's |
918 | IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's | 902 | IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's |
919 | IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's | 903 | IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's |
920 | IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's | 904 | IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's |
921 | IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted | 905 | IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted |
922 | IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted | 906 | IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted |
923 | IPW_ORD_STAT_TX_BEACON, // # of tx beacon | 907 | IPW_ORD_STAT_TX_BEACON, // # of tx beacon |
924 | IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM | 908 | IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM |
925 | IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX | 909 | IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX |
926 | IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx | 910 | IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx |
927 | IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX | 911 | IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX |
928 | 912 | ||
929 | IPW_ORD_STAT_TX_TOTAL_BYTES = 41,// Total successful Tx data bytes | 913 | IPW_ORD_STAT_TX_TOTAL_BYTES = 41, // Total successful Tx data bytes |
930 | IPW_ORD_STAT_TX_RETRIES, // # of Tx retries | 914 | IPW_ORD_STAT_TX_RETRIES, // # of Tx retries |
931 | IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS | 915 | IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS |
932 | IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS | 916 | IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS |
933 | IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS | 917 | IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS |
934 | IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS | 918 | IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS |
935 | 919 | ||
936 | IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures | 920 | IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures |
937 | IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time | 921 | IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time |
938 | IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP,// # of times max tries in a hop failed | 922 | IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP, // # of times max tries in a hop failed |
939 | IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup | 923 | IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup |
940 | IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted | 924 | IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted |
941 | IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed | 925 | IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed |
942 | IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames | 926 | IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames |
943 | IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent | 927 | IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent |
944 | IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks | 928 | IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks |
945 | 929 | ||
946 | // Receive statistics | 930 | // Receive statistics |
@@ -952,7 +936,7 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
952 | IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB | 936 | IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB |
953 | IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB | 937 | IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB |
954 | 938 | ||
955 | IPW_ORD_STAT_RX_NODIR_DATA = 71,// # of nondirected packets | 939 | IPW_ORD_STAT_RX_NODIR_DATA = 71, // # of nondirected packets |
956 | IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB | 940 | IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB |
957 | IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB | 941 | IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB |
958 | IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB | 942 | IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB |
@@ -977,18 +961,18 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
977 | IPW_ORD_STAT_RX_AUTH, // # of authentication Rx | 961 | IPW_ORD_STAT_RX_AUTH, // # of authentication Rx |
978 | IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx | 962 | IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx |
979 | 963 | ||
980 | IPW_ORD_STAT_RX_TOTAL_BYTES = 101,// Total rx data bytes received | 964 | IPW_ORD_STAT_RX_TOTAL_BYTES = 101, // Total rx data bytes received |
981 | IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error | 965 | IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error |
982 | IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB | 966 | IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB |
983 | IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB | 967 | IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB |
984 | IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB | 968 | IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB |
985 | IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB | 969 | IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB |
986 | 970 | ||
987 | IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB | 971 | IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB |
988 | IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB | 972 | IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB |
989 | IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB | 973 | IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB |
990 | IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB | 974 | IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB |
991 | IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets | 975 | IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets |
992 | 976 | ||
993 | IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db | 977 | IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db |
994 | IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db | 978 | IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db |
@@ -1006,17 +990,17 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW | |||
1006 | IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption | 990 | IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption |
1007 | 991 | ||
1008 | // PSP Statistics | 992 | // PSP Statistics |
1009 | IPW_ORD_STAT_PSP_SUSPENSION = 137,// # of times adapter suspended | 993 | IPW_ORD_STAT_PSP_SUSPENSION = 137, // # of times adapter suspended |
1010 | IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout | 994 | IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout |
1011 | IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts | 995 | IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts |
1012 | IPW_ORD_STAT_PSP_NONDIR_TIMEOUT,// # of timeouts waiting for last broadcast/muticast pkt | 996 | IPW_ORD_STAT_PSP_NONDIR_TIMEOUT, // # of timeouts waiting for last broadcast/muticast pkt |
1013 | IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received | 997 | IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received |
1014 | IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received | 998 | IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received |
1015 | IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID | 999 | IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID |
1016 | 1000 | ||
1017 | // Association and roaming | 1001 | // Association and roaming |
1018 | IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association | 1002 | IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association |
1019 | IPW_ORD_STAT_PERCENT_MISSED_BCNS,// current calculation of % missed beacons | 1003 | IPW_ORD_STAT_PERCENT_MISSED_BCNS, // current calculation of % missed beacons |
1020 | IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries | 1004 | IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries |
1021 | IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated | 1005 | IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated |
1022 | // AP table entry. set to 0 if not associated | 1006 | // AP table entry. set to 0 if not associated |
@@ -1151,7 +1135,7 @@ struct ipw2100_fw_chunk { | |||
1151 | }; | 1135 | }; |
1152 | 1136 | ||
1153 | struct ipw2100_fw_chunk_set { | 1137 | struct ipw2100_fw_chunk_set { |
1154 | const void *data; | 1138 | const void *data; |
1155 | unsigned long size; | 1139 | unsigned long size; |
1156 | }; | 1140 | }; |
1157 | 1141 | ||
@@ -1164,4 +1148,4 @@ struct ipw2100_fw { | |||
1164 | 1148 | ||
1165 | #define MAX_FW_VERSION_LEN 14 | 1149 | #define MAX_FW_VERSION_LEN 14 |
1166 | 1150 | ||
1167 | #endif /* _IPW2100_H */ | 1151 | #endif /* _IPW2100_H */ |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 3db0c32afe82..b0d195d1721a 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.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 | 802.11 status code portion of this file from ethereal-0.10.6: | 5 | 802.11 status code portion of this file from ethereal-0.10.6: |
6 | Copyright 2000, Axis Communications AB | 6 | Copyright 2000, Axis Communications AB |
@@ -31,30 +31,103 @@ | |||
31 | ******************************************************************************/ | 31 | ******************************************************************************/ |
32 | 32 | ||
33 | #include "ipw2200.h" | 33 | #include "ipw2200.h" |
34 | #include <linux/version.h> | ||
34 | 35 | ||
35 | #define IPW2200_VERSION "1.0.0" | 36 | #define IPW2200_VERSION "git-1.0.8" |
36 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
37 | #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" | 38 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" |
38 | #define DRV_VERSION IPW2200_VERSION | 39 | #define DRV_VERSION IPW2200_VERSION |
39 | 40 | ||
41 | #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) | ||
42 | |||
40 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 43 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
41 | MODULE_VERSION(DRV_VERSION); | 44 | MODULE_VERSION(DRV_VERSION); |
42 | MODULE_AUTHOR(DRV_COPYRIGHT); | 45 | MODULE_AUTHOR(DRV_COPYRIGHT); |
43 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
44 | 47 | ||
48 | static int cmdlog = 0; | ||
45 | static int debug = 0; | 49 | static int debug = 0; |
46 | static int channel = 0; | 50 | static int channel = 0; |
47 | static char *ifname; | ||
48 | static int mode = 0; | 51 | static int mode = 0; |
49 | 52 | ||
50 | static u32 ipw_debug_level; | 53 | static u32 ipw_debug_level; |
51 | static int associate = 1; | 54 | static int associate = 1; |
52 | static int auto_create = 1; | 55 | static int auto_create = 1; |
56 | static int led = 0; | ||
53 | static int disable = 0; | 57 | static int disable = 0; |
58 | static int hwcrypto = 1; | ||
54 | static const char ipw_modes[] = { | 59 | static const char ipw_modes[] = { |
55 | 'a', 'b', 'g', '?' | 60 | 'a', 'b', 'g', '?' |
56 | }; | 61 | }; |
57 | 62 | ||
63 | #ifdef CONFIG_IPW_QOS | ||
64 | static int qos_enable = 0; | ||
65 | static int qos_burst_enable = 0; | ||
66 | static int qos_no_ack_mask = 0; | ||
67 | static int burst_duration_CCK = 0; | ||
68 | static int burst_duration_OFDM = 0; | ||
69 | |||
70 | static struct ieee80211_qos_parameters def_qos_parameters_OFDM = { | ||
71 | {QOS_TX0_CW_MIN_OFDM, QOS_TX1_CW_MIN_OFDM, QOS_TX2_CW_MIN_OFDM, | ||
72 | QOS_TX3_CW_MIN_OFDM}, | ||
73 | {QOS_TX0_CW_MAX_OFDM, QOS_TX1_CW_MAX_OFDM, QOS_TX2_CW_MAX_OFDM, | ||
74 | QOS_TX3_CW_MAX_OFDM}, | ||
75 | {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, | ||
76 | {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, | ||
77 | {QOS_TX0_TXOP_LIMIT_OFDM, QOS_TX1_TXOP_LIMIT_OFDM, | ||
78 | QOS_TX2_TXOP_LIMIT_OFDM, QOS_TX3_TXOP_LIMIT_OFDM} | ||
79 | }; | ||
80 | |||
81 | static struct ieee80211_qos_parameters def_qos_parameters_CCK = { | ||
82 | {QOS_TX0_CW_MIN_CCK, QOS_TX1_CW_MIN_CCK, QOS_TX2_CW_MIN_CCK, | ||
83 | QOS_TX3_CW_MIN_CCK}, | ||
84 | {QOS_TX0_CW_MAX_CCK, QOS_TX1_CW_MAX_CCK, QOS_TX2_CW_MAX_CCK, | ||
85 | QOS_TX3_CW_MAX_CCK}, | ||
86 | {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, | ||
87 | {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, | ||
88 | {QOS_TX0_TXOP_LIMIT_CCK, QOS_TX1_TXOP_LIMIT_CCK, QOS_TX2_TXOP_LIMIT_CCK, | ||
89 | QOS_TX3_TXOP_LIMIT_CCK} | ||
90 | }; | ||
91 | |||
92 | static struct ieee80211_qos_parameters def_parameters_OFDM = { | ||
93 | {DEF_TX0_CW_MIN_OFDM, DEF_TX1_CW_MIN_OFDM, DEF_TX2_CW_MIN_OFDM, | ||
94 | DEF_TX3_CW_MIN_OFDM}, | ||
95 | {DEF_TX0_CW_MAX_OFDM, DEF_TX1_CW_MAX_OFDM, DEF_TX2_CW_MAX_OFDM, | ||
96 | DEF_TX3_CW_MAX_OFDM}, | ||
97 | {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, | ||
98 | {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, | ||
99 | {DEF_TX0_TXOP_LIMIT_OFDM, DEF_TX1_TXOP_LIMIT_OFDM, | ||
100 | DEF_TX2_TXOP_LIMIT_OFDM, DEF_TX3_TXOP_LIMIT_OFDM} | ||
101 | }; | ||
102 | |||
103 | static struct ieee80211_qos_parameters def_parameters_CCK = { | ||
104 | {DEF_TX0_CW_MIN_CCK, DEF_TX1_CW_MIN_CCK, DEF_TX2_CW_MIN_CCK, | ||
105 | DEF_TX3_CW_MIN_CCK}, | ||
106 | {DEF_TX0_CW_MAX_CCK, DEF_TX1_CW_MAX_CCK, DEF_TX2_CW_MAX_CCK, | ||
107 | DEF_TX3_CW_MAX_CCK}, | ||
108 | {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, | ||
109 | {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, | ||
110 | {DEF_TX0_TXOP_LIMIT_CCK, DEF_TX1_TXOP_LIMIT_CCK, DEF_TX2_TXOP_LIMIT_CCK, | ||
111 | DEF_TX3_TXOP_LIMIT_CCK} | ||
112 | }; | ||
113 | |||
114 | static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; | ||
115 | |||
116 | static int from_priority_to_tx_queue[] = { | ||
117 | IPW_TX_QUEUE_1, IPW_TX_QUEUE_2, IPW_TX_QUEUE_2, IPW_TX_QUEUE_1, | ||
118 | IPW_TX_QUEUE_3, IPW_TX_QUEUE_3, IPW_TX_QUEUE_4, IPW_TX_QUEUE_4 | ||
119 | }; | ||
120 | |||
121 | static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv); | ||
122 | |||
123 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | ||
124 | *qos_param); | ||
125 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | ||
126 | *qos_param); | ||
127 | #endif /* CONFIG_IPW_QOS */ | ||
128 | |||
129 | static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev); | ||
130 | static void ipw_remove_current_network(struct ipw_priv *priv); | ||
58 | static void ipw_rx(struct ipw_priv *priv); | 131 | static void ipw_rx(struct ipw_priv *priv); |
59 | static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | 132 | static int ipw_queue_tx_reclaim(struct ipw_priv *priv, |
60 | struct clx2_tx_queue *txq, int qindex); | 133 | struct clx2_tx_queue *txq, int qindex); |
@@ -68,42 +141,24 @@ static void ipw_tx_queue_free(struct ipw_priv *); | |||
68 | static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); | 141 | static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); |
69 | static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); | 142 | static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); |
70 | static void ipw_rx_queue_replenish(void *); | 143 | static void ipw_rx_queue_replenish(void *); |
71 | |||
72 | static int ipw_up(struct ipw_priv *); | 144 | static int ipw_up(struct ipw_priv *); |
145 | static void ipw_bg_up(void *); | ||
73 | static void ipw_down(struct ipw_priv *); | 146 | static void ipw_down(struct ipw_priv *); |
147 | static void ipw_bg_down(void *); | ||
74 | static int ipw_config(struct ipw_priv *); | 148 | static int ipw_config(struct ipw_priv *); |
75 | static int init_supported_rates(struct ipw_priv *priv, | 149 | static int init_supported_rates(struct ipw_priv *priv, |
76 | struct ipw_supported_rates *prates); | 150 | struct ipw_supported_rates *prates); |
151 | static void ipw_set_hwcrypto_keys(struct ipw_priv *); | ||
152 | static void ipw_send_wep_keys(struct ipw_priv *, int); | ||
77 | 153 | ||
78 | static u8 band_b_active_channel[MAX_B_CHANNELS] = { | 154 | static int ipw_is_valid_channel(struct ieee80211_device *, u8); |
79 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 | 155 | static int ipw_channel_to_index(struct ieee80211_device *, u8); |
80 | }; | 156 | static u8 ipw_freq_to_channel(struct ieee80211_device *, u32); |
81 | static u8 band_a_active_channel[MAX_A_CHANNELS] = { | 157 | static int ipw_set_geo(struct ieee80211_device *, const struct ieee80211_geo *); |
82 | 36, 40, 44, 48, 149, 153, 157, 161, 165, 52, 56, 60, 64, 0 | 158 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *); |
83 | }; | ||
84 | 159 | ||
85 | static int is_valid_channel(int mode_mask, int channel) | 160 | static int snprint_line(char *buf, size_t count, |
86 | { | 161 | const u8 * data, u32 len, u32 ofs) |
87 | int i; | ||
88 | |||
89 | if (!channel) | ||
90 | return 0; | ||
91 | |||
92 | if (mode_mask & IEEE_A) | ||
93 | for (i = 0; i < MAX_A_CHANNELS; i++) | ||
94 | if (band_a_active_channel[i] == channel) | ||
95 | return IEEE_A; | ||
96 | |||
97 | if (mode_mask & (IEEE_B | IEEE_G)) | ||
98 | for (i = 0; i < MAX_B_CHANNELS; i++) | ||
99 | if (band_b_active_channel[i] == channel) | ||
100 | return mode_mask & (IEEE_B | IEEE_G); | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static char *snprint_line(char *buf, size_t count, | ||
106 | const u8 * data, u32 len, u32 ofs) | ||
107 | { | 162 | { |
108 | int out, i, j, l; | 163 | int out, i, j, l; |
109 | char c; | 164 | char c; |
@@ -134,7 +189,7 @@ static char *snprint_line(char *buf, size_t count, | |||
134 | out += snprintf(buf + out, count - out, " "); | 189 | out += snprintf(buf + out, count - out, " "); |
135 | } | 190 | } |
136 | 191 | ||
137 | return buf; | 192 | return out; |
138 | } | 193 | } |
139 | 194 | ||
140 | static void printk_buf(int level, const u8 * data, u32 len) | 195 | static void printk_buf(int level, const u8 * data, u32 len) |
@@ -145,14 +200,33 @@ static void printk_buf(int level, const u8 * data, u32 len) | |||
145 | return; | 200 | return; |
146 | 201 | ||
147 | while (len) { | 202 | while (len) { |
148 | printk(KERN_DEBUG "%s\n", | 203 | snprint_line(line, sizeof(line), &data[ofs], |
149 | snprint_line(line, sizeof(line), &data[ofs], | 204 | min(len, 16U), ofs); |
150 | min(len, 16U), ofs)); | 205 | printk(KERN_DEBUG "%s\n", line); |
151 | ofs += 16; | 206 | ofs += 16; |
152 | len -= min(len, 16U); | 207 | len -= min(len, 16U); |
153 | } | 208 | } |
154 | } | 209 | } |
155 | 210 | ||
211 | static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) | ||
212 | { | ||
213 | size_t out = size; | ||
214 | u32 ofs = 0; | ||
215 | int total = 0; | ||
216 | |||
217 | while (size && len) { | ||
218 | out = snprint_line(output, size, &data[ofs], | ||
219 | min_t(size_t, len, 16U), ofs); | ||
220 | |||
221 | ofs += 16; | ||
222 | output += out; | ||
223 | size -= out; | ||
224 | len -= min_t(size_t, len, 16U); | ||
225 | total += out; | ||
226 | } | ||
227 | return total; | ||
228 | } | ||
229 | |||
156 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); | 230 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); |
157 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) | 231 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) |
158 | 232 | ||
@@ -226,38 +300,42 @@ static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | |||
226 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) | 300 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
227 | 301 | ||
228 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 302 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
229 | #define ipw_read_indirect(a, b, c, d) \ | 303 | static inline void __ipw_read_indirect(const char *f, int l, |
230 | IPW_DEBUG_IO("%s %d: read_inddirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 304 | struct ipw_priv *a, u32 b, u8 * c, int d) |
231 | _ipw_read_indirect(a, b, c, d) | 305 | { |
306 | IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %d bytes\n", f, l, (u32) (b), | ||
307 | d); | ||
308 | _ipw_read_indirect(a, b, c, d); | ||
309 | } | ||
310 | |||
311 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) | ||
232 | 312 | ||
233 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, | 313 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
234 | int num); | 314 | int num); |
235 | #define ipw_write_indirect(a, b, c, d) \ | 315 | #define ipw_write_indirect(a, b, c, d) \ |
236 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 316 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
237 | _ipw_write_indirect(a, b, c, d) | 317 | _ipw_write_indirect(a, b, c, d) |
238 | 318 | ||
239 | /* indirect write s */ | 319 | /* indirect write s */ |
240 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | 320 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
241 | { | 321 | { |
242 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); | 322 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
243 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); | 323 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); |
244 | _ipw_write32(priv, CX2_INDIRECT_DATA, value); | 324 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); |
245 | } | 325 | } |
246 | 326 | ||
247 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 327 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
248 | { | 328 | { |
249 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 329 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
250 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 330 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
251 | _ipw_write8(priv, CX2_INDIRECT_DATA, value); | 331 | _ipw_write8(priv, IPW_INDIRECT_DATA, value); |
252 | IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", | ||
253 | (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), value); | ||
254 | } | 332 | } |
255 | 333 | ||
256 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | 334 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
257 | { | 335 | { |
258 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 336 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
259 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 337 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
260 | _ipw_write16(priv, CX2_INDIRECT_DATA, value); | 338 | _ipw_write16(priv, IPW_INDIRECT_DATA, value); |
261 | } | 339 | } |
262 | 340 | ||
263 | /* indirect read s */ | 341 | /* indirect read s */ |
@@ -265,9 +343,9 @@ static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | |||
265 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | 343 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) |
266 | { | 344 | { |
267 | u32 word; | 345 | u32 word; |
268 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 346 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); |
269 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); | 347 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); |
270 | word = _ipw_read32(priv, CX2_INDIRECT_DATA); | 348 | word = _ipw_read32(priv, IPW_INDIRECT_DATA); |
271 | return (word >> ((reg & 0x3) * 8)) & 0xff; | 349 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
272 | } | 350 | } |
273 | 351 | ||
@@ -277,8 +355,8 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
277 | 355 | ||
278 | IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); | 356 | IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); |
279 | 357 | ||
280 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); | 358 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); |
281 | value = _ipw_read32(priv, CX2_INDIRECT_DATA); | 359 | value = _ipw_read32(priv, IPW_INDIRECT_DATA); |
282 | IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x \n", reg, value); | 360 | IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x \n", reg, value); |
283 | return value; | 361 | return value; |
284 | } | 362 | } |
@@ -287,67 +365,69 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
287 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 365 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
288 | int num) | 366 | int num) |
289 | { | 367 | { |
290 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; | 368 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; |
291 | u32 dif_len = addr - aligned_addr; | 369 | u32 dif_len = addr - aligned_addr; |
292 | u32 aligned_len; | ||
293 | u32 i; | 370 | u32 i; |
294 | 371 | ||
295 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); | 372 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); |
296 | 373 | ||
374 | if (num <= 0) { | ||
375 | return; | ||
376 | } | ||
377 | |||
297 | /* Read the first nibble byte by byte */ | 378 | /* Read the first nibble byte by byte */ |
298 | if (unlikely(dif_len)) { | 379 | if (unlikely(dif_len)) { |
380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | ||
299 | /* Start reading at aligned_addr + dif_len */ | 381 | /* Start reading at aligned_addr + dif_len */ |
300 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 382 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--) |
301 | for (i = dif_len; i < 4; i++, buf++) | 383 | *buf++ = _ipw_read8(priv, IPW_INDIRECT_DATA + i); |
302 | *buf = _ipw_read8(priv, CX2_INDIRECT_DATA + i); | ||
303 | num -= dif_len; | ||
304 | aligned_addr += 4; | 384 | aligned_addr += 4; |
305 | } | 385 | } |
306 | 386 | ||
307 | /* Read DWs through autoinc register */ | 387 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
308 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 388 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
309 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 389 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); |
310 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | ||
311 | *(u32 *) buf = ipw_read32(priv, CX2_AUTOINC_DATA); | ||
312 | 390 | ||
313 | /* Copy the last nibble */ | 391 | /* Copy the last nibble */ |
314 | dif_len = num - aligned_len; | 392 | if (unlikely(num)) { |
315 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 393 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
316 | for (i = 0; i < dif_len; i++, buf++) | 394 | for (i = 0; num > 0; i++, num--) |
317 | *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); | 395 | *buf++ = ipw_read8(priv, IPW_INDIRECT_DATA + i); |
396 | } | ||
318 | } | 397 | } |
319 | 398 | ||
320 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 399 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
321 | int num) | 400 | int num) |
322 | { | 401 | { |
323 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; | 402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; |
324 | u32 dif_len = addr - aligned_addr; | 403 | u32 dif_len = addr - aligned_addr; |
325 | u32 aligned_len; | ||
326 | u32 i; | 404 | u32 i; |
327 | 405 | ||
328 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); | 406 | IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); |
329 | 407 | ||
408 | if (num <= 0) { | ||
409 | return; | ||
410 | } | ||
411 | |||
330 | /* Write the first nibble byte by byte */ | 412 | /* Write the first nibble byte by byte */ |
331 | if (unlikely(dif_len)) { | 413 | if (unlikely(dif_len)) { |
332 | /* Start writing at aligned_addr + dif_len */ | 414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
333 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 415 | /* Start reading at aligned_addr + dif_len */ |
334 | for (i = dif_len; i < 4; i++, buf++) | 416 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) |
335 | _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); | 417 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
336 | num -= dif_len; | ||
337 | aligned_addr += 4; | 418 | aligned_addr += 4; |
338 | } | 419 | } |
339 | 420 | ||
340 | /* Write DWs through autoinc register */ | 421 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
341 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 422 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
342 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 423 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); |
343 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | ||
344 | _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32 *) buf); | ||
345 | 424 | ||
346 | /* Copy the last nibble */ | 425 | /* Copy the last nibble */ |
347 | dif_len = num - aligned_len; | 426 | if (unlikely(num)) { |
348 | _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); | 427 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
349 | for (i = 0; i < dif_len; i++, buf++) | 428 | for (i = 0; num > 0; i++, num--, buf++) |
350 | _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); | 429 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
430 | } | ||
351 | } | 431 | } |
352 | 432 | ||
353 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, | 433 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, |
@@ -371,7 +451,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv) | |||
371 | if (priv->status & STATUS_INT_ENABLED) | 451 | if (priv->status & STATUS_INT_ENABLED) |
372 | return; | 452 | return; |
373 | priv->status |= STATUS_INT_ENABLED; | 453 | priv->status |= STATUS_INT_ENABLED; |
374 | ipw_write32(priv, CX2_INTA_MASK_R, CX2_INTA_MASK_ALL); | 454 | ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); |
375 | } | 455 | } |
376 | 456 | ||
377 | static inline void ipw_disable_interrupts(struct ipw_priv *priv) | 457 | static inline void ipw_disable_interrupts(struct ipw_priv *priv) |
@@ -379,9 +459,10 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) | |||
379 | if (!(priv->status & STATUS_INT_ENABLED)) | 459 | if (!(priv->status & STATUS_INT_ENABLED)) |
380 | return; | 460 | return; |
381 | priv->status &= ~STATUS_INT_ENABLED; | 461 | priv->status &= ~STATUS_INT_ENABLED; |
382 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 462 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
383 | } | 463 | } |
384 | 464 | ||
465 | #ifdef CONFIG_IPW_DEBUG | ||
385 | static char *ipw_error_desc(u32 val) | 466 | static char *ipw_error_desc(u32 val) |
386 | { | 467 | { |
387 | switch (val) { | 468 | switch (val) { |
@@ -394,81 +475,65 @@ static char *ipw_error_desc(u32 val) | |||
394 | case IPW_FW_ERROR_MEMORY_OVERFLOW: | 475 | case IPW_FW_ERROR_MEMORY_OVERFLOW: |
395 | return "MEMORY_OVERFLOW"; | 476 | return "MEMORY_OVERFLOW"; |
396 | case IPW_FW_ERROR_BAD_PARAM: | 477 | case IPW_FW_ERROR_BAD_PARAM: |
397 | return "ERROR_BAD_PARAM"; | 478 | return "BAD_PARAM"; |
398 | case IPW_FW_ERROR_BAD_CHECKSUM: | 479 | case IPW_FW_ERROR_BAD_CHECKSUM: |
399 | return "ERROR_BAD_CHECKSUM"; | 480 | return "BAD_CHECKSUM"; |
400 | case IPW_FW_ERROR_NMI_INTERRUPT: | 481 | case IPW_FW_ERROR_NMI_INTERRUPT: |
401 | return "ERROR_NMI_INTERRUPT"; | 482 | return "NMI_INTERRUPT"; |
402 | case IPW_FW_ERROR_BAD_DATABASE: | 483 | case IPW_FW_ERROR_BAD_DATABASE: |
403 | return "ERROR_BAD_DATABASE"; | 484 | return "BAD_DATABASE"; |
404 | case IPW_FW_ERROR_ALLOC_FAIL: | 485 | case IPW_FW_ERROR_ALLOC_FAIL: |
405 | return "ERROR_ALLOC_FAIL"; | 486 | return "ALLOC_FAIL"; |
406 | case IPW_FW_ERROR_DMA_UNDERRUN: | 487 | case IPW_FW_ERROR_DMA_UNDERRUN: |
407 | return "ERROR_DMA_UNDERRUN"; | 488 | return "DMA_UNDERRUN"; |
408 | case IPW_FW_ERROR_DMA_STATUS: | 489 | case IPW_FW_ERROR_DMA_STATUS: |
409 | return "ERROR_DMA_STATUS"; | 490 | return "DMA_STATUS"; |
410 | case IPW_FW_ERROR_DINOSTATUS_ERROR: | 491 | case IPW_FW_ERROR_DINO_ERROR: |
411 | return "ERROR_DINOSTATUS_ERROR"; | 492 | return "DINO_ERROR"; |
412 | case IPW_FW_ERROR_EEPROMSTATUS_ERROR: | 493 | case IPW_FW_ERROR_EEPROM_ERROR: |
413 | return "ERROR_EEPROMSTATUS_ERROR"; | 494 | return "EEPROM_ERROR"; |
414 | case IPW_FW_ERROR_SYSASSERT: | 495 | case IPW_FW_ERROR_SYSASSERT: |
415 | return "ERROR_SYSASSERT"; | 496 | return "SYSASSERT"; |
416 | case IPW_FW_ERROR_FATAL_ERROR: | 497 | case IPW_FW_ERROR_FATAL_ERROR: |
417 | return "ERROR_FATALSTATUS_ERROR"; | 498 | return "FATAL_ERROR"; |
418 | default: | 499 | default: |
419 | return "UNKNOWNSTATUS_ERROR"; | 500 | return "UNKNOWN_ERROR"; |
420 | } | 501 | } |
421 | } | 502 | } |
422 | 503 | ||
423 | static void ipw_dump_nic_error_log(struct ipw_priv *priv) | 504 | static void ipw_dump_error_log(struct ipw_priv *priv, |
505 | struct ipw_fw_error *error) | ||
424 | { | 506 | { |
425 | u32 desc, time, blink1, blink2, ilink1, ilink2, idata, i, count, base; | 507 | u32 i; |
426 | |||
427 | base = ipw_read32(priv, IPWSTATUS_ERROR_LOG); | ||
428 | count = ipw_read_reg32(priv, base); | ||
429 | 508 | ||
430 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | 509 | if (!error) { |
431 | IPW_ERROR("Start IPW Error Log Dump:\n"); | 510 | IPW_ERROR("Error allocating and capturing error log. " |
432 | IPW_ERROR("Status: 0x%08X, Config: %08X\n", | 511 | "Nothing to dump.\n"); |
433 | priv->status, priv->config); | 512 | return; |
434 | } | 513 | } |
435 | 514 | ||
436 | for (i = ERROR_START_OFFSET; | 515 | IPW_ERROR("Start IPW Error Log Dump:\n"); |
437 | i <= count * ERROR_ELEM_SIZE; i += ERROR_ELEM_SIZE) { | 516 | IPW_ERROR("Status: 0x%08X, Config: %08X\n", |
438 | desc = ipw_read_reg32(priv, base + i); | 517 | error->status, error->config); |
439 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); | ||
440 | blink1 = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); | ||
441 | blink2 = ipw_read_reg32(priv, base + i + 3 * sizeof(u32)); | ||
442 | ilink1 = ipw_read_reg32(priv, base + i + 4 * sizeof(u32)); | ||
443 | ilink2 = ipw_read_reg32(priv, base + i + 5 * sizeof(u32)); | ||
444 | idata = ipw_read_reg32(priv, base + i + 6 * sizeof(u32)); | ||
445 | 518 | ||
519 | for (i = 0; i < error->elem_len; i++) | ||
446 | IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", | 520 | IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", |
447 | ipw_error_desc(desc), time, blink1, blink2, | 521 | ipw_error_desc(error->elem[i].desc), |
448 | ilink1, ilink2, idata); | 522 | error->elem[i].time, |
449 | } | 523 | error->elem[i].blink1, |
524 | error->elem[i].blink2, | ||
525 | error->elem[i].link1, | ||
526 | error->elem[i].link2, error->elem[i].data); | ||
527 | for (i = 0; i < error->log_len; i++) | ||
528 | IPW_ERROR("%i\t0x%08x\t%i\n", | ||
529 | error->log[i].time, | ||
530 | error->log[i].data, error->log[i].event); | ||
450 | } | 531 | } |
532 | #endif | ||
451 | 533 | ||
452 | static void ipw_dump_nic_event_log(struct ipw_priv *priv) | 534 | static inline int ipw_is_init(struct ipw_priv *priv) |
453 | { | 535 | { |
454 | u32 ev, time, data, i, count, base; | 536 | return (priv->status & STATUS_INIT) ? 1 : 0; |
455 | |||
456 | base = ipw_read32(priv, IPW_EVENT_LOG); | ||
457 | count = ipw_read_reg32(priv, base); | ||
458 | |||
459 | if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE) | ||
460 | IPW_ERROR("Start IPW Event Log Dump:\n"); | ||
461 | |||
462 | for (i = EVENT_START_OFFSET; | ||
463 | i <= count * EVENT_ELEM_SIZE; i += EVENT_ELEM_SIZE) { | ||
464 | ev = ipw_read_reg32(priv, base + i); | ||
465 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); | ||
466 | data = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); | ||
467 | |||
468 | #ifdef CONFIG_IPW_DEBUG | ||
469 | IPW_ERROR("%i\t0x%08x\t%i\n", time, data, ev); | ||
470 | #endif | ||
471 | } | ||
472 | } | 537 | } |
473 | 538 | ||
474 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) | 539 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) |
@@ -636,6 +701,340 @@ static void ipw_init_ordinals(struct ipw_priv *priv) | |||
636 | 701 | ||
637 | } | 702 | } |
638 | 703 | ||
704 | u32 ipw_register_toggle(u32 reg) | ||
705 | { | ||
706 | reg &= ~IPW_START_STANDBY; | ||
707 | if (reg & IPW_GATE_ODMA) | ||
708 | reg &= ~IPW_GATE_ODMA; | ||
709 | if (reg & IPW_GATE_IDMA) | ||
710 | reg &= ~IPW_GATE_IDMA; | ||
711 | if (reg & IPW_GATE_ADMA) | ||
712 | reg &= ~IPW_GATE_ADMA; | ||
713 | return reg; | ||
714 | } | ||
715 | |||
716 | /* | ||
717 | * LED behavior: | ||
718 | * - On radio ON, turn on any LEDs that require to be on during start | ||
719 | * - On initialization, start unassociated blink | ||
720 | * - On association, disable unassociated blink | ||
721 | * - On disassociation, start unassociated blink | ||
722 | * - On radio OFF, turn off any LEDs started during radio on | ||
723 | * | ||
724 | */ | ||
725 | #define LD_TIME_LINK_ON 300 | ||
726 | #define LD_TIME_LINK_OFF 2700 | ||
727 | #define LD_TIME_ACT_ON 250 | ||
728 | |||
729 | void ipw_led_link_on(struct ipw_priv *priv) | ||
730 | { | ||
731 | unsigned long flags; | ||
732 | u32 led; | ||
733 | |||
734 | /* If configured to not use LEDs, or nic_type is 1, | ||
735 | * then we don't toggle a LINK led */ | ||
736 | if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) | ||
737 | return; | ||
738 | |||
739 | spin_lock_irqsave(&priv->lock, flags); | ||
740 | |||
741 | if (!(priv->status & STATUS_RF_KILL_MASK) && | ||
742 | !(priv->status & STATUS_LED_LINK_ON)) { | ||
743 | IPW_DEBUG_LED("Link LED On\n"); | ||
744 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
745 | led |= priv->led_association_on; | ||
746 | |||
747 | led = ipw_register_toggle(led); | ||
748 | |||
749 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
750 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
751 | |||
752 | priv->status |= STATUS_LED_LINK_ON; | ||
753 | |||
754 | /* If we aren't associated, schedule turning the LED off */ | ||
755 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
756 | queue_delayed_work(priv->workqueue, | ||
757 | &priv->led_link_off, | ||
758 | LD_TIME_LINK_ON); | ||
759 | } | ||
760 | |||
761 | spin_unlock_irqrestore(&priv->lock, flags); | ||
762 | } | ||
763 | |||
764 | static void ipw_bg_led_link_on(void *data) | ||
765 | { | ||
766 | struct ipw_priv *priv = data; | ||
767 | down(&priv->sem); | ||
768 | ipw_led_link_on(data); | ||
769 | up(&priv->sem); | ||
770 | } | ||
771 | |||
772 | void ipw_led_link_off(struct ipw_priv *priv) | ||
773 | { | ||
774 | unsigned long flags; | ||
775 | u32 led; | ||
776 | |||
777 | /* If configured not to use LEDs, or nic type is 1, | ||
778 | * then we don't goggle the LINK led. */ | ||
779 | if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) | ||
780 | return; | ||
781 | |||
782 | spin_lock_irqsave(&priv->lock, flags); | ||
783 | |||
784 | if (priv->status & STATUS_LED_LINK_ON) { | ||
785 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
786 | led &= priv->led_association_off; | ||
787 | led = ipw_register_toggle(led); | ||
788 | |||
789 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
790 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
791 | |||
792 | IPW_DEBUG_LED("Link LED Off\n"); | ||
793 | |||
794 | priv->status &= ~STATUS_LED_LINK_ON; | ||
795 | |||
796 | /* If we aren't associated and the radio is on, schedule | ||
797 | * turning the LED on (blink while unassociated) */ | ||
798 | if (!(priv->status & STATUS_RF_KILL_MASK) && | ||
799 | !(priv->status & STATUS_ASSOCIATED)) | ||
800 | queue_delayed_work(priv->workqueue, &priv->led_link_on, | ||
801 | LD_TIME_LINK_OFF); | ||
802 | |||
803 | } | ||
804 | |||
805 | spin_unlock_irqrestore(&priv->lock, flags); | ||
806 | } | ||
807 | |||
808 | static void ipw_bg_led_link_off(void *data) | ||
809 | { | ||
810 | struct ipw_priv *priv = data; | ||
811 | down(&priv->sem); | ||
812 | ipw_led_link_off(data); | ||
813 | up(&priv->sem); | ||
814 | } | ||
815 | |||
816 | static inline void __ipw_led_activity_on(struct ipw_priv *priv) | ||
817 | { | ||
818 | u32 led; | ||
819 | |||
820 | if (priv->config & CFG_NO_LED) | ||
821 | return; | ||
822 | |||
823 | if (priv->status & STATUS_RF_KILL_MASK) | ||
824 | return; | ||
825 | |||
826 | if (!(priv->status & STATUS_LED_ACT_ON)) { | ||
827 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
828 | led |= priv->led_activity_on; | ||
829 | |||
830 | led = ipw_register_toggle(led); | ||
831 | |||
832 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
833 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
834 | |||
835 | IPW_DEBUG_LED("Activity LED On\n"); | ||
836 | |||
837 | priv->status |= STATUS_LED_ACT_ON; | ||
838 | |||
839 | cancel_delayed_work(&priv->led_act_off); | ||
840 | queue_delayed_work(priv->workqueue, &priv->led_act_off, | ||
841 | LD_TIME_ACT_ON); | ||
842 | } else { | ||
843 | /* Reschedule LED off for full time period */ | ||
844 | cancel_delayed_work(&priv->led_act_off); | ||
845 | queue_delayed_work(priv->workqueue, &priv->led_act_off, | ||
846 | LD_TIME_ACT_ON); | ||
847 | } | ||
848 | } | ||
849 | |||
850 | void ipw_led_activity_on(struct ipw_priv *priv) | ||
851 | { | ||
852 | unsigned long flags; | ||
853 | spin_lock_irqsave(&priv->lock, flags); | ||
854 | __ipw_led_activity_on(priv); | ||
855 | spin_unlock_irqrestore(&priv->lock, flags); | ||
856 | } | ||
857 | |||
858 | void ipw_led_activity_off(struct ipw_priv *priv) | ||
859 | { | ||
860 | unsigned long flags; | ||
861 | u32 led; | ||
862 | |||
863 | if (priv->config & CFG_NO_LED) | ||
864 | return; | ||
865 | |||
866 | spin_lock_irqsave(&priv->lock, flags); | ||
867 | |||
868 | if (priv->status & STATUS_LED_ACT_ON) { | ||
869 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
870 | led &= priv->led_activity_off; | ||
871 | |||
872 | led = ipw_register_toggle(led); | ||
873 | |||
874 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
875 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
876 | |||
877 | IPW_DEBUG_LED("Activity LED Off\n"); | ||
878 | |||
879 | priv->status &= ~STATUS_LED_ACT_ON; | ||
880 | } | ||
881 | |||
882 | spin_unlock_irqrestore(&priv->lock, flags); | ||
883 | } | ||
884 | |||
885 | static void ipw_bg_led_activity_off(void *data) | ||
886 | { | ||
887 | struct ipw_priv *priv = data; | ||
888 | down(&priv->sem); | ||
889 | ipw_led_activity_off(data); | ||
890 | up(&priv->sem); | ||
891 | } | ||
892 | |||
893 | void ipw_led_band_on(struct ipw_priv *priv) | ||
894 | { | ||
895 | unsigned long flags; | ||
896 | u32 led; | ||
897 | |||
898 | /* Only nic type 1 supports mode LEDs */ | ||
899 | if (priv->config & CFG_NO_LED || | ||
900 | priv->nic_type != EEPROM_NIC_TYPE_1 || !priv->assoc_network) | ||
901 | return; | ||
902 | |||
903 | spin_lock_irqsave(&priv->lock, flags); | ||
904 | |||
905 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
906 | if (priv->assoc_network->mode == IEEE_A) { | ||
907 | led |= priv->led_ofdm_on; | ||
908 | led &= priv->led_association_off; | ||
909 | IPW_DEBUG_LED("Mode LED On: 802.11a\n"); | ||
910 | } else if (priv->assoc_network->mode == IEEE_G) { | ||
911 | led |= priv->led_ofdm_on; | ||
912 | led |= priv->led_association_on; | ||
913 | IPW_DEBUG_LED("Mode LED On: 802.11g\n"); | ||
914 | } else { | ||
915 | led &= priv->led_ofdm_off; | ||
916 | led |= priv->led_association_on; | ||
917 | IPW_DEBUG_LED("Mode LED On: 802.11b\n"); | ||
918 | } | ||
919 | |||
920 | led = ipw_register_toggle(led); | ||
921 | |||
922 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
923 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
924 | |||
925 | spin_unlock_irqrestore(&priv->lock, flags); | ||
926 | } | ||
927 | |||
928 | void ipw_led_band_off(struct ipw_priv *priv) | ||
929 | { | ||
930 | unsigned long flags; | ||
931 | u32 led; | ||
932 | |||
933 | /* Only nic type 1 supports mode LEDs */ | ||
934 | if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) | ||
935 | return; | ||
936 | |||
937 | spin_lock_irqsave(&priv->lock, flags); | ||
938 | |||
939 | led = ipw_read_reg32(priv, IPW_EVENT_REG); | ||
940 | led &= priv->led_ofdm_off; | ||
941 | led &= priv->led_association_off; | ||
942 | |||
943 | led = ipw_register_toggle(led); | ||
944 | |||
945 | IPW_DEBUG_LED("Reg: 0x%08X\n", led); | ||
946 | ipw_write_reg32(priv, IPW_EVENT_REG, led); | ||
947 | |||
948 | spin_unlock_irqrestore(&priv->lock, flags); | ||
949 | } | ||
950 | |||
951 | void ipw_led_radio_on(struct ipw_priv *priv) | ||
952 | { | ||
953 | ipw_led_link_on(priv); | ||
954 | } | ||
955 | |||
956 | void ipw_led_radio_off(struct ipw_priv *priv) | ||
957 | { | ||
958 | ipw_led_activity_off(priv); | ||
959 | ipw_led_link_off(priv); | ||
960 | } | ||
961 | |||
962 | void ipw_led_link_up(struct ipw_priv *priv) | ||
963 | { | ||
964 | /* Set the Link Led on for all nic types */ | ||
965 | ipw_led_link_on(priv); | ||
966 | } | ||
967 | |||
968 | void ipw_led_link_down(struct ipw_priv *priv) | ||
969 | { | ||
970 | ipw_led_activity_off(priv); | ||
971 | ipw_led_link_off(priv); | ||
972 | |||
973 | if (priv->status & STATUS_RF_KILL_MASK) | ||
974 | ipw_led_radio_off(priv); | ||
975 | } | ||
976 | |||
977 | void ipw_led_init(struct ipw_priv *priv) | ||
978 | { | ||
979 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; | ||
980 | |||
981 | /* Set the default PINs for the link and activity leds */ | ||
982 | priv->led_activity_on = IPW_ACTIVITY_LED; | ||
983 | priv->led_activity_off = ~(IPW_ACTIVITY_LED); | ||
984 | |||
985 | priv->led_association_on = IPW_ASSOCIATED_LED; | ||
986 | priv->led_association_off = ~(IPW_ASSOCIATED_LED); | ||
987 | |||
988 | /* Set the default PINs for the OFDM leds */ | ||
989 | priv->led_ofdm_on = IPW_OFDM_LED; | ||
990 | priv->led_ofdm_off = ~(IPW_OFDM_LED); | ||
991 | |||
992 | switch (priv->nic_type) { | ||
993 | case EEPROM_NIC_TYPE_1: | ||
994 | /* In this NIC type, the LEDs are reversed.... */ | ||
995 | priv->led_activity_on = IPW_ASSOCIATED_LED; | ||
996 | priv->led_activity_off = ~(IPW_ASSOCIATED_LED); | ||
997 | priv->led_association_on = IPW_ACTIVITY_LED; | ||
998 | priv->led_association_off = ~(IPW_ACTIVITY_LED); | ||
999 | |||
1000 | if (!(priv->config & CFG_NO_LED)) | ||
1001 | ipw_led_band_on(priv); | ||
1002 | |||
1003 | /* And we don't blink link LEDs for this nic, so | ||
1004 | * just return here */ | ||
1005 | return; | ||
1006 | |||
1007 | case EEPROM_NIC_TYPE_3: | ||
1008 | case EEPROM_NIC_TYPE_2: | ||
1009 | case EEPROM_NIC_TYPE_4: | ||
1010 | case EEPROM_NIC_TYPE_0: | ||
1011 | break; | ||
1012 | |||
1013 | default: | ||
1014 | IPW_DEBUG_INFO("Unknown NIC type from EEPROM: %d\n", | ||
1015 | priv->nic_type); | ||
1016 | priv->nic_type = EEPROM_NIC_TYPE_0; | ||
1017 | break; | ||
1018 | } | ||
1019 | |||
1020 | if (!(priv->config & CFG_NO_LED)) { | ||
1021 | if (priv->status & STATUS_ASSOCIATED) | ||
1022 | ipw_led_link_on(priv); | ||
1023 | else | ||
1024 | ipw_led_link_off(priv); | ||
1025 | } | ||
1026 | } | ||
1027 | |||
1028 | void ipw_led_shutdown(struct ipw_priv *priv) | ||
1029 | { | ||
1030 | ipw_led_activity_off(priv); | ||
1031 | ipw_led_link_off(priv); | ||
1032 | ipw_led_band_off(priv); | ||
1033 | cancel_delayed_work(&priv->led_link_on); | ||
1034 | cancel_delayed_work(&priv->led_link_off); | ||
1035 | cancel_delayed_work(&priv->led_act_off); | ||
1036 | } | ||
1037 | |||
639 | /* | 1038 | /* |
640 | * The following adds a new attribute to the sysfs representation | 1039 | * The following adds a new attribute to the sysfs representation |
641 | * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) | 1040 | * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) |
@@ -647,8 +1046,9 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) | |||
647 | { | 1046 | { |
648 | return sprintf(buf, "0x%08X\n", ipw_debug_level); | 1047 | return sprintf(buf, "0x%08X\n", ipw_debug_level); |
649 | } | 1048 | } |
650 | static ssize_t store_debug_level(struct device_driver *d, | 1049 | |
651 | const char *buf, size_t count) | 1050 | static ssize_t store_debug_level(struct device_driver *d, const char *buf, |
1051 | size_t count) | ||
652 | { | 1052 | { |
653 | char *p = (char *)buf; | 1053 | char *p = (char *)buf; |
654 | u32 val; | 1054 | u32 val; |
@@ -672,75 +1072,263 @@ static ssize_t store_debug_level(struct device_driver *d, | |||
672 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | 1072 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, |
673 | show_debug_level, store_debug_level); | 1073 | show_debug_level, store_debug_level); |
674 | 1074 | ||
675 | static ssize_t show_status(struct device *d, | 1075 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) |
676 | struct device_attribute *attr, char *buf) | ||
677 | { | 1076 | { |
678 | struct ipw_priv *p = d->driver_data; | 1077 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); |
679 | return sprintf(buf, "0x%08x\n", (int)p->status); | ||
680 | } | 1078 | } |
681 | 1079 | ||
682 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 1080 | static void ipw_capture_event_log(struct ipw_priv *priv, |
1081 | u32 log_len, struct ipw_event *log) | ||
1082 | { | ||
1083 | u32 base; | ||
683 | 1084 | ||
684 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | 1085 | if (log_len) { |
685 | char *buf) | 1086 | base = ipw_read32(priv, IPW_EVENT_LOG); |
1087 | ipw_read_indirect(priv, base + sizeof(base) + sizeof(u32), | ||
1088 | (u8 *) log, sizeof(*log) * log_len); | ||
1089 | } | ||
1090 | } | ||
1091 | |||
1092 | static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) | ||
686 | { | 1093 | { |
687 | struct ipw_priv *p = d->driver_data; | 1094 | struct ipw_fw_error *error; |
688 | return sprintf(buf, "0x%08x\n", (int)p->config); | 1095 | u32 log_len = ipw_get_event_log_len(priv); |
1096 | u32 base = ipw_read32(priv, IPW_ERROR_LOG); | ||
1097 | u32 elem_len = ipw_read_reg32(priv, base); | ||
1098 | |||
1099 | error = kmalloc(sizeof(*error) + | ||
1100 | sizeof(*error->elem) * elem_len + | ||
1101 | sizeof(*error->log) * log_len, GFP_ATOMIC); | ||
1102 | if (!error) { | ||
1103 | IPW_ERROR("Memory allocation for firmware error log " | ||
1104 | "failed.\n"); | ||
1105 | return NULL; | ||
1106 | } | ||
1107 | error->jiffies = jiffies; | ||
1108 | error->status = priv->status; | ||
1109 | error->config = priv->config; | ||
1110 | error->elem_len = elem_len; | ||
1111 | error->log_len = log_len; | ||
1112 | error->elem = (struct ipw_error_elem *)error->payload; | ||
1113 | error->log = (struct ipw_event *)(error->elem + | ||
1114 | (sizeof(*error->elem) * elem_len)); | ||
1115 | |||
1116 | ipw_capture_event_log(priv, log_len, error->log); | ||
1117 | |||
1118 | if (elem_len) | ||
1119 | ipw_read_indirect(priv, base + sizeof(base), (u8 *) error->elem, | ||
1120 | sizeof(*error->elem) * elem_len); | ||
1121 | |||
1122 | return error; | ||
689 | } | 1123 | } |
690 | 1124 | ||
691 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | 1125 | static void ipw_free_error_log(struct ipw_fw_error *error) |
1126 | { | ||
1127 | if (error) | ||
1128 | kfree(error); | ||
1129 | } | ||
692 | 1130 | ||
693 | static ssize_t show_nic_type(struct device *d, | 1131 | static ssize_t show_event_log(struct device *d, |
694 | struct device_attribute *attr, char *buf) | 1132 | struct device_attribute *attr, char *buf) |
695 | { | 1133 | { |
696 | struct ipw_priv *p = d->driver_data; | 1134 | struct ipw_priv *priv = dev_get_drvdata(d); |
697 | u8 type = p->eeprom[EEPROM_NIC_TYPE]; | 1135 | u32 log_len = ipw_get_event_log_len(priv); |
1136 | struct ipw_event log[log_len]; | ||
1137 | u32 len = 0, i; | ||
1138 | |||
1139 | ipw_capture_event_log(priv, log_len, log); | ||
1140 | |||
1141 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); | ||
1142 | for (i = 0; i < log_len; i++) | ||
1143 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1144 | "\n%08X%08X%08X", | ||
1145 | log[i].time, log[i].event, log[i].data); | ||
1146 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1147 | return len; | ||
1148 | } | ||
698 | 1149 | ||
699 | switch (type) { | 1150 | static DEVICE_ATTR(event_log, S_IRUGO, show_event_log, NULL); |
700 | case EEPROM_NIC_TYPE_STANDARD: | 1151 | |
701 | return sprintf(buf, "STANDARD\n"); | 1152 | static ssize_t show_error(struct device *d, |
702 | case EEPROM_NIC_TYPE_DELL: | 1153 | struct device_attribute *attr, char *buf) |
703 | return sprintf(buf, "DELL\n"); | 1154 | { |
704 | case EEPROM_NIC_TYPE_FUJITSU: | 1155 | struct ipw_priv *priv = dev_get_drvdata(d); |
705 | return sprintf(buf, "FUJITSU\n"); | 1156 | u32 len = 0, i; |
706 | case EEPROM_NIC_TYPE_IBM: | 1157 | if (!priv->error) |
707 | return sprintf(buf, "IBM\n"); | 1158 | return 0; |
708 | case EEPROM_NIC_TYPE_HP: | 1159 | len += snprintf(buf + len, PAGE_SIZE - len, |
709 | return sprintf(buf, "HP\n"); | 1160 | "%08lX%08X%08X%08X", |
1161 | priv->error->jiffies, | ||
1162 | priv->error->status, | ||
1163 | priv->error->config, priv->error->elem_len); | ||
1164 | for (i = 0; i < priv->error->elem_len; i++) | ||
1165 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1166 | "\n%08X%08X%08X%08X%08X%08X%08X", | ||
1167 | priv->error->elem[i].time, | ||
1168 | priv->error->elem[i].desc, | ||
1169 | priv->error->elem[i].blink1, | ||
1170 | priv->error->elem[i].blink2, | ||
1171 | priv->error->elem[i].link1, | ||
1172 | priv->error->elem[i].link2, | ||
1173 | priv->error->elem[i].data); | ||
1174 | |||
1175 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1176 | "\n%08X", priv->error->log_len); | ||
1177 | for (i = 0; i < priv->error->log_len; i++) | ||
1178 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
1179 | "\n%08X%08X%08X", | ||
1180 | priv->error->log[i].time, | ||
1181 | priv->error->log[i].event, | ||
1182 | priv->error->log[i].data); | ||
1183 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1184 | return len; | ||
1185 | } | ||
1186 | |||
1187 | static ssize_t clear_error(struct device *d, | ||
1188 | struct device_attribute *attr, | ||
1189 | const char *buf, size_t count) | ||
1190 | { | ||
1191 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1192 | if (priv->error) { | ||
1193 | ipw_free_error_log(priv->error); | ||
1194 | priv->error = NULL; | ||
710 | } | 1195 | } |
1196 | return count; | ||
1197 | } | ||
1198 | |||
1199 | static DEVICE_ATTR(error, S_IRUGO | S_IWUSR, show_error, clear_error); | ||
711 | 1200 | ||
712 | return sprintf(buf, "UNKNOWN\n"); | 1201 | static ssize_t show_cmd_log(struct device *d, |
1202 | struct device_attribute *attr, char *buf) | ||
1203 | { | ||
1204 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1205 | u32 len = 0, i; | ||
1206 | if (!priv->cmdlog) | ||
1207 | return 0; | ||
1208 | for (i = (priv->cmdlog_pos + 1) % priv->cmdlog_len; | ||
1209 | (i != priv->cmdlog_pos) && (PAGE_SIZE - len); | ||
1210 | i = (i + 1) % priv->cmdlog_len) { | ||
1211 | len += | ||
1212 | snprintf(buf + len, PAGE_SIZE - len, | ||
1213 | "\n%08lX%08X%08X%08X\n", priv->cmdlog[i].jiffies, | ||
1214 | priv->cmdlog[i].retcode, priv->cmdlog[i].cmd.cmd, | ||
1215 | priv->cmdlog[i].cmd.len); | ||
1216 | len += | ||
1217 | snprintk_buf(buf + len, PAGE_SIZE - len, | ||
1218 | (u8 *) priv->cmdlog[i].cmd.param, | ||
1219 | priv->cmdlog[i].cmd.len); | ||
1220 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1221 | } | ||
1222 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | ||
1223 | return len; | ||
713 | } | 1224 | } |
714 | 1225 | ||
715 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); | 1226 | static DEVICE_ATTR(cmd_log, S_IRUGO, show_cmd_log, NULL); |
716 | 1227 | ||
717 | static ssize_t dump_error_log(struct device *d, | 1228 | static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, |
718 | struct device_attribute *attr, const char *buf, | 1229 | char *buf) |
719 | size_t count) | ||
720 | { | 1230 | { |
721 | char *p = (char *)buf; | 1231 | struct ipw_priv *priv = dev_get_drvdata(d); |
1232 | return sprintf(buf, "%d\n", priv->ieee->scan_age); | ||
1233 | } | ||
722 | 1234 | ||
723 | if (p[0] == '1') | 1235 | static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, |
724 | ipw_dump_nic_error_log((struct ipw_priv *)d->driver_data); | 1236 | const char *buf, size_t count) |
1237 | { | ||
1238 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
1239 | #ifdef CONFIG_IPW_DEBUG | ||
1240 | struct net_device *dev = priv->net_dev; | ||
1241 | #endif | ||
1242 | char buffer[] = "00000000"; | ||
1243 | unsigned long len = | ||
1244 | (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1; | ||
1245 | unsigned long val; | ||
1246 | char *p = buffer; | ||
725 | 1247 | ||
726 | return strnlen(buf, count); | 1248 | IPW_DEBUG_INFO("enter\n"); |
1249 | |||
1250 | strncpy(buffer, buf, len); | ||
1251 | buffer[len] = 0; | ||
1252 | |||
1253 | if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { | ||
1254 | p++; | ||
1255 | if (p[0] == 'x' || p[0] == 'X') | ||
1256 | p++; | ||
1257 | val = simple_strtoul(p, &p, 16); | ||
1258 | } else | ||
1259 | val = simple_strtoul(p, &p, 10); | ||
1260 | if (p == buffer) { | ||
1261 | IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); | ||
1262 | } else { | ||
1263 | priv->ieee->scan_age = val; | ||
1264 | IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); | ||
1265 | } | ||
1266 | |||
1267 | IPW_DEBUG_INFO("exit\n"); | ||
1268 | return len; | ||
727 | } | 1269 | } |
728 | 1270 | ||
729 | static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); | 1271 | static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); |
730 | 1272 | ||
731 | static ssize_t dump_event_log(struct device *d, | 1273 | static ssize_t show_led(struct device *d, struct device_attribute *attr, |
732 | struct device_attribute *attr, const char *buf, | 1274 | char *buf) |
733 | size_t count) | ||
734 | { | 1275 | { |
735 | char *p = (char *)buf; | 1276 | struct ipw_priv *priv = dev_get_drvdata(d); |
1277 | return sprintf(buf, "%d\n", (priv->config & CFG_NO_LED) ? 0 : 1); | ||
1278 | } | ||
736 | 1279 | ||
737 | if (p[0] == '1') | 1280 | static ssize_t store_led(struct device *d, struct device_attribute *attr, |
738 | ipw_dump_nic_event_log((struct ipw_priv *)d->driver_data); | 1281 | const char *buf, size_t count) |
1282 | { | ||
1283 | struct ipw_priv *priv = dev_get_drvdata(d); | ||
739 | 1284 | ||
740 | return strnlen(buf, count); | 1285 | IPW_DEBUG_INFO("enter\n"); |
1286 | |||
1287 | if (count == 0) | ||
1288 | return 0; | ||
1289 | |||
1290 | if (*buf == 0) { | ||
1291 | IPW_DEBUG_LED("Disabling LED control.\n"); | ||
1292 | priv->config |= CFG_NO_LED; | ||
1293 | ipw_led_shutdown(priv); | ||
1294 | } else { | ||
1295 | IPW_DEBUG_LED("Enabling LED control.\n"); | ||
1296 | priv->config &= ~CFG_NO_LED; | ||
1297 | ipw_led_init(priv); | ||
1298 | } | ||
1299 | |||
1300 | IPW_DEBUG_INFO("exit\n"); | ||
1301 | return count; | ||
1302 | } | ||
1303 | |||
1304 | static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led); | ||
1305 | |||
1306 | static ssize_t show_status(struct device *d, | ||
1307 | struct device_attribute *attr, char *buf) | ||
1308 | { | ||
1309 | struct ipw_priv *p = d->driver_data; | ||
1310 | return sprintf(buf, "0x%08x\n", (int)p->status); | ||
741 | } | 1311 | } |
742 | 1312 | ||
743 | static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); | 1313 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
1314 | |||
1315 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | ||
1316 | char *buf) | ||
1317 | { | ||
1318 | struct ipw_priv *p = d->driver_data; | ||
1319 | return sprintf(buf, "0x%08x\n", (int)p->config); | ||
1320 | } | ||
1321 | |||
1322 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | ||
1323 | |||
1324 | static ssize_t show_nic_type(struct device *d, | ||
1325 | struct device_attribute *attr, char *buf) | ||
1326 | { | ||
1327 | struct ipw_priv *priv = d->driver_data; | ||
1328 | return sprintf(buf, "TYPE: %d\n", priv->nic_type); | ||
1329 | } | ||
1330 | |||
1331 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); | ||
744 | 1332 | ||
745 | static ssize_t show_ucode_version(struct device *d, | 1333 | static ssize_t show_ucode_version(struct device *d, |
746 | struct device_attribute *attr, char *buf) | 1334 | struct device_attribute *attr, char *buf) |
@@ -798,7 +1386,7 @@ static ssize_t show_command_event_reg(struct device *d, | |||
798 | u32 reg = 0; | 1386 | u32 reg = 0; |
799 | struct ipw_priv *p = d->driver_data; | 1387 | struct ipw_priv *p = d->driver_data; |
800 | 1388 | ||
801 | reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT); | 1389 | reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT); |
802 | return sprintf(buf, "0x%08x\n", reg); | 1390 | return sprintf(buf, "0x%08x\n", reg); |
803 | } | 1391 | } |
804 | static ssize_t store_command_event_reg(struct device *d, | 1392 | static ssize_t store_command_event_reg(struct device *d, |
@@ -809,7 +1397,7 @@ static ssize_t store_command_event_reg(struct device *d, | |||
809 | struct ipw_priv *p = d->driver_data; | 1397 | struct ipw_priv *p = d->driver_data; |
810 | 1398 | ||
811 | sscanf(buf, "%x", ®); | 1399 | sscanf(buf, "%x", ®); |
812 | ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); | 1400 | ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg); |
813 | return strnlen(buf, count); | 1401 | return strnlen(buf, count); |
814 | } | 1402 | } |
815 | 1403 | ||
@@ -845,6 +1433,7 @@ static ssize_t show_indirect_dword(struct device *d, | |||
845 | { | 1433 | { |
846 | u32 reg = 0; | 1434 | u32 reg = 0; |
847 | struct ipw_priv *priv = d->driver_data; | 1435 | struct ipw_priv *priv = d->driver_data; |
1436 | |||
848 | if (priv->status & STATUS_INDIRECT_DWORD) | 1437 | if (priv->status & STATUS_INDIRECT_DWORD) |
849 | reg = ipw_read_reg32(priv, priv->indirect_dword); | 1438 | reg = ipw_read_reg32(priv, priv->indirect_dword); |
850 | else | 1439 | else |
@@ -871,6 +1460,7 @@ static ssize_t show_indirect_byte(struct device *d, | |||
871 | { | 1460 | { |
872 | u8 reg = 0; | 1461 | u8 reg = 0; |
873 | struct ipw_priv *priv = d->driver_data; | 1462 | struct ipw_priv *priv = d->driver_data; |
1463 | |||
874 | if (priv->status & STATUS_INDIRECT_BYTE) | 1464 | if (priv->status & STATUS_INDIRECT_BYTE) |
875 | reg = ipw_read_reg8(priv, priv->indirect_byte); | 1465 | reg = ipw_read_reg8(priv, priv->indirect_byte); |
876 | else | 1466 | else |
@@ -945,7 +1535,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | |||
945 | static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | 1535 | static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) |
946 | { | 1536 | { |
947 | if ((disable_radio ? 1 : 0) == | 1537 | if ((disable_radio ? 1 : 0) == |
948 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) | 1538 | ((priv->status & STATUS_RF_KILL_SW) ? 1 : 0)) |
949 | return 0; | 1539 | return 0; |
950 | 1540 | ||
951 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 1541 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
@@ -954,10 +1544,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
954 | if (disable_radio) { | 1544 | if (disable_radio) { |
955 | priv->status |= STATUS_RF_KILL_SW; | 1545 | priv->status |= STATUS_RF_KILL_SW; |
956 | 1546 | ||
957 | if (priv->workqueue) { | 1547 | if (priv->workqueue) |
958 | cancel_delayed_work(&priv->request_scan); | 1548 | cancel_delayed_work(&priv->request_scan); |
959 | } | ||
960 | wake_up_interruptible(&priv->wait_command_queue); | ||
961 | queue_work(priv->workqueue, &priv->down); | 1549 | queue_work(priv->workqueue, &priv->down); |
962 | } else { | 1550 | } else { |
963 | priv->status &= ~STATUS_RF_KILL_SW; | 1551 | priv->status &= ~STATUS_RF_KILL_SW; |
@@ -987,6 +1575,93 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | |||
987 | 1575 | ||
988 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | 1576 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); |
989 | 1577 | ||
1578 | static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr, | ||
1579 | char *buf) | ||
1580 | { | ||
1581 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1582 | int pos = 0, len = 0; | ||
1583 | if (priv->config & CFG_SPEED_SCAN) { | ||
1584 | while (priv->speed_scan[pos] != 0) | ||
1585 | len += sprintf(&buf[len], "%d ", | ||
1586 | priv->speed_scan[pos++]); | ||
1587 | return len + sprintf(&buf[len], "\n"); | ||
1588 | } | ||
1589 | |||
1590 | return sprintf(buf, "0\n"); | ||
1591 | } | ||
1592 | |||
1593 | static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, | ||
1594 | const char *buf, size_t count) | ||
1595 | { | ||
1596 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1597 | int channel, pos = 0; | ||
1598 | const char *p = buf; | ||
1599 | |||
1600 | /* list of space separated channels to scan, optionally ending with 0 */ | ||
1601 | while ((channel = simple_strtol(p, NULL, 0))) { | ||
1602 | if (pos == MAX_SPEED_SCAN - 1) { | ||
1603 | priv->speed_scan[pos] = 0; | ||
1604 | break; | ||
1605 | } | ||
1606 | |||
1607 | if (ipw_is_valid_channel(priv->ieee, channel)) | ||
1608 | priv->speed_scan[pos++] = channel; | ||
1609 | else | ||
1610 | IPW_WARNING("Skipping invalid channel request: %d\n", | ||
1611 | channel); | ||
1612 | p = strchr(p, ' '); | ||
1613 | if (!p) | ||
1614 | break; | ||
1615 | while (*p == ' ' || *p == '\t') | ||
1616 | p++; | ||
1617 | } | ||
1618 | |||
1619 | if (pos == 0) | ||
1620 | priv->config &= ~CFG_SPEED_SCAN; | ||
1621 | else { | ||
1622 | priv->speed_scan_pos = 0; | ||
1623 | priv->config |= CFG_SPEED_SCAN; | ||
1624 | } | ||
1625 | |||
1626 | return count; | ||
1627 | } | ||
1628 | |||
1629 | static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan, | ||
1630 | store_speed_scan); | ||
1631 | |||
1632 | static ssize_t show_net_stats(struct device *d, struct device_attribute *attr, | ||
1633 | char *buf) | ||
1634 | { | ||
1635 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1636 | return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0'); | ||
1637 | } | ||
1638 | |||
1639 | static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, | ||
1640 | const char *buf, size_t count) | ||
1641 | { | ||
1642 | struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; | ||
1643 | if (buf[0] == '1') | ||
1644 | priv->config |= CFG_NET_STATS; | ||
1645 | else | ||
1646 | priv->config &= ~CFG_NET_STATS; | ||
1647 | |||
1648 | return count; | ||
1649 | } | ||
1650 | |||
1651 | static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, | ||
1652 | show_net_stats, store_net_stats); | ||
1653 | |||
1654 | static void notify_wx_assoc_event(struct ipw_priv *priv) | ||
1655 | { | ||
1656 | union iwreq_data wrqu; | ||
1657 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
1658 | if (priv->status & STATUS_ASSOCIATED) | ||
1659 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | ||
1660 | else | ||
1661 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | ||
1662 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | ||
1663 | } | ||
1664 | |||
990 | static void ipw_irq_tasklet(struct ipw_priv *priv) | 1665 | static void ipw_irq_tasklet(struct ipw_priv *priv) |
991 | { | 1666 | { |
992 | u32 inta, inta_mask, handled = 0; | 1667 | u32 inta, inta_mask, handled = 0; |
@@ -995,102 +1670,135 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
995 | 1670 | ||
996 | spin_lock_irqsave(&priv->lock, flags); | 1671 | spin_lock_irqsave(&priv->lock, flags); |
997 | 1672 | ||
998 | inta = ipw_read32(priv, CX2_INTA_RW); | 1673 | inta = ipw_read32(priv, IPW_INTA_RW); |
999 | inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); | 1674 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); |
1000 | inta &= (CX2_INTA_MASK_ALL & inta_mask); | 1675 | inta &= (IPW_INTA_MASK_ALL & inta_mask); |
1001 | 1676 | ||
1002 | /* Add any cached INTA values that need to be handled */ | 1677 | /* Add any cached INTA values that need to be handled */ |
1003 | inta |= priv->isr_inta; | 1678 | inta |= priv->isr_inta; |
1004 | 1679 | ||
1005 | /* handle all the justifications for the interrupt */ | 1680 | /* handle all the justifications for the interrupt */ |
1006 | if (inta & CX2_INTA_BIT_RX_TRANSFER) { | 1681 | if (inta & IPW_INTA_BIT_RX_TRANSFER) { |
1007 | ipw_rx(priv); | 1682 | ipw_rx(priv); |
1008 | handled |= CX2_INTA_BIT_RX_TRANSFER; | 1683 | handled |= IPW_INTA_BIT_RX_TRANSFER; |
1009 | } | 1684 | } |
1010 | 1685 | ||
1011 | if (inta & CX2_INTA_BIT_TX_CMD_QUEUE) { | 1686 | if (inta & IPW_INTA_BIT_TX_CMD_QUEUE) { |
1012 | IPW_DEBUG_HC("Command completed.\n"); | 1687 | IPW_DEBUG_HC("Command completed.\n"); |
1013 | rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); | 1688 | rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); |
1014 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1689 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1015 | wake_up_interruptible(&priv->wait_command_queue); | 1690 | wake_up_interruptible(&priv->wait_command_queue); |
1016 | handled |= CX2_INTA_BIT_TX_CMD_QUEUE; | 1691 | handled |= IPW_INTA_BIT_TX_CMD_QUEUE; |
1017 | } | 1692 | } |
1018 | 1693 | ||
1019 | if (inta & CX2_INTA_BIT_TX_QUEUE_1) { | 1694 | if (inta & IPW_INTA_BIT_TX_QUEUE_1) { |
1020 | IPW_DEBUG_TX("TX_QUEUE_1\n"); | 1695 | IPW_DEBUG_TX("TX_QUEUE_1\n"); |
1021 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); | 1696 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); |
1022 | handled |= CX2_INTA_BIT_TX_QUEUE_1; | 1697 | handled |= IPW_INTA_BIT_TX_QUEUE_1; |
1023 | } | 1698 | } |
1024 | 1699 | ||
1025 | if (inta & CX2_INTA_BIT_TX_QUEUE_2) { | 1700 | if (inta & IPW_INTA_BIT_TX_QUEUE_2) { |
1026 | IPW_DEBUG_TX("TX_QUEUE_2\n"); | 1701 | IPW_DEBUG_TX("TX_QUEUE_2\n"); |
1027 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); | 1702 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); |
1028 | handled |= CX2_INTA_BIT_TX_QUEUE_2; | 1703 | handled |= IPW_INTA_BIT_TX_QUEUE_2; |
1029 | } | 1704 | } |
1030 | 1705 | ||
1031 | if (inta & CX2_INTA_BIT_TX_QUEUE_3) { | 1706 | if (inta & IPW_INTA_BIT_TX_QUEUE_3) { |
1032 | IPW_DEBUG_TX("TX_QUEUE_3\n"); | 1707 | IPW_DEBUG_TX("TX_QUEUE_3\n"); |
1033 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); | 1708 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); |
1034 | handled |= CX2_INTA_BIT_TX_QUEUE_3; | 1709 | handled |= IPW_INTA_BIT_TX_QUEUE_3; |
1035 | } | 1710 | } |
1036 | 1711 | ||
1037 | if (inta & CX2_INTA_BIT_TX_QUEUE_4) { | 1712 | if (inta & IPW_INTA_BIT_TX_QUEUE_4) { |
1038 | IPW_DEBUG_TX("TX_QUEUE_4\n"); | 1713 | IPW_DEBUG_TX("TX_QUEUE_4\n"); |
1039 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); | 1714 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); |
1040 | handled |= CX2_INTA_BIT_TX_QUEUE_4; | 1715 | handled |= IPW_INTA_BIT_TX_QUEUE_4; |
1041 | } | 1716 | } |
1042 | 1717 | ||
1043 | if (inta & CX2_INTA_BIT_STATUS_CHANGE) { | 1718 | if (inta & IPW_INTA_BIT_STATUS_CHANGE) { |
1044 | IPW_WARNING("STATUS_CHANGE\n"); | 1719 | IPW_WARNING("STATUS_CHANGE\n"); |
1045 | handled |= CX2_INTA_BIT_STATUS_CHANGE; | 1720 | handled |= IPW_INTA_BIT_STATUS_CHANGE; |
1046 | } | 1721 | } |
1047 | 1722 | ||
1048 | if (inta & CX2_INTA_BIT_BEACON_PERIOD_EXPIRED) { | 1723 | if (inta & IPW_INTA_BIT_BEACON_PERIOD_EXPIRED) { |
1049 | IPW_WARNING("TX_PERIOD_EXPIRED\n"); | 1724 | IPW_WARNING("TX_PERIOD_EXPIRED\n"); |
1050 | handled |= CX2_INTA_BIT_BEACON_PERIOD_EXPIRED; | 1725 | handled |= IPW_INTA_BIT_BEACON_PERIOD_EXPIRED; |
1051 | } | 1726 | } |
1052 | 1727 | ||
1053 | if (inta & CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { | 1728 | if (inta & IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { |
1054 | IPW_WARNING("HOST_CMD_DONE\n"); | 1729 | IPW_WARNING("HOST_CMD_DONE\n"); |
1055 | handled |= CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; | 1730 | handled |= IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; |
1056 | } | 1731 | } |
1057 | 1732 | ||
1058 | if (inta & CX2_INTA_BIT_FW_INITIALIZATION_DONE) { | 1733 | if (inta & IPW_INTA_BIT_FW_INITIALIZATION_DONE) { |
1059 | IPW_WARNING("FW_INITIALIZATION_DONE\n"); | 1734 | IPW_WARNING("FW_INITIALIZATION_DONE\n"); |
1060 | handled |= CX2_INTA_BIT_FW_INITIALIZATION_DONE; | 1735 | handled |= IPW_INTA_BIT_FW_INITIALIZATION_DONE; |
1061 | } | 1736 | } |
1062 | 1737 | ||
1063 | if (inta & CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { | 1738 | if (inta & IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { |
1064 | IPW_WARNING("PHY_OFF_DONE\n"); | 1739 | IPW_WARNING("PHY_OFF_DONE\n"); |
1065 | handled |= CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; | 1740 | handled |= IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; |
1066 | } | 1741 | } |
1067 | 1742 | ||
1068 | if (inta & CX2_INTA_BIT_RF_KILL_DONE) { | 1743 | if (inta & IPW_INTA_BIT_RF_KILL_DONE) { |
1069 | IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); | 1744 | IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); |
1070 | priv->status |= STATUS_RF_KILL_HW; | 1745 | priv->status |= STATUS_RF_KILL_HW; |
1071 | wake_up_interruptible(&priv->wait_command_queue); | 1746 | wake_up_interruptible(&priv->wait_command_queue); |
1072 | netif_carrier_off(priv->net_dev); | 1747 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); |
1073 | netif_stop_queue(priv->net_dev); | ||
1074 | cancel_delayed_work(&priv->request_scan); | 1748 | cancel_delayed_work(&priv->request_scan); |
1749 | schedule_work(&priv->link_down); | ||
1075 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); | 1750 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); |
1076 | handled |= CX2_INTA_BIT_RF_KILL_DONE; | 1751 | handled |= IPW_INTA_BIT_RF_KILL_DONE; |
1077 | } | 1752 | } |
1078 | 1753 | ||
1079 | if (inta & CX2_INTA_BIT_FATAL_ERROR) { | 1754 | if (inta & IPW_INTA_BIT_FATAL_ERROR) { |
1080 | IPW_ERROR("Firmware error detected. Restarting.\n"); | 1755 | IPW_ERROR("Firmware error detected. Restarting.\n"); |
1756 | if (priv->error) { | ||
1757 | IPW_ERROR("Sysfs 'error' log already exists.\n"); | ||
1081 | #ifdef CONFIG_IPW_DEBUG | 1758 | #ifdef CONFIG_IPW_DEBUG |
1082 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { | 1759 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { |
1083 | ipw_dump_nic_error_log(priv); | 1760 | struct ipw_fw_error *error = |
1084 | ipw_dump_nic_event_log(priv); | 1761 | ipw_alloc_error_log(priv); |
1085 | } | 1762 | ipw_dump_error_log(priv, error); |
1763 | if (error) | ||
1764 | ipw_free_error_log(error); | ||
1765 | } | ||
1086 | #endif | 1766 | #endif |
1767 | } else { | ||
1768 | priv->error = ipw_alloc_error_log(priv); | ||
1769 | if (priv->error) | ||
1770 | IPW_ERROR("Sysfs 'error' log captured.\n"); | ||
1771 | else | ||
1772 | IPW_ERROR("Error allocating sysfs 'error' " | ||
1773 | "log.\n"); | ||
1774 | #ifdef CONFIG_IPW_DEBUG | ||
1775 | if (ipw_debug_level & IPW_DL_FW_ERRORS) | ||
1776 | ipw_dump_error_log(priv, priv->error); | ||
1777 | #endif | ||
1778 | } | ||
1779 | |||
1780 | /* XXX: If hardware encryption is for WPA/WPA2, | ||
1781 | * we have to notify the supplicant. */ | ||
1782 | if (priv->ieee->sec.encrypt) { | ||
1783 | priv->status &= ~STATUS_ASSOCIATED; | ||
1784 | notify_wx_assoc_event(priv); | ||
1785 | } | ||
1786 | |||
1787 | /* Keep the restart process from trying to send host | ||
1788 | * commands by clearing the INIT status bit */ | ||
1789 | priv->status &= ~STATUS_INIT; | ||
1790 | |||
1791 | /* Cancel currently queued command. */ | ||
1792 | priv->status &= ~STATUS_HCMD_ACTIVE; | ||
1793 | wake_up_interruptible(&priv->wait_command_queue); | ||
1794 | |||
1087 | queue_work(priv->workqueue, &priv->adapter_restart); | 1795 | queue_work(priv->workqueue, &priv->adapter_restart); |
1088 | handled |= CX2_INTA_BIT_FATAL_ERROR; | 1796 | handled |= IPW_INTA_BIT_FATAL_ERROR; |
1089 | } | 1797 | } |
1090 | 1798 | ||
1091 | if (inta & CX2_INTA_BIT_PARITY_ERROR) { | 1799 | if (inta & IPW_INTA_BIT_PARITY_ERROR) { |
1092 | IPW_ERROR("Parity error\n"); | 1800 | IPW_ERROR("Parity error\n"); |
1093 | handled |= CX2_INTA_BIT_PARITY_ERROR; | 1801 | handled |= IPW_INTA_BIT_PARITY_ERROR; |
1094 | } | 1802 | } |
1095 | 1803 | ||
1096 | if (handled != inta) { | 1804 | if (handled != inta) { |
@@ -1103,7 +1811,6 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
1103 | spin_unlock_irqrestore(&priv->lock, flags); | 1811 | spin_unlock_irqrestore(&priv->lock, flags); |
1104 | } | 1812 | } |
1105 | 1813 | ||
1106 | #ifdef CONFIG_IPW_DEBUG | ||
1107 | #define IPW_CMD(x) case IPW_CMD_ ## x : return #x | 1814 | #define IPW_CMD(x) case IPW_CMD_ ## x : return #x |
1108 | static char *get_cmd_string(u8 cmd) | 1815 | static char *get_cmd_string(u8 cmd) |
1109 | { | 1816 | { |
@@ -1162,44 +1869,78 @@ static char *get_cmd_string(u8 cmd) | |||
1162 | return "UNKNOWN"; | 1869 | return "UNKNOWN"; |
1163 | } | 1870 | } |
1164 | } | 1871 | } |
1165 | #endif /* CONFIG_IPW_DEBUG */ | ||
1166 | 1872 | ||
1167 | #define HOST_COMPLETE_TIMEOUT HZ | 1873 | #define HOST_COMPLETE_TIMEOUT HZ |
1168 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1874 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) |
1169 | { | 1875 | { |
1170 | int rc = 0; | 1876 | int rc = 0; |
1877 | unsigned long flags; | ||
1171 | 1878 | ||
1879 | spin_lock_irqsave(&priv->lock, flags); | ||
1172 | if (priv->status & STATUS_HCMD_ACTIVE) { | 1880 | if (priv->status & STATUS_HCMD_ACTIVE) { |
1173 | IPW_ERROR("Already sending a command\n"); | 1881 | IPW_ERROR("Failed to send %s: Already sending a command.\n", |
1174 | return -1; | 1882 | get_cmd_string(cmd->cmd)); |
1883 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1884 | return -EAGAIN; | ||
1175 | } | 1885 | } |
1176 | 1886 | ||
1177 | priv->status |= STATUS_HCMD_ACTIVE; | 1887 | priv->status |= STATUS_HCMD_ACTIVE; |
1178 | 1888 | ||
1179 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", | 1889 | if (priv->cmdlog) { |
1180 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); | 1890 | priv->cmdlog[priv->cmdlog_pos].jiffies = jiffies; |
1891 | priv->cmdlog[priv->cmdlog_pos].cmd.cmd = cmd->cmd; | ||
1892 | priv->cmdlog[priv->cmdlog_pos].cmd.len = cmd->len; | ||
1893 | memcpy(priv->cmdlog[priv->cmdlog_pos].cmd.param, cmd->param, | ||
1894 | cmd->len); | ||
1895 | priv->cmdlog[priv->cmdlog_pos].retcode = -1; | ||
1896 | } | ||
1897 | |||
1898 | IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", | ||
1899 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, | ||
1900 | priv->status); | ||
1181 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | 1901 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); |
1182 | 1902 | ||
1183 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1903 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); |
1184 | if (rc) | 1904 | if (rc) { |
1185 | return rc; | 1905 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1906 | IPW_ERROR("Failed to send %s: Reason %d\n", | ||
1907 | get_cmd_string(cmd->cmd), rc); | ||
1908 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1909 | goto exit; | ||
1910 | } | ||
1911 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1186 | 1912 | ||
1187 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 1913 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
1188 | !(priv-> | 1914 | !(priv-> |
1189 | status & STATUS_HCMD_ACTIVE), | 1915 | status & STATUS_HCMD_ACTIVE), |
1190 | HOST_COMPLETE_TIMEOUT); | 1916 | HOST_COMPLETE_TIMEOUT); |
1191 | if (rc == 0) { | 1917 | if (rc == 0) { |
1192 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", | 1918 | spin_lock_irqsave(&priv->lock, flags); |
1193 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 1919 | if (priv->status & STATUS_HCMD_ACTIVE) { |
1194 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1920 | IPW_ERROR("Failed to send %s: Command timed out.\n", |
1195 | return -EIO; | 1921 | get_cmd_string(cmd->cmd)); |
1196 | } | 1922 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1197 | if (priv->status & STATUS_RF_KILL_MASK) { | 1923 | spin_unlock_irqrestore(&priv->lock, flags); |
1198 | IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); | 1924 | rc = -EIO; |
1199 | return -EIO; | 1925 | goto exit; |
1926 | } | ||
1927 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1928 | } else | ||
1929 | rc = 0; | ||
1930 | |||
1931 | if (priv->status & STATUS_RF_KILL_HW) { | ||
1932 | IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", | ||
1933 | get_cmd_string(cmd->cmd)); | ||
1934 | rc = -EIO; | ||
1935 | goto exit; | ||
1200 | } | 1936 | } |
1201 | 1937 | ||
1202 | return 0; | 1938 | exit: |
1939 | if (priv->cmdlog) { | ||
1940 | priv->cmdlog[priv->cmdlog_pos++].retcode = rc; | ||
1941 | priv->cmdlog_pos %= priv->cmdlog_len; | ||
1942 | } | ||
1943 | return rc; | ||
1203 | } | 1944 | } |
1204 | 1945 | ||
1205 | static int ipw_send_host_complete(struct ipw_priv *priv) | 1946 | static int ipw_send_host_complete(struct ipw_priv *priv) |
@@ -1214,12 +1955,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv) | |||
1214 | return -1; | 1955 | return -1; |
1215 | } | 1956 | } |
1216 | 1957 | ||
1217 | if (ipw_send_cmd(priv, &cmd)) { | 1958 | return ipw_send_cmd(priv, &cmd); |
1218 | IPW_ERROR("failed to send HOST_COMPLETE command\n"); | ||
1219 | return -1; | ||
1220 | } | ||
1221 | |||
1222 | return 0; | ||
1223 | } | 1959 | } |
1224 | 1960 | ||
1225 | static int ipw_send_system_config(struct ipw_priv *priv, | 1961 | static int ipw_send_system_config(struct ipw_priv *priv, |
@@ -1235,13 +1971,8 @@ static int ipw_send_system_config(struct ipw_priv *priv, | |||
1235 | return -1; | 1971 | return -1; |
1236 | } | 1972 | } |
1237 | 1973 | ||
1238 | memcpy(&cmd.param, config, sizeof(*config)); | 1974 | memcpy(cmd.param, config, sizeof(*config)); |
1239 | if (ipw_send_cmd(priv, &cmd)) { | 1975 | return ipw_send_cmd(priv, &cmd); |
1240 | IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); | ||
1241 | return -1; | ||
1242 | } | ||
1243 | |||
1244 | return 0; | ||
1245 | } | 1976 | } |
1246 | 1977 | ||
1247 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | 1978 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
@@ -1256,13 +1987,8 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | |||
1256 | return -1; | 1987 | return -1; |
1257 | } | 1988 | } |
1258 | 1989 | ||
1259 | memcpy(&cmd.param, ssid, cmd.len); | 1990 | memcpy(cmd.param, ssid, cmd.len); |
1260 | if (ipw_send_cmd(priv, &cmd)) { | 1991 | return ipw_send_cmd(priv, &cmd); |
1261 | IPW_ERROR("failed to send SSID command\n"); | ||
1262 | return -1; | ||
1263 | } | ||
1264 | |||
1265 | return 0; | ||
1266 | } | 1992 | } |
1267 | 1993 | ||
1268 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | 1994 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
@@ -1280,16 +2006,15 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | |||
1280 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", | 2006 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", |
1281 | priv->net_dev->name, MAC_ARG(mac)); | 2007 | priv->net_dev->name, MAC_ARG(mac)); |
1282 | 2008 | ||
1283 | memcpy(&cmd.param, mac, ETH_ALEN); | 2009 | memcpy(cmd.param, mac, ETH_ALEN); |
1284 | 2010 | return ipw_send_cmd(priv, &cmd); | |
1285 | if (ipw_send_cmd(priv, &cmd)) { | ||
1286 | IPW_ERROR("failed to send ADAPTER_ADDRESS command\n"); | ||
1287 | return -1; | ||
1288 | } | ||
1289 | |||
1290 | return 0; | ||
1291 | } | 2011 | } |
1292 | 2012 | ||
2013 | /* | ||
2014 | * NOTE: This must be executed from our workqueue as it results in udelay | ||
2015 | * being called which may corrupt the keyboard if executed on default | ||
2016 | * workqueue | ||
2017 | */ | ||
1293 | static void ipw_adapter_restart(void *adapter) | 2018 | static void ipw_adapter_restart(void *adapter) |
1294 | { | 2019 | { |
1295 | struct ipw_priv *priv = adapter; | 2020 | struct ipw_priv *priv = adapter; |
@@ -1298,12 +2023,25 @@ static void ipw_adapter_restart(void *adapter) | |||
1298 | return; | 2023 | return; |
1299 | 2024 | ||
1300 | ipw_down(priv); | 2025 | ipw_down(priv); |
2026 | |||
2027 | if (priv->assoc_network && | ||
2028 | (priv->assoc_network->capability & WLAN_CAPABILITY_IBSS)) | ||
2029 | ipw_remove_current_network(priv); | ||
2030 | |||
1301 | if (ipw_up(priv)) { | 2031 | if (ipw_up(priv)) { |
1302 | IPW_ERROR("Failed to up device\n"); | 2032 | IPW_ERROR("Failed to up device\n"); |
1303 | return; | 2033 | return; |
1304 | } | 2034 | } |
1305 | } | 2035 | } |
1306 | 2036 | ||
2037 | static void ipw_bg_adapter_restart(void *data) | ||
2038 | { | ||
2039 | struct ipw_priv *priv = data; | ||
2040 | down(&priv->sem); | ||
2041 | ipw_adapter_restart(data); | ||
2042 | up(&priv->sem); | ||
2043 | } | ||
2044 | |||
1307 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) | 2045 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) |
1308 | 2046 | ||
1309 | static void ipw_scan_check(void *data) | 2047 | static void ipw_scan_check(void *data) |
@@ -1313,10 +2051,18 @@ static void ipw_scan_check(void *data) | |||
1313 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " | 2051 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " |
1314 | "adapter (%dms).\n", | 2052 | "adapter (%dms).\n", |
1315 | IPW_SCAN_CHECK_WATCHDOG / 100); | 2053 | IPW_SCAN_CHECK_WATCHDOG / 100); |
1316 | ipw_adapter_restart(priv); | 2054 | queue_work(priv->workqueue, &priv->adapter_restart); |
1317 | } | 2055 | } |
1318 | } | 2056 | } |
1319 | 2057 | ||
2058 | static void ipw_bg_scan_check(void *data) | ||
2059 | { | ||
2060 | struct ipw_priv *priv = data; | ||
2061 | down(&priv->sem); | ||
2062 | ipw_scan_check(data); | ||
2063 | up(&priv->sem); | ||
2064 | } | ||
2065 | |||
1320 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, | 2066 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, |
1321 | struct ipw_scan_request_ext *request) | 2067 | struct ipw_scan_request_ext *request) |
1322 | { | 2068 | { |
@@ -1325,20 +2071,8 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, | |||
1325 | .len = sizeof(*request) | 2071 | .len = sizeof(*request) |
1326 | }; | 2072 | }; |
1327 | 2073 | ||
1328 | if (!priv || !request) { | 2074 | memcpy(cmd.param, request, sizeof(*request)); |
1329 | IPW_ERROR("Invalid args\n"); | 2075 | return ipw_send_cmd(priv, &cmd); |
1330 | return -1; | ||
1331 | } | ||
1332 | |||
1333 | memcpy(&cmd.param, request, sizeof(*request)); | ||
1334 | if (ipw_send_cmd(priv, &cmd)) { | ||
1335 | IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); | ||
1336 | return -1; | ||
1337 | } | ||
1338 | |||
1339 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
1340 | IPW_SCAN_CHECK_WATCHDOG); | ||
1341 | return 0; | ||
1342 | } | 2076 | } |
1343 | 2077 | ||
1344 | static int ipw_send_scan_abort(struct ipw_priv *priv) | 2078 | static int ipw_send_scan_abort(struct ipw_priv *priv) |
@@ -1353,12 +2087,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv) | |||
1353 | return -1; | 2087 | return -1; |
1354 | } | 2088 | } |
1355 | 2089 | ||
1356 | if (ipw_send_cmd(priv, &cmd)) { | 2090 | return ipw_send_cmd(priv, &cmd); |
1357 | IPW_ERROR("failed to send SCAN_ABORT command\n"); | ||
1358 | return -1; | ||
1359 | } | ||
1360 | |||
1361 | return 0; | ||
1362 | } | 2091 | } |
1363 | 2092 | ||
1364 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | 2093 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) |
@@ -1370,12 +2099,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | |||
1370 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 2099 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) |
1371 | &cmd.param; | 2100 | &cmd.param; |
1372 | calib->beacon_rssi_raw = sens; | 2101 | calib->beacon_rssi_raw = sens; |
1373 | if (ipw_send_cmd(priv, &cmd)) { | 2102 | return ipw_send_cmd(priv, &cmd); |
1374 | IPW_ERROR("failed to send SENSITIVITY CALIB command\n"); | ||
1375 | return -1; | ||
1376 | } | ||
1377 | |||
1378 | return 0; | ||
1379 | } | 2103 | } |
1380 | 2104 | ||
1381 | static int ipw_send_associate(struct ipw_priv *priv, | 2105 | static int ipw_send_associate(struct ipw_priv *priv, |
@@ -1386,18 +2110,26 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
1386 | .len = sizeof(*associate) | 2110 | .len = sizeof(*associate) |
1387 | }; | 2111 | }; |
1388 | 2112 | ||
2113 | struct ipw_associate tmp_associate; | ||
2114 | memcpy(&tmp_associate, associate, sizeof(*associate)); | ||
2115 | tmp_associate.policy_support = | ||
2116 | cpu_to_le16(tmp_associate.policy_support); | ||
2117 | tmp_associate.assoc_tsf_msw = cpu_to_le32(tmp_associate.assoc_tsf_msw); | ||
2118 | tmp_associate.assoc_tsf_lsw = cpu_to_le32(tmp_associate.assoc_tsf_lsw); | ||
2119 | tmp_associate.capability = cpu_to_le16(tmp_associate.capability); | ||
2120 | tmp_associate.listen_interval = | ||
2121 | cpu_to_le16(tmp_associate.listen_interval); | ||
2122 | tmp_associate.beacon_interval = | ||
2123 | cpu_to_le16(tmp_associate.beacon_interval); | ||
2124 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); | ||
2125 | |||
1389 | if (!priv || !associate) { | 2126 | if (!priv || !associate) { |
1390 | IPW_ERROR("Invalid args\n"); | 2127 | IPW_ERROR("Invalid args\n"); |
1391 | return -1; | 2128 | return -1; |
1392 | } | 2129 | } |
1393 | 2130 | ||
1394 | memcpy(&cmd.param, associate, sizeof(*associate)); | 2131 | memcpy(cmd.param, &tmp_associate, sizeof(*associate)); |
1395 | if (ipw_send_cmd(priv, &cmd)) { | 2132 | return ipw_send_cmd(priv, &cmd); |
1396 | IPW_ERROR("failed to send ASSOCIATE command\n"); | ||
1397 | return -1; | ||
1398 | } | ||
1399 | |||
1400 | return 0; | ||
1401 | } | 2133 | } |
1402 | 2134 | ||
1403 | static int ipw_send_supported_rates(struct ipw_priv *priv, | 2135 | static int ipw_send_supported_rates(struct ipw_priv *priv, |
@@ -1413,13 +2145,8 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, | |||
1413 | return -1; | 2145 | return -1; |
1414 | } | 2146 | } |
1415 | 2147 | ||
1416 | memcpy(&cmd.param, rates, sizeof(*rates)); | 2148 | memcpy(cmd.param, rates, sizeof(*rates)); |
1417 | if (ipw_send_cmd(priv, &cmd)) { | 2149 | return ipw_send_cmd(priv, &cmd); |
1418 | IPW_ERROR("failed to send SUPPORTED_RATES command\n"); | ||
1419 | return -1; | ||
1420 | } | ||
1421 | |||
1422 | return 0; | ||
1423 | } | 2150 | } |
1424 | 2151 | ||
1425 | static int ipw_set_random_seed(struct ipw_priv *priv) | 2152 | static int ipw_set_random_seed(struct ipw_priv *priv) |
@@ -1436,15 +2163,9 @@ static int ipw_set_random_seed(struct ipw_priv *priv) | |||
1436 | 2163 | ||
1437 | get_random_bytes(&cmd.param, sizeof(u32)); | 2164 | get_random_bytes(&cmd.param, sizeof(u32)); |
1438 | 2165 | ||
1439 | if (ipw_send_cmd(priv, &cmd)) { | 2166 | return ipw_send_cmd(priv, &cmd); |
1440 | IPW_ERROR("failed to send SEED_NUMBER command\n"); | ||
1441 | return -1; | ||
1442 | } | ||
1443 | |||
1444 | return 0; | ||
1445 | } | 2167 | } |
1446 | 2168 | ||
1447 | #if 0 | ||
1448 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | 2169 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) |
1449 | { | 2170 | { |
1450 | struct host_cmd cmd = { | 2171 | struct host_cmd cmd = { |
@@ -1459,14 +2180,8 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | |||
1459 | 2180 | ||
1460 | *((u32 *) & cmd.param) = phy_off; | 2181 | *((u32 *) & cmd.param) = phy_off; |
1461 | 2182 | ||
1462 | if (ipw_send_cmd(priv, &cmd)) { | 2183 | return ipw_send_cmd(priv, &cmd); |
1463 | IPW_ERROR("failed to send CARD_DISABLE command\n"); | ||
1464 | return -1; | ||
1465 | } | ||
1466 | |||
1467 | return 0; | ||
1468 | } | 2184 | } |
1469 | #endif | ||
1470 | 2185 | ||
1471 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | 2186 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
1472 | { | 2187 | { |
@@ -1480,12 +2195,51 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | |||
1480 | return -1; | 2195 | return -1; |
1481 | } | 2196 | } |
1482 | 2197 | ||
1483 | memcpy(&cmd.param, power, sizeof(*power)); | 2198 | memcpy(cmd.param, power, sizeof(*power)); |
1484 | if (ipw_send_cmd(priv, &cmd)) { | 2199 | return ipw_send_cmd(priv, &cmd); |
1485 | IPW_ERROR("failed to send TX_POWER command\n"); | 2200 | } |
1486 | return -1; | 2201 | |
2202 | static int ipw_set_tx_power(struct ipw_priv *priv) | ||
2203 | { | ||
2204 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
2205 | struct ipw_tx_power tx_power; | ||
2206 | s8 max_power; | ||
2207 | int i; | ||
2208 | |||
2209 | memset(&tx_power, 0, sizeof(tx_power)); | ||
2210 | |||
2211 | /* configure device for 'G' band */ | ||
2212 | tx_power.ieee_mode = IPW_G_MODE; | ||
2213 | tx_power.num_channels = geo->bg_channels; | ||
2214 | for (i = 0; i < geo->bg_channels; i++) { | ||
2215 | max_power = geo->bg[i].max_power; | ||
2216 | tx_power.channels_tx_power[i].channel_number = | ||
2217 | geo->bg[i].channel; | ||
2218 | tx_power.channels_tx_power[i].tx_power = max_power ? | ||
2219 | min(max_power, priv->tx_power) : priv->tx_power; | ||
1487 | } | 2220 | } |
2221 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2222 | return -EIO; | ||
2223 | |||
2224 | /* configure device to also handle 'B' band */ | ||
2225 | tx_power.ieee_mode = IPW_B_MODE; | ||
2226 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2227 | return -EIO; | ||
1488 | 2228 | ||
2229 | /* configure device to also handle 'A' band */ | ||
2230 | if (priv->ieee->abg_true) { | ||
2231 | tx_power.ieee_mode = IPW_A_MODE; | ||
2232 | tx_power.num_channels = geo->a_channels; | ||
2233 | for (i = 0; i < tx_power.num_channels; i++) { | ||
2234 | max_power = geo->a[i].max_power; | ||
2235 | tx_power.channels_tx_power[i].channel_number = | ||
2236 | geo->a[i].channel; | ||
2237 | tx_power.channels_tx_power[i].tx_power = max_power ? | ||
2238 | min(max_power, priv->tx_power) : priv->tx_power; | ||
2239 | } | ||
2240 | if (ipw_send_tx_power(priv, &tx_power)) | ||
2241 | return -EIO; | ||
2242 | } | ||
1489 | return 0; | 2243 | return 0; |
1490 | } | 2244 | } |
1491 | 2245 | ||
@@ -1504,13 +2258,8 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) | |||
1504 | return -1; | 2258 | return -1; |
1505 | } | 2259 | } |
1506 | 2260 | ||
1507 | memcpy(&cmd.param, &rts_threshold, sizeof(rts_threshold)); | 2261 | memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); |
1508 | if (ipw_send_cmd(priv, &cmd)) { | 2262 | return ipw_send_cmd(priv, &cmd); |
1509 | IPW_ERROR("failed to send RTS_THRESHOLD command\n"); | ||
1510 | return -1; | ||
1511 | } | ||
1512 | |||
1513 | return 0; | ||
1514 | } | 2263 | } |
1515 | 2264 | ||
1516 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | 2265 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) |
@@ -1528,13 +2277,8 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | |||
1528 | return -1; | 2277 | return -1; |
1529 | } | 2278 | } |
1530 | 2279 | ||
1531 | memcpy(&cmd.param, &frag_threshold, sizeof(frag_threshold)); | 2280 | memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); |
1532 | if (ipw_send_cmd(priv, &cmd)) { | 2281 | return ipw_send_cmd(priv, &cmd); |
1533 | IPW_ERROR("failed to send FRAG_THRESHOLD command\n"); | ||
1534 | return -1; | ||
1535 | } | ||
1536 | |||
1537 | return 0; | ||
1538 | } | 2282 | } |
1539 | 2283 | ||
1540 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | 2284 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) |
@@ -1564,12 +2308,27 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
1564 | break; | 2308 | break; |
1565 | } | 2309 | } |
1566 | 2310 | ||
1567 | if (ipw_send_cmd(priv, &cmd)) { | 2311 | return ipw_send_cmd(priv, &cmd); |
1568 | IPW_ERROR("failed to send POWER_MODE command\n"); | 2312 | } |
2313 | |||
2314 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | ||
2315 | { | ||
2316 | struct ipw_retry_limit retry_limit = { | ||
2317 | .short_retry_limit = slimit, | ||
2318 | .long_retry_limit = llimit | ||
2319 | }; | ||
2320 | struct host_cmd cmd = { | ||
2321 | .cmd = IPW_CMD_RETRY_LIMIT, | ||
2322 | .len = sizeof(retry_limit) | ||
2323 | }; | ||
2324 | |||
2325 | if (!priv) { | ||
2326 | IPW_ERROR("Invalid args\n"); | ||
1569 | return -1; | 2327 | return -1; |
1570 | } | 2328 | } |
1571 | 2329 | ||
1572 | return 0; | 2330 | memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); |
2331 | return ipw_send_cmd(priv, &cmd); | ||
1573 | } | 2332 | } |
1574 | 2333 | ||
1575 | /* | 2334 | /* |
@@ -1671,8 +2430,7 @@ static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr) | |||
1671 | /* data's copy of the eeprom data */ | 2430 | /* data's copy of the eeprom data */ |
1672 | static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) | 2431 | static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) |
1673 | { | 2432 | { |
1674 | u8 *ee = (u8 *) priv->eeprom; | 2433 | memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); |
1675 | memcpy(mac, &ee[EEPROM_MAC_ADDRESS], 6); | ||
1676 | } | 2434 | } |
1677 | 2435 | ||
1678 | /* | 2436 | /* |
@@ -1692,7 +2450,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
1692 | 2450 | ||
1693 | /* read entire contents of eeprom into private buffer */ | 2451 | /* read entire contents of eeprom into private buffer */ |
1694 | for (i = 0; i < 128; i++) | 2452 | for (i = 0; i < 128; i++) |
1695 | eeprom[i] = eeprom_read_u16(priv, (u8) i); | 2453 | eeprom[i] = le16_to_cpu(eeprom_read_u16(priv, (u8) i)); |
1696 | 2454 | ||
1697 | /* | 2455 | /* |
1698 | If the data looks correct, then copy it to our private | 2456 | If the data looks correct, then copy it to our private |
@@ -1703,7 +2461,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
1703 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); | 2461 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); |
1704 | 2462 | ||
1705 | /* write the eeprom data to sram */ | 2463 | /* write the eeprom data to sram */ |
1706 | for (i = 0; i < CX2_EEPROM_IMAGE_SIZE; i++) | 2464 | for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) |
1707 | ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); | 2465 | ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); |
1708 | 2466 | ||
1709 | /* Do not load eeprom data on fatal error or suspend */ | 2467 | /* Do not load eeprom data on fatal error or suspend */ |
@@ -1723,14 +2481,14 @@ static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) | |||
1723 | count >>= 2; | 2481 | count >>= 2; |
1724 | if (!count) | 2482 | if (!count) |
1725 | return; | 2483 | return; |
1726 | _ipw_write32(priv, CX2_AUTOINC_ADDR, start); | 2484 | _ipw_write32(priv, IPW_AUTOINC_ADDR, start); |
1727 | while (count--) | 2485 | while (count--) |
1728 | _ipw_write32(priv, CX2_AUTOINC_DATA, 0); | 2486 | _ipw_write32(priv, IPW_AUTOINC_DATA, 0); |
1729 | } | 2487 | } |
1730 | 2488 | ||
1731 | static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) | 2489 | static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) |
1732 | { | 2490 | { |
1733 | ipw_zero_memory(priv, CX2_SHARED_SRAM_DMA_CONTROL, | 2491 | ipw_zero_memory(priv, IPW_SHARED_SRAM_DMA_CONTROL, |
1734 | CB_NUMBER_OF_ELEMENTS_SMALL * | 2492 | CB_NUMBER_OF_ELEMENTS_SMALL * |
1735 | sizeof(struct command_block)); | 2493 | sizeof(struct command_block)); |
1736 | } | 2494 | } |
@@ -1744,7 +2502,7 @@ static int ipw_fw_dma_enable(struct ipw_priv *priv) | |||
1744 | ipw_fw_dma_reset_command_blocks(priv); | 2502 | ipw_fw_dma_reset_command_blocks(priv); |
1745 | 2503 | ||
1746 | /* Write CB base address */ | 2504 | /* Write CB base address */ |
1747 | ipw_write_reg32(priv, CX2_DMA_I_CB_BASE, CX2_SHARED_SRAM_DMA_CONTROL); | 2505 | ipw_write_reg32(priv, IPW_DMA_I_CB_BASE, IPW_SHARED_SRAM_DMA_CONTROL); |
1748 | 2506 | ||
1749 | IPW_DEBUG_FW("<< : \n"); | 2507 | IPW_DEBUG_FW("<< : \n"); |
1750 | return 0; | 2508 | return 0; |
@@ -1758,7 +2516,7 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv) | |||
1758 | 2516 | ||
1759 | //set the Stop and Abort bit | 2517 | //set the Stop and Abort bit |
1760 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; | 2518 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; |
1761 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); | 2519 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); |
1762 | priv->sram_desc.last_cb_index = 0; | 2520 | priv->sram_desc.last_cb_index = 0; |
1763 | 2521 | ||
1764 | IPW_DEBUG_FW("<< \n"); | 2522 | IPW_DEBUG_FW("<< \n"); |
@@ -1768,7 +2526,7 @@ static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, | |||
1768 | struct command_block *cb) | 2526 | struct command_block *cb) |
1769 | { | 2527 | { |
1770 | u32 address = | 2528 | u32 address = |
1771 | CX2_SHARED_SRAM_DMA_CONTROL + | 2529 | IPW_SHARED_SRAM_DMA_CONTROL + |
1772 | (sizeof(struct command_block) * index); | 2530 | (sizeof(struct command_block) * index); |
1773 | IPW_DEBUG_FW(">> :\n"); | 2531 | IPW_DEBUG_FW(">> :\n"); |
1774 | 2532 | ||
@@ -1792,13 +2550,13 @@ static int ipw_fw_dma_kick(struct ipw_priv *priv) | |||
1792 | &priv->sram_desc.cb_list[index]); | 2550 | &priv->sram_desc.cb_list[index]); |
1793 | 2551 | ||
1794 | /* Enable the DMA in the CSR register */ | 2552 | /* Enable the DMA in the CSR register */ |
1795 | ipw_clear_bit(priv, CX2_RESET_REG, | 2553 | ipw_clear_bit(priv, IPW_RESET_REG, |
1796 | CX2_RESET_REG_MASTER_DISABLED | | 2554 | IPW_RESET_REG_MASTER_DISABLED | |
1797 | CX2_RESET_REG_STOP_MASTER); | 2555 | IPW_RESET_REG_STOP_MASTER); |
1798 | 2556 | ||
1799 | /* Set the Start bit. */ | 2557 | /* Set the Start bit. */ |
1800 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; | 2558 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; |
1801 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); | 2559 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); |
1802 | 2560 | ||
1803 | IPW_DEBUG_FW("<< :\n"); | 2561 | IPW_DEBUG_FW("<< :\n"); |
1804 | return 0; | 2562 | return 0; |
@@ -1811,12 +2569,12 @@ static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) | |||
1811 | u32 cb_fields_address = 0; | 2569 | u32 cb_fields_address = 0; |
1812 | 2570 | ||
1813 | IPW_DEBUG_FW(">> :\n"); | 2571 | IPW_DEBUG_FW(">> :\n"); |
1814 | address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); | 2572 | address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); |
1815 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); | 2573 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); |
1816 | 2574 | ||
1817 | /* Read the DMA Controlor register */ | 2575 | /* Read the DMA Controlor register */ |
1818 | register_value = ipw_read_reg32(priv, CX2_DMA_I_DMA_CONTROL); | 2576 | register_value = ipw_read_reg32(priv, IPW_DMA_I_DMA_CONTROL); |
1819 | IPW_DEBUG_FW_INFO("CX2_DMA_I_DMA_CONTROL is 0x%x \n", register_value); | 2577 | IPW_DEBUG_FW_INFO("IPW_DMA_I_DMA_CONTROL is 0x%x \n", register_value); |
1820 | 2578 | ||
1821 | /* Print the CB values */ | 2579 | /* Print the CB values */ |
1822 | cb_fields_address = address; | 2580 | cb_fields_address = address; |
@@ -1845,9 +2603,9 @@ static int ipw_fw_dma_command_block_index(struct ipw_priv *priv) | |||
1845 | u32 current_cb_index = 0; | 2603 | u32 current_cb_index = 0; |
1846 | 2604 | ||
1847 | IPW_DEBUG_FW("<< :\n"); | 2605 | IPW_DEBUG_FW("<< :\n"); |
1848 | current_cb_address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); | 2606 | current_cb_address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); |
1849 | 2607 | ||
1850 | current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL) / | 2608 | current_cb_index = (current_cb_address - IPW_SHARED_SRAM_DMA_CONTROL) / |
1851 | sizeof(struct command_block); | 2609 | sizeof(struct command_block); |
1852 | 2610 | ||
1853 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", | 2611 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", |
@@ -1976,8 +2734,8 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv) | |||
1976 | ipw_fw_dma_abort(priv); | 2734 | ipw_fw_dma_abort(priv); |
1977 | 2735 | ||
1978 | /*Disable the DMA in the CSR register */ | 2736 | /*Disable the DMA in the CSR register */ |
1979 | ipw_set_bit(priv, CX2_RESET_REG, | 2737 | ipw_set_bit(priv, IPW_RESET_REG, |
1980 | CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); | 2738 | IPW_RESET_REG_MASTER_DISABLED | IPW_RESET_REG_STOP_MASTER); |
1981 | 2739 | ||
1982 | IPW_DEBUG_FW("<< dmaWaitSync \n"); | 2740 | IPW_DEBUG_FW("<< dmaWaitSync \n"); |
1983 | return 0; | 2741 | return 0; |
@@ -1987,6 +2745,9 @@ static void ipw_remove_current_network(struct ipw_priv *priv) | |||
1987 | { | 2745 | { |
1988 | struct list_head *element, *safe; | 2746 | struct list_head *element, *safe; |
1989 | struct ieee80211_network *network = NULL; | 2747 | struct ieee80211_network *network = NULL; |
2748 | unsigned long flags; | ||
2749 | |||
2750 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
1990 | list_for_each_safe(element, safe, &priv->ieee->network_list) { | 2751 | list_for_each_safe(element, safe, &priv->ieee->network_list) { |
1991 | network = list_entry(element, struct ieee80211_network, list); | 2752 | network = list_entry(element, struct ieee80211_network, list); |
1992 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | 2753 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { |
@@ -1995,6 +2756,7 @@ static void ipw_remove_current_network(struct ipw_priv *priv) | |||
1995 | &priv->ieee->network_free_list); | 2756 | &priv->ieee->network_free_list); |
1996 | } | 2757 | } |
1997 | } | 2758 | } |
2759 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
1998 | } | 2760 | } |
1999 | 2761 | ||
2000 | /** | 2762 | /** |
@@ -2037,10 +2799,10 @@ static int ipw_stop_master(struct ipw_priv *priv) | |||
2037 | 2799 | ||
2038 | IPW_DEBUG_TRACE(">> \n"); | 2800 | IPW_DEBUG_TRACE(">> \n"); |
2039 | /* stop master. typical delay - 0 */ | 2801 | /* stop master. typical delay - 0 */ |
2040 | ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); | 2802 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
2041 | 2803 | ||
2042 | rc = ipw_poll_bit(priv, CX2_RESET_REG, | 2804 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
2043 | CX2_RESET_REG_MASTER_DISABLED, 100); | 2805 | IPW_RESET_REG_MASTER_DISABLED, 100); |
2044 | if (rc < 0) { | 2806 | if (rc < 0) { |
2045 | IPW_ERROR("stop master failed in 10ms\n"); | 2807 | IPW_ERROR("stop master failed in 10ms\n"); |
2046 | return -1; | 2808 | return -1; |
@@ -2056,7 +2818,7 @@ static void ipw_arc_release(struct ipw_priv *priv) | |||
2056 | IPW_DEBUG_TRACE(">> \n"); | 2818 | IPW_DEBUG_TRACE(">> \n"); |
2057 | mdelay(5); | 2819 | mdelay(5); |
2058 | 2820 | ||
2059 | ipw_clear_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); | 2821 | ipw_clear_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); |
2060 | 2822 | ||
2061 | /* no one knows timing, for safety add some delay */ | 2823 | /* no one knows timing, for safety add some delay */ |
2062 | mdelay(5); | 2824 | mdelay(5); |
@@ -2073,13 +2835,12 @@ struct fw_chunk { | |||
2073 | }; | 2835 | }; |
2074 | 2836 | ||
2075 | #define IPW_FW_MAJOR_VERSION 2 | 2837 | #define IPW_FW_MAJOR_VERSION 2 |
2076 | #define IPW_FW_MINOR_VERSION 2 | 2838 | #define IPW_FW_MINOR_VERSION 4 |
2077 | 2839 | ||
2078 | #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) | 2840 | #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) |
2079 | #define IPW_FW_MAJOR(x) (x & 0xff) | 2841 | #define IPW_FW_MAJOR(x) (x & 0xff) |
2080 | 2842 | ||
2081 | #define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | \ | 2843 | #define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | IPW_FW_MAJOR_VERSION) |
2082 | IPW_FW_MAJOR_VERSION) | ||
2083 | 2844 | ||
2084 | #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ | 2845 | #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ |
2085 | "." __stringify(IPW_FW_MINOR_VERSION) "-" | 2846 | "." __stringify(IPW_FW_MINOR_VERSION) "-" |
@@ -2107,8 +2868,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2107 | 2868 | ||
2108 | // spin_lock_irqsave(&priv->lock, flags); | 2869 | // spin_lock_irqsave(&priv->lock, flags); |
2109 | 2870 | ||
2110 | for (addr = CX2_SHARED_LOWER_BOUND; | 2871 | for (addr = IPW_SHARED_LOWER_BOUND; |
2111 | addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { | 2872 | addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { |
2112 | ipw_write32(priv, addr, 0); | 2873 | ipw_write32(priv, addr, 0); |
2113 | } | 2874 | } |
2114 | 2875 | ||
@@ -2117,16 +2878,16 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2117 | /* destroy DMA queues */ | 2878 | /* destroy DMA queues */ |
2118 | /* reset sequence */ | 2879 | /* reset sequence */ |
2119 | 2880 | ||
2120 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_ON); | 2881 | ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_ON); |
2121 | ipw_arc_release(priv); | 2882 | ipw_arc_release(priv); |
2122 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_OFF); | 2883 | ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_OFF); |
2123 | mdelay(1); | 2884 | mdelay(1); |
2124 | 2885 | ||
2125 | /* reset PHY */ | 2886 | /* reset PHY */ |
2126 | ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, CX2_BASEBAND_POWER_DOWN); | 2887 | ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, IPW_BASEBAND_POWER_DOWN); |
2127 | mdelay(1); | 2888 | mdelay(1); |
2128 | 2889 | ||
2129 | ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, 0); | 2890 | ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, 0); |
2130 | mdelay(1); | 2891 | mdelay(1); |
2131 | 2892 | ||
2132 | /* enable ucode store */ | 2893 | /* enable ucode store */ |
@@ -2144,18 +2905,19 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2144 | */ | 2905 | */ |
2145 | /* load new ipw uCode */ | 2906 | /* load new ipw uCode */ |
2146 | for (i = 0; i < len / 2; i++) | 2907 | for (i = 0; i < len / 2; i++) |
2147 | ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); | 2908 | ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE, |
2909 | cpu_to_le16(image[i])); | ||
2148 | 2910 | ||
2149 | /* enable DINO */ | 2911 | /* enable DINO */ |
2150 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2912 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); |
2151 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); | 2913 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); |
2152 | 2914 | ||
2153 | /* this is where the igx / win driver deveates from the VAP driver. */ | 2915 | /* this is where the igx / win driver deveates from the VAP driver. */ |
2154 | 2916 | ||
2155 | /* wait for alive response */ | 2917 | /* wait for alive response */ |
2156 | for (i = 0; i < 100; i++) { | 2918 | for (i = 0; i < 100; i++) { |
2157 | /* poll for incoming data */ | 2919 | /* poll for incoming data */ |
2158 | cr = ipw_read_reg8(priv, CX2_BASEBAND_CONTROL_STATUS); | 2920 | cr = ipw_read_reg8(priv, IPW_BASEBAND_CONTROL_STATUS); |
2159 | if (cr & DINO_RXFIFO_DATA) | 2921 | if (cr & DINO_RXFIFO_DATA) |
2160 | break; | 2922 | break; |
2161 | mdelay(1); | 2923 | mdelay(1); |
@@ -2167,7 +2929,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2167 | 2929 | ||
2168 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) | 2930 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) |
2169 | response_buffer[i] = | 2931 | response_buffer[i] = |
2170 | ipw_read_reg32(priv, CX2_BASEBAND_RX_FIFO_READ); | 2932 | le32_to_cpu(ipw_read_reg32(priv, |
2933 | IPW_BASEBAND_RX_FIFO_READ)); | ||
2171 | memcpy(&priv->dino_alive, response_buffer, | 2934 | memcpy(&priv->dino_alive, response_buffer, |
2172 | sizeof(priv->dino_alive)); | 2935 | sizeof(priv->dino_alive)); |
2173 | if (priv->dino_alive.alive_command == 1 | 2936 | if (priv->dino_alive.alive_command == 1 |
@@ -2196,7 +2959,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2196 | 2959 | ||
2197 | /* disable DINO, otherwise for some reason | 2960 | /* disable DINO, otherwise for some reason |
2198 | firmware have problem getting alive resp. */ | 2961 | firmware have problem getting alive resp. */ |
2199 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2962 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); |
2200 | 2963 | ||
2201 | // spin_unlock_irqrestore(&priv->lock, flags); | 2964 | // spin_unlock_irqrestore(&priv->lock, flags); |
2202 | 2965 | ||
@@ -2236,13 +2999,14 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) | |||
2236 | * offeset*/ | 2999 | * offeset*/ |
2237 | /* Dma loading */ | 3000 | /* Dma loading */ |
2238 | rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, | 3001 | rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, |
2239 | chunk->address, chunk->length); | 3002 | le32_to_cpu(chunk->address), |
3003 | le32_to_cpu(chunk->length)); | ||
2240 | if (rc) { | 3004 | if (rc) { |
2241 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); | 3005 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); |
2242 | goto out; | 3006 | goto out; |
2243 | } | 3007 | } |
2244 | 3008 | ||
2245 | offset += chunk->length; | 3009 | offset += le32_to_cpu(chunk->length); |
2246 | } while (offset < len); | 3010 | } while (offset < len); |
2247 | 3011 | ||
2248 | /* Run the DMA and wait for the answer */ | 3012 | /* Run the DMA and wait for the answer */ |
@@ -2268,16 +3032,16 @@ static int ipw_stop_nic(struct ipw_priv *priv) | |||
2268 | int rc = 0; | 3032 | int rc = 0; |
2269 | 3033 | ||
2270 | /* stop */ | 3034 | /* stop */ |
2271 | ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); | 3035 | ipw_write32(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
2272 | 3036 | ||
2273 | rc = ipw_poll_bit(priv, CX2_RESET_REG, | 3037 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
2274 | CX2_RESET_REG_MASTER_DISABLED, 500); | 3038 | IPW_RESET_REG_MASTER_DISABLED, 500); |
2275 | if (rc < 0) { | 3039 | if (rc < 0) { |
2276 | IPW_ERROR("wait for reg master disabled failed\n"); | 3040 | IPW_ERROR("wait for reg master disabled failed\n"); |
2277 | return rc; | 3041 | return rc; |
2278 | } | 3042 | } |
2279 | 3043 | ||
2280 | ipw_set_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); | 3044 | ipw_set_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); |
2281 | 3045 | ||
2282 | return rc; | 3046 | return rc; |
2283 | } | 3047 | } |
@@ -2287,14 +3051,14 @@ static void ipw_start_nic(struct ipw_priv *priv) | |||
2287 | IPW_DEBUG_TRACE(">>\n"); | 3051 | IPW_DEBUG_TRACE(">>\n"); |
2288 | 3052 | ||
2289 | /* prvHwStartNic release ARC */ | 3053 | /* prvHwStartNic release ARC */ |
2290 | ipw_clear_bit(priv, CX2_RESET_REG, | 3054 | ipw_clear_bit(priv, IPW_RESET_REG, |
2291 | CX2_RESET_REG_MASTER_DISABLED | | 3055 | IPW_RESET_REG_MASTER_DISABLED | |
2292 | CX2_RESET_REG_STOP_MASTER | | 3056 | IPW_RESET_REG_STOP_MASTER | |
2293 | CBD_RESET_REG_PRINCETON_RESET); | 3057 | CBD_RESET_REG_PRINCETON_RESET); |
2294 | 3058 | ||
2295 | /* enable power management */ | 3059 | /* enable power management */ |
2296 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, | 3060 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, |
2297 | CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); | 3061 | IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); |
2298 | 3062 | ||
2299 | IPW_DEBUG_TRACE("<<\n"); | 3063 | IPW_DEBUG_TRACE("<<\n"); |
2300 | } | 3064 | } |
@@ -2307,25 +3071,25 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2307 | /* reset */ | 3071 | /* reset */ |
2308 | /*prvHwInitNic */ | 3072 | /*prvHwInitNic */ |
2309 | /* set "initialization complete" bit to move adapter to D0 state */ | 3073 | /* set "initialization complete" bit to move adapter to D0 state */ |
2310 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); | 3074 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); |
2311 | 3075 | ||
2312 | /* low-level PLL activation */ | 3076 | /* low-level PLL activation */ |
2313 | ipw_write32(priv, CX2_READ_INT_REGISTER, | 3077 | ipw_write32(priv, IPW_READ_INT_REGISTER, |
2314 | CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); | 3078 | IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER); |
2315 | 3079 | ||
2316 | /* wait for clock stabilization */ | 3080 | /* wait for clock stabilization */ |
2317 | rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, | 3081 | rc = ipw_poll_bit(priv, IPW_GP_CNTRL_RW, |
2318 | CX2_GP_CNTRL_BIT_CLOCK_READY, 250); | 3082 | IPW_GP_CNTRL_BIT_CLOCK_READY, 250); |
2319 | if (rc < 0) | 3083 | if (rc < 0) |
2320 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); | 3084 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); |
2321 | 3085 | ||
2322 | /* assert SW reset */ | 3086 | /* assert SW reset */ |
2323 | ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_SW_RESET); | 3087 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_SW_RESET); |
2324 | 3088 | ||
2325 | udelay(10); | 3089 | udelay(10); |
2326 | 3090 | ||
2327 | /* set "initialization complete" bit to move adapter to D0 state */ | 3091 | /* set "initialization complete" bit to move adapter to D0 state */ |
2328 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); | 3092 | ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); |
2329 | 3093 | ||
2330 | IPW_DEBUG_TRACE(">>\n"); | 3094 | IPW_DEBUG_TRACE(">>\n"); |
2331 | return 0; | 3095 | return 0; |
@@ -2337,14 +3101,19 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2337 | static int ipw_reset_nic(struct ipw_priv *priv) | 3101 | static int ipw_reset_nic(struct ipw_priv *priv) |
2338 | { | 3102 | { |
2339 | int rc = 0; | 3103 | int rc = 0; |
3104 | unsigned long flags; | ||
2340 | 3105 | ||
2341 | IPW_DEBUG_TRACE(">>\n"); | 3106 | IPW_DEBUG_TRACE(">>\n"); |
2342 | 3107 | ||
2343 | rc = ipw_init_nic(priv); | 3108 | rc = ipw_init_nic(priv); |
2344 | 3109 | ||
3110 | spin_lock_irqsave(&priv->lock, flags); | ||
2345 | /* Clear the 'host command active' bit... */ | 3111 | /* Clear the 'host command active' bit... */ |
2346 | priv->status &= ~STATUS_HCMD_ACTIVE; | 3112 | priv->status &= ~STATUS_HCMD_ACTIVE; |
2347 | wake_up_interruptible(&priv->wait_command_queue); | 3113 | wake_up_interruptible(&priv->wait_command_queue); |
3114 | priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); | ||
3115 | wake_up_interruptible(&priv->wait_state); | ||
3116 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2348 | 3117 | ||
2349 | IPW_DEBUG_TRACE("<<\n"); | 3118 | IPW_DEBUG_TRACE("<<\n"); |
2350 | return rc; | 3119 | return rc; |
@@ -2364,22 +3133,23 @@ static int ipw_get_fw(struct ipw_priv *priv, | |||
2364 | } | 3133 | } |
2365 | 3134 | ||
2366 | header = (struct fw_header *)(*fw)->data; | 3135 | header = (struct fw_header *)(*fw)->data; |
2367 | if (IPW_FW_MAJOR(header->version) != IPW_FW_MAJOR_VERSION) { | 3136 | if (IPW_FW_MAJOR(le32_to_cpu(header->version)) != IPW_FW_MAJOR_VERSION) { |
2368 | IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", | 3137 | IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", |
2369 | name, | 3138 | name, |
2370 | IPW_FW_MAJOR(header->version), IPW_FW_MAJOR_VERSION); | 3139 | IPW_FW_MAJOR(le32_to_cpu(header->version)), |
3140 | IPW_FW_MAJOR_VERSION); | ||
2371 | return -EINVAL; | 3141 | return -EINVAL; |
2372 | } | 3142 | } |
2373 | 3143 | ||
2374 | IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", | 3144 | IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", |
2375 | name, | 3145 | name, |
2376 | IPW_FW_MAJOR(header->version), | 3146 | IPW_FW_MAJOR(le32_to_cpu(header->version)), |
2377 | IPW_FW_MINOR(header->version), | 3147 | IPW_FW_MINOR(le32_to_cpu(header->version)), |
2378 | (*fw)->size - sizeof(struct fw_header)); | 3148 | (*fw)->size - sizeof(struct fw_header)); |
2379 | return 0; | 3149 | return 0; |
2380 | } | 3150 | } |
2381 | 3151 | ||
2382 | #define CX2_RX_BUF_SIZE (3000) | 3152 | #define IPW_RX_BUF_SIZE (3000) |
2383 | 3153 | ||
2384 | static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | 3154 | static inline void ipw_rx_queue_reset(struct ipw_priv *priv, |
2385 | struct ipw_rx_queue *rxq) | 3155 | struct ipw_rx_queue *rxq) |
@@ -2398,8 +3168,9 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | |||
2398 | * to an SKB, so we need to unmap and free potential storage */ | 3168 | * to an SKB, so we need to unmap and free potential storage */ |
2399 | if (rxq->pool[i].skb != NULL) { | 3169 | if (rxq->pool[i].skb != NULL) { |
2400 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 3170 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
2401 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 3171 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
2402 | dev_kfree_skb(rxq->pool[i].skb); | 3172 | dev_kfree_skb(rxq->pool[i].skb); |
3173 | rxq->pool[i].skb = NULL; | ||
2403 | } | 3174 | } |
2404 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 3175 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
2405 | } | 3176 | } |
@@ -2417,6 +3188,19 @@ static int fw_loaded = 0; | |||
2417 | static const struct firmware *bootfw = NULL; | 3188 | static const struct firmware *bootfw = NULL; |
2418 | static const struct firmware *firmware = NULL; | 3189 | static const struct firmware *firmware = NULL; |
2419 | static const struct firmware *ucode = NULL; | 3190 | static const struct firmware *ucode = NULL; |
3191 | |||
3192 | static void free_firmware(void) | ||
3193 | { | ||
3194 | if (fw_loaded) { | ||
3195 | release_firmware(bootfw); | ||
3196 | release_firmware(ucode); | ||
3197 | release_firmware(firmware); | ||
3198 | bootfw = ucode = firmware = NULL; | ||
3199 | fw_loaded = 0; | ||
3200 | } | ||
3201 | } | ||
3202 | #else | ||
3203 | #define free_firmware() do {} while (0) | ||
2420 | #endif | 3204 | #endif |
2421 | 3205 | ||
2422 | static int ipw_load(struct ipw_priv *priv) | 3206 | static int ipw_load(struct ipw_priv *priv) |
@@ -2445,10 +3229,10 @@ static int ipw_load(struct ipw_priv *priv) | |||
2445 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); | 3229 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); |
2446 | break; | 3230 | break; |
2447 | 3231 | ||
2448 | #ifdef CONFIG_IPW_PROMISC | 3232 | #ifdef CONFIG_IPW2200_MONITOR |
2449 | case IW_MODE_MONITOR: | 3233 | case IW_MODE_MONITOR: |
2450 | rc = ipw_get_fw(priv, &ucode, | 3234 | rc = ipw_get_fw(priv, &ucode, |
2451 | IPW_FW_NAME("ibss_ucode")); | 3235 | IPW_FW_NAME("sniffer_ucode")); |
2452 | if (rc) | 3236 | if (rc) |
2453 | goto error; | 3237 | goto error; |
2454 | 3238 | ||
@@ -2487,11 +3271,11 @@ static int ipw_load(struct ipw_priv *priv) | |||
2487 | 3271 | ||
2488 | retry: | 3272 | retry: |
2489 | /* Ensure interrupts are disabled */ | 3273 | /* Ensure interrupts are disabled */ |
2490 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 3274 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
2491 | priv->status &= ~STATUS_INT_ENABLED; | 3275 | priv->status &= ~STATUS_INT_ENABLED; |
2492 | 3276 | ||
2493 | /* ack pending interrupts */ | 3277 | /* ack pending interrupts */ |
2494 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); | 3278 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); |
2495 | 3279 | ||
2496 | ipw_stop_nic(priv); | 3280 | ipw_stop_nic(priv); |
2497 | 3281 | ||
@@ -2501,14 +3285,14 @@ static int ipw_load(struct ipw_priv *priv) | |||
2501 | goto error; | 3285 | goto error; |
2502 | } | 3286 | } |
2503 | 3287 | ||
2504 | ipw_zero_memory(priv, CX2_NIC_SRAM_LOWER_BOUND, | 3288 | ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, |
2505 | CX2_NIC_SRAM_UPPER_BOUND - CX2_NIC_SRAM_LOWER_BOUND); | 3289 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); |
2506 | 3290 | ||
2507 | /* DMA the initial boot firmware into the device */ | 3291 | /* DMA the initial boot firmware into the device */ |
2508 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), | 3292 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), |
2509 | bootfw->size - sizeof(struct fw_header)); | 3293 | bootfw->size - sizeof(struct fw_header)); |
2510 | if (rc < 0) { | 3294 | if (rc < 0) { |
2511 | IPW_ERROR("Unable to load boot firmware\n"); | 3295 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); |
2512 | goto error; | 3296 | goto error; |
2513 | } | 3297 | } |
2514 | 3298 | ||
@@ -2516,8 +3300,8 @@ static int ipw_load(struct ipw_priv *priv) | |||
2516 | ipw_start_nic(priv); | 3300 | ipw_start_nic(priv); |
2517 | 3301 | ||
2518 | /* wait for the device to finish it's initial startup sequence */ | 3302 | /* wait for the device to finish it's initial startup sequence */ |
2519 | rc = ipw_poll_bit(priv, CX2_INTA_RW, | 3303 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
2520 | CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3304 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
2521 | if (rc < 0) { | 3305 | if (rc < 0) { |
2522 | IPW_ERROR("device failed to boot initial fw image\n"); | 3306 | IPW_ERROR("device failed to boot initial fw image\n"); |
2523 | goto error; | 3307 | goto error; |
@@ -2525,13 +3309,13 @@ static int ipw_load(struct ipw_priv *priv) | |||
2525 | IPW_DEBUG_INFO("initial device response after %dms\n", rc); | 3309 | IPW_DEBUG_INFO("initial device response after %dms\n", rc); |
2526 | 3310 | ||
2527 | /* ack fw init done interrupt */ | 3311 | /* ack fw init done interrupt */ |
2528 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); | 3312 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
2529 | 3313 | ||
2530 | /* DMA the ucode into the device */ | 3314 | /* DMA the ucode into the device */ |
2531 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), | 3315 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), |
2532 | ucode->size - sizeof(struct fw_header)); | 3316 | ucode->size - sizeof(struct fw_header)); |
2533 | if (rc < 0) { | 3317 | if (rc < 0) { |
2534 | IPW_ERROR("Unable to load ucode\n"); | 3318 | IPW_ERROR("Unable to load ucode: %d\n", rc); |
2535 | goto error; | 3319 | goto error; |
2536 | } | 3320 | } |
2537 | 3321 | ||
@@ -2543,7 +3327,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2543 | sizeof(struct fw_header), | 3327 | sizeof(struct fw_header), |
2544 | firmware->size - sizeof(struct fw_header)); | 3328 | firmware->size - sizeof(struct fw_header)); |
2545 | if (rc < 0) { | 3329 | if (rc < 0) { |
2546 | IPW_ERROR("Unable to load firmware\n"); | 3330 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
2547 | goto error; | 3331 | goto error; |
2548 | } | 3332 | } |
2549 | 3333 | ||
@@ -2556,12 +3340,14 @@ static int ipw_load(struct ipw_priv *priv) | |||
2556 | } | 3340 | } |
2557 | 3341 | ||
2558 | /* Ensure interrupts are disabled */ | 3342 | /* Ensure interrupts are disabled */ |
2559 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 3343 | ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); |
3344 | /* ack pending interrupts */ | ||
3345 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); | ||
2560 | 3346 | ||
2561 | /* kick start the device */ | 3347 | /* kick start the device */ |
2562 | ipw_start_nic(priv); | 3348 | ipw_start_nic(priv); |
2563 | 3349 | ||
2564 | if (ipw_read32(priv, CX2_INTA_RW) & CX2_INTA_BIT_PARITY_ERROR) { | 3350 | if (ipw_read32(priv, IPW_INTA_RW) & IPW_INTA_BIT_PARITY_ERROR) { |
2565 | if (retries > 0) { | 3351 | if (retries > 0) { |
2566 | IPW_WARNING("Parity error. Retrying init.\n"); | 3352 | IPW_WARNING("Parity error. Retrying init.\n"); |
2567 | retries--; | 3353 | retries--; |
@@ -2574,8 +3360,8 @@ static int ipw_load(struct ipw_priv *priv) | |||
2574 | } | 3360 | } |
2575 | 3361 | ||
2576 | /* wait for the device */ | 3362 | /* wait for the device */ |
2577 | rc = ipw_poll_bit(priv, CX2_INTA_RW, | 3363 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
2578 | CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3364 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
2579 | if (rc < 0) { | 3365 | if (rc < 0) { |
2580 | IPW_ERROR("device failed to start after 500ms\n"); | 3366 | IPW_ERROR("device failed to start after 500ms\n"); |
2581 | goto error; | 3367 | goto error; |
@@ -2583,7 +3369,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2583 | IPW_DEBUG_INFO("device response after %dms\n", rc); | 3369 | IPW_DEBUG_INFO("device response after %dms\n", rc); |
2584 | 3370 | ||
2585 | /* ack fw init done interrupt */ | 3371 | /* ack fw init done interrupt */ |
2586 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); | 3372 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
2587 | 3373 | ||
2588 | /* read eeprom data and initialize the eeprom region of sram */ | 3374 | /* read eeprom data and initialize the eeprom region of sram */ |
2589 | priv->eeprom_delay = 1; | 3375 | priv->eeprom_delay = 1; |
@@ -2595,10 +3381,10 @@ static int ipw_load(struct ipw_priv *priv) | |||
2595 | /* Ensure our queue has valid packets */ | 3381 | /* Ensure our queue has valid packets */ |
2596 | ipw_rx_queue_replenish(priv); | 3382 | ipw_rx_queue_replenish(priv); |
2597 | 3383 | ||
2598 | ipw_write32(priv, CX2_RX_READ_INDEX, priv->rxq->read); | 3384 | ipw_write32(priv, IPW_RX_READ_INDEX, priv->rxq->read); |
2599 | 3385 | ||
2600 | /* ack pending interrupts */ | 3386 | /* ack pending interrupts */ |
2601 | ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); | 3387 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); |
2602 | 3388 | ||
2603 | #ifndef CONFIG_PM | 3389 | #ifndef CONFIG_PM |
2604 | release_firmware(bootfw); | 3390 | release_firmware(bootfw); |
@@ -2755,16 +3541,18 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv, | |||
2755 | return; | 3541 | return; |
2756 | 3542 | ||
2757 | /* sanity check */ | 3543 | /* sanity check */ |
2758 | if (bd->u.data.num_chunks > NUM_TFD_CHUNKS) { | 3544 | if (le32_to_cpu(bd->u.data.num_chunks) > NUM_TFD_CHUNKS) { |
2759 | IPW_ERROR("Too many chunks: %i\n", bd->u.data.num_chunks); | 3545 | IPW_ERROR("Too many chunks: %i\n", |
3546 | le32_to_cpu(bd->u.data.num_chunks)); | ||
2760 | /** @todo issue fatal error, it is quite serious situation */ | 3547 | /** @todo issue fatal error, it is quite serious situation */ |
2761 | return; | 3548 | return; |
2762 | } | 3549 | } |
2763 | 3550 | ||
2764 | /* unmap chunks if any */ | 3551 | /* unmap chunks if any */ |
2765 | for (i = 0; i < bd->u.data.num_chunks; i++) { | 3552 | for (i = 0; i < le32_to_cpu(bd->u.data.num_chunks); i++) { |
2766 | pci_unmap_single(dev, bd->u.data.chunk_ptr[i], | 3553 | pci_unmap_single(dev, le32_to_cpu(bd->u.data.chunk_ptr[i]), |
2767 | bd->u.data.chunk_len[i], PCI_DMA_TODEVICE); | 3554 | le16_to_cpu(bd->u.data.chunk_len[i]), |
3555 | PCI_DMA_TODEVICE); | ||
2768 | if (txq->txb[txq->q.last_used]) { | 3556 | if (txq->txb[txq->q.last_used]) { |
2769 | ieee80211_txb_free(txq->txb[txq->q.last_used]); | 3557 | ieee80211_txb_free(txq->txb[txq->q.last_used]); |
2770 | txq->txb[txq->q.last_used] = NULL; | 3558 | txq->txb[txq->q.last_used] = NULL; |
@@ -2821,21 +3609,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv) | |||
2821 | ipw_queue_tx_free(priv, &priv->txq[3]); | 3609 | ipw_queue_tx_free(priv, &priv->txq[3]); |
2822 | } | 3610 | } |
2823 | 3611 | ||
2824 | static void inline __maybe_wake_tx(struct ipw_priv *priv) | ||
2825 | { | ||
2826 | if (netif_running(priv->net_dev)) { | ||
2827 | switch (priv->port_type) { | ||
2828 | case DCR_TYPE_MU_BSS: | ||
2829 | case DCR_TYPE_MU_IBSS: | ||
2830 | if (!(priv->status & STATUS_ASSOCIATED)) { | ||
2831 | return; | ||
2832 | } | ||
2833 | } | ||
2834 | netif_wake_queue(priv->net_dev); | ||
2835 | } | ||
2836 | |||
2837 | } | ||
2838 | |||
2839 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) | 3612 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) |
2840 | { | 3613 | { |
2841 | /* First 3 bytes are manufacturer */ | 3614 | /* First 3 bytes are manufacturer */ |
@@ -2898,7 +3671,13 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2898 | { | 3671 | { |
2899 | int err; | 3672 | int err; |
2900 | 3673 | ||
2901 | if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))) { | 3674 | if (priv->status & STATUS_ASSOCIATING) { |
3675 | IPW_DEBUG_ASSOC("Disassociating while associating.\n"); | ||
3676 | queue_work(priv->workqueue, &priv->disassociate); | ||
3677 | return; | ||
3678 | } | ||
3679 | |||
3680 | if (!(priv->status & STATUS_ASSOCIATED)) { | ||
2902 | IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); | 3681 | IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); |
2903 | return; | 3682 | return; |
2904 | } | 3683 | } |
@@ -2915,6 +3694,7 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2915 | priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; | 3694 | priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; |
2916 | else | 3695 | else |
2917 | priv->assoc_request.assoc_type = HC_DISASSOCIATE; | 3696 | priv->assoc_request.assoc_type = HC_DISASSOCIATE; |
3697 | |||
2918 | err = ipw_send_associate(priv, &priv->assoc_request); | 3698 | err = ipw_send_associate(priv, &priv->assoc_request); |
2919 | if (err) { | 3699 | if (err) { |
2920 | IPW_DEBUG_HC("Attempt to send [dis]associate command " | 3700 | IPW_DEBUG_HC("Attempt to send [dis]associate command " |
@@ -2924,20 +3704,27 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) | |||
2924 | 3704 | ||
2925 | } | 3705 | } |
2926 | 3706 | ||
2927 | static void ipw_disassociate(void *data) | 3707 | static int ipw_disassociate(void *data) |
2928 | { | 3708 | { |
3709 | struct ipw_priv *priv = data; | ||
3710 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) | ||
3711 | return 0; | ||
2929 | ipw_send_disassociate(data, 0); | 3712 | ipw_send_disassociate(data, 0); |
3713 | return 1; | ||
2930 | } | 3714 | } |
2931 | 3715 | ||
2932 | static void notify_wx_assoc_event(struct ipw_priv *priv) | 3716 | static void ipw_bg_disassociate(void *data) |
2933 | { | 3717 | { |
2934 | union iwreq_data wrqu; | 3718 | struct ipw_priv *priv = data; |
2935 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 3719 | down(&priv->sem); |
2936 | if (priv->status & STATUS_ASSOCIATED) | 3720 | ipw_disassociate(data); |
2937 | memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); | 3721 | up(&priv->sem); |
2938 | else | 3722 | } |
2939 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | 3723 | |
2940 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | 3724 | static void ipw_system_config(void *data) |
3725 | { | ||
3726 | struct ipw_priv *priv = data; | ||
3727 | ipw_send_system_config(priv, &priv->sys_config); | ||
2941 | } | 3728 | } |
2942 | 3729 | ||
2943 | struct ipw_status_code { | 3730 | struct ipw_status_code { |
@@ -2997,7 +3784,7 @@ static const char *ipw_get_status_code(u16 status) | |||
2997 | { | 3784 | { |
2998 | int i; | 3785 | int i; |
2999 | for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) | 3786 | for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) |
3000 | if (ipw_status_codes[i].status == status) | 3787 | if (ipw_status_codes[i].status == (status & 0xff)) |
3001 | return ipw_status_codes[i].reason; | 3788 | return ipw_status_codes[i].reason; |
3002 | return "Unknown status value."; | 3789 | return "Unknown status value."; |
3003 | } | 3790 | } |
@@ -3076,18 +3863,30 @@ static inline u32 ipw_get_max_rate(struct ipw_priv *priv) | |||
3076 | while (i && !(mask & i)) | 3863 | while (i && !(mask & i)) |
3077 | i >>= 1; | 3864 | i >>= 1; |
3078 | switch (i) { | 3865 | switch (i) { |
3079 | case IEEE80211_CCK_RATE_1MB_MASK: return 1000000; | 3866 | case IEEE80211_CCK_RATE_1MB_MASK: |
3080 | case IEEE80211_CCK_RATE_2MB_MASK: return 2000000; | 3867 | return 1000000; |
3081 | case IEEE80211_CCK_RATE_5MB_MASK: return 5500000; | 3868 | case IEEE80211_CCK_RATE_2MB_MASK: |
3082 | case IEEE80211_OFDM_RATE_6MB_MASK: return 6000000; | 3869 | return 2000000; |
3083 | case IEEE80211_OFDM_RATE_9MB_MASK: return 9000000; | 3870 | case IEEE80211_CCK_RATE_5MB_MASK: |
3084 | case IEEE80211_CCK_RATE_11MB_MASK: return 11000000; | 3871 | return 5500000; |
3085 | case IEEE80211_OFDM_RATE_12MB_MASK: return 12000000; | 3872 | case IEEE80211_OFDM_RATE_6MB_MASK: |
3086 | case IEEE80211_OFDM_RATE_18MB_MASK: return 18000000; | 3873 | return 6000000; |
3087 | case IEEE80211_OFDM_RATE_24MB_MASK: return 24000000; | 3874 | case IEEE80211_OFDM_RATE_9MB_MASK: |
3088 | case IEEE80211_OFDM_RATE_36MB_MASK: return 36000000; | 3875 | return 9000000; |
3089 | case IEEE80211_OFDM_RATE_48MB_MASK: return 48000000; | 3876 | case IEEE80211_CCK_RATE_11MB_MASK: |
3090 | case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; | 3877 | return 11000000; |
3878 | case IEEE80211_OFDM_RATE_12MB_MASK: | ||
3879 | return 12000000; | ||
3880 | case IEEE80211_OFDM_RATE_18MB_MASK: | ||
3881 | return 18000000; | ||
3882 | case IEEE80211_OFDM_RATE_24MB_MASK: | ||
3883 | return 24000000; | ||
3884 | case IEEE80211_OFDM_RATE_36MB_MASK: | ||
3885 | return 36000000; | ||
3886 | case IEEE80211_OFDM_RATE_48MB_MASK: | ||
3887 | return 48000000; | ||
3888 | case IEEE80211_OFDM_RATE_54MB_MASK: | ||
3889 | return 54000000; | ||
3091 | } | 3890 | } |
3092 | 3891 | ||
3093 | if (priv->ieee->mode == IEEE_B) | 3892 | if (priv->ieee->mode == IEEE_B) |
@@ -3115,25 +3914,35 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv) | |||
3115 | return ipw_get_max_rate(priv); | 3914 | return ipw_get_max_rate(priv); |
3116 | 3915 | ||
3117 | switch (rate) { | 3916 | switch (rate) { |
3118 | case IPW_TX_RATE_1MB: return 1000000; | 3917 | case IPW_TX_RATE_1MB: |
3119 | case IPW_TX_RATE_2MB: return 2000000; | 3918 | return 1000000; |
3120 | case IPW_TX_RATE_5MB: return 5500000; | 3919 | case IPW_TX_RATE_2MB: |
3121 | case IPW_TX_RATE_6MB: return 6000000; | 3920 | return 2000000; |
3122 | case IPW_TX_RATE_9MB: return 9000000; | 3921 | case IPW_TX_RATE_5MB: |
3123 | case IPW_TX_RATE_11MB: return 11000000; | 3922 | return 5500000; |
3124 | case IPW_TX_RATE_12MB: return 12000000; | 3923 | case IPW_TX_RATE_6MB: |
3125 | case IPW_TX_RATE_18MB: return 18000000; | 3924 | return 6000000; |
3126 | case IPW_TX_RATE_24MB: return 24000000; | 3925 | case IPW_TX_RATE_9MB: |
3127 | case IPW_TX_RATE_36MB: return 36000000; | 3926 | return 9000000; |
3128 | case IPW_TX_RATE_48MB: return 48000000; | 3927 | case IPW_TX_RATE_11MB: |
3129 | case IPW_TX_RATE_54MB: return 54000000; | 3928 | return 11000000; |
3929 | case IPW_TX_RATE_12MB: | ||
3930 | return 12000000; | ||
3931 | case IPW_TX_RATE_18MB: | ||
3932 | return 18000000; | ||
3933 | case IPW_TX_RATE_24MB: | ||
3934 | return 24000000; | ||
3935 | case IPW_TX_RATE_36MB: | ||
3936 | return 36000000; | ||
3937 | case IPW_TX_RATE_48MB: | ||
3938 | return 48000000; | ||
3939 | case IPW_TX_RATE_54MB: | ||
3940 | return 54000000; | ||
3130 | } | 3941 | } |
3131 | 3942 | ||
3132 | return 0; | 3943 | return 0; |
3133 | } | 3944 | } |
3134 | 3945 | ||
3135 | #define PERFECT_RSSI (-50) | ||
3136 | #define WORST_RSSI (-85) | ||
3137 | #define IPW_STATS_INTERVAL (2 * HZ) | 3946 | #define IPW_STATS_INTERVAL (2 * HZ) |
3138 | static void ipw_gather_stats(struct ipw_priv *priv) | 3947 | static void ipw_gather_stats(struct ipw_priv *priv) |
3139 | { | 3948 | { |
@@ -3145,6 +3954,7 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3145 | s16 rssi; | 3954 | s16 rssi; |
3146 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, | 3955 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, |
3147 | rate_quality; | 3956 | rate_quality; |
3957 | u32 max_rate; | ||
3148 | 3958 | ||
3149 | if (!(priv->status & STATUS_ASSOCIATED)) { | 3959 | if (!(priv->status & STATUS_ASSOCIATED)) { |
3150 | priv->quality = 0; | 3960 | priv->quality = 0; |
@@ -3201,7 +4011,8 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3201 | beacon_quality, missed_beacons_percent); | 4011 | beacon_quality, missed_beacons_percent); |
3202 | 4012 | ||
3203 | priv->last_rate = ipw_get_current_rate(priv); | 4013 | priv->last_rate = ipw_get_current_rate(priv); |
3204 | rate_quality = priv->last_rate * 40 / priv->last_rate + 60; | 4014 | max_rate = ipw_get_max_rate(priv); |
4015 | rate_quality = priv->last_rate * 40 / max_rate + 60; | ||
3205 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", | 4016 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", |
3206 | rate_quality, priv->last_rate / 1000000); | 4017 | rate_quality, priv->last_rate / 1000000); |
3207 | 4018 | ||
@@ -3222,13 +4033,20 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3222 | tx_quality, tx_failures_delta, tx_packets_delta); | 4033 | tx_quality, tx_failures_delta, tx_packets_delta); |
3223 | 4034 | ||
3224 | rssi = average_value(&priv->average_rssi); | 4035 | rssi = average_value(&priv->average_rssi); |
3225 | if (rssi > PERFECT_RSSI) | 4036 | signal_quality = |
4037 | (100 * | ||
4038 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * | ||
4039 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) - | ||
4040 | (priv->ieee->perfect_rssi - rssi) * | ||
4041 | (15 * (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) + | ||
4042 | 62 * (priv->ieee->perfect_rssi - rssi))) / | ||
4043 | ((priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * | ||
4044 | (priv->ieee->perfect_rssi - priv->ieee->worst_rssi)); | ||
4045 | if (signal_quality > 100) | ||
3226 | signal_quality = 100; | 4046 | signal_quality = 100; |
3227 | else if (rssi < WORST_RSSI) | 4047 | else if (signal_quality < 1) |
3228 | signal_quality = 0; | 4048 | signal_quality = 0; |
3229 | else | 4049 | |
3230 | signal_quality = (rssi - WORST_RSSI) * 100 / | ||
3231 | (PERFECT_RSSI - WORST_RSSI); | ||
3232 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", | 4050 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", |
3233 | signal_quality, rssi); | 4051 | signal_quality, rssi); |
3234 | 4052 | ||
@@ -3257,6 +4075,85 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3257 | IPW_STATS_INTERVAL); | 4075 | IPW_STATS_INTERVAL); |
3258 | } | 4076 | } |
3259 | 4077 | ||
4078 | static void ipw_bg_gather_stats(void *data) | ||
4079 | { | ||
4080 | struct ipw_priv *priv = data; | ||
4081 | down(&priv->sem); | ||
4082 | ipw_gather_stats(data); | ||
4083 | up(&priv->sem); | ||
4084 | } | ||
4085 | |||
4086 | /* Missed beacon behavior: | ||
4087 | * 1st missed -> roaming_threshold, just wait, don't do any scan/roam. | ||
4088 | * roaming_threshold -> disassociate_threshold, scan and roam for better signal. | ||
4089 | * Above disassociate threshold, give up and stop scanning. | ||
4090 | * Roaming is disabled if disassociate_threshold <= roaming_threshold */ | ||
4091 | static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, | ||
4092 | int missed_count) | ||
4093 | { | ||
4094 | priv->notif_missed_beacons = missed_count; | ||
4095 | |||
4096 | if (missed_count > priv->disassociate_threshold && | ||
4097 | priv->status & STATUS_ASSOCIATED) { | ||
4098 | /* If associated and we've hit the missed | ||
4099 | * beacon threshold, disassociate, turn | ||
4100 | * off roaming, and abort any active scans */ | ||
4101 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
4102 | IPW_DL_STATE | IPW_DL_ASSOC, | ||
4103 | "Missed beacon: %d - disassociate\n", missed_count); | ||
4104 | priv->status &= ~STATUS_ROAMING; | ||
4105 | if (priv->status & STATUS_SCANNING) { | ||
4106 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
4107 | IPW_DL_STATE, | ||
4108 | "Aborting scan with missed beacon.\n"); | ||
4109 | queue_work(priv->workqueue, &priv->abort_scan); | ||
4110 | } | ||
4111 | |||
4112 | queue_work(priv->workqueue, &priv->disassociate); | ||
4113 | return; | ||
4114 | } | ||
4115 | |||
4116 | if (priv->status & STATUS_ROAMING) { | ||
4117 | /* If we are currently roaming, then just | ||
4118 | * print a debug statement... */ | ||
4119 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
4120 | "Missed beacon: %d - roam in progress\n", | ||
4121 | missed_count); | ||
4122 | return; | ||
4123 | } | ||
4124 | |||
4125 | if (missed_count > priv->roaming_threshold && | ||
4126 | missed_count <= priv->disassociate_threshold) { | ||
4127 | /* If we are not already roaming, set the ROAM | ||
4128 | * bit in the status and kick off a scan. | ||
4129 | * This can happen several times before we reach | ||
4130 | * disassociate_threshold. */ | ||
4131 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
4132 | "Missed beacon: %d - initiate " | ||
4133 | "roaming\n", missed_count); | ||
4134 | if (!(priv->status & STATUS_ROAMING)) { | ||
4135 | priv->status |= STATUS_ROAMING; | ||
4136 | if (!(priv->status & STATUS_SCANNING)) | ||
4137 | queue_work(priv->workqueue, | ||
4138 | &priv->request_scan); | ||
4139 | } | ||
4140 | return; | ||
4141 | } | ||
4142 | |||
4143 | if (priv->status & STATUS_SCANNING) { | ||
4144 | /* Stop scan to keep fw from getting | ||
4145 | * stuck (only if we aren't roaming -- | ||
4146 | * otherwise we'll never scan more than 2 or 3 | ||
4147 | * channels..) */ | ||
4148 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE, | ||
4149 | "Aborting scan with missed beacon.\n"); | ||
4150 | queue_work(priv->workqueue, &priv->abort_scan); | ||
4151 | } | ||
4152 | |||
4153 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); | ||
4154 | |||
4155 | } | ||
4156 | |||
3260 | /** | 4157 | /** |
3261 | * Handle host notification packet. | 4158 | * Handle host notification packet. |
3262 | * Called from interrupt routine | 4159 | * Called from interrupt routine |
@@ -3264,6 +4161,8 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3264 | static inline void ipw_rx_notification(struct ipw_priv *priv, | 4161 | static inline void ipw_rx_notification(struct ipw_priv *priv, |
3265 | struct ipw_rx_notification *notif) | 4162 | struct ipw_rx_notification *notif) |
3266 | { | 4163 | { |
4164 | notif->size = le16_to_cpu(notif->size); | ||
4165 | |||
3267 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); | 4166 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); |
3268 | 4167 | ||
3269 | switch (notif->subtype) { | 4168 | switch (notif->subtype) { |
@@ -3307,30 +4206,44 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3307 | 4206 | ||
3308 | priv->status &= ~STATUS_ASSOCIATING; | 4207 | priv->status &= ~STATUS_ASSOCIATING; |
3309 | priv->status |= STATUS_ASSOCIATED; | 4208 | priv->status |= STATUS_ASSOCIATED; |
3310 | 4209 | queue_work(priv->workqueue, | |
3311 | netif_carrier_on(priv->net_dev); | 4210 | &priv->system_config); |
3312 | if (netif_queue_stopped(priv->net_dev)) { | 4211 | |
3313 | IPW_DEBUG_NOTIF | 4212 | #ifdef CONFIG_IPW_QOS |
3314 | ("waking queue\n"); | 4213 | #define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ |
3315 | netif_wake_queue(priv->net_dev); | 4214 | le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_ctl)) |
3316 | } else { | 4215 | if ((priv->status & STATUS_AUTH) && |
3317 | IPW_DEBUG_NOTIF | 4216 | (IPW_GET_PACKET_STYPE(¬if->u.raw) |
3318 | ("starting queue\n"); | 4217 | == IEEE80211_STYPE_ASSOC_RESP)) { |
3319 | netif_start_queue(priv-> | 4218 | if ((sizeof |
3320 | net_dev); | 4219 | (struct |
4220 | ieee80211_assoc_response) | ||
4221 | <= notif->size) | ||
4222 | && (notif->size <= 2314)) { | ||
4223 | struct | ||
4224 | ieee80211_rx_stats | ||
4225 | stats = { | ||
4226 | .len = | ||
4227 | notif-> | ||
4228 | size - 1, | ||
4229 | }; | ||
4230 | |||
4231 | IPW_DEBUG_QOS | ||
4232 | ("QoS Associate " | ||
4233 | "size %d\n", | ||
4234 | notif->size); | ||
4235 | ieee80211_rx_mgt(priv-> | ||
4236 | ieee, | ||
4237 | (struct | ||
4238 | ieee80211_hdr_4addr | ||
4239 | *) | ||
4240 | ¬if->u.raw, &stats); | ||
4241 | } | ||
3321 | } | 4242 | } |
4243 | #endif | ||
3322 | 4244 | ||
3323 | ipw_reset_stats(priv); | 4245 | schedule_work(&priv->link_up); |
3324 | /* Ensure the rate is updated immediately */ | ||
3325 | priv->last_rate = | ||
3326 | ipw_get_current_rate(priv); | ||
3327 | schedule_work(&priv->gather_stats); | ||
3328 | notify_wx_assoc_event(priv); | ||
3329 | 4246 | ||
3330 | /* queue_delayed_work(priv->workqueue, | ||
3331 | &priv->request_scan, | ||
3332 | SCAN_ASSOCIATED_INTERVAL); | ||
3333 | */ | ||
3334 | break; | 4247 | break; |
3335 | } | 4248 | } |
3336 | 4249 | ||
@@ -3363,12 +4276,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3363 | STATUS_AUTH | | 4276 | STATUS_AUTH | |
3364 | STATUS_ASSOCIATED); | 4277 | STATUS_ASSOCIATED); |
3365 | 4278 | ||
3366 | netif_carrier_off(priv-> | 4279 | schedule_work(&priv->link_down); |
3367 | net_dev); | ||
3368 | netif_stop_queue(priv->net_dev); | ||
3369 | queue_work(priv->workqueue, | ||
3370 | &priv->request_scan); | ||
3371 | notify_wx_assoc_event(priv); | ||
3372 | break; | 4280 | break; |
3373 | } | 4281 | } |
3374 | 4282 | ||
@@ -3383,6 +4291,24 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3383 | } | 4291 | } |
3384 | 4292 | ||
3385 | case CMAS_INIT:{ | 4293 | case CMAS_INIT:{ |
4294 | if (priv->status & STATUS_AUTH) { | ||
4295 | struct | ||
4296 | ieee80211_assoc_response | ||
4297 | *resp; | ||
4298 | resp = | ||
4299 | (struct | ||
4300 | ieee80211_assoc_response | ||
4301 | *)¬if->u.raw; | ||
4302 | IPW_DEBUG(IPW_DL_NOTIF | | ||
4303 | IPW_DL_STATE | | ||
4304 | IPW_DL_ASSOC, | ||
4305 | "association failed (0x%04X): %s\n", | ||
4306 | ntohs(resp->status), | ||
4307 | ipw_get_status_code | ||
4308 | (ntohs | ||
4309 | (resp->status))); | ||
4310 | } | ||
4311 | |||
3386 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4312 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3387 | IPW_DL_ASSOC, | 4313 | IPW_DL_ASSOC, |
3388 | "disassociated: '%s' " MAC_FMT | 4314 | "disassociated: '%s' " MAC_FMT |
@@ -3395,35 +4321,21 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3395 | ~(STATUS_DISASSOCIATING | | 4321 | ~(STATUS_DISASSOCIATING | |
3396 | STATUS_ASSOCIATING | | 4322 | STATUS_ASSOCIATING | |
3397 | STATUS_ASSOCIATED | STATUS_AUTH); | 4323 | STATUS_ASSOCIATED | STATUS_AUTH); |
4324 | if (priv->assoc_network | ||
4325 | && (priv->assoc_network-> | ||
4326 | capability & | ||
4327 | WLAN_CAPABILITY_IBSS)) | ||
4328 | ipw_remove_current_network | ||
4329 | (priv); | ||
3398 | 4330 | ||
3399 | netif_stop_queue(priv->net_dev); | 4331 | schedule_work(&priv->link_down); |
3400 | if (!(priv->status & STATUS_ROAMING)) { | ||
3401 | netif_carrier_off(priv-> | ||
3402 | net_dev); | ||
3403 | notify_wx_assoc_event(priv); | ||
3404 | |||
3405 | /* Cancel any queued work ... */ | ||
3406 | cancel_delayed_work(&priv-> | ||
3407 | request_scan); | ||
3408 | cancel_delayed_work(&priv-> | ||
3409 | adhoc_check); | ||
3410 | |||
3411 | /* Queue up another scan... */ | ||
3412 | queue_work(priv->workqueue, | ||
3413 | &priv->request_scan); | ||
3414 | |||
3415 | cancel_delayed_work(&priv-> | ||
3416 | gather_stats); | ||
3417 | } else { | ||
3418 | priv->status |= STATUS_ROAMING; | ||
3419 | queue_work(priv->workqueue, | ||
3420 | &priv->request_scan); | ||
3421 | } | ||
3422 | 4332 | ||
3423 | ipw_reset_stats(priv); | ||
3424 | break; | 4333 | break; |
3425 | } | 4334 | } |
3426 | 4335 | ||
4336 | case CMAS_RX_ASSOC_RESP: | ||
4337 | break; | ||
4338 | |||
3427 | default: | 4339 | default: |
3428 | IPW_ERROR("assoc: unknown (%d)\n", | 4340 | IPW_ERROR("assoc: unknown (%d)\n", |
3429 | assoc->state); | 4341 | assoc->state); |
@@ -3466,11 +4378,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3466 | STATUS_AUTH | | 4378 | STATUS_AUTH | |
3467 | STATUS_ASSOCIATED); | 4379 | STATUS_ASSOCIATED); |
3468 | 4380 | ||
3469 | netif_carrier_off(priv->net_dev); | 4381 | schedule_work(&priv->link_down); |
3470 | netif_stop_queue(priv->net_dev); | ||
3471 | queue_work(priv->workqueue, | ||
3472 | &priv->request_scan); | ||
3473 | notify_wx_assoc_event(priv); | ||
3474 | break; | 4382 | break; |
3475 | 4383 | ||
3476 | case CMAS_TX_AUTH_SEQ_1: | 4384 | case CMAS_TX_AUTH_SEQ_1: |
@@ -3512,6 +4420,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3512 | case CMAS_RX_ASSOC_RESP: | 4420 | case CMAS_RX_ASSOC_RESP: |
3513 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4421 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3514 | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); | 4422 | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); |
4423 | |||
3515 | break; | 4424 | break; |
3516 | case CMAS_ASSOCIATED: | 4425 | case CMAS_ASSOCIATED: |
3517 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | 4426 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
@@ -3556,43 +4465,67 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3556 | priv->status &= | 4465 | priv->status &= |
3557 | ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); | 4466 | ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); |
3558 | 4467 | ||
4468 | wake_up_interruptible(&priv->wait_state); | ||
3559 | cancel_delayed_work(&priv->scan_check); | 4469 | cancel_delayed_work(&priv->scan_check); |
3560 | 4470 | ||
4471 | if (priv->status & STATUS_EXIT_PENDING) | ||
4472 | break; | ||
4473 | |||
4474 | priv->ieee->scans++; | ||
4475 | |||
4476 | #ifdef CONFIG_IPW2200_MONITOR | ||
4477 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
4478 | priv->status |= STATUS_SCAN_FORCED; | ||
4479 | queue_work(priv->workqueue, | ||
4480 | &priv->request_scan); | ||
4481 | break; | ||
4482 | } | ||
4483 | priv->status &= ~STATUS_SCAN_FORCED; | ||
4484 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
4485 | |||
3561 | if (!(priv->status & (STATUS_ASSOCIATED | | 4486 | if (!(priv->status & (STATUS_ASSOCIATED | |
3562 | STATUS_ASSOCIATING | | 4487 | STATUS_ASSOCIATING | |
3563 | STATUS_ROAMING | | 4488 | STATUS_ROAMING | |
3564 | STATUS_DISASSOCIATING))) | 4489 | STATUS_DISASSOCIATING))) |
3565 | queue_work(priv->workqueue, &priv->associate); | 4490 | queue_work(priv->workqueue, &priv->associate); |
3566 | else if (priv->status & STATUS_ROAMING) { | 4491 | else if (priv->status & STATUS_ROAMING) { |
3567 | /* If a scan completed and we are in roam mode, then | 4492 | if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) |
3568 | * the scan that completed was the one requested as a | 4493 | /* If a scan completed and we are in roam mode, then |
3569 | * result of entering roam... so, schedule the | 4494 | * the scan that completed was the one requested as a |
3570 | * roam work */ | 4495 | * result of entering roam... so, schedule the |
3571 | queue_work(priv->workqueue, &priv->roam); | 4496 | * roam work */ |
4497 | queue_work(priv->workqueue, | ||
4498 | &priv->roam); | ||
4499 | else | ||
4500 | /* Don't schedule if we aborted the scan */ | ||
4501 | priv->status &= ~STATUS_ROAMING; | ||
3572 | } else if (priv->status & STATUS_SCAN_PENDING) | 4502 | } else if (priv->status & STATUS_SCAN_PENDING) |
3573 | queue_work(priv->workqueue, | 4503 | queue_work(priv->workqueue, |
3574 | &priv->request_scan); | 4504 | &priv->request_scan); |
3575 | 4505 | else if (priv->config & CFG_BACKGROUND_SCAN | |
3576 | priv->ieee->scans++; | 4506 | && priv->status & STATUS_ASSOCIATED) |
4507 | queue_delayed_work(priv->workqueue, | ||
4508 | &priv->request_scan, HZ); | ||
3577 | break; | 4509 | break; |
3578 | } | 4510 | } |
3579 | 4511 | ||
3580 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ | 4512 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ |
3581 | struct notif_frag_length *x = ¬if->u.frag_len; | 4513 | struct notif_frag_length *x = ¬if->u.frag_len; |
3582 | 4514 | ||
3583 | if (notif->size == sizeof(*x)) { | 4515 | if (notif->size == sizeof(*x)) |
3584 | IPW_ERROR("Frag length: %d\n", x->frag_length); | 4516 | IPW_ERROR("Frag length: %d\n", |
3585 | } else { | 4517 | le16_to_cpu(x->frag_length)); |
4518 | else | ||
3586 | IPW_ERROR("Frag length of wrong size %d " | 4519 | IPW_ERROR("Frag length of wrong size %d " |
3587 | "(should be %zd)\n", | 4520 | "(should be %zd)\n", |
3588 | notif->size, sizeof(*x)); | 4521 | notif->size, sizeof(*x)); |
3589 | } | ||
3590 | break; | 4522 | break; |
3591 | } | 4523 | } |
3592 | 4524 | ||
3593 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ | 4525 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ |
3594 | struct notif_link_deterioration *x = | 4526 | struct notif_link_deterioration *x = |
3595 | ¬if->u.link_deterioration; | 4527 | ¬if->u.link_deterioration; |
4528 | |||
3596 | if (notif->size == sizeof(*x)) { | 4529 | if (notif->size == sizeof(*x)) { |
3597 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | 4530 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, |
3598 | "link deterioration: '%s' " MAC_FMT | 4531 | "link deterioration: '%s' " MAC_FMT |
@@ -3612,11 +4545,9 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3612 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ | 4545 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ |
3613 | IPW_ERROR("Dino config\n"); | 4546 | IPW_ERROR("Dino config\n"); |
3614 | if (priv->hcmd | 4547 | if (priv->hcmd |
3615 | && priv->hcmd->cmd == HOST_CMD_DINO_CONFIG) { | 4548 | && priv->hcmd->cmd != HOST_CMD_DINO_CONFIG) |
3616 | /* TODO: Do anything special? */ | ||
3617 | } else { | ||
3618 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); | 4549 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); |
3619 | } | 4550 | |
3620 | break; | 4551 | break; |
3621 | } | 4552 | } |
3622 | 4553 | ||
@@ -3629,36 +4560,11 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3629 | break; | 4560 | break; |
3630 | } | 4561 | } |
3631 | 4562 | ||
3632 | if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) { | 4563 | if (le32_to_cpu(x->state) == |
3633 | if (priv->status & STATUS_SCANNING) { | 4564 | HOST_NOTIFICATION_STATUS_BEACON_MISSING) |
3634 | /* Stop scan to keep fw from getting | 4565 | ipw_handle_missed_beacon(priv, |
3635 | * stuck... */ | 4566 | le32_to_cpu(x-> |
3636 | queue_work(priv->workqueue, | 4567 | number)); |
3637 | &priv->abort_scan); | ||
3638 | } | ||
3639 | |||
3640 | if (x->number > priv->missed_beacon_threshold && | ||
3641 | priv->status & STATUS_ASSOCIATED) { | ||
3642 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
3643 | IPW_DL_STATE, | ||
3644 | "Missed beacon: %d - disassociate\n", | ||
3645 | x->number); | ||
3646 | queue_work(priv->workqueue, | ||
3647 | &priv->disassociate); | ||
3648 | } else if (x->number > priv->roaming_threshold) { | ||
3649 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
3650 | "Missed beacon: %d - initiate " | ||
3651 | "roaming\n", x->number); | ||
3652 | queue_work(priv->workqueue, | ||
3653 | &priv->roam); | ||
3654 | } else { | ||
3655 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", | ||
3656 | x->number); | ||
3657 | } | ||
3658 | |||
3659 | priv->notif_missed_beacons = x->number; | ||
3660 | |||
3661 | } | ||
3662 | 4568 | ||
3663 | break; | 4569 | break; |
3664 | } | 4570 | } |
@@ -3697,7 +4603,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, | |||
3697 | case HOST_NOTIFICATION_NOISE_STATS:{ | 4603 | case HOST_NOTIFICATION_NOISE_STATS:{ |
3698 | if (notif->size == sizeof(u32)) { | 4604 | if (notif->size == sizeof(u32)) { |
3699 | priv->last_noise = | 4605 | priv->last_noise = |
3700 | (u8) (notif->u.noise.value & 0xff); | 4606 | (u8) (le32_to_cpu(notif->u.noise.value) & |
4607 | 0xff); | ||
3701 | average_add(&priv->average_noise, | 4608 | average_add(&priv->average_noise, |
3702 | priv->last_noise); | 4609 | priv->last_noise); |
3703 | break; | 4610 | break; |
@@ -3730,43 +4637,43 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3730 | ipw_tx_queue_free(priv); | 4637 | ipw_tx_queue_free(priv); |
3731 | /* Tx CMD queue */ | 4638 | /* Tx CMD queue */ |
3732 | rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, | 4639 | rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, |
3733 | CX2_TX_CMD_QUEUE_READ_INDEX, | 4640 | IPW_TX_CMD_QUEUE_READ_INDEX, |
3734 | CX2_TX_CMD_QUEUE_WRITE_INDEX, | 4641 | IPW_TX_CMD_QUEUE_WRITE_INDEX, |
3735 | CX2_TX_CMD_QUEUE_BD_BASE, | 4642 | IPW_TX_CMD_QUEUE_BD_BASE, |
3736 | CX2_TX_CMD_QUEUE_BD_SIZE); | 4643 | IPW_TX_CMD_QUEUE_BD_SIZE); |
3737 | if (rc) { | 4644 | if (rc) { |
3738 | IPW_ERROR("Tx Cmd queue init failed\n"); | 4645 | IPW_ERROR("Tx Cmd queue init failed\n"); |
3739 | goto error; | 4646 | goto error; |
3740 | } | 4647 | } |
3741 | /* Tx queue(s) */ | 4648 | /* Tx queue(s) */ |
3742 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, | 4649 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, |
3743 | CX2_TX_QUEUE_0_READ_INDEX, | 4650 | IPW_TX_QUEUE_0_READ_INDEX, |
3744 | CX2_TX_QUEUE_0_WRITE_INDEX, | 4651 | IPW_TX_QUEUE_0_WRITE_INDEX, |
3745 | CX2_TX_QUEUE_0_BD_BASE, CX2_TX_QUEUE_0_BD_SIZE); | 4652 | IPW_TX_QUEUE_0_BD_BASE, IPW_TX_QUEUE_0_BD_SIZE); |
3746 | if (rc) { | 4653 | if (rc) { |
3747 | IPW_ERROR("Tx 0 queue init failed\n"); | 4654 | IPW_ERROR("Tx 0 queue init failed\n"); |
3748 | goto error; | 4655 | goto error; |
3749 | } | 4656 | } |
3750 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, | 4657 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, |
3751 | CX2_TX_QUEUE_1_READ_INDEX, | 4658 | IPW_TX_QUEUE_1_READ_INDEX, |
3752 | CX2_TX_QUEUE_1_WRITE_INDEX, | 4659 | IPW_TX_QUEUE_1_WRITE_INDEX, |
3753 | CX2_TX_QUEUE_1_BD_BASE, CX2_TX_QUEUE_1_BD_SIZE); | 4660 | IPW_TX_QUEUE_1_BD_BASE, IPW_TX_QUEUE_1_BD_SIZE); |
3754 | if (rc) { | 4661 | if (rc) { |
3755 | IPW_ERROR("Tx 1 queue init failed\n"); | 4662 | IPW_ERROR("Tx 1 queue init failed\n"); |
3756 | goto error; | 4663 | goto error; |
3757 | } | 4664 | } |
3758 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, | 4665 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, |
3759 | CX2_TX_QUEUE_2_READ_INDEX, | 4666 | IPW_TX_QUEUE_2_READ_INDEX, |
3760 | CX2_TX_QUEUE_2_WRITE_INDEX, | 4667 | IPW_TX_QUEUE_2_WRITE_INDEX, |
3761 | CX2_TX_QUEUE_2_BD_BASE, CX2_TX_QUEUE_2_BD_SIZE); | 4668 | IPW_TX_QUEUE_2_BD_BASE, IPW_TX_QUEUE_2_BD_SIZE); |
3762 | if (rc) { | 4669 | if (rc) { |
3763 | IPW_ERROR("Tx 2 queue init failed\n"); | 4670 | IPW_ERROR("Tx 2 queue init failed\n"); |
3764 | goto error; | 4671 | goto error; |
3765 | } | 4672 | } |
3766 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, | 4673 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, |
3767 | CX2_TX_QUEUE_3_READ_INDEX, | 4674 | IPW_TX_QUEUE_3_READ_INDEX, |
3768 | CX2_TX_QUEUE_3_WRITE_INDEX, | 4675 | IPW_TX_QUEUE_3_WRITE_INDEX, |
3769 | CX2_TX_QUEUE_3_BD_BASE, CX2_TX_QUEUE_3_BD_SIZE); | 4676 | IPW_TX_QUEUE_3_BD_BASE, IPW_TX_QUEUE_3_BD_SIZE); |
3770 | if (rc) { | 4677 | if (rc) { |
3771 | IPW_ERROR("Tx 3 queue init failed\n"); | 4678 | IPW_ERROR("Tx 3 queue init failed\n"); |
3772 | goto error; | 4679 | goto error; |
@@ -3814,9 +4721,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | |||
3814 | priv->tx_packets++; | 4721 | priv->tx_packets++; |
3815 | } | 4722 | } |
3816 | done: | 4723 | done: |
3817 | if (ipw_queue_space(q) > q->low_mark && qindex >= 0) { | 4724 | if ((ipw_queue_space(q) > q->low_mark) && |
3818 | __maybe_wake_tx(priv); | 4725 | (qindex >= 0) && |
3819 | } | 4726 | (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) |
4727 | netif_wake_queue(priv->net_dev); | ||
3820 | used = q->first_empty - q->last_used; | 4728 | used = q->first_empty - q->last_used; |
3821 | if (used < 0) | 4729 | if (used < 0) |
3822 | used += q->n_bd; | 4730 | used += q->n_bd; |
@@ -3857,7 +4765,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, | |||
3857 | * Rx theory of operation | 4765 | * Rx theory of operation |
3858 | * | 4766 | * |
3859 | * The host allocates 32 DMA target addresses and passes the host address | 4767 | * The host allocates 32 DMA target addresses and passes the host address |
3860 | * to the firmware at register CX2_RFDS_TABLE_LOWER + N * RFD_SIZE where N is | 4768 | * to the firmware at register IPW_RFDS_TABLE_LOWER + N * RFD_SIZE where N is |
3861 | * 0 to 31 | 4769 | * 0 to 31 |
3862 | * | 4770 | * |
3863 | * Rx Queue Indexes | 4771 | * Rx Queue Indexes |
@@ -3941,7 +4849,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) | |||
3941 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); | 4849 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); |
3942 | list_del(element); | 4850 | list_del(element); |
3943 | 4851 | ||
3944 | ipw_write32(priv, CX2_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, | 4852 | ipw_write32(priv, IPW_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, |
3945 | rxb->dma_addr); | 4853 | rxb->dma_addr); |
3946 | rxq->queue[rxq->write] = rxb; | 4854 | rxq->queue[rxq->write] = rxb; |
3947 | rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; | 4855 | rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; |
@@ -3956,7 +4864,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) | |||
3956 | 4864 | ||
3957 | /* If we've added more space for the firmware to place data, tell it */ | 4865 | /* If we've added more space for the firmware to place data, tell it */ |
3958 | if (write != rxq->write) | 4866 | if (write != rxq->write) |
3959 | ipw_write32(priv, CX2_RX_WRITE_INDEX, rxq->write); | 4867 | ipw_write32(priv, IPW_RX_WRITE_INDEX, rxq->write); |
3960 | } | 4868 | } |
3961 | 4869 | ||
3962 | /* | 4870 | /* |
@@ -3977,7 +4885,7 @@ static void ipw_rx_queue_replenish(void *data) | |||
3977 | while (!list_empty(&rxq->rx_used)) { | 4885 | while (!list_empty(&rxq->rx_used)) { |
3978 | element = rxq->rx_used.next; | 4886 | element = rxq->rx_used.next; |
3979 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); | 4887 | rxb = list_entry(element, struct ipw_rx_mem_buffer, list); |
3980 | rxb->skb = alloc_skb(CX2_RX_BUF_SIZE, GFP_ATOMIC); | 4888 | rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_ATOMIC); |
3981 | if (!rxb->skb) { | 4889 | if (!rxb->skb) { |
3982 | printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", | 4890 | printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", |
3983 | priv->net_dev->name); | 4891 | priv->net_dev->name); |
@@ -3991,7 +4899,7 @@ static void ipw_rx_queue_replenish(void *data) | |||
3991 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; | 4899 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; |
3992 | rxb->dma_addr = | 4900 | rxb->dma_addr = |
3993 | pci_map_single(priv->pci_dev, rxb->skb->data, | 4901 | pci_map_single(priv->pci_dev, rxb->skb->data, |
3994 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 4902 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
3995 | 4903 | ||
3996 | list_add_tail(&rxb->list, &rxq->rx_free); | 4904 | list_add_tail(&rxb->list, &rxq->rx_free); |
3997 | rxq->free_count++; | 4905 | rxq->free_count++; |
@@ -4001,6 +4909,14 @@ static void ipw_rx_queue_replenish(void *data) | |||
4001 | ipw_rx_queue_restock(priv); | 4909 | ipw_rx_queue_restock(priv); |
4002 | } | 4910 | } |
4003 | 4911 | ||
4912 | static void ipw_bg_rx_queue_replenish(void *data) | ||
4913 | { | ||
4914 | struct ipw_priv *priv = data; | ||
4915 | down(&priv->sem); | ||
4916 | ipw_rx_queue_replenish(data); | ||
4917 | up(&priv->sem); | ||
4918 | } | ||
4919 | |||
4004 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 4920 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. |
4005 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL | 4921 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL |
4006 | * This free routine walks the list of POOL entries and if SKB is set to | 4922 | * This free routine walks the list of POOL entries and if SKB is set to |
@@ -4016,7 +4932,7 @@ static void ipw_rx_queue_free(struct ipw_priv *priv, struct ipw_rx_queue *rxq) | |||
4016 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 4932 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
4017 | if (rxq->pool[i].skb != NULL) { | 4933 | if (rxq->pool[i].skb != NULL) { |
4018 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 4934 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
4019 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 4935 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
4020 | dev_kfree_skb(rxq->pool[i].skb); | 4936 | dev_kfree_skb(rxq->pool[i].skb); |
4021 | } | 4937 | } |
4022 | } | 4938 | } |
@@ -4135,8 +5051,18 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4135 | num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); | 5051 | num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); |
4136 | rates->num_rates = 0; | 5052 | rates->num_rates = 0; |
4137 | for (i = 0; i < num_rates; i++) { | 5053 | for (i = 0; i < num_rates; i++) { |
4138 | if (!ipw_is_rate_in_mask | 5054 | if (!ipw_is_rate_in_mask(priv, network->mode, |
4139 | (priv, network->mode, network->rates[i])) { | 5055 | network->rates[i])) { |
5056 | |||
5057 | if (network->rates[i] & IEEE80211_BASIC_RATE_MASK) { | ||
5058 | IPW_DEBUG_SCAN("Adding masked mandatory " | ||
5059 | "rate %02X\n", | ||
5060 | network->rates[i]); | ||
5061 | rates->supported_rates[rates->num_rates++] = | ||
5062 | network->rates[i]; | ||
5063 | continue; | ||
5064 | } | ||
5065 | |||
4140 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 5066 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4141 | network->rates[i], priv->rates_mask); | 5067 | network->rates[i], priv->rates_mask); |
4142 | continue; | 5068 | continue; |
@@ -4145,11 +5071,20 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4145 | rates->supported_rates[rates->num_rates++] = network->rates[i]; | 5071 | rates->supported_rates[rates->num_rates++] = network->rates[i]; |
4146 | } | 5072 | } |
4147 | 5073 | ||
4148 | num_rates = | 5074 | num_rates = min(network->rates_ex_len, |
4149 | min(network->rates_ex_len, (u8) (IPW_MAX_RATES - num_rates)); | 5075 | (u8) (IPW_MAX_RATES - num_rates)); |
4150 | for (i = 0; i < num_rates; i++) { | 5076 | for (i = 0; i < num_rates; i++) { |
4151 | if (!ipw_is_rate_in_mask | 5077 | if (!ipw_is_rate_in_mask(priv, network->mode, |
4152 | (priv, network->mode, network->rates_ex[i])) { | 5078 | network->rates_ex[i])) { |
5079 | if (network->rates_ex[i] & IEEE80211_BASIC_RATE_MASK) { | ||
5080 | IPW_DEBUG_SCAN("Adding masked mandatory " | ||
5081 | "rate %02X\n", | ||
5082 | network->rates_ex[i]); | ||
5083 | rates->supported_rates[rates->num_rates++] = | ||
5084 | network->rates[i]; | ||
5085 | continue; | ||
5086 | } | ||
5087 | |||
4153 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 5088 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4154 | network->rates_ex[i], priv->rates_mask); | 5089 | network->rates_ex[i], priv->rates_mask); |
4155 | continue; | 5090 | continue; |
@@ -4159,7 +5094,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4159 | network->rates_ex[i]; | 5094 | network->rates_ex[i]; |
4160 | } | 5095 | } |
4161 | 5096 | ||
4162 | return rates->num_rates; | 5097 | return 1; |
4163 | } | 5098 | } |
4164 | 5099 | ||
4165 | static inline void ipw_copy_rates(struct ipw_supported_rates *dest, | 5100 | static inline void ipw_copy_rates(struct ipw_supported_rates *dest, |
@@ -4241,6 +5176,216 @@ struct ipw_network_match { | |||
4241 | struct ipw_supported_rates rates; | 5176 | struct ipw_supported_rates rates; |
4242 | }; | 5177 | }; |
4243 | 5178 | ||
5179 | static int ipw_find_adhoc_network(struct ipw_priv *priv, | ||
5180 | struct ipw_network_match *match, | ||
5181 | struct ieee80211_network *network, | ||
5182 | int roaming) | ||
5183 | { | ||
5184 | struct ipw_supported_rates rates; | ||
5185 | |||
5186 | /* Verify that this network's capability is compatible with the | ||
5187 | * current mode (AdHoc or Infrastructure) */ | ||
5188 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
5189 | !(network->capability & WLAN_CAPABILITY_IBSS))) { | ||
5190 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded due to " | ||
5191 | "capability mismatch.\n", | ||
5192 | escape_essid(network->ssid, network->ssid_len), | ||
5193 | MAC_ARG(network->bssid)); | ||
5194 | return 0; | ||
5195 | } | ||
5196 | |||
5197 | /* If we do not have an ESSID for this AP, we can not associate with | ||
5198 | * it */ | ||
5199 | if (network->flags & NETWORK_EMPTY_ESSID) { | ||
5200 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5201 | "because of hidden ESSID.\n", | ||
5202 | escape_essid(network->ssid, network->ssid_len), | ||
5203 | MAC_ARG(network->bssid)); | ||
5204 | return 0; | ||
5205 | } | ||
5206 | |||
5207 | if (unlikely(roaming)) { | ||
5208 | /* If we are roaming, then ensure check if this is a valid | ||
5209 | * network to try and roam to */ | ||
5210 | if ((network->ssid_len != match->network->ssid_len) || | ||
5211 | memcmp(network->ssid, match->network->ssid, | ||
5212 | network->ssid_len)) { | ||
5213 | IPW_DEBUG_MERGE("Netowrk '%s (" MAC_FMT ")' excluded " | ||
5214 | "because of non-network ESSID.\n", | ||
5215 | escape_essid(network->ssid, | ||
5216 | network->ssid_len), | ||
5217 | MAC_ARG(network->bssid)); | ||
5218 | return 0; | ||
5219 | } | ||
5220 | } else { | ||
5221 | /* If an ESSID has been configured then compare the broadcast | ||
5222 | * ESSID to ours */ | ||
5223 | if ((priv->config & CFG_STATIC_ESSID) && | ||
5224 | ((network->ssid_len != priv->essid_len) || | ||
5225 | memcmp(network->ssid, priv->essid, | ||
5226 | min(network->ssid_len, priv->essid_len)))) { | ||
5227 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
5228 | |||
5229 | strncpy(escaped, | ||
5230 | escape_essid(network->ssid, network->ssid_len), | ||
5231 | sizeof(escaped)); | ||
5232 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5233 | "because of ESSID mismatch: '%s'.\n", | ||
5234 | escaped, MAC_ARG(network->bssid), | ||
5235 | escape_essid(priv->essid, | ||
5236 | priv->essid_len)); | ||
5237 | return 0; | ||
5238 | } | ||
5239 | } | ||
5240 | |||
5241 | /* If the old network rate is better than this one, don't bother | ||
5242 | * testing everything else. */ | ||
5243 | |||
5244 | if (network->time_stamp[0] < match->network->time_stamp[0]) { | ||
5245 | IPW_DEBUG_MERGE("Network '%s excluded because newer than " | ||
5246 | "current network.\n", | ||
5247 | escape_essid(match->network->ssid, | ||
5248 | match->network->ssid_len)); | ||
5249 | return 0; | ||
5250 | } else if (network->time_stamp[1] < match->network->time_stamp[1]) { | ||
5251 | IPW_DEBUG_MERGE("Network '%s excluded because newer than " | ||
5252 | "current network.\n", | ||
5253 | escape_essid(match->network->ssid, | ||
5254 | match->network->ssid_len)); | ||
5255 | return 0; | ||
5256 | } | ||
5257 | |||
5258 | /* Now go through and see if the requested network is valid... */ | ||
5259 | if (priv->ieee->scan_age != 0 && | ||
5260 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | ||
5261 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5262 | "because of age: %lums.\n", | ||
5263 | escape_essid(network->ssid, network->ssid_len), | ||
5264 | MAC_ARG(network->bssid), | ||
5265 | 1000 * (jiffies - network->last_scanned) / HZ); | ||
5266 | return 0; | ||
5267 | } | ||
5268 | |||
5269 | if ((priv->config & CFG_STATIC_CHANNEL) && | ||
5270 | (network->channel != priv->channel)) { | ||
5271 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5272 | "because of channel mismatch: %d != %d.\n", | ||
5273 | escape_essid(network->ssid, network->ssid_len), | ||
5274 | MAC_ARG(network->bssid), | ||
5275 | network->channel, priv->channel); | ||
5276 | return 0; | ||
5277 | } | ||
5278 | |||
5279 | /* Verify privacy compatability */ | ||
5280 | if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != | ||
5281 | ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { | ||
5282 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5283 | "because of privacy mismatch: %s != %s.\n", | ||
5284 | escape_essid(network->ssid, network->ssid_len), | ||
5285 | MAC_ARG(network->bssid), | ||
5286 | priv-> | ||
5287 | capability & CAP_PRIVACY_ON ? "on" : "off", | ||
5288 | network-> | ||
5289 | capability & WLAN_CAPABILITY_PRIVACY ? "on" : | ||
5290 | "off"); | ||
5291 | return 0; | ||
5292 | } | ||
5293 | |||
5294 | if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | ||
5295 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5296 | "because of the same BSSID match: " MAC_FMT | ||
5297 | ".\n", escape_essid(network->ssid, | ||
5298 | network->ssid_len), | ||
5299 | MAC_ARG(network->bssid), MAC_ARG(priv->bssid)); | ||
5300 | return 0; | ||
5301 | } | ||
5302 | |||
5303 | /* Filter out any incompatible freq / mode combinations */ | ||
5304 | if (!ieee80211_is_valid_mode(priv->ieee, network->mode)) { | ||
5305 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5306 | "because of invalid frequency/mode " | ||
5307 | "combination.\n", | ||
5308 | escape_essid(network->ssid, network->ssid_len), | ||
5309 | MAC_ARG(network->bssid)); | ||
5310 | return 0; | ||
5311 | } | ||
5312 | |||
5313 | /* Ensure that the rates supported by the driver are compatible with | ||
5314 | * this AP, including verification of basic rates (mandatory) */ | ||
5315 | if (!ipw_compatible_rates(priv, network, &rates)) { | ||
5316 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5317 | "because configured rate mask excludes " | ||
5318 | "AP mandatory rate.\n", | ||
5319 | escape_essid(network->ssid, network->ssid_len), | ||
5320 | MAC_ARG(network->bssid)); | ||
5321 | return 0; | ||
5322 | } | ||
5323 | |||
5324 | if (rates.num_rates == 0) { | ||
5325 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | ||
5326 | "because of no compatible rates.\n", | ||
5327 | escape_essid(network->ssid, network->ssid_len), | ||
5328 | MAC_ARG(network->bssid)); | ||
5329 | return 0; | ||
5330 | } | ||
5331 | |||
5332 | /* TODO: Perform any further minimal comparititive tests. We do not | ||
5333 | * want to put too much policy logic here; intelligent scan selection | ||
5334 | * should occur within a generic IEEE 802.11 user space tool. */ | ||
5335 | |||
5336 | /* Set up 'new' AP to this network */ | ||
5337 | ipw_copy_rates(&match->rates, &rates); | ||
5338 | match->network = network; | ||
5339 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' is a viable match.\n", | ||
5340 | escape_essid(network->ssid, network->ssid_len), | ||
5341 | MAC_ARG(network->bssid)); | ||
5342 | |||
5343 | return 1; | ||
5344 | } | ||
5345 | |||
5346 | static void ipw_merge_adhoc_network(void *data) | ||
5347 | { | ||
5348 | struct ipw_priv *priv = data; | ||
5349 | struct ieee80211_network *network = NULL; | ||
5350 | struct ipw_network_match match = { | ||
5351 | .network = priv->assoc_network | ||
5352 | }; | ||
5353 | |||
5354 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5355 | (priv->ieee->iw_mode == IW_MODE_ADHOC)) { | ||
5356 | /* First pass through ROAM process -- look for a better | ||
5357 | * network */ | ||
5358 | unsigned long flags; | ||
5359 | |||
5360 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
5361 | list_for_each_entry(network, &priv->ieee->network_list, list) { | ||
5362 | if (network != priv->assoc_network) | ||
5363 | ipw_find_adhoc_network(priv, &match, network, | ||
5364 | 1); | ||
5365 | } | ||
5366 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
5367 | |||
5368 | if (match.network == priv->assoc_network) { | ||
5369 | IPW_DEBUG_MERGE("No better ADHOC in this network to " | ||
5370 | "merge to.\n"); | ||
5371 | return; | ||
5372 | } | ||
5373 | |||
5374 | down(&priv->sem); | ||
5375 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { | ||
5376 | IPW_DEBUG_MERGE("remove network %s\n", | ||
5377 | escape_essid(priv->essid, | ||
5378 | priv->essid_len)); | ||
5379 | ipw_remove_current_network(priv); | ||
5380 | } | ||
5381 | |||
5382 | ipw_disassociate(priv); | ||
5383 | priv->assoc_network = match.network; | ||
5384 | up(&priv->sem); | ||
5385 | return; | ||
5386 | } | ||
5387 | } | ||
5388 | |||
4244 | static int ipw_best_network(struct ipw_priv *priv, | 5389 | static int ipw_best_network(struct ipw_priv *priv, |
4245 | struct ipw_network_match *match, | 5390 | struct ipw_network_match *match, |
4246 | struct ieee80211_network *network, int roaming) | 5391 | struct ieee80211_network *network, int roaming) |
@@ -4322,9 +5467,9 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4322 | /* If this network has already had an association attempt within the | 5467 | /* If this network has already had an association attempt within the |
4323 | * last 3 seconds, do not try and associate again... */ | 5468 | * last 3 seconds, do not try and associate again... */ |
4324 | if (network->last_associate && | 5469 | if (network->last_associate && |
4325 | time_after(network->last_associate + (HZ * 5UL), jiffies)) { | 5470 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { |
4326 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5471 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4327 | "because of storming (%lu since last " | 5472 | "because of storming (%lus since last " |
4328 | "assoc attempt).\n", | 5473 | "assoc attempt).\n", |
4329 | escape_essid(network->ssid, network->ssid_len), | 5474 | escape_essid(network->ssid, network->ssid_len), |
4330 | MAC_ARG(network->bssid), | 5475 | MAC_ARG(network->bssid), |
@@ -4334,12 +5479,12 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4334 | 5479 | ||
4335 | /* Now go through and see if the requested network is valid... */ | 5480 | /* Now go through and see if the requested network is valid... */ |
4336 | if (priv->ieee->scan_age != 0 && | 5481 | if (priv->ieee->scan_age != 0 && |
4337 | jiffies - network->last_scanned > priv->ieee->scan_age) { | 5482 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
4338 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5483 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4339 | "because of age: %lums.\n", | 5484 | "because of age: %lums.\n", |
4340 | escape_essid(network->ssid, network->ssid_len), | 5485 | escape_essid(network->ssid, network->ssid_len), |
4341 | MAC_ARG(network->bssid), | 5486 | MAC_ARG(network->bssid), |
4342 | (jiffies - network->last_scanned) / (HZ / 100)); | 5487 | 1000 * (jiffies - network->last_scanned) / HZ); |
4343 | return 0; | 5488 | return 0; |
4344 | } | 5489 | } |
4345 | 5490 | ||
@@ -4367,6 +5512,15 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4367 | return 0; | 5512 | return 0; |
4368 | } | 5513 | } |
4369 | 5514 | ||
5515 | if (!priv->ieee->wpa_enabled && (network->wpa_ie_len > 0 || | ||
5516 | network->rsn_ie_len > 0)) { | ||
5517 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5518 | "because of WPA capability mismatch.\n", | ||
5519 | escape_essid(network->ssid, network->ssid_len), | ||
5520 | MAC_ARG(network->bssid)); | ||
5521 | return 0; | ||
5522 | } | ||
5523 | |||
4370 | if ((priv->config & CFG_STATIC_BSSID) && | 5524 | if ((priv->config & CFG_STATIC_BSSID) && |
4371 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | 5525 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { |
4372 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5526 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
@@ -4386,7 +5540,26 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4386 | return 0; | 5540 | return 0; |
4387 | } | 5541 | } |
4388 | 5542 | ||
4389 | ipw_compatible_rates(priv, network, &rates); | 5543 | /* Filter out invalid channel in current GEO */ |
5544 | if (!ipw_is_valid_channel(priv->ieee, network->channel)) { | ||
5545 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5546 | "because of invalid channel in current GEO\n", | ||
5547 | escape_essid(network->ssid, network->ssid_len), | ||
5548 | MAC_ARG(network->bssid)); | ||
5549 | return 0; | ||
5550 | } | ||
5551 | |||
5552 | /* Ensure that the rates supported by the driver are compatible with | ||
5553 | * this AP, including verification of basic rates (mandatory) */ | ||
5554 | if (!ipw_compatible_rates(priv, network, &rates)) { | ||
5555 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
5556 | "because configured rate mask excludes " | ||
5557 | "AP mandatory rate.\n", | ||
5558 | escape_essid(network->ssid, network->ssid_len), | ||
5559 | MAC_ARG(network->bssid)); | ||
5560 | return 0; | ||
5561 | } | ||
5562 | |||
4390 | if (rates.num_rates == 0) { | 5563 | if (rates.num_rates == 0) { |
4391 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5564 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4392 | "because of no compatible rates.\n", | 5565 | "because of no compatible rates.\n", |
@@ -4413,6 +5586,9 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
4413 | static void ipw_adhoc_create(struct ipw_priv *priv, | 5586 | static void ipw_adhoc_create(struct ipw_priv *priv, |
4414 | struct ieee80211_network *network) | 5587 | struct ieee80211_network *network) |
4415 | { | 5588 | { |
5589 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
5590 | int i; | ||
5591 | |||
4416 | /* | 5592 | /* |
4417 | * For the purposes of scanning, we can set our wireless mode | 5593 | * For the purposes of scanning, we can set our wireless mode |
4418 | * to trigger scans across combinations of bands, but when it | 5594 | * to trigger scans across combinations of bands, but when it |
@@ -4423,22 +5599,47 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4423 | * chossen band. Attempting to create a new ad-hoc network | 5599 | * chossen band. Attempting to create a new ad-hoc network |
4424 | * with an invalid channel for wireless mode will trigger a | 5600 | * with an invalid channel for wireless mode will trigger a |
4425 | * FW fatal error. | 5601 | * FW fatal error. |
5602 | * | ||
4426 | */ | 5603 | */ |
4427 | network->mode = is_valid_channel(priv->ieee->mode, priv->channel); | 5604 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { |
4428 | if (network->mode) { | 5605 | case IEEE80211_52GHZ_BAND: |
4429 | network->channel = priv->channel; | 5606 | network->mode = IEEE_A; |
4430 | } else { | 5607 | i = ipw_channel_to_index(priv->ieee, priv->channel); |
5608 | if (i == -1) | ||
5609 | BUG(); | ||
5610 | if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | ||
5611 | IPW_WARNING("Overriding invalid channel\n"); | ||
5612 | priv->channel = geo->a[0].channel; | ||
5613 | } | ||
5614 | break; | ||
5615 | |||
5616 | case IEEE80211_24GHZ_BAND: | ||
5617 | if (priv->ieee->mode & IEEE_G) | ||
5618 | network->mode = IEEE_G; | ||
5619 | else | ||
5620 | network->mode = IEEE_B; | ||
5621 | i = ipw_channel_to_index(priv->ieee, priv->channel); | ||
5622 | if (i == -1) | ||
5623 | BUG(); | ||
5624 | if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | ||
5625 | IPW_WARNING("Overriding invalid channel\n"); | ||
5626 | priv->channel = geo->bg[0].channel; | ||
5627 | } | ||
5628 | break; | ||
5629 | |||
5630 | default: | ||
4431 | IPW_WARNING("Overriding invalid channel\n"); | 5631 | IPW_WARNING("Overriding invalid channel\n"); |
4432 | if (priv->ieee->mode & IEEE_A) { | 5632 | if (priv->ieee->mode & IEEE_A) { |
4433 | network->mode = IEEE_A; | 5633 | network->mode = IEEE_A; |
4434 | priv->channel = band_a_active_channel[0]; | 5634 | priv->channel = geo->a[0].channel; |
4435 | } else if (priv->ieee->mode & IEEE_G) { | 5635 | } else if (priv->ieee->mode & IEEE_G) { |
4436 | network->mode = IEEE_G; | 5636 | network->mode = IEEE_G; |
4437 | priv->channel = band_b_active_channel[0]; | 5637 | priv->channel = geo->bg[0].channel; |
4438 | } else { | 5638 | } else { |
4439 | network->mode = IEEE_B; | 5639 | network->mode = IEEE_B; |
4440 | priv->channel = band_b_active_channel[0]; | 5640 | priv->channel = geo->bg[0].channel; |
4441 | } | 5641 | } |
5642 | break; | ||
4442 | } | 5643 | } |
4443 | 5644 | ||
4444 | network->channel = priv->channel; | 5645 | network->channel = priv->channel; |
@@ -4448,6 +5649,8 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4448 | memcpy(network->ssid, priv->essid, priv->essid_len); | 5649 | memcpy(network->ssid, priv->essid, priv->essid_len); |
4449 | memset(&network->stats, 0, sizeof(network->stats)); | 5650 | memset(&network->stats, 0, sizeof(network->stats)); |
4450 | network->capability = WLAN_CAPABILITY_IBSS; | 5651 | network->capability = WLAN_CAPABILITY_IBSS; |
5652 | if (!(priv->config & CFG_PREAMBLE_LONG)) | ||
5653 | network->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; | ||
4451 | if (priv->capability & CAP_PRIVACY_ON) | 5654 | if (priv->capability & CAP_PRIVACY_ON) |
4452 | network->capability |= WLAN_CAPABILITY_PRIVACY; | 5655 | network->capability |= WLAN_CAPABILITY_PRIVACY; |
4453 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); | 5656 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); |
@@ -4464,13 +5667,35 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4464 | network->beacon_interval = 100; /* Default */ | 5667 | network->beacon_interval = 100; /* Default */ |
4465 | network->listen_interval = 10; /* Default */ | 5668 | network->listen_interval = 10; /* Default */ |
4466 | network->atim_window = 0; /* Default */ | 5669 | network->atim_window = 0; /* Default */ |
4467 | #ifdef CONFIG_IEEE80211_WPA | ||
4468 | network->wpa_ie_len = 0; | 5670 | network->wpa_ie_len = 0; |
4469 | network->rsn_ie_len = 0; | 5671 | network->rsn_ie_len = 0; |
4470 | #endif /* CONFIG_IEEE80211_WPA */ | ||
4471 | } | 5672 | } |
4472 | 5673 | ||
4473 | static void ipw_send_wep_keys(struct ipw_priv *priv) | 5674 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) |
5675 | { | ||
5676 | struct ipw_tgi_tx_key *key; | ||
5677 | struct host_cmd cmd = { | ||
5678 | .cmd = IPW_CMD_TGI_TX_KEY, | ||
5679 | .len = sizeof(*key) | ||
5680 | }; | ||
5681 | |||
5682 | if (!(priv->ieee->sec.flags & (1 << index))) | ||
5683 | return; | ||
5684 | |||
5685 | key = (struct ipw_tgi_tx_key *)&cmd.param; | ||
5686 | key->key_id = index; | ||
5687 | memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); | ||
5688 | key->security_type = type; | ||
5689 | key->station_index = 0; /* always 0 for BSS */ | ||
5690 | key->flags = 0; | ||
5691 | /* 0 for new key; previous value of counter (after fatal error) */ | ||
5692 | key->tx_counter[0] = 0; | ||
5693 | key->tx_counter[1] = 0; | ||
5694 | |||
5695 | ipw_send_cmd(priv, &cmd); | ||
5696 | } | ||
5697 | |||
5698 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) | ||
4474 | { | 5699 | { |
4475 | struct ipw_wep_key *key; | 5700 | struct ipw_wep_key *key; |
4476 | int i; | 5701 | int i; |
@@ -4483,19 +5708,97 @@ static void ipw_send_wep_keys(struct ipw_priv *priv) | |||
4483 | key->cmd_id = DINO_CMD_WEP_KEY; | 5708 | key->cmd_id = DINO_CMD_WEP_KEY; |
4484 | key->seq_num = 0; | 5709 | key->seq_num = 0; |
4485 | 5710 | ||
5711 | /* Note: AES keys cannot be set for multiple times. | ||
5712 | * Only set it at the first time. */ | ||
4486 | for (i = 0; i < 4; i++) { | 5713 | for (i = 0; i < 4; i++) { |
4487 | key->key_index = i; | 5714 | key->key_index = i | type; |
4488 | if (!(priv->sec.flags & (1 << i))) { | 5715 | if (!(priv->ieee->sec.flags & (1 << i))) { |
4489 | key->key_size = 0; | 5716 | key->key_size = 0; |
4490 | } else { | 5717 | continue; |
4491 | key->key_size = priv->sec.key_sizes[i]; | ||
4492 | memcpy(key->key, priv->sec.keys[i], key->key_size); | ||
4493 | } | 5718 | } |
4494 | 5719 | ||
4495 | if (ipw_send_cmd(priv, &cmd)) { | 5720 | key->key_size = priv->ieee->sec.key_sizes[i]; |
4496 | IPW_ERROR("failed to send WEP_KEY command\n"); | 5721 | memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); |
4497 | return; | 5722 | |
4498 | } | 5723 | ipw_send_cmd(priv, &cmd); |
5724 | } | ||
5725 | } | ||
5726 | |||
5727 | static void ipw_set_hw_decrypt_unicast(struct ipw_priv *priv, int level) | ||
5728 | { | ||
5729 | if (priv->ieee->host_encrypt) | ||
5730 | return; | ||
5731 | |||
5732 | switch (level) { | ||
5733 | case SEC_LEVEL_3: | ||
5734 | priv->sys_config.disable_unicast_decryption = 0; | ||
5735 | priv->ieee->host_decrypt = 0; | ||
5736 | break; | ||
5737 | case SEC_LEVEL_2: | ||
5738 | priv->sys_config.disable_unicast_decryption = 1; | ||
5739 | priv->ieee->host_decrypt = 1; | ||
5740 | break; | ||
5741 | case SEC_LEVEL_1: | ||
5742 | priv->sys_config.disable_unicast_decryption = 0; | ||
5743 | priv->ieee->host_decrypt = 0; | ||
5744 | break; | ||
5745 | case SEC_LEVEL_0: | ||
5746 | priv->sys_config.disable_unicast_decryption = 1; | ||
5747 | break; | ||
5748 | default: | ||
5749 | break; | ||
5750 | } | ||
5751 | } | ||
5752 | |||
5753 | static void ipw_set_hw_decrypt_multicast(struct ipw_priv *priv, int level) | ||
5754 | { | ||
5755 | if (priv->ieee->host_encrypt) | ||
5756 | return; | ||
5757 | |||
5758 | switch (level) { | ||
5759 | case SEC_LEVEL_3: | ||
5760 | priv->sys_config.disable_multicast_decryption = 0; | ||
5761 | break; | ||
5762 | case SEC_LEVEL_2: | ||
5763 | priv->sys_config.disable_multicast_decryption = 1; | ||
5764 | break; | ||
5765 | case SEC_LEVEL_1: | ||
5766 | priv->sys_config.disable_multicast_decryption = 0; | ||
5767 | break; | ||
5768 | case SEC_LEVEL_0: | ||
5769 | priv->sys_config.disable_multicast_decryption = 1; | ||
5770 | break; | ||
5771 | default: | ||
5772 | break; | ||
5773 | } | ||
5774 | } | ||
5775 | |||
5776 | static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) | ||
5777 | { | ||
5778 | switch (priv->ieee->sec.level) { | ||
5779 | case SEC_LEVEL_3: | ||
5780 | if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) | ||
5781 | ipw_send_tgi_tx_key(priv, | ||
5782 | DCT_FLAG_EXT_SECURITY_CCM, | ||
5783 | priv->ieee->sec.active_key); | ||
5784 | |||
5785 | if (!priv->ieee->host_mc_decrypt) | ||
5786 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); | ||
5787 | break; | ||
5788 | case SEC_LEVEL_2: | ||
5789 | if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) | ||
5790 | ipw_send_tgi_tx_key(priv, | ||
5791 | DCT_FLAG_EXT_SECURITY_TKIP, | ||
5792 | priv->ieee->sec.active_key); | ||
5793 | break; | ||
5794 | case SEC_LEVEL_1: | ||
5795 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | ||
5796 | ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); | ||
5797 | ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); | ||
5798 | break; | ||
5799 | case SEC_LEVEL_0: | ||
5800 | default: | ||
5801 | break; | ||
4499 | } | 5802 | } |
4500 | } | 5803 | } |
4501 | 5804 | ||
@@ -4503,9 +5806,12 @@ static void ipw_adhoc_check(void *data) | |||
4503 | { | 5806 | { |
4504 | struct ipw_priv *priv = data; | 5807 | struct ipw_priv *priv = data; |
4505 | 5808 | ||
4506 | if (priv->missed_adhoc_beacons++ > priv->missed_beacon_threshold && | 5809 | if (priv->missed_adhoc_beacons++ > priv->disassociate_threshold && |
4507 | !(priv->config & CFG_ADHOC_PERSIST)) { | 5810 | !(priv->config & CFG_ADHOC_PERSIST)) { |
4508 | IPW_DEBUG_SCAN("Disassociating due to missed beacons\n"); | 5811 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | |
5812 | IPW_DL_STATE | IPW_DL_ASSOC, | ||
5813 | "Missed beacon: %d - disassociate\n", | ||
5814 | priv->missed_adhoc_beacons); | ||
4509 | ipw_remove_current_network(priv); | 5815 | ipw_remove_current_network(priv); |
4510 | ipw_disassociate(priv); | 5816 | ipw_disassociate(priv); |
4511 | return; | 5817 | return; |
@@ -4515,6 +5821,14 @@ static void ipw_adhoc_check(void *data) | |||
4515 | priv->assoc_request.beacon_interval); | 5821 | priv->assoc_request.beacon_interval); |
4516 | } | 5822 | } |
4517 | 5823 | ||
5824 | static void ipw_bg_adhoc_check(void *data) | ||
5825 | { | ||
5826 | struct ipw_priv *priv = data; | ||
5827 | down(&priv->sem); | ||
5828 | ipw_adhoc_check(data); | ||
5829 | up(&priv->sem); | ||
5830 | } | ||
5831 | |||
4518 | #ifdef CONFIG_IPW_DEBUG | 5832 | #ifdef CONFIG_IPW_DEBUG |
4519 | static void ipw_debug_config(struct ipw_priv *priv) | 5833 | static void ipw_debug_config(struct ipw_priv *priv) |
4520 | { | 5834 | { |
@@ -4530,7 +5844,8 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
4530 | else | 5844 | else |
4531 | IPW_DEBUG_INFO("ESSID unlocked.\n"); | 5845 | IPW_DEBUG_INFO("ESSID unlocked.\n"); |
4532 | if (priv->config & CFG_STATIC_BSSID) | 5846 | if (priv->config & CFG_STATIC_BSSID) |
4533 | IPW_DEBUG_INFO("BSSID locked to %d\n", priv->channel); | 5847 | IPW_DEBUG_INFO("BSSID locked to " MAC_FMT "\n", |
5848 | MAC_ARG(priv->bssid)); | ||
4534 | else | 5849 | else |
4535 | IPW_DEBUG_INFO("BSSID unlocked.\n"); | 5850 | IPW_DEBUG_INFO("BSSID unlocked.\n"); |
4536 | if (priv->capability & CAP_PRIVACY_ON) | 5851 | if (priv->capability & CAP_PRIVACY_ON) |
@@ -4543,8 +5858,7 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
4543 | #define ipw_debug_config(x) do {} while (0) | 5858 | #define ipw_debug_config(x) do {} while (0) |
4544 | #endif | 5859 | #endif |
4545 | 5860 | ||
4546 | static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | 5861 | static inline void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) |
4547 | struct ieee80211_network *network) | ||
4548 | { | 5862 | { |
4549 | /* TODO: Verify that this works... */ | 5863 | /* TODO: Verify that this works... */ |
4550 | struct ipw_fixed_rate fr = { | 5864 | struct ipw_fixed_rate fr = { |
@@ -4561,6 +5875,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4561 | /* IEEE_A */ | 5875 | /* IEEE_A */ |
4562 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { | 5876 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { |
4563 | /* Invalid fixed rate mask */ | 5877 | /* Invalid fixed rate mask */ |
5878 | IPW_DEBUG_WX | ||
5879 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4564 | fr.tx_rates = 0; | 5880 | fr.tx_rates = 0; |
4565 | break; | 5881 | break; |
4566 | } | 5882 | } |
@@ -4570,9 +5886,11 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4570 | 5886 | ||
4571 | default: /* 2.4Ghz or Mixed */ | 5887 | default: /* 2.4Ghz or Mixed */ |
4572 | /* IEEE_B */ | 5888 | /* IEEE_B */ |
4573 | if (network->mode == IEEE_B) { | 5889 | if (mode == IEEE_B) { |
4574 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { | 5890 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { |
4575 | /* Invalid fixed rate mask */ | 5891 | /* Invalid fixed rate mask */ |
5892 | IPW_DEBUG_WX | ||
5893 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4576 | fr.tx_rates = 0; | 5894 | fr.tx_rates = 0; |
4577 | } | 5895 | } |
4578 | break; | 5896 | break; |
@@ -4582,6 +5900,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4582 | if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | | 5900 | if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | |
4583 | IEEE80211_OFDM_RATES_MASK)) { | 5901 | IEEE80211_OFDM_RATES_MASK)) { |
4584 | /* Invalid fixed rate mask */ | 5902 | /* Invalid fixed rate mask */ |
5903 | IPW_DEBUG_WX | ||
5904 | ("invalid fixed rate mask in ipw_set_fixed_rate\n"); | ||
4585 | fr.tx_rates = 0; | 5905 | fr.tx_rates = 0; |
4586 | break; | 5906 | break; |
4587 | } | 5907 | } |
@@ -4609,6 +5929,1112 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4609 | ipw_write_reg32(priv, reg, *(u32 *) & fr); | 5929 | ipw_write_reg32(priv, reg, *(u32 *) & fr); |
4610 | } | 5930 | } |
4611 | 5931 | ||
5932 | static void ipw_abort_scan(struct ipw_priv *priv) | ||
5933 | { | ||
5934 | int err; | ||
5935 | |||
5936 | if (priv->status & STATUS_SCAN_ABORTING) { | ||
5937 | IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); | ||
5938 | return; | ||
5939 | } | ||
5940 | priv->status |= STATUS_SCAN_ABORTING; | ||
5941 | |||
5942 | err = ipw_send_scan_abort(priv); | ||
5943 | if (err) | ||
5944 | IPW_DEBUG_HC("Request to abort scan failed.\n"); | ||
5945 | } | ||
5946 | |||
5947 | static void ipw_add_scan_channels(struct ipw_priv *priv, | ||
5948 | struct ipw_scan_request_ext *scan, | ||
5949 | int scan_type) | ||
5950 | { | ||
5951 | int channel_index = 0; | ||
5952 | const struct ieee80211_geo *geo; | ||
5953 | int i; | ||
5954 | |||
5955 | geo = ipw_get_geo(priv->ieee); | ||
5956 | |||
5957 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | ||
5958 | int start = channel_index; | ||
5959 | for (i = 0; i < geo->a_channels; i++) { | ||
5960 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5961 | geo->a[i].channel == priv->channel) | ||
5962 | continue; | ||
5963 | channel_index++; | ||
5964 | scan->channels_list[channel_index] = geo->a[i].channel; | ||
5965 | ipw_set_scan_type(scan, channel_index, | ||
5966 | geo->a[i]. | ||
5967 | flags & IEEE80211_CH_PASSIVE_ONLY ? | ||
5968 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN : | ||
5969 | scan_type); | ||
5970 | } | ||
5971 | |||
5972 | if (start != channel_index) { | ||
5973 | scan->channels_list[start] = (u8) (IPW_A_MODE << 6) | | ||
5974 | (channel_index - start); | ||
5975 | channel_index++; | ||
5976 | } | ||
5977 | } | ||
5978 | |||
5979 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { | ||
5980 | int start = channel_index; | ||
5981 | if (priv->config & CFG_SPEED_SCAN) { | ||
5982 | int index; | ||
5983 | u8 channels[IEEE80211_24GHZ_CHANNELS] = { | ||
5984 | /* nop out the list */ | ||
5985 | [0] = 0 | ||
5986 | }; | ||
5987 | |||
5988 | u8 channel; | ||
5989 | while (channel_index < IPW_SCAN_CHANNELS) { | ||
5990 | channel = | ||
5991 | priv->speed_scan[priv->speed_scan_pos]; | ||
5992 | if (channel == 0) { | ||
5993 | priv->speed_scan_pos = 0; | ||
5994 | channel = priv->speed_scan[0]; | ||
5995 | } | ||
5996 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5997 | channel == priv->channel) { | ||
5998 | priv->speed_scan_pos++; | ||
5999 | continue; | ||
6000 | } | ||
6001 | |||
6002 | /* If this channel has already been | ||
6003 | * added in scan, break from loop | ||
6004 | * and this will be the first channel | ||
6005 | * in the next scan. | ||
6006 | */ | ||
6007 | if (channels[channel - 1] != 0) | ||
6008 | break; | ||
6009 | |||
6010 | channels[channel - 1] = 1; | ||
6011 | priv->speed_scan_pos++; | ||
6012 | channel_index++; | ||
6013 | scan->channels_list[channel_index] = channel; | ||
6014 | index = | ||
6015 | ipw_channel_to_index(priv->ieee, channel); | ||
6016 | ipw_set_scan_type(scan, channel_index, | ||
6017 | geo->bg[index]. | ||
6018 | flags & | ||
6019 | IEEE80211_CH_PASSIVE_ONLY ? | ||
6020 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN | ||
6021 | : scan_type); | ||
6022 | } | ||
6023 | } else { | ||
6024 | for (i = 0; i < geo->bg_channels; i++) { | ||
6025 | if ((priv->status & STATUS_ASSOCIATED) && | ||
6026 | geo->bg[i].channel == priv->channel) | ||
6027 | continue; | ||
6028 | channel_index++; | ||
6029 | scan->channels_list[channel_index] = | ||
6030 | geo->bg[i].channel; | ||
6031 | ipw_set_scan_type(scan, channel_index, | ||
6032 | geo->bg[i]. | ||
6033 | flags & | ||
6034 | IEEE80211_CH_PASSIVE_ONLY ? | ||
6035 | IPW_SCAN_PASSIVE_FULL_DWELL_SCAN | ||
6036 | : scan_type); | ||
6037 | } | ||
6038 | } | ||
6039 | |||
6040 | if (start != channel_index) { | ||
6041 | scan->channels_list[start] = (u8) (IPW_B_MODE << 6) | | ||
6042 | (channel_index - start); | ||
6043 | } | ||
6044 | } | ||
6045 | } | ||
6046 | |||
6047 | static int ipw_request_scan(struct ipw_priv *priv) | ||
6048 | { | ||
6049 | struct ipw_scan_request_ext scan; | ||
6050 | int err = 0, scan_type; | ||
6051 | |||
6052 | if (!(priv->status & STATUS_INIT) || | ||
6053 | (priv->status & STATUS_EXIT_PENDING)) | ||
6054 | return 0; | ||
6055 | |||
6056 | down(&priv->sem); | ||
6057 | |||
6058 | if (priv->status & STATUS_SCANNING) { | ||
6059 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); | ||
6060 | priv->status |= STATUS_SCAN_PENDING; | ||
6061 | goto done; | ||
6062 | } | ||
6063 | |||
6064 | if (!(priv->status & STATUS_SCAN_FORCED) && | ||
6065 | priv->status & STATUS_SCAN_ABORTING) { | ||
6066 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | ||
6067 | priv->status |= STATUS_SCAN_PENDING; | ||
6068 | goto done; | ||
6069 | } | ||
6070 | |||
6071 | if (priv->status & STATUS_RF_KILL_MASK) { | ||
6072 | IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | ||
6073 | priv->status |= STATUS_SCAN_PENDING; | ||
6074 | goto done; | ||
6075 | } | ||
6076 | |||
6077 | memset(&scan, 0, sizeof(scan)); | ||
6078 | |||
6079 | if (priv->config & CFG_SPEED_SCAN) | ||
6080 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
6081 | cpu_to_le16(30); | ||
6082 | else | ||
6083 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
6084 | cpu_to_le16(20); | ||
6085 | |||
6086 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | ||
6087 | cpu_to_le16(20); | ||
6088 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
6089 | |||
6090 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
6091 | |||
6092 | #ifdef CONFIG_IPW2200_MONITOR | ||
6093 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
6094 | u8 channel; | ||
6095 | u8 band = 0; | ||
6096 | |||
6097 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { | ||
6098 | case IEEE80211_52GHZ_BAND: | ||
6099 | band = (u8) (IPW_A_MODE << 6) | 1; | ||
6100 | channel = priv->channel; | ||
6101 | break; | ||
6102 | |||
6103 | case IEEE80211_24GHZ_BAND: | ||
6104 | band = (u8) (IPW_B_MODE << 6) | 1; | ||
6105 | channel = priv->channel; | ||
6106 | break; | ||
6107 | |||
6108 | default: | ||
6109 | band = (u8) (IPW_B_MODE << 6) | 1; | ||
6110 | channel = 9; | ||
6111 | break; | ||
6112 | } | ||
6113 | |||
6114 | scan.channels_list[0] = band; | ||
6115 | scan.channels_list[1] = channel; | ||
6116 | ipw_set_scan_type(&scan, 1, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); | ||
6117 | |||
6118 | /* NOTE: The card will sit on this channel for this time | ||
6119 | * period. Scan aborts are timing sensitive and frequently | ||
6120 | * result in firmware restarts. As such, it is best to | ||
6121 | * set a small dwell_time here and just keep re-issuing | ||
6122 | * scans. Otherwise fast channel hopping will not actually | ||
6123 | * hop channels. | ||
6124 | * | ||
6125 | * TODO: Move SPEED SCAN support to all modes and bands */ | ||
6126 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = | ||
6127 | cpu_to_le16(2000); | ||
6128 | } else { | ||
6129 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
6130 | /* If we are roaming, then make this a directed scan for the | ||
6131 | * current network. Otherwise, ensure that every other scan | ||
6132 | * is a fast channel hop scan */ | ||
6133 | if ((priv->status & STATUS_ROAMING) | ||
6134 | || (!(priv->status & STATUS_ASSOCIATED) | ||
6135 | && (priv->config & CFG_STATIC_ESSID) | ||
6136 | && (le32_to_cpu(scan.full_scan_index) % 2))) { | ||
6137 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | ||
6138 | if (err) { | ||
6139 | IPW_DEBUG_HC("Attempt to send SSID command " | ||
6140 | "failed.\n"); | ||
6141 | goto done; | ||
6142 | } | ||
6143 | |||
6144 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
6145 | } else | ||
6146 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; | ||
6147 | |||
6148 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
6149 | #ifdef CONFIG_IPW2200_MONITOR | ||
6150 | } | ||
6151 | #endif | ||
6152 | |||
6153 | err = ipw_send_scan_request_ext(priv, &scan); | ||
6154 | if (err) { | ||
6155 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
6156 | goto done; | ||
6157 | } | ||
6158 | |||
6159 | priv->status |= STATUS_SCANNING; | ||
6160 | priv->status &= ~STATUS_SCAN_PENDING; | ||
6161 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
6162 | IPW_SCAN_CHECK_WATCHDOG); | ||
6163 | done: | ||
6164 | up(&priv->sem); | ||
6165 | return err; | ||
6166 | } | ||
6167 | |||
6168 | static void ipw_bg_abort_scan(void *data) | ||
6169 | { | ||
6170 | struct ipw_priv *priv = data; | ||
6171 | down(&priv->sem); | ||
6172 | ipw_abort_scan(data); | ||
6173 | up(&priv->sem); | ||
6174 | } | ||
6175 | |||
6176 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) | ||
6177 | { | ||
6178 | /* This is called when wpa_supplicant loads and closes the driver | ||
6179 | * interface. */ | ||
6180 | priv->ieee->wpa_enabled = value; | ||
6181 | return 0; | ||
6182 | } | ||
6183 | |||
6184 | static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | ||
6185 | { | ||
6186 | struct ieee80211_device *ieee = priv->ieee; | ||
6187 | struct ieee80211_security sec = { | ||
6188 | .flags = SEC_AUTH_MODE, | ||
6189 | }; | ||
6190 | int ret = 0; | ||
6191 | |||
6192 | if (value & IW_AUTH_ALG_SHARED_KEY) { | ||
6193 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; | ||
6194 | ieee->open_wep = 0; | ||
6195 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | ||
6196 | sec.auth_mode = WLAN_AUTH_OPEN; | ||
6197 | ieee->open_wep = 1; | ||
6198 | } else | ||
6199 | return -EINVAL; | ||
6200 | |||
6201 | if (ieee->set_security) | ||
6202 | ieee->set_security(ieee->dev, &sec); | ||
6203 | else | ||
6204 | ret = -EOPNOTSUPP; | ||
6205 | |||
6206 | return ret; | ||
6207 | } | ||
6208 | |||
6209 | void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | ||
6210 | { | ||
6211 | /* make sure WPA is enabled */ | ||
6212 | ipw_wpa_enable(priv, 1); | ||
6213 | |||
6214 | ipw_disassociate(priv); | ||
6215 | } | ||
6216 | |||
6217 | static int ipw_set_rsn_capa(struct ipw_priv *priv, | ||
6218 | char *capabilities, int length) | ||
6219 | { | ||
6220 | struct host_cmd cmd = { | ||
6221 | .cmd = IPW_CMD_RSN_CAPABILITIES, | ||
6222 | .len = length, | ||
6223 | }; | ||
6224 | |||
6225 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); | ||
6226 | |||
6227 | memcpy(cmd.param, capabilities, length); | ||
6228 | return ipw_send_cmd(priv, &cmd); | ||
6229 | } | ||
6230 | |||
6231 | /* | ||
6232 | * WE-18 support | ||
6233 | */ | ||
6234 | |||
6235 | /* SIOCSIWGENIE */ | ||
6236 | static int ipw_wx_set_genie(struct net_device *dev, | ||
6237 | struct iw_request_info *info, | ||
6238 | union iwreq_data *wrqu, char *extra) | ||
6239 | { | ||
6240 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6241 | struct ieee80211_device *ieee = priv->ieee; | ||
6242 | u8 *buf; | ||
6243 | int err = 0; | ||
6244 | |||
6245 | if (wrqu->data.length > MAX_WPA_IE_LEN || | ||
6246 | (wrqu->data.length && extra == NULL)) | ||
6247 | return -EINVAL; | ||
6248 | |||
6249 | //down(&priv->sem); | ||
6250 | |||
6251 | //if (!ieee->wpa_enabled) { | ||
6252 | // err = -EOPNOTSUPP; | ||
6253 | // goto out; | ||
6254 | //} | ||
6255 | |||
6256 | if (wrqu->data.length) { | ||
6257 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); | ||
6258 | if (buf == NULL) { | ||
6259 | err = -ENOMEM; | ||
6260 | goto out; | ||
6261 | } | ||
6262 | |||
6263 | memcpy(buf, extra, wrqu->data.length); | ||
6264 | kfree(ieee->wpa_ie); | ||
6265 | ieee->wpa_ie = buf; | ||
6266 | ieee->wpa_ie_len = wrqu->data.length; | ||
6267 | } else { | ||
6268 | kfree(ieee->wpa_ie); | ||
6269 | ieee->wpa_ie = NULL; | ||
6270 | ieee->wpa_ie_len = 0; | ||
6271 | } | ||
6272 | |||
6273 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | ||
6274 | out: | ||
6275 | //up(&priv->sem); | ||
6276 | return err; | ||
6277 | } | ||
6278 | |||
6279 | /* SIOCGIWGENIE */ | ||
6280 | static int ipw_wx_get_genie(struct net_device *dev, | ||
6281 | struct iw_request_info *info, | ||
6282 | union iwreq_data *wrqu, char *extra) | ||
6283 | { | ||
6284 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6285 | struct ieee80211_device *ieee = priv->ieee; | ||
6286 | int err = 0; | ||
6287 | |||
6288 | //down(&priv->sem); | ||
6289 | |||
6290 | //if (!ieee->wpa_enabled) { | ||
6291 | // err = -EOPNOTSUPP; | ||
6292 | // goto out; | ||
6293 | //} | ||
6294 | |||
6295 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { | ||
6296 | wrqu->data.length = 0; | ||
6297 | goto out; | ||
6298 | } | ||
6299 | |||
6300 | if (wrqu->data.length < ieee->wpa_ie_len) { | ||
6301 | err = -E2BIG; | ||
6302 | goto out; | ||
6303 | } | ||
6304 | |||
6305 | wrqu->data.length = ieee->wpa_ie_len; | ||
6306 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | ||
6307 | |||
6308 | out: | ||
6309 | //up(&priv->sem); | ||
6310 | return err; | ||
6311 | } | ||
6312 | |||
6313 | static int wext_cipher2level(int cipher) | ||
6314 | { | ||
6315 | switch (cipher) { | ||
6316 | case IW_AUTH_CIPHER_NONE: | ||
6317 | return SEC_LEVEL_0; | ||
6318 | case IW_AUTH_CIPHER_WEP40: | ||
6319 | case IW_AUTH_CIPHER_WEP104: | ||
6320 | return SEC_LEVEL_1; | ||
6321 | case IW_AUTH_CIPHER_TKIP: | ||
6322 | return SEC_LEVEL_2; | ||
6323 | case IW_AUTH_CIPHER_CCMP: | ||
6324 | return SEC_LEVEL_3; | ||
6325 | default: | ||
6326 | return -1; | ||
6327 | } | ||
6328 | } | ||
6329 | |||
6330 | /* SIOCSIWAUTH */ | ||
6331 | static int ipw_wx_set_auth(struct net_device *dev, | ||
6332 | struct iw_request_info *info, | ||
6333 | union iwreq_data *wrqu, char *extra) | ||
6334 | { | ||
6335 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6336 | struct ieee80211_device *ieee = priv->ieee; | ||
6337 | struct iw_param *param = &wrqu->param; | ||
6338 | struct ieee80211_crypt_data *crypt; | ||
6339 | unsigned long flags; | ||
6340 | int ret = 0; | ||
6341 | |||
6342 | switch (param->flags & IW_AUTH_INDEX) { | ||
6343 | case IW_AUTH_WPA_VERSION: | ||
6344 | break; | ||
6345 | case IW_AUTH_CIPHER_PAIRWISE: | ||
6346 | ipw_set_hw_decrypt_unicast(priv, | ||
6347 | wext_cipher2level(param->value)); | ||
6348 | break; | ||
6349 | case IW_AUTH_CIPHER_GROUP: | ||
6350 | ipw_set_hw_decrypt_multicast(priv, | ||
6351 | wext_cipher2level(param->value)); | ||
6352 | break; | ||
6353 | case IW_AUTH_KEY_MGMT: | ||
6354 | /* | ||
6355 | * ipw2200 does not use these parameters | ||
6356 | */ | ||
6357 | break; | ||
6358 | |||
6359 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
6360 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
6361 | if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) | ||
6362 | break; | ||
6363 | |||
6364 | flags = crypt->ops->get_flags(crypt->priv); | ||
6365 | |||
6366 | if (param->value) | ||
6367 | flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
6368 | else | ||
6369 | flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; | ||
6370 | |||
6371 | crypt->ops->set_flags(flags, crypt->priv); | ||
6372 | |||
6373 | break; | ||
6374 | |||
6375 | case IW_AUTH_DROP_UNENCRYPTED:{ | ||
6376 | /* HACK: | ||
6377 | * | ||
6378 | * wpa_supplicant calls set_wpa_enabled when the driver | ||
6379 | * is loaded and unloaded, regardless of if WPA is being | ||
6380 | * used. No other calls are made which can be used to | ||
6381 | * determine if encryption will be used or not prior to | ||
6382 | * association being expected. If encryption is not being | ||
6383 | * used, drop_unencrypted is set to false, else true -- we | ||
6384 | * can use this to determine if the CAP_PRIVACY_ON bit should | ||
6385 | * be set. | ||
6386 | */ | ||
6387 | struct ieee80211_security sec = { | ||
6388 | .flags = SEC_ENABLED, | ||
6389 | .enabled = param->value, | ||
6390 | }; | ||
6391 | priv->ieee->drop_unencrypted = param->value; | ||
6392 | /* We only change SEC_LEVEL for open mode. Others | ||
6393 | * are set by ipw_wpa_set_encryption. | ||
6394 | */ | ||
6395 | if (!param->value) { | ||
6396 | sec.flags |= SEC_LEVEL; | ||
6397 | sec.level = SEC_LEVEL_0; | ||
6398 | } else { | ||
6399 | sec.flags |= SEC_LEVEL; | ||
6400 | sec.level = SEC_LEVEL_1; | ||
6401 | } | ||
6402 | if (priv->ieee->set_security) | ||
6403 | priv->ieee->set_security(priv->ieee->dev, &sec); | ||
6404 | break; | ||
6405 | } | ||
6406 | |||
6407 | case IW_AUTH_80211_AUTH_ALG: | ||
6408 | ret = ipw_wpa_set_auth_algs(priv, param->value); | ||
6409 | break; | ||
6410 | |||
6411 | case IW_AUTH_WPA_ENABLED: | ||
6412 | ret = ipw_wpa_enable(priv, param->value); | ||
6413 | break; | ||
6414 | |||
6415 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
6416 | ieee->ieee802_1x = param->value; | ||
6417 | break; | ||
6418 | |||
6419 | //case IW_AUTH_ROAMING_CONTROL: | ||
6420 | case IW_AUTH_PRIVACY_INVOKED: | ||
6421 | ieee->privacy_invoked = param->value; | ||
6422 | break; | ||
6423 | |||
6424 | default: | ||
6425 | return -EOPNOTSUPP; | ||
6426 | } | ||
6427 | return ret; | ||
6428 | } | ||
6429 | |||
6430 | /* SIOCGIWAUTH */ | ||
6431 | static int ipw_wx_get_auth(struct net_device *dev, | ||
6432 | struct iw_request_info *info, | ||
6433 | union iwreq_data *wrqu, char *extra) | ||
6434 | { | ||
6435 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6436 | struct ieee80211_device *ieee = priv->ieee; | ||
6437 | struct ieee80211_crypt_data *crypt; | ||
6438 | struct iw_param *param = &wrqu->param; | ||
6439 | int ret = 0; | ||
6440 | |||
6441 | switch (param->flags & IW_AUTH_INDEX) { | ||
6442 | case IW_AUTH_WPA_VERSION: | ||
6443 | case IW_AUTH_CIPHER_PAIRWISE: | ||
6444 | case IW_AUTH_CIPHER_GROUP: | ||
6445 | case IW_AUTH_KEY_MGMT: | ||
6446 | /* | ||
6447 | * wpa_supplicant will control these internally | ||
6448 | */ | ||
6449 | ret = -EOPNOTSUPP; | ||
6450 | break; | ||
6451 | |||
6452 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
6453 | crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; | ||
6454 | if (!crypt || !crypt->ops->get_flags) | ||
6455 | break; | ||
6456 | |||
6457 | param->value = (crypt->ops->get_flags(crypt->priv) & | ||
6458 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; | ||
6459 | |||
6460 | break; | ||
6461 | |||
6462 | case IW_AUTH_DROP_UNENCRYPTED: | ||
6463 | param->value = ieee->drop_unencrypted; | ||
6464 | break; | ||
6465 | |||
6466 | case IW_AUTH_80211_AUTH_ALG: | ||
6467 | param->value = ieee->sec.auth_mode; | ||
6468 | break; | ||
6469 | |||
6470 | case IW_AUTH_WPA_ENABLED: | ||
6471 | param->value = ieee->wpa_enabled; | ||
6472 | break; | ||
6473 | |||
6474 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
6475 | param->value = ieee->ieee802_1x; | ||
6476 | break; | ||
6477 | |||
6478 | case IW_AUTH_ROAMING_CONTROL: | ||
6479 | case IW_AUTH_PRIVACY_INVOKED: | ||
6480 | param->value = ieee->privacy_invoked; | ||
6481 | break; | ||
6482 | |||
6483 | default: | ||
6484 | return -EOPNOTSUPP; | ||
6485 | } | ||
6486 | return 0; | ||
6487 | } | ||
6488 | |||
6489 | /* SIOCSIWENCODEEXT */ | ||
6490 | static int ipw_wx_set_encodeext(struct net_device *dev, | ||
6491 | struct iw_request_info *info, | ||
6492 | union iwreq_data *wrqu, char *extra) | ||
6493 | { | ||
6494 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6495 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
6496 | |||
6497 | if (hwcrypto) { | ||
6498 | if (ext->alg == IW_ENCODE_ALG_TKIP) { | ||
6499 | /* IPW HW can't build TKIP MIC, | ||
6500 | host decryption still needed */ | ||
6501 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | ||
6502 | priv->ieee->host_mc_decrypt = 1; | ||
6503 | else { | ||
6504 | priv->ieee->host_encrypt = 0; | ||
6505 | priv->ieee->host_encrypt_msdu = 1; | ||
6506 | priv->ieee->host_decrypt = 1; | ||
6507 | } | ||
6508 | } else { | ||
6509 | priv->ieee->host_encrypt = 0; | ||
6510 | priv->ieee->host_encrypt_msdu = 0; | ||
6511 | priv->ieee->host_decrypt = 0; | ||
6512 | priv->ieee->host_mc_decrypt = 0; | ||
6513 | } | ||
6514 | } | ||
6515 | |||
6516 | return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); | ||
6517 | } | ||
6518 | |||
6519 | /* SIOCGIWENCODEEXT */ | ||
6520 | static int ipw_wx_get_encodeext(struct net_device *dev, | ||
6521 | struct iw_request_info *info, | ||
6522 | union iwreq_data *wrqu, char *extra) | ||
6523 | { | ||
6524 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6525 | return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); | ||
6526 | } | ||
6527 | |||
6528 | /* SIOCSIWMLME */ | ||
6529 | static int ipw_wx_set_mlme(struct net_device *dev, | ||
6530 | struct iw_request_info *info, | ||
6531 | union iwreq_data *wrqu, char *extra) | ||
6532 | { | ||
6533 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6534 | struct iw_mlme *mlme = (struct iw_mlme *)extra; | ||
6535 | u16 reason; | ||
6536 | |||
6537 | reason = cpu_to_le16(mlme->reason_code); | ||
6538 | |||
6539 | switch (mlme->cmd) { | ||
6540 | case IW_MLME_DEAUTH: | ||
6541 | // silently ignore | ||
6542 | break; | ||
6543 | |||
6544 | case IW_MLME_DISASSOC: | ||
6545 | ipw_disassociate(priv); | ||
6546 | break; | ||
6547 | |||
6548 | default: | ||
6549 | return -EOPNOTSUPP; | ||
6550 | } | ||
6551 | return 0; | ||
6552 | } | ||
6553 | |||
6554 | #ifdef CONFIG_IPW_QOS | ||
6555 | |||
6556 | /* QoS */ | ||
6557 | /* | ||
6558 | * get the modulation type of the current network or | ||
6559 | * the card current mode | ||
6560 | */ | ||
6561 | u8 ipw_qos_current_mode(struct ipw_priv * priv) | ||
6562 | { | ||
6563 | u8 mode = 0; | ||
6564 | |||
6565 | if (priv->status & STATUS_ASSOCIATED) { | ||
6566 | unsigned long flags; | ||
6567 | |||
6568 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6569 | mode = priv->assoc_network->mode; | ||
6570 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6571 | } else { | ||
6572 | mode = priv->ieee->mode; | ||
6573 | } | ||
6574 | IPW_DEBUG_QOS("QoS network/card mode %d \n", mode); | ||
6575 | return mode; | ||
6576 | } | ||
6577 | |||
6578 | /* | ||
6579 | * Handle management frame beacon and probe response | ||
6580 | */ | ||
6581 | static int ipw_qos_handle_probe_response(struct ipw_priv *priv, | ||
6582 | int active_network, | ||
6583 | struct ieee80211_network *network) | ||
6584 | { | ||
6585 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6586 | |||
6587 | if (network->capability & WLAN_CAPABILITY_IBSS) | ||
6588 | network->qos_data.active = network->qos_data.supported; | ||
6589 | |||
6590 | if (network->flags & NETWORK_HAS_QOS_MASK) { | ||
6591 | if (active_network && | ||
6592 | (network->flags & NETWORK_HAS_QOS_PARAMETERS)) | ||
6593 | network->qos_data.active = network->qos_data.supported; | ||
6594 | |||
6595 | if ((network->qos_data.active == 1) && (active_network == 1) && | ||
6596 | (network->flags & NETWORK_HAS_QOS_PARAMETERS) && | ||
6597 | (network->qos_data.old_param_count != | ||
6598 | network->qos_data.param_count)) { | ||
6599 | network->qos_data.old_param_count = | ||
6600 | network->qos_data.param_count; | ||
6601 | schedule_work(&priv->qos_activate); | ||
6602 | IPW_DEBUG_QOS("QoS parameters change call " | ||
6603 | "qos_activate\n"); | ||
6604 | } | ||
6605 | } else { | ||
6606 | if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) | ||
6607 | memcpy(&network->qos_data.parameters, | ||
6608 | &def_parameters_CCK, size); | ||
6609 | else | ||
6610 | memcpy(&network->qos_data.parameters, | ||
6611 | &def_parameters_OFDM, size); | ||
6612 | |||
6613 | if ((network->qos_data.active == 1) && (active_network == 1)) { | ||
6614 | IPW_DEBUG_QOS("QoS was disabled call qos_activate \n"); | ||
6615 | schedule_work(&priv->qos_activate); | ||
6616 | } | ||
6617 | |||
6618 | network->qos_data.active = 0; | ||
6619 | network->qos_data.supported = 0; | ||
6620 | } | ||
6621 | if ((priv->status & STATUS_ASSOCIATED) && | ||
6622 | (priv->ieee->iw_mode == IW_MODE_ADHOC) && (active_network == 0)) { | ||
6623 | if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) | ||
6624 | if ((network->capability & WLAN_CAPABILITY_IBSS) && | ||
6625 | !(network->flags & NETWORK_EMPTY_ESSID)) | ||
6626 | if ((network->ssid_len == | ||
6627 | priv->assoc_network->ssid_len) && | ||
6628 | !memcmp(network->ssid, | ||
6629 | priv->assoc_network->ssid, | ||
6630 | network->ssid_len)) { | ||
6631 | queue_work(priv->workqueue, | ||
6632 | &priv->merge_networks); | ||
6633 | } | ||
6634 | } | ||
6635 | |||
6636 | return 0; | ||
6637 | } | ||
6638 | |||
6639 | /* | ||
6640 | * This function set up the firmware to support QoS. It sends | ||
6641 | * IPW_CMD_QOS_PARAMETERS and IPW_CMD_WME_INFO | ||
6642 | */ | ||
6643 | static int ipw_qos_activate(struct ipw_priv *priv, | ||
6644 | struct ieee80211_qos_data *qos_network_data) | ||
6645 | { | ||
6646 | int err; | ||
6647 | struct ieee80211_qos_parameters qos_parameters[QOS_QOS_SETS]; | ||
6648 | struct ieee80211_qos_parameters *active_one = NULL; | ||
6649 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6650 | u32 burst_duration; | ||
6651 | int i; | ||
6652 | u8 type; | ||
6653 | |||
6654 | type = ipw_qos_current_mode(priv); | ||
6655 | |||
6656 | active_one = &(qos_parameters[QOS_PARAM_SET_DEF_CCK]); | ||
6657 | memcpy(active_one, priv->qos_data.def_qos_parm_CCK, size); | ||
6658 | active_one = &(qos_parameters[QOS_PARAM_SET_DEF_OFDM]); | ||
6659 | memcpy(active_one, priv->qos_data.def_qos_parm_OFDM, size); | ||
6660 | |||
6661 | if (qos_network_data == NULL) { | ||
6662 | if (type == IEEE_B) { | ||
6663 | IPW_DEBUG_QOS("QoS activate network mode %d\n", type); | ||
6664 | active_one = &def_parameters_CCK; | ||
6665 | } else | ||
6666 | active_one = &def_parameters_OFDM; | ||
6667 | |||
6668 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6669 | burst_duration = ipw_qos_get_burst_duration(priv); | ||
6670 | for (i = 0; i < QOS_QUEUE_NUM; i++) | ||
6671 | qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] = | ||
6672 | (u16) burst_duration; | ||
6673 | } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | ||
6674 | if (type == IEEE_B) { | ||
6675 | IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n", | ||
6676 | type); | ||
6677 | if (priv->qos_data.qos_enable == 0) | ||
6678 | active_one = &def_parameters_CCK; | ||
6679 | else | ||
6680 | active_one = priv->qos_data.def_qos_parm_CCK; | ||
6681 | } else { | ||
6682 | if (priv->qos_data.qos_enable == 0) | ||
6683 | active_one = &def_parameters_OFDM; | ||
6684 | else | ||
6685 | active_one = priv->qos_data.def_qos_parm_OFDM; | ||
6686 | } | ||
6687 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6688 | } else { | ||
6689 | unsigned long flags; | ||
6690 | int active; | ||
6691 | |||
6692 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6693 | active_one = &(qos_network_data->parameters); | ||
6694 | qos_network_data->old_param_count = | ||
6695 | qos_network_data->param_count; | ||
6696 | memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); | ||
6697 | active = qos_network_data->supported; | ||
6698 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6699 | |||
6700 | if (active == 0) { | ||
6701 | burst_duration = ipw_qos_get_burst_duration(priv); | ||
6702 | for (i = 0; i < QOS_QUEUE_NUM; i++) | ||
6703 | qos_parameters[QOS_PARAM_SET_ACTIVE]. | ||
6704 | tx_op_limit[i] = (u16) burst_duration; | ||
6705 | } | ||
6706 | } | ||
6707 | |||
6708 | IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); | ||
6709 | err = ipw_send_qos_params_command(priv, | ||
6710 | (struct ieee80211_qos_parameters *) | ||
6711 | &(qos_parameters[0])); | ||
6712 | if (err) | ||
6713 | IPW_DEBUG_QOS("QoS IPW_CMD_QOS_PARAMETERS failed\n"); | ||
6714 | |||
6715 | return err; | ||
6716 | } | ||
6717 | |||
6718 | /* | ||
6719 | * send IPW_CMD_WME_INFO to the firmware | ||
6720 | */ | ||
6721 | static int ipw_qos_set_info_element(struct ipw_priv *priv) | ||
6722 | { | ||
6723 | int ret = 0; | ||
6724 | struct ieee80211_qos_information_element qos_info; | ||
6725 | |||
6726 | if (priv == NULL) | ||
6727 | return -1; | ||
6728 | |||
6729 | qos_info.elementID = QOS_ELEMENT_ID; | ||
6730 | qos_info.length = sizeof(struct ieee80211_qos_information_element) - 2; | ||
6731 | |||
6732 | qos_info.version = QOS_VERSION_1; | ||
6733 | qos_info.ac_info = 0; | ||
6734 | |||
6735 | memcpy(qos_info.qui, qos_oui, QOS_OUI_LEN); | ||
6736 | qos_info.qui_type = QOS_OUI_TYPE; | ||
6737 | qos_info.qui_subtype = QOS_OUI_INFO_SUB_TYPE; | ||
6738 | |||
6739 | ret = ipw_send_qos_info_command(priv, &qos_info); | ||
6740 | if (ret != 0) { | ||
6741 | IPW_DEBUG_QOS("QoS error calling ipw_send_qos_info_command\n"); | ||
6742 | } | ||
6743 | return ret; | ||
6744 | } | ||
6745 | |||
6746 | /* | ||
6747 | * Set the QoS parameter with the association request structure | ||
6748 | */ | ||
6749 | static int ipw_qos_association(struct ipw_priv *priv, | ||
6750 | struct ieee80211_network *network) | ||
6751 | { | ||
6752 | int err = 0; | ||
6753 | struct ieee80211_qos_data *qos_data = NULL; | ||
6754 | struct ieee80211_qos_data ibss_data = { | ||
6755 | .supported = 1, | ||
6756 | .active = 1, | ||
6757 | }; | ||
6758 | |||
6759 | switch (priv->ieee->iw_mode) { | ||
6760 | case IW_MODE_ADHOC: | ||
6761 | if (!(network->capability & WLAN_CAPABILITY_IBSS)) | ||
6762 | BUG(); | ||
6763 | |||
6764 | qos_data = &ibss_data; | ||
6765 | break; | ||
6766 | |||
6767 | case IW_MODE_INFRA: | ||
6768 | qos_data = &network->qos_data; | ||
6769 | break; | ||
6770 | |||
6771 | default: | ||
6772 | BUG(); | ||
6773 | break; | ||
6774 | } | ||
6775 | |||
6776 | err = ipw_qos_activate(priv, qos_data); | ||
6777 | if (err) { | ||
6778 | priv->assoc_request.policy_support &= ~HC_QOS_SUPPORT_ASSOC; | ||
6779 | return err; | ||
6780 | } | ||
6781 | |||
6782 | if (priv->qos_data.qos_enable && qos_data->supported) { | ||
6783 | IPW_DEBUG_QOS("QoS will be enabled for this association\n"); | ||
6784 | priv->assoc_request.policy_support |= HC_QOS_SUPPORT_ASSOC; | ||
6785 | return ipw_qos_set_info_element(priv); | ||
6786 | } | ||
6787 | |||
6788 | return 0; | ||
6789 | } | ||
6790 | |||
6791 | /* | ||
6792 | * handling the beaconing responces. if we get different QoS setting | ||
6793 | * of the network from the the associated setting adjust the QoS | ||
6794 | * setting | ||
6795 | */ | ||
6796 | static int ipw_qos_association_resp(struct ipw_priv *priv, | ||
6797 | struct ieee80211_network *network) | ||
6798 | { | ||
6799 | int ret = 0; | ||
6800 | unsigned long flags; | ||
6801 | u32 size = sizeof(struct ieee80211_qos_parameters); | ||
6802 | int set_qos_param = 0; | ||
6803 | |||
6804 | if ((priv == NULL) || (network == NULL) || | ||
6805 | (priv->assoc_network == NULL)) | ||
6806 | return ret; | ||
6807 | |||
6808 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
6809 | return ret; | ||
6810 | |||
6811 | if ((priv->ieee->iw_mode != IW_MODE_INFRA)) | ||
6812 | return ret; | ||
6813 | |||
6814 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6815 | if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { | ||
6816 | memcpy(&priv->assoc_network->qos_data, &network->qos_data, | ||
6817 | sizeof(struct ieee80211_qos_data)); | ||
6818 | priv->assoc_network->qos_data.active = 1; | ||
6819 | if ((network->qos_data.old_param_count != | ||
6820 | network->qos_data.param_count)) { | ||
6821 | set_qos_param = 1; | ||
6822 | network->qos_data.old_param_count = | ||
6823 | network->qos_data.param_count; | ||
6824 | } | ||
6825 | |||
6826 | } else { | ||
6827 | if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) | ||
6828 | memcpy(&priv->assoc_network->qos_data.parameters, | ||
6829 | &def_parameters_CCK, size); | ||
6830 | else | ||
6831 | memcpy(&priv->assoc_network->qos_data.parameters, | ||
6832 | &def_parameters_OFDM, size); | ||
6833 | priv->assoc_network->qos_data.active = 0; | ||
6834 | priv->assoc_network->qos_data.supported = 0; | ||
6835 | set_qos_param = 1; | ||
6836 | } | ||
6837 | |||
6838 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6839 | |||
6840 | if (set_qos_param == 1) | ||
6841 | schedule_work(&priv->qos_activate); | ||
6842 | |||
6843 | return ret; | ||
6844 | } | ||
6845 | |||
6846 | static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv) | ||
6847 | { | ||
6848 | u32 ret = 0; | ||
6849 | |||
6850 | if ((priv == NULL)) | ||
6851 | return 0; | ||
6852 | |||
6853 | if (!(priv->ieee->modulation & IEEE80211_OFDM_MODULATION)) | ||
6854 | ret = priv->qos_data.burst_duration_CCK; | ||
6855 | else | ||
6856 | ret = priv->qos_data.burst_duration_OFDM; | ||
6857 | |||
6858 | return ret; | ||
6859 | } | ||
6860 | |||
6861 | /* | ||
6862 | * Initialize the setting of QoS global | ||
6863 | */ | ||
6864 | static void ipw_qos_init(struct ipw_priv *priv, int enable, | ||
6865 | int burst_enable, u32 burst_duration_CCK, | ||
6866 | u32 burst_duration_OFDM) | ||
6867 | { | ||
6868 | priv->qos_data.qos_enable = enable; | ||
6869 | |||
6870 | if (priv->qos_data.qos_enable) { | ||
6871 | priv->qos_data.def_qos_parm_CCK = &def_qos_parameters_CCK; | ||
6872 | priv->qos_data.def_qos_parm_OFDM = &def_qos_parameters_OFDM; | ||
6873 | IPW_DEBUG_QOS("QoS is enabled\n"); | ||
6874 | } else { | ||
6875 | priv->qos_data.def_qos_parm_CCK = &def_parameters_CCK; | ||
6876 | priv->qos_data.def_qos_parm_OFDM = &def_parameters_OFDM; | ||
6877 | IPW_DEBUG_QOS("QoS is not enabled\n"); | ||
6878 | } | ||
6879 | |||
6880 | priv->qos_data.burst_enable = burst_enable; | ||
6881 | |||
6882 | if (burst_enable) { | ||
6883 | priv->qos_data.burst_duration_CCK = burst_duration_CCK; | ||
6884 | priv->qos_data.burst_duration_OFDM = burst_duration_OFDM; | ||
6885 | } else { | ||
6886 | priv->qos_data.burst_duration_CCK = 0; | ||
6887 | priv->qos_data.burst_duration_OFDM = 0; | ||
6888 | } | ||
6889 | } | ||
6890 | |||
6891 | /* | ||
6892 | * map the packet priority to the right TX Queue | ||
6893 | */ | ||
6894 | static int ipw_get_tx_queue_number(struct ipw_priv *priv, u16 priority) | ||
6895 | { | ||
6896 | if (priority > 7 || !priv->qos_data.qos_enable) | ||
6897 | priority = 0; | ||
6898 | |||
6899 | return from_priority_to_tx_queue[priority] - 1; | ||
6900 | } | ||
6901 | |||
6902 | /* | ||
6903 | * add QoS parameter to the TX command | ||
6904 | */ | ||
6905 | static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv, | ||
6906 | u16 priority, | ||
6907 | struct tfd_data *tfd, u8 unicast) | ||
6908 | { | ||
6909 | int ret = 0; | ||
6910 | int tx_queue_id = 0; | ||
6911 | struct ieee80211_qos_data *qos_data = NULL; | ||
6912 | int active, supported; | ||
6913 | unsigned long flags; | ||
6914 | |||
6915 | if (!(priv->status & STATUS_ASSOCIATED)) | ||
6916 | return 0; | ||
6917 | |||
6918 | qos_data = &priv->assoc_network->qos_data; | ||
6919 | |||
6920 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
6921 | |||
6922 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | ||
6923 | if (unicast == 0) | ||
6924 | qos_data->active = 0; | ||
6925 | else | ||
6926 | qos_data->active = qos_data->supported; | ||
6927 | } | ||
6928 | |||
6929 | active = qos_data->active; | ||
6930 | supported = qos_data->supported; | ||
6931 | |||
6932 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
6933 | |||
6934 | IPW_DEBUG_QOS("QoS %d network is QoS active %d supported %d " | ||
6935 | "unicast %d\n", | ||
6936 | priv->qos_data.qos_enable, active, supported, unicast); | ||
6937 | if (active && priv->qos_data.qos_enable) { | ||
6938 | ret = from_priority_to_tx_queue[priority]; | ||
6939 | tx_queue_id = ret - 1; | ||
6940 | IPW_DEBUG_QOS("QoS packet priority is %d \n", priority); | ||
6941 | if (priority <= 7) { | ||
6942 | tfd->tx_flags_ext |= DCT_FLAG_EXT_QOS_ENABLED; | ||
6943 | tfd->tfd.tfd_26.mchdr.qos_ctrl = priority; | ||
6944 | tfd->tfd.tfd_26.mchdr.frame_ctl |= | ||
6945 | IEEE80211_STYPE_QOS_DATA; | ||
6946 | |||
6947 | if (priv->qos_data.qos_no_ack_mask & | ||
6948 | (1UL << tx_queue_id)) { | ||
6949 | tfd->tx_flags &= ~DCT_FLAG_ACK_REQD; | ||
6950 | tfd->tfd.tfd_26.mchdr.qos_ctrl |= | ||
6951 | CTRL_QOS_NO_ACK; | ||
6952 | } | ||
6953 | } | ||
6954 | } | ||
6955 | |||
6956 | return ret; | ||
6957 | } | ||
6958 | |||
6959 | /* | ||
6960 | * background support to run QoS activate functionality | ||
6961 | */ | ||
6962 | static void ipw_bg_qos_activate(void *data) | ||
6963 | { | ||
6964 | struct ipw_priv *priv = data; | ||
6965 | |||
6966 | if (priv == NULL) | ||
6967 | return; | ||
6968 | |||
6969 | down(&priv->sem); | ||
6970 | |||
6971 | if (priv->status & STATUS_ASSOCIATED) | ||
6972 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); | ||
6973 | |||
6974 | up(&priv->sem); | ||
6975 | } | ||
6976 | |||
6977 | static int ipw_handle_probe_response(struct net_device *dev, | ||
6978 | struct ieee80211_probe_response *resp, | ||
6979 | struct ieee80211_network *network) | ||
6980 | { | ||
6981 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6982 | int active_network = ((priv->status & STATUS_ASSOCIATED) && | ||
6983 | (network == priv->assoc_network)); | ||
6984 | |||
6985 | ipw_qos_handle_probe_response(priv, active_network, network); | ||
6986 | |||
6987 | return 0; | ||
6988 | } | ||
6989 | |||
6990 | static int ipw_handle_beacon(struct net_device *dev, | ||
6991 | struct ieee80211_beacon *resp, | ||
6992 | struct ieee80211_network *network) | ||
6993 | { | ||
6994 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
6995 | int active_network = ((priv->status & STATUS_ASSOCIATED) && | ||
6996 | (network == priv->assoc_network)); | ||
6997 | |||
6998 | ipw_qos_handle_probe_response(priv, active_network, network); | ||
6999 | |||
7000 | return 0; | ||
7001 | } | ||
7002 | |||
7003 | static int ipw_handle_assoc_response(struct net_device *dev, | ||
7004 | struct ieee80211_assoc_response *resp, | ||
7005 | struct ieee80211_network *network) | ||
7006 | { | ||
7007 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
7008 | ipw_qos_association_resp(priv, network); | ||
7009 | return 0; | ||
7010 | } | ||
7011 | |||
7012 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | ||
7013 | *qos_param) | ||
7014 | { | ||
7015 | struct host_cmd cmd = { | ||
7016 | .cmd = IPW_CMD_QOS_PARAMETERS, | ||
7017 | .len = (sizeof(struct ieee80211_qos_parameters) * 3) | ||
7018 | }; | ||
7019 | |||
7020 | memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); | ||
7021 | return ipw_send_cmd(priv, &cmd); | ||
7022 | } | ||
7023 | |||
7024 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | ||
7025 | *qos_param) | ||
7026 | { | ||
7027 | struct host_cmd cmd = { | ||
7028 | .cmd = IPW_CMD_WME_INFO, | ||
7029 | .len = sizeof(*qos_param) | ||
7030 | }; | ||
7031 | |||
7032 | memcpy(cmd.param, qos_param, sizeof(*qos_param)); | ||
7033 | return ipw_send_cmd(priv, &cmd); | ||
7034 | } | ||
7035 | |||
7036 | #endif /* CONFIG_IPW_QOS */ | ||
7037 | |||
4612 | static int ipw_associate_network(struct ipw_priv *priv, | 7038 | static int ipw_associate_network(struct ipw_priv *priv, |
4613 | struct ieee80211_network *network, | 7039 | struct ieee80211_network *network, |
4614 | struct ipw_supported_rates *rates, int roaming) | 7040 | struct ipw_supported_rates *rates, int roaming) |
@@ -4616,7 +7042,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4616 | int err; | 7042 | int err; |
4617 | 7043 | ||
4618 | if (priv->config & CFG_FIXED_RATE) | 7044 | if (priv->config & CFG_FIXED_RATE) |
4619 | ipw_set_fixed_rate(priv, network); | 7045 | ipw_set_fixed_rate(priv, network->mode); |
4620 | 7046 | ||
4621 | if (!(priv->config & CFG_STATIC_ESSID)) { | 7047 | if (!(priv->config & CFG_STATIC_ESSID)) { |
4622 | priv->essid_len = min(network->ssid_len, | 7048 | priv->essid_len = min(network->ssid_len, |
@@ -4631,14 +7057,22 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4631 | if ((priv->capability & CAP_PRIVACY_ON) && | 7057 | if ((priv->capability & CAP_PRIVACY_ON) && |
4632 | (priv->capability & CAP_SHARED_KEY)) { | 7058 | (priv->capability & CAP_SHARED_KEY)) { |
4633 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; | 7059 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; |
4634 | priv->assoc_request.auth_key = priv->sec.active_key; | 7060 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; |
7061 | |||
7062 | if ((priv->capability & CAP_PRIVACY_ON) && | ||
7063 | (priv->ieee->sec.level == SEC_LEVEL_1) && | ||
7064 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) | ||
7065 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | ||
4635 | } else { | 7066 | } else { |
4636 | priv->assoc_request.auth_type = AUTH_OPEN; | 7067 | priv->assoc_request.auth_type = AUTH_OPEN; |
4637 | priv->assoc_request.auth_key = 0; | 7068 | priv->assoc_request.auth_key = 0; |
4638 | } | 7069 | } |
4639 | 7070 | ||
4640 | if (priv->capability & CAP_PRIVACY_ON) | 7071 | if (priv->ieee->wpa_ie_len) { |
4641 | ipw_send_wep_keys(priv); | 7072 | priv->assoc_request.policy_support = 0x02; /* RSN active */ |
7073 | ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, | ||
7074 | priv->ieee->wpa_ie_len); | ||
7075 | } | ||
4642 | 7076 | ||
4643 | /* | 7077 | /* |
4644 | * It is valid for our ieee device to support multiple modes, but | 7078 | * It is valid for our ieee device to support multiple modes, but |
@@ -4652,20 +7086,41 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4652 | else if (network->mode & priv->ieee->mode & IEEE_B) | 7086 | else if (network->mode & priv->ieee->mode & IEEE_B) |
4653 | priv->assoc_request.ieee_mode = IPW_B_MODE; | 7087 | priv->assoc_request.ieee_mode = IPW_B_MODE; |
4654 | 7088 | ||
7089 | priv->assoc_request.capability = network->capability; | ||
7090 | if ((network->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
7091 | && !(priv->config & CFG_PREAMBLE_LONG)) { | ||
7092 | priv->assoc_request.preamble_length = DCT_FLAG_SHORT_PREAMBLE; | ||
7093 | } else { | ||
7094 | priv->assoc_request.preamble_length = DCT_FLAG_LONG_PREAMBLE; | ||
7095 | |||
7096 | /* Clear the short preamble if we won't be supporting it */ | ||
7097 | priv->assoc_request.capability &= | ||
7098 | ~WLAN_CAPABILITY_SHORT_PREAMBLE; | ||
7099 | } | ||
7100 | |||
7101 | /* Clear capability bits that aren't used in Ad Hoc */ | ||
7102 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
7103 | priv->assoc_request.capability &= | ||
7104 | ~WLAN_CAPABILITY_SHORT_SLOT_TIME; | ||
7105 | |||
4655 | IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " | 7106 | IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " |
4656 | "802.11%c [%d], enc=%s%s%s%c%c\n", | 7107 | "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", |
4657 | roaming ? "Rea" : "A", | 7108 | roaming ? "Rea" : "A", |
4658 | escape_essid(priv->essid, priv->essid_len), | 7109 | escape_essid(priv->essid, priv->essid_len), |
4659 | network->channel, | 7110 | network->channel, |
4660 | ipw_modes[priv->assoc_request.ieee_mode], | 7111 | ipw_modes[priv->assoc_request.ieee_mode], |
4661 | rates->num_rates, | 7112 | rates->num_rates, |
7113 | (priv->assoc_request.preamble_length == | ||
7114 | DCT_FLAG_LONG_PREAMBLE) ? "long" : "short", | ||
7115 | network->capability & | ||
7116 | WLAN_CAPABILITY_SHORT_PREAMBLE ? "short" : "long", | ||
4662 | priv->capability & CAP_PRIVACY_ON ? "on " : "off", | 7117 | priv->capability & CAP_PRIVACY_ON ? "on " : "off", |
4663 | priv->capability & CAP_PRIVACY_ON ? | 7118 | priv->capability & CAP_PRIVACY_ON ? |
4664 | (priv->capability & CAP_SHARED_KEY ? "(shared)" : | 7119 | (priv->capability & CAP_SHARED_KEY ? "(shared)" : |
4665 | "(open)") : "", | 7120 | "(open)") : "", |
4666 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", | 7121 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", |
4667 | priv->capability & CAP_PRIVACY_ON ? | 7122 | priv->capability & CAP_PRIVACY_ON ? |
4668 | '1' + priv->sec.active_key : '.', | 7123 | '1' + priv->ieee->sec.active_key : '.', |
4669 | priv->capability & CAP_PRIVACY_ON ? '.' : ' '); | 7124 | priv->capability & CAP_PRIVACY_ON ? '.' : ' '); |
4670 | 7125 | ||
4671 | priv->assoc_request.beacon_interval = network->beacon_interval; | 7126 | priv->assoc_request.beacon_interval = network->beacon_interval; |
@@ -4683,17 +7138,16 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4683 | priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; | 7138 | priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; |
4684 | } | 7139 | } |
4685 | 7140 | ||
4686 | memcpy(&priv->assoc_request.bssid, network->bssid, ETH_ALEN); | 7141 | memcpy(priv->assoc_request.bssid, network->bssid, ETH_ALEN); |
4687 | 7142 | ||
4688 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 7143 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
4689 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); | 7144 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); |
4690 | priv->assoc_request.atim_window = network->atim_window; | 7145 | priv->assoc_request.atim_window = network->atim_window; |
4691 | } else { | 7146 | } else { |
4692 | memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); | 7147 | memcpy(priv->assoc_request.dest, network->bssid, ETH_ALEN); |
4693 | priv->assoc_request.atim_window = 0; | 7148 | priv->assoc_request.atim_window = 0; |
4694 | } | 7149 | } |
4695 | 7150 | ||
4696 | priv->assoc_request.capability = network->capability; | ||
4697 | priv->assoc_request.listen_interval = network->listen_interval; | 7151 | priv->assoc_request.listen_interval = network->listen_interval; |
4698 | 7152 | ||
4699 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | 7153 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); |
@@ -4710,6 +7164,12 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4710 | priv->sys_config.dot11g_auto_detection = 1; | 7164 | priv->sys_config.dot11g_auto_detection = 1; |
4711 | else | 7165 | else |
4712 | priv->sys_config.dot11g_auto_detection = 0; | 7166 | priv->sys_config.dot11g_auto_detection = 0; |
7167 | |||
7168 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
7169 | priv->sys_config.answer_broadcast_ssid_probe = 1; | ||
7170 | else | ||
7171 | priv->sys_config.answer_broadcast_ssid_probe = 0; | ||
7172 | |||
4713 | err = ipw_send_system_config(priv, &priv->sys_config); | 7173 | err = ipw_send_system_config(priv, &priv->sys_config); |
4714 | if (err) { | 7174 | if (err) { |
4715 | IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); | 7175 | IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); |
@@ -4717,7 +7177,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4717 | } | 7177 | } |
4718 | 7178 | ||
4719 | IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); | 7179 | IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); |
4720 | err = ipw_set_sensitivity(priv, network->stats.rssi); | 7180 | err = ipw_set_sensitivity(priv, network->stats.rssi + IPW_RSSI_TO_DBM); |
4721 | if (err) { | 7181 | if (err) { |
4722 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); | 7182 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); |
4723 | return err; | 7183 | return err; |
@@ -4735,6 +7195,10 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4735 | 7195 | ||
4736 | priv->assoc_network = network; | 7196 | priv->assoc_network = network; |
4737 | 7197 | ||
7198 | #ifdef CONFIG_IPW_QOS | ||
7199 | ipw_qos_association(priv, network); | ||
7200 | #endif | ||
7201 | |||
4738 | err = ipw_send_associate(priv, &priv->assoc_request); | 7202 | err = ipw_send_associate(priv, &priv->assoc_request); |
4739 | if (err) { | 7203 | if (err) { |
4740 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); | 7204 | IPW_DEBUG_HC("Attempt to send associate command failed.\n"); |
@@ -4782,12 +7246,15 @@ static void ipw_roam(void *data) | |||
4782 | if (priv->status & STATUS_ASSOCIATED) { | 7246 | if (priv->status & STATUS_ASSOCIATED) { |
4783 | /* First pass through ROAM process -- look for a better | 7247 | /* First pass through ROAM process -- look for a better |
4784 | * network */ | 7248 | * network */ |
7249 | unsigned long flags; | ||
4785 | u8 rssi = priv->assoc_network->stats.rssi; | 7250 | u8 rssi = priv->assoc_network->stats.rssi; |
4786 | priv->assoc_network->stats.rssi = -128; | 7251 | priv->assoc_network->stats.rssi = -128; |
7252 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
4787 | list_for_each_entry(network, &priv->ieee->network_list, list) { | 7253 | list_for_each_entry(network, &priv->ieee->network_list, list) { |
4788 | if (network != priv->assoc_network) | 7254 | if (network != priv->assoc_network) |
4789 | ipw_best_network(priv, &match, network, 1); | 7255 | ipw_best_network(priv, &match, network, 1); |
4790 | } | 7256 | } |
7257 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
4791 | priv->assoc_network->stats.rssi = rssi; | 7258 | priv->assoc_network->stats.rssi = rssi; |
4792 | 7259 | ||
4793 | if (match.network == priv->assoc_network) { | 7260 | if (match.network == priv->assoc_network) { |
@@ -4810,7 +7277,15 @@ static void ipw_roam(void *data) | |||
4810 | priv->status &= ~STATUS_ROAMING; | 7277 | priv->status &= ~STATUS_ROAMING; |
4811 | } | 7278 | } |
4812 | 7279 | ||
4813 | static void ipw_associate(void *data) | 7280 | static void ipw_bg_roam(void *data) |
7281 | { | ||
7282 | struct ipw_priv *priv = data; | ||
7283 | down(&priv->sem); | ||
7284 | ipw_roam(data); | ||
7285 | up(&priv->sem); | ||
7286 | } | ||
7287 | |||
7288 | static int ipw_associate(void *data) | ||
4814 | { | 7289 | { |
4815 | struct ipw_priv *priv = data; | 7290 | struct ipw_priv *priv = data; |
4816 | 7291 | ||
@@ -4820,14 +7295,41 @@ static void ipw_associate(void *data) | |||
4820 | }; | 7295 | }; |
4821 | struct ipw_supported_rates *rates; | 7296 | struct ipw_supported_rates *rates; |
4822 | struct list_head *element; | 7297 | struct list_head *element; |
7298 | unsigned long flags; | ||
7299 | |||
7300 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | ||
7301 | IPW_DEBUG_ASSOC("Not attempting association (monitor mode)\n"); | ||
7302 | return 0; | ||
7303 | } | ||
7304 | |||
7305 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | ||
7306 | IPW_DEBUG_ASSOC("Not attempting association (already in " | ||
7307 | "progress)\n"); | ||
7308 | return 0; | ||
7309 | } | ||
7310 | |||
7311 | if (priv->status & STATUS_DISASSOCIATING) { | ||
7312 | IPW_DEBUG_ASSOC("Not attempting association (in " | ||
7313 | "disassociating)\n "); | ||
7314 | queue_work(priv->workqueue, &priv->associate); | ||
7315 | return 0; | ||
7316 | } | ||
7317 | |||
7318 | if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { | ||
7319 | IPW_DEBUG_ASSOC("Not attempting association (scanning or not " | ||
7320 | "initialized)\n"); | ||
7321 | return 0; | ||
7322 | } | ||
4823 | 7323 | ||
4824 | if (!(priv->config & CFG_ASSOCIATE) && | 7324 | if (!(priv->config & CFG_ASSOCIATE) && |
4825 | !(priv->config & (CFG_STATIC_ESSID | | 7325 | !(priv->config & (CFG_STATIC_ESSID | |
4826 | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { | 7326 | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { |
4827 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); | 7327 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); |
4828 | return; | 7328 | return 0; |
4829 | } | 7329 | } |
4830 | 7330 | ||
7331 | /* Protect our use of the network_list */ | ||
7332 | spin_lock_irqsave(&priv->ieee->lock, flags); | ||
4831 | list_for_each_entry(network, &priv->ieee->network_list, list) | 7333 | list_for_each_entry(network, &priv->ieee->network_list, list) |
4832 | ipw_best_network(priv, &match, network, 0); | 7334 | ipw_best_network(priv, &match, network, 0); |
4833 | 7335 | ||
@@ -4838,6 +7340,7 @@ static void ipw_associate(void *data) | |||
4838 | priv->ieee->iw_mode == IW_MODE_ADHOC && | 7340 | priv->ieee->iw_mode == IW_MODE_ADHOC && |
4839 | priv->config & CFG_ADHOC_CREATE && | 7341 | priv->config & CFG_ADHOC_CREATE && |
4840 | priv->config & CFG_STATIC_ESSID && | 7342 | priv->config & CFG_STATIC_ESSID && |
7343 | priv->config & CFG_STATIC_CHANNEL && | ||
4841 | !list_empty(&priv->ieee->network_free_list)) { | 7344 | !list_empty(&priv->ieee->network_free_list)) { |
4842 | element = priv->ieee->network_free_list.next; | 7345 | element = priv->ieee->network_free_list.next; |
4843 | network = list_entry(element, struct ieee80211_network, list); | 7346 | network = list_entry(element, struct ieee80211_network, list); |
@@ -4846,25 +7349,83 @@ static void ipw_associate(void *data) | |||
4846 | list_del(element); | 7349 | list_del(element); |
4847 | list_add_tail(&network->list, &priv->ieee->network_list); | 7350 | list_add_tail(&network->list, &priv->ieee->network_list); |
4848 | } | 7351 | } |
7352 | spin_unlock_irqrestore(&priv->ieee->lock, flags); | ||
4849 | 7353 | ||
4850 | /* If we reached the end of the list, then we don't have any valid | 7354 | /* If we reached the end of the list, then we don't have any valid |
4851 | * matching APs */ | 7355 | * matching APs */ |
4852 | if (!network) { | 7356 | if (!network) { |
4853 | ipw_debug_config(priv); | 7357 | ipw_debug_config(priv); |
4854 | 7358 | ||
4855 | queue_delayed_work(priv->workqueue, &priv->request_scan, | 7359 | if (!(priv->status & STATUS_SCANNING)) { |
4856 | SCAN_INTERVAL); | 7360 | if (!(priv->config & CFG_SPEED_SCAN)) |
7361 | queue_delayed_work(priv->workqueue, | ||
7362 | &priv->request_scan, | ||
7363 | SCAN_INTERVAL); | ||
7364 | else | ||
7365 | queue_work(priv->workqueue, | ||
7366 | &priv->request_scan); | ||
7367 | } | ||
4857 | 7368 | ||
4858 | return; | 7369 | return 0; |
4859 | } | 7370 | } |
4860 | 7371 | ||
4861 | ipw_associate_network(priv, network, rates, 0); | 7372 | ipw_associate_network(priv, network, rates, 0); |
7373 | |||
7374 | return 1; | ||
4862 | } | 7375 | } |
4863 | 7376 | ||
4864 | static inline void ipw_handle_data_packet(struct ipw_priv *priv, | 7377 | static void ipw_bg_associate(void *data) |
4865 | struct ipw_rx_mem_buffer *rxb, | ||
4866 | struct ieee80211_rx_stats *stats) | ||
4867 | { | 7378 | { |
7379 | struct ipw_priv *priv = data; | ||
7380 | down(&priv->sem); | ||
7381 | ipw_associate(data); | ||
7382 | up(&priv->sem); | ||
7383 | } | ||
7384 | |||
7385 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, | ||
7386 | struct sk_buff *skb) | ||
7387 | { | ||
7388 | struct ieee80211_hdr *hdr; | ||
7389 | u16 fc; | ||
7390 | |||
7391 | hdr = (struct ieee80211_hdr *)skb->data; | ||
7392 | fc = le16_to_cpu(hdr->frame_ctl); | ||
7393 | if (!(fc & IEEE80211_FCTL_PROTECTED)) | ||
7394 | return; | ||
7395 | |||
7396 | fc &= ~IEEE80211_FCTL_PROTECTED; | ||
7397 | hdr->frame_ctl = cpu_to_le16(fc); | ||
7398 | switch (priv->ieee->sec.level) { | ||
7399 | case SEC_LEVEL_3: | ||
7400 | /* Remove CCMP HDR */ | ||
7401 | memmove(skb->data + IEEE80211_3ADDR_LEN, | ||
7402 | skb->data + IEEE80211_3ADDR_LEN + 8, | ||
7403 | skb->len - IEEE80211_3ADDR_LEN - 8); | ||
7404 | skb_trim(skb, skb->len - 16); /* CCMP_HDR_LEN + CCMP_MIC_LEN */ | ||
7405 | break; | ||
7406 | case SEC_LEVEL_2: | ||
7407 | break; | ||
7408 | case SEC_LEVEL_1: | ||
7409 | /* Remove IV */ | ||
7410 | memmove(skb->data + IEEE80211_3ADDR_LEN, | ||
7411 | skb->data + IEEE80211_3ADDR_LEN + 4, | ||
7412 | skb->len - IEEE80211_3ADDR_LEN - 4); | ||
7413 | skb_trim(skb, skb->len - 8); /* IV + ICV */ | ||
7414 | break; | ||
7415 | case SEC_LEVEL_0: | ||
7416 | break; | ||
7417 | default: | ||
7418 | printk(KERN_ERR "Unknow security level %d\n", | ||
7419 | priv->ieee->sec.level); | ||
7420 | break; | ||
7421 | } | ||
7422 | } | ||
7423 | |||
7424 | static void ipw_handle_data_packet(struct ipw_priv *priv, | ||
7425 | struct ipw_rx_mem_buffer *rxb, | ||
7426 | struct ieee80211_rx_stats *stats) | ||
7427 | { | ||
7428 | struct ieee80211_hdr_4addr *hdr; | ||
4868 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; | 7429 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; |
4869 | 7430 | ||
4870 | /* We received data from the HW, so stop the watchdog */ | 7431 | /* We received data from the HW, so stop the watchdog */ |
@@ -4872,7 +7433,7 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, | |||
4872 | 7433 | ||
4873 | /* We only process data packets if the | 7434 | /* We only process data packets if the |
4874 | * interface is open */ | 7435 | * interface is open */ |
4875 | if (unlikely((pkt->u.frame.length + IPW_RX_FRAME_SIZE) > | 7436 | if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > |
4876 | skb_tailroom(rxb->skb))) { | 7437 | skb_tailroom(rxb->skb))) { |
4877 | priv->ieee->stats.rx_errors++; | 7438 | priv->ieee->stats.rx_errors++; |
4878 | priv->wstats.discard.misc++; | 7439 | priv->wstats.discard.misc++; |
@@ -4889,14 +7450,351 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, | |||
4889 | skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); | 7450 | skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); |
4890 | 7451 | ||
4891 | /* Set the size of the skb to the size of the frame */ | 7452 | /* Set the size of the skb to the size of the frame */ |
4892 | skb_put(rxb->skb, pkt->u.frame.length); | 7453 | skb_put(rxb->skb, le16_to_cpu(pkt->u.frame.length)); |
4893 | 7454 | ||
4894 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); | 7455 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); |
4895 | 7456 | ||
7457 | /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ | ||
7458 | hdr = (struct ieee80211_hdr_4addr *)rxb->skb->data; | ||
7459 | if (priv->ieee->iw_mode != IW_MODE_MONITOR && | ||
7460 | ((is_multicast_ether_addr(hdr->addr1) || | ||
7461 | is_broadcast_ether_addr(hdr->addr1)) ? | ||
7462 | !priv->ieee->host_mc_decrypt : !priv->ieee->host_decrypt)) | ||
7463 | ipw_rebuild_decrypted_skb(priv, rxb->skb); | ||
7464 | |||
4896 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) | 7465 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) |
4897 | priv->ieee->stats.rx_errors++; | 7466 | priv->ieee->stats.rx_errors++; |
4898 | else /* ieee80211_rx succeeded, so it now owns the SKB */ | 7467 | else { /* ieee80211_rx succeeded, so it now owns the SKB */ |
4899 | rxb->skb = NULL; | 7468 | rxb->skb = NULL; |
7469 | __ipw_led_activity_on(priv); | ||
7470 | } | ||
7471 | } | ||
7472 | |||
7473 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
7474 | static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | ||
7475 | struct ipw_rx_mem_buffer *rxb, | ||
7476 | struct ieee80211_rx_stats *stats) | ||
7477 | { | ||
7478 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; | ||
7479 | struct ipw_rx_frame *frame = &pkt->u.frame; | ||
7480 | |||
7481 | /* initial pull of some data */ | ||
7482 | u16 received_channel = frame->received_channel; | ||
7483 | u8 antennaAndPhy = frame->antennaAndPhy; | ||
7484 | s8 antsignal = frame->rssi_dbm - IPW_RSSI_TO_DBM; /* call it signed anyhow */ | ||
7485 | u16 pktrate = frame->rate; | ||
7486 | |||
7487 | /* Magic struct that slots into the radiotap header -- no reason | ||
7488 | * to build this manually element by element, we can write it much | ||
7489 | * more efficiently than we can parse it. ORDER MATTERS HERE */ | ||
7490 | struct ipw_rt_hdr { | ||
7491 | struct ieee80211_radiotap_header rt_hdr; | ||
7492 | u8 rt_flags; /* radiotap packet flags */ | ||
7493 | u8 rt_rate; /* rate in 500kb/s */ | ||
7494 | u16 rt_channel; /* channel in mhz */ | ||
7495 | u16 rt_chbitmask; /* channel bitfield */ | ||
7496 | s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ | ||
7497 | u8 rt_antenna; /* antenna number */ | ||
7498 | } *ipw_rt; | ||
7499 | |||
7500 | short len = le16_to_cpu(pkt->u.frame.length); | ||
7501 | |||
7502 | /* We received data from the HW, so stop the watchdog */ | ||
7503 | priv->net_dev->trans_start = jiffies; | ||
7504 | |||
7505 | /* We only process data packets if the | ||
7506 | * interface is open */ | ||
7507 | if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > | ||
7508 | skb_tailroom(rxb->skb))) { | ||
7509 | priv->ieee->stats.rx_errors++; | ||
7510 | priv->wstats.discard.misc++; | ||
7511 | IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); | ||
7512 | return; | ||
7513 | } else if (unlikely(!netif_running(priv->net_dev))) { | ||
7514 | priv->ieee->stats.rx_dropped++; | ||
7515 | priv->wstats.discard.misc++; | ||
7516 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | ||
7517 | return; | ||
7518 | } | ||
7519 | |||
7520 | /* Libpcap 0.9.3+ can handle variable length radiotap, so we'll use | ||
7521 | * that now */ | ||
7522 | if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) { | ||
7523 | /* FIXME: Should alloc bigger skb instead */ | ||
7524 | priv->ieee->stats.rx_dropped++; | ||
7525 | priv->wstats.discard.misc++; | ||
7526 | IPW_DEBUG_DROP("Dropping too large packet in monitor\n"); | ||
7527 | return; | ||
7528 | } | ||
7529 | |||
7530 | /* copy the frame itself */ | ||
7531 | memmove(rxb->skb->data + sizeof(struct ipw_rt_hdr), | ||
7532 | rxb->skb->data + IPW_RX_FRAME_SIZE, len); | ||
7533 | |||
7534 | /* Zero the radiotap static buffer ... We only need to zero the bytes NOT | ||
7535 | * part of our real header, saves a little time. | ||
7536 | * | ||
7537 | * No longer necessary since we fill in all our data. Purge before merging | ||
7538 | * patch officially. | ||
7539 | * memset(rxb->skb->data + sizeof(struct ipw_rt_hdr), 0, | ||
7540 | * IEEE80211_RADIOTAP_HDRLEN - sizeof(struct ipw_rt_hdr)); | ||
7541 | */ | ||
7542 | |||
7543 | ipw_rt = (struct ipw_rt_hdr *)rxb->skb->data; | ||
7544 | |||
7545 | ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
7546 | ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ | ||
7547 | ipw_rt->rt_hdr.it_len = sizeof(struct ipw_rt_hdr); /* total header+data */ | ||
7548 | |||
7549 | /* Big bitfield of all the fields we provide in radiotap */ | ||
7550 | ipw_rt->rt_hdr.it_present = | ||
7551 | ((1 << IEEE80211_RADIOTAP_FLAGS) | | ||
7552 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
7553 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
7554 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | ||
7555 | (1 << IEEE80211_RADIOTAP_ANTENNA)); | ||
7556 | |||
7557 | /* Zero the flags, we'll add to them as we go */ | ||
7558 | ipw_rt->rt_flags = 0; | ||
7559 | |||
7560 | /* Convert signal to DBM */ | ||
7561 | ipw_rt->rt_dbmsignal = antsignal; | ||
7562 | |||
7563 | /* Convert the channel data and set the flags */ | ||
7564 | ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); | ||
7565 | if (received_channel > 14) { /* 802.11a */ | ||
7566 | ipw_rt->rt_chbitmask = | ||
7567 | cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); | ||
7568 | } else if (antennaAndPhy & 32) { /* 802.11b */ | ||
7569 | ipw_rt->rt_chbitmask = | ||
7570 | cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); | ||
7571 | } else { /* 802.11g */ | ||
7572 | ipw_rt->rt_chbitmask = | ||
7573 | (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ); | ||
7574 | } | ||
7575 | |||
7576 | /* set the rate in multiples of 500k/s */ | ||
7577 | switch (pktrate) { | ||
7578 | case IPW_TX_RATE_1MB: | ||
7579 | ipw_rt->rt_rate = 2; | ||
7580 | break; | ||
7581 | case IPW_TX_RATE_2MB: | ||
7582 | ipw_rt->rt_rate = 4; | ||
7583 | break; | ||
7584 | case IPW_TX_RATE_5MB: | ||
7585 | ipw_rt->rt_rate = 10; | ||
7586 | break; | ||
7587 | case IPW_TX_RATE_6MB: | ||
7588 | ipw_rt->rt_rate = 12; | ||
7589 | break; | ||
7590 | case IPW_TX_RATE_9MB: | ||
7591 | ipw_rt->rt_rate = 18; | ||
7592 | break; | ||
7593 | case IPW_TX_RATE_11MB: | ||
7594 | ipw_rt->rt_rate = 22; | ||
7595 | break; | ||
7596 | case IPW_TX_RATE_12MB: | ||
7597 | ipw_rt->rt_rate = 24; | ||
7598 | break; | ||
7599 | case IPW_TX_RATE_18MB: | ||
7600 | ipw_rt->rt_rate = 36; | ||
7601 | break; | ||
7602 | case IPW_TX_RATE_24MB: | ||
7603 | ipw_rt->rt_rate = 48; | ||
7604 | break; | ||
7605 | case IPW_TX_RATE_36MB: | ||
7606 | ipw_rt->rt_rate = 72; | ||
7607 | break; | ||
7608 | case IPW_TX_RATE_48MB: | ||
7609 | ipw_rt->rt_rate = 96; | ||
7610 | break; | ||
7611 | case IPW_TX_RATE_54MB: | ||
7612 | ipw_rt->rt_rate = 108; | ||
7613 | break; | ||
7614 | default: | ||
7615 | ipw_rt->rt_rate = 0; | ||
7616 | break; | ||
7617 | } | ||
7618 | |||
7619 | /* antenna number */ | ||
7620 | ipw_rt->rt_antenna = (antennaAndPhy & 3); /* Is this right? */ | ||
7621 | |||
7622 | /* set the preamble flag if we have it */ | ||
7623 | if ((antennaAndPhy & 64)) | ||
7624 | ipw_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; | ||
7625 | |||
7626 | /* Set the size of the skb to the size of the frame */ | ||
7627 | skb_put(rxb->skb, len + sizeof(struct ipw_rt_hdr)); | ||
7628 | |||
7629 | IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); | ||
7630 | |||
7631 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) | ||
7632 | priv->ieee->stats.rx_errors++; | ||
7633 | else { /* ieee80211_rx succeeded, so it now owns the SKB */ | ||
7634 | rxb->skb = NULL; | ||
7635 | /* no LED during capture */ | ||
7636 | } | ||
7637 | } | ||
7638 | #endif | ||
7639 | |||
7640 | static inline int is_network_packet(struct ipw_priv *priv, | ||
7641 | struct ieee80211_hdr_4addr *header) | ||
7642 | { | ||
7643 | /* Filter incoming packets to determine if they are targetted toward | ||
7644 | * this network, discarding packets coming from ourselves */ | ||
7645 | switch (priv->ieee->iw_mode) { | ||
7646 | case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ | ||
7647 | /* packets from our adapter are dropped (echo) */ | ||
7648 | if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) | ||
7649 | return 0; | ||
7650 | |||
7651 | /* {broad,multi}cast packets to our BSSID go through */ | ||
7652 | if (is_multicast_ether_addr(header->addr1) || | ||
7653 | is_broadcast_ether_addr(header->addr1)) | ||
7654 | return !memcmp(header->addr3, priv->bssid, ETH_ALEN); | ||
7655 | |||
7656 | /* packets to our adapter go through */ | ||
7657 | return !memcmp(header->addr1, priv->net_dev->dev_addr, | ||
7658 | ETH_ALEN); | ||
7659 | |||
7660 | case IW_MODE_INFRA: /* Header: Dest. | BSSID | Source */ | ||
7661 | /* packets from our adapter are dropped (echo) */ | ||
7662 | if (!memcmp(header->addr3, priv->net_dev->dev_addr, ETH_ALEN)) | ||
7663 | return 0; | ||
7664 | |||
7665 | /* {broad,multi}cast packets to our BSS go through */ | ||
7666 | if (is_multicast_ether_addr(header->addr1) || | ||
7667 | is_broadcast_ether_addr(header->addr1)) | ||
7668 | return !memcmp(header->addr2, priv->bssid, ETH_ALEN); | ||
7669 | |||
7670 | /* packets to our adapter go through */ | ||
7671 | return !memcmp(header->addr1, priv->net_dev->dev_addr, | ||
7672 | ETH_ALEN); | ||
7673 | } | ||
7674 | |||
7675 | return 1; | ||
7676 | } | ||
7677 | |||
7678 | #define IPW_PACKET_RETRY_TIME HZ | ||
7679 | |||
7680 | static inline int is_duplicate_packet(struct ipw_priv *priv, | ||
7681 | struct ieee80211_hdr_4addr *header) | ||
7682 | { | ||
7683 | u16 sc = le16_to_cpu(header->seq_ctl); | ||
7684 | u16 seq = WLAN_GET_SEQ_SEQ(sc); | ||
7685 | u16 frag = WLAN_GET_SEQ_FRAG(sc); | ||
7686 | u16 *last_seq, *last_frag; | ||
7687 | unsigned long *last_time; | ||
7688 | |||
7689 | switch (priv->ieee->iw_mode) { | ||
7690 | case IW_MODE_ADHOC: | ||
7691 | { | ||
7692 | struct list_head *p; | ||
7693 | struct ipw_ibss_seq *entry = NULL; | ||
7694 | u8 *mac = header->addr2; | ||
7695 | int index = mac[5] % IPW_IBSS_MAC_HASH_SIZE; | ||
7696 | |||
7697 | __list_for_each(p, &priv->ibss_mac_hash[index]) { | ||
7698 | entry = | ||
7699 | list_entry(p, struct ipw_ibss_seq, list); | ||
7700 | if (!memcmp(entry->mac, mac, ETH_ALEN)) | ||
7701 | break; | ||
7702 | } | ||
7703 | if (p == &priv->ibss_mac_hash[index]) { | ||
7704 | entry = kmalloc(sizeof(*entry), GFP_ATOMIC); | ||
7705 | if (!entry) { | ||
7706 | IPW_ERROR | ||
7707 | ("Cannot malloc new mac entry\n"); | ||
7708 | return 0; | ||
7709 | } | ||
7710 | memcpy(entry->mac, mac, ETH_ALEN); | ||
7711 | entry->seq_num = seq; | ||
7712 | entry->frag_num = frag; | ||
7713 | entry->packet_time = jiffies; | ||
7714 | list_add(&entry->list, | ||
7715 | &priv->ibss_mac_hash[index]); | ||
7716 | return 0; | ||
7717 | } | ||
7718 | last_seq = &entry->seq_num; | ||
7719 | last_frag = &entry->frag_num; | ||
7720 | last_time = &entry->packet_time; | ||
7721 | break; | ||
7722 | } | ||
7723 | case IW_MODE_INFRA: | ||
7724 | last_seq = &priv->last_seq_num; | ||
7725 | last_frag = &priv->last_frag_num; | ||
7726 | last_time = &priv->last_packet_time; | ||
7727 | break; | ||
7728 | default: | ||
7729 | return 0; | ||
7730 | } | ||
7731 | if ((*last_seq == seq) && | ||
7732 | time_after(*last_time + IPW_PACKET_RETRY_TIME, jiffies)) { | ||
7733 | if (*last_frag == frag) | ||
7734 | goto drop; | ||
7735 | if (*last_frag + 1 != frag) | ||
7736 | /* out-of-order fragment */ | ||
7737 | goto drop; | ||
7738 | } else | ||
7739 | *last_seq = seq; | ||
7740 | |||
7741 | *last_frag = frag; | ||
7742 | *last_time = jiffies; | ||
7743 | return 0; | ||
7744 | |||
7745 | drop: | ||
7746 | /* Comment this line now since we observed the card receives | ||
7747 | * duplicate packets but the FCTL_RETRY bit is not set in the | ||
7748 | * IBSS mode with fragmentation enabled. | ||
7749 | BUG_ON(!(le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_RETRY)); */ | ||
7750 | return 1; | ||
7751 | } | ||
7752 | |||
7753 | static void ipw_handle_mgmt_packet(struct ipw_priv *priv, | ||
7754 | struct ipw_rx_mem_buffer *rxb, | ||
7755 | struct ieee80211_rx_stats *stats) | ||
7756 | { | ||
7757 | struct sk_buff *skb = rxb->skb; | ||
7758 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)skb->data; | ||
7759 | struct ieee80211_hdr_4addr *header = (struct ieee80211_hdr_4addr *) | ||
7760 | (skb->data + IPW_RX_FRAME_SIZE); | ||
7761 | |||
7762 | ieee80211_rx_mgt(priv->ieee, header, stats); | ||
7763 | |||
7764 | if (priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
7765 | ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == | ||
7766 | IEEE80211_STYPE_PROBE_RESP) || | ||
7767 | (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == | ||
7768 | IEEE80211_STYPE_BEACON))) { | ||
7769 | if (!memcmp(header->addr3, priv->bssid, ETH_ALEN)) | ||
7770 | ipw_add_station(priv, header->addr2); | ||
7771 | } | ||
7772 | |||
7773 | if (priv->config & CFG_NET_STATS) { | ||
7774 | IPW_DEBUG_HC("sending stat packet\n"); | ||
7775 | |||
7776 | /* Set the size of the skb to the size of the full | ||
7777 | * ipw header and 802.11 frame */ | ||
7778 | skb_put(skb, le16_to_cpu(pkt->u.frame.length) + | ||
7779 | IPW_RX_FRAME_SIZE); | ||
7780 | |||
7781 | /* Advance past the ipw packet header to the 802.11 frame */ | ||
7782 | skb_pull(skb, IPW_RX_FRAME_SIZE); | ||
7783 | |||
7784 | /* Push the ieee80211_rx_stats before the 802.11 frame */ | ||
7785 | memcpy(skb_push(skb, sizeof(*stats)), stats, sizeof(*stats)); | ||
7786 | |||
7787 | skb->dev = priv->ieee->dev; | ||
7788 | |||
7789 | /* Point raw at the ieee80211_stats */ | ||
7790 | skb->mac.raw = skb->data; | ||
7791 | |||
7792 | skb->pkt_type = PACKET_OTHERHOST; | ||
7793 | skb->protocol = __constant_htons(ETH_P_80211_STATS); | ||
7794 | memset(skb->cb, 0, sizeof(rxb->skb->cb)); | ||
7795 | netif_rx(skb); | ||
7796 | rxb->skb = NULL; | ||
7797 | } | ||
4900 | } | 7798 | } |
4901 | 7799 | ||
4902 | /* | 7800 | /* |
@@ -4912,8 +7810,8 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4912 | u32 r, w, i; | 7810 | u32 r, w, i; |
4913 | u8 network_packet; | 7811 | u8 network_packet; |
4914 | 7812 | ||
4915 | r = ipw_read32(priv, CX2_RX_READ_INDEX); | 7813 | r = ipw_read32(priv, IPW_RX_READ_INDEX); |
4916 | w = ipw_read32(priv, CX2_RX_WRITE_INDEX); | 7814 | w = ipw_read32(priv, IPW_RX_WRITE_INDEX); |
4917 | i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; | 7815 | i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; |
4918 | 7816 | ||
4919 | while (i != r) { | 7817 | while (i != r) { |
@@ -4927,7 +7825,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4927 | priv->rxq->queue[i] = NULL; | 7825 | priv->rxq->queue[i] = NULL; |
4928 | 7826 | ||
4929 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, | 7827 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, |
4930 | CX2_RX_BUF_SIZE, | 7828 | IPW_RX_BUF_SIZE, |
4931 | PCI_DMA_FROMDEVICE); | 7829 | PCI_DMA_FROMDEVICE); |
4932 | 7830 | ||
4933 | pkt = (struct ipw_rx_packet *)rxb->skb->data; | 7831 | pkt = (struct ipw_rx_packet *)rxb->skb->data; |
@@ -4938,9 +7836,13 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4938 | switch (pkt->header.message_type) { | 7836 | switch (pkt->header.message_type) { |
4939 | case RX_FRAME_TYPE: /* 802.11 frame */ { | 7837 | case RX_FRAME_TYPE: /* 802.11 frame */ { |
4940 | struct ieee80211_rx_stats stats = { | 7838 | struct ieee80211_rx_stats stats = { |
4941 | .rssi = pkt->u.frame.rssi_dbm - | 7839 | .rssi = |
7840 | le16_to_cpu(pkt->u.frame.rssi_dbm) - | ||
4942 | IPW_RSSI_TO_DBM, | 7841 | IPW_RSSI_TO_DBM, |
4943 | .signal = pkt->u.frame.signal, | 7842 | .signal = |
7843 | le16_to_cpu(pkt->u.frame.signal), | ||
7844 | .noise = | ||
7845 | le16_to_cpu(pkt->u.frame.noise), | ||
4944 | .rate = pkt->u.frame.rate, | 7846 | .rate = pkt->u.frame.rate, |
4945 | .mac_time = jiffies, | 7847 | .mac_time = jiffies, |
4946 | .received_channel = | 7848 | .received_channel = |
@@ -4950,22 +7852,30 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4950 | control & (1 << 0)) ? | 7852 | control & (1 << 0)) ? |
4951 | IEEE80211_24GHZ_BAND : | 7853 | IEEE80211_24GHZ_BAND : |
4952 | IEEE80211_52GHZ_BAND, | 7854 | IEEE80211_52GHZ_BAND, |
4953 | .len = pkt->u.frame.length, | 7855 | .len = le16_to_cpu(pkt->u.frame.length), |
4954 | }; | 7856 | }; |
4955 | 7857 | ||
4956 | if (stats.rssi != 0) | 7858 | if (stats.rssi != 0) |
4957 | stats.mask |= IEEE80211_STATMASK_RSSI; | 7859 | stats.mask |= IEEE80211_STATMASK_RSSI; |
4958 | if (stats.signal != 0) | 7860 | if (stats.signal != 0) |
4959 | stats.mask |= IEEE80211_STATMASK_SIGNAL; | 7861 | stats.mask |= IEEE80211_STATMASK_SIGNAL; |
7862 | if (stats.noise != 0) | ||
7863 | stats.mask |= IEEE80211_STATMASK_NOISE; | ||
4960 | if (stats.rate != 0) | 7864 | if (stats.rate != 0) |
4961 | stats.mask |= IEEE80211_STATMASK_RATE; | 7865 | stats.mask |= IEEE80211_STATMASK_RATE; |
4962 | 7866 | ||
4963 | priv->rx_packets++; | 7867 | priv->rx_packets++; |
4964 | 7868 | ||
4965 | #ifdef CONFIG_IPW_PROMISC | 7869 | #ifdef CONFIG_IPW2200_MONITOR |
4966 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 7870 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
7871 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
7872 | ipw_handle_data_packet_monitor(priv, | ||
7873 | rxb, | ||
7874 | &stats); | ||
7875 | #else | ||
4967 | ipw_handle_data_packet(priv, rxb, | 7876 | ipw_handle_data_packet(priv, rxb, |
4968 | &stats); | 7877 | &stats); |
7878 | #endif | ||
4969 | break; | 7879 | break; |
4970 | } | 7880 | } |
4971 | #endif | 7881 | #endif |
@@ -4979,35 +7889,9 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4979 | * correctly -- we should probably use the | 7889 | * correctly -- we should probably use the |
4980 | * frame control of the packet and disregard | 7890 | * frame control of the packet and disregard |
4981 | * the current iw_mode */ | 7891 | * the current iw_mode */ |
4982 | switch (priv->ieee->iw_mode) { | ||
4983 | case IW_MODE_ADHOC: | ||
4984 | network_packet = | ||
4985 | !memcmp(header->addr1, | ||
4986 | priv->net_dev->dev_addr, | ||
4987 | ETH_ALEN) || | ||
4988 | !memcmp(header->addr3, | ||
4989 | priv->bssid, ETH_ALEN) || | ||
4990 | is_broadcast_ether_addr(header-> | ||
4991 | addr1) | ||
4992 | || is_multicast_ether_addr(header-> | ||
4993 | addr1); | ||
4994 | break; | ||
4995 | |||
4996 | case IW_MODE_INFRA: | ||
4997 | default: | ||
4998 | network_packet = | ||
4999 | !memcmp(header->addr3, | ||
5000 | priv->bssid, ETH_ALEN) || | ||
5001 | !memcmp(header->addr1, | ||
5002 | priv->net_dev->dev_addr, | ||
5003 | ETH_ALEN) || | ||
5004 | is_broadcast_ether_addr(header-> | ||
5005 | addr1) | ||
5006 | || is_multicast_ether_addr(header-> | ||
5007 | addr1); | ||
5008 | break; | ||
5009 | } | ||
5010 | 7892 | ||
7893 | network_packet = | ||
7894 | is_network_packet(priv, header); | ||
5011 | if (network_packet && priv->assoc_network) { | 7895 | if (network_packet && priv->assoc_network) { |
5012 | priv->assoc_network->stats.rssi = | 7896 | priv->assoc_network->stats.rssi = |
5013 | stats.rssi; | 7897 | stats.rssi; |
@@ -5017,9 +7901,10 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5017 | } | 7901 | } |
5018 | 7902 | ||
5019 | IPW_DEBUG_RX("Frame: len=%u\n", | 7903 | IPW_DEBUG_RX("Frame: len=%u\n", |
5020 | pkt->u.frame.length); | 7904 | le16_to_cpu(pkt->u.frame.length)); |
5021 | 7905 | ||
5022 | if (pkt->u.frame.length < frame_hdr_len(header)) { | 7906 | if (le16_to_cpu(pkt->u.frame.length) < |
7907 | frame_hdr_len(header)) { | ||
5023 | IPW_DEBUG_DROP | 7908 | IPW_DEBUG_DROP |
5024 | ("Received packet is too small. " | 7909 | ("Received packet is too small. " |
5025 | "Dropping.\n"); | 7910 | "Dropping.\n"); |
@@ -5028,34 +7913,22 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5028 | break; | 7913 | break; |
5029 | } | 7914 | } |
5030 | 7915 | ||
5031 | switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { | 7916 | switch (WLAN_FC_GET_TYPE |
7917 | (le16_to_cpu(header->frame_ctl))) { | ||
7918 | |||
5032 | case IEEE80211_FTYPE_MGMT: | 7919 | case IEEE80211_FTYPE_MGMT: |
5033 | ieee80211_rx_mgt(priv->ieee, header, | 7920 | ipw_handle_mgmt_packet(priv, rxb, |
5034 | &stats); | 7921 | &stats); |
5035 | if (priv->ieee->iw_mode == IW_MODE_ADHOC | ||
5036 | && | ||
5037 | ((WLAN_FC_GET_STYPE | ||
5038 | (header->frame_ctl) == | ||
5039 | IEEE80211_STYPE_PROBE_RESP) | ||
5040 | || | ||
5041 | (WLAN_FC_GET_STYPE | ||
5042 | (header->frame_ctl) == | ||
5043 | IEEE80211_STYPE_BEACON)) | ||
5044 | && !memcmp(header->addr3, | ||
5045 | priv->bssid, ETH_ALEN)) | ||
5046 | ipw_add_station(priv, | ||
5047 | header->addr2); | ||
5048 | break; | 7922 | break; |
5049 | 7923 | ||
5050 | case IEEE80211_FTYPE_CTL: | 7924 | case IEEE80211_FTYPE_CTL: |
5051 | break; | 7925 | break; |
5052 | 7926 | ||
5053 | case IEEE80211_FTYPE_DATA: | 7927 | case IEEE80211_FTYPE_DATA: |
5054 | if (network_packet) | 7928 | if (unlikely(!network_packet || |
5055 | ipw_handle_data_packet(priv, | 7929 | is_duplicate_packet(priv, |
5056 | rxb, | 7930 | header))) |
5057 | &stats); | 7931 | { |
5058 | else | ||
5059 | IPW_DEBUG_DROP("Dropping: " | 7932 | IPW_DEBUG_DROP("Dropping: " |
5060 | MAC_FMT ", " | 7933 | MAC_FMT ", " |
5061 | MAC_FMT ", " | 7934 | MAC_FMT ", " |
@@ -5066,6 +7939,12 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5066 | addr2), | 7939 | addr2), |
5067 | MAC_ARG(header-> | 7940 | MAC_ARG(header-> |
5068 | addr3)); | 7941 | addr3)); |
7942 | break; | ||
7943 | } | ||
7944 | |||
7945 | ipw_handle_data_packet(priv, rxb, | ||
7946 | &stats); | ||
7947 | |||
5069 | break; | 7948 | break; |
5070 | } | 7949 | } |
5071 | break; | 7950 | break; |
@@ -5096,7 +7975,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5096 | } | 7975 | } |
5097 | 7976 | ||
5098 | pci_unmap_single(priv->pci_dev, rxb->dma_addr, | 7977 | pci_unmap_single(priv->pci_dev, rxb->dma_addr, |
5099 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 7978 | IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
5100 | list_add_tail(&rxb->list, &priv->rxq->rx_used); | 7979 | list_add_tail(&rxb->list, &priv->rxq->rx_used); |
5101 | 7980 | ||
5102 | i = (i + 1) % RX_QUEUE_SIZE; | 7981 | i = (i + 1) % RX_QUEUE_SIZE; |
@@ -5108,128 +7987,129 @@ static void ipw_rx(struct ipw_priv *priv) | |||
5108 | ipw_rx_queue_restock(priv); | 7987 | ipw_rx_queue_restock(priv); |
5109 | } | 7988 | } |
5110 | 7989 | ||
5111 | static void ipw_abort_scan(struct ipw_priv *priv) | 7990 | #define DEFAULT_RTS_THRESHOLD 2304U |
7991 | #define MIN_RTS_THRESHOLD 1U | ||
7992 | #define MAX_RTS_THRESHOLD 2304U | ||
7993 | #define DEFAULT_BEACON_INTERVAL 100U | ||
7994 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
7995 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
7996 | |||
7997 | static int ipw_sw_reset(struct ipw_priv *priv, int init) | ||
5112 | { | 7998 | { |
5113 | int err; | 7999 | int band, modulation; |
8000 | int old_mode = priv->ieee->iw_mode; | ||
5114 | 8001 | ||
5115 | if (priv->status & STATUS_SCAN_ABORTING) { | 8002 | /* Initialize module parameter values here */ |
5116 | IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); | 8003 | priv->config = 0; |
5117 | return; | ||
5118 | } | ||
5119 | priv->status |= STATUS_SCAN_ABORTING; | ||
5120 | 8004 | ||
5121 | err = ipw_send_scan_abort(priv); | 8005 | /* We default to disabling the LED code as right now it causes |
5122 | if (err) | 8006 | * too many systems to lock up... */ |
5123 | IPW_DEBUG_HC("Request to abort scan failed.\n"); | 8007 | if (!led) |
5124 | } | 8008 | priv->config |= CFG_NO_LED; |
5125 | 8009 | ||
5126 | static int ipw_request_scan(struct ipw_priv *priv) | 8010 | if (associate) |
5127 | { | 8011 | priv->config |= CFG_ASSOCIATE; |
5128 | struct ipw_scan_request_ext scan; | 8012 | else |
5129 | int channel_index = 0; | 8013 | IPW_DEBUG_INFO("Auto associate disabled.\n"); |
5130 | int i, err, scan_type; | ||
5131 | 8014 | ||
5132 | if (priv->status & STATUS_EXIT_PENDING) { | 8015 | if (auto_create) |
5133 | IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); | 8016 | priv->config |= CFG_ADHOC_CREATE; |
5134 | priv->status |= STATUS_SCAN_PENDING; | 8017 | else |
5135 | return 0; | 8018 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); |
5136 | } | ||
5137 | 8019 | ||
5138 | if (priv->status & STATUS_SCANNING) { | 8020 | if (disable) { |
5139 | IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); | 8021 | priv->status |= STATUS_RF_KILL_SW; |
5140 | priv->status |= STATUS_SCAN_PENDING; | 8022 | IPW_DEBUG_INFO("Radio disabled.\n"); |
5141 | ipw_abort_scan(priv); | ||
5142 | return 0; | ||
5143 | } | 8023 | } |
5144 | 8024 | ||
5145 | if (priv->status & STATUS_SCAN_ABORTING) { | 8025 | if (channel != 0) { |
5146 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | 8026 | priv->config |= CFG_STATIC_CHANNEL; |
5147 | priv->status |= STATUS_SCAN_PENDING; | 8027 | priv->channel = channel; |
5148 | return 0; | 8028 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); |
8029 | /* TODO: Validate that provided channel is in range */ | ||
5149 | } | 8030 | } |
8031 | #ifdef CONFIG_IPW_QOS | ||
8032 | ipw_qos_init(priv, qos_enable, qos_burst_enable, | ||
8033 | burst_duration_CCK, burst_duration_OFDM); | ||
8034 | #endif /* CONFIG_IPW_QOS */ | ||
5150 | 8035 | ||
5151 | if (priv->status & STATUS_RF_KILL_MASK) { | 8036 | switch (mode) { |
5152 | IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | 8037 | case 1: |
5153 | priv->status |= STATUS_SCAN_PENDING; | 8038 | priv->ieee->iw_mode = IW_MODE_ADHOC; |
5154 | return 0; | 8039 | priv->net_dev->type = ARPHRD_ETHER; |
8040 | |||
8041 | break; | ||
8042 | #ifdef CONFIG_IPW2200_MONITOR | ||
8043 | case 2: | ||
8044 | priv->ieee->iw_mode = IW_MODE_MONITOR; | ||
8045 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
8046 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
8047 | #else | ||
8048 | priv->net_dev->type = ARPHRD_IEEE80211; | ||
8049 | #endif | ||
8050 | break; | ||
8051 | #endif | ||
8052 | default: | ||
8053 | case 0: | ||
8054 | priv->net_dev->type = ARPHRD_ETHER; | ||
8055 | priv->ieee->iw_mode = IW_MODE_INFRA; | ||
8056 | break; | ||
5155 | } | 8057 | } |
5156 | 8058 | ||
5157 | memset(&scan, 0, sizeof(scan)); | 8059 | if (hwcrypto) { |
8060 | priv->ieee->host_encrypt = 0; | ||
8061 | priv->ieee->host_encrypt_msdu = 0; | ||
8062 | priv->ieee->host_decrypt = 0; | ||
8063 | priv->ieee->host_mc_decrypt = 0; | ||
8064 | } | ||
8065 | IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); | ||
5158 | 8066 | ||
5159 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = 20; | 8067 | /* IPW2200/2915 is abled to do hardware fragmentation. */ |
5160 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = 20; | 8068 | priv->ieee->host_open_frag = 0; |
5161 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 20; | ||
5162 | |||
5163 | scan.full_scan_index = ieee80211_get_scans(priv->ieee); | ||
5164 | /* If we are roaming, then make this a directed scan for the current | ||
5165 | * network. Otherwise, ensure that every other scan is a fast | ||
5166 | * channel hop scan */ | ||
5167 | if ((priv->status & STATUS_ROAMING) | ||
5168 | || (!(priv->status & STATUS_ASSOCIATED) | ||
5169 | && (priv->config & CFG_STATIC_ESSID) | ||
5170 | && (scan.full_scan_index % 2))) { | ||
5171 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | ||
5172 | if (err) { | ||
5173 | IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); | ||
5174 | return err; | ||
5175 | } | ||
5176 | 8069 | ||
5177 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | 8070 | if ((priv->pci_dev->device == 0x4223) || |
8071 | (priv->pci_dev->device == 0x4224)) { | ||
8072 | if (init) | ||
8073 | printk(KERN_INFO DRV_NAME | ||
8074 | ": Detected Intel PRO/Wireless 2915ABG Network " | ||
8075 | "Connection\n"); | ||
8076 | priv->ieee->abg_true = 1; | ||
8077 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | ||
8078 | modulation = IEEE80211_OFDM_MODULATION | | ||
8079 | IEEE80211_CCK_MODULATION; | ||
8080 | priv->adapter = IPW_2915ABG; | ||
8081 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; | ||
5178 | } else { | 8082 | } else { |
5179 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; | 8083 | if (init) |
5180 | } | 8084 | printk(KERN_INFO DRV_NAME |
5181 | 8085 | ": Detected Intel PRO/Wireless 2200BG Network " | |
5182 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | 8086 | "Connection\n"); |
5183 | int start = channel_index; | ||
5184 | for (i = 0; i < MAX_A_CHANNELS; i++) { | ||
5185 | if (band_a_active_channel[i] == 0) | ||
5186 | break; | ||
5187 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5188 | band_a_active_channel[i] == priv->channel) | ||
5189 | continue; | ||
5190 | channel_index++; | ||
5191 | scan.channels_list[channel_index] = | ||
5192 | band_a_active_channel[i]; | ||
5193 | ipw_set_scan_type(&scan, channel_index, scan_type); | ||
5194 | } | ||
5195 | 8087 | ||
5196 | if (start != channel_index) { | 8088 | priv->ieee->abg_true = 0; |
5197 | scan.channels_list[start] = (u8) (IPW_A_MODE << 6) | | 8089 | band = IEEE80211_24GHZ_BAND; |
5198 | (channel_index - start); | 8090 | modulation = IEEE80211_OFDM_MODULATION | |
5199 | channel_index++; | 8091 | IEEE80211_CCK_MODULATION; |
5200 | } | 8092 | priv->adapter = IPW_2200BG; |
8093 | priv->ieee->mode = IEEE_G | IEEE_B; | ||
5201 | } | 8094 | } |
5202 | 8095 | ||
5203 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { | 8096 | priv->ieee->freq_band = band; |
5204 | int start = channel_index; | 8097 | priv->ieee->modulation = modulation; |
5205 | for (i = 0; i < MAX_B_CHANNELS; i++) { | ||
5206 | if (band_b_active_channel[i] == 0) | ||
5207 | break; | ||
5208 | if ((priv->status & STATUS_ASSOCIATED) && | ||
5209 | band_b_active_channel[i] == priv->channel) | ||
5210 | continue; | ||
5211 | channel_index++; | ||
5212 | scan.channels_list[channel_index] = | ||
5213 | band_b_active_channel[i]; | ||
5214 | ipw_set_scan_type(&scan, channel_index, scan_type); | ||
5215 | } | ||
5216 | 8098 | ||
5217 | if (start != channel_index) { | 8099 | priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; |
5218 | scan.channels_list[start] = (u8) (IPW_B_MODE << 6) | | ||
5219 | (channel_index - start); | ||
5220 | } | ||
5221 | } | ||
5222 | 8100 | ||
5223 | err = ipw_send_scan_request_ext(priv, &scan); | 8101 | priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; |
5224 | if (err) { | 8102 | priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; |
5225 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
5226 | return -EIO; | ||
5227 | } | ||
5228 | 8103 | ||
5229 | priv->status |= STATUS_SCANNING; | 8104 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
5230 | priv->status &= ~STATUS_SCAN_PENDING; | 8105 | priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; |
8106 | priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; | ||
5231 | 8107 | ||
5232 | return 0; | 8108 | /* If power management is turned on, default to AC mode */ |
8109 | priv->power_mode = IPW_POWER_AC; | ||
8110 | priv->tx_power = IPW_TX_POWER_DEFAULT; | ||
8111 | |||
8112 | return old_mode == priv->ieee->iw_mode; | ||
5233 | } | 8113 | } |
5234 | 8114 | ||
5235 | /* | 8115 | /* |
@@ -5247,12 +8127,16 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
5247 | union iwreq_data *wrqu, char *extra) | 8127 | union iwreq_data *wrqu, char *extra) |
5248 | { | 8128 | { |
5249 | struct ipw_priv *priv = ieee80211_priv(dev); | 8129 | struct ipw_priv *priv = ieee80211_priv(dev); |
5250 | if (!(priv->status & STATUS_ASSOCIATED)) | 8130 | down(&priv->sem); |
8131 | if (priv->status & STATUS_RF_KILL_MASK) | ||
8132 | strcpy(wrqu->name, "radio off"); | ||
8133 | else if (!(priv->status & STATUS_ASSOCIATED)) | ||
5251 | strcpy(wrqu->name, "unassociated"); | 8134 | strcpy(wrqu->name, "unassociated"); |
5252 | else | 8135 | else |
5253 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", | 8136 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", |
5254 | ipw_modes[priv->assoc_request.ieee_mode]); | 8137 | ipw_modes[priv->assoc_request.ieee_mode]); |
5255 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); | 8138 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); |
8139 | up(&priv->sem); | ||
5256 | return 0; | 8140 | return 0; |
5257 | } | 8141 | } |
5258 | 8142 | ||
@@ -5261,13 +8145,9 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | |||
5261 | if (channel == 0) { | 8145 | if (channel == 0) { |
5262 | IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); | 8146 | IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); |
5263 | priv->config &= ~CFG_STATIC_CHANNEL; | 8147 | priv->config &= ~CFG_STATIC_CHANNEL; |
5264 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8148 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5265 | STATUS_ASSOCIATING))) { | 8149 | "parameters.\n"); |
5266 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8150 | ipw_associate(priv); |
5267 | "parameters.\n"); | ||
5268 | ipw_associate(priv); | ||
5269 | } | ||
5270 | |||
5271 | return 0; | 8151 | return 0; |
5272 | } | 8152 | } |
5273 | 8153 | ||
@@ -5282,14 +8162,32 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | |||
5282 | IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); | 8162 | IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); |
5283 | priv->channel = channel; | 8163 | priv->channel = channel; |
5284 | 8164 | ||
5285 | /* If we are currently associated, or trying to associate | 8165 | #ifdef CONFIG_IPW2200_MONITOR |
5286 | * then see if this is a new channel (causing us to disassociate) */ | 8166 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
5287 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8167 | int i; |
5288 | IPW_DEBUG_ASSOC("Disassociating due to channel change.\n"); | 8168 | if (priv->status & STATUS_SCANNING) { |
5289 | ipw_disassociate(priv); | 8169 | IPW_DEBUG_SCAN("Scan abort triggered due to " |
5290 | } else { | 8170 | "channel change.\n"); |
5291 | ipw_associate(priv); | 8171 | ipw_abort_scan(priv); |
8172 | } | ||
8173 | |||
8174 | for (i = 1000; i && (priv->status & STATUS_SCANNING); i--) | ||
8175 | udelay(10); | ||
8176 | |||
8177 | if (priv->status & STATUS_SCANNING) | ||
8178 | IPW_DEBUG_SCAN("Still scanning...\n"); | ||
8179 | else | ||
8180 | IPW_DEBUG_SCAN("Took %dms to abort current scan\n", | ||
8181 | 1000 - i); | ||
8182 | |||
8183 | return 0; | ||
5292 | } | 8184 | } |
8185 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
8186 | |||
8187 | /* Network configuration changed -- force [re]association */ | ||
8188 | IPW_DEBUG_ASSOC("[re]association triggered due to channel change.\n"); | ||
8189 | if (!ipw_disassociate(priv)) | ||
8190 | ipw_associate(priv); | ||
5293 | 8191 | ||
5294 | return 0; | 8192 | return 0; |
5295 | } | 8193 | } |
@@ -5299,29 +8197,48 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
5299 | union iwreq_data *wrqu, char *extra) | 8197 | union iwreq_data *wrqu, char *extra) |
5300 | { | 8198 | { |
5301 | struct ipw_priv *priv = ieee80211_priv(dev); | 8199 | struct ipw_priv *priv = ieee80211_priv(dev); |
8200 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | ||
5302 | struct iw_freq *fwrq = &wrqu->freq; | 8201 | struct iw_freq *fwrq = &wrqu->freq; |
5303 | 8202 | int ret = 0, i; | |
8203 | u8 channel, flags; | ||
8204 | int band; | ||
8205 | |||
8206 | if (fwrq->m == 0) { | ||
8207 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); | ||
8208 | down(&priv->sem); | ||
8209 | ret = ipw_set_channel(priv, 0); | ||
8210 | up(&priv->sem); | ||
8211 | return ret; | ||
8212 | } | ||
5304 | /* if setting by freq convert to channel */ | 8213 | /* if setting by freq convert to channel */ |
5305 | if (fwrq->e == 1) { | 8214 | if (fwrq->e == 1) { |
5306 | if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { | 8215 | channel = ipw_freq_to_channel(priv->ieee, fwrq->m); |
5307 | int f = fwrq->m / 100000; | 8216 | if (channel == 0) |
5308 | int c = 0; | 8217 | return -EINVAL; |
8218 | } else | ||
8219 | channel = fwrq->m; | ||
8220 | |||
8221 | if (!(band = ipw_is_valid_channel(priv->ieee, channel))) | ||
8222 | return -EINVAL; | ||
5309 | 8223 | ||
5310 | while ((c < REG_MAX_CHANNEL) && | 8224 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
5311 | (f != ipw_frequencies[c])) | 8225 | i = ipw_channel_to_index(priv->ieee, channel); |
5312 | c++; | 8226 | if (i == -1) |
8227 | return -EINVAL; | ||
5313 | 8228 | ||
5314 | /* hack to fall through */ | 8229 | flags = (band == IEEE80211_24GHZ_BAND) ? |
5315 | fwrq->e = 0; | 8230 | geo->bg[i].flags : geo->a[i].flags; |
5316 | fwrq->m = c + 1; | 8231 | if (flags & IEEE80211_CH_PASSIVE_ONLY) { |
8232 | IPW_DEBUG_WX("Invalid Ad-Hoc channel for 802.11a\n"); | ||
8233 | return -EINVAL; | ||
5317 | } | 8234 | } |
5318 | } | 8235 | } |
5319 | 8236 | ||
5320 | if (fwrq->e > 0 || fwrq->m > 1000) | ||
5321 | return -EOPNOTSUPP; | ||
5322 | |||
5323 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 8237 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
5324 | return ipw_set_channel(priv, (u8) fwrq->m); | 8238 | down(&priv->sem); |
8239 | ret = ipw_set_channel(priv, channel); | ||
8240 | up(&priv->sem); | ||
8241 | return ret; | ||
5325 | } | 8242 | } |
5326 | 8243 | ||
5327 | static int ipw_wx_get_freq(struct net_device *dev, | 8244 | static int ipw_wx_get_freq(struct net_device *dev, |
@@ -5334,12 +8251,14 @@ static int ipw_wx_get_freq(struct net_device *dev, | |||
5334 | 8251 | ||
5335 | /* If we are associated, trying to associate, or have a statically | 8252 | /* If we are associated, trying to associate, or have a statically |
5336 | * configured CHANNEL then return that; otherwise return ANY */ | 8253 | * configured CHANNEL then return that; otherwise return ANY */ |
8254 | down(&priv->sem); | ||
5337 | if (priv->config & CFG_STATIC_CHANNEL || | 8255 | if (priv->config & CFG_STATIC_CHANNEL || |
5338 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) | 8256 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) |
5339 | wrqu->freq.m = priv->channel; | 8257 | wrqu->freq.m = priv->channel; |
5340 | else | 8258 | else |
5341 | wrqu->freq.m = 0; | 8259 | wrqu->freq.m = 0; |
5342 | 8260 | ||
8261 | up(&priv->sem); | ||
5343 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); | 8262 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); |
5344 | return 0; | 8263 | return 0; |
5345 | } | 8264 | } |
@@ -5353,11 +8272,8 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5353 | 8272 | ||
5354 | IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); | 8273 | IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); |
5355 | 8274 | ||
5356 | if (wrqu->mode == priv->ieee->iw_mode) | ||
5357 | return 0; | ||
5358 | |||
5359 | switch (wrqu->mode) { | 8275 | switch (wrqu->mode) { |
5360 | #ifdef CONFIG_IPW_PROMISC | 8276 | #ifdef CONFIG_IPW2200_MONITOR |
5361 | case IW_MODE_MONITOR: | 8277 | case IW_MODE_MONITOR: |
5362 | #endif | 8278 | #endif |
5363 | case IW_MODE_ADHOC: | 8279 | case IW_MODE_ADHOC: |
@@ -5369,31 +8285,33 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5369 | default: | 8285 | default: |
5370 | return -EINVAL; | 8286 | return -EINVAL; |
5371 | } | 8287 | } |
8288 | if (wrqu->mode == priv->ieee->iw_mode) | ||
8289 | return 0; | ||
8290 | |||
8291 | down(&priv->sem); | ||
8292 | |||
8293 | ipw_sw_reset(priv, 0); | ||
5372 | 8294 | ||
5373 | #ifdef CONFIG_IPW_PROMISC | 8295 | #ifdef CONFIG_IPW2200_MONITOR |
5374 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) | 8296 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) |
5375 | priv->net_dev->type = ARPHRD_ETHER; | 8297 | priv->net_dev->type = ARPHRD_ETHER; |
5376 | 8298 | ||
5377 | if (wrqu->mode == IW_MODE_MONITOR) | 8299 | if (wrqu->mode == IW_MODE_MONITOR) |
8300 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
8301 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
8302 | #else | ||
5378 | priv->net_dev->type = ARPHRD_IEEE80211; | 8303 | priv->net_dev->type = ARPHRD_IEEE80211; |
5379 | #endif /* CONFIG_IPW_PROMISC */ | 8304 | #endif |
8305 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
5380 | 8306 | ||
5381 | #ifdef CONFIG_PM | ||
5382 | /* Free the existing firmware and reset the fw_loaded | 8307 | /* Free the existing firmware and reset the fw_loaded |
5383 | * flag so ipw_load() will bring in the new firmawre */ | 8308 | * flag so ipw_load() will bring in the new firmawre */ |
5384 | if (fw_loaded) { | 8309 | free_firmware(); |
5385 | fw_loaded = 0; | ||
5386 | } | ||
5387 | |||
5388 | release_firmware(bootfw); | ||
5389 | release_firmware(ucode); | ||
5390 | release_firmware(firmware); | ||
5391 | bootfw = ucode = firmware = NULL; | ||
5392 | #endif | ||
5393 | 8310 | ||
5394 | priv->ieee->iw_mode = wrqu->mode; | 8311 | priv->ieee->iw_mode = wrqu->mode; |
5395 | ipw_adapter_restart(priv); | ||
5396 | 8312 | ||
8313 | queue_work(priv->workqueue, &priv->adapter_restart); | ||
8314 | up(&priv->sem); | ||
5397 | return err; | 8315 | return err; |
5398 | } | 8316 | } |
5399 | 8317 | ||
@@ -5402,20 +8320,13 @@ static int ipw_wx_get_mode(struct net_device *dev, | |||
5402 | union iwreq_data *wrqu, char *extra) | 8320 | union iwreq_data *wrqu, char *extra) |
5403 | { | 8321 | { |
5404 | struct ipw_priv *priv = ieee80211_priv(dev); | 8322 | struct ipw_priv *priv = ieee80211_priv(dev); |
5405 | 8323 | down(&priv->sem); | |
5406 | wrqu->mode = priv->ieee->iw_mode; | 8324 | wrqu->mode = priv->ieee->iw_mode; |
5407 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); | 8325 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); |
5408 | 8326 | up(&priv->sem); | |
5409 | return 0; | 8327 | return 0; |
5410 | } | 8328 | } |
5411 | 8329 | ||
5412 | #define DEFAULT_RTS_THRESHOLD 2304U | ||
5413 | #define MIN_RTS_THRESHOLD 1U | ||
5414 | #define MAX_RTS_THRESHOLD 2304U | ||
5415 | #define DEFAULT_BEACON_INTERVAL 100U | ||
5416 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
5417 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
5418 | |||
5419 | /* Values are in microsecond */ | 8330 | /* Values are in microsecond */ |
5420 | static const s32 timeout_duration[] = { | 8331 | static const s32 timeout_duration[] = { |
5421 | 350000, | 8332 | 350000, |
@@ -5439,8 +8350,8 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5439 | { | 8350 | { |
5440 | struct ipw_priv *priv = ieee80211_priv(dev); | 8351 | struct ipw_priv *priv = ieee80211_priv(dev); |
5441 | struct iw_range *range = (struct iw_range *)extra; | 8352 | struct iw_range *range = (struct iw_range *)extra; |
5442 | u16 val; | 8353 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); |
5443 | int i; | 8354 | int i = 0, j; |
5444 | 8355 | ||
5445 | wrqu->data.length = sizeof(*range); | 8356 | wrqu->data.length = sizeof(*range); |
5446 | memset(range, 0, sizeof(*range)); | 8357 | memset(range, 0, sizeof(*range)); |
@@ -5451,7 +8362,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5451 | range->max_qual.qual = 100; | 8362 | range->max_qual.qual = 100; |
5452 | /* TODO: Find real max RSSI and stick here */ | 8363 | /* TODO: Find real max RSSI and stick here */ |
5453 | range->max_qual.level = 0; | 8364 | range->max_qual.level = 0; |
5454 | range->max_qual.noise = 0; | 8365 | range->max_qual.noise = priv->ieee->worst_rssi + 0x100; |
5455 | range->max_qual.updated = 7; /* Updated all three */ | 8366 | range->max_qual.updated = 7; /* Updated all three */ |
5456 | 8367 | ||
5457 | range->avg_qual.qual = 70; | 8368 | range->avg_qual.qual = 70; |
@@ -5459,7 +8370,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5459 | range->avg_qual.level = 0; /* FIXME to real average level */ | 8370 | range->avg_qual.level = 0; /* FIXME to real average level */ |
5460 | range->avg_qual.noise = 0; | 8371 | range->avg_qual.noise = 0; |
5461 | range->avg_qual.updated = 7; /* Updated all three */ | 8372 | range->avg_qual.updated = 7; /* Updated all three */ |
5462 | 8373 | down(&priv->sem); | |
5463 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); | 8374 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); |
5464 | 8375 | ||
5465 | for (i = 0; i < range->num_bitrates; i++) | 8376 | for (i = 0; i < range->num_bitrates; i++) |
@@ -5479,19 +8390,35 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5479 | range->we_version_compiled = WIRELESS_EXT; | 8390 | range->we_version_compiled = WIRELESS_EXT; |
5480 | range->we_version_source = 16; | 8391 | range->we_version_source = 16; |
5481 | 8392 | ||
5482 | range->num_channels = FREQ_COUNT; | 8393 | i = 0; |
5483 | 8394 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { | |
5484 | val = 0; | 8395 | for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; |
5485 | for (i = 0; i < FREQ_COUNT; i++) { | 8396 | i++, j++) { |
5486 | range->freq[val].i = i + 1; | 8397 | range->freq[i].i = geo->bg[j].channel; |
5487 | range->freq[val].m = ipw_frequencies[i] * 100000; | 8398 | range->freq[i].m = geo->bg[j].freq * 100000; |
5488 | range->freq[val].e = 1; | 8399 | range->freq[i].e = 1; |
5489 | val++; | 8400 | } |
8401 | } | ||
5490 | 8402 | ||
5491 | if (val == IW_MAX_FREQUENCIES) | 8403 | if (priv->ieee->mode & IEEE_A) { |
5492 | break; | 8404 | for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; |
8405 | i++, j++) { | ||
8406 | range->freq[i].i = geo->a[j].channel; | ||
8407 | range->freq[i].m = geo->a[j].freq * 100000; | ||
8408 | range->freq[i].e = 1; | ||
8409 | } | ||
5493 | } | 8410 | } |
5494 | range->num_frequency = val; | 8411 | |
8412 | range->num_channels = i; | ||
8413 | range->num_frequency = i; | ||
8414 | |||
8415 | up(&priv->sem); | ||
8416 | |||
8417 | /* Event capability (kernel + driver) */ | ||
8418 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | ||
8419 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | | ||
8420 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | ||
8421 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | ||
5495 | 8422 | ||
5496 | IPW_DEBUG_WX("GET Range\n"); | 8423 | IPW_DEBUG_WX("GET Range\n"); |
5497 | return 0; | 8424 | return 0; |
@@ -5512,25 +8439,23 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
5512 | 8439 | ||
5513 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) | 8440 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) |
5514 | return -EINVAL; | 8441 | return -EINVAL; |
5515 | 8442 | down(&priv->sem); | |
5516 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || | 8443 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || |
5517 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8444 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
5518 | /* we disable mandatory BSSID association */ | 8445 | /* we disable mandatory BSSID association */ |
5519 | IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); | 8446 | IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); |
5520 | priv->config &= ~CFG_STATIC_BSSID; | 8447 | priv->config &= ~CFG_STATIC_BSSID; |
5521 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8448 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5522 | STATUS_ASSOCIATING))) { | 8449 | "parameters.\n"); |
5523 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8450 | ipw_associate(priv); |
5524 | "parameters.\n"); | 8451 | up(&priv->sem); |
5525 | ipw_associate(priv); | ||
5526 | } | ||
5527 | |||
5528 | return 0; | 8452 | return 0; |
5529 | } | 8453 | } |
5530 | 8454 | ||
5531 | priv->config |= CFG_STATIC_BSSID; | 8455 | priv->config |= CFG_STATIC_BSSID; |
5532 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8456 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
5533 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); | 8457 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); |
8458 | up(&priv->sem); | ||
5534 | return 0; | 8459 | return 0; |
5535 | } | 8460 | } |
5536 | 8461 | ||
@@ -5539,15 +8464,12 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
5539 | 8464 | ||
5540 | memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); | 8465 | memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); |
5541 | 8466 | ||
5542 | /* If we are currently associated, or trying to associate | 8467 | /* Network configuration changed -- force [re]association */ |
5543 | * then see if this is a new BSSID (causing us to disassociate) */ | 8468 | IPW_DEBUG_ASSOC("[re]association triggered due to BSSID change.\n"); |
5544 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8469 | if (!ipw_disassociate(priv)) |
5545 | IPW_DEBUG_ASSOC("Disassociating due to BSSID change.\n"); | ||
5546 | ipw_disassociate(priv); | ||
5547 | } else { | ||
5548 | ipw_associate(priv); | 8470 | ipw_associate(priv); |
5549 | } | ||
5550 | 8471 | ||
8472 | up(&priv->sem); | ||
5551 | return 0; | 8473 | return 0; |
5552 | } | 8474 | } |
5553 | 8475 | ||
@@ -5558,15 +8480,17 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
5558 | struct ipw_priv *priv = ieee80211_priv(dev); | 8480 | struct ipw_priv *priv = ieee80211_priv(dev); |
5559 | /* If we are associated, trying to associate, or have a statically | 8481 | /* If we are associated, trying to associate, or have a statically |
5560 | * configured BSSID then return that; otherwise return ANY */ | 8482 | * configured BSSID then return that; otherwise return ANY */ |
8483 | down(&priv->sem); | ||
5561 | if (priv->config & CFG_STATIC_BSSID || | 8484 | if (priv->config & CFG_STATIC_BSSID || |
5562 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8485 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
5563 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 8486 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
5564 | memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); | 8487 | memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); |
5565 | } else | 8488 | } else |
5566 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); | 8489 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); |
5567 | 8490 | ||
5568 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", | 8491 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", |
5569 | MAC_ARG(wrqu->ap_addr.sa_data)); | 8492 | MAC_ARG(wrqu->ap_addr.sa_data)); |
8493 | up(&priv->sem); | ||
5570 | return 0; | 8494 | return 0; |
5571 | } | 8495 | } |
5572 | 8496 | ||
@@ -5577,21 +8501,22 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5577 | struct ipw_priv *priv = ieee80211_priv(dev); | 8501 | struct ipw_priv *priv = ieee80211_priv(dev); |
5578 | char *essid = ""; /* ANY */ | 8502 | char *essid = ""; /* ANY */ |
5579 | int length = 0; | 8503 | int length = 0; |
5580 | 8504 | down(&priv->sem); | |
5581 | if (wrqu->essid.flags && wrqu->essid.length) { | 8505 | if (wrqu->essid.flags && wrqu->essid.length) { |
5582 | length = wrqu->essid.length - 1; | 8506 | length = wrqu->essid.length - 1; |
5583 | essid = extra; | 8507 | essid = extra; |
5584 | } | 8508 | } |
5585 | if (length == 0) { | 8509 | if (length == 0) { |
5586 | IPW_DEBUG_WX("Setting ESSID to ANY\n"); | 8510 | IPW_DEBUG_WX("Setting ESSID to ANY\n"); |
5587 | priv->config &= ~CFG_STATIC_ESSID; | 8511 | if ((priv->config & CFG_STATIC_ESSID) && |
5588 | if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | | 8512 | !(priv->status & (STATUS_ASSOCIATED | |
5589 | STATUS_ASSOCIATING))) { | 8513 | STATUS_ASSOCIATING))) { |
5590 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8514 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
5591 | "parameters.\n"); | 8515 | "parameters.\n"); |
8516 | priv->config &= ~CFG_STATIC_ESSID; | ||
5592 | ipw_associate(priv); | 8517 | ipw_associate(priv); |
5593 | } | 8518 | } |
5594 | 8519 | up(&priv->sem); | |
5595 | return 0; | 8520 | return 0; |
5596 | } | 8521 | } |
5597 | 8522 | ||
@@ -5601,6 +8526,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5601 | 8526 | ||
5602 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { | 8527 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { |
5603 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); | 8528 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); |
8529 | up(&priv->sem); | ||
5604 | return 0; | 8530 | return 0; |
5605 | } | 8531 | } |
5606 | 8532 | ||
@@ -5610,15 +8536,12 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5610 | priv->essid_len = length; | 8536 | priv->essid_len = length; |
5611 | memcpy(priv->essid, essid, priv->essid_len); | 8537 | memcpy(priv->essid, essid, priv->essid_len); |
5612 | 8538 | ||
5613 | /* If we are currently associated, or trying to associate | 8539 | /* Network configuration changed -- force [re]association */ |
5614 | * then see if this is a new ESSID (causing us to disassociate) */ | 8540 | IPW_DEBUG_ASSOC("[re]association triggered due to ESSID change.\n"); |
5615 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8541 | if (!ipw_disassociate(priv)) |
5616 | IPW_DEBUG_ASSOC("Disassociating due to ESSID change.\n"); | ||
5617 | ipw_disassociate(priv); | ||
5618 | } else { | ||
5619 | ipw_associate(priv); | 8542 | ipw_associate(priv); |
5620 | } | ||
5621 | 8543 | ||
8544 | up(&priv->sem); | ||
5622 | return 0; | 8545 | return 0; |
5623 | } | 8546 | } |
5624 | 8547 | ||
@@ -5630,6 +8553,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
5630 | 8553 | ||
5631 | /* If we are associated, trying to associate, or have a statically | 8554 | /* If we are associated, trying to associate, or have a statically |
5632 | * configured ESSID then return that; otherwise return ANY */ | 8555 | * configured ESSID then return that; otherwise return ANY */ |
8556 | down(&priv->sem); | ||
5633 | if (priv->config & CFG_STATIC_ESSID || | 8557 | if (priv->config & CFG_STATIC_ESSID || |
5634 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8558 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
5635 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 8559 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
@@ -5642,7 +8566,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
5642 | wrqu->essid.length = 0; | 8566 | wrqu->essid.length = 0; |
5643 | wrqu->essid.flags = 0; /* active */ | 8567 | wrqu->essid.flags = 0; /* active */ |
5644 | } | 8568 | } |
5645 | 8569 | up(&priv->sem); | |
5646 | return 0; | 8570 | return 0; |
5647 | } | 8571 | } |
5648 | 8572 | ||
@@ -5655,11 +8579,12 @@ static int ipw_wx_set_nick(struct net_device *dev, | |||
5655 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); | 8579 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); |
5656 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 8580 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
5657 | return -E2BIG; | 8581 | return -E2BIG; |
5658 | 8582 | down(&priv->sem); | |
5659 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); | 8583 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
5660 | memset(priv->nick, 0, sizeof(priv->nick)); | 8584 | memset(priv->nick, 0, sizeof(priv->nick)); |
5661 | memcpy(priv->nick, extra, wrqu->data.length); | 8585 | memcpy(priv->nick, extra, wrqu->data.length); |
5662 | IPW_DEBUG_TRACE("<<\n"); | 8586 | IPW_DEBUG_TRACE("<<\n"); |
8587 | up(&priv->sem); | ||
5663 | return 0; | 8588 | return 0; |
5664 | 8589 | ||
5665 | } | 8590 | } |
@@ -5670,9 +8595,11 @@ static int ipw_wx_get_nick(struct net_device *dev, | |||
5670 | { | 8595 | { |
5671 | struct ipw_priv *priv = ieee80211_priv(dev); | 8596 | struct ipw_priv *priv = ieee80211_priv(dev); |
5672 | IPW_DEBUG_WX("Getting nick\n"); | 8597 | IPW_DEBUG_WX("Getting nick\n"); |
8598 | down(&priv->sem); | ||
5673 | wrqu->data.length = strlen(priv->nick) + 1; | 8599 | wrqu->data.length = strlen(priv->nick) + 1; |
5674 | memcpy(extra, priv->nick, wrqu->data.length); | 8600 | memcpy(extra, priv->nick, wrqu->data.length); |
5675 | wrqu->data.flags = 1; /* active */ | 8601 | wrqu->data.flags = 1; /* active */ |
8602 | up(&priv->sem); | ||
5676 | return 0; | 8603 | return 0; |
5677 | } | 8604 | } |
5678 | 8605 | ||
@@ -5680,8 +8607,113 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
5680 | struct iw_request_info *info, | 8607 | struct iw_request_info *info, |
5681 | union iwreq_data *wrqu, char *extra) | 8608 | union iwreq_data *wrqu, char *extra) |
5682 | { | 8609 | { |
5683 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8610 | /* TODO: We should use semaphores or locks for access to priv */ |
5684 | return -EOPNOTSUPP; | 8611 | struct ipw_priv *priv = ieee80211_priv(dev); |
8612 | u32 target_rate = wrqu->bitrate.value; | ||
8613 | u32 fixed, mask; | ||
8614 | |||
8615 | /* value = -1, fixed = 0 means auto only, so we should use all rates offered by AP */ | ||
8616 | /* value = X, fixed = 1 means only rate X */ | ||
8617 | /* value = X, fixed = 0 means all rates lower equal X */ | ||
8618 | |||
8619 | if (target_rate == -1) { | ||
8620 | fixed = 0; | ||
8621 | mask = IEEE80211_DEFAULT_RATES_MASK; | ||
8622 | /* Now we should reassociate */ | ||
8623 | goto apply; | ||
8624 | } | ||
8625 | |||
8626 | mask = 0; | ||
8627 | fixed = wrqu->bitrate.fixed; | ||
8628 | |||
8629 | if (target_rate == 1000000 || !fixed) | ||
8630 | mask |= IEEE80211_CCK_RATE_1MB_MASK; | ||
8631 | if (target_rate == 1000000) | ||
8632 | goto apply; | ||
8633 | |||
8634 | if (target_rate == 2000000 || !fixed) | ||
8635 | mask |= IEEE80211_CCK_RATE_2MB_MASK; | ||
8636 | if (target_rate == 2000000) | ||
8637 | goto apply; | ||
8638 | |||
8639 | if (target_rate == 5500000 || !fixed) | ||
8640 | mask |= IEEE80211_CCK_RATE_5MB_MASK; | ||
8641 | if (target_rate == 5500000) | ||
8642 | goto apply; | ||
8643 | |||
8644 | if (target_rate == 6000000 || !fixed) | ||
8645 | mask |= IEEE80211_OFDM_RATE_6MB_MASK; | ||
8646 | if (target_rate == 6000000) | ||
8647 | goto apply; | ||
8648 | |||
8649 | if (target_rate == 9000000 || !fixed) | ||
8650 | mask |= IEEE80211_OFDM_RATE_9MB_MASK; | ||
8651 | if (target_rate == 9000000) | ||
8652 | goto apply; | ||
8653 | |||
8654 | if (target_rate == 11000000 || !fixed) | ||
8655 | mask |= IEEE80211_CCK_RATE_11MB_MASK; | ||
8656 | if (target_rate == 11000000) | ||
8657 | goto apply; | ||
8658 | |||
8659 | if (target_rate == 12000000 || !fixed) | ||
8660 | mask |= IEEE80211_OFDM_RATE_12MB_MASK; | ||
8661 | if (target_rate == 12000000) | ||
8662 | goto apply; | ||
8663 | |||
8664 | if (target_rate == 18000000 || !fixed) | ||
8665 | mask |= IEEE80211_OFDM_RATE_18MB_MASK; | ||
8666 | if (target_rate == 18000000) | ||
8667 | goto apply; | ||
8668 | |||
8669 | if (target_rate == 24000000 || !fixed) | ||
8670 | mask |= IEEE80211_OFDM_RATE_24MB_MASK; | ||
8671 | if (target_rate == 24000000) | ||
8672 | goto apply; | ||
8673 | |||
8674 | if (target_rate == 36000000 || !fixed) | ||
8675 | mask |= IEEE80211_OFDM_RATE_36MB_MASK; | ||
8676 | if (target_rate == 36000000) | ||
8677 | goto apply; | ||
8678 | |||
8679 | if (target_rate == 48000000 || !fixed) | ||
8680 | mask |= IEEE80211_OFDM_RATE_48MB_MASK; | ||
8681 | if (target_rate == 48000000) | ||
8682 | goto apply; | ||
8683 | |||
8684 | if (target_rate == 54000000 || !fixed) | ||
8685 | mask |= IEEE80211_OFDM_RATE_54MB_MASK; | ||
8686 | if (target_rate == 54000000) | ||
8687 | goto apply; | ||
8688 | |||
8689 | IPW_DEBUG_WX("invalid rate specified, returning error\n"); | ||
8690 | return -EINVAL; | ||
8691 | |||
8692 | apply: | ||
8693 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", | ||
8694 | mask, fixed ? "fixed" : "sub-rates"); | ||
8695 | down(&priv->sem); | ||
8696 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { | ||
8697 | priv->config &= ~CFG_FIXED_RATE; | ||
8698 | ipw_set_fixed_rate(priv, priv->ieee->mode); | ||
8699 | } else | ||
8700 | priv->config |= CFG_FIXED_RATE; | ||
8701 | |||
8702 | if (priv->rates_mask == mask) { | ||
8703 | IPW_DEBUG_WX("Mask set to current mask.\n"); | ||
8704 | up(&priv->sem); | ||
8705 | return 0; | ||
8706 | } | ||
8707 | |||
8708 | priv->rates_mask = mask; | ||
8709 | |||
8710 | /* Network configuration changed -- force [re]association */ | ||
8711 | IPW_DEBUG_ASSOC("[re]association triggered due to rates change.\n"); | ||
8712 | if (!ipw_disassociate(priv)) | ||
8713 | ipw_associate(priv); | ||
8714 | |||
8715 | up(&priv->sem); | ||
8716 | return 0; | ||
5685 | } | 8717 | } |
5686 | 8718 | ||
5687 | static int ipw_wx_get_rate(struct net_device *dev, | 8719 | static int ipw_wx_get_rate(struct net_device *dev, |
@@ -5689,8 +8721,9 @@ static int ipw_wx_get_rate(struct net_device *dev, | |||
5689 | union iwreq_data *wrqu, char *extra) | 8721 | union iwreq_data *wrqu, char *extra) |
5690 | { | 8722 | { |
5691 | struct ipw_priv *priv = ieee80211_priv(dev); | 8723 | struct ipw_priv *priv = ieee80211_priv(dev); |
8724 | down(&priv->sem); | ||
5692 | wrqu->bitrate.value = priv->last_rate; | 8725 | wrqu->bitrate.value = priv->last_rate; |
5693 | 8726 | up(&priv->sem); | |
5694 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 8727 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
5695 | return 0; | 8728 | return 0; |
5696 | } | 8729 | } |
@@ -5700,18 +8733,20 @@ static int ipw_wx_set_rts(struct net_device *dev, | |||
5700 | union iwreq_data *wrqu, char *extra) | 8733 | union iwreq_data *wrqu, char *extra) |
5701 | { | 8734 | { |
5702 | struct ipw_priv *priv = ieee80211_priv(dev); | 8735 | struct ipw_priv *priv = ieee80211_priv(dev); |
5703 | 8736 | down(&priv->sem); | |
5704 | if (wrqu->rts.disabled) | 8737 | if (wrqu->rts.disabled) |
5705 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | 8738 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
5706 | else { | 8739 | else { |
5707 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || | 8740 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || |
5708 | wrqu->rts.value > MAX_RTS_THRESHOLD) | 8741 | wrqu->rts.value > MAX_RTS_THRESHOLD) { |
8742 | up(&priv->sem); | ||
5709 | return -EINVAL; | 8743 | return -EINVAL; |
5710 | 8744 | } | |
5711 | priv->rts_threshold = wrqu->rts.value; | 8745 | priv->rts_threshold = wrqu->rts.value; |
5712 | } | 8746 | } |
5713 | 8747 | ||
5714 | ipw_send_rts_threshold(priv, priv->rts_threshold); | 8748 | ipw_send_rts_threshold(priv, priv->rts_threshold); |
8749 | up(&priv->sem); | ||
5715 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); | 8750 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); |
5716 | return 0; | 8751 | return 0; |
5717 | } | 8752 | } |
@@ -5721,10 +8756,11 @@ static int ipw_wx_get_rts(struct net_device *dev, | |||
5721 | union iwreq_data *wrqu, char *extra) | 8756 | union iwreq_data *wrqu, char *extra) |
5722 | { | 8757 | { |
5723 | struct ipw_priv *priv = ieee80211_priv(dev); | 8758 | struct ipw_priv *priv = ieee80211_priv(dev); |
8759 | down(&priv->sem); | ||
5724 | wrqu->rts.value = priv->rts_threshold; | 8760 | wrqu->rts.value = priv->rts_threshold; |
5725 | wrqu->rts.fixed = 0; /* no auto select */ | 8761 | wrqu->rts.fixed = 0; /* no auto select */ |
5726 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); | 8762 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); |
5727 | 8763 | up(&priv->sem); | |
5728 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); | 8764 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); |
5729 | return 0; | 8765 | return 0; |
5730 | } | 8766 | } |
@@ -5734,41 +8770,33 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
5734 | union iwreq_data *wrqu, char *extra) | 8770 | union iwreq_data *wrqu, char *extra) |
5735 | { | 8771 | { |
5736 | struct ipw_priv *priv = ieee80211_priv(dev); | 8772 | struct ipw_priv *priv = ieee80211_priv(dev); |
5737 | struct ipw_tx_power tx_power; | 8773 | int err = 0; |
5738 | int i; | ||
5739 | |||
5740 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) | ||
5741 | return -EINPROGRESS; | ||
5742 | |||
5743 | if (wrqu->power.flags != IW_TXPOW_DBM) | ||
5744 | return -EINVAL; | ||
5745 | 8774 | ||
5746 | if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) | 8775 | down(&priv->sem); |
5747 | return -EINVAL; | 8776 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { |
8777 | err = -EINPROGRESS; | ||
8778 | goto out; | ||
8779 | } | ||
5748 | 8780 | ||
5749 | priv->tx_power = wrqu->power.value; | 8781 | if (!wrqu->power.fixed) |
8782 | wrqu->power.value = IPW_TX_POWER_DEFAULT; | ||
5750 | 8783 | ||
5751 | memset(&tx_power, 0, sizeof(tx_power)); | 8784 | if (wrqu->power.flags != IW_TXPOW_DBM) { |
5752 | 8785 | err = -EINVAL; | |
5753 | /* configure device for 'G' band */ | 8786 | goto out; |
5754 | tx_power.ieee_mode = IPW_G_MODE; | ||
5755 | tx_power.num_channels = 11; | ||
5756 | for (i = 0; i < 11; i++) { | ||
5757 | tx_power.channels_tx_power[i].channel_number = i + 1; | ||
5758 | tx_power.channels_tx_power[i].tx_power = priv->tx_power; | ||
5759 | } | 8787 | } |
5760 | if (ipw_send_tx_power(priv, &tx_power)) | ||
5761 | goto error; | ||
5762 | 8788 | ||
5763 | /* configure device to also handle 'B' band */ | 8789 | if ((wrqu->power.value > IPW_TX_POWER_MAX) || |
5764 | tx_power.ieee_mode = IPW_B_MODE; | 8790 | (wrqu->power.value < IPW_TX_POWER_MIN)) { |
5765 | if (ipw_send_tx_power(priv, &tx_power)) | 8791 | err = -EINVAL; |
5766 | goto error; | 8792 | goto out; |
5767 | 8793 | } | |
5768 | return 0; | ||
5769 | 8794 | ||
5770 | error: | 8795 | priv->tx_power = wrqu->power.value; |
5771 | return -EIO; | 8796 | err = ipw_set_tx_power(priv); |
8797 | out: | ||
8798 | up(&priv->sem); | ||
8799 | return err; | ||
5772 | } | 8800 | } |
5773 | 8801 | ||
5774 | static int ipw_wx_get_txpow(struct net_device *dev, | 8802 | static int ipw_wx_get_txpow(struct net_device *dev, |
@@ -5776,14 +8804,15 @@ static int ipw_wx_get_txpow(struct net_device *dev, | |||
5776 | union iwreq_data *wrqu, char *extra) | 8804 | union iwreq_data *wrqu, char *extra) |
5777 | { | 8805 | { |
5778 | struct ipw_priv *priv = ieee80211_priv(dev); | 8806 | struct ipw_priv *priv = ieee80211_priv(dev); |
5779 | 8807 | down(&priv->sem); | |
5780 | wrqu->power.value = priv->tx_power; | 8808 | wrqu->power.value = priv->tx_power; |
5781 | wrqu->power.fixed = 1; | 8809 | wrqu->power.fixed = 1; |
5782 | wrqu->power.flags = IW_TXPOW_DBM; | 8810 | wrqu->power.flags = IW_TXPOW_DBM; |
5783 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; | 8811 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
8812 | up(&priv->sem); | ||
5784 | 8813 | ||
5785 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", | 8814 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", |
5786 | wrqu->power.disabled ? "ON" : "OFF", wrqu->power.value); | 8815 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); |
5787 | 8816 | ||
5788 | return 0; | 8817 | return 0; |
5789 | } | 8818 | } |
@@ -5793,18 +8822,21 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
5793 | union iwreq_data *wrqu, char *extra) | 8822 | union iwreq_data *wrqu, char *extra) |
5794 | { | 8823 | { |
5795 | struct ipw_priv *priv = ieee80211_priv(dev); | 8824 | struct ipw_priv *priv = ieee80211_priv(dev); |
5796 | 8825 | down(&priv->sem); | |
5797 | if (wrqu->frag.disabled) | 8826 | if (wrqu->frag.disabled) |
5798 | priv->ieee->fts = DEFAULT_FTS; | 8827 | priv->ieee->fts = DEFAULT_FTS; |
5799 | else { | 8828 | else { |
5800 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || | 8829 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || |
5801 | wrqu->frag.value > MAX_FRAG_THRESHOLD) | 8830 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { |
8831 | up(&priv->sem); | ||
5802 | return -EINVAL; | 8832 | return -EINVAL; |
8833 | } | ||
5803 | 8834 | ||
5804 | priv->ieee->fts = wrqu->frag.value & ~0x1; | 8835 | priv->ieee->fts = wrqu->frag.value & ~0x1; |
5805 | } | 8836 | } |
5806 | 8837 | ||
5807 | ipw_send_frag_threshold(priv, wrqu->frag.value); | 8838 | ipw_send_frag_threshold(priv, wrqu->frag.value); |
8839 | up(&priv->sem); | ||
5808 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); | 8840 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); |
5809 | return 0; | 8841 | return 0; |
5810 | } | 8842 | } |
@@ -5814,10 +8846,11 @@ static int ipw_wx_get_frag(struct net_device *dev, | |||
5814 | union iwreq_data *wrqu, char *extra) | 8846 | union iwreq_data *wrqu, char *extra) |
5815 | { | 8847 | { |
5816 | struct ipw_priv *priv = ieee80211_priv(dev); | 8848 | struct ipw_priv *priv = ieee80211_priv(dev); |
8849 | down(&priv->sem); | ||
5817 | wrqu->frag.value = priv->ieee->fts; | 8850 | wrqu->frag.value = priv->ieee->fts; |
5818 | wrqu->frag.fixed = 0; /* no auto select */ | 8851 | wrqu->frag.fixed = 0; /* no auto select */ |
5819 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); | 8852 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); |
5820 | 8853 | up(&priv->sem); | |
5821 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); | 8854 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); |
5822 | 8855 | ||
5823 | return 0; | 8856 | return 0; |
@@ -5827,16 +8860,128 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
5827 | struct iw_request_info *info, | 8860 | struct iw_request_info *info, |
5828 | union iwreq_data *wrqu, char *extra) | 8861 | union iwreq_data *wrqu, char *extra) |
5829 | { | 8862 | { |
5830 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8863 | struct ipw_priv *priv = ieee80211_priv(dev); |
5831 | return -EOPNOTSUPP; | 8864 | |
8865 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) | ||
8866 | return -EINVAL; | ||
8867 | |||
8868 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) | ||
8869 | return 0; | ||
8870 | |||
8871 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) | ||
8872 | return -EINVAL; | ||
8873 | |||
8874 | down(&priv->sem); | ||
8875 | if (wrqu->retry.flags & IW_RETRY_MIN) | ||
8876 | priv->short_retry_limit = (u8) wrqu->retry.value; | ||
8877 | else if (wrqu->retry.flags & IW_RETRY_MAX) | ||
8878 | priv->long_retry_limit = (u8) wrqu->retry.value; | ||
8879 | else { | ||
8880 | priv->short_retry_limit = (u8) wrqu->retry.value; | ||
8881 | priv->long_retry_limit = (u8) wrqu->retry.value; | ||
8882 | } | ||
8883 | |||
8884 | ipw_send_retry_limit(priv, priv->short_retry_limit, | ||
8885 | priv->long_retry_limit); | ||
8886 | up(&priv->sem); | ||
8887 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", | ||
8888 | priv->short_retry_limit, priv->long_retry_limit); | ||
8889 | return 0; | ||
5832 | } | 8890 | } |
5833 | 8891 | ||
5834 | static int ipw_wx_get_retry(struct net_device *dev, | 8892 | static int ipw_wx_get_retry(struct net_device *dev, |
5835 | struct iw_request_info *info, | 8893 | struct iw_request_info *info, |
5836 | union iwreq_data *wrqu, char *extra) | 8894 | union iwreq_data *wrqu, char *extra) |
5837 | { | 8895 | { |
5838 | IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); | 8896 | struct ipw_priv *priv = ieee80211_priv(dev); |
5839 | return -EOPNOTSUPP; | 8897 | |
8898 | down(&priv->sem); | ||
8899 | wrqu->retry.disabled = 0; | ||
8900 | |||
8901 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | ||
8902 | up(&priv->sem); | ||
8903 | return -EINVAL; | ||
8904 | } | ||
8905 | |||
8906 | if (wrqu->retry.flags & IW_RETRY_MAX) { | ||
8907 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; | ||
8908 | wrqu->retry.value = priv->long_retry_limit; | ||
8909 | } else if (wrqu->retry.flags & IW_RETRY_MIN) { | ||
8910 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; | ||
8911 | wrqu->retry.value = priv->short_retry_limit; | ||
8912 | } else { | ||
8913 | wrqu->retry.flags = IW_RETRY_LIMIT; | ||
8914 | wrqu->retry.value = priv->short_retry_limit; | ||
8915 | } | ||
8916 | up(&priv->sem); | ||
8917 | |||
8918 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); | ||
8919 | |||
8920 | return 0; | ||
8921 | } | ||
8922 | |||
8923 | static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | ||
8924 | int essid_len) | ||
8925 | { | ||
8926 | struct ipw_scan_request_ext scan; | ||
8927 | int err = 0, scan_type; | ||
8928 | |||
8929 | down(&priv->sem); | ||
8930 | |||
8931 | if (priv->status & STATUS_RF_KILL_MASK) { | ||
8932 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); | ||
8933 | priv->status |= STATUS_SCAN_PENDING; | ||
8934 | goto done; | ||
8935 | } | ||
8936 | |||
8937 | IPW_DEBUG_HC("starting request direct scan!\n"); | ||
8938 | |||
8939 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | ||
8940 | err = wait_event_interruptible(priv->wait_state, | ||
8941 | !(priv-> | ||
8942 | status & (STATUS_SCANNING | | ||
8943 | STATUS_SCAN_ABORTING))); | ||
8944 | if (err) { | ||
8945 | IPW_DEBUG_HC("aborting direct scan"); | ||
8946 | goto done; | ||
8947 | } | ||
8948 | } | ||
8949 | memset(&scan, 0, sizeof(scan)); | ||
8950 | |||
8951 | if (priv->config & CFG_SPEED_SCAN) | ||
8952 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
8953 | cpu_to_le16(30); | ||
8954 | else | ||
8955 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
8956 | cpu_to_le16(20); | ||
8957 | |||
8958 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | ||
8959 | cpu_to_le16(20); | ||
8960 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
8961 | scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); | ||
8962 | |||
8963 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
8964 | |||
8965 | err = ipw_send_ssid(priv, essid, essid_len); | ||
8966 | if (err) { | ||
8967 | IPW_DEBUG_HC("Attempt to send SSID command failed\n"); | ||
8968 | goto done; | ||
8969 | } | ||
8970 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
8971 | |||
8972 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
8973 | |||
8974 | err = ipw_send_scan_request_ext(priv, &scan); | ||
8975 | if (err) { | ||
8976 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
8977 | goto done; | ||
8978 | } | ||
8979 | |||
8980 | priv->status |= STATUS_SCANNING; | ||
8981 | |||
8982 | done: | ||
8983 | up(&priv->sem); | ||
8984 | return err; | ||
5840 | } | 8985 | } |
5841 | 8986 | ||
5842 | static int ipw_wx_set_scan(struct net_device *dev, | 8987 | static int ipw_wx_set_scan(struct net_device *dev, |
@@ -5844,9 +8989,21 @@ static int ipw_wx_set_scan(struct net_device *dev, | |||
5844 | union iwreq_data *wrqu, char *extra) | 8989 | union iwreq_data *wrqu, char *extra) |
5845 | { | 8990 | { |
5846 | struct ipw_priv *priv = ieee80211_priv(dev); | 8991 | struct ipw_priv *priv = ieee80211_priv(dev); |
8992 | struct iw_scan_req *req = NULL; | ||
8993 | if (wrqu->data.length | ||
8994 | && wrqu->data.length == sizeof(struct iw_scan_req)) { | ||
8995 | req = (struct iw_scan_req *)extra; | ||
8996 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | ||
8997 | ipw_request_direct_scan(priv, req->essid, | ||
8998 | req->essid_len); | ||
8999 | return 0; | ||
9000 | } | ||
9001 | } | ||
9002 | |||
5847 | IPW_DEBUG_WX("Start scan\n"); | 9003 | IPW_DEBUG_WX("Start scan\n"); |
5848 | if (ipw_request_scan(priv)) | 9004 | |
5849 | return -EIO; | 9005 | queue_work(priv->workqueue, &priv->request_scan); |
9006 | |||
5850 | return 0; | 9007 | return 0; |
5851 | } | 9008 | } |
5852 | 9009 | ||
@@ -5863,7 +9020,21 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
5863 | union iwreq_data *wrqu, char *key) | 9020 | union iwreq_data *wrqu, char *key) |
5864 | { | 9021 | { |
5865 | struct ipw_priv *priv = ieee80211_priv(dev); | 9022 | struct ipw_priv *priv = ieee80211_priv(dev); |
5866 | return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | 9023 | int ret; |
9024 | u32 cap = priv->capability; | ||
9025 | |||
9026 | down(&priv->sem); | ||
9027 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | ||
9028 | |||
9029 | /* In IBSS mode, we need to notify the firmware to update | ||
9030 | * the beacon info after we changed the capability. */ | ||
9031 | if (cap != priv->capability && | ||
9032 | priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
9033 | priv->status & STATUS_ASSOCIATED) | ||
9034 | ipw_disassociate(priv); | ||
9035 | |||
9036 | up(&priv->sem); | ||
9037 | return ret; | ||
5867 | } | 9038 | } |
5868 | 9039 | ||
5869 | static int ipw_wx_get_encode(struct net_device *dev, | 9040 | static int ipw_wx_get_encode(struct net_device *dev, |
@@ -5880,17 +9051,17 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5880 | { | 9051 | { |
5881 | struct ipw_priv *priv = ieee80211_priv(dev); | 9052 | struct ipw_priv *priv = ieee80211_priv(dev); |
5882 | int err; | 9053 | int err; |
5883 | 9054 | down(&priv->sem); | |
5884 | if (wrqu->power.disabled) { | 9055 | if (wrqu->power.disabled) { |
5885 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); | 9056 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); |
5886 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); | 9057 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); |
5887 | if (err) { | 9058 | if (err) { |
5888 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9059 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9060 | up(&priv->sem); | ||
5889 | return err; | 9061 | return err; |
5890 | } | 9062 | } |
5891 | |||
5892 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); | 9063 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); |
5893 | 9064 | up(&priv->sem); | |
5894 | return 0; | 9065 | return 0; |
5895 | } | 9066 | } |
5896 | 9067 | ||
@@ -5902,6 +9073,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5902 | default: /* Otherwise we don't support it */ | 9073 | default: /* Otherwise we don't support it */ |
5903 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 9074 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
5904 | wrqu->power.flags); | 9075 | wrqu->power.flags); |
9076 | up(&priv->sem); | ||
5905 | return -EOPNOTSUPP; | 9077 | return -EOPNOTSUPP; |
5906 | } | 9078 | } |
5907 | 9079 | ||
@@ -5914,11 +9086,12 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5914 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 9086 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
5915 | if (err) { | 9087 | if (err) { |
5916 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9088 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9089 | up(&priv->sem); | ||
5917 | return err; | 9090 | return err; |
5918 | } | 9091 | } |
5919 | 9092 | ||
5920 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); | 9093 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
5921 | 9094 | up(&priv->sem); | |
5922 | return 0; | 9095 | return 0; |
5923 | } | 9096 | } |
5924 | 9097 | ||
@@ -5927,13 +9100,13 @@ static int ipw_wx_get_power(struct net_device *dev, | |||
5927 | union iwreq_data *wrqu, char *extra) | 9100 | union iwreq_data *wrqu, char *extra) |
5928 | { | 9101 | { |
5929 | struct ipw_priv *priv = ieee80211_priv(dev); | 9102 | struct ipw_priv *priv = ieee80211_priv(dev); |
5930 | 9103 | down(&priv->sem); | |
5931 | if (!(priv->power_mode & IPW_POWER_ENABLED)) { | 9104 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
5932 | wrqu->power.disabled = 1; | 9105 | wrqu->power.disabled = 1; |
5933 | } else { | 9106 | else |
5934 | wrqu->power.disabled = 0; | 9107 | wrqu->power.disabled = 0; |
5935 | } | ||
5936 | 9108 | ||
9109 | up(&priv->sem); | ||
5937 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); | 9110 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); |
5938 | 9111 | ||
5939 | return 0; | 9112 | return 0; |
@@ -5946,7 +9119,7 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
5946 | struct ipw_priv *priv = ieee80211_priv(dev); | 9119 | struct ipw_priv *priv = ieee80211_priv(dev); |
5947 | int mode = *(int *)extra; | 9120 | int mode = *(int *)extra; |
5948 | int err; | 9121 | int err; |
5949 | 9122 | down(&priv->sem); | |
5950 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { | 9123 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { |
5951 | mode = IPW_POWER_AC; | 9124 | mode = IPW_POWER_AC; |
5952 | priv->power_mode = mode; | 9125 | priv->power_mode = mode; |
@@ -5959,10 +9132,11 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
5959 | 9132 | ||
5960 | if (err) { | 9133 | if (err) { |
5961 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9134 | IPW_DEBUG_WX("failed setting power mode.\n"); |
9135 | up(&priv->sem); | ||
5962 | return err; | 9136 | return err; |
5963 | } | 9137 | } |
5964 | } | 9138 | } |
5965 | 9139 | up(&priv->sem); | |
5966 | return 0; | 9140 | return 0; |
5967 | } | 9141 | } |
5968 | 9142 | ||
@@ -6011,7 +9185,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6011 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); | 9185 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); |
6012 | return -EINVAL; | 9186 | return -EINVAL; |
6013 | } | 9187 | } |
6014 | 9188 | down(&priv->sem); | |
6015 | if (priv->adapter == IPW_2915ABG) { | 9189 | if (priv->adapter == IPW_2915ABG) { |
6016 | priv->ieee->abg_true = 1; | 9190 | priv->ieee->abg_true = 1; |
6017 | if (mode & IEEE_A) { | 9191 | if (mode & IEEE_A) { |
@@ -6023,6 +9197,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6023 | if (mode & IEEE_A) { | 9197 | if (mode & IEEE_A) { |
6024 | IPW_WARNING("Attempt to set 2200BG into " | 9198 | IPW_WARNING("Attempt to set 2200BG into " |
6025 | "802.11a mode\n"); | 9199 | "802.11a mode\n"); |
9200 | up(&priv->sem); | ||
6026 | return -EINVAL; | 9201 | return -EINVAL; |
6027 | } | 9202 | } |
6028 | 9203 | ||
@@ -6046,20 +9221,20 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6046 | priv->ieee->modulation = modulation; | 9221 | priv->ieee->modulation = modulation; |
6047 | init_supported_rates(priv, &priv->rates); | 9222 | init_supported_rates(priv, &priv->rates); |
6048 | 9223 | ||
6049 | /* If we are currently associated, or trying to associate | 9224 | /* Network configuration changed -- force [re]association */ |
6050 | * then see if this is a new configuration (causing us to | 9225 | IPW_DEBUG_ASSOC("[re]association triggered due to mode change.\n"); |
6051 | * disassociate) */ | 9226 | if (!ipw_disassociate(priv)) { |
6052 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | ||
6053 | /* The resulting association will trigger | ||
6054 | * the new rates to be sent to the device */ | ||
6055 | IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); | ||
6056 | ipw_disassociate(priv); | ||
6057 | } else | ||
6058 | ipw_send_supported_rates(priv, &priv->rates); | 9227 | ipw_send_supported_rates(priv, &priv->rates); |
9228 | ipw_associate(priv); | ||
9229 | } | ||
9230 | |||
9231 | /* Update the band LEDs */ | ||
9232 | ipw_led_band_on(priv); | ||
6059 | 9233 | ||
6060 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", | 9234 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", |
6061 | mode & IEEE_A ? 'a' : '.', | 9235 | mode & IEEE_A ? 'a' : '.', |
6062 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); | 9236 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); |
9237 | up(&priv->sem); | ||
6063 | return 0; | 9238 | return 0; |
6064 | } | 9239 | } |
6065 | 9240 | ||
@@ -6068,124 +9243,234 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
6068 | union iwreq_data *wrqu, char *extra) | 9243 | union iwreq_data *wrqu, char *extra) |
6069 | { | 9244 | { |
6070 | struct ipw_priv *priv = ieee80211_priv(dev); | 9245 | struct ipw_priv *priv = ieee80211_priv(dev); |
6071 | 9246 | down(&priv->sem); | |
6072 | switch (priv->ieee->freq_band) { | 9247 | switch (priv->ieee->mode) { |
6073 | case IEEE80211_24GHZ_BAND: | 9248 | case IEEE_A: |
6074 | switch (priv->ieee->modulation) { | ||
6075 | case IEEE80211_CCK_MODULATION: | ||
6076 | strncpy(extra, "802.11b (2)", MAX_WX_STRING); | ||
6077 | break; | ||
6078 | case IEEE80211_OFDM_MODULATION: | ||
6079 | strncpy(extra, "802.11g (4)", MAX_WX_STRING); | ||
6080 | break; | ||
6081 | default: | ||
6082 | strncpy(extra, "802.11bg (6)", MAX_WX_STRING); | ||
6083 | break; | ||
6084 | } | ||
6085 | break; | ||
6086 | |||
6087 | case IEEE80211_52GHZ_BAND: | ||
6088 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); | 9249 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); |
6089 | break; | 9250 | break; |
6090 | 9251 | case IEEE_B: | |
6091 | default: /* Mixed Band */ | 9252 | strncpy(extra, "802.11b (2)", MAX_WX_STRING); |
6092 | switch (priv->ieee->modulation) { | 9253 | break; |
6093 | case IEEE80211_CCK_MODULATION: | 9254 | case IEEE_A | IEEE_B: |
6094 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); | 9255 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); |
6095 | break; | 9256 | break; |
6096 | case IEEE80211_OFDM_MODULATION: | 9257 | case IEEE_G: |
6097 | strncpy(extra, "802.11ag (5)", MAX_WX_STRING); | 9258 | strncpy(extra, "802.11g (4)", MAX_WX_STRING); |
6098 | break; | 9259 | break; |
6099 | default: | 9260 | case IEEE_A | IEEE_G: |
6100 | strncpy(extra, "802.11abg (7)", MAX_WX_STRING); | 9261 | strncpy(extra, "802.11ag (5)", MAX_WX_STRING); |
6101 | break; | 9262 | break; |
6102 | } | 9263 | case IEEE_B | IEEE_G: |
9264 | strncpy(extra, "802.11bg (6)", MAX_WX_STRING); | ||
9265 | break; | ||
9266 | case IEEE_A | IEEE_B | IEEE_G: | ||
9267 | strncpy(extra, "802.11abg (7)", MAX_WX_STRING); | ||
9268 | break; | ||
9269 | default: | ||
9270 | strncpy(extra, "unknown", MAX_WX_STRING); | ||
6103 | break; | 9271 | break; |
6104 | } | 9272 | } |
6105 | 9273 | ||
6106 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); | 9274 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); |
6107 | 9275 | ||
6108 | wrqu->data.length = strlen(extra) + 1; | 9276 | wrqu->data.length = strlen(extra) + 1; |
9277 | up(&priv->sem); | ||
6109 | 9278 | ||
6110 | return 0; | 9279 | return 0; |
6111 | } | 9280 | } |
6112 | 9281 | ||
6113 | #ifdef CONFIG_IPW_PROMISC | 9282 | static int ipw_wx_set_preamble(struct net_device *dev, |
6114 | static int ipw_wx_set_promisc(struct net_device *dev, | 9283 | struct iw_request_info *info, |
9284 | union iwreq_data *wrqu, char *extra) | ||
9285 | { | ||
9286 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9287 | int mode = *(int *)extra; | ||
9288 | down(&priv->sem); | ||
9289 | /* Switching from SHORT -> LONG requires a disassociation */ | ||
9290 | if (mode == 1) { | ||
9291 | if (!(priv->config & CFG_PREAMBLE_LONG)) { | ||
9292 | priv->config |= CFG_PREAMBLE_LONG; | ||
9293 | |||
9294 | /* Network configuration changed -- force [re]association */ | ||
9295 | IPW_DEBUG_ASSOC | ||
9296 | ("[re]association triggered due to preamble change.\n"); | ||
9297 | if (!ipw_disassociate(priv)) | ||
9298 | ipw_associate(priv); | ||
9299 | } | ||
9300 | goto done; | ||
9301 | } | ||
9302 | |||
9303 | if (mode == 0) { | ||
9304 | priv->config &= ~CFG_PREAMBLE_LONG; | ||
9305 | goto done; | ||
9306 | } | ||
9307 | up(&priv->sem); | ||
9308 | return -EINVAL; | ||
9309 | |||
9310 | done: | ||
9311 | up(&priv->sem); | ||
9312 | return 0; | ||
9313 | } | ||
9314 | |||
9315 | static int ipw_wx_get_preamble(struct net_device *dev, | ||
9316 | struct iw_request_info *info, | ||
9317 | union iwreq_data *wrqu, char *extra) | ||
9318 | { | ||
9319 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9320 | down(&priv->sem); | ||
9321 | if (priv->config & CFG_PREAMBLE_LONG) | ||
9322 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); | ||
9323 | else | ||
9324 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); | ||
9325 | up(&priv->sem); | ||
9326 | return 0; | ||
9327 | } | ||
9328 | |||
9329 | #ifdef CONFIG_IPW2200_MONITOR | ||
9330 | static int ipw_wx_set_monitor(struct net_device *dev, | ||
6115 | struct iw_request_info *info, | 9331 | struct iw_request_info *info, |
6116 | union iwreq_data *wrqu, char *extra) | 9332 | union iwreq_data *wrqu, char *extra) |
6117 | { | 9333 | { |
6118 | struct ipw_priv *priv = ieee80211_priv(dev); | 9334 | struct ipw_priv *priv = ieee80211_priv(dev); |
6119 | int *parms = (int *)extra; | 9335 | int *parms = (int *)extra; |
6120 | int enable = (parms[0] > 0); | 9336 | int enable = (parms[0] > 0); |
6121 | 9337 | down(&priv->sem); | |
6122 | IPW_DEBUG_WX("SET PROMISC: %d %d\n", enable, parms[1]); | 9338 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); |
6123 | if (enable) { | 9339 | if (enable) { |
6124 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9340 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
9341 | #ifdef CONFIG_IEEE80211_RADIOTAP | ||
9342 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
9343 | #else | ||
6125 | priv->net_dev->type = ARPHRD_IEEE80211; | 9344 | priv->net_dev->type = ARPHRD_IEEE80211; |
6126 | ipw_adapter_restart(priv); | 9345 | #endif |
9346 | queue_work(priv->workqueue, &priv->adapter_restart); | ||
6127 | } | 9347 | } |
6128 | 9348 | ||
6129 | ipw_set_channel(priv, parms[1]); | 9349 | ipw_set_channel(priv, parms[1]); |
6130 | } else { | 9350 | } else { |
6131 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) | 9351 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
9352 | up(&priv->sem); | ||
6132 | return 0; | 9353 | return 0; |
9354 | } | ||
6133 | priv->net_dev->type = ARPHRD_ETHER; | 9355 | priv->net_dev->type = ARPHRD_ETHER; |
6134 | ipw_adapter_restart(priv); | 9356 | queue_work(priv->workqueue, &priv->adapter_restart); |
6135 | } | 9357 | } |
9358 | up(&priv->sem); | ||
6136 | return 0; | 9359 | return 0; |
6137 | } | 9360 | } |
6138 | 9361 | ||
9362 | #endif // CONFIG_IPW2200_MONITOR | ||
9363 | |||
6139 | static int ipw_wx_reset(struct net_device *dev, | 9364 | static int ipw_wx_reset(struct net_device *dev, |
6140 | struct iw_request_info *info, | 9365 | struct iw_request_info *info, |
6141 | union iwreq_data *wrqu, char *extra) | 9366 | union iwreq_data *wrqu, char *extra) |
6142 | { | 9367 | { |
6143 | struct ipw_priv *priv = ieee80211_priv(dev); | 9368 | struct ipw_priv *priv = ieee80211_priv(dev); |
6144 | IPW_DEBUG_WX("RESET\n"); | 9369 | IPW_DEBUG_WX("RESET\n"); |
6145 | ipw_adapter_restart(priv); | 9370 | queue_work(priv->workqueue, &priv->adapter_restart); |
9371 | return 0; | ||
9372 | } | ||
9373 | |||
9374 | static int ipw_wx_sw_reset(struct net_device *dev, | ||
9375 | struct iw_request_info *info, | ||
9376 | union iwreq_data *wrqu, char *extra) | ||
9377 | { | ||
9378 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9379 | union iwreq_data wrqu_sec = { | ||
9380 | .encoding = { | ||
9381 | .flags = IW_ENCODE_DISABLED, | ||
9382 | }, | ||
9383 | }; | ||
9384 | int ret; | ||
9385 | |||
9386 | IPW_DEBUG_WX("SW_RESET\n"); | ||
9387 | |||
9388 | down(&priv->sem); | ||
9389 | |||
9390 | ret = ipw_sw_reset(priv, 0); | ||
9391 | if (!ret) { | ||
9392 | free_firmware(); | ||
9393 | ipw_adapter_restart(priv); | ||
9394 | } | ||
9395 | |||
9396 | /* The SW reset bit might have been toggled on by the 'disable' | ||
9397 | * module parameter, so take appropriate action */ | ||
9398 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); | ||
9399 | |||
9400 | up(&priv->sem); | ||
9401 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); | ||
9402 | down(&priv->sem); | ||
9403 | |||
9404 | if (!(priv->status & STATUS_RF_KILL_MASK)) { | ||
9405 | /* Configuration likely changed -- force [re]association */ | ||
9406 | IPW_DEBUG_ASSOC("[re]association triggered due to sw " | ||
9407 | "reset.\n"); | ||
9408 | if (!ipw_disassociate(priv)) | ||
9409 | ipw_associate(priv); | ||
9410 | } | ||
9411 | |||
9412 | up(&priv->sem); | ||
9413 | |||
6146 | return 0; | 9414 | return 0; |
6147 | } | 9415 | } |
6148 | #endif // CONFIG_IPW_PROMISC | ||
6149 | 9416 | ||
6150 | /* Rebase the WE IOCTLs to zero for the handler array */ | 9417 | /* Rebase the WE IOCTLs to zero for the handler array */ |
6151 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] | 9418 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] |
6152 | static iw_handler ipw_wx_handlers[] = { | 9419 | static iw_handler ipw_wx_handlers[] = { |
6153 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, | 9420 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, |
6154 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, | 9421 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, |
6155 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, | 9422 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, |
6156 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, | 9423 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, |
6157 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, | 9424 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, |
6158 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, | 9425 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, |
6159 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, | 9426 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, |
6160 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, | 9427 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, |
6161 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, | 9428 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, |
6162 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, | 9429 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, |
6163 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, | 9430 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, |
6164 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, | 9431 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, |
6165 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, | 9432 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, |
6166 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, | 9433 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, |
6167 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, | 9434 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, |
6168 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, | 9435 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, |
6169 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, | 9436 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, |
6170 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, | 9437 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, |
6171 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, | 9438 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, |
6172 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, | 9439 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, |
6173 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, | 9440 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, |
6174 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, | 9441 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, |
6175 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, | 9442 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, |
6176 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, | 9443 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, |
6177 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, | 9444 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, |
6178 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, | 9445 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, |
6179 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, | 9446 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, |
6180 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, | 9447 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, |
9448 | IW_IOCTL(SIOCSIWSPY) = iw_handler_set_spy, | ||
9449 | IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy, | ||
9450 | IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy, | ||
9451 | IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, | ||
9452 | IW_IOCTL(SIOCSIWGENIE) = ipw_wx_set_genie, | ||
9453 | IW_IOCTL(SIOCGIWGENIE) = ipw_wx_get_genie, | ||
9454 | IW_IOCTL(SIOCSIWMLME) = ipw_wx_set_mlme, | ||
9455 | IW_IOCTL(SIOCSIWAUTH) = ipw_wx_set_auth, | ||
9456 | IW_IOCTL(SIOCGIWAUTH) = ipw_wx_get_auth, | ||
9457 | IW_IOCTL(SIOCSIWENCODEEXT) = ipw_wx_set_encodeext, | ||
9458 | IW_IOCTL(SIOCGIWENCODEEXT) = ipw_wx_get_encodeext, | ||
6181 | }; | 9459 | }; |
6182 | 9460 | ||
6183 | #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV | 9461 | enum { |
6184 | #define IPW_PRIV_GET_POWER SIOCIWFIRSTPRIV+1 | 9462 | IPW_PRIV_SET_POWER = SIOCIWFIRSTPRIV, |
6185 | #define IPW_PRIV_SET_MODE SIOCIWFIRSTPRIV+2 | 9463 | IPW_PRIV_GET_POWER, |
6186 | #define IPW_PRIV_GET_MODE SIOCIWFIRSTPRIV+3 | 9464 | IPW_PRIV_SET_MODE, |
6187 | #define IPW_PRIV_SET_PROMISC SIOCIWFIRSTPRIV+4 | 9465 | IPW_PRIV_GET_MODE, |
6188 | #define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 | 9466 | IPW_PRIV_SET_PREAMBLE, |
9467 | IPW_PRIV_GET_PREAMBLE, | ||
9468 | IPW_PRIV_RESET, | ||
9469 | IPW_PRIV_SW_RESET, | ||
9470 | #ifdef CONFIG_IPW2200_MONITOR | ||
9471 | IPW_PRIV_SET_MONITOR, | ||
9472 | #endif | ||
9473 | }; | ||
6189 | 9474 | ||
6190 | static struct iw_priv_args ipw_priv_args[] = { | 9475 | static struct iw_priv_args ipw_priv_args[] = { |
6191 | { | 9476 | { |
@@ -6204,14 +9489,25 @@ static struct iw_priv_args ipw_priv_args[] = { | |||
6204 | .cmd = IPW_PRIV_GET_MODE, | 9489 | .cmd = IPW_PRIV_GET_MODE, |
6205 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, | 9490 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, |
6206 | .name = "get_mode"}, | 9491 | .name = "get_mode"}, |
6207 | #ifdef CONFIG_IPW_PROMISC | ||
6208 | { | 9492 | { |
6209 | IPW_PRIV_SET_PROMISC, | 9493 | .cmd = IPW_PRIV_SET_PREAMBLE, |
6210 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, | 9494 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
9495 | .name = "set_preamble"}, | ||
9496 | { | ||
9497 | .cmd = IPW_PRIV_GET_PREAMBLE, | ||
9498 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, | ||
9499 | .name = "get_preamble"}, | ||
6211 | { | 9500 | { |
6212 | IPW_PRIV_RESET, | 9501 | IPW_PRIV_RESET, |
6213 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, | 9502 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, |
6214 | #endif /* CONFIG_IPW_PROMISC */ | 9503 | { |
9504 | IPW_PRIV_SW_RESET, | ||
9505 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "sw_reset"}, | ||
9506 | #ifdef CONFIG_IPW2200_MONITOR | ||
9507 | { | ||
9508 | IPW_PRIV_SET_MONITOR, | ||
9509 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, | ||
9510 | #endif /* CONFIG_IPW2200_MONITOR */ | ||
6215 | }; | 9511 | }; |
6216 | 9512 | ||
6217 | static iw_handler ipw_priv_handler[] = { | 9513 | static iw_handler ipw_priv_handler[] = { |
@@ -6219,19 +9515,23 @@ static iw_handler ipw_priv_handler[] = { | |||
6219 | ipw_wx_get_powermode, | 9515 | ipw_wx_get_powermode, |
6220 | ipw_wx_set_wireless_mode, | 9516 | ipw_wx_set_wireless_mode, |
6221 | ipw_wx_get_wireless_mode, | 9517 | ipw_wx_get_wireless_mode, |
6222 | #ifdef CONFIG_IPW_PROMISC | 9518 | ipw_wx_set_preamble, |
6223 | ipw_wx_set_promisc, | 9519 | ipw_wx_get_preamble, |
6224 | ipw_wx_reset, | 9520 | ipw_wx_reset, |
9521 | ipw_wx_sw_reset, | ||
9522 | #ifdef CONFIG_IPW2200_MONITOR | ||
9523 | ipw_wx_set_monitor, | ||
6225 | #endif | 9524 | #endif |
6226 | }; | 9525 | }; |
6227 | 9526 | ||
6228 | static struct iw_handler_def ipw_wx_handler_def = { | 9527 | static struct iw_handler_def ipw_wx_handler_def = { |
6229 | .standard = ipw_wx_handlers, | 9528 | .standard = ipw_wx_handlers, |
6230 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), | 9529 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), |
6231 | .num_private = ARRAY_SIZE(ipw_priv_handler), | 9530 | .num_private = ARRAY_SIZE(ipw_priv_handler), |
6232 | .num_private_args = ARRAY_SIZE(ipw_priv_args), | 9531 | .num_private_args = ARRAY_SIZE(ipw_priv_args), |
6233 | .private = ipw_priv_handler, | 9532 | .private = ipw_priv_handler, |
6234 | .private_args = ipw_priv_args, | 9533 | .private_args = ipw_priv_args, |
9534 | .get_wireless_stats = ipw_get_wireless_stats, | ||
6235 | }; | 9535 | }; |
6236 | 9536 | ||
6237 | /* | 9537 | /* |
@@ -6246,8 +9546,8 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
6246 | 9546 | ||
6247 | wstats = &priv->wstats; | 9547 | wstats = &priv->wstats; |
6248 | 9548 | ||
6249 | /* if hw is disabled, then ipw2100_get_ordinal() can't be called. | 9549 | /* if hw is disabled, then ipw_get_ordinal() can't be called. |
6250 | * ipw2100_wx_wireless_stats seems to be called before fw is | 9550 | * netdev->get_wireless_stats seems to be called before fw is |
6251 | * initialized. STATUS_ASSOCIATED will only be set if the hw is up | 9551 | * initialized. STATUS_ASSOCIATED will only be set if the hw is up |
6252 | * and associated; if not associcated, the values are all meaningless | 9552 | * and associated; if not associcated, the values are all meaningless |
6253 | * anyway, so set them all to NULL and INVALID */ | 9553 | * anyway, so set them all to NULL and INVALID */ |
@@ -6298,7 +9598,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config) | |||
6298 | sys_config->dot11g_auto_detection = 0; | 9598 | sys_config->dot11g_auto_detection = 0; |
6299 | sys_config->enable_cts_to_self = 0; | 9599 | sys_config->enable_cts_to_self = 0; |
6300 | sys_config->bt_coexist_collision_thr = 0; | 9600 | sys_config->bt_coexist_collision_thr = 0; |
6301 | sys_config->pass_noise_stats_to_host = 1; | 9601 | sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 |
6302 | } | 9602 | } |
6303 | 9603 | ||
6304 | static int ipw_net_open(struct net_device *dev) | 9604 | static int ipw_net_open(struct net_device *dev) |
@@ -6306,9 +9606,11 @@ static int ipw_net_open(struct net_device *dev) | |||
6306 | struct ipw_priv *priv = ieee80211_priv(dev); | 9606 | struct ipw_priv *priv = ieee80211_priv(dev); |
6307 | IPW_DEBUG_INFO("dev->open\n"); | 9607 | IPW_DEBUG_INFO("dev->open\n"); |
6308 | /* we should be verifying the device is ready to be opened */ | 9608 | /* we should be verifying the device is ready to be opened */ |
9609 | down(&priv->sem); | ||
6309 | if (!(priv->status & STATUS_RF_KILL_MASK) && | 9610 | if (!(priv->status & STATUS_RF_KILL_MASK) && |
6310 | (priv->status & STATUS_ASSOCIATED)) | 9611 | (priv->status & STATUS_ASSOCIATED)) |
6311 | netif_start_queue(dev); | 9612 | netif_start_queue(dev); |
9613 | up(&priv->sem); | ||
6312 | return 0; | 9614 | return 0; |
6313 | } | 9615 | } |
6314 | 9616 | ||
@@ -6326,22 +9628,34 @@ modify to send one tfd per fragment instead of using chunking. otherwise | |||
6326 | we need to heavily modify the ieee80211_skb_to_txb. | 9628 | we need to heavily modify the ieee80211_skb_to_txb. |
6327 | */ | 9629 | */ |
6328 | 9630 | ||
6329 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | 9631 | static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, |
9632 | int pri) | ||
6330 | { | 9633 | { |
6331 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) | 9634 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) |
6332 | txb->fragments[0]->data; | 9635 | txb->fragments[0]->data; |
6333 | int i = 0; | 9636 | int i = 0; |
6334 | struct tfd_frame *tfd; | 9637 | struct tfd_frame *tfd; |
9638 | #ifdef CONFIG_IPW_QOS | ||
9639 | int tx_id = ipw_get_tx_queue_number(priv, pri); | ||
9640 | struct clx2_tx_queue *txq = &priv->txq[tx_id]; | ||
9641 | #else | ||
6335 | struct clx2_tx_queue *txq = &priv->txq[0]; | 9642 | struct clx2_tx_queue *txq = &priv->txq[0]; |
9643 | #endif | ||
6336 | struct clx2_queue *q = &txq->q; | 9644 | struct clx2_queue *q = &txq->q; |
6337 | u8 id, hdr_len, unicast; | 9645 | u8 id, hdr_len, unicast; |
6338 | u16 remaining_bytes; | 9646 | u16 remaining_bytes; |
9647 | int fc; | ||
9648 | |||
9649 | /* If there isn't room in the queue, we return busy and let the | ||
9650 | * network stack requeue the packet for us */ | ||
9651 | if (ipw_queue_space(q) < q->high_mark) | ||
9652 | return NETDEV_TX_BUSY; | ||
6339 | 9653 | ||
6340 | switch (priv->ieee->iw_mode) { | 9654 | switch (priv->ieee->iw_mode) { |
6341 | case IW_MODE_ADHOC: | 9655 | case IW_MODE_ADHOC: |
6342 | hdr_len = IEEE80211_3ADDR_LEN; | 9656 | hdr_len = IEEE80211_3ADDR_LEN; |
6343 | unicast = !is_broadcast_ether_addr(hdr->addr1) && | 9657 | unicast = !(is_multicast_ether_addr(hdr->addr1) || |
6344 | !is_multicast_ether_addr(hdr->addr1); | 9658 | is_broadcast_ether_addr(hdr->addr1)); |
6345 | id = ipw_find_station(priv, hdr->addr1); | 9659 | id = ipw_find_station(priv, hdr->addr1); |
6346 | if (id == IPW_INVALID_STATION) { | 9660 | if (id == IPW_INVALID_STATION) { |
6347 | id = ipw_add_station(priv, hdr->addr1); | 9661 | id = ipw_add_station(priv, hdr->addr1); |
@@ -6356,8 +9670,8 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6356 | 9670 | ||
6357 | case IW_MODE_INFRA: | 9671 | case IW_MODE_INFRA: |
6358 | default: | 9672 | default: |
6359 | unicast = !is_broadcast_ether_addr(hdr->addr3) && | 9673 | unicast = !(is_multicast_ether_addr(hdr->addr3) || |
6360 | !is_multicast_ether_addr(hdr->addr3); | 9674 | is_broadcast_ether_addr(hdr->addr3)); |
6361 | hdr_len = IEEE80211_3ADDR_LEN; | 9675 | hdr_len = IEEE80211_3ADDR_LEN; |
6362 | id = 0; | 9676 | id = 0; |
6363 | break; | 9677 | break; |
@@ -6372,26 +9686,83 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6372 | tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; | 9686 | tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; |
6373 | 9687 | ||
6374 | tfd->u.data.cmd_id = DINO_CMD_TX; | 9688 | tfd->u.data.cmd_id = DINO_CMD_TX; |
6375 | tfd->u.data.len = txb->payload_size; | 9689 | tfd->u.data.len = cpu_to_le16(txb->payload_size); |
6376 | remaining_bytes = txb->payload_size; | 9690 | remaining_bytes = txb->payload_size; |
6377 | if (unlikely(!unicast)) | ||
6378 | tfd->u.data.tx_flags = DCT_FLAG_NO_WEP; | ||
6379 | else | ||
6380 | tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD; | ||
6381 | 9691 | ||
6382 | if (priv->assoc_request.ieee_mode == IPW_B_MODE) | 9692 | if (priv->assoc_request.ieee_mode == IPW_B_MODE) |
6383 | tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK; | 9693 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_CCK; |
6384 | else | 9694 | else |
6385 | tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_OFDM; | 9695 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_OFDM; |
6386 | 9696 | ||
6387 | if (priv->config & CFG_PREAMBLE) | 9697 | if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) |
6388 | tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREMBL; | 9698 | tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; |
9699 | |||
9700 | fc = le16_to_cpu(hdr->frame_ctl); | ||
9701 | hdr->frame_ctl = cpu_to_le16(fc & ~IEEE80211_FCTL_MOREFRAGS); | ||
6389 | 9702 | ||
6390 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); | 9703 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); |
6391 | 9704 | ||
9705 | if (likely(unicast)) | ||
9706 | tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; | ||
9707 | |||
9708 | if (txb->encrypted && !priv->ieee->host_encrypt) { | ||
9709 | switch (priv->ieee->sec.level) { | ||
9710 | case SEC_LEVEL_3: | ||
9711 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9712 | IEEE80211_FCTL_PROTECTED; | ||
9713 | /* XXX: ACK flag must be set for CCMP even if it | ||
9714 | * is a multicast/broadcast packet, because CCMP | ||
9715 | * group communication encrypted by GTK is | ||
9716 | * actually done by the AP. */ | ||
9717 | if (!unicast) | ||
9718 | tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; | ||
9719 | |||
9720 | tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; | ||
9721 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_CCM; | ||
9722 | tfd->u.data.key_index = 0; | ||
9723 | tfd->u.data.key_index |= DCT_WEP_INDEX_USE_IMMEDIATE; | ||
9724 | break; | ||
9725 | case SEC_LEVEL_2: | ||
9726 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9727 | IEEE80211_FCTL_PROTECTED; | ||
9728 | tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; | ||
9729 | tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP; | ||
9730 | tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE; | ||
9731 | break; | ||
9732 | case SEC_LEVEL_1: | ||
9733 | tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= | ||
9734 | IEEE80211_FCTL_PROTECTED; | ||
9735 | tfd->u.data.key_index = priv->ieee->tx_keyidx; | ||
9736 | if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <= | ||
9737 | 40) | ||
9738 | tfd->u.data.key_index |= DCT_WEP_KEY_64Bit; | ||
9739 | else | ||
9740 | tfd->u.data.key_index |= DCT_WEP_KEY_128Bit; | ||
9741 | break; | ||
9742 | case SEC_LEVEL_0: | ||
9743 | break; | ||
9744 | default: | ||
9745 | printk(KERN_ERR "Unknow security level %d\n", | ||
9746 | priv->ieee->sec.level); | ||
9747 | break; | ||
9748 | } | ||
9749 | } else | ||
9750 | /* No hardware encryption */ | ||
9751 | tfd->u.data.tx_flags |= DCT_FLAG_NO_WEP; | ||
9752 | |||
9753 | #ifdef CONFIG_IPW_QOS | ||
9754 | ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data), unicast); | ||
9755 | #endif /* CONFIG_IPW_QOS */ | ||
9756 | |||
6392 | /* payload */ | 9757 | /* payload */ |
6393 | tfd->u.data.num_chunks = min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags); | 9758 | tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2), |
6394 | for (i = 0; i < tfd->u.data.num_chunks; i++) { | 9759 | txb->nr_frags)); |
9760 | IPW_DEBUG_FRAG("%i fragments being sent as %i chunks.\n", | ||
9761 | txb->nr_frags, le32_to_cpu(tfd->u.data.num_chunks)); | ||
9762 | for (i = 0; i < le32_to_cpu(tfd->u.data.num_chunks); i++) { | ||
9763 | IPW_DEBUG_FRAG("Adding fragment %i of %i (%d bytes).\n", | ||
9764 | i, le32_to_cpu(tfd->u.data.num_chunks), | ||
9765 | txb->fragments[i]->len - hdr_len); | ||
6395 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", | 9766 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", |
6396 | i, tfd->u.data.num_chunks, | 9767 | i, tfd->u.data.num_chunks, |
6397 | txb->fragments[i]->len - hdr_len); | 9768 | txb->fragments[i]->len - hdr_len); |
@@ -6399,11 +9770,13 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6399 | txb->fragments[i]->len - hdr_len); | 9770 | txb->fragments[i]->len - hdr_len); |
6400 | 9771 | ||
6401 | tfd->u.data.chunk_ptr[i] = | 9772 | tfd->u.data.chunk_ptr[i] = |
6402 | pci_map_single(priv->pci_dev, | 9773 | cpu_to_le32(pci_map_single |
6403 | txb->fragments[i]->data + hdr_len, | 9774 | (priv->pci_dev, |
6404 | txb->fragments[i]->len - hdr_len, | 9775 | txb->fragments[i]->data + hdr_len, |
6405 | PCI_DMA_TODEVICE); | 9776 | txb->fragments[i]->len - hdr_len, |
6406 | tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len; | 9777 | PCI_DMA_TODEVICE)); |
9778 | tfd->u.data.chunk_len[i] = | ||
9779 | cpu_to_le16(txb->fragments[i]->len - hdr_len); | ||
6407 | } | 9780 | } |
6408 | 9781 | ||
6409 | if (i != txb->nr_frags) { | 9782 | if (i != txb->nr_frags) { |
@@ -6418,9 +9791,10 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6418 | remaining_bytes); | 9791 | remaining_bytes); |
6419 | skb = alloc_skb(remaining_bytes, GFP_ATOMIC); | 9792 | skb = alloc_skb(remaining_bytes, GFP_ATOMIC); |
6420 | if (skb != NULL) { | 9793 | if (skb != NULL) { |
6421 | tfd->u.data.chunk_len[i] = remaining_bytes; | 9794 | tfd->u.data.chunk_len[i] = cpu_to_le16(remaining_bytes); |
6422 | for (j = i; j < txb->nr_frags; j++) { | 9795 | for (j = i; j < txb->nr_frags; j++) { |
6423 | int size = txb->fragments[j]->len - hdr_len; | 9796 | int size = txb->fragments[j]->len - hdr_len; |
9797 | |||
6424 | printk(KERN_INFO "Adding frag %d %d...\n", | 9798 | printk(KERN_INFO "Adding frag %d %d...\n", |
6425 | j, size); | 9799 | j, size); |
6426 | memcpy(skb_put(skb, size), | 9800 | memcpy(skb_put(skb, size), |
@@ -6429,10 +9803,14 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6429 | dev_kfree_skb_any(txb->fragments[i]); | 9803 | dev_kfree_skb_any(txb->fragments[i]); |
6430 | txb->fragments[i] = skb; | 9804 | txb->fragments[i] = skb; |
6431 | tfd->u.data.chunk_ptr[i] = | 9805 | tfd->u.data.chunk_ptr[i] = |
6432 | pci_map_single(priv->pci_dev, skb->data, | 9806 | cpu_to_le32(pci_map_single |
6433 | tfd->u.data.chunk_len[i], | 9807 | (priv->pci_dev, skb->data, |
6434 | PCI_DMA_TODEVICE); | 9808 | tfd->u.data.chunk_len[i], |
6435 | tfd->u.data.num_chunks++; | 9809 | PCI_DMA_TODEVICE)); |
9810 | |||
9811 | tfd->u.data.num_chunks = | ||
9812 | cpu_to_le32(le32_to_cpu(tfd->u.data.num_chunks) + | ||
9813 | 1); | ||
6436 | } | 9814 | } |
6437 | } | 9815 | } |
6438 | 9816 | ||
@@ -6440,14 +9818,28 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6440 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); | 9818 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); |
6441 | ipw_write32(priv, q->reg_w, q->first_empty); | 9819 | ipw_write32(priv, q->reg_w, q->first_empty); |
6442 | 9820 | ||
6443 | if (ipw_queue_space(q) < q->high_mark) | 9821 | return NETDEV_TX_OK; |
6444 | netif_stop_queue(priv->net_dev); | ||
6445 | |||
6446 | return; | ||
6447 | 9822 | ||
6448 | drop: | 9823 | drop: |
6449 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); | 9824 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); |
6450 | ieee80211_txb_free(txb); | 9825 | ieee80211_txb_free(txb); |
9826 | return NETDEV_TX_OK; | ||
9827 | } | ||
9828 | |||
9829 | static int ipw_net_is_queue_full(struct net_device *dev, int pri) | ||
9830 | { | ||
9831 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
9832 | #ifdef CONFIG_IPW_QOS | ||
9833 | int tx_id = ipw_get_tx_queue_number(priv, pri); | ||
9834 | struct clx2_tx_queue *txq = &priv->txq[tx_id]; | ||
9835 | #else | ||
9836 | struct clx2_tx_queue *txq = &priv->txq[0]; | ||
9837 | #endif /* CONFIG_IPW_QOS */ | ||
9838 | |||
9839 | if (ipw_queue_space(&txq->q) < txq->q.high_mark) | ||
9840 | return 1; | ||
9841 | |||
9842 | return 0; | ||
6451 | } | 9843 | } |
6452 | 9844 | ||
6453 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | 9845 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, |
@@ -6455,9 +9847,9 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | |||
6455 | { | 9847 | { |
6456 | struct ipw_priv *priv = ieee80211_priv(dev); | 9848 | struct ipw_priv *priv = ieee80211_priv(dev); |
6457 | unsigned long flags; | 9849 | unsigned long flags; |
9850 | int ret; | ||
6458 | 9851 | ||
6459 | IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); | 9852 | IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); |
6460 | |||
6461 | spin_lock_irqsave(&priv->lock, flags); | 9853 | spin_lock_irqsave(&priv->lock, flags); |
6462 | 9854 | ||
6463 | if (!(priv->status & STATUS_ASSOCIATED)) { | 9855 | if (!(priv->status & STATUS_ASSOCIATED)) { |
@@ -6467,10 +9859,12 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | |||
6467 | goto fail_unlock; | 9859 | goto fail_unlock; |
6468 | } | 9860 | } |
6469 | 9861 | ||
6470 | ipw_tx_skb(priv, txb); | 9862 | ret = ipw_tx_skb(priv, txb, pri); |
6471 | 9863 | if (ret == NETDEV_TX_OK) | |
9864 | __ipw_led_activity_on(priv); | ||
6472 | spin_unlock_irqrestore(&priv->lock, flags); | 9865 | spin_unlock_irqrestore(&priv->lock, flags); |
6473 | return 0; | 9866 | |
9867 | return ret; | ||
6474 | 9868 | ||
6475 | fail_unlock: | 9869 | fail_unlock: |
6476 | spin_unlock_irqrestore(&priv->lock, flags); | 9870 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -6497,11 +9891,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) | |||
6497 | struct sockaddr *addr = p; | 9891 | struct sockaddr *addr = p; |
6498 | if (!is_valid_ether_addr(addr->sa_data)) | 9892 | if (!is_valid_ether_addr(addr->sa_data)) |
6499 | return -EADDRNOTAVAIL; | 9893 | return -EADDRNOTAVAIL; |
9894 | down(&priv->sem); | ||
6500 | priv->config |= CFG_CUSTOM_MAC; | 9895 | priv->config |= CFG_CUSTOM_MAC; |
6501 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 9896 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
6502 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", | 9897 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", |
6503 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); | 9898 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); |
6504 | ipw_adapter_restart(priv); | 9899 | queue_work(priv->workqueue, &priv->adapter_restart); |
9900 | up(&priv->sem); | ||
6505 | return 0; | 9901 | return 0; |
6506 | } | 9902 | } |
6507 | 9903 | ||
@@ -6524,7 +9920,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, | |||
6524 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", | 9920 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", |
6525 | vers, date); | 9921 | vers, date); |
6526 | strcpy(info->bus_info, pci_name(p->pci_dev)); | 9922 | strcpy(info->bus_info, pci_name(p->pci_dev)); |
6527 | info->eedump_len = CX2_EEPROM_IMAGE_SIZE; | 9923 | info->eedump_len = IPW_EEPROM_IMAGE_SIZE; |
6528 | } | 9924 | } |
6529 | 9925 | ||
6530 | static u32 ipw_ethtool_get_link(struct net_device *dev) | 9926 | static u32 ipw_ethtool_get_link(struct net_device *dev) |
@@ -6535,7 +9931,7 @@ static u32 ipw_ethtool_get_link(struct net_device *dev) | |||
6535 | 9931 | ||
6536 | static int ipw_ethtool_get_eeprom_len(struct net_device *dev) | 9932 | static int ipw_ethtool_get_eeprom_len(struct net_device *dev) |
6537 | { | 9933 | { |
6538 | return CX2_EEPROM_IMAGE_SIZE; | 9934 | return IPW_EEPROM_IMAGE_SIZE; |
6539 | } | 9935 | } |
6540 | 9936 | ||
6541 | static int ipw_ethtool_get_eeprom(struct net_device *dev, | 9937 | static int ipw_ethtool_get_eeprom(struct net_device *dev, |
@@ -6543,10 +9939,11 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, | |||
6543 | { | 9939 | { |
6544 | struct ipw_priv *p = ieee80211_priv(dev); | 9940 | struct ipw_priv *p = ieee80211_priv(dev); |
6545 | 9941 | ||
6546 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 9942 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
6547 | return -EINVAL; | 9943 | return -EINVAL; |
6548 | 9944 | down(&p->sem); | |
6549 | memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); | 9945 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); |
9946 | up(&p->sem); | ||
6550 | return 0; | 9947 | return 0; |
6551 | } | 9948 | } |
6552 | 9949 | ||
@@ -6556,23 +9953,23 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, | |||
6556 | struct ipw_priv *p = ieee80211_priv(dev); | 9953 | struct ipw_priv *p = ieee80211_priv(dev); |
6557 | int i; | 9954 | int i; |
6558 | 9955 | ||
6559 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 9956 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
6560 | return -EINVAL; | 9957 | return -EINVAL; |
6561 | 9958 | down(&p->sem); | |
6562 | memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); | 9959 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); |
6563 | for (i = IPW_EEPROM_DATA; | 9960 | for (i = IPW_EEPROM_DATA; |
6564 | i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; i++) | 9961 | i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) |
6565 | ipw_write8(p, i, p->eeprom[i]); | 9962 | ipw_write8(p, i, p->eeprom[i]); |
6566 | 9963 | up(&p->sem); | |
6567 | return 0; | 9964 | return 0; |
6568 | } | 9965 | } |
6569 | 9966 | ||
6570 | static struct ethtool_ops ipw_ethtool_ops = { | 9967 | static struct ethtool_ops ipw_ethtool_ops = { |
6571 | .get_link = ipw_ethtool_get_link, | 9968 | .get_link = ipw_ethtool_get_link, |
6572 | .get_drvinfo = ipw_ethtool_get_drvinfo, | 9969 | .get_drvinfo = ipw_ethtool_get_drvinfo, |
6573 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, | 9970 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, |
6574 | .get_eeprom = ipw_ethtool_get_eeprom, | 9971 | .get_eeprom = ipw_ethtool_get_eeprom, |
6575 | .set_eeprom = ipw_ethtool_set_eeprom, | 9972 | .set_eeprom = ipw_ethtool_set_eeprom, |
6576 | }; | 9973 | }; |
6577 | 9974 | ||
6578 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | 9975 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) |
@@ -6590,8 +9987,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6590 | goto none; | 9987 | goto none; |
6591 | } | 9988 | } |
6592 | 9989 | ||
6593 | inta = ipw_read32(priv, CX2_INTA_RW); | 9990 | inta = ipw_read32(priv, IPW_INTA_RW); |
6594 | inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); | 9991 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); |
6595 | 9992 | ||
6596 | if (inta == 0xFFFFFFFF) { | 9993 | if (inta == 0xFFFFFFFF) { |
6597 | /* Hardware disappeared */ | 9994 | /* Hardware disappeared */ |
@@ -6599,7 +9996,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6599 | goto none; | 9996 | goto none; |
6600 | } | 9997 | } |
6601 | 9998 | ||
6602 | if (!(inta & (CX2_INTA_MASK_ALL & inta_mask))) { | 9999 | if (!(inta & (IPW_INTA_MASK_ALL & inta_mask))) { |
6603 | /* Shared interrupt */ | 10000 | /* Shared interrupt */ |
6604 | goto none; | 10001 | goto none; |
6605 | } | 10002 | } |
@@ -6608,8 +10005,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6608 | ipw_disable_interrupts(priv); | 10005 | ipw_disable_interrupts(priv); |
6609 | 10006 | ||
6610 | /* ack current interrupts */ | 10007 | /* ack current interrupts */ |
6611 | inta &= (CX2_INTA_MASK_ALL & inta_mask); | 10008 | inta &= (IPW_INTA_MASK_ALL & inta_mask); |
6612 | ipw_write32(priv, CX2_INTA_RW, inta); | 10009 | ipw_write32(priv, IPW_INTA_RW, inta); |
6613 | 10010 | ||
6614 | /* Cache INTA value for our tasklet */ | 10011 | /* Cache INTA value for our tasklet */ |
6615 | priv->isr_inta = inta; | 10012 | priv->isr_inta = inta; |
@@ -6655,28 +10052,116 @@ static void ipw_rf_kill(void *adapter) | |||
6655 | spin_unlock_irqrestore(&priv->lock, flags); | 10052 | spin_unlock_irqrestore(&priv->lock, flags); |
6656 | } | 10053 | } |
6657 | 10054 | ||
10055 | static void ipw_bg_rf_kill(void *data) | ||
10056 | { | ||
10057 | struct ipw_priv *priv = data; | ||
10058 | down(&priv->sem); | ||
10059 | ipw_rf_kill(data); | ||
10060 | up(&priv->sem); | ||
10061 | } | ||
10062 | |||
10063 | void ipw_link_up(struct ipw_priv *priv) | ||
10064 | { | ||
10065 | priv->last_seq_num = -1; | ||
10066 | priv->last_frag_num = -1; | ||
10067 | priv->last_packet_time = 0; | ||
10068 | |||
10069 | netif_carrier_on(priv->net_dev); | ||
10070 | if (netif_queue_stopped(priv->net_dev)) { | ||
10071 | IPW_DEBUG_NOTIF("waking queue\n"); | ||
10072 | netif_wake_queue(priv->net_dev); | ||
10073 | } else { | ||
10074 | IPW_DEBUG_NOTIF("starting queue\n"); | ||
10075 | netif_start_queue(priv->net_dev); | ||
10076 | } | ||
10077 | |||
10078 | cancel_delayed_work(&priv->request_scan); | ||
10079 | ipw_reset_stats(priv); | ||
10080 | /* Ensure the rate is updated immediately */ | ||
10081 | priv->last_rate = ipw_get_current_rate(priv); | ||
10082 | ipw_gather_stats(priv); | ||
10083 | ipw_led_link_up(priv); | ||
10084 | notify_wx_assoc_event(priv); | ||
10085 | |||
10086 | if (priv->config & CFG_BACKGROUND_SCAN) | ||
10087 | queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); | ||
10088 | } | ||
10089 | |||
10090 | static void ipw_bg_link_up(void *data) | ||
10091 | { | ||
10092 | struct ipw_priv *priv = data; | ||
10093 | down(&priv->sem); | ||
10094 | ipw_link_up(data); | ||
10095 | up(&priv->sem); | ||
10096 | } | ||
10097 | |||
10098 | void ipw_link_down(struct ipw_priv *priv) | ||
10099 | { | ||
10100 | ipw_led_link_down(priv); | ||
10101 | netif_carrier_off(priv->net_dev); | ||
10102 | netif_stop_queue(priv->net_dev); | ||
10103 | notify_wx_assoc_event(priv); | ||
10104 | |||
10105 | /* Cancel any queued work ... */ | ||
10106 | cancel_delayed_work(&priv->request_scan); | ||
10107 | cancel_delayed_work(&priv->adhoc_check); | ||
10108 | cancel_delayed_work(&priv->gather_stats); | ||
10109 | |||
10110 | ipw_reset_stats(priv); | ||
10111 | |||
10112 | if (!(priv->status & STATUS_EXIT_PENDING)) { | ||
10113 | /* Queue up another scan... */ | ||
10114 | queue_work(priv->workqueue, &priv->request_scan); | ||
10115 | } | ||
10116 | } | ||
10117 | |||
10118 | static void ipw_bg_link_down(void *data) | ||
10119 | { | ||
10120 | struct ipw_priv *priv = data; | ||
10121 | down(&priv->sem); | ||
10122 | ipw_link_down(data); | ||
10123 | up(&priv->sem); | ||
10124 | } | ||
10125 | |||
6658 | static int ipw_setup_deferred_work(struct ipw_priv *priv) | 10126 | static int ipw_setup_deferred_work(struct ipw_priv *priv) |
6659 | { | 10127 | { |
6660 | int ret = 0; | 10128 | int ret = 0; |
6661 | 10129 | ||
6662 | priv->workqueue = create_workqueue(DRV_NAME); | 10130 | priv->workqueue = create_workqueue(DRV_NAME); |
6663 | init_waitqueue_head(&priv->wait_command_queue); | 10131 | init_waitqueue_head(&priv->wait_command_queue); |
6664 | 10132 | init_waitqueue_head(&priv->wait_state); | |
6665 | INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv); | 10133 | |
6666 | INIT_WORK(&priv->associate, ipw_associate, priv); | 10134 | INIT_WORK(&priv->adhoc_check, ipw_bg_adhoc_check, priv); |
6667 | INIT_WORK(&priv->disassociate, ipw_disassociate, priv); | 10135 | INIT_WORK(&priv->associate, ipw_bg_associate, priv); |
6668 | INIT_WORK(&priv->rx_replenish, ipw_rx_queue_replenish, priv); | 10136 | INIT_WORK(&priv->disassociate, ipw_bg_disassociate, priv); |
6669 | INIT_WORK(&priv->adapter_restart, ipw_adapter_restart, priv); | 10137 | INIT_WORK(&priv->system_config, ipw_system_config, priv); |
6670 | INIT_WORK(&priv->rf_kill, ipw_rf_kill, priv); | 10138 | INIT_WORK(&priv->rx_replenish, ipw_bg_rx_queue_replenish, priv); |
6671 | INIT_WORK(&priv->up, (void (*)(void *))ipw_up, priv); | 10139 | INIT_WORK(&priv->adapter_restart, ipw_bg_adapter_restart, priv); |
6672 | INIT_WORK(&priv->down, (void (*)(void *))ipw_down, priv); | 10140 | INIT_WORK(&priv->rf_kill, ipw_bg_rf_kill, priv); |
10141 | INIT_WORK(&priv->up, (void (*)(void *))ipw_bg_up, priv); | ||
10142 | INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); | ||
6673 | INIT_WORK(&priv->request_scan, | 10143 | INIT_WORK(&priv->request_scan, |
6674 | (void (*)(void *))ipw_request_scan, priv); | 10144 | (void (*)(void *))ipw_request_scan, priv); |
6675 | INIT_WORK(&priv->gather_stats, | 10145 | INIT_WORK(&priv->gather_stats, |
6676 | (void (*)(void *))ipw_gather_stats, priv); | 10146 | (void (*)(void *))ipw_bg_gather_stats, priv); |
6677 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv); | 10147 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); |
6678 | INIT_WORK(&priv->roam, ipw_roam, priv); | 10148 | INIT_WORK(&priv->roam, ipw_bg_roam, priv); |
6679 | INIT_WORK(&priv->scan_check, ipw_scan_check, priv); | 10149 | INIT_WORK(&priv->scan_check, ipw_bg_scan_check, priv); |
10150 | INIT_WORK(&priv->link_up, (void (*)(void *))ipw_bg_link_up, priv); | ||
10151 | INIT_WORK(&priv->link_down, (void (*)(void *))ipw_bg_link_down, priv); | ||
10152 | INIT_WORK(&priv->led_link_on, (void (*)(void *))ipw_bg_led_link_on, | ||
10153 | priv); | ||
10154 | INIT_WORK(&priv->led_link_off, (void (*)(void *))ipw_bg_led_link_off, | ||
10155 | priv); | ||
10156 | INIT_WORK(&priv->led_act_off, (void (*)(void *))ipw_bg_led_activity_off, | ||
10157 | priv); | ||
10158 | INIT_WORK(&priv->merge_networks, | ||
10159 | (void (*)(void *))ipw_merge_adhoc_network, priv); | ||
10160 | |||
10161 | #ifdef CONFIG_IPW_QOS | ||
10162 | INIT_WORK(&priv->qos_activate, (void (*)(void *))ipw_bg_qos_activate, | ||
10163 | priv); | ||
10164 | #endif /* CONFIG_IPW_QOS */ | ||
6680 | 10165 | ||
6681 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 10166 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) |
6682 | ipw_irq_tasklet, (unsigned long)priv); | 10167 | ipw_irq_tasklet, (unsigned long)priv); |
@@ -6689,34 +10174,36 @@ static void shim__set_security(struct net_device *dev, | |||
6689 | { | 10174 | { |
6690 | struct ipw_priv *priv = ieee80211_priv(dev); | 10175 | struct ipw_priv *priv = ieee80211_priv(dev); |
6691 | int i; | 10176 | int i; |
6692 | |||
6693 | for (i = 0; i < 4; i++) { | 10177 | for (i = 0; i < 4; i++) { |
6694 | if (sec->flags & (1 << i)) { | 10178 | if (sec->flags & (1 << i)) { |
6695 | priv->sec.key_sizes[i] = sec->key_sizes[i]; | 10179 | priv->ieee->sec.encode_alg[i] = sec->encode_alg[i]; |
10180 | priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; | ||
6696 | if (sec->key_sizes[i] == 0) | 10181 | if (sec->key_sizes[i] == 0) |
6697 | priv->sec.flags &= ~(1 << i); | 10182 | priv->ieee->sec.flags &= ~(1 << i); |
6698 | else | 10183 | else { |
6699 | memcpy(priv->sec.keys[i], sec->keys[i], | 10184 | memcpy(priv->ieee->sec.keys[i], sec->keys[i], |
6700 | sec->key_sizes[i]); | 10185 | sec->key_sizes[i]); |
6701 | priv->sec.flags |= (1 << i); | 10186 | priv->ieee->sec.flags |= (1 << i); |
10187 | } | ||
6702 | priv->status |= STATUS_SECURITY_UPDATED; | 10188 | priv->status |= STATUS_SECURITY_UPDATED; |
6703 | } | 10189 | } else if (sec->level != SEC_LEVEL_1) |
10190 | priv->ieee->sec.flags &= ~(1 << i); | ||
6704 | } | 10191 | } |
6705 | 10192 | ||
6706 | if ((sec->flags & SEC_ACTIVE_KEY) && | 10193 | if (sec->flags & SEC_ACTIVE_KEY) { |
6707 | priv->sec.active_key != sec->active_key) { | ||
6708 | if (sec->active_key <= 3) { | 10194 | if (sec->active_key <= 3) { |
6709 | priv->sec.active_key = sec->active_key; | 10195 | priv->ieee->sec.active_key = sec->active_key; |
6710 | priv->sec.flags |= SEC_ACTIVE_KEY; | 10196 | priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
6711 | } else | 10197 | } else |
6712 | priv->sec.flags &= ~SEC_ACTIVE_KEY; | 10198 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; |
6713 | priv->status |= STATUS_SECURITY_UPDATED; | 10199 | priv->status |= STATUS_SECURITY_UPDATED; |
6714 | } | 10200 | } else |
10201 | priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; | ||
6715 | 10202 | ||
6716 | if ((sec->flags & SEC_AUTH_MODE) && | 10203 | if ((sec->flags & SEC_AUTH_MODE) && |
6717 | (priv->sec.auth_mode != sec->auth_mode)) { | 10204 | (priv->ieee->sec.auth_mode != sec->auth_mode)) { |
6718 | priv->sec.auth_mode = sec->auth_mode; | 10205 | priv->ieee->sec.auth_mode = sec->auth_mode; |
6719 | priv->sec.flags |= SEC_AUTH_MODE; | 10206 | priv->ieee->sec.flags |= SEC_AUTH_MODE; |
6720 | if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) | 10207 | if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) |
6721 | priv->capability |= CAP_SHARED_KEY; | 10208 | priv->capability |= CAP_SHARED_KEY; |
6722 | else | 10209 | else |
@@ -6724,9 +10211,9 @@ static void shim__set_security(struct net_device *dev, | |||
6724 | priv->status |= STATUS_SECURITY_UPDATED; | 10211 | priv->status |= STATUS_SECURITY_UPDATED; |
6725 | } | 10212 | } |
6726 | 10213 | ||
6727 | if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { | 10214 | if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { |
6728 | priv->sec.flags |= SEC_ENABLED; | 10215 | priv->ieee->sec.flags |= SEC_ENABLED; |
6729 | priv->sec.enabled = sec->enabled; | 10216 | priv->ieee->sec.enabled = sec->enabled; |
6730 | priv->status |= STATUS_SECURITY_UPDATED; | 10217 | priv->status |= STATUS_SECURITY_UPDATED; |
6731 | if (sec->enabled) | 10218 | if (sec->enabled) |
6732 | priv->capability |= CAP_PRIVACY_ON; | 10219 | priv->capability |= CAP_PRIVACY_ON; |
@@ -6734,12 +10221,18 @@ static void shim__set_security(struct net_device *dev, | |||
6734 | priv->capability &= ~CAP_PRIVACY_ON; | 10221 | priv->capability &= ~CAP_PRIVACY_ON; |
6735 | } | 10222 | } |
6736 | 10223 | ||
6737 | if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { | 10224 | if (sec->flags & SEC_ENCRYPT) |
6738 | priv->sec.level = sec->level; | 10225 | priv->ieee->sec.encrypt = sec->encrypt; |
6739 | priv->sec.flags |= SEC_LEVEL; | 10226 | |
10227 | if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { | ||
10228 | priv->ieee->sec.level = sec->level; | ||
10229 | priv->ieee->sec.flags |= SEC_LEVEL; | ||
6740 | priv->status |= STATUS_SECURITY_UPDATED; | 10230 | priv->status |= STATUS_SECURITY_UPDATED; |
6741 | } | 10231 | } |
6742 | 10232 | ||
10233 | if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) | ||
10234 | ipw_set_hwcrypto_keys(priv); | ||
10235 | |||
6743 | /* To match current functionality of ipw2100 (which works well w/ | 10236 | /* To match current functionality of ipw2100 (which works well w/ |
6744 | * various supplicants, we don't force a disassociate if the | 10237 | * various supplicants, we don't force a disassociate if the |
6745 | * privacy capability changes ... */ | 10238 | * privacy capability changes ... */ |
@@ -6788,29 +10281,10 @@ static int init_supported_rates(struct ipw_priv *priv, | |||
6788 | 10281 | ||
6789 | static int ipw_config(struct ipw_priv *priv) | 10282 | static int ipw_config(struct ipw_priv *priv) |
6790 | { | 10283 | { |
6791 | int i; | ||
6792 | struct ipw_tx_power tx_power; | ||
6793 | |||
6794 | memset(&priv->sys_config, 0, sizeof(priv->sys_config)); | ||
6795 | memset(&tx_power, 0, sizeof(tx_power)); | ||
6796 | |||
6797 | /* This is only called from ipw_up, which resets/reloads the firmware | 10284 | /* This is only called from ipw_up, which resets/reloads the firmware |
6798 | so, we don't need to first disable the card before we configure | 10285 | so, we don't need to first disable the card before we configure |
6799 | it */ | 10286 | it */ |
6800 | 10287 | if (ipw_set_tx_power(priv)) | |
6801 | /* configure device for 'G' band */ | ||
6802 | tx_power.ieee_mode = IPW_G_MODE; | ||
6803 | tx_power.num_channels = 11; | ||
6804 | for (i = 0; i < 11; i++) { | ||
6805 | tx_power.channels_tx_power[i].channel_number = i + 1; | ||
6806 | tx_power.channels_tx_power[i].tx_power = priv->tx_power; | ||
6807 | } | ||
6808 | if (ipw_send_tx_power(priv, &tx_power)) | ||
6809 | goto error; | ||
6810 | |||
6811 | /* configure device to also handle 'B' band */ | ||
6812 | tx_power.ieee_mode = IPW_B_MODE; | ||
6813 | if (ipw_send_tx_power(priv, &tx_power)) | ||
6814 | goto error; | 10288 | goto error; |
6815 | 10289 | ||
6816 | /* initialize adapter address */ | 10290 | /* initialize adapter address */ |
@@ -6819,6 +10293,11 @@ static int ipw_config(struct ipw_priv *priv) | |||
6819 | 10293 | ||
6820 | /* set basic system config settings */ | 10294 | /* set basic system config settings */ |
6821 | init_sys_config(&priv->sys_config); | 10295 | init_sys_config(&priv->sys_config); |
10296 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | ||
10297 | priv->sys_config.answer_broadcast_ssid_probe = 1; | ||
10298 | else | ||
10299 | priv->sys_config.answer_broadcast_ssid_probe = 0; | ||
10300 | |||
6822 | if (ipw_send_system_config(priv, &priv->sys_config)) | 10301 | if (ipw_send_system_config(priv, &priv->sys_config)) |
6823 | goto error; | 10302 | goto error; |
6824 | 10303 | ||
@@ -6831,6 +10310,10 @@ static int ipw_config(struct ipw_priv *priv) | |||
6831 | if (ipw_send_rts_threshold(priv, priv->rts_threshold)) | 10310 | if (ipw_send_rts_threshold(priv, priv->rts_threshold)) |
6832 | goto error; | 10311 | goto error; |
6833 | } | 10312 | } |
10313 | #ifdef CONFIG_IPW_QOS | ||
10314 | IPW_DEBUG_QOS("QoS: call ipw_qos_activate\n"); | ||
10315 | ipw_qos_activate(priv, NULL); | ||
10316 | #endif /* CONFIG_IPW_QOS */ | ||
6834 | 10317 | ||
6835 | if (ipw_set_random_seed(priv)) | 10318 | if (ipw_set_random_seed(priv)) |
6836 | goto error; | 10319 | goto error; |
@@ -6839,9 +10322,17 @@ static int ipw_config(struct ipw_priv *priv) | |||
6839 | if (ipw_send_host_complete(priv)) | 10322 | if (ipw_send_host_complete(priv)) |
6840 | goto error; | 10323 | goto error; |
6841 | 10324 | ||
6842 | /* If configured to try and auto-associate, kick off a scan */ | 10325 | priv->status |= STATUS_INIT; |
6843 | if ((priv->config & CFG_ASSOCIATE) && ipw_request_scan(priv)) | 10326 | |
6844 | goto error; | 10327 | ipw_led_init(priv); |
10328 | ipw_led_radio_on(priv); | ||
10329 | priv->notif_missed_beacons = 0; | ||
10330 | |||
10331 | /* Set hardware WEP key if it is configured. */ | ||
10332 | if ((priv->capability & CAP_PRIVACY_ON) && | ||
10333 | (priv->ieee->sec.level == SEC_LEVEL_1) && | ||
10334 | !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) | ||
10335 | ipw_set_hwcrypto_keys(priv); | ||
6845 | 10336 | ||
6846 | return 0; | 10337 | return 0; |
6847 | 10338 | ||
@@ -6849,20 +10340,379 @@ static int ipw_config(struct ipw_priv *priv) | |||
6849 | return -EIO; | 10340 | return -EIO; |
6850 | } | 10341 | } |
6851 | 10342 | ||
10343 | /* | ||
10344 | * NOTE: | ||
10345 | * | ||
10346 | * These tables have been tested in conjunction with the | ||
10347 | * Intel PRO/Wireless 2200BG and 2915ABG Network Connection Adapters. | ||
10348 | * | ||
10349 | * Altering this values, using it on other hardware, or in geographies | ||
10350 | * not intended for resale of the above mentioned Intel adapters has | ||
10351 | * not been tested. | ||
10352 | * | ||
10353 | */ | ||
10354 | static const struct ieee80211_geo ipw_geos[] = { | ||
10355 | { /* Restricted */ | ||
10356 | "---", | ||
10357 | .bg_channels = 11, | ||
10358 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10359 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10360 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10361 | {2457, 10}, {2462, 11}}, | ||
10362 | }, | ||
10363 | |||
10364 | { /* Custom US/Canada */ | ||
10365 | "ZZF", | ||
10366 | .bg_channels = 11, | ||
10367 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10368 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10369 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10370 | {2457, 10}, {2462, 11}}, | ||
10371 | .a_channels = 8, | ||
10372 | .a = {{5180, 36}, | ||
10373 | {5200, 40}, | ||
10374 | {5220, 44}, | ||
10375 | {5240, 48}, | ||
10376 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10377 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10378 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10379 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10380 | }, | ||
10381 | |||
10382 | { /* Rest of World */ | ||
10383 | "ZZD", | ||
10384 | .bg_channels = 13, | ||
10385 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10386 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10387 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10388 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10389 | {2472, 13}}, | ||
10390 | }, | ||
10391 | |||
10392 | { /* Custom USA & Europe & High */ | ||
10393 | "ZZA", | ||
10394 | .bg_channels = 11, | ||
10395 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10396 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10397 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10398 | {2457, 10}, {2462, 11}}, | ||
10399 | .a_channels = 13, | ||
10400 | .a = {{5180, 36}, | ||
10401 | {5200, 40}, | ||
10402 | {5220, 44}, | ||
10403 | {5240, 48}, | ||
10404 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10405 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10406 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10407 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10408 | {5745, 149}, | ||
10409 | {5765, 153}, | ||
10410 | {5785, 157}, | ||
10411 | {5805, 161}, | ||
10412 | {5825, 165}}, | ||
10413 | }, | ||
10414 | |||
10415 | { /* Custom NA & Europe */ | ||
10416 | "ZZB", | ||
10417 | .bg_channels = 11, | ||
10418 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10419 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10420 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10421 | {2457, 10}, {2462, 11}}, | ||
10422 | .a_channels = 13, | ||
10423 | .a = {{5180, 36}, | ||
10424 | {5200, 40}, | ||
10425 | {5220, 44}, | ||
10426 | {5240, 48}, | ||
10427 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10428 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10429 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10430 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10431 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10432 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10433 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10434 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10435 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10436 | }, | ||
10437 | |||
10438 | { /* Custom Japan */ | ||
10439 | "ZZC", | ||
10440 | .bg_channels = 11, | ||
10441 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10442 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10443 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10444 | {2457, 10}, {2462, 11}}, | ||
10445 | .a_channels = 4, | ||
10446 | .a = {{5170, 34}, {5190, 38}, | ||
10447 | {5210, 42}, {5230, 46}}, | ||
10448 | }, | ||
10449 | |||
10450 | { /* Custom */ | ||
10451 | "ZZM", | ||
10452 | .bg_channels = 11, | ||
10453 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10454 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10455 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10456 | {2457, 10}, {2462, 11}}, | ||
10457 | }, | ||
10458 | |||
10459 | { /* Europe */ | ||
10460 | "ZZE", | ||
10461 | .bg_channels = 13, | ||
10462 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10463 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10464 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10465 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10466 | {2472, 13}}, | ||
10467 | .a_channels = 19, | ||
10468 | .a = {{5180, 36}, | ||
10469 | {5200, 40}, | ||
10470 | {5220, 44}, | ||
10471 | {5240, 48}, | ||
10472 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10473 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10474 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10475 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10476 | {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, | ||
10477 | {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, | ||
10478 | {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, | ||
10479 | {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, | ||
10480 | {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, | ||
10481 | {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, | ||
10482 | {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, | ||
10483 | {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, | ||
10484 | {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, | ||
10485 | {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, | ||
10486 | {5700, 140, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10487 | }, | ||
10488 | |||
10489 | { /* Custom Japan */ | ||
10490 | "ZZJ", | ||
10491 | .bg_channels = 14, | ||
10492 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10493 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10494 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10495 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10496 | {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY}}, | ||
10497 | .a_channels = 4, | ||
10498 | .a = {{5170, 34}, {5190, 38}, | ||
10499 | {5210, 42}, {5230, 46}}, | ||
10500 | }, | ||
10501 | |||
10502 | { /* Rest of World */ | ||
10503 | "ZZR", | ||
10504 | .bg_channels = 14, | ||
10505 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10506 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10507 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10508 | {2457, 10}, {2462, 11}, {2467, 12}, | ||
10509 | {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY | | ||
10510 | IEEE80211_CH_PASSIVE_ONLY}}, | ||
10511 | }, | ||
10512 | |||
10513 | { /* High Band */ | ||
10514 | "ZZH", | ||
10515 | .bg_channels = 13, | ||
10516 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10517 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10518 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10519 | {2457, 10}, {2462, 11}, | ||
10520 | {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, | ||
10521 | {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10522 | .a_channels = 4, | ||
10523 | .a = {{5745, 149}, {5765, 153}, | ||
10524 | {5785, 157}, {5805, 161}}, | ||
10525 | }, | ||
10526 | |||
10527 | { /* Custom Europe */ | ||
10528 | "ZZG", | ||
10529 | .bg_channels = 13, | ||
10530 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10531 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10532 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10533 | {2457, 10}, {2462, 11}, | ||
10534 | {2467, 12}, {2472, 13}}, | ||
10535 | .a_channels = 4, | ||
10536 | .a = {{5180, 36}, {5200, 40}, | ||
10537 | {5220, 44}, {5240, 48}}, | ||
10538 | }, | ||
10539 | |||
10540 | { /* Europe */ | ||
10541 | "ZZK", | ||
10542 | .bg_channels = 13, | ||
10543 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10544 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10545 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10546 | {2457, 10}, {2462, 11}, | ||
10547 | {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, | ||
10548 | {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10549 | .a_channels = 24, | ||
10550 | .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, | ||
10551 | {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, | ||
10552 | {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, | ||
10553 | {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, | ||
10554 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10555 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10556 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10557 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10558 | {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, | ||
10559 | {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, | ||
10560 | {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, | ||
10561 | {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, | ||
10562 | {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, | ||
10563 | {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, | ||
10564 | {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, | ||
10565 | {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, | ||
10566 | {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, | ||
10567 | {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, | ||
10568 | {5700, 140, IEEE80211_CH_PASSIVE_ONLY}, | ||
10569 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10570 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10571 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10572 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10573 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10574 | }, | ||
10575 | |||
10576 | { /* Europe */ | ||
10577 | "ZZL", | ||
10578 | .bg_channels = 11, | ||
10579 | .bg = {{2412, 1}, {2417, 2}, {2422, 3}, | ||
10580 | {2427, 4}, {2432, 5}, {2437, 6}, | ||
10581 | {2442, 7}, {2447, 8}, {2452, 9}, | ||
10582 | {2457, 10}, {2462, 11}}, | ||
10583 | .a_channels = 13, | ||
10584 | .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, | ||
10585 | {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, | ||
10586 | {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, | ||
10587 | {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, | ||
10588 | {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, | ||
10589 | {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, | ||
10590 | {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, | ||
10591 | {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, | ||
10592 | {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, | ||
10593 | {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, | ||
10594 | {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, | ||
10595 | {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, | ||
10596 | {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, | ||
10597 | } | ||
10598 | }; | ||
10599 | |||
10600 | /* GEO code borrowed from ieee80211_geo.c */ | ||
10601 | static int ipw_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | ||
10602 | { | ||
10603 | int i; | ||
10604 | |||
10605 | /* Driver needs to initialize the geography map before using | ||
10606 | * these helper functions */ | ||
10607 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10608 | |||
10609 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10610 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10611 | /* NOTE: If G mode is currently supported but | ||
10612 | * this is a B only channel, we don't see it | ||
10613 | * as valid. */ | ||
10614 | if ((ieee->geo.bg[i].channel == channel) && | ||
10615 | (!(ieee->mode & IEEE_G) || | ||
10616 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | ||
10617 | return IEEE80211_24GHZ_BAND; | ||
10618 | |||
10619 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10620 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10621 | if (ieee->geo.a[i].channel == channel) | ||
10622 | return IEEE80211_52GHZ_BAND; | ||
10623 | |||
10624 | return 0; | ||
10625 | } | ||
10626 | |||
10627 | static int ipw_channel_to_index(struct ieee80211_device *ieee, u8 channel) | ||
10628 | { | ||
10629 | int i; | ||
10630 | |||
10631 | /* Driver needs to initialize the geography map before using | ||
10632 | * these helper functions */ | ||
10633 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10634 | |||
10635 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10636 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10637 | if (ieee->geo.bg[i].channel == channel) | ||
10638 | return i; | ||
10639 | |||
10640 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10641 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10642 | if (ieee->geo.a[i].channel == channel) | ||
10643 | return i; | ||
10644 | |||
10645 | return -1; | ||
10646 | } | ||
10647 | |||
10648 | static u8 ipw_freq_to_channel(struct ieee80211_device *ieee, u32 freq) | ||
10649 | { | ||
10650 | int i; | ||
10651 | |||
10652 | /* Driver needs to initialize the geography map before using | ||
10653 | * these helper functions */ | ||
10654 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
10655 | |||
10656 | freq /= 100000; | ||
10657 | |||
10658 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
10659 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
10660 | if (ieee->geo.bg[i].freq == freq) | ||
10661 | return ieee->geo.bg[i].channel; | ||
10662 | |||
10663 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
10664 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
10665 | if (ieee->geo.a[i].freq == freq) | ||
10666 | return ieee->geo.a[i].channel; | ||
10667 | |||
10668 | return 0; | ||
10669 | } | ||
10670 | |||
10671 | static int ipw_set_geo(struct ieee80211_device *ieee, | ||
10672 | const struct ieee80211_geo *geo) | ||
10673 | { | ||
10674 | memcpy(ieee->geo.name, geo->name, 3); | ||
10675 | ieee->geo.name[3] = '\0'; | ||
10676 | ieee->geo.bg_channels = geo->bg_channels; | ||
10677 | ieee->geo.a_channels = geo->a_channels; | ||
10678 | memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * | ||
10679 | sizeof(struct ieee80211_channel)); | ||
10680 | memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * | ||
10681 | sizeof(struct ieee80211_channel)); | ||
10682 | return 0; | ||
10683 | } | ||
10684 | |||
10685 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *ieee) | ||
10686 | { | ||
10687 | return &ieee->geo; | ||
10688 | } | ||
10689 | |||
6852 | #define MAX_HW_RESTARTS 5 | 10690 | #define MAX_HW_RESTARTS 5 |
6853 | static int ipw_up(struct ipw_priv *priv) | 10691 | static int ipw_up(struct ipw_priv *priv) |
6854 | { | 10692 | { |
6855 | int rc, i; | 10693 | int rc, i, j; |
6856 | 10694 | ||
6857 | if (priv->status & STATUS_EXIT_PENDING) | 10695 | if (priv->status & STATUS_EXIT_PENDING) |
6858 | return -EIO; | 10696 | return -EIO; |
6859 | 10697 | ||
10698 | if (cmdlog && !priv->cmdlog) { | ||
10699 | priv->cmdlog = kmalloc(sizeof(*priv->cmdlog) * cmdlog, | ||
10700 | GFP_KERNEL); | ||
10701 | if (priv->cmdlog == NULL) { | ||
10702 | IPW_ERROR("Error allocating %d command log entries.\n", | ||
10703 | cmdlog); | ||
10704 | } else { | ||
10705 | memset(priv->cmdlog, 0, sizeof(*priv->cmdlog) * cmdlog); | ||
10706 | priv->cmdlog_len = cmdlog; | ||
10707 | } | ||
10708 | } | ||
10709 | |||
6860 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 10710 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
6861 | /* Load the microcode, firmware, and eeprom. | 10711 | /* Load the microcode, firmware, and eeprom. |
6862 | * Also start the clocks. */ | 10712 | * Also start the clocks. */ |
6863 | rc = ipw_load(priv); | 10713 | rc = ipw_load(priv); |
6864 | if (rc) { | 10714 | if (rc) { |
6865 | IPW_ERROR("Unable to load firmware: 0x%08X\n", rc); | 10715 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
6866 | return rc; | 10716 | return rc; |
6867 | } | 10717 | } |
6868 | 10718 | ||
@@ -6871,20 +10721,50 @@ static int ipw_up(struct ipw_priv *priv) | |||
6871 | eeprom_parse_mac(priv, priv->mac_addr); | 10721 | eeprom_parse_mac(priv, priv->mac_addr); |
6872 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); | 10722 | memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); |
6873 | 10723 | ||
6874 | if (priv->status & STATUS_RF_KILL_MASK) | 10724 | for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { |
10725 | if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], | ||
10726 | ipw_geos[j].name, 3)) | ||
10727 | break; | ||
10728 | } | ||
10729 | if (j == ARRAY_SIZE(ipw_geos)) { | ||
10730 | IPW_WARNING("SKU [%c%c%c] not recognized.\n", | ||
10731 | priv->eeprom[EEPROM_COUNTRY_CODE + 0], | ||
10732 | priv->eeprom[EEPROM_COUNTRY_CODE + 1], | ||
10733 | priv->eeprom[EEPROM_COUNTRY_CODE + 2]); | ||
10734 | j = 0; | ||
10735 | } | ||
10736 | if (ipw_set_geo(priv->ieee, &ipw_geos[j])) { | ||
10737 | IPW_WARNING("Could not set geography."); | ||
10738 | return 0; | ||
10739 | } | ||
10740 | |||
10741 | IPW_DEBUG_INFO("Geography %03d [%s] detected.\n", | ||
10742 | j, priv->ieee->geo.name); | ||
10743 | |||
10744 | if (priv->status & STATUS_RF_KILL_SW) { | ||
10745 | IPW_WARNING("Radio disabled by module parameter.\n"); | ||
10746 | return 0; | ||
10747 | } else if (rf_kill_active(priv)) { | ||
10748 | IPW_WARNING("Radio Frequency Kill Switch is On:\n" | ||
10749 | "Kill switch must be turned off for " | ||
10750 | "wireless networking to work.\n"); | ||
10751 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | ||
10752 | 2 * HZ); | ||
6875 | return 0; | 10753 | return 0; |
10754 | } | ||
6876 | 10755 | ||
6877 | rc = ipw_config(priv); | 10756 | rc = ipw_config(priv); |
6878 | if (!rc) { | 10757 | if (!rc) { |
6879 | IPW_DEBUG_INFO("Configured device on count %i\n", i); | 10758 | IPW_DEBUG_INFO("Configured device on count %i\n", i); |
6880 | priv->notif_missed_beacons = 0; | 10759 | |
6881 | netif_start_queue(priv->net_dev); | 10760 | /* If configure to try and auto-associate, kick |
10761 | * off a scan. */ | ||
10762 | queue_work(priv->workqueue, &priv->request_scan); | ||
10763 | |||
6882 | return 0; | 10764 | return 0; |
6883 | } else { | ||
6884 | IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", | ||
6885 | rc); | ||
6886 | } | 10765 | } |
6887 | 10766 | ||
10767 | IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", rc); | ||
6888 | IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", | 10768 | IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", |
6889 | i, MAX_HW_RESTARTS); | 10769 | i, MAX_HW_RESTARTS); |
6890 | 10770 | ||
@@ -6896,47 +10776,101 @@ static int ipw_up(struct ipw_priv *priv) | |||
6896 | /* tried to restart and config the device for as long as our | 10776 | /* tried to restart and config the device for as long as our |
6897 | * patience could withstand */ | 10777 | * patience could withstand */ |
6898 | IPW_ERROR("Unable to initialize device after %d attempts.\n", i); | 10778 | IPW_ERROR("Unable to initialize device after %d attempts.\n", i); |
10779 | |||
6899 | return -EIO; | 10780 | return -EIO; |
6900 | } | 10781 | } |
6901 | 10782 | ||
6902 | static void ipw_down(struct ipw_priv *priv) | 10783 | static void ipw_bg_up(void *data) |
10784 | { | ||
10785 | struct ipw_priv *priv = data; | ||
10786 | down(&priv->sem); | ||
10787 | ipw_up(data); | ||
10788 | up(&priv->sem); | ||
10789 | } | ||
10790 | |||
10791 | static void ipw_deinit(struct ipw_priv *priv) | ||
6903 | { | 10792 | { |
10793 | int i; | ||
10794 | |||
10795 | if (priv->status & STATUS_SCANNING) { | ||
10796 | IPW_DEBUG_INFO("Aborting scan during shutdown.\n"); | ||
10797 | ipw_abort_scan(priv); | ||
10798 | } | ||
10799 | |||
10800 | if (priv->status & STATUS_ASSOCIATED) { | ||
10801 | IPW_DEBUG_INFO("Disassociating during shutdown.\n"); | ||
10802 | ipw_disassociate(priv); | ||
10803 | } | ||
10804 | |||
10805 | ipw_led_shutdown(priv); | ||
10806 | |||
10807 | /* Wait up to 1s for status to change to not scanning and not | ||
10808 | * associated (disassociation can take a while for a ful 802.11 | ||
10809 | * exchange */ | ||
10810 | for (i = 1000; i && (priv->status & | ||
10811 | (STATUS_DISASSOCIATING | | ||
10812 | STATUS_ASSOCIATED | STATUS_SCANNING)); i--) | ||
10813 | udelay(10); | ||
10814 | |||
10815 | if (priv->status & (STATUS_DISASSOCIATING | | ||
10816 | STATUS_ASSOCIATED | STATUS_SCANNING)) | ||
10817 | IPW_DEBUG_INFO("Still associated or scanning...\n"); | ||
10818 | else | ||
10819 | IPW_DEBUG_INFO("Took %dms to de-init\n", 1000 - i); | ||
10820 | |||
6904 | /* Attempt to disable the card */ | 10821 | /* Attempt to disable the card */ |
6905 | #if 0 | ||
6906 | ipw_send_card_disable(priv, 0); | 10822 | ipw_send_card_disable(priv, 0); |
6907 | #endif | 10823 | |
10824 | priv->status &= ~STATUS_INIT; | ||
10825 | } | ||
10826 | |||
10827 | static void ipw_down(struct ipw_priv *priv) | ||
10828 | { | ||
10829 | int exit_pending = priv->status & STATUS_EXIT_PENDING; | ||
10830 | |||
10831 | priv->status |= STATUS_EXIT_PENDING; | ||
10832 | |||
10833 | if (ipw_is_init(priv)) | ||
10834 | ipw_deinit(priv); | ||
10835 | |||
10836 | /* Wipe out the EXIT_PENDING status bit if we are not actually | ||
10837 | * exiting the module */ | ||
10838 | if (!exit_pending) | ||
10839 | priv->status &= ~STATUS_EXIT_PENDING; | ||
6908 | 10840 | ||
6909 | /* tell the device to stop sending interrupts */ | 10841 | /* tell the device to stop sending interrupts */ |
6910 | ipw_disable_interrupts(priv); | 10842 | ipw_disable_interrupts(priv); |
6911 | 10843 | ||
6912 | /* Clear all bits but the RF Kill */ | 10844 | /* Clear all bits but the RF Kill */ |
6913 | priv->status &= STATUS_RF_KILL_MASK; | 10845 | priv->status &= STATUS_RF_KILL_MASK | STATUS_EXIT_PENDING; |
6914 | |||
6915 | netif_carrier_off(priv->net_dev); | 10846 | netif_carrier_off(priv->net_dev); |
6916 | netif_stop_queue(priv->net_dev); | 10847 | netif_stop_queue(priv->net_dev); |
6917 | 10848 | ||
6918 | ipw_stop_nic(priv); | 10849 | ipw_stop_nic(priv); |
10850 | |||
10851 | ipw_led_radio_off(priv); | ||
10852 | } | ||
10853 | |||
10854 | static void ipw_bg_down(void *data) | ||
10855 | { | ||
10856 | struct ipw_priv *priv = data; | ||
10857 | down(&priv->sem); | ||
10858 | ipw_down(data); | ||
10859 | up(&priv->sem); | ||
6919 | } | 10860 | } |
6920 | 10861 | ||
6921 | /* Called by register_netdev() */ | 10862 | /* Called by register_netdev() */ |
6922 | static int ipw_net_init(struct net_device *dev) | 10863 | static int ipw_net_init(struct net_device *dev) |
6923 | { | 10864 | { |
6924 | struct ipw_priv *priv = ieee80211_priv(dev); | 10865 | struct ipw_priv *priv = ieee80211_priv(dev); |
10866 | down(&priv->sem); | ||
6925 | 10867 | ||
6926 | if (priv->status & STATUS_RF_KILL_SW) { | 10868 | if (ipw_up(priv)) { |
6927 | IPW_WARNING("Radio disabled by module parameter.\n"); | 10869 | up(&priv->sem); |
6928 | return 0; | ||
6929 | } else if (rf_kill_active(priv)) { | ||
6930 | IPW_WARNING("Radio Frequency Kill Switch is On:\n" | ||
6931 | "Kill switch must be turned off for " | ||
6932 | "wireless networking to work.\n"); | ||
6933 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); | ||
6934 | return 0; | ||
6935 | } | ||
6936 | |||
6937 | if (ipw_up(priv)) | ||
6938 | return -EIO; | 10870 | return -EIO; |
10871 | } | ||
6939 | 10872 | ||
10873 | up(&priv->sem); | ||
6940 | return 0; | 10874 | return 0; |
6941 | } | 10875 | } |
6942 | 10876 | ||
@@ -6961,7 +10895,7 @@ static struct pci_device_id card_ids[] = { | |||
6961 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, | 10895 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, |
6962 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 10896 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
6963 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ | 10897 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ |
6964 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ | 10898 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ |
6965 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 10899 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6966 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 10900 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6967 | 10901 | ||
@@ -6981,11 +10915,16 @@ static struct attribute *ipw_sysfs_entries[] = { | |||
6981 | &dev_attr_nic_type.attr, | 10915 | &dev_attr_nic_type.attr, |
6982 | &dev_attr_status.attr, | 10916 | &dev_attr_status.attr, |
6983 | &dev_attr_cfg.attr, | 10917 | &dev_attr_cfg.attr, |
6984 | &dev_attr_dump_errors.attr, | 10918 | &dev_attr_error.attr, |
6985 | &dev_attr_dump_events.attr, | 10919 | &dev_attr_event_log.attr, |
10920 | &dev_attr_cmd_log.attr, | ||
6986 | &dev_attr_eeprom_delay.attr, | 10921 | &dev_attr_eeprom_delay.attr, |
6987 | &dev_attr_ucode_version.attr, | 10922 | &dev_attr_ucode_version.attr, |
6988 | &dev_attr_rtc.attr, | 10923 | &dev_attr_rtc.attr, |
10924 | &dev_attr_scan_age.attr, | ||
10925 | &dev_attr_led.attr, | ||
10926 | &dev_attr_speed_scan.attr, | ||
10927 | &dev_attr_net_stats.attr, | ||
6989 | NULL | 10928 | NULL |
6990 | }; | 10929 | }; |
6991 | 10930 | ||
@@ -7001,7 +10940,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7001 | void __iomem *base; | 10940 | void __iomem *base; |
7002 | u32 length, val; | 10941 | u32 length, val; |
7003 | struct ipw_priv *priv; | 10942 | struct ipw_priv *priv; |
7004 | int band, modulation; | 10943 | int i; |
7005 | 10944 | ||
7006 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); | 10945 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); |
7007 | if (net_dev == NULL) { | 10946 | if (net_dev == NULL) { |
@@ -7011,13 +10950,17 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7011 | 10950 | ||
7012 | priv = ieee80211_priv(net_dev); | 10951 | priv = ieee80211_priv(net_dev); |
7013 | priv->ieee = netdev_priv(net_dev); | 10952 | priv->ieee = netdev_priv(net_dev); |
10953 | |||
7014 | priv->net_dev = net_dev; | 10954 | priv->net_dev = net_dev; |
7015 | priv->pci_dev = pdev; | 10955 | priv->pci_dev = pdev; |
7016 | #ifdef CONFIG_IPW_DEBUG | 10956 | #ifdef CONFIG_IPW_DEBUG |
7017 | ipw_debug_level = debug; | 10957 | ipw_debug_level = debug; |
7018 | #endif | 10958 | #endif |
7019 | spin_lock_init(&priv->lock); | 10959 | spin_lock_init(&priv->lock); |
10960 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) | ||
10961 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | ||
7020 | 10962 | ||
10963 | init_MUTEX(&priv->sem); | ||
7021 | if (pci_enable_device(pdev)) { | 10964 | if (pci_enable_device(pdev)) { |
7022 | err = -ENODEV; | 10965 | err = -ENODEV; |
7023 | goto out_free_ieee80211; | 10966 | goto out_free_ieee80211; |
@@ -7064,90 +11007,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7064 | goto out_iounmap; | 11007 | goto out_iounmap; |
7065 | } | 11008 | } |
7066 | 11009 | ||
7067 | /* Initialize module parameter values here */ | 11010 | ipw_sw_reset(priv, 1); |
7068 | if (ifname) | ||
7069 | strncpy(net_dev->name, ifname, IFNAMSIZ); | ||
7070 | |||
7071 | if (associate) | ||
7072 | priv->config |= CFG_ASSOCIATE; | ||
7073 | else | ||
7074 | IPW_DEBUG_INFO("Auto associate disabled.\n"); | ||
7075 | |||
7076 | if (auto_create) | ||
7077 | priv->config |= CFG_ADHOC_CREATE; | ||
7078 | else | ||
7079 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); | ||
7080 | |||
7081 | if (disable) { | ||
7082 | priv->status |= STATUS_RF_KILL_SW; | ||
7083 | IPW_DEBUG_INFO("Radio disabled.\n"); | ||
7084 | } | ||
7085 | |||
7086 | if (channel != 0) { | ||
7087 | priv->config |= CFG_STATIC_CHANNEL; | ||
7088 | priv->channel = channel; | ||
7089 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | ||
7090 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | ||
7091 | /* TODO: Validate that provided channel is in range */ | ||
7092 | } | ||
7093 | |||
7094 | switch (mode) { | ||
7095 | case 1: | ||
7096 | priv->ieee->iw_mode = IW_MODE_ADHOC; | ||
7097 | break; | ||
7098 | #ifdef CONFIG_IPW_PROMISC | ||
7099 | case 2: | ||
7100 | priv->ieee->iw_mode = IW_MODE_MONITOR; | ||
7101 | break; | ||
7102 | #endif | ||
7103 | default: | ||
7104 | case 0: | ||
7105 | priv->ieee->iw_mode = IW_MODE_INFRA; | ||
7106 | break; | ||
7107 | } | ||
7108 | |||
7109 | if ((priv->pci_dev->device == 0x4223) || | ||
7110 | (priv->pci_dev->device == 0x4224)) { | ||
7111 | printk(KERN_INFO DRV_NAME | ||
7112 | ": Detected Intel PRO/Wireless 2915ABG Network " | ||
7113 | "Connection\n"); | ||
7114 | priv->ieee->abg_true = 1; | ||
7115 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | ||
7116 | modulation = IEEE80211_OFDM_MODULATION | | ||
7117 | IEEE80211_CCK_MODULATION; | ||
7118 | priv->adapter = IPW_2915ABG; | ||
7119 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; | ||
7120 | } else { | ||
7121 | if (priv->pci_dev->device == 0x4221) | ||
7122 | printk(KERN_INFO DRV_NAME | ||
7123 | ": Detected Intel PRO/Wireless 2225BG Network " | ||
7124 | "Connection\n"); | ||
7125 | else | ||
7126 | printk(KERN_INFO DRV_NAME | ||
7127 | ": Detected Intel PRO/Wireless 2200BG Network " | ||
7128 | "Connection\n"); | ||
7129 | |||
7130 | priv->ieee->abg_true = 0; | ||
7131 | band = IEEE80211_24GHZ_BAND; | ||
7132 | modulation = IEEE80211_OFDM_MODULATION | | ||
7133 | IEEE80211_CCK_MODULATION; | ||
7134 | priv->adapter = IPW_2200BG; | ||
7135 | priv->ieee->mode = IEEE_G | IEEE_B; | ||
7136 | } | ||
7137 | |||
7138 | priv->ieee->freq_band = band; | ||
7139 | priv->ieee->modulation = modulation; | ||
7140 | |||
7141 | priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; | ||
7142 | |||
7143 | priv->missed_beacon_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; | ||
7144 | priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; | ||
7145 | |||
7146 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | ||
7147 | |||
7148 | /* If power management is turned on, default to AC mode */ | ||
7149 | priv->power_mode = IPW_POWER_AC; | ||
7150 | priv->tx_power = IPW_DEFAULT_TX_POWER; | ||
7151 | 11011 | ||
7152 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); | 11012 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); |
7153 | if (err) { | 11013 | if (err) { |
@@ -7158,8 +11018,20 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7158 | SET_MODULE_OWNER(net_dev); | 11018 | SET_MODULE_OWNER(net_dev); |
7159 | SET_NETDEV_DEV(net_dev, &pdev->dev); | 11019 | SET_NETDEV_DEV(net_dev, &pdev->dev); |
7160 | 11020 | ||
11021 | down(&priv->sem); | ||
11022 | |||
7161 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; | 11023 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; |
7162 | priv->ieee->set_security = shim__set_security; | 11024 | priv->ieee->set_security = shim__set_security; |
11025 | priv->ieee->is_queue_full = ipw_net_is_queue_full; | ||
11026 | |||
11027 | #ifdef CONFIG_IPW_QOS | ||
11028 | priv->ieee->handle_probe_response = ipw_handle_beacon; | ||
11029 | priv->ieee->handle_beacon = ipw_handle_probe_response; | ||
11030 | priv->ieee->handle_assoc_response = ipw_handle_assoc_response; | ||
11031 | #endif /* CONFIG_IPW_QOS */ | ||
11032 | |||
11033 | priv->ieee->perfect_rssi = -20; | ||
11034 | priv->ieee->worst_rssi = -85; | ||
7163 | 11035 | ||
7164 | net_dev->open = ipw_net_open; | 11036 | net_dev->open = ipw_net_open; |
7165 | net_dev->stop = ipw_net_stop; | 11037 | net_dev->stop = ipw_net_stop; |
@@ -7167,7 +11039,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7167 | net_dev->get_stats = ipw_net_get_stats; | 11039 | net_dev->get_stats = ipw_net_get_stats; |
7168 | net_dev->set_multicast_list = ipw_net_set_multicast_list; | 11040 | net_dev->set_multicast_list = ipw_net_set_multicast_list; |
7169 | net_dev->set_mac_address = ipw_net_set_mac_address; | 11041 | net_dev->set_mac_address = ipw_net_set_mac_address; |
7170 | net_dev->get_wireless_stats = ipw_get_wireless_stats; | 11042 | priv->wireless_data.spy_data = &priv->ieee->spy_data; |
11043 | priv->wireless_data.ieee80211 = priv->ieee; | ||
11044 | net_dev->wireless_data = &priv->wireless_data; | ||
7171 | net_dev->wireless_handlers = &ipw_wx_handler_def; | 11045 | net_dev->wireless_handlers = &ipw_wx_handler_def; |
7172 | net_dev->ethtool_ops = &ipw_ethtool_ops; | 11046 | net_dev->ethtool_ops = &ipw_ethtool_ops; |
7173 | net_dev->irq = pdev->irq; | 11047 | net_dev->irq = pdev->irq; |
@@ -7178,18 +11052,19 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7178 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); | 11052 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); |
7179 | if (err) { | 11053 | if (err) { |
7180 | IPW_ERROR("failed to create sysfs device attributes\n"); | 11054 | IPW_ERROR("failed to create sysfs device attributes\n"); |
11055 | up(&priv->sem); | ||
7181 | goto out_release_irq; | 11056 | goto out_release_irq; |
7182 | } | 11057 | } |
7183 | 11058 | ||
11059 | up(&priv->sem); | ||
7184 | err = register_netdev(net_dev); | 11060 | err = register_netdev(net_dev); |
7185 | if (err) { | 11061 | if (err) { |
7186 | IPW_ERROR("failed to register network device\n"); | 11062 | IPW_ERROR("failed to register network device\n"); |
7187 | goto out_remove_group; | 11063 | goto out_remove_sysfs; |
7188 | } | 11064 | } |
7189 | |||
7190 | return 0; | 11065 | return 0; |
7191 | 11066 | ||
7192 | out_remove_group: | 11067 | out_remove_sysfs: |
7193 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11068 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
7194 | out_release_irq: | 11069 | out_release_irq: |
7195 | free_irq(pdev->irq, priv); | 11070 | free_irq(pdev->irq, priv); |
@@ -7212,14 +11087,19 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7212 | static void ipw_pci_remove(struct pci_dev *pdev) | 11087 | static void ipw_pci_remove(struct pci_dev *pdev) |
7213 | { | 11088 | { |
7214 | struct ipw_priv *priv = pci_get_drvdata(pdev); | 11089 | struct ipw_priv *priv = pci_get_drvdata(pdev); |
11090 | struct list_head *p, *q; | ||
11091 | int i; | ||
11092 | |||
7215 | if (!priv) | 11093 | if (!priv) |
7216 | return; | 11094 | return; |
7217 | 11095 | ||
7218 | priv->status |= STATUS_EXIT_PENDING; | 11096 | down(&priv->sem); |
7219 | 11097 | ||
11098 | priv->status |= STATUS_EXIT_PENDING; | ||
11099 | ipw_down(priv); | ||
7220 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11100 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
7221 | 11101 | ||
7222 | ipw_down(priv); | 11102 | up(&priv->sem); |
7223 | 11103 | ||
7224 | unregister_netdev(priv->net_dev); | 11104 | unregister_netdev(priv->net_dev); |
7225 | 11105 | ||
@@ -7229,16 +11109,31 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
7229 | } | 11109 | } |
7230 | ipw_tx_queue_free(priv); | 11110 | ipw_tx_queue_free(priv); |
7231 | 11111 | ||
11112 | if (priv->cmdlog) { | ||
11113 | kfree(priv->cmdlog); | ||
11114 | priv->cmdlog = NULL; | ||
11115 | } | ||
7232 | /* ipw_down will ensure that there is no more pending work | 11116 | /* ipw_down will ensure that there is no more pending work |
7233 | * in the workqueue's, so we can safely remove them now. */ | 11117 | * in the workqueue's, so we can safely remove them now. */ |
7234 | if (priv->workqueue) { | 11118 | cancel_delayed_work(&priv->adhoc_check); |
7235 | cancel_delayed_work(&priv->adhoc_check); | 11119 | cancel_delayed_work(&priv->gather_stats); |
7236 | cancel_delayed_work(&priv->gather_stats); | 11120 | cancel_delayed_work(&priv->request_scan); |
7237 | cancel_delayed_work(&priv->request_scan); | 11121 | cancel_delayed_work(&priv->rf_kill); |
7238 | cancel_delayed_work(&priv->rf_kill); | 11122 | cancel_delayed_work(&priv->scan_check); |
7239 | cancel_delayed_work(&priv->scan_check); | 11123 | destroy_workqueue(priv->workqueue); |
7240 | destroy_workqueue(priv->workqueue); | 11124 | priv->workqueue = NULL; |
7241 | priv->workqueue = NULL; | 11125 | |
11126 | /* Free MAC hash list for ADHOC */ | ||
11127 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { | ||
11128 | list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { | ||
11129 | kfree(list_entry(p, struct ipw_ibss_seq, list)); | ||
11130 | list_del(p); | ||
11131 | } | ||
11132 | } | ||
11133 | |||
11134 | if (priv->error) { | ||
11135 | ipw_free_error_log(priv->error); | ||
11136 | priv->error = NULL; | ||
7242 | } | 11137 | } |
7243 | 11138 | ||
7244 | free_irq(pdev->irq, priv); | 11139 | free_irq(pdev->irq, priv); |
@@ -7247,15 +11142,7 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
7247 | pci_disable_device(pdev); | 11142 | pci_disable_device(pdev); |
7248 | pci_set_drvdata(pdev, NULL); | 11143 | pci_set_drvdata(pdev, NULL); |
7249 | free_ieee80211(priv->net_dev); | 11144 | free_ieee80211(priv->net_dev); |
7250 | 11145 | free_firmware(); | |
7251 | #ifdef CONFIG_PM | ||
7252 | if (fw_loaded) { | ||
7253 | release_firmware(bootfw); | ||
7254 | release_firmware(ucode); | ||
7255 | release_firmware(firmware); | ||
7256 | fw_loaded = 0; | ||
7257 | } | ||
7258 | #endif | ||
7259 | } | 11146 | } |
7260 | 11147 | ||
7261 | #ifdef CONFIG_PM | 11148 | #ifdef CONFIG_PM |
@@ -7287,13 +11174,10 @@ static int ipw_pci_resume(struct pci_dev *pdev) | |||
7287 | 11174 | ||
7288 | printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); | 11175 | printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); |
7289 | 11176 | ||
7290 | pci_set_power_state(pdev, 0); | 11177 | pci_set_power_state(pdev, PCI_D0); |
7291 | pci_enable_device(pdev); | 11178 | pci_enable_device(pdev); |
7292 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) | ||
7293 | pci_restore_state(pdev, priv->pm_state); | ||
7294 | #else | ||
7295 | pci_restore_state(pdev); | 11179 | pci_restore_state(pdev); |
7296 | #endif | 11180 | |
7297 | /* | 11181 | /* |
7298 | * Suspend/Resume resets the PCI configuration space, so we have to | 11182 | * Suspend/Resume resets the PCI configuration space, so we have to |
7299 | * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries | 11183 | * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries |
@@ -7365,16 +11249,33 @@ MODULE_PARM_DESC(associate, "auto associate when scanning (default on)"); | |||
7365 | module_param(auto_create, int, 0444); | 11249 | module_param(auto_create, int, 0444); |
7366 | MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); | 11250 | MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); |
7367 | 11251 | ||
11252 | module_param(led, int, 0444); | ||
11253 | MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n"); | ||
11254 | |||
7368 | module_param(debug, int, 0444); | 11255 | module_param(debug, int, 0444); |
7369 | MODULE_PARM_DESC(debug, "debug output mask"); | 11256 | MODULE_PARM_DESC(debug, "debug output mask"); |
7370 | 11257 | ||
7371 | module_param(channel, int, 0444); | 11258 | module_param(channel, int, 0444); |
7372 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); | 11259 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); |
7373 | 11260 | ||
7374 | module_param(ifname, charp, 0444); | 11261 | #ifdef CONFIG_IPW_QOS |
7375 | MODULE_PARM_DESC(ifname, "network device name (default eth%d)"); | 11262 | module_param(qos_enable, int, 0444); |
11263 | MODULE_PARM_DESC(qos_enable, "enable all QoS functionalitis"); | ||
11264 | |||
11265 | module_param(qos_burst_enable, int, 0444); | ||
11266 | MODULE_PARM_DESC(qos_burst_enable, "enable QoS burst mode"); | ||
11267 | |||
11268 | module_param(qos_no_ack_mask, int, 0444); | ||
11269 | MODULE_PARM_DESC(qos_no_ack_mask, "mask Tx_Queue to no ack"); | ||
7376 | 11270 | ||
7377 | #ifdef CONFIG_IPW_PROMISC | 11271 | module_param(burst_duration_CCK, int, 0444); |
11272 | MODULE_PARM_DESC(burst_duration_CCK, "set CCK burst value"); | ||
11273 | |||
11274 | module_param(burst_duration_OFDM, int, 0444); | ||
11275 | MODULE_PARM_DESC(burst_duration_OFDM, "set OFDM burst value"); | ||
11276 | #endif /* CONFIG_IPW_QOS */ | ||
11277 | |||
11278 | #ifdef CONFIG_IPW2200_MONITOR | ||
7378 | module_param(mode, int, 0444); | 11279 | module_param(mode, int, 0444); |
7379 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); | 11280 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); |
7380 | #else | 11281 | #else |
@@ -7382,5 +11283,12 @@ module_param(mode, int, 0444); | |||
7382 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); | 11283 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); |
7383 | #endif | 11284 | #endif |
7384 | 11285 | ||
11286 | module_param(hwcrypto, int, 0444); | ||
11287 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); | ||
11288 | |||
11289 | module_param(cmdlog, int, 0444); | ||
11290 | MODULE_PARM_DESC(cmdlog, | ||
11291 | "allocate a ring buffer for logging firmware commands"); | ||
11292 | |||
7385 | module_exit(ipw_exit); | 11293 | module_exit(ipw_exit); |
7386 | module_init(ipw_init); | 11294 | module_init(ipw_init); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e9cf32bf3e31..1c98db0652c9 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -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 |
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/config.h> | 34 | #include <linux/config.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | 36 | ||
37 | #include <linux/version.h> | ||
38 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
39 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
40 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
@@ -50,6 +49,7 @@ | |||
50 | #include <asm/io.h> | 49 | #include <asm/io.h> |
51 | 50 | ||
52 | #include <net/ieee80211.h> | 51 | #include <net/ieee80211.h> |
52 | #include <net/ieee80211_radiotap.h> | ||
53 | 53 | ||
54 | #define DRV_NAME "ipw2200" | 54 | #define DRV_NAME "ipw2200" |
55 | 55 | ||
@@ -161,6 +161,16 @@ enum connection_manager_assoc_states { | |||
161 | * TX Queue Flag Definitions | 161 | * TX Queue Flag Definitions |
162 | */ | 162 | */ |
163 | 163 | ||
164 | /* tx wep key definition */ | ||
165 | #define DCT_WEP_KEY_NOT_IMMIDIATE 0x00 | ||
166 | #define DCT_WEP_KEY_64Bit 0x40 | ||
167 | #define DCT_WEP_KEY_128Bit 0x80 | ||
168 | #define DCT_WEP_KEY_128bitIV 0xC0 | ||
169 | #define DCT_WEP_KEY_SIZE_MASK 0xC0 | ||
170 | |||
171 | #define DCT_WEP_KEY_INDEX_MASK 0x0F | ||
172 | #define DCT_WEP_INDEX_USE_IMMEDIATE 0x20 | ||
173 | |||
164 | /* abort attempt if mgmt frame is rx'd */ | 174 | /* abort attempt if mgmt frame is rx'd */ |
165 | #define DCT_FLAG_ABORT_MGMT 0x01 | 175 | #define DCT_FLAG_ABORT_MGMT 0x01 |
166 | 176 | ||
@@ -168,7 +178,8 @@ enum connection_manager_assoc_states { | |||
168 | #define DCT_FLAG_CTS_REQUIRED 0x02 | 178 | #define DCT_FLAG_CTS_REQUIRED 0x02 |
169 | 179 | ||
170 | /* use short preamble */ | 180 | /* use short preamble */ |
171 | #define DCT_FLAG_SHORT_PREMBL 0x04 | 181 | #define DCT_FLAG_LONG_PREAMBLE 0x00 |
182 | #define DCT_FLAG_SHORT_PREAMBLE 0x04 | ||
172 | 183 | ||
173 | /* RTS/CTS first */ | 184 | /* RTS/CTS first */ |
174 | #define DCT_FLAG_RTS_REQD 0x08 | 185 | #define DCT_FLAG_RTS_REQD 0x08 |
@@ -185,9 +196,23 @@ enum connection_manager_assoc_states { | |||
185 | /* ACK rx is expected to follow */ | 196 | /* ACK rx is expected to follow */ |
186 | #define DCT_FLAG_ACK_REQD 0x80 | 197 | #define DCT_FLAG_ACK_REQD 0x80 |
187 | 198 | ||
199 | /* TX flags extension */ | ||
188 | #define DCT_FLAG_EXT_MODE_CCK 0x01 | 200 | #define DCT_FLAG_EXT_MODE_CCK 0x01 |
189 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 | 201 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 |
190 | 202 | ||
203 | #define DCT_FLAG_EXT_SECURITY_WEP 0x00 | ||
204 | #define DCT_FLAG_EXT_SECURITY_NO DCT_FLAG_EXT_SECURITY_WEP | ||
205 | #define DCT_FLAG_EXT_SECURITY_CKIP 0x04 | ||
206 | #define DCT_FLAG_EXT_SECURITY_CCM 0x08 | ||
207 | #define DCT_FLAG_EXT_SECURITY_TKIP 0x0C | ||
208 | #define DCT_FLAG_EXT_SECURITY_MASK 0x0C | ||
209 | |||
210 | #define DCT_FLAG_EXT_QOS_ENABLED 0x10 | ||
211 | |||
212 | #define DCT_FLAG_EXT_HC_NO_SIFS_PIFS 0x00 | ||
213 | #define DCT_FLAG_EXT_HC_SIFS 0x20 | ||
214 | #define DCT_FLAG_EXT_HC_PIFS 0x40 | ||
215 | |||
191 | #define TX_RX_TYPE_MASK 0xFF | 216 | #define TX_RX_TYPE_MASK 0xFF |
192 | #define TX_FRAME_TYPE 0x00 | 217 | #define TX_FRAME_TYPE 0x00 |
193 | #define TX_HOST_COMMAND_TYPE 0x01 | 218 | #define TX_HOST_COMMAND_TYPE 0x01 |
@@ -233,6 +258,117 @@ enum connection_manager_assoc_states { | |||
233 | #define DCR_TYPE_SNIFFER 0x06 | 258 | #define DCR_TYPE_SNIFFER 0x06 |
234 | #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS | 259 | #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS |
235 | 260 | ||
261 | /* QoS definitions */ | ||
262 | |||
263 | #define CW_MIN_OFDM 15 | ||
264 | #define CW_MAX_OFDM 1023 | ||
265 | #define CW_MIN_CCK 31 | ||
266 | #define CW_MAX_CCK 1023 | ||
267 | |||
268 | #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM | ||
269 | #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM | ||
270 | #define QOS_TX2_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) | ||
271 | #define QOS_TX3_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 4 - 1 ) | ||
272 | |||
273 | #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK | ||
274 | #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK | ||
275 | #define QOS_TX2_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) | ||
276 | #define QOS_TX3_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 4 - 1 ) | ||
277 | |||
278 | #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM | ||
279 | #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM | ||
280 | #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM | ||
281 | #define QOS_TX3_CW_MAX_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) | ||
282 | |||
283 | #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK | ||
284 | #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK | ||
285 | #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK | ||
286 | #define QOS_TX3_CW_MAX_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) | ||
287 | |||
288 | #define QOS_TX0_AIFS (3 - QOS_AIFSN_MIN_VALUE) | ||
289 | #define QOS_TX1_AIFS (7 - QOS_AIFSN_MIN_VALUE) | ||
290 | #define QOS_TX2_AIFS (2 - QOS_AIFSN_MIN_VALUE) | ||
291 | #define QOS_TX3_AIFS (2 - QOS_AIFSN_MIN_VALUE) | ||
292 | |||
293 | #define QOS_TX0_ACM 0 | ||
294 | #define QOS_TX1_ACM 0 | ||
295 | #define QOS_TX2_ACM 0 | ||
296 | #define QOS_TX3_ACM 0 | ||
297 | |||
298 | #define QOS_TX0_TXOP_LIMIT_CCK 0 | ||
299 | #define QOS_TX1_TXOP_LIMIT_CCK 0 | ||
300 | #define QOS_TX2_TXOP_LIMIT_CCK 6016 | ||
301 | #define QOS_TX3_TXOP_LIMIT_CCK 3264 | ||
302 | |||
303 | #define QOS_TX0_TXOP_LIMIT_OFDM 0 | ||
304 | #define QOS_TX1_TXOP_LIMIT_OFDM 0 | ||
305 | #define QOS_TX2_TXOP_LIMIT_OFDM 3008 | ||
306 | #define QOS_TX3_TXOP_LIMIT_OFDM 1504 | ||
307 | |||
308 | #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM | ||
309 | #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM | ||
310 | #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM | ||
311 | #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM | ||
312 | |||
313 | #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK | ||
314 | #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK | ||
315 | #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK | ||
316 | #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK | ||
317 | |||
318 | #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM | ||
319 | #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM | ||
320 | #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM | ||
321 | #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM | ||
322 | |||
323 | #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK | ||
324 | #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK | ||
325 | #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK | ||
326 | #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK | ||
327 | |||
328 | #define DEF_TX0_AIFS 0 | ||
329 | #define DEF_TX1_AIFS 0 | ||
330 | #define DEF_TX2_AIFS 0 | ||
331 | #define DEF_TX3_AIFS 0 | ||
332 | |||
333 | #define DEF_TX0_ACM 0 | ||
334 | #define DEF_TX1_ACM 0 | ||
335 | #define DEF_TX2_ACM 0 | ||
336 | #define DEF_TX3_ACM 0 | ||
337 | |||
338 | #define DEF_TX0_TXOP_LIMIT_CCK 0 | ||
339 | #define DEF_TX1_TXOP_LIMIT_CCK 0 | ||
340 | #define DEF_TX2_TXOP_LIMIT_CCK 0 | ||
341 | #define DEF_TX3_TXOP_LIMIT_CCK 0 | ||
342 | |||
343 | #define DEF_TX0_TXOP_LIMIT_OFDM 0 | ||
344 | #define DEF_TX1_TXOP_LIMIT_OFDM 0 | ||
345 | #define DEF_TX2_TXOP_LIMIT_OFDM 0 | ||
346 | #define DEF_TX3_TXOP_LIMIT_OFDM 0 | ||
347 | |||
348 | #define QOS_QOS_SETS 3 | ||
349 | #define QOS_PARAM_SET_ACTIVE 0 | ||
350 | #define QOS_PARAM_SET_DEF_CCK 1 | ||
351 | #define QOS_PARAM_SET_DEF_OFDM 2 | ||
352 | |||
353 | #define CTRL_QOS_NO_ACK (0x0020) | ||
354 | |||
355 | #define IPW_TX_QUEUE_1 1 | ||
356 | #define IPW_TX_QUEUE_2 2 | ||
357 | #define IPW_TX_QUEUE_3 3 | ||
358 | #define IPW_TX_QUEUE_4 4 | ||
359 | |||
360 | /* QoS sturctures */ | ||
361 | struct ipw_qos_info { | ||
362 | int qos_enable; | ||
363 | struct ieee80211_qos_parameters *def_qos_parm_OFDM; | ||
364 | struct ieee80211_qos_parameters *def_qos_parm_CCK; | ||
365 | u32 burst_duration_CCK; | ||
366 | u32 burst_duration_OFDM; | ||
367 | u16 qos_no_ack_mask; | ||
368 | int burst_enable; | ||
369 | }; | ||
370 | |||
371 | /**************************************************************/ | ||
236 | /** | 372 | /** |
237 | * Generic queue structure | 373 | * Generic queue structure |
238 | * | 374 | * |
@@ -402,9 +538,9 @@ struct clx2_tx_queue { | |||
402 | #define RX_FREE_BUFFERS 32 | 538 | #define RX_FREE_BUFFERS 32 |
403 | #define RX_LOW_WATERMARK 8 | 539 | #define RX_LOW_WATERMARK 8 |
404 | 540 | ||
405 | #define SUP_RATE_11A_MAX_NUM_CHANNELS (8) | 541 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
406 | #define SUP_RATE_11B_MAX_NUM_CHANNELS (4) | 542 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 |
407 | #define SUP_RATE_11G_MAX_NUM_CHANNELS (12) | 543 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 |
408 | 544 | ||
409 | // Used for passing to driver number of successes and failures per rate | 545 | // Used for passing to driver number of successes and failures per rate |
410 | struct rate_histogram { | 546 | struct rate_histogram { |
@@ -453,6 +589,9 @@ struct notif_channel_result { | |||
453 | u8 uReserved; | 589 | u8 uReserved; |
454 | } __attribute__ ((packed)); | 590 | } __attribute__ ((packed)); |
455 | 591 | ||
592 | #define SCAN_COMPLETED_STATUS_COMPLETE 1 | ||
593 | #define SCAN_COMPLETED_STATUS_ABORTED 2 | ||
594 | |||
456 | struct notif_scan_complete { | 595 | struct notif_scan_complete { |
457 | u8 scan_type; | 596 | u8 scan_type; |
458 | u8 num_channels; | 597 | u8 num_channels; |
@@ -563,8 +702,8 @@ struct ipw_rx_packet { | |||
563 | } __attribute__ ((packed)); | 702 | } __attribute__ ((packed)); |
564 | 703 | ||
565 | #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 | 704 | #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 |
566 | #define IPW_RX_FRAME_SIZE sizeof(struct ipw_rx_header) + \ | 705 | #define IPW_RX_FRAME_SIZE (unsigned int)(sizeof(struct ipw_rx_header) + \ |
567 | sizeof(struct ipw_rx_frame) | 706 | sizeof(struct ipw_rx_frame)) |
568 | 707 | ||
569 | struct ipw_rx_mem_buffer { | 708 | struct ipw_rx_mem_buffer { |
570 | dma_addr_t dma_addr; | 709 | dma_addr_t dma_addr; |
@@ -657,6 +796,19 @@ struct ipw_multicast_addr { | |||
657 | u8 mac4[6]; | 796 | u8 mac4[6]; |
658 | } __attribute__ ((packed)); | 797 | } __attribute__ ((packed)); |
659 | 798 | ||
799 | #define DCW_WEP_KEY_INDEX_MASK 0x03 /* bits [0:1] */ | ||
800 | #define DCW_WEP_KEY_SEC_TYPE_MASK 0x30 /* bits [4:5] */ | ||
801 | |||
802 | #define DCW_WEP_KEY_SEC_TYPE_WEP 0x00 | ||
803 | #define DCW_WEP_KEY_SEC_TYPE_CCM 0x20 | ||
804 | #define DCW_WEP_KEY_SEC_TYPE_TKIP 0x30 | ||
805 | |||
806 | #define DCW_WEP_KEY_INVALID_SIZE 0x00 /* 0 = Invalid key */ | ||
807 | #define DCW_WEP_KEY64Bit_SIZE 0x05 /* 64-bit encryption */ | ||
808 | #define DCW_WEP_KEY128Bit_SIZE 0x0D /* 128-bit encryption */ | ||
809 | #define DCW_CCM_KEY128Bit_SIZE 0x10 /* 128-bit key */ | ||
810 | //#define DCW_WEP_KEY128BitIV_SIZE 0x10 /* 128-bit key and 128-bit IV */ | ||
811 | |||
660 | struct ipw_wep_key { | 812 | struct ipw_wep_key { |
661 | u8 cmd_id; | 813 | u8 cmd_id; |
662 | u8 seq_num; | 814 | u8 seq_num; |
@@ -818,14 +970,6 @@ struct ipw_tx_power { | |||
818 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; | 970 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; |
819 | } __attribute__ ((packed)); | 971 | } __attribute__ ((packed)); |
820 | 972 | ||
821 | struct ipw_qos_parameters { | ||
822 | u16 cw_min[4]; | ||
823 | u16 cw_max[4]; | ||
824 | u8 aifs[4]; | ||
825 | u8 flag[4]; | ||
826 | u16 tx_op_limit[4]; | ||
827 | } __attribute__ ((packed)); | ||
828 | |||
829 | struct ipw_rsn_capabilities { | 973 | struct ipw_rsn_capabilities { |
830 | u8 id; | 974 | u8 id; |
831 | u8 length; | 975 | u8 length; |
@@ -888,6 +1032,10 @@ struct ipw_cmd { | |||
888 | #define STATUS_SCAN_PENDING (1<<20) | 1032 | #define STATUS_SCAN_PENDING (1<<20) |
889 | #define STATUS_SCANNING (1<<21) | 1033 | #define STATUS_SCANNING (1<<21) |
890 | #define STATUS_SCAN_ABORTING (1<<22) | 1034 | #define STATUS_SCAN_ABORTING (1<<22) |
1035 | #define STATUS_SCAN_FORCED (1<<23) | ||
1036 | |||
1037 | #define STATUS_LED_LINK_ON (1<<24) | ||
1038 | #define STATUS_LED_ACT_ON (1<<25) | ||
891 | 1039 | ||
892 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ | 1040 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ |
893 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ | 1041 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ |
@@ -899,11 +1047,15 @@ struct ipw_cmd { | |||
899 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | 1047 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ |
900 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ | 1048 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ |
901 | #define CFG_CUSTOM_MAC (1<<3) | 1049 | #define CFG_CUSTOM_MAC (1<<3) |
902 | #define CFG_PREAMBLE (1<<4) | 1050 | #define CFG_PREAMBLE_LONG (1<<4) |
903 | #define CFG_ADHOC_PERSIST (1<<5) | 1051 | #define CFG_ADHOC_PERSIST (1<<5) |
904 | #define CFG_ASSOCIATE (1<<6) | 1052 | #define CFG_ASSOCIATE (1<<6) |
905 | #define CFG_FIXED_RATE (1<<7) | 1053 | #define CFG_FIXED_RATE (1<<7) |
906 | #define CFG_ADHOC_CREATE (1<<8) | 1054 | #define CFG_ADHOC_CREATE (1<<8) |
1055 | #define CFG_NO_LED (1<<9) | ||
1056 | #define CFG_BACKGROUND_SCAN (1<<10) | ||
1057 | #define CFG_SPEED_SCAN (1<<11) | ||
1058 | #define CFG_NET_STATS (1<<12) | ||
907 | 1059 | ||
908 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ | 1060 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ |
909 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ | 1061 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ |
@@ -925,13 +1077,50 @@ struct average { | |||
925 | s32 sum; | 1077 | s32 sum; |
926 | }; | 1078 | }; |
927 | 1079 | ||
1080 | #define MAX_SPEED_SCAN 100 | ||
1081 | #define IPW_IBSS_MAC_HASH_SIZE 31 | ||
1082 | |||
1083 | struct ipw_ibss_seq { | ||
1084 | u8 mac[ETH_ALEN]; | ||
1085 | u16 seq_num; | ||
1086 | u16 frag_num; | ||
1087 | unsigned long packet_time; | ||
1088 | struct list_head list; | ||
1089 | }; | ||
1090 | |||
1091 | struct ipw_error_elem { | ||
1092 | u32 desc; | ||
1093 | u32 time; | ||
1094 | u32 blink1; | ||
1095 | u32 blink2; | ||
1096 | u32 link1; | ||
1097 | u32 link2; | ||
1098 | u32 data; | ||
1099 | }; | ||
1100 | |||
1101 | struct ipw_event { | ||
1102 | u32 event; | ||
1103 | u32 time; | ||
1104 | u32 data; | ||
1105 | } __attribute__ ((packed)); | ||
1106 | |||
1107 | struct ipw_fw_error { | ||
1108 | unsigned long jiffies; | ||
1109 | u32 status; | ||
1110 | u32 config; | ||
1111 | u32 elem_len; | ||
1112 | u32 log_len; | ||
1113 | struct ipw_error_elem *elem; | ||
1114 | struct ipw_event *log; | ||
1115 | u8 payload[0]; | ||
1116 | } __attribute__ ((packed)); | ||
1117 | |||
928 | struct ipw_priv { | 1118 | struct ipw_priv { |
929 | /* ieee device used by generic ieee processing code */ | 1119 | /* ieee device used by generic ieee processing code */ |
930 | struct ieee80211_device *ieee; | 1120 | struct ieee80211_device *ieee; |
931 | struct ieee80211_security sec; | ||
932 | 1121 | ||
933 | /* spinlock */ | ||
934 | spinlock_t lock; | 1122 | spinlock_t lock; |
1123 | struct semaphore sem; | ||
935 | 1124 | ||
936 | /* basic pci-network driver stuff */ | 1125 | /* basic pci-network driver stuff */ |
937 | struct pci_dev *pci_dev; | 1126 | struct pci_dev *pci_dev; |
@@ -966,7 +1155,7 @@ struct ipw_priv { | |||
966 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ | 1155 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ |
967 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ | 1156 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ |
968 | u32 hcmd_seq; /**< sequence number for hcmd */ | 1157 | u32 hcmd_seq; /**< sequence number for hcmd */ |
969 | u32 missed_beacon_threshold; | 1158 | u32 disassociate_threshold; |
970 | u32 roaming_threshold; | 1159 | u32 roaming_threshold; |
971 | 1160 | ||
972 | struct ipw_associate assoc_request; | 1161 | struct ipw_associate assoc_request; |
@@ -1007,6 +1196,8 @@ struct ipw_priv { | |||
1007 | u8 mac_addr[ETH_ALEN]; | 1196 | u8 mac_addr[ETH_ALEN]; |
1008 | u8 num_stations; | 1197 | u8 num_stations; |
1009 | u8 stations[MAX_STATIONS][ETH_ALEN]; | 1198 | u8 stations[MAX_STATIONS][ETH_ALEN]; |
1199 | u8 short_retry_limit; | ||
1200 | u8 long_retry_limit; | ||
1010 | 1201 | ||
1011 | u32 notif_missed_beacons; | 1202 | u32 notif_missed_beacons; |
1012 | 1203 | ||
@@ -1024,17 +1215,29 @@ struct ipw_priv { | |||
1024 | u32 tx_packets; | 1215 | u32 tx_packets; |
1025 | u32 quality; | 1216 | u32 quality; |
1026 | 1217 | ||
1218 | u8 speed_scan[MAX_SPEED_SCAN]; | ||
1219 | u8 speed_scan_pos; | ||
1220 | |||
1221 | u16 last_seq_num; | ||
1222 | u16 last_frag_num; | ||
1223 | unsigned long last_packet_time; | ||
1224 | struct list_head ibss_mac_hash[IPW_IBSS_MAC_HASH_SIZE]; | ||
1225 | |||
1027 | /* eeprom */ | 1226 | /* eeprom */ |
1028 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ | 1227 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ |
1228 | u8 country[4]; | ||
1029 | int eeprom_delay; | 1229 | int eeprom_delay; |
1030 | 1230 | ||
1031 | struct iw_statistics wstats; | 1231 | struct iw_statistics wstats; |
1032 | 1232 | ||
1233 | struct iw_public_data wireless_data; | ||
1234 | |||
1033 | struct workqueue_struct *workqueue; | 1235 | struct workqueue_struct *workqueue; |
1034 | 1236 | ||
1035 | struct work_struct adhoc_check; | 1237 | struct work_struct adhoc_check; |
1036 | struct work_struct associate; | 1238 | struct work_struct associate; |
1037 | struct work_struct disassociate; | 1239 | struct work_struct disassociate; |
1240 | struct work_struct system_config; | ||
1038 | struct work_struct rx_replenish; | 1241 | struct work_struct rx_replenish; |
1039 | struct work_struct request_scan; | 1242 | struct work_struct request_scan; |
1040 | struct work_struct adapter_restart; | 1243 | struct work_struct adapter_restart; |
@@ -1045,25 +1248,51 @@ struct ipw_priv { | |||
1045 | struct work_struct abort_scan; | 1248 | struct work_struct abort_scan; |
1046 | struct work_struct roam; | 1249 | struct work_struct roam; |
1047 | struct work_struct scan_check; | 1250 | struct work_struct scan_check; |
1251 | struct work_struct link_up; | ||
1252 | struct work_struct link_down; | ||
1048 | 1253 | ||
1049 | struct tasklet_struct irq_tasklet; | 1254 | struct tasklet_struct irq_tasklet; |
1050 | 1255 | ||
1256 | /* LED related variables and work_struct */ | ||
1257 | u8 nic_type; | ||
1258 | u32 led_activity_on; | ||
1259 | u32 led_activity_off; | ||
1260 | u32 led_association_on; | ||
1261 | u32 led_association_off; | ||
1262 | u32 led_ofdm_on; | ||
1263 | u32 led_ofdm_off; | ||
1264 | |||
1265 | struct work_struct led_link_on; | ||
1266 | struct work_struct led_link_off; | ||
1267 | struct work_struct led_act_off; | ||
1268 | struct work_struct merge_networks; | ||
1269 | |||
1270 | struct ipw_cmd_log *cmdlog; | ||
1271 | int cmdlog_len; | ||
1272 | int cmdlog_pos; | ||
1273 | |||
1051 | #define IPW_2200BG 1 | 1274 | #define IPW_2200BG 1 |
1052 | #define IPW_2915ABG 2 | 1275 | #define IPW_2915ABG 2 |
1053 | u8 adapter; | 1276 | u8 adapter; |
1054 | 1277 | ||
1055 | #define IPW_DEFAULT_TX_POWER 0x14 | 1278 | s8 tx_power; |
1056 | u8 tx_power; | ||
1057 | 1279 | ||
1058 | #ifdef CONFIG_PM | 1280 | #ifdef CONFIG_PM |
1059 | u32 pm_state[16]; | 1281 | u32 pm_state[16]; |
1060 | #endif | 1282 | #endif |
1061 | 1283 | ||
1284 | struct ipw_fw_error *error; | ||
1285 | |||
1062 | /* network state */ | 1286 | /* network state */ |
1063 | 1287 | ||
1064 | /* Used to pass the current INTA value from ISR to Tasklet */ | 1288 | /* Used to pass the current INTA value from ISR to Tasklet */ |
1065 | u32 isr_inta; | 1289 | u32 isr_inta; |
1066 | 1290 | ||
1291 | /* QoS */ | ||
1292 | struct ipw_qos_info qos_data; | ||
1293 | struct work_struct qos_activate; | ||
1294 | /*********************************/ | ||
1295 | |||
1067 | /* debugging info */ | 1296 | /* debugging info */ |
1068 | u32 indirect_dword; | 1297 | u32 indirect_dword; |
1069 | u32 direct_dword; | 1298 | u32 direct_dword; |
@@ -1125,6 +1354,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1125 | #define IPW_DL_RF_KILL (1<<17) | 1354 | #define IPW_DL_RF_KILL (1<<17) |
1126 | #define IPW_DL_FW_ERRORS (1<<18) | 1355 | #define IPW_DL_FW_ERRORS (1<<18) |
1127 | 1356 | ||
1357 | #define IPW_DL_LED (1<<19) | ||
1358 | |||
1128 | #define IPW_DL_ORD (1<<20) | 1359 | #define IPW_DL_ORD (1<<20) |
1129 | 1360 | ||
1130 | #define IPW_DL_FRAG (1<<21) | 1361 | #define IPW_DL_FRAG (1<<21) |
@@ -1137,6 +1368,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1137 | #define IPW_DL_TRACE (1<<28) | 1368 | #define IPW_DL_TRACE (1<<28) |
1138 | 1369 | ||
1139 | #define IPW_DL_STATS (1<<29) | 1370 | #define IPW_DL_STATS (1<<29) |
1371 | #define IPW_DL_MERGE (1<<30) | ||
1372 | #define IPW_DL_QOS (1<<31) | ||
1140 | 1373 | ||
1141 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) | 1374 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) |
1142 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) | 1375 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) |
@@ -1150,6 +1383,7 @@ do { if (ipw_debug_level & (level)) \ | |||
1150 | #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a) | 1383 | #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a) |
1151 | #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a) | 1384 | #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a) |
1152 | #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) | 1385 | #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) |
1386 | #define IPW_DEBUG_LED(f, a...) IPW_DEBUG(IPW_DL_LED, f, ## a) | ||
1153 | #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a) | 1387 | #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a) |
1154 | #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) | 1388 | #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) |
1155 | #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a) | 1389 | #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a) |
@@ -1163,6 +1397,8 @@ do { if (ipw_debug_level & (level)) \ | |||
1163 | #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) | 1397 | #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) |
1164 | #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) | 1398 | #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) |
1165 | #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) | 1399 | #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) |
1400 | #define IPW_DEBUG_MERGE(f, a...) IPW_DEBUG(IPW_DL_MERGE, f, ## a) | ||
1401 | #define IPW_DEBUG_QOS(f, a...) IPW_DEBUG(IPW_DL_QOS, f, ## a) | ||
1166 | 1402 | ||
1167 | #include <linux/ctype.h> | 1403 | #include <linux/ctype.h> |
1168 | 1404 | ||
@@ -1177,59 +1413,65 @@ do { if (ipw_debug_level & (level)) \ | |||
1177 | #define DINO_RXFIFO_DATA 0x01 | 1413 | #define DINO_RXFIFO_DATA 0x01 |
1178 | #define DINO_CONTROL_REG 0x00200000 | 1414 | #define DINO_CONTROL_REG 0x00200000 |
1179 | 1415 | ||
1180 | #define CX2_INTA_RW 0x00000008 | 1416 | #define IPW_INTA_RW 0x00000008 |
1181 | #define CX2_INTA_MASK_R 0x0000000C | 1417 | #define IPW_INTA_MASK_R 0x0000000C |
1182 | #define CX2_INDIRECT_ADDR 0x00000010 | 1418 | #define IPW_INDIRECT_ADDR 0x00000010 |
1183 | #define CX2_INDIRECT_DATA 0x00000014 | 1419 | #define IPW_INDIRECT_DATA 0x00000014 |
1184 | #define CX2_AUTOINC_ADDR 0x00000018 | 1420 | #define IPW_AUTOINC_ADDR 0x00000018 |
1185 | #define CX2_AUTOINC_DATA 0x0000001C | 1421 | #define IPW_AUTOINC_DATA 0x0000001C |
1186 | #define CX2_RESET_REG 0x00000020 | 1422 | #define IPW_RESET_REG 0x00000020 |
1187 | #define CX2_GP_CNTRL_RW 0x00000024 | 1423 | #define IPW_GP_CNTRL_RW 0x00000024 |
1188 | 1424 | ||
1189 | #define CX2_READ_INT_REGISTER 0xFF4 | 1425 | #define IPW_READ_INT_REGISTER 0xFF4 |
1190 | 1426 | ||
1191 | #define CX2_GP_CNTRL_BIT_INIT_DONE 0x00000004 | 1427 | #define IPW_GP_CNTRL_BIT_INIT_DONE 0x00000004 |
1192 | 1428 | ||
1193 | #define CX2_REGISTER_DOMAIN1_END 0x00001000 | 1429 | #define IPW_REGISTER_DOMAIN1_END 0x00001000 |
1194 | #define CX2_SRAM_READ_INT_REGISTER 0x00000ff4 | 1430 | #define IPW_SRAM_READ_INT_REGISTER 0x00000ff4 |
1195 | 1431 | ||
1196 | #define CX2_SHARED_LOWER_BOUND 0x00000200 | 1432 | #define IPW_SHARED_LOWER_BOUND 0x00000200 |
1197 | #define CX2_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 | 1433 | #define IPW_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 |
1198 | 1434 | ||
1199 | #define CX2_NIC_SRAM_LOWER_BOUND 0x00000000 | 1435 | #define IPW_NIC_SRAM_LOWER_BOUND 0x00000000 |
1200 | #define CX2_NIC_SRAM_UPPER_BOUND 0x00030000 | 1436 | #define IPW_NIC_SRAM_UPPER_BOUND 0x00030000 |
1201 | 1437 | ||
1202 | #define CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) | 1438 | #define IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) |
1203 | #define CX2_GP_CNTRL_BIT_CLOCK_READY 0x00000001 | 1439 | #define IPW_GP_CNTRL_BIT_CLOCK_READY 0x00000001 |
1204 | #define CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 | 1440 | #define IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 |
1205 | 1441 | ||
1206 | /* | 1442 | /* |
1207 | * RESET Register Bit Indexes | 1443 | * RESET Register Bit Indexes |
1208 | */ | 1444 | */ |
1209 | #define CBD_RESET_REG_PRINCETON_RESET 0x00000001 /* Bit 0 (LSB) */ | 1445 | #define CBD_RESET_REG_PRINCETON_RESET (1<<0) |
1210 | #define CX2_RESET_REG_SW_RESET 0x00000080 /* Bit 7 */ | 1446 | #define IPW_START_STANDBY (1<<2) |
1211 | #define CX2_RESET_REG_MASTER_DISABLED 0x00000100 /* Bit 8 */ | 1447 | #define IPW_ACTIVITY_LED (1<<4) |
1212 | #define CX2_RESET_REG_STOP_MASTER 0x00000200 /* Bit 9 */ | 1448 | #define IPW_ASSOCIATED_LED (1<<5) |
1213 | #define CX2_ARC_KESHET_CONFIG 0x08000000 /* Bit 27 */ | 1449 | #define IPW_OFDM_LED (1<<6) |
1214 | #define CX2_START_STANDBY 0x00000004 /* Bit 2 */ | 1450 | #define IPW_RESET_REG_SW_RESET (1<<7) |
1215 | 1451 | #define IPW_RESET_REG_MASTER_DISABLED (1<<8) | |
1216 | #define CX2_CSR_CIS_UPPER_BOUND 0x00000200 | 1452 | #define IPW_RESET_REG_STOP_MASTER (1<<9) |
1217 | #define CX2_DOMAIN_0_END 0x1000 | 1453 | #define IPW_GATE_ODMA (1<<25) |
1454 | #define IPW_GATE_IDMA (1<<26) | ||
1455 | #define IPW_ARC_KESHET_CONFIG (1<<27) | ||
1456 | #define IPW_GATE_ADMA (1<<29) | ||
1457 | |||
1458 | #define IPW_CSR_CIS_UPPER_BOUND 0x00000200 | ||
1459 | #define IPW_DOMAIN_0_END 0x1000 | ||
1218 | #define CLX_MEM_BAR_SIZE 0x1000 | 1460 | #define CLX_MEM_BAR_SIZE 0x1000 |
1219 | 1461 | ||
1220 | #define CX2_BASEBAND_CONTROL_STATUS 0X00200000 | 1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 |
1221 | #define CX2_BASEBAND_TX_FIFO_WRITE 0X00200004 | 1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 |
1222 | #define CX2_BASEBAND_RX_FIFO_READ 0X00200004 | 1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 |
1223 | #define CX2_BASEBAND_CONTROL_STORE 0X00200010 | 1465 | #define IPW_BASEBAND_CONTROL_STORE 0X00200010 |
1224 | 1466 | ||
1225 | #define CX2_INTERNAL_CMD_EVENT 0X00300004 | 1467 | #define IPW_INTERNAL_CMD_EVENT 0X00300004 |
1226 | #define CX2_BASEBAND_POWER_DOWN 0x00000001 | 1468 | #define IPW_BASEBAND_POWER_DOWN 0x00000001 |
1227 | 1469 | ||
1228 | #define CX2_MEM_HALT_AND_RESET 0x003000e0 | 1470 | #define IPW_MEM_HALT_AND_RESET 0x003000e0 |
1229 | 1471 | ||
1230 | /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ | 1472 | /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ |
1231 | #define CX2_BIT_HALT_RESET_ON 0x80000000 | 1473 | #define IPW_BIT_HALT_RESET_ON 0x80000000 |
1232 | #define CX2_BIT_HALT_RESET_OFF 0x00000000 | 1474 | #define IPW_BIT_HALT_RESET_OFF 0x00000000 |
1233 | 1475 | ||
1234 | #define CB_LAST_VALID 0x20000000 | 1476 | #define CB_LAST_VALID 0x20000000 |
1235 | #define CB_INT_ENABLED 0x40000000 | 1477 | #define CB_INT_ENABLED 0x40000000 |
@@ -1248,63 +1490,63 @@ do { if (ipw_debug_level & (level)) \ | |||
1248 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 | 1490 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 |
1249 | #define DMA_CB_START 0x00000100 | 1491 | #define DMA_CB_START 0x00000100 |
1250 | 1492 | ||
1251 | #define CX2_SHARED_SRAM_SIZE 0x00030000 | 1493 | #define IPW_SHARED_SRAM_SIZE 0x00030000 |
1252 | #define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 | 1494 | #define IPW_SHARED_SRAM_DMA_CONTROL 0x00027000 |
1253 | #define CB_MAX_LENGTH 0x1FFF | 1495 | #define CB_MAX_LENGTH 0x1FFF |
1254 | 1496 | ||
1255 | #define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 | 1497 | #define IPW_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 |
1256 | #define CX2_EEPROM_IMAGE_SIZE 0x100 | 1498 | #define IPW_EEPROM_IMAGE_SIZE 0x100 |
1257 | 1499 | ||
1258 | /* DMA defs */ | 1500 | /* DMA defs */ |
1259 | #define CX2_DMA_I_CURRENT_CB 0x003000D0 | 1501 | #define IPW_DMA_I_CURRENT_CB 0x003000D0 |
1260 | #define CX2_DMA_O_CURRENT_CB 0x003000D4 | 1502 | #define IPW_DMA_O_CURRENT_CB 0x003000D4 |
1261 | #define CX2_DMA_I_DMA_CONTROL 0x003000A4 | 1503 | #define IPW_DMA_I_DMA_CONTROL 0x003000A4 |
1262 | #define CX2_DMA_I_CB_BASE 0x003000A0 | 1504 | #define IPW_DMA_I_CB_BASE 0x003000A0 |
1263 | 1505 | ||
1264 | #define CX2_TX_CMD_QUEUE_BD_BASE (0x00000200) | 1506 | #define IPW_TX_CMD_QUEUE_BD_BASE 0x00000200 |
1265 | #define CX2_TX_CMD_QUEUE_BD_SIZE (0x00000204) | 1507 | #define IPW_TX_CMD_QUEUE_BD_SIZE 0x00000204 |
1266 | #define CX2_TX_QUEUE_0_BD_BASE (0x00000208) | 1508 | #define IPW_TX_QUEUE_0_BD_BASE 0x00000208 |
1267 | #define CX2_TX_QUEUE_0_BD_SIZE (0x0000020C) | 1509 | #define IPW_TX_QUEUE_0_BD_SIZE (0x0000020C) |
1268 | #define CX2_TX_QUEUE_1_BD_BASE (0x00000210) | 1510 | #define IPW_TX_QUEUE_1_BD_BASE 0x00000210 |
1269 | #define CX2_TX_QUEUE_1_BD_SIZE (0x00000214) | 1511 | #define IPW_TX_QUEUE_1_BD_SIZE 0x00000214 |
1270 | #define CX2_TX_QUEUE_2_BD_BASE (0x00000218) | 1512 | #define IPW_TX_QUEUE_2_BD_BASE 0x00000218 |
1271 | #define CX2_TX_QUEUE_2_BD_SIZE (0x0000021C) | 1513 | #define IPW_TX_QUEUE_2_BD_SIZE (0x0000021C) |
1272 | #define CX2_TX_QUEUE_3_BD_BASE (0x00000220) | 1514 | #define IPW_TX_QUEUE_3_BD_BASE 0x00000220 |
1273 | #define CX2_TX_QUEUE_3_BD_SIZE (0x00000224) | 1515 | #define IPW_TX_QUEUE_3_BD_SIZE 0x00000224 |
1274 | #define CX2_RX_BD_BASE (0x00000240) | 1516 | #define IPW_RX_BD_BASE 0x00000240 |
1275 | #define CX2_RX_BD_SIZE (0x00000244) | 1517 | #define IPW_RX_BD_SIZE 0x00000244 |
1276 | #define CX2_RFDS_TABLE_LOWER (0x00000500) | 1518 | #define IPW_RFDS_TABLE_LOWER 0x00000500 |
1277 | 1519 | ||
1278 | #define CX2_TX_CMD_QUEUE_READ_INDEX (0x00000280) | 1520 | #define IPW_TX_CMD_QUEUE_READ_INDEX 0x00000280 |
1279 | #define CX2_TX_QUEUE_0_READ_INDEX (0x00000284) | 1521 | #define IPW_TX_QUEUE_0_READ_INDEX 0x00000284 |
1280 | #define CX2_TX_QUEUE_1_READ_INDEX (0x00000288) | 1522 | #define IPW_TX_QUEUE_1_READ_INDEX 0x00000288 |
1281 | #define CX2_TX_QUEUE_2_READ_INDEX (0x0000028C) | 1523 | #define IPW_TX_QUEUE_2_READ_INDEX (0x0000028C) |
1282 | #define CX2_TX_QUEUE_3_READ_INDEX (0x00000290) | 1524 | #define IPW_TX_QUEUE_3_READ_INDEX 0x00000290 |
1283 | #define CX2_RX_READ_INDEX (0x000002A0) | 1525 | #define IPW_RX_READ_INDEX (0x000002A0) |
1284 | 1526 | ||
1285 | #define CX2_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) | 1527 | #define IPW_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) |
1286 | #define CX2_TX_QUEUE_0_WRITE_INDEX (0x00000F84) | 1528 | #define IPW_TX_QUEUE_0_WRITE_INDEX (0x00000F84) |
1287 | #define CX2_TX_QUEUE_1_WRITE_INDEX (0x00000F88) | 1529 | #define IPW_TX_QUEUE_1_WRITE_INDEX (0x00000F88) |
1288 | #define CX2_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) | 1530 | #define IPW_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) |
1289 | #define CX2_TX_QUEUE_3_WRITE_INDEX (0x00000F90) | 1531 | #define IPW_TX_QUEUE_3_WRITE_INDEX (0x00000F90) |
1290 | #define CX2_RX_WRITE_INDEX (0x00000FA0) | 1532 | #define IPW_RX_WRITE_INDEX (0x00000FA0) |
1291 | 1533 | ||
1292 | /* | 1534 | /* |
1293 | * EEPROM Related Definitions | 1535 | * EEPROM Related Definitions |
1294 | */ | 1536 | */ |
1295 | 1537 | ||
1296 | #define IPW_EEPROM_DATA_SRAM_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x814) | 1538 | #define IPW_EEPROM_DATA_SRAM_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x814) |
1297 | #define IPW_EEPROM_DATA_SRAM_SIZE (CX2_SHARED_LOWER_BOUND + 0x818) | 1539 | #define IPW_EEPROM_DATA_SRAM_SIZE (IPW_SHARED_LOWER_BOUND + 0x818) |
1298 | #define IPW_EEPROM_LOAD_DISABLE (CX2_SHARED_LOWER_BOUND + 0x81C) | 1540 | #define IPW_EEPROM_LOAD_DISABLE (IPW_SHARED_LOWER_BOUND + 0x81C) |
1299 | #define IPW_EEPROM_DATA (CX2_SHARED_LOWER_BOUND + 0x820) | 1541 | #define IPW_EEPROM_DATA (IPW_SHARED_LOWER_BOUND + 0x820) |
1300 | #define IPW_EEPROM_UPPER_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x9E0) | 1542 | #define IPW_EEPROM_UPPER_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x9E0) |
1301 | 1543 | ||
1302 | #define IPW_STATION_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0xA0C) | 1544 | #define IPW_STATION_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0xA0C) |
1303 | #define IPW_STATION_TABLE_UPPER (CX2_SHARED_LOWER_BOUND + 0xB0C) | 1545 | #define IPW_STATION_TABLE_UPPER (IPW_SHARED_LOWER_BOUND + 0xB0C) |
1304 | #define IPW_REQUEST_ATIM (CX2_SHARED_LOWER_BOUND + 0xB0C) | 1546 | #define IPW_REQUEST_ATIM (IPW_SHARED_LOWER_BOUND + 0xB0C) |
1305 | #define IPW_ATIM_SENT (CX2_SHARED_LOWER_BOUND + 0xB10) | 1547 | #define IPW_ATIM_SENT (IPW_SHARED_LOWER_BOUND + 0xB10) |
1306 | #define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) | 1548 | #define IPW_WHO_IS_AWAKE (IPW_SHARED_LOWER_BOUND + 0xB14) |
1307 | #define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) | 1549 | #define IPW_DURING_ATIM_WINDOW (IPW_SHARED_LOWER_BOUND + 0xB18) |
1308 | 1550 | ||
1309 | #define MSB 1 | 1551 | #define MSB 1 |
1310 | #define LSB 0 | 1552 | #define LSB 0 |
@@ -1326,15 +1568,15 @@ do { if (ipw_debug_level & (level)) \ | |||
1326 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ | 1568 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ |
1327 | 1569 | ||
1328 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ | 1570 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ |
1329 | #define EEPROM_NIC_TYPE_STANDARD 0 | 1571 | #define EEPROM_NIC_TYPE_0 0 |
1330 | #define EEPROM_NIC_TYPE_DELL 1 | 1572 | #define EEPROM_NIC_TYPE_1 1 |
1331 | #define EEPROM_NIC_TYPE_FUJITSU 2 | 1573 | #define EEPROM_NIC_TYPE_2 2 |
1332 | #define EEPROM_NIC_TYPE_IBM 3 | 1574 | #define EEPROM_NIC_TYPE_3 3 |
1333 | #define EEPROM_NIC_TYPE_HP 4 | 1575 | #define EEPROM_NIC_TYPE_4 4 |
1334 | 1576 | ||
1335 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 | 1577 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 |
1336 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) | 1578 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) |
1337 | 1579 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) | |
1338 | #define EEPROM_BIT_SK (1<<0) | 1580 | #define EEPROM_BIT_SK (1<<0) |
1339 | #define EEPROM_BIT_CS (1<<1) | 1581 | #define EEPROM_BIT_CS (1<<1) |
1340 | #define EEPROM_BIT_DI (1<<2) | 1582 | #define EEPROM_BIT_DI (1<<2) |
@@ -1343,50 +1585,47 @@ do { if (ipw_debug_level & (level)) \ | |||
1343 | #define EEPROM_CMD_READ 0x2 | 1585 | #define EEPROM_CMD_READ 0x2 |
1344 | 1586 | ||
1345 | /* Interrupts masks */ | 1587 | /* Interrupts masks */ |
1346 | #define CX2_INTA_NONE 0x00000000 | 1588 | #define IPW_INTA_NONE 0x00000000 |
1347 | 1589 | ||
1348 | #define CX2_INTA_BIT_RX_TRANSFER 0x00000002 | 1590 | #define IPW_INTA_BIT_RX_TRANSFER 0x00000002 |
1349 | #define CX2_INTA_BIT_STATUS_CHANGE 0x00000010 | 1591 | #define IPW_INTA_BIT_STATUS_CHANGE 0x00000010 |
1350 | #define CX2_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 | 1592 | #define IPW_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 |
1351 | 1593 | ||
1352 | //Inta Bits for CF | 1594 | //Inta Bits for CF |
1353 | #define CX2_INTA_BIT_TX_CMD_QUEUE 0x00000800 | 1595 | #define IPW_INTA_BIT_TX_CMD_QUEUE 0x00000800 |
1354 | #define CX2_INTA_BIT_TX_QUEUE_1 0x00001000 | 1596 | #define IPW_INTA_BIT_TX_QUEUE_1 0x00001000 |
1355 | #define CX2_INTA_BIT_TX_QUEUE_2 0x00002000 | 1597 | #define IPW_INTA_BIT_TX_QUEUE_2 0x00002000 |
1356 | #define CX2_INTA_BIT_TX_QUEUE_3 0x00004000 | 1598 | #define IPW_INTA_BIT_TX_QUEUE_3 0x00004000 |
1357 | #define CX2_INTA_BIT_TX_QUEUE_4 0x00008000 | 1599 | #define IPW_INTA_BIT_TX_QUEUE_4 0x00008000 |
1358 | 1600 | ||
1359 | #define CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 | 1601 | #define IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 |
1360 | 1602 | ||
1361 | #define CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 | 1603 | #define IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 |
1362 | #define CX2_INTA_BIT_POWER_DOWN 0x00200000 | 1604 | #define IPW_INTA_BIT_POWER_DOWN 0x00200000 |
1363 | 1605 | ||
1364 | #define CX2_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 | 1606 | #define IPW_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 |
1365 | #define CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 | 1607 | #define IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 |
1366 | #define CX2_INTA_BIT_RF_KILL_DONE 0x04000000 | 1608 | #define IPW_INTA_BIT_RF_KILL_DONE 0x04000000 |
1367 | #define CX2_INTA_BIT_FATAL_ERROR 0x40000000 | 1609 | #define IPW_INTA_BIT_FATAL_ERROR 0x40000000 |
1368 | #define CX2_INTA_BIT_PARITY_ERROR 0x80000000 | 1610 | #define IPW_INTA_BIT_PARITY_ERROR 0x80000000 |
1369 | 1611 | ||
1370 | /* Interrupts enabled at init time. */ | 1612 | /* Interrupts enabled at init time. */ |
1371 | #define CX2_INTA_MASK_ALL \ | 1613 | #define IPW_INTA_MASK_ALL \ |
1372 | (CX2_INTA_BIT_TX_QUEUE_1 | \ | 1614 | (IPW_INTA_BIT_TX_QUEUE_1 | \ |
1373 | CX2_INTA_BIT_TX_QUEUE_2 | \ | 1615 | IPW_INTA_BIT_TX_QUEUE_2 | \ |
1374 | CX2_INTA_BIT_TX_QUEUE_3 | \ | 1616 | IPW_INTA_BIT_TX_QUEUE_3 | \ |
1375 | CX2_INTA_BIT_TX_QUEUE_4 | \ | 1617 | IPW_INTA_BIT_TX_QUEUE_4 | \ |
1376 | CX2_INTA_BIT_TX_CMD_QUEUE | \ | 1618 | IPW_INTA_BIT_TX_CMD_QUEUE | \ |
1377 | CX2_INTA_BIT_RX_TRANSFER | \ | 1619 | IPW_INTA_BIT_RX_TRANSFER | \ |
1378 | CX2_INTA_BIT_FATAL_ERROR | \ | 1620 | IPW_INTA_BIT_FATAL_ERROR | \ |
1379 | CX2_INTA_BIT_PARITY_ERROR | \ | 1621 | IPW_INTA_BIT_PARITY_ERROR | \ |
1380 | CX2_INTA_BIT_STATUS_CHANGE | \ | 1622 | IPW_INTA_BIT_STATUS_CHANGE | \ |
1381 | CX2_INTA_BIT_FW_INITIALIZATION_DONE | \ | 1623 | IPW_INTA_BIT_FW_INITIALIZATION_DONE | \ |
1382 | CX2_INTA_BIT_BEACON_PERIOD_EXPIRED | \ | 1624 | IPW_INTA_BIT_BEACON_PERIOD_EXPIRED | \ |
1383 | CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ | 1625 | IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ |
1384 | CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ | 1626 | IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ |
1385 | CX2_INTA_BIT_POWER_DOWN | \ | 1627 | IPW_INTA_BIT_POWER_DOWN | \ |
1386 | CX2_INTA_BIT_RF_KILL_DONE ) | 1628 | IPW_INTA_BIT_RF_KILL_DONE ) |
1387 | |||
1388 | #define IPWSTATUS_ERROR_LOG (CX2_SHARED_LOWER_BOUND + 0x410) | ||
1389 | #define IPW_EVENT_LOG (CX2_SHARED_LOWER_BOUND + 0x414) | ||
1390 | 1629 | ||
1391 | /* FW event log definitions */ | 1630 | /* FW event log definitions */ |
1392 | #define EVENT_ELEM_SIZE (3 * sizeof(u32)) | 1631 | #define EVENT_ELEM_SIZE (3 * sizeof(u32)) |
@@ -1396,6 +1635,11 @@ do { if (ipw_debug_level & (level)) \ | |||
1396 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | 1635 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
1397 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 1636 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
1398 | 1637 | ||
1638 | /* TX power level (dbm) */ | ||
1639 | #define IPW_TX_POWER_MIN -12 | ||
1640 | #define IPW_TX_POWER_MAX 20 | ||
1641 | #define IPW_TX_POWER_DEFAULT IPW_TX_POWER_MAX | ||
1642 | |||
1399 | enum { | 1643 | enum { |
1400 | IPW_FW_ERROR_OK = 0, | 1644 | IPW_FW_ERROR_OK = 0, |
1401 | IPW_FW_ERROR_FAIL, | 1645 | IPW_FW_ERROR_FAIL, |
@@ -1408,8 +1652,8 @@ enum { | |||
1408 | IPW_FW_ERROR_ALLOC_FAIL, | 1652 | IPW_FW_ERROR_ALLOC_FAIL, |
1409 | IPW_FW_ERROR_DMA_UNDERRUN, | 1653 | IPW_FW_ERROR_DMA_UNDERRUN, |
1410 | IPW_FW_ERROR_DMA_STATUS, | 1654 | IPW_FW_ERROR_DMA_STATUS, |
1411 | IPW_FW_ERROR_DINOSTATUS_ERROR, | 1655 | IPW_FW_ERROR_DINO_ERROR, |
1412 | IPW_FW_ERROR_EEPROMSTATUS_ERROR, | 1656 | IPW_FW_ERROR_EEPROM_ERROR, |
1413 | IPW_FW_ERROR_SYSASSERT, | 1657 | IPW_FW_ERROR_SYSASSERT, |
1414 | IPW_FW_ERROR_FATAL_ERROR | 1658 | IPW_FW_ERROR_FATAL_ERROR |
1415 | }; | 1659 | }; |
@@ -1425,6 +1669,8 @@ enum { | |||
1425 | #define HC_IBSS_RECONF 4 | 1669 | #define HC_IBSS_RECONF 4 |
1426 | #define HC_DISASSOC_QUIET 5 | 1670 | #define HC_DISASSOC_QUIET 5 |
1427 | 1671 | ||
1672 | #define HC_QOS_SUPPORT_ASSOC 0x01 | ||
1673 | |||
1428 | #define IPW_RATE_CAPABILITIES 1 | 1674 | #define IPW_RATE_CAPABILITIES 1 |
1429 | #define IPW_RATE_CONNECT 0 | 1675 | #define IPW_RATE_CONNECT 0 |
1430 | 1676 | ||
@@ -1595,18 +1841,20 @@ enum { | |||
1595 | IPW_ORD_TABLE_7_LAST | 1841 | IPW_ORD_TABLE_7_LAST |
1596 | }; | 1842 | }; |
1597 | 1843 | ||
1598 | #define IPW_ORDINALS_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0x500) | 1844 | #define IPW_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) |
1599 | #define IPW_ORDINALS_TABLE_0 (CX2_SHARED_LOWER_BOUND + 0x180) | 1845 | #define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414) |
1600 | #define IPW_ORDINALS_TABLE_1 (CX2_SHARED_LOWER_BOUND + 0x184) | 1846 | #define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500) |
1601 | #define IPW_ORDINALS_TABLE_2 (CX2_SHARED_LOWER_BOUND + 0x188) | 1847 | #define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180) |
1602 | #define IPW_MEM_FIXED_OVERRIDE (CX2_SHARED_LOWER_BOUND + 0x41C) | 1848 | #define IPW_ORDINALS_TABLE_1 (IPW_SHARED_LOWER_BOUND + 0x184) |
1849 | #define IPW_ORDINALS_TABLE_2 (IPW_SHARED_LOWER_BOUND + 0x188) | ||
1850 | #define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C) | ||
1603 | 1851 | ||
1604 | struct ipw_fixed_rate { | 1852 | struct ipw_fixed_rate { |
1605 | u16 tx_rates; | 1853 | u16 tx_rates; |
1606 | u16 reserved; | 1854 | u16 reserved; |
1607 | } __attribute__ ((packed)); | 1855 | } __attribute__ ((packed)); |
1608 | 1856 | ||
1609 | #define CX2_INDIRECT_ADDR_MASK (~0x3ul) | 1857 | #define IPW_INDIRECT_ADDR_MASK (~0x3ul) |
1610 | 1858 | ||
1611 | struct host_cmd { | 1859 | struct host_cmd { |
1612 | u8 cmd; | 1860 | u8 cmd; |
@@ -1615,6 +1863,12 @@ struct host_cmd { | |||
1615 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; | 1863 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; |
1616 | } __attribute__ ((packed)); | 1864 | } __attribute__ ((packed)); |
1617 | 1865 | ||
1866 | struct ipw_cmd_log { | ||
1867 | unsigned long jiffies; | ||
1868 | int retcode; | ||
1869 | struct host_cmd cmd; | ||
1870 | }; | ||
1871 | |||
1618 | #define CFG_BT_COEXISTENCE_MIN 0x00 | 1872 | #define CFG_BT_COEXISTENCE_MIN 0x00 |
1619 | #define CFG_BT_COEXISTENCE_DEFER 0x02 | 1873 | #define CFG_BT_COEXISTENCE_DEFER 0x02 |
1620 | #define CFG_BT_COEXISTENCE_KILL 0x04 | 1874 | #define CFG_BT_COEXISTENCE_KILL 0x04 |
@@ -1643,15 +1897,6 @@ struct host_cmd { | |||
1643 | #define REG_CHANNEL_MASK 0x00003FFF | 1897 | #define REG_CHANNEL_MASK 0x00003FFF |
1644 | #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff | 1898 | #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff |
1645 | 1899 | ||
1646 | static const long ipw_frequencies[] = { | ||
1647 | 2412, 2417, 2422, 2427, | ||
1648 | 2432, 2437, 2442, 2447, | ||
1649 | 2452, 2457, 2462, 2467, | ||
1650 | 2472, 2484 | ||
1651 | }; | ||
1652 | |||
1653 | #define FREQ_COUNT ARRAY_SIZE(ipw_frequencies) | ||
1654 | |||
1655 | #define IPW_MAX_CONFIG_RETRIES 10 | 1900 | #define IPW_MAX_CONFIG_RETRIES 10 |
1656 | 1901 | ||
1657 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) | 1902 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) |
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 7a17bb31fc89..f5d856db92a1 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | #include <linux/wireless.h> | 13 | #include <linux/wireless.h> |
14 | #include <net/iw_handler.h> | 14 | #include <net/iw_handler.h> |
15 | #include <linux/version.h> | ||
16 | 15 | ||
17 | #include "hermes.h" | 16 | #include "hermes.h" |
18 | 17 | ||
diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index adc7499136dc..109a96d90007 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/version.h> | ||
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/types.h> | 22 | #include <linux/types.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
@@ -112,9 +111,10 @@ isl38xx_handle_wakeup(isl38xx_control_block *control_block, | |||
112 | void | 111 | void |
113 | isl38xx_trigger_device(int asleep, void __iomem *device_base) | 112 | isl38xx_trigger_device(int asleep, void __iomem *device_base) |
114 | { | 113 | { |
115 | u32 reg, counter = 0; | 114 | u32 reg; |
116 | 115 | ||
117 | #if VERBOSE > SHOW_ERROR_MESSAGES | 116 | #if VERBOSE > SHOW_ERROR_MESSAGES |
117 | u32 counter = 0; | ||
118 | struct timeval current_time; | 118 | struct timeval current_time; |
119 | DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); | 119 | DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); |
120 | #endif | 120 | #endif |
@@ -131,7 +131,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
131 | current_time.tv_sec, (long)current_time.tv_usec, | 131 | current_time.tv_sec, (long)current_time.tv_usec, |
132 | readl(device_base + ISL38XX_CTRL_STAT_REG)); | 132 | readl(device_base + ISL38XX_CTRL_STAT_REG)); |
133 | #endif | 133 | #endif |
134 | udelay(ISL38XX_WRITEIO_DELAY); | ||
135 | 134 | ||
136 | reg = readl(device_base + ISL38XX_INT_IDENT_REG); | 135 | reg = readl(device_base + ISL38XX_INT_IDENT_REG); |
137 | if (reg == 0xabadface) { | 136 | if (reg == 0xabadface) { |
@@ -145,7 +144,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
145 | while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), | 144 | while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), |
146 | (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { | 145 | (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { |
147 | udelay(ISL38XX_WRITEIO_DELAY); | 146 | udelay(ISL38XX_WRITEIO_DELAY); |
147 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
148 | counter++; | 148 | counter++; |
149 | #endif | ||
149 | } | 150 | } |
150 | 151 | ||
151 | #if VERBOSE > SHOW_ERROR_MESSAGES | 152 | #if VERBOSE > SHOW_ERROR_MESSAGES |
@@ -153,10 +154,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
153 | "%08li.%08li Device register read %08x\n", | 154 | "%08li.%08li Device register read %08x\n", |
154 | current_time.tv_sec, (long)current_time.tv_usec, | 155 | current_time.tv_sec, (long)current_time.tv_usec, |
155 | readl(device_base + ISL38XX_CTRL_STAT_REG)); | 156 | readl(device_base + ISL38XX_CTRL_STAT_REG)); |
156 | #endif | ||
157 | udelay(ISL38XX_WRITEIO_DELAY); | ||
158 | |||
159 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
160 | do_gettimeofday(¤t_time); | 157 | do_gettimeofday(¤t_time); |
161 | DEBUG(SHOW_TRACING, | 158 | DEBUG(SHOW_TRACING, |
162 | "%08li.%08li Device asleep counter %i\n", | 159 | "%08li.%08li Device asleep counter %i\n", |
@@ -171,7 +168,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
171 | 168 | ||
172 | /* perform another read on the Device Status Register */ | 169 | /* perform another read on the Device Status Register */ |
173 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); | 170 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); |
174 | udelay(ISL38XX_WRITEIO_DELAY); | ||
175 | 171 | ||
176 | #if VERBOSE > SHOW_ERROR_MESSAGES | 172 | #if VERBOSE > SHOW_ERROR_MESSAGES |
177 | do_gettimeofday(¤t_time); | 173 | do_gettimeofday(¤t_time); |
@@ -187,7 +183,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
187 | 183 | ||
188 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, | 184 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, |
189 | ISL38XX_DEV_INT_REG); | 185 | ISL38XX_DEV_INT_REG); |
190 | udelay(ISL38XX_WRITEIO_DELAY); | ||
191 | } | 186 | } |
192 | } | 187 | } |
193 | 188 | ||
diff --git a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h index e83e4912ab66..8af20980af8d 100644 --- a/drivers/net/wireless/prism54/isl_38xx.h +++ b/drivers/net/wireless/prism54/isl_38xx.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #ifndef _ISL_38XX_H | 20 | #ifndef _ISL_38XX_H |
21 | #define _ISL_38XX_H | 21 | #define _ISL_38XX_H |
22 | 22 | ||
23 | #include <linux/version.h> | ||
24 | #include <asm/io.h> | 23 | #include <asm/io.h> |
25 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
26 | 25 | ||
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 5c1a1adf1ff8..135a156db25d 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
26 | #include <linux/if_arp.h> | 25 | #include <linux/if_arp.h> |
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 78bdb359835e..5ddf29599032 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/version.h> | ||
23 | #include <linux/module.h> | 22 | #include <linux/module.h> |
24 | 23 | ||
25 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index efbed4397951..07053165e4c5 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #ifndef _ISLPCI_DEV_H | 23 | #ifndef _ISLPCI_DEV_H |
24 | #define _ISLPCI_DEV_H | 24 | #define _ISLPCI_DEV_H |
25 | 25 | ||
26 | #include <linux/version.h> | ||
27 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
28 | #include <linux/wireless.h> | 27 | #include <linux/wireless.h> |
29 | #include <net/iw_handler.h> | 28 | #include <net/iw_handler.h> |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index fc1eb3564832..33d64d2ee53f 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/version.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | 21 | ||
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
@@ -227,17 +226,17 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
227 | priv->data_low_tx_full = 1; | 226 | priv->data_low_tx_full = 1; |
228 | } | 227 | } |
229 | 228 | ||
229 | /* set the transmission time */ | ||
230 | ndev->trans_start = jiffies; | ||
231 | priv->statistics.tx_packets++; | ||
232 | priv->statistics.tx_bytes += skb->len; | ||
233 | |||
230 | /* trigger the device */ | 234 | /* trigger the device */ |
231 | islpci_trigger(priv); | 235 | islpci_trigger(priv); |
232 | 236 | ||
233 | /* unlock the driver code */ | 237 | /* unlock the driver code */ |
234 | spin_unlock_irqrestore(&priv->slock, flags); | 238 | spin_unlock_irqrestore(&priv->slock, flags); |
235 | 239 | ||
236 | /* set the transmission time */ | ||
237 | ndev->trans_start = jiffies; | ||
238 | priv->statistics.tx_packets++; | ||
239 | priv->statistics.tx_bytes += skb->len; | ||
240 | |||
241 | return 0; | 240 | return 0; |
242 | 241 | ||
243 | drop_free: | 242 | drop_free: |
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index dc040caab7d7..b41d666fea3c 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/version.h> | ||
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 4b3c98f5c564..c822cad3333f 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4608,9 +4608,8 @@ wavelan_attach(void) | |||
4608 | #endif | 4608 | #endif |
4609 | 4609 | ||
4610 | /* Initialize the dev_link_t structure */ | 4610 | /* Initialize the dev_link_t structure */ |
4611 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 4611 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
4612 | if (!link) return NULL; | 4612 | if (!link) return NULL; |
4613 | memset(link, 0, sizeof(struct dev_link_t)); | ||
4614 | 4613 | ||
4615 | /* The io structure describes IO port mapping */ | 4614 | /* The io structure describes IO port mapping */ |
4616 | link->io.NumPorts1 = 8; | 4615 | link->io.NumPorts1 = 8; |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3f8c27f0871b..978fdc606781 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void) | |||
1965 | int ret; | 1965 | int ret; |
1966 | 1966 | ||
1967 | /* Initialize the dev_link_t structure */ | 1967 | /* Initialize the dev_link_t structure */ |
1968 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 1968 | link = kzalloc(sizeof(*link), GFP_KERNEL); |
1969 | if (!link) | 1969 | if (!link) |
1970 | goto out; | 1970 | goto out; |
1971 | memset(link, 0, sizeof(struct dev_link_t)); | ||
1972 | 1971 | ||
1973 | /* The io structure describes IO port mapping */ | 1972 | /* The io structure describes IO port mapping */ |
1974 | link->io.NumPorts1 = 16; | 1973 | link->io.NumPorts1 = 16; |