diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 19:25:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 19:25:49 -0500 |
commit | aca361c1a0dc0165ac3148137983cb4b1458b5c1 (patch) | |
tree | 3527ff422fe90e97657d5996499fa4a9d30e2d5a /drivers | |
parent | cec6062037783a762aa5606b06b8bc5c14d9657f (diff) | |
parent | 9b7c84899ea6bfc4f8932a83b28db313e7397bd1 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (45 commits)
[PATCH] Restore channel setting after scan.
[PATCH] hostap: Fix memory leak on PCI probe error path
[PATCH] hostap: Remove dead code (duplicated idx != 0)
[PATCH] hostap: Fix unlikely read overrun in CIS parsing
[PATCH] hostap: Fix double free in prism2_config() error path
[PATCH] hostap: Fix ap_add_sta() return value verification
[PATCH] hostap: Fix hw reset after CMDCODE_ACCESS_WRITE timeout
[PATCH] wireless/airo: cache wireless scans
[PATCH] wireless/airo: define default MTU
[PATCH] wireless/airo: clean up printk usage to print device name
[PATCH] WE-20 for kernel 2.6.16
[PATCH] softmac: remove function_enter()
[PATCH] skge: version 1.5
[PATCH] skge: compute available ring buffers
[PATCH] skge: dont free skb until multi-part transmit complete
[PATCH] skge: multicast statistics fix
[PATCH] skge: rx_reuse called twice
[PATCH] skge: dont use dev_alloc_skb for rx buffs
[PATCH] skge: align receive buffers
[PATCH] sky2: dont need to use dev_kfree_skb_any
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/skge.c | 105 | ||||
-rw-r--r-- | drivers/net/skge.h | 1 | ||||
-rw-r--r-- | drivers/net/sky2.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/Kconfig | 9 | ||||
-rw-r--r-- | drivers/net/wireless/airo.c | 455 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_hw.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_pci.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_plx.c | 13 |
11 files changed, 376 insertions, 235 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 4eda81d41b10..35dbf05c7f06 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "skge.h" | 44 | #include "skge.h" |
45 | 45 | ||
46 | #define DRV_NAME "skge" | 46 | #define DRV_NAME "skge" |
47 | #define DRV_VERSION "1.4" | 47 | #define DRV_VERSION "1.5" |
48 | #define PFX DRV_NAME " " | 48 | #define PFX DRV_NAME " " |
49 | 49 | ||
50 | #define DEFAULT_TX_RING_SIZE 128 | 50 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -357,7 +357,7 @@ static struct net_device_stats *skge_get_stats(struct net_device *dev) | |||
357 | skge->net_stats.rx_bytes = data[1]; | 357 | skge->net_stats.rx_bytes = data[1]; |
358 | skge->net_stats.tx_packets = data[2] + data[4] + data[6]; | 358 | skge->net_stats.tx_packets = data[2] + data[4] + data[6]; |
359 | skge->net_stats.rx_packets = data[3] + data[5] + data[7]; | 359 | skge->net_stats.rx_packets = data[3] + data[5] + data[7]; |
360 | skge->net_stats.multicast = data[5] + data[7]; | 360 | skge->net_stats.multicast = data[3] + data[5]; |
361 | skge->net_stats.collisions = data[10]; | 361 | skge->net_stats.collisions = data[10]; |
362 | skge->net_stats.tx_aborted_errors = data[12]; | 362 | skge->net_stats.tx_aborted_errors = data[12]; |
363 | 363 | ||
@@ -781,7 +781,7 @@ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | |||
781 | * Note: DMA address is not changed by chip. | 781 | * Note: DMA address is not changed by chip. |
782 | * MTU not changed while receiver active. | 782 | * MTU not changed while receiver active. |
783 | */ | 783 | */ |
784 | static void skge_rx_reuse(struct skge_element *e, unsigned int size) | 784 | static inline void skge_rx_reuse(struct skge_element *e, unsigned int size) |
785 | { | 785 | { |
786 | struct skge_rx_desc *rd = e->desc; | 786 | struct skge_rx_desc *rd = e->desc; |
787 | 787 | ||
@@ -829,7 +829,7 @@ static int skge_rx_fill(struct skge_port *skge) | |||
829 | do { | 829 | do { |
830 | struct sk_buff *skb; | 830 | struct sk_buff *skb; |
831 | 831 | ||
832 | skb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); | 832 | skb = alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, GFP_KERNEL); |
833 | if (!skb) | 833 | if (!skb) |
834 | return -ENOMEM; | 834 | return -ENOMEM; |
835 | 835 | ||
@@ -847,8 +847,7 @@ static void skge_link_up(struct skge_port *skge) | |||
847 | LED_BLK_OFF|LED_SYNC_OFF|LED_ON); | 847 | LED_BLK_OFF|LED_SYNC_OFF|LED_ON); |
848 | 848 | ||
849 | netif_carrier_on(skge->netdev); | 849 | netif_carrier_on(skge->netdev); |
850 | if (skge->tx_avail > MAX_SKB_FRAGS + 1) | 850 | netif_wake_queue(skge->netdev); |
851 | netif_wake_queue(skge->netdev); | ||
852 | 851 | ||
853 | if (netif_msg_link(skge)) | 852 | if (netif_msg_link(skge)) |
854 | printk(KERN_INFO PFX | 853 | printk(KERN_INFO PFX |
@@ -2155,7 +2154,7 @@ static int skge_up(struct net_device *dev) | |||
2155 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); | 2154 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); |
2156 | 2155 | ||
2157 | if (dev->mtu > RX_BUF_SIZE) | 2156 | if (dev->mtu > RX_BUF_SIZE) |
2158 | skge->rx_buf_size = dev->mtu + ETH_HLEN + NET_IP_ALIGN; | 2157 | skge->rx_buf_size = dev->mtu + ETH_HLEN; |
2159 | else | 2158 | else |
2160 | skge->rx_buf_size = RX_BUF_SIZE; | 2159 | skge->rx_buf_size = RX_BUF_SIZE; |
2161 | 2160 | ||
@@ -2190,8 +2189,6 @@ static int skge_up(struct net_device *dev) | |||
2190 | if (err) | 2189 | if (err) |
2191 | goto free_rx_ring; | 2190 | goto free_rx_ring; |
2192 | 2191 | ||
2193 | skge->tx_avail = skge->tx_ring.count - 1; | ||
2194 | |||
2195 | /* Initialize MAC */ | 2192 | /* Initialize MAC */ |
2196 | spin_lock_bh(&hw->phy_lock); | 2193 | spin_lock_bh(&hw->phy_lock); |
2197 | if (hw->chip_id == CHIP_ID_GENESIS) | 2194 | if (hw->chip_id == CHIP_ID_GENESIS) |
@@ -2294,6 +2291,12 @@ static int skge_down(struct net_device *dev) | |||
2294 | return 0; | 2291 | return 0; |
2295 | } | 2292 | } |
2296 | 2293 | ||
2294 | static inline int skge_avail(const struct skge_ring *ring) | ||
2295 | { | ||
2296 | return ((ring->to_clean > ring->to_use) ? 0 : ring->count) | ||
2297 | + (ring->to_clean - ring->to_use) - 1; | ||
2298 | } | ||
2299 | |||
2297 | static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | 2300 | static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) |
2298 | { | 2301 | { |
2299 | struct skge_port *skge = netdev_priv(dev); | 2302 | struct skge_port *skge = netdev_priv(dev); |
@@ -2314,7 +2317,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2314 | return NETDEV_TX_LOCKED; | 2317 | return NETDEV_TX_LOCKED; |
2315 | } | 2318 | } |
2316 | 2319 | ||
2317 | if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { | 2320 | if (unlikely(skge_avail(&skge->tx_ring) < skb_shinfo(skb)->nr_frags + 1)) { |
2318 | if (!netif_queue_stopped(dev)) { | 2321 | if (!netif_queue_stopped(dev)) { |
2319 | netif_stop_queue(dev); | 2322 | netif_stop_queue(dev); |
2320 | 2323 | ||
@@ -2390,8 +2393,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2390 | dev->name, e - ring->start, skb->len); | 2393 | dev->name, e - ring->start, skb->len); |
2391 | 2394 | ||
2392 | ring->to_use = e->next; | 2395 | ring->to_use = e->next; |
2393 | skge->tx_avail -= skb_shinfo(skb)->nr_frags + 1; | 2396 | if (skge_avail(&skge->tx_ring) <= MAX_SKB_FRAGS + 1) { |
2394 | if (skge->tx_avail <= MAX_SKB_FRAGS + 1) { | ||
2395 | pr_debug("%s: transmit queue full\n", dev->name); | 2397 | pr_debug("%s: transmit queue full\n", dev->name); |
2396 | netif_stop_queue(dev); | 2398 | netif_stop_queue(dev); |
2397 | } | 2399 | } |
@@ -2404,35 +2406,37 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2404 | return NETDEV_TX_OK; | 2406 | return NETDEV_TX_OK; |
2405 | } | 2407 | } |
2406 | 2408 | ||
2407 | static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e) | 2409 | static void skge_tx_complete(struct skge_port *skge, struct skge_element *last) |
2408 | { | 2410 | { |
2409 | /* This ring element can be skb or fragment */ | 2411 | struct pci_dev *pdev = skge->hw->pdev; |
2410 | if (e->skb) { | 2412 | struct skge_element *e; |
2411 | pci_unmap_single(hw->pdev, | 2413 | |
2412 | pci_unmap_addr(e, mapaddr), | 2414 | for (e = skge->tx_ring.to_clean; e != last; e = e->next) { |
2413 | pci_unmap_len(e, maplen), | 2415 | struct sk_buff *skb = e->skb; |
2414 | PCI_DMA_TODEVICE); | 2416 | int i; |
2415 | dev_kfree_skb(e->skb); | 2417 | |
2416 | e->skb = NULL; | 2418 | e->skb = NULL; |
2417 | } else { | 2419 | pci_unmap_single(pdev, pci_unmap_addr(e, mapaddr), |
2418 | pci_unmap_page(hw->pdev, | 2420 | skb_headlen(skb), PCI_DMA_TODEVICE); |
2419 | pci_unmap_addr(e, mapaddr), | 2421 | |
2420 | pci_unmap_len(e, maplen), | 2422 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2421 | PCI_DMA_TODEVICE); | 2423 | e = e->next; |
2424 | pci_unmap_page(pdev, pci_unmap_addr(e, mapaddr), | ||
2425 | skb_shinfo(skb)->frags[i].size, | ||
2426 | PCI_DMA_TODEVICE); | ||
2427 | } | ||
2428 | |||
2429 | dev_kfree_skb(skb); | ||
2422 | } | 2430 | } |
2431 | skge->tx_ring.to_clean = e; | ||
2423 | } | 2432 | } |
2424 | 2433 | ||
2425 | static void skge_tx_clean(struct skge_port *skge) | 2434 | static void skge_tx_clean(struct skge_port *skge) |
2426 | { | 2435 | { |
2427 | struct skge_ring *ring = &skge->tx_ring; | ||
2428 | struct skge_element *e; | ||
2429 | 2436 | ||
2430 | spin_lock_bh(&skge->tx_lock); | 2437 | spin_lock_bh(&skge->tx_lock); |
2431 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { | 2438 | skge_tx_complete(skge, skge->tx_ring.to_use); |
2432 | ++skge->tx_avail; | 2439 | netif_wake_queue(skge->netdev); |
2433 | skge_tx_free(skge->hw, e); | ||
2434 | } | ||
2435 | ring->to_clean = e; | ||
2436 | spin_unlock_bh(&skge->tx_lock); | 2440 | spin_unlock_bh(&skge->tx_lock); |
2437 | } | 2441 | } |
2438 | 2442 | ||
@@ -2592,7 +2596,7 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge, | |||
2592 | goto error; | 2596 | goto error; |
2593 | 2597 | ||
2594 | if (len < RX_COPY_THRESHOLD) { | 2598 | if (len < RX_COPY_THRESHOLD) { |
2595 | skb = dev_alloc_skb(len + 2); | 2599 | skb = alloc_skb(len + 2, GFP_ATOMIC); |
2596 | if (!skb) | 2600 | if (!skb) |
2597 | goto resubmit; | 2601 | goto resubmit; |
2598 | 2602 | ||
@@ -2607,10 +2611,11 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge, | |||
2607 | skge_rx_reuse(e, skge->rx_buf_size); | 2611 | skge_rx_reuse(e, skge->rx_buf_size); |
2608 | } else { | 2612 | } else { |
2609 | struct sk_buff *nskb; | 2613 | struct sk_buff *nskb; |
2610 | nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); | 2614 | nskb = alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, GFP_ATOMIC); |
2611 | if (!nskb) | 2615 | if (!nskb) |
2612 | goto resubmit; | 2616 | goto resubmit; |
2613 | 2617 | ||
2618 | skb_reserve(nskb, NET_IP_ALIGN); | ||
2614 | pci_unmap_single(skge->hw->pdev, | 2619 | pci_unmap_single(skge->hw->pdev, |
2615 | pci_unmap_addr(e, mapaddr), | 2620 | pci_unmap_addr(e, mapaddr), |
2616 | pci_unmap_len(e, maplen), | 2621 | pci_unmap_len(e, maplen), |
@@ -2661,30 +2666,29 @@ resubmit: | |||
2661 | static void skge_tx_done(struct skge_port *skge) | 2666 | static void skge_tx_done(struct skge_port *skge) |
2662 | { | 2667 | { |
2663 | struct skge_ring *ring = &skge->tx_ring; | 2668 | struct skge_ring *ring = &skge->tx_ring; |
2664 | struct skge_element *e; | 2669 | struct skge_element *e, *last; |
2665 | 2670 | ||
2666 | spin_lock(&skge->tx_lock); | 2671 | spin_lock(&skge->tx_lock); |
2667 | for (e = ring->to_clean; prefetch(e->next), e != ring->to_use; e = e->next) { | 2672 | last = ring->to_clean; |
2673 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { | ||
2668 | struct skge_tx_desc *td = e->desc; | 2674 | struct skge_tx_desc *td = e->desc; |
2669 | u32 control; | ||
2670 | 2675 | ||
2671 | rmb(); | 2676 | if (td->control & BMU_OWN) |
2672 | control = td->control; | ||
2673 | if (control & BMU_OWN) | ||
2674 | break; | 2677 | break; |
2675 | 2678 | ||
2676 | if (unlikely(netif_msg_tx_done(skge))) | 2679 | if (td->control & BMU_EOF) { |
2677 | printk(KERN_DEBUG PFX "%s: tx done slot %td status 0x%x\n", | 2680 | last = e->next; |
2678 | skge->netdev->name, e - ring->start, td->status); | 2681 | if (unlikely(netif_msg_tx_done(skge))) |
2679 | 2682 | printk(KERN_DEBUG PFX "%s: tx done slot %td\n", | |
2680 | skge_tx_free(skge->hw, e); | 2683 | skge->netdev->name, e - ring->start); |
2681 | e->skb = NULL; | 2684 | } |
2682 | ++skge->tx_avail; | ||
2683 | } | 2685 | } |
2684 | ring->to_clean = e; | 2686 | |
2687 | skge_tx_complete(skge, last); | ||
2688 | |||
2685 | skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); | 2689 | skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); |
2686 | 2690 | ||
2687 | if (skge->tx_avail > MAX_SKB_FRAGS + 1) | 2691 | if (skge_avail(&skge->tx_ring) > MAX_SKB_FRAGS + 1) |
2688 | netif_wake_queue(skge->netdev); | 2692 | netif_wake_queue(skge->netdev); |
2689 | 2693 | ||
2690 | spin_unlock(&skge->tx_lock); | 2694 | spin_unlock(&skge->tx_lock); |
@@ -2718,8 +2722,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2718 | netif_receive_skb(skb); | 2722 | netif_receive_skb(skb); |
2719 | 2723 | ||
2720 | ++work_done; | 2724 | ++work_done; |
2721 | } else | 2725 | } |
2722 | skge_rx_reuse(e, skge->rx_buf_size); | ||
2723 | } | 2726 | } |
2724 | ring->to_clean = e; | 2727 | ring->to_clean = e; |
2725 | 2728 | ||
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 2efdacc290e5..1f1ce88c8186 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -2418,7 +2418,6 @@ struct skge_port { | |||
2418 | int port; | 2418 | int port; |
2419 | 2419 | ||
2420 | spinlock_t tx_lock; | 2420 | spinlock_t tx_lock; |
2421 | u32 tx_avail; | ||
2422 | struct skge_ring tx_ring; | 2421 | struct skge_ring tx_ring; |
2423 | struct skge_ring rx_ring; | 2422 | struct skge_ring rx_ring; |
2424 | 2423 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 36db93811ac7..68f9c206a620 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1175,7 +1175,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1175 | /* just drop the packet if non-linear expansion fails */ | 1175 | /* just drop the packet if non-linear expansion fails */ |
1176 | if (skb_header_cloned(skb) && | 1176 | if (skb_header_cloned(skb) && |
1177 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { | 1177 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { |
1178 | dev_kfree_skb_any(skb); | 1178 | dev_kfree_skb(skb); |
1179 | goto out_unlock; | 1179 | goto out_unlock; |
1180 | } | 1180 | } |
1181 | 1181 | ||
@@ -1324,7 +1324,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1324 | PCI_DMA_TODEVICE); | 1324 | PCI_DMA_TODEVICE); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | dev_kfree_skb_any(skb); | 1327 | dev_kfree_skb(skb); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | sky2->tx_cons = put; | 1330 | sky2->tx_cons = put; |
@@ -2484,7 +2484,7 @@ static const struct sky2_stat { | |||
2484 | { "single_collisions", GM_TXF_SNG_COL }, | 2484 | { "single_collisions", GM_TXF_SNG_COL }, |
2485 | { "multi_collisions", GM_TXF_MUL_COL }, | 2485 | { "multi_collisions", GM_TXF_MUL_COL }, |
2486 | 2486 | ||
2487 | { "rx_short", GM_RXE_SHT }, | 2487 | { "rx_short", GM_RXF_SHT }, |
2488 | { "rx_runt", GM_RXE_FRAG }, | 2488 | { "rx_runt", GM_RXE_FRAG }, |
2489 | { "rx_64_byte_packets", GM_RXF_64B }, | 2489 | { "rx_64_byte_packets", GM_RXF_64B }, |
2490 | { "rx_65_to_127_byte_packets", GM_RXF_127B }, | 2490 | { "rx_65_to_127_byte_packets", GM_RXF_127B }, |
@@ -2607,7 +2607,7 @@ static struct net_device_stats *sky2_get_stats(struct net_device *dev) | |||
2607 | sky2->net_stats.rx_bytes = data[1]; | 2607 | sky2->net_stats.rx_bytes = data[1]; |
2608 | sky2->net_stats.tx_packets = data[2] + data[4] + data[6]; | 2608 | sky2->net_stats.tx_packets = data[2] + data[4] + data[6]; |
2609 | sky2->net_stats.rx_packets = data[3] + data[5] + data[7]; | 2609 | sky2->net_stats.rx_packets = data[3] + data[5] + data[7]; |
2610 | sky2->net_stats.multicast = data[5] + data[7]; | 2610 | sky2->net_stats.multicast = data[3] + data[5]; |
2611 | sky2->net_stats.collisions = data[10]; | 2611 | sky2->net_stats.collisions = data[10]; |
2612 | sky2->net_stats.tx_aborted_errors = data[12]; | 2612 | sky2->net_stats.tx_aborted_errors = data[12]; |
2613 | 2613 | ||
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 5b0a19a5058d..6a1033ec06cf 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -25,6 +25,15 @@ config NET_RADIO | |||
25 | the tools from | 25 | the tools from |
26 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. | 26 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. |
27 | 27 | ||
28 | config NET_WIRELESS_RTNETLINK | ||
29 | bool "Wireless Extension API over RtNetlink" | ||
30 | ---help--- | ||
31 | Support the Wireless Extension API over the RtNetlink socket | ||
32 | in addition to the traditional ioctl interface (selected above). | ||
33 | |||
34 | For now, few tools use this facility, but it might grow in the | ||
35 | future. The only downside is that it adds 4.5 kB to your kernel. | ||
36 | |||
28 | # Note : the cards are obsolete (can't buy them anymore), but the drivers | 37 | # Note : the cards are obsolete (can't buy them anymore), but the drivers |
29 | # are not, as people are still using them... | 38 | # are not, as people are still using them... |
30 | comment "Obsolete Wireless cards support (pre-802.11)" | 39 | comment "Obsolete Wireless cards support (pre-802.11)" |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 864937a409e5..108d9fed8f07 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -770,6 +770,11 @@ typedef struct { | |||
770 | } BSSListRid; | 770 | } BSSListRid; |
771 | 771 | ||
772 | typedef struct { | 772 | typedef struct { |
773 | BSSListRid bss; | ||
774 | struct list_head list; | ||
775 | } BSSListElement; | ||
776 | |||
777 | typedef struct { | ||
773 | u8 rssipct; | 778 | u8 rssipct; |
774 | u8 rssidBm; | 779 | u8 rssidBm; |
775 | } tdsRssiEntry; | 780 | } tdsRssiEntry; |
@@ -902,6 +907,7 @@ static char swversion[] = "2.1"; | |||
902 | #define NUM_MODULES 2 | 907 | #define NUM_MODULES 2 |
903 | #define MIC_MSGLEN_MAX 2400 | 908 | #define MIC_MSGLEN_MAX 2400 |
904 | #define EMMH32_MSGLEN_MAX MIC_MSGLEN_MAX | 909 | #define EMMH32_MSGLEN_MAX MIC_MSGLEN_MAX |
910 | #define AIRO_DEF_MTU 2312 | ||
905 | 911 | ||
906 | typedef struct { | 912 | typedef struct { |
907 | u32 size; // size | 913 | u32 size; // size |
@@ -1119,6 +1125,8 @@ static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket, | |||
1119 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); | 1125 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); |
1120 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); | 1126 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); |
1121 | 1127 | ||
1128 | static void airo_networks_free(struct airo_info *ai); | ||
1129 | |||
1122 | struct airo_info { | 1130 | struct airo_info { |
1123 | struct net_device_stats stats; | 1131 | struct net_device_stats stats; |
1124 | struct net_device *dev; | 1132 | struct net_device *dev; |
@@ -1150,7 +1158,7 @@ struct airo_info { | |||
1150 | #define FLAG_COMMIT 13 | 1158 | #define FLAG_COMMIT 13 |
1151 | #define FLAG_RESET 14 | 1159 | #define FLAG_RESET 14 |
1152 | #define FLAG_FLASHING 15 | 1160 | #define FLAG_FLASHING 15 |
1153 | #define JOB_MASK 0x1ff0000 | 1161 | #define JOB_MASK 0x2ff0000 |
1154 | #define JOB_DIE 16 | 1162 | #define JOB_DIE 16 |
1155 | #define JOB_XMIT 17 | 1163 | #define JOB_XMIT 17 |
1156 | #define JOB_XMIT11 18 | 1164 | #define JOB_XMIT11 18 |
@@ -1160,6 +1168,7 @@ struct airo_info { | |||
1160 | #define JOB_EVENT 22 | 1168 | #define JOB_EVENT 22 |
1161 | #define JOB_AUTOWEP 23 | 1169 | #define JOB_AUTOWEP 23 |
1162 | #define JOB_WSTATS 24 | 1170 | #define JOB_WSTATS 24 |
1171 | #define JOB_SCAN_RESULTS 25 | ||
1163 | int (*bap_read)(struct airo_info*, u16 *pu16Dst, int bytelen, | 1172 | int (*bap_read)(struct airo_info*, u16 *pu16Dst, int bytelen, |
1164 | int whichbap); | 1173 | int whichbap); |
1165 | unsigned short *flash; | 1174 | unsigned short *flash; |
@@ -1176,7 +1185,7 @@ struct airo_info { | |||
1176 | } xmit, xmit11; | 1185 | } xmit, xmit11; |
1177 | struct net_device *wifidev; | 1186 | struct net_device *wifidev; |
1178 | struct iw_statistics wstats; // wireless stats | 1187 | struct iw_statistics wstats; // wireless stats |
1179 | unsigned long scan_timestamp; /* Time started to scan */ | 1188 | unsigned long scan_timeout; /* Time scan should be read */ |
1180 | struct iw_spy_data spy_data; | 1189 | struct iw_spy_data spy_data; |
1181 | struct iw_public_data wireless_data; | 1190 | struct iw_public_data wireless_data; |
1182 | /* MIC stuff */ | 1191 | /* MIC stuff */ |
@@ -1198,6 +1207,10 @@ struct airo_info { | |||
1198 | APListRid *APList; | 1207 | APListRid *APList; |
1199 | #define PCI_SHARED_LEN 2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE | 1208 | #define PCI_SHARED_LEN 2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE |
1200 | char proc_name[IFNAMSIZ]; | 1209 | char proc_name[IFNAMSIZ]; |
1210 | |||
1211 | struct list_head network_list; | ||
1212 | struct list_head network_free_list; | ||
1213 | BSSListElement *networks; | ||
1201 | }; | 1214 | }; |
1202 | 1215 | ||
1203 | static inline int bap_read(struct airo_info *ai, u16 *pu16Dst, int bytelen, | 1216 | static inline int bap_read(struct airo_info *ai, u16 *pu16Dst, int bytelen, |
@@ -1216,6 +1229,22 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime); | |||
1216 | static int flashputbuf(struct airo_info *ai); | 1229 | static int flashputbuf(struct airo_info *ai); |
1217 | static int flashrestart(struct airo_info *ai,struct net_device *dev); | 1230 | static int flashrestart(struct airo_info *ai,struct net_device *dev); |
1218 | 1231 | ||
1232 | #define airo_print(type, name, fmt, args...) \ | ||
1233 | { printk(type "airo(%s): " fmt "\n", name, ##args); } | ||
1234 | |||
1235 | #define airo_print_info(name, fmt, args...) \ | ||
1236 | airo_print(KERN_INFO, name, fmt, ##args) | ||
1237 | |||
1238 | #define airo_print_dbg(name, fmt, args...) \ | ||
1239 | airo_print(KERN_DEBUG, name, fmt, ##args) | ||
1240 | |||
1241 | #define airo_print_warn(name, fmt, args...) \ | ||
1242 | airo_print(KERN_WARNING, name, fmt, ##args) | ||
1243 | |||
1244 | #define airo_print_err(name, fmt, args...) \ | ||
1245 | airo_print(KERN_ERR, name, fmt, ##args) | ||
1246 | |||
1247 | |||
1219 | /*********************************************************************** | 1248 | /*********************************************************************** |
1220 | * MIC ROUTINES * | 1249 | * MIC ROUTINES * |
1221 | *********************************************************************** | 1250 | *********************************************************************** |
@@ -1294,7 +1323,7 @@ static int micsetup(struct airo_info *ai) { | |||
1294 | ai->tfm = crypto_alloc_tfm("aes", CRYPTO_TFM_REQ_MAY_SLEEP); | 1323 | ai->tfm = crypto_alloc_tfm("aes", CRYPTO_TFM_REQ_MAY_SLEEP); |
1295 | 1324 | ||
1296 | if (ai->tfm == NULL) { | 1325 | if (ai->tfm == NULL) { |
1297 | printk(KERN_ERR "airo: failed to load transform for AES\n"); | 1326 | airo_print_err(ai->dev->name, "failed to load transform for AES"); |
1298 | return ERROR; | 1327 | return ERROR; |
1299 | } | 1328 | } |
1300 | 1329 | ||
@@ -1726,11 +1755,11 @@ static int writeWepKeyRid(struct airo_info*ai, WepKeyRid *pwkr, int perm, int lo | |||
1726 | wkr.kindex = cpu_to_le16(wkr.kindex); | 1755 | wkr.kindex = cpu_to_le16(wkr.kindex); |
1727 | wkr.klen = cpu_to_le16(wkr.klen); | 1756 | wkr.klen = cpu_to_le16(wkr.klen); |
1728 | rc = PC4500_writerid(ai, RID_WEP_TEMP, &wkr, sizeof(wkr), lock); | 1757 | rc = PC4500_writerid(ai, RID_WEP_TEMP, &wkr, sizeof(wkr), lock); |
1729 | if (rc!=SUCCESS) printk(KERN_ERR "airo: WEP_TEMP set %x\n", rc); | 1758 | if (rc!=SUCCESS) airo_print_err(ai->dev->name, "WEP_TEMP set %x", rc); |
1730 | if (perm) { | 1759 | if (perm) { |
1731 | rc = PC4500_writerid(ai, RID_WEP_PERM, &wkr, sizeof(wkr), lock); | 1760 | rc = PC4500_writerid(ai, RID_WEP_PERM, &wkr, sizeof(wkr), lock); |
1732 | if (rc!=SUCCESS) { | 1761 | if (rc!=SUCCESS) { |
1733 | printk(KERN_ERR "airo: WEP_PERM set %x\n", rc); | 1762 | airo_print_err(ai->dev->name, "WEP_PERM set %x", rc); |
1734 | } | 1763 | } |
1735 | } | 1764 | } |
1736 | return rc; | 1765 | return rc; |
@@ -1909,7 +1938,7 @@ static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
1909 | struct airo_info *ai = dev->priv; | 1938 | struct airo_info *ai = dev->priv; |
1910 | 1939 | ||
1911 | if (!skb) { | 1940 | if (!skb) { |
1912 | printk(KERN_ERR "airo: %s: skb==NULL\n",__FUNCTION__); | 1941 | airo_print_err(dev->name, "%s: skb == NULL!",__FUNCTION__); |
1913 | return 0; | 1942 | return 0; |
1914 | } | 1943 | } |
1915 | npacks = skb_queue_len (&ai->txq); | 1944 | npacks = skb_queue_len (&ai->txq); |
@@ -1955,8 +1984,8 @@ static int mpi_send_packet (struct net_device *dev) | |||
1955 | /* get a packet to send */ | 1984 | /* get a packet to send */ |
1956 | 1985 | ||
1957 | if ((skb = skb_dequeue(&ai->txq)) == 0) { | 1986 | if ((skb = skb_dequeue(&ai->txq)) == 0) { |
1958 | printk (KERN_ERR | 1987 | airo_print_err(dev->name, |
1959 | "airo: %s: Dequeue'd zero in send_packet()\n", | 1988 | "%s: Dequeue'd zero in send_packet()", |
1960 | __FUNCTION__); | 1989 | __FUNCTION__); |
1961 | return 0; | 1990 | return 0; |
1962 | } | 1991 | } |
@@ -2108,7 +2137,7 @@ static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
2108 | u32 *fids = priv->fids; | 2137 | u32 *fids = priv->fids; |
2109 | 2138 | ||
2110 | if ( skb == NULL ) { | 2139 | if ( skb == NULL ) { |
2111 | printk( KERN_ERR "airo: skb == NULL!!!\n" ); | 2140 | airo_print_err(dev->name, "%s: skb == NULL!", __FUNCTION__); |
2112 | return 0; | 2141 | return 0; |
2113 | } | 2142 | } |
2114 | 2143 | ||
@@ -2179,7 +2208,7 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { | |||
2179 | } | 2208 | } |
2180 | 2209 | ||
2181 | if ( skb == NULL ) { | 2210 | if ( skb == NULL ) { |
2182 | printk( KERN_ERR "airo: skb == NULL!!!\n" ); | 2211 | airo_print_err(dev->name, "%s: skb == NULL!", __FUNCTION__); |
2183 | return 0; | 2212 | return 0; |
2184 | } | 2213 | } |
2185 | 2214 | ||
@@ -2364,6 +2393,8 @@ void stop_airo_card( struct net_device *dev, int freeres ) | |||
2364 | dev_kfree_skb(skb); | 2393 | dev_kfree_skb(skb); |
2365 | } | 2394 | } |
2366 | 2395 | ||
2396 | airo_networks_free (ai); | ||
2397 | |||
2367 | kfree(ai->flash); | 2398 | kfree(ai->flash); |
2368 | kfree(ai->rssi); | 2399 | kfree(ai->rssi); |
2369 | kfree(ai->APList); | 2400 | kfree(ai->APList); |
@@ -2434,7 +2465,7 @@ static int mpi_init_descriptors (struct airo_info *ai) | |||
2434 | cmd.parm2 = MPI_MAX_FIDS; | 2465 | cmd.parm2 = MPI_MAX_FIDS; |
2435 | rc=issuecommand(ai, &cmd, &rsp); | 2466 | rc=issuecommand(ai, &cmd, &rsp); |
2436 | if (rc != SUCCESS) { | 2467 | if (rc != SUCCESS) { |
2437 | printk(KERN_ERR "airo: Couldn't allocate RX FID\n"); | 2468 | airo_print_err(ai->dev->name, "Couldn't allocate RX FID"); |
2438 | return rc; | 2469 | return rc; |
2439 | } | 2470 | } |
2440 | 2471 | ||
@@ -2462,7 +2493,7 @@ static int mpi_init_descriptors (struct airo_info *ai) | |||
2462 | 2493 | ||
2463 | rc=issuecommand(ai, &cmd, &rsp); | 2494 | rc=issuecommand(ai, &cmd, &rsp); |
2464 | if (rc != SUCCESS) { | 2495 | if (rc != SUCCESS) { |
2465 | printk(KERN_ERR "airo: Couldn't allocate TX FID\n"); | 2496 | airo_print_err(ai->dev->name, "Couldn't allocate TX FID"); |
2466 | return rc; | 2497 | return rc; |
2467 | } | 2498 | } |
2468 | 2499 | ||
@@ -2476,7 +2507,7 @@ static int mpi_init_descriptors (struct airo_info *ai) | |||
2476 | cmd.parm2 = 1; /* Magic number... */ | 2507 | cmd.parm2 = 1; /* Magic number... */ |
2477 | rc=issuecommand(ai, &cmd, &rsp); | 2508 | rc=issuecommand(ai, &cmd, &rsp); |
2478 | if (rc != SUCCESS) { | 2509 | if (rc != SUCCESS) { |
2479 | printk(KERN_ERR "airo: Couldn't allocate RID\n"); | 2510 | airo_print_err(ai->dev->name, "Couldn't allocate RID"); |
2480 | return rc; | 2511 | return rc; |
2481 | } | 2512 | } |
2482 | 2513 | ||
@@ -2508,25 +2539,25 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2508 | aux_len = AUXMEMSIZE; | 2539 | aux_len = AUXMEMSIZE; |
2509 | 2540 | ||
2510 | if (!request_mem_region(mem_start, mem_len, name)) { | 2541 | if (!request_mem_region(mem_start, mem_len, name)) { |
2511 | printk(KERN_ERR "airo: Couldn't get region %x[%x] for %s\n", | 2542 | airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s", |
2512 | (int)mem_start, (int)mem_len, name); | 2543 | (int)mem_start, (int)mem_len, name); |
2513 | goto out; | 2544 | goto out; |
2514 | } | 2545 | } |
2515 | if (!request_mem_region(aux_start, aux_len, name)) { | 2546 | if (!request_mem_region(aux_start, aux_len, name)) { |
2516 | printk(KERN_ERR "airo: Couldn't get region %x[%x] for %s\n", | 2547 | airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s", |
2517 | (int)aux_start, (int)aux_len, name); | 2548 | (int)aux_start, (int)aux_len, name); |
2518 | goto free_region1; | 2549 | goto free_region1; |
2519 | } | 2550 | } |
2520 | 2551 | ||
2521 | ai->pcimem = ioremap(mem_start, mem_len); | 2552 | ai->pcimem = ioremap(mem_start, mem_len); |
2522 | if (!ai->pcimem) { | 2553 | if (!ai->pcimem) { |
2523 | printk(KERN_ERR "airo: Couldn't map region %x[%x] for %s\n", | 2554 | airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s", |
2524 | (int)mem_start, (int)mem_len, name); | 2555 | (int)mem_start, (int)mem_len, name); |
2525 | goto free_region2; | 2556 | goto free_region2; |
2526 | } | 2557 | } |
2527 | ai->pciaux = ioremap(aux_start, aux_len); | 2558 | ai->pciaux = ioremap(aux_start, aux_len); |
2528 | if (!ai->pciaux) { | 2559 | if (!ai->pciaux) { |
2529 | printk(KERN_ERR "airo: Couldn't map region %x[%x] for %s\n", | 2560 | airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s", |
2530 | (int)aux_start, (int)aux_len, name); | 2561 | (int)aux_start, (int)aux_len, name); |
2531 | goto free_memmap; | 2562 | goto free_memmap; |
2532 | } | 2563 | } |
@@ -2534,7 +2565,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2534 | /* Reserve PKTSIZE for each fid and 2K for the Rids */ | 2565 | /* Reserve PKTSIZE for each fid and 2K for the Rids */ |
2535 | ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma); | 2566 | ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma); |
2536 | if (!ai->shared) { | 2567 | if (!ai->shared) { |
2537 | printk(KERN_ERR "airo: Couldn't alloc_consistent %d\n", | 2568 | airo_print_err(ai->dev->name, "Couldn't alloc_consistent %d", |
2538 | PCI_SHARED_LEN); | 2569 | PCI_SHARED_LEN); |
2539 | goto free_auxmap; | 2570 | goto free_auxmap; |
2540 | } | 2571 | } |
@@ -2626,7 +2657,7 @@ static void wifi_setup(struct net_device *dev) | |||
2626 | 2657 | ||
2627 | dev->type = ARPHRD_IEEE80211; | 2658 | dev->type = ARPHRD_IEEE80211; |
2628 | dev->hard_header_len = ETH_HLEN; | 2659 | dev->hard_header_len = ETH_HLEN; |
2629 | dev->mtu = 2312; | 2660 | dev->mtu = AIRO_DEF_MTU; |
2630 | dev->addr_len = ETH_ALEN; | 2661 | dev->addr_len = ETH_ALEN; |
2631 | dev->tx_queue_len = 100; | 2662 | dev->tx_queue_len = 100; |
2632 | 2663 | ||
@@ -2670,6 +2701,42 @@ static int reset_card( struct net_device *dev , int lock) { | |||
2670 | return 0; | 2701 | return 0; |
2671 | } | 2702 | } |
2672 | 2703 | ||
2704 | #define MAX_NETWORK_COUNT 64 | ||
2705 | static int airo_networks_allocate(struct airo_info *ai) | ||
2706 | { | ||
2707 | if (ai->networks) | ||
2708 | return 0; | ||
2709 | |||
2710 | ai->networks = | ||
2711 | kzalloc(MAX_NETWORK_COUNT * sizeof(BSSListElement), | ||
2712 | GFP_KERNEL); | ||
2713 | if (!ai->networks) { | ||
2714 | airo_print_warn(ai->dev->name, "Out of memory allocating beacons"); | ||
2715 | return -ENOMEM; | ||
2716 | } | ||
2717 | |||
2718 | return 0; | ||
2719 | } | ||
2720 | |||
2721 | static void airo_networks_free(struct airo_info *ai) | ||
2722 | { | ||
2723 | if (!ai->networks) | ||
2724 | return; | ||
2725 | kfree(ai->networks); | ||
2726 | ai->networks = NULL; | ||
2727 | } | ||
2728 | |||
2729 | static void airo_networks_initialize(struct airo_info *ai) | ||
2730 | { | ||
2731 | int i; | ||
2732 | |||
2733 | INIT_LIST_HEAD(&ai->network_free_list); | ||
2734 | INIT_LIST_HEAD(&ai->network_list); | ||
2735 | for (i = 0; i < MAX_NETWORK_COUNT; i++) | ||
2736 | list_add_tail(&ai->networks[i].list, | ||
2737 | &ai->network_free_list); | ||
2738 | } | ||
2739 | |||
2673 | static struct net_device *_init_airo_card( unsigned short irq, int port, | 2740 | static struct net_device *_init_airo_card( unsigned short irq, int port, |
2674 | int is_pcmcia, struct pci_dev *pci, | 2741 | int is_pcmcia, struct pci_dev *pci, |
2675 | struct device *dmdev ) | 2742 | struct device *dmdev ) |
@@ -2681,22 +2748,22 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2681 | /* Create the network device object. */ | 2748 | /* Create the network device object. */ |
2682 | dev = alloc_etherdev(sizeof(*ai)); | 2749 | dev = alloc_etherdev(sizeof(*ai)); |
2683 | if (!dev) { | 2750 | if (!dev) { |
2684 | printk(KERN_ERR "airo: Couldn't alloc_etherdev\n"); | 2751 | airo_print_err("", "Couldn't alloc_etherdev"); |
2685 | return NULL; | 2752 | return NULL; |
2686 | } | 2753 | } |
2687 | if (dev_alloc_name(dev, dev->name) < 0) { | 2754 | if (dev_alloc_name(dev, dev->name) < 0) { |
2688 | printk(KERN_ERR "airo: Couldn't get name!\n"); | 2755 | airo_print_err("", "Couldn't get name!"); |
2689 | goto err_out_free; | 2756 | goto err_out_free; |
2690 | } | 2757 | } |
2691 | 2758 | ||
2692 | ai = dev->priv; | 2759 | ai = dev->priv; |
2693 | ai->wifidev = NULL; | 2760 | ai->wifidev = NULL; |
2694 | ai->flags = 0; | 2761 | ai->flags = 0; |
2762 | ai->dev = dev; | ||
2695 | if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { | 2763 | if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { |
2696 | printk(KERN_DEBUG "airo: Found an MPI350 card\n"); | 2764 | airo_print_dbg(dev->name, "Found an MPI350 card"); |
2697 | set_bit(FLAG_MPI, &ai->flags); | 2765 | set_bit(FLAG_MPI, &ai->flags); |
2698 | } | 2766 | } |
2699 | ai->dev = dev; | ||
2700 | spin_lock_init(&ai->aux_lock); | 2767 | spin_lock_init(&ai->aux_lock); |
2701 | sema_init(&ai->sem, 1); | 2768 | sema_init(&ai->sem, 1); |
2702 | ai->config.len = 0; | 2769 | ai->config.len = 0; |
@@ -2711,6 +2778,10 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2711 | if (rc) | 2778 | if (rc) |
2712 | goto err_out_thr; | 2779 | goto err_out_thr; |
2713 | 2780 | ||
2781 | if (airo_networks_allocate (ai)) | ||
2782 | goto err_out_unlink; | ||
2783 | airo_networks_initialize (ai); | ||
2784 | |||
2714 | /* The Airo-specific entries in the device structure. */ | 2785 | /* The Airo-specific entries in the device structure. */ |
2715 | if (test_bit(FLAG_MPI,&ai->flags)) { | 2786 | if (test_bit(FLAG_MPI,&ai->flags)) { |
2716 | skb_queue_head_init (&ai->txq); | 2787 | skb_queue_head_init (&ai->txq); |
@@ -2732,33 +2803,33 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2732 | 2803 | ||
2733 | SET_NETDEV_DEV(dev, dmdev); | 2804 | SET_NETDEV_DEV(dev, dmdev); |
2734 | 2805 | ||
2735 | |||
2736 | reset_card (dev, 1); | 2806 | reset_card (dev, 1); |
2737 | msleep(400); | 2807 | msleep(400); |
2738 | 2808 | ||
2739 | rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); | 2809 | rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); |
2740 | if (rc) { | 2810 | if (rc) { |
2741 | printk(KERN_ERR "airo: register interrupt %d failed, rc %d\n", irq, rc ); | 2811 | airo_print_err(dev->name, "register interrupt %d failed, rc %d", |
2812 | irq, rc); | ||
2742 | goto err_out_unlink; | 2813 | goto err_out_unlink; |
2743 | } | 2814 | } |
2744 | if (!is_pcmcia) { | 2815 | if (!is_pcmcia) { |
2745 | if (!request_region( dev->base_addr, 64, dev->name )) { | 2816 | if (!request_region( dev->base_addr, 64, dev->name )) { |
2746 | rc = -EBUSY; | 2817 | rc = -EBUSY; |
2747 | printk(KERN_ERR "airo: Couldn't request region\n"); | 2818 | airo_print_err(dev->name, "Couldn't request region"); |
2748 | goto err_out_irq; | 2819 | goto err_out_irq; |
2749 | } | 2820 | } |
2750 | } | 2821 | } |
2751 | 2822 | ||
2752 | if (test_bit(FLAG_MPI,&ai->flags)) { | 2823 | if (test_bit(FLAG_MPI,&ai->flags)) { |
2753 | if (mpi_map_card(ai, pci, dev->name)) { | 2824 | if (mpi_map_card(ai, pci, dev->name)) { |
2754 | printk(KERN_ERR "airo: Could not map memory\n"); | 2825 | airo_print_err(dev->name, "Could not map memory"); |
2755 | goto err_out_res; | 2826 | goto err_out_res; |
2756 | } | 2827 | } |
2757 | } | 2828 | } |
2758 | 2829 | ||
2759 | if (probe) { | 2830 | if (probe) { |
2760 | if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) { | 2831 | if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) { |
2761 | printk( KERN_ERR "airo: MAC could not be enabled\n" ); | 2832 | airo_print_err(dev->name, "MAC could not be enabled" ); |
2762 | rc = -EIO; | 2833 | rc = -EIO; |
2763 | goto err_out_map; | 2834 | goto err_out_map; |
2764 | } | 2835 | } |
@@ -2769,21 +2840,20 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2769 | 2840 | ||
2770 | rc = register_netdev(dev); | 2841 | rc = register_netdev(dev); |
2771 | if (rc) { | 2842 | if (rc) { |
2772 | printk(KERN_ERR "airo: Couldn't register_netdev\n"); | 2843 | airo_print_err(dev->name, "Couldn't register_netdev"); |
2773 | goto err_out_map; | 2844 | goto err_out_map; |
2774 | } | 2845 | } |
2775 | ai->wifidev = init_wifidev(ai, dev); | 2846 | ai->wifidev = init_wifidev(ai, dev); |
2776 | 2847 | ||
2777 | set_bit(FLAG_REGISTERED,&ai->flags); | 2848 | set_bit(FLAG_REGISTERED,&ai->flags); |
2778 | printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n", | 2849 | airo_print_info(dev->name, "MAC enabled %x:%x:%x:%x:%x:%x", |
2779 | dev->name, | ||
2780 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | 2850 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
2781 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | 2851 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); |
2782 | 2852 | ||
2783 | /* Allocate the transmit buffers */ | 2853 | /* Allocate the transmit buffers */ |
2784 | if (probe && !test_bit(FLAG_MPI,&ai->flags)) | 2854 | if (probe && !test_bit(FLAG_MPI,&ai->flags)) |
2785 | for( i = 0; i < MAX_FIDS; i++ ) | 2855 | for( i = 0; i < MAX_FIDS; i++ ) |
2786 | ai->fids[i] = transmit_allocate(ai,2312,i>=MAX_FIDS/2); | 2856 | ai->fids[i] = transmit_allocate(ai,AIRO_DEF_MTU,i>=MAX_FIDS/2); |
2787 | 2857 | ||
2788 | setup_proc_entry( dev, dev->priv ); /* XXX check for failure */ | 2858 | setup_proc_entry( dev, dev->priv ); /* XXX check for failure */ |
2789 | netif_start_queue(dev); | 2859 | netif_start_queue(dev); |
@@ -2840,16 +2910,16 @@ int reset_airo_card( struct net_device *dev ) | |||
2840 | return -1; | 2910 | return -1; |
2841 | 2911 | ||
2842 | if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) { | 2912 | if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) { |
2843 | printk( KERN_ERR "airo: MAC could not be enabled\n" ); | 2913 | airo_print_err(dev->name, "MAC could not be enabled"); |
2844 | return -1; | 2914 | return -1; |
2845 | } | 2915 | } |
2846 | printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n", dev->name, | 2916 | airo_print_info(dev->name, "MAC enabled %x:%x:%x:%x:%x:%x", |
2847 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | 2917 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
2848 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); | 2918 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
2849 | /* Allocate the transmit buffers if needed */ | 2919 | /* Allocate the transmit buffers if needed */ |
2850 | if (!test_bit(FLAG_MPI,&ai->flags)) | 2920 | if (!test_bit(FLAG_MPI,&ai->flags)) |
2851 | for( i = 0; i < MAX_FIDS; i++ ) | 2921 | for( i = 0; i < MAX_FIDS; i++ ) |
2852 | ai->fids[i] = transmit_allocate (ai,2312,i>=MAX_FIDS/2); | 2922 | ai->fids[i] = transmit_allocate (ai,AIRO_DEF_MTU,i>=MAX_FIDS/2); |
2853 | 2923 | ||
2854 | enable_interrupts( ai ); | 2924 | enable_interrupts( ai ); |
2855 | netif_wake_queue(dev); | 2925 | netif_wake_queue(dev); |
@@ -2875,6 +2945,65 @@ static void airo_send_event(struct net_device *dev) { | |||
2875 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 2945 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); |
2876 | } | 2946 | } |
2877 | 2947 | ||
2948 | static void airo_process_scan_results (struct airo_info *ai) { | ||
2949 | union iwreq_data wrqu; | ||
2950 | BSSListRid BSSList; | ||
2951 | int rc; | ||
2952 | BSSListElement * loop_net; | ||
2953 | BSSListElement * tmp_net; | ||
2954 | |||
2955 | /* Blow away current list of scan results */ | ||
2956 | list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) { | ||
2957 | list_move_tail (&loop_net->list, &ai->network_free_list); | ||
2958 | /* Don't blow away ->list, just BSS data */ | ||
2959 | memset (loop_net, 0, sizeof (loop_net->bss)); | ||
2960 | } | ||
2961 | |||
2962 | /* Try to read the first entry of the scan result */ | ||
2963 | rc = PC4500_readrid(ai, RID_BSSLISTFIRST, &BSSList, sizeof(BSSList), 0); | ||
2964 | if((rc) || (BSSList.index == 0xffff)) { | ||
2965 | /* No scan results */ | ||
2966 | goto out; | ||
2967 | } | ||
2968 | |||
2969 | /* Read and parse all entries */ | ||
2970 | tmp_net = NULL; | ||
2971 | while((!rc) && (BSSList.index != 0xffff)) { | ||
2972 | /* Grab a network off the free list */ | ||
2973 | if (!list_empty(&ai->network_free_list)) { | ||
2974 | tmp_net = list_entry(ai->network_free_list.next, | ||
2975 | BSSListElement, list); | ||
2976 | list_del(ai->network_free_list.next); | ||
2977 | } | ||
2978 | |||
2979 | if (tmp_net != NULL) { | ||
2980 | memcpy(tmp_net, &BSSList, sizeof(tmp_net->bss)); | ||
2981 | list_add_tail(&tmp_net->list, &ai->network_list); | ||
2982 | tmp_net = NULL; | ||
2983 | } | ||
2984 | |||
2985 | /* Read next entry */ | ||
2986 | rc = PC4500_readrid(ai, RID_BSSLISTNEXT, | ||
2987 | &BSSList, sizeof(BSSList), 0); | ||
2988 | } | ||
2989 | |||
2990 | out: | ||
2991 | ai->scan_timeout = 0; | ||
2992 | clear_bit(JOB_SCAN_RESULTS, &ai->flags); | ||
2993 | up(&ai->sem); | ||
2994 | |||
2995 | /* Send an empty event to user space. | ||
2996 | * We don't send the received data on | ||
2997 | * the event because it would require | ||
2998 | * us to do complex transcoding, and | ||
2999 | * we want to minimise the work done in | ||
3000 | * the irq handler. Use a request to | ||
3001 | * extract the data - Jean II */ | ||
3002 | wrqu.data.length = 0; | ||
3003 | wrqu.data.flags = 0; | ||
3004 | wireless_send_event(ai->dev, SIOCGIWSCAN, &wrqu, NULL); | ||
3005 | } | ||
3006 | |||
2878 | static int airo_thread(void *data) { | 3007 | static int airo_thread(void *data) { |
2879 | struct net_device *dev = data; | 3008 | struct net_device *dev = data; |
2880 | struct airo_info *ai = dev->priv; | 3009 | struct airo_info *ai = dev->priv; |
@@ -2904,13 +3033,26 @@ static int airo_thread(void *data) { | |||
2904 | set_current_state(TASK_INTERRUPTIBLE); | 3033 | set_current_state(TASK_INTERRUPTIBLE); |
2905 | if (ai->flags & JOB_MASK) | 3034 | if (ai->flags & JOB_MASK) |
2906 | break; | 3035 | break; |
2907 | if (ai->expires) { | 3036 | if (ai->expires || ai->scan_timeout) { |
2908 | if (time_after_eq(jiffies,ai->expires)){ | 3037 | if (ai->scan_timeout && |
3038 | time_after_eq(jiffies,ai->scan_timeout)){ | ||
3039 | set_bit(JOB_SCAN_RESULTS,&ai->flags); | ||
3040 | break; | ||
3041 | } else if (ai->expires && | ||
3042 | time_after_eq(jiffies,ai->expires)){ | ||
2909 | set_bit(JOB_AUTOWEP,&ai->flags); | 3043 | set_bit(JOB_AUTOWEP,&ai->flags); |
2910 | break; | 3044 | break; |
2911 | } | 3045 | } |
2912 | if (!signal_pending(current)) { | 3046 | if (!signal_pending(current)) { |
2913 | schedule_timeout(ai->expires - jiffies); | 3047 | unsigned long wake_at; |
3048 | if (!ai->expires || !ai->scan_timeout) { | ||
3049 | wake_at = max(ai->expires, | ||
3050 | ai->scan_timeout); | ||
3051 | } else { | ||
3052 | wake_at = min(ai->expires, | ||
3053 | ai->scan_timeout); | ||
3054 | } | ||
3055 | schedule_timeout(wake_at - jiffies); | ||
2914 | continue; | 3056 | continue; |
2915 | } | 3057 | } |
2916 | } else if (!signal_pending(current)) { | 3058 | } else if (!signal_pending(current)) { |
@@ -2953,6 +3095,10 @@ static int airo_thread(void *data) { | |||
2953 | airo_send_event(dev); | 3095 | airo_send_event(dev); |
2954 | else if (test_bit(JOB_AUTOWEP, &ai->flags)) | 3096 | else if (test_bit(JOB_AUTOWEP, &ai->flags)) |
2955 | timer_func(dev); | 3097 | timer_func(dev); |
3098 | else if (test_bit(JOB_SCAN_RESULTS, &ai->flags)) | ||
3099 | airo_process_scan_results(ai); | ||
3100 | else /* Shouldn't get here, but we make sure to unlock */ | ||
3101 | up(&ai->sem); | ||
2956 | } | 3102 | } |
2957 | complete_and_exit (&ai->thr_exited, 0); | 3103 | complete_and_exit (&ai->thr_exited, 0); |
2958 | } | 3104 | } |
@@ -3047,19 +3193,15 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3047 | * and reassociations as valid status | 3193 | * and reassociations as valid status |
3048 | * Jean II */ | 3194 | * Jean II */ |
3049 | if(newStatus == ASSOCIATED) { | 3195 | if(newStatus == ASSOCIATED) { |
3050 | if (apriv->scan_timestamp) { | 3196 | #if 0 |
3051 | /* Send an empty event to user space. | 3197 | /* FIXME: Grabbing scan results here |
3052 | * We don't send the received data on | 3198 | * seems to be too early??? Just wait for |
3053 | * the event because it would require | 3199 | * timeout instead. */ |
3054 | * us to do complex transcoding, and | 3200 | if (apriv->scan_timeout > 0) { |
3055 | * we want to minimise the work done in | 3201 | set_bit(JOB_SCAN_RESULTS, &apriv->flags); |
3056 | * the irq handler. Use a request to | 3202 | wake_up_interruptible(&apriv->thr_wait); |
3057 | * extract the data - Jean II */ | ||
3058 | wrqu.data.length = 0; | ||
3059 | wrqu.data.flags = 0; | ||
3060 | wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); | ||
3061 | apriv->scan_timestamp = 0; | ||
3062 | } | 3203 | } |
3204 | #endif | ||
3063 | if (down_trylock(&apriv->sem) != 0) { | 3205 | if (down_trylock(&apriv->sem) != 0) { |
3064 | set_bit(JOB_EVENT, &apriv->flags); | 3206 | set_bit(JOB_EVENT, &apriv->flags); |
3065 | wake_up_interruptible(&apriv->thr_wait); | 3207 | wake_up_interruptible(&apriv->thr_wait); |
@@ -3117,8 +3259,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3117 | } | 3259 | } |
3118 | len = le16_to_cpu(hdr.len); | 3260 | len = le16_to_cpu(hdr.len); |
3119 | 3261 | ||
3120 | if (len > 2312) { | 3262 | if (len > AIRO_DEF_MTU) { |
3121 | printk( KERN_ERR "airo: Bad size %d\n", len ); | 3263 | airo_print_err(apriv->dev->name, "Bad size %d", len); |
3122 | goto badrx; | 3264 | goto badrx; |
3123 | } | 3265 | } |
3124 | if (len == 0) | 3266 | if (len == 0) |
@@ -3161,10 +3303,12 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) | |||
3161 | bap_read (apriv, &gap, sizeof(gap), BAP0); | 3303 | bap_read (apriv, &gap, sizeof(gap), BAP0); |
3162 | gap = le16_to_cpu(gap); | 3304 | gap = le16_to_cpu(gap); |
3163 | if (gap) { | 3305 | if (gap) { |
3164 | if (gap <= 8) | 3306 | if (gap <= 8) { |
3165 | bap_read (apriv, tmpbuf, gap, BAP0); | 3307 | bap_read (apriv, tmpbuf, gap, BAP0); |
3166 | else | 3308 | } else { |
3167 | printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n"); | 3309 | airo_print_err(apriv->dev->name, "gaplen too " |
3310 | "big. Problems will follow..."); | ||
3311 | } | ||
3168 | } | 3312 | } |
3169 | bap_read (apriv, buffer + hdrlen/2, len, BAP0); | 3313 | bap_read (apriv, buffer + hdrlen/2, len, BAP0); |
3170 | } else { | 3314 | } else { |
@@ -3281,12 +3425,13 @@ exitrx: | |||
3281 | } | 3425 | } |
3282 | } else { | 3426 | } else { |
3283 | OUT4500( apriv, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); | 3427 | OUT4500( apriv, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); |
3284 | printk( KERN_ERR "airo: Unallocated FID was used to xmit\n" ); | 3428 | airo_print_err(apriv->dev->name, "Unallocated FID was " |
3429 | "used to xmit" ); | ||
3285 | } | 3430 | } |
3286 | } | 3431 | } |
3287 | exittx: | 3432 | exittx: |
3288 | if ( status & ~STATUS_INTS & ~IGNORE_INTS ) | 3433 | if ( status & ~STATUS_INTS & ~IGNORE_INTS ) |
3289 | printk( KERN_WARNING "airo: Got weird status %x\n", | 3434 | airo_print_warn(apriv->dev->name, "Got weird status %x", |
3290 | status & ~STATUS_INTS & ~IGNORE_INTS ); | 3435 | status & ~STATUS_INTS & ~IGNORE_INTS ); |
3291 | } | 3436 | } |
3292 | 3437 | ||
@@ -3359,8 +3504,8 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) { | |||
3359 | up(&ai->sem); | 3504 | up(&ai->sem); |
3360 | 3505 | ||
3361 | if (rc) | 3506 | if (rc) |
3362 | printk(KERN_ERR "%s: Cannot enable MAC, err=%d\n", | 3507 | airo_print_err(ai->dev->name, "%s: Cannot enable MAC, err=%d", |
3363 | __FUNCTION__,rc); | 3508 | __FUNCTION__, rc); |
3364 | return rc; | 3509 | return rc; |
3365 | } | 3510 | } |
3366 | 3511 | ||
@@ -3489,8 +3634,8 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
3489 | if (ai->wifidev == NULL) | 3634 | if (ai->wifidev == NULL) |
3490 | hdr.len = 0; | 3635 | hdr.len = 0; |
3491 | len = le16_to_cpu(hdr.len); | 3636 | len = le16_to_cpu(hdr.len); |
3492 | if (len > 2312) { | 3637 | if (len > AIRO_DEF_MTU) { |
3493 | printk( KERN_ERR "airo: Bad size %d\n", len ); | 3638 | airo_print_err(ai->dev->name, "Bad size %d", len); |
3494 | goto badrx; | 3639 | goto badrx; |
3495 | } | 3640 | } |
3496 | if (len == 0) | 3641 | if (len == 0) |
@@ -3531,8 +3676,8 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
3531 | if (gap <= 8) | 3676 | if (gap <= 8) |
3532 | ptr += gap; | 3677 | ptr += gap; |
3533 | else | 3678 | else |
3534 | printk(KERN_ERR | 3679 | airo_print_err(ai->dev->name, |
3535 | "airo: gaplen too big. Problems will follow...\n"); | 3680 | "gaplen too big. Problems will follow..."); |
3536 | } | 3681 | } |
3537 | memcpy ((char *)buffer + hdrlen, ptr, len); | 3682 | memcpy ((char *)buffer + hdrlen, ptr, len); |
3538 | ptr += len; | 3683 | ptr += len; |
@@ -3604,15 +3749,15 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3604 | if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { | 3749 | if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { |
3605 | if (lock) | 3750 | if (lock) |
3606 | up(&ai->sem); | 3751 | up(&ai->sem); |
3607 | printk(KERN_ERR "airo: Error checking for AUX port\n"); | 3752 | airo_print_err(ai->dev->name, "Error checking for AUX port"); |
3608 | return ERROR; | 3753 | return ERROR; |
3609 | } | 3754 | } |
3610 | if (!aux_bap || rsp.status & 0xff00) { | 3755 | if (!aux_bap || rsp.status & 0xff00) { |
3611 | ai->bap_read = fast_bap_read; | 3756 | ai->bap_read = fast_bap_read; |
3612 | printk(KERN_DEBUG "airo: Doing fast bap_reads\n"); | 3757 | airo_print_dbg(ai->dev->name, "Doing fast bap_reads"); |
3613 | } else { | 3758 | } else { |
3614 | ai->bap_read = aux_bap_read; | 3759 | ai->bap_read = aux_bap_read; |
3615 | printk(KERN_DEBUG "airo: Doing AUX bap_reads\n"); | 3760 | airo_print_dbg(ai->dev->name, "Doing AUX bap_reads"); |
3616 | } | 3761 | } |
3617 | } | 3762 | } |
3618 | if (lock) | 3763 | if (lock) |
@@ -3643,7 +3788,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3643 | if (cap_rid.softCap & 8) | 3788 | if (cap_rid.softCap & 8) |
3644 | ai->config.rmode |= RXMODE_NORMALIZED_RSSI; | 3789 | ai->config.rmode |= RXMODE_NORMALIZED_RSSI; |
3645 | else | 3790 | else |
3646 | printk(KERN_WARNING "airo: unknown received signal level scale\n"); | 3791 | airo_print_warn(ai->dev->name, "unknown received signal " |
3792 | "level scale"); | ||
3647 | } | 3793 | } |
3648 | ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; | 3794 | ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; |
3649 | ai->config.authType = AUTH_OPEN; | 3795 | ai->config.authType = AUTH_OPEN; |
@@ -3706,7 +3852,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3706 | 3852 | ||
3707 | status = enable_MAC(ai, &rsp, lock); | 3853 | status = enable_MAC(ai, &rsp, lock); |
3708 | if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) { | 3854 | if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) { |
3709 | printk( KERN_ERR "airo: Bad MAC enable reason = %x, rid = %x, offset = %d\n", rsp.rsp0, rsp.rsp1, rsp.rsp2 ); | 3855 | airo_print_err(ai->dev->name, "Bad MAC enable reason = %x, rid = %x," |
3856 | " offset = %d", rsp.rsp0, rsp.rsp1, rsp.rsp2 ); | ||
3710 | return ERROR; | 3857 | return ERROR; |
3711 | } | 3858 | } |
3712 | 3859 | ||
@@ -3749,8 +3896,8 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { | |||
3749 | } | 3896 | } |
3750 | 3897 | ||
3751 | if ( max_tries == -1 ) { | 3898 | if ( max_tries == -1 ) { |
3752 | printk( KERN_ERR | 3899 | airo_print_err(ai->dev->name, |
3753 | "airo: Max tries exceeded when issueing command\n" ); | 3900 | "Max tries exceeded when issueing command"); |
3754 | if (IN4500(ai, COMMAND) & COMMAND_BUSY) | 3901 | if (IN4500(ai, COMMAND) & COMMAND_BUSY) |
3755 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); | 3902 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); |
3756 | return ERROR; | 3903 | return ERROR; |
@@ -3762,11 +3909,11 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { | |||
3762 | pRsp->rsp1 = IN4500(ai, RESP1); | 3909 | pRsp->rsp1 = IN4500(ai, RESP1); |
3763 | pRsp->rsp2 = IN4500(ai, RESP2); | 3910 | pRsp->rsp2 = IN4500(ai, RESP2); |
3764 | if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) { | 3911 | if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) { |
3765 | printk (KERN_ERR "airo: cmd= %x\n", pCmd->cmd); | 3912 | airo_print_err(ai->dev->name, "cmd= %x\n", pCmd->cmd); |
3766 | printk (KERN_ERR "airo: status= %x\n", pRsp->status); | 3913 | airo_print_err(ai->dev->name, "status= %x\n", pRsp->status); |
3767 | printk (KERN_ERR "airo: Rsp0= %x\n", pRsp->rsp0); | 3914 | airo_print_err(ai->dev->name, "Rsp0= %x\n", pRsp->rsp0); |
3768 | printk (KERN_ERR "airo: Rsp1= %x\n", pRsp->rsp1); | 3915 | airo_print_err(ai->dev->name, "Rsp1= %x\n", pRsp->rsp1); |
3769 | printk (KERN_ERR "airo: Rsp2= %x\n", pRsp->rsp2); | 3916 | airo_print_err(ai->dev->name, "Rsp2= %x\n", pRsp->rsp2); |
3770 | } | 3917 | } |
3771 | 3918 | ||
3772 | // clear stuck command busy if necessary | 3919 | // clear stuck command busy if necessary |
@@ -3799,15 +3946,15 @@ static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap ) | |||
3799 | } | 3946 | } |
3800 | } else if ( status & BAP_ERR ) { | 3947 | } else if ( status & BAP_ERR ) { |
3801 | /* invalid rid or offset */ | 3948 | /* invalid rid or offset */ |
3802 | printk( KERN_ERR "airo: BAP error %x %d\n", | 3949 | airo_print_err(ai->dev->name, "BAP error %x %d", |
3803 | status, whichbap ); | 3950 | status, whichbap ); |
3804 | return ERROR; | 3951 | return ERROR; |
3805 | } else if (status & BAP_DONE) { // success | 3952 | } else if (status & BAP_DONE) { // success |
3806 | return SUCCESS; | 3953 | return SUCCESS; |
3807 | } | 3954 | } |
3808 | if ( !(max_tries--) ) { | 3955 | if ( !(max_tries--) ) { |
3809 | printk( KERN_ERR | 3956 | airo_print_err(ai->dev->name, |
3810 | "airo: BAP setup error too many retries\n" ); | 3957 | "airo: BAP setup error too many retries\n"); |
3811 | return ERROR; | 3958 | return ERROR; |
3812 | } | 3959 | } |
3813 | // -- PC4500 missed it, try again | 3960 | // -- PC4500 missed it, try again |
@@ -3962,8 +4109,8 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in | |||
3962 | len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2; | 4109 | len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2; |
3963 | 4110 | ||
3964 | if ( len <= 2 ) { | 4111 | if ( len <= 2 ) { |
3965 | printk( KERN_ERR | 4112 | airo_print_err(ai->dev->name, |
3966 | "airo: Rid %x has a length of %d which is too short\n", | 4113 | "Rid %x has a length of %d which is too short", |
3967 | (int)rid, (int)len ); | 4114 | (int)rid, (int)len ); |
3968 | rc = ERROR; | 4115 | rc = ERROR; |
3969 | goto done; | 4116 | goto done; |
@@ -3996,8 +4143,8 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, | |||
3996 | Resp rsp; | 4143 | Resp rsp; |
3997 | 4144 | ||
3998 | if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) | 4145 | if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) |
3999 | printk(KERN_ERR | 4146 | airo_print_err(ai->dev->name, |
4000 | "%s: MAC should be disabled (rid=%04x)\n", | 4147 | "%s: MAC should be disabled (rid=%04x)", |
4001 | __FUNCTION__, rid); | 4148 | __FUNCTION__, rid); |
4002 | memset(&cmd, 0, sizeof(cmd)); | 4149 | memset(&cmd, 0, sizeof(cmd)); |
4003 | memset(&rsp, 0, sizeof(rsp)); | 4150 | memset(&rsp, 0, sizeof(rsp)); |
@@ -4013,7 +4160,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, | |||
4013 | &ai->config_desc.rid_desc, sizeof(Rid)); | 4160 | &ai->config_desc.rid_desc, sizeof(Rid)); |
4014 | 4161 | ||
4015 | if (len < 4 || len > 2047) { | 4162 | if (len < 4 || len > 2047) { |
4016 | printk(KERN_ERR "%s: len=%d\n",__FUNCTION__,len); | 4163 | airo_print_err(ai->dev->name, "%s: len=%d", __FUNCTION__, len); |
4017 | rc = -1; | 4164 | rc = -1; |
4018 | } else { | 4165 | } else { |
4019 | memcpy((char *)ai->config_desc.virtual_host_addr, | 4166 | memcpy((char *)ai->config_desc.virtual_host_addr, |
@@ -4021,10 +4168,10 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, | |||
4021 | 4168 | ||
4022 | rc = issuecommand(ai, &cmd, &rsp); | 4169 | rc = issuecommand(ai, &cmd, &rsp); |
4023 | if ((rc & 0xff00) != 0) { | 4170 | if ((rc & 0xff00) != 0) { |
4024 | printk(KERN_ERR "%s: Write rid Error %d\n", | 4171 | airo_print_err(ai->dev->name, "%s: Write rid Error %d", |
4025 | __FUNCTION__,rc); | 4172 | __FUNCTION__, rc); |
4026 | printk(KERN_ERR "%s: Cmd=%04x\n", | 4173 | airo_print_err(ai->dev->name, "%s: Cmd=%04x", |
4027 | __FUNCTION__,cmd.cmd); | 4174 | __FUNCTION__, cmd.cmd); |
4028 | } | 4175 | } |
4029 | 4176 | ||
4030 | if ((rsp.status & 0x7f00)) | 4177 | if ((rsp.status & 0x7f00)) |
@@ -4123,7 +4270,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) | |||
4123 | len >>= 16; | 4270 | len >>= 16; |
4124 | 4271 | ||
4125 | if (len <= ETH_ALEN * 2) { | 4272 | if (len <= ETH_ALEN * 2) { |
4126 | printk( KERN_WARNING "Short packet %d\n", len ); | 4273 | airo_print_warn(ai->dev->name, "Short packet %d", len); |
4127 | return ERROR; | 4274 | return ERROR; |
4128 | } | 4275 | } |
4129 | len -= ETH_ALEN * 2; | 4276 | len -= ETH_ALEN * 2; |
@@ -4187,7 +4334,7 @@ static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket) | |||
4187 | } | 4334 | } |
4188 | 4335 | ||
4189 | if (len < hdrlen) { | 4336 | if (len < hdrlen) { |
4190 | printk( KERN_WARNING "Short packet %d\n", len ); | 4337 | airo_print_warn(ai->dev->name, "Short packet %d", len); |
4191 | return ERROR; | 4338 | return ERROR; |
4192 | } | 4339 | } |
4193 | 4340 | ||
@@ -4584,15 +4731,14 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4584 | i*4<stats.len; i++){ | 4731 | i*4<stats.len; i++){ |
4585 | if (!statsLabels[i]) continue; | 4732 | if (!statsLabels[i]) continue; |
4586 | if (j+strlen(statsLabels[i])+16>4096) { | 4733 | if (j+strlen(statsLabels[i])+16>4096) { |
4587 | printk(KERN_WARNING | 4734 | airo_print_warn(apriv->dev->name, |
4588 | "airo: Potentially disasterous buffer overflow averted!\n"); | 4735 | "Potentially disasterous buffer overflow averted!"); |
4589 | break; | 4736 | break; |
4590 | } | 4737 | } |
4591 | j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], vals[i]); | 4738 | j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], vals[i]); |
4592 | } | 4739 | } |
4593 | if (i*4>=stats.len){ | 4740 | if (i*4>=stats.len){ |
4594 | printk(KERN_WARNING | 4741 | airo_print_warn(apriv->dev->name, "Got a short rid"); |
4595 | "airo: Got a short rid\n"); | ||
4596 | } | 4742 | } |
4597 | data->readlen = j; | 4743 | data->readlen = j; |
4598 | return 0; | 4744 | return 0; |
@@ -4754,7 +4900,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4754 | 4900 | ||
4755 | line += 14; | 4901 | line += 14; |
4756 | v = get_dec_u16(line, &i, 4); | 4902 | v = get_dec_u16(line, &i, 4); |
4757 | v = (v<0) ? 0 : ((v>2312) ? 2312 : v); | 4903 | v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); |
4758 | ai->config.rtsThres = (u16)v; | 4904 | ai->config.rtsThres = (u16)v; |
4759 | set_bit (FLAG_COMMIT, &ai->flags); | 4905 | set_bit (FLAG_COMMIT, &ai->flags); |
4760 | } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { | 4906 | } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { |
@@ -4788,7 +4934,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4788 | 4934 | ||
4789 | line += 15; | 4935 | line += 15; |
4790 | v = get_dec_u16(line, &i, 4); | 4936 | v = get_dec_u16(line, &i, 4); |
4791 | v = (v<256) ? 256 : ((v>2312) ? 2312 : v); | 4937 | v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); |
4792 | v = v & 0xfffe; /* Make sure its even */ | 4938 | v = v & 0xfffe; /* Make sure its even */ |
4793 | ai->config.fragThresh = (u16)v; | 4939 | ai->config.fragThresh = (u16)v; |
4794 | set_bit (FLAG_COMMIT, &ai->flags); | 4940 | set_bit (FLAG_COMMIT, &ai->flags); |
@@ -4798,8 +4944,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4798 | case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; | 4944 | case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; |
4799 | case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; | 4945 | case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; |
4800 | case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; | 4946 | case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; |
4801 | default: | 4947 | default: airo_print_warn(ai->dev->name, "Unknown modulation"); |
4802 | printk( KERN_WARNING "airo: Unknown modulation\n" ); | ||
4803 | } | 4948 | } |
4804 | } else if (!strncmp(line, "Preamble: ", 10)) { | 4949 | } else if (!strncmp(line, "Preamble: ", 10)) { |
4805 | line += 10; | 4950 | line += 10; |
@@ -4807,10 +4952,10 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4807 | case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; | 4952 | case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; |
4808 | case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; | 4953 | case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; |
4809 | case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; | 4954 | case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; |
4810 | default: printk(KERN_WARNING "airo: Unknown preamble\n"); | 4955 | default: airo_print_warn(ai->dev->name, "Unknown preamble"); |
4811 | } | 4956 | } |
4812 | } else { | 4957 | } else { |
4813 | printk( KERN_WARNING "Couldn't figure out %s\n", line ); | 4958 | airo_print_warn(ai->dev->name, "Couldn't figure out %s", line); |
4814 | } | 4959 | } |
4815 | while( line[0] && line[0] != '\n' ) line++; | 4960 | while( line[0] && line[0] != '\n' ) line++; |
4816 | if ( line[0] ) line++; | 4961 | if ( line[0] ) line++; |
@@ -5076,7 +5221,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { | |||
5076 | } | 5221 | } |
5077 | j = 2; | 5222 | j = 2; |
5078 | } else { | 5223 | } else { |
5079 | printk(KERN_ERR "airo: WepKey passed invalid key index\n"); | 5224 | airo_print_err(ai->dev->name, "WepKey passed invalid key index"); |
5080 | return; | 5225 | return; |
5081 | } | 5226 | } |
5082 | 5227 | ||
@@ -5489,17 +5634,16 @@ static int __init airo_init_module( void ) | |||
5489 | airo_entry->gid = proc_gid; | 5634 | airo_entry->gid = proc_gid; |
5490 | 5635 | ||
5491 | for( i = 0; i < 4 && io[i] && irq[i]; i++ ) { | 5636 | for( i = 0; i < 4 && io[i] && irq[i]; i++ ) { |
5492 | printk( KERN_INFO | 5637 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " |
5493 | "airo: Trying to configure ISA adapter at irq=%d io=0x%x\n", | 5638 | "io=0x%x", irq[i], io[i] ); |
5494 | irq[i], io[i] ); | ||
5495 | if (init_airo_card( irq[i], io[i], 0, NULL )) | 5639 | if (init_airo_card( irq[i], io[i], 0, NULL )) |
5496 | have_isa_dev = 1; | 5640 | have_isa_dev = 1; |
5497 | } | 5641 | } |
5498 | 5642 | ||
5499 | #ifdef CONFIG_PCI | 5643 | #ifdef CONFIG_PCI |
5500 | printk( KERN_INFO "airo: Probing for PCI adapters\n" ); | 5644 | airo_print_info("", "Probing for PCI adapters"); |
5501 | pci_register_driver(&airo_driver); | 5645 | pci_register_driver(&airo_driver); |
5502 | printk( KERN_INFO "airo: Finished probing for PCI adapters\n" ); | 5646 | airo_print_info("", "Finished probing for PCI adapters"); |
5503 | #endif | 5647 | #endif |
5504 | 5648 | ||
5505 | /* Always exit with success, as we are a library module | 5649 | /* Always exit with success, as we are a library module |
@@ -5511,7 +5655,7 @@ static int __init airo_init_module( void ) | |||
5511 | static void __exit airo_cleanup_module( void ) | 5655 | static void __exit airo_cleanup_module( void ) |
5512 | { | 5656 | { |
5513 | while( airo_devices ) { | 5657 | while( airo_devices ) { |
5514 | printk( KERN_INFO "airo: Unregistering %s\n", airo_devices->dev->name ); | 5658 | airo_print_info(airo_devices->dev->name, "Unregistering...\n"); |
5515 | stop_airo_card( airo_devices->dev, 1 ); | 5659 | stop_airo_card( airo_devices->dev, 1 ); |
5516 | } | 5660 | } |
5517 | #ifdef CONFIG_PCI | 5661 | #ifdef CONFIG_PCI |
@@ -5622,7 +5766,8 @@ static int airo_set_freq(struct net_device *dev, | |||
5622 | /* We should do a better check than that, | 5766 | /* We should do a better check than that, |
5623 | * based on the card capability !!! */ | 5767 | * based on the card capability !!! */ |
5624 | if((channel < 1) || (channel > 14)) { | 5768 | if((channel < 1) || (channel > 14)) { |
5625 | printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m); | 5769 | airo_print_dbg(dev->name, "New channel value of %d is invalid!", |
5770 | fwrq->m); | ||
5626 | rc = -EINVAL; | 5771 | rc = -EINVAL; |
5627 | } else { | 5772 | } else { |
5628 | readConfigRid(local, 1); | 5773 | readConfigRid(local, 1); |
@@ -5946,8 +6091,8 @@ static int airo_set_rts(struct net_device *dev, | |||
5946 | int rthr = vwrq->value; | 6091 | int rthr = vwrq->value; |
5947 | 6092 | ||
5948 | if(vwrq->disabled) | 6093 | if(vwrq->disabled) |
5949 | rthr = 2312; | 6094 | rthr = AIRO_DEF_MTU; |
5950 | if((rthr < 0) || (rthr > 2312)) { | 6095 | if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { |
5951 | return -EINVAL; | 6096 | return -EINVAL; |
5952 | } | 6097 | } |
5953 | readConfigRid(local, 1); | 6098 | readConfigRid(local, 1); |
@@ -5970,7 +6115,7 @@ static int airo_get_rts(struct net_device *dev, | |||
5970 | 6115 | ||
5971 | readConfigRid(local, 1); | 6116 | readConfigRid(local, 1); |
5972 | vwrq->value = local->config.rtsThres; | 6117 | vwrq->value = local->config.rtsThres; |
5973 | vwrq->disabled = (vwrq->value >= 2312); | 6118 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); |
5974 | vwrq->fixed = 1; | 6119 | vwrq->fixed = 1; |
5975 | 6120 | ||
5976 | return 0; | 6121 | return 0; |
@@ -5989,8 +6134,8 @@ static int airo_set_frag(struct net_device *dev, | |||
5989 | int fthr = vwrq->value; | 6134 | int fthr = vwrq->value; |
5990 | 6135 | ||
5991 | if(vwrq->disabled) | 6136 | if(vwrq->disabled) |
5992 | fthr = 2312; | 6137 | fthr = AIRO_DEF_MTU; |
5993 | if((fthr < 256) || (fthr > 2312)) { | 6138 | if((fthr < 256) || (fthr > AIRO_DEF_MTU)) { |
5994 | return -EINVAL; | 6139 | return -EINVAL; |
5995 | } | 6140 | } |
5996 | fthr &= ~0x1; /* Get an even value - is it really needed ??? */ | 6141 | fthr &= ~0x1; /* Get an even value - is it really needed ??? */ |
@@ -6014,7 +6159,7 @@ static int airo_get_frag(struct net_device *dev, | |||
6014 | 6159 | ||
6015 | readConfigRid(local, 1); | 6160 | readConfigRid(local, 1); |
6016 | vwrq->value = local->config.fragThresh; | 6161 | vwrq->value = local->config.fragThresh; |
6017 | vwrq->disabled = (vwrq->value >= 2312); | 6162 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); |
6018 | vwrq->fixed = 1; | 6163 | vwrq->fixed = 1; |
6019 | 6164 | ||
6020 | return 0; | 6165 | return 0; |
@@ -6709,9 +6854,9 @@ static int airo_get_range(struct net_device *dev, | |||
6709 | range->throughput = 1500 * 1000; | 6854 | range->throughput = 1500 * 1000; |
6710 | 6855 | ||
6711 | range->min_rts = 0; | 6856 | range->min_rts = 0; |
6712 | range->max_rts = 2312; | 6857 | range->max_rts = AIRO_DEF_MTU; |
6713 | range->min_frag = 256; | 6858 | range->min_frag = 256; |
6714 | range->max_frag = 2312; | 6859 | range->max_frag = AIRO_DEF_MTU; |
6715 | 6860 | ||
6716 | if(cap_rid.softCap & 2) { | 6861 | if(cap_rid.softCap & 2) { |
6717 | // WEP: RC4 40 bits | 6862 | // WEP: RC4 40 bits |
@@ -6972,6 +7117,7 @@ static int airo_set_scan(struct net_device *dev, | |||
6972 | struct airo_info *ai = dev->priv; | 7117 | struct airo_info *ai = dev->priv; |
6973 | Cmd cmd; | 7118 | Cmd cmd; |
6974 | Resp rsp; | 7119 | Resp rsp; |
7120 | int wake = 0; | ||
6975 | 7121 | ||
6976 | /* Note : you may have realised that, as this is a SET operation, | 7122 | /* Note : you may have realised that, as this is a SET operation, |
6977 | * this is privileged and therefore a normal user can't | 7123 | * this is privileged and therefore a normal user can't |
@@ -6981,17 +7127,25 @@ static int airo_set_scan(struct net_device *dev, | |||
6981 | * Jean II */ | 7127 | * Jean II */ |
6982 | if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; | 7128 | if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; |
6983 | 7129 | ||
7130 | if (down_interruptible(&ai->sem)) | ||
7131 | return -ERESTARTSYS; | ||
7132 | |||
7133 | /* If there's already a scan in progress, don't | ||
7134 | * trigger another one. */ | ||
7135 | if (ai->scan_timeout > 0) | ||
7136 | goto out; | ||
7137 | |||
6984 | /* Initiate a scan command */ | 7138 | /* Initiate a scan command */ |
6985 | memset(&cmd, 0, sizeof(cmd)); | 7139 | memset(&cmd, 0, sizeof(cmd)); |
6986 | cmd.cmd=CMD_LISTBSS; | 7140 | cmd.cmd=CMD_LISTBSS; |
6987 | if (down_interruptible(&ai->sem)) | ||
6988 | return -ERESTARTSYS; | ||
6989 | issuecommand(ai, &cmd, &rsp); | 7141 | issuecommand(ai, &cmd, &rsp); |
6990 | ai->scan_timestamp = jiffies; | 7142 | ai->scan_timeout = RUN_AT(3*HZ); |
6991 | up(&ai->sem); | 7143 | wake = 1; |
6992 | |||
6993 | /* At this point, just return to the user. */ | ||
6994 | 7144 | ||
7145 | out: | ||
7146 | up(&ai->sem); | ||
7147 | if (wake) | ||
7148 | wake_up_interruptible(&ai->thr_wait); | ||
6995 | return 0; | 7149 | return 0; |
6996 | } | 7150 | } |
6997 | 7151 | ||
@@ -7111,59 +7265,38 @@ static int airo_get_scan(struct net_device *dev, | |||
7111 | char *extra) | 7265 | char *extra) |
7112 | { | 7266 | { |
7113 | struct airo_info *ai = dev->priv; | 7267 | struct airo_info *ai = dev->priv; |
7114 | BSSListRid BSSList; | 7268 | BSSListElement *net; |
7115 | int rc; | 7269 | int err = 0; |
7116 | char *current_ev = extra; | 7270 | char *current_ev = extra; |
7117 | 7271 | ||
7118 | /* When we are associated again, the scan has surely finished. | 7272 | /* If a scan is in-progress, return -EAGAIN */ |
7119 | * Just in case, let's make sure enough time has elapsed since | 7273 | if (ai->scan_timeout > 0) |
7120 | * we started the scan. - Javier */ | ||
7121 | if(ai->scan_timestamp && time_before(jiffies,ai->scan_timestamp+3*HZ)) { | ||
7122 | /* Important note : we don't want to block the caller | ||
7123 | * until results are ready for various reasons. | ||
7124 | * First, managing wait queues is complex and racy | ||
7125 | * (there may be multiple simultaneous callers). | ||
7126 | * Second, we grab some rtnetlink lock before comming | ||
7127 | * here (in dev_ioctl()). | ||
7128 | * Third, the caller can wait on the Wireless Event | ||
7129 | * - Jean II */ | ||
7130 | return -EAGAIN; | 7274 | return -EAGAIN; |
7131 | } | ||
7132 | ai->scan_timestamp = 0; | ||
7133 | 7275 | ||
7134 | /* There's only a race with proc_BSSList_open(), but its | 7276 | if (down_interruptible(&ai->sem)) |
7135 | * consequences are begnign. So I don't bother fixing it - Javier */ | 7277 | return -EAGAIN; |
7136 | |||
7137 | /* Try to read the first entry of the scan result */ | ||
7138 | rc = PC4500_readrid(ai, RID_BSSLISTFIRST, &BSSList, sizeof(BSSList), 1); | ||
7139 | if((rc) || (BSSList.index == 0xffff)) { | ||
7140 | /* Client error, no scan results... | ||
7141 | * The caller need to restart the scan. */ | ||
7142 | return -ENODATA; | ||
7143 | } | ||
7144 | 7278 | ||
7145 | /* Read and parse all entries */ | 7279 | list_for_each_entry (net, &ai->network_list, list) { |
7146 | while((!rc) && (BSSList.index != 0xffff)) { | ||
7147 | /* Translate to WE format this entry */ | 7280 | /* Translate to WE format this entry */ |
7148 | current_ev = airo_translate_scan(dev, current_ev, | 7281 | current_ev = airo_translate_scan(dev, current_ev, |
7149 | extra + dwrq->length, | 7282 | extra + dwrq->length, |
7150 | &BSSList); | 7283 | &net->bss); |
7151 | 7284 | ||
7152 | /* Check if there is space for one more entry */ | 7285 | /* Check if there is space for one more entry */ |
7153 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { | 7286 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { |
7154 | /* Ask user space to try again with a bigger buffer */ | 7287 | /* Ask user space to try again with a bigger buffer */ |
7155 | return -E2BIG; | 7288 | err = -E2BIG; |
7289 | goto out; | ||
7156 | } | 7290 | } |
7157 | |||
7158 | /* Read next entry */ | ||
7159 | rc = PC4500_readrid(ai, RID_BSSLISTNEXT, | ||
7160 | &BSSList, sizeof(BSSList), 1); | ||
7161 | } | 7291 | } |
7292 | |||
7162 | /* Length of data */ | 7293 | /* Length of data */ |
7163 | dwrq->length = (current_ev - extra); | 7294 | dwrq->length = (current_ev - extra); |
7164 | dwrq->flags = 0; /* todo */ | 7295 | dwrq->flags = 0; /* todo */ |
7165 | 7296 | ||
7166 | return 0; | 7297 | out: |
7298 | up(&ai->sem); | ||
7299 | return err; | ||
7167 | } | 7300 | } |
7168 | 7301 | ||
7169 | /*------------------------------------------------------------------*/ | 7302 | /*------------------------------------------------------------------*/ |
@@ -7711,7 +7844,7 @@ static int cmdreset(struct airo_info *ai) { | |||
7711 | disable_MAC(ai, 1); | 7844 | disable_MAC(ai, 1); |
7712 | 7845 | ||
7713 | if(!waitbusy (ai)){ | 7846 | if(!waitbusy (ai)){ |
7714 | printk(KERN_INFO "Waitbusy hang before RESET\n"); | 7847 | airo_print_info(ai->dev->name, "Waitbusy hang before RESET"); |
7715 | return -EBUSY; | 7848 | return -EBUSY; |
7716 | } | 7849 | } |
7717 | 7850 | ||
@@ -7720,7 +7853,7 @@ static int cmdreset(struct airo_info *ai) { | |||
7720 | ssleep(1); /* WAS 600 12/7/00 */ | 7853 | ssleep(1); /* WAS 600 12/7/00 */ |
7721 | 7854 | ||
7722 | if(!waitbusy (ai)){ | 7855 | if(!waitbusy (ai)){ |
7723 | printk(KERN_INFO "Waitbusy hang AFTER RESET\n"); | 7856 | airo_print_info(ai->dev->name, "Waitbusy hang AFTER RESET"); |
7724 | return -EBUSY; | 7857 | return -EBUSY; |
7725 | } | 7858 | } |
7726 | return 0; | 7859 | return 0; |
@@ -7748,7 +7881,7 @@ static int setflashmode (struct airo_info *ai) { | |||
7748 | 7881 | ||
7749 | if(!waitbusy(ai)) { | 7882 | if(!waitbusy(ai)) { |
7750 | clear_bit (FLAG_FLASHING, &ai->flags); | 7883 | clear_bit (FLAG_FLASHING, &ai->flags); |
7751 | printk(KERN_INFO "Waitbusy hang after setflash mode\n"); | 7884 | airo_print_info(ai->dev->name, "Waitbusy hang after setflash mode"); |
7752 | return -EIO; | 7885 | return -EIO; |
7753 | } | 7886 | } |
7754 | return 0; | 7887 | return 0; |
@@ -7777,7 +7910,7 @@ static int flashpchar(struct airo_info *ai,int byte,int dwelltime) { | |||
7777 | 7910 | ||
7778 | /* timeout for busy clear wait */ | 7911 | /* timeout for busy clear wait */ |
7779 | if(waittime <= 0 ){ | 7912 | if(waittime <= 0 ){ |
7780 | printk(KERN_INFO "flash putchar busywait timeout! \n"); | 7913 | airo_print_info(ai->dev->name, "flash putchar busywait timeout!"); |
7781 | return -EBUSY; | 7914 | return -EBUSY; |
7782 | } | 7915 | } |
7783 | 7916 | ||
@@ -7866,7 +7999,7 @@ static int flashrestart(struct airo_info *ai,struct net_device *dev){ | |||
7866 | if (!test_bit(FLAG_MPI,&ai->flags)) | 7999 | if (!test_bit(FLAG_MPI,&ai->flags)) |
7867 | for( i = 0; i < MAX_FIDS; i++ ) { | 8000 | for( i = 0; i < MAX_FIDS; i++ ) { |
7868 | ai->fids[i] = transmit_allocate | 8001 | ai->fids[i] = transmit_allocate |
7869 | ( ai, 2312, i >= MAX_FIDS / 2 ); | 8002 | ( ai, AIRO_DEF_MTU, i >= MAX_FIDS / 2 ); |
7870 | } | 8003 | } |
7871 | 8004 | ||
7872 | ssleep(1); /* Added 12/7/00 */ | 8005 | ssleep(1); /* Added 12/7/00 */ |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 753a1de6664b..06c3fa32b310 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -3141,7 +3141,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) | |||
3141 | if (ret == 1) { | 3141 | if (ret == 1) { |
3142 | sta = ap_add_sta(ap, sta_addr); | 3142 | sta = ap_add_sta(ap, sta_addr); |
3143 | if (!sta) | 3143 | if (!sta) |
3144 | ret = -1; | 3144 | return -1; |
3145 | sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; | 3145 | sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; |
3146 | sta->ap = 1; | 3146 | sta->ap = 1; |
3147 | memset(sta->supported_rates, 0, sizeof(sta->supported_rates)); | 3147 | memset(sta->supported_rates, 0, sizeof(sta->supported_rates)); |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index f8f4503475f9..d335b250923a 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -585,8 +585,6 @@ static int prism2_config(dev_link_t *link) | |||
585 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); | 585 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); |
586 | hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); | 586 | hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); |
587 | if (parse == NULL || hw_priv == NULL) { | 587 | if (parse == NULL || hw_priv == NULL) { |
588 | kfree(parse); | ||
589 | kfree(hw_priv); | ||
590 | ret = -ENOMEM; | 588 | ret = -ENOMEM; |
591 | goto failed; | 589 | goto failed; |
592 | } | 590 | } |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index b1f142d9e232..328e9a1d13b5 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -928,15 +928,15 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len) | |||
928 | 928 | ||
929 | res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL); | 929 | res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL); |
930 | up(&local->rid_bap_sem); | 930 | up(&local->rid_bap_sem); |
931 | |||
931 | if (res) { | 932 | if (res) { |
932 | printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE " | 933 | printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE " |
933 | "failed (res=%d, rid=%04x, len=%d)\n", | 934 | "failed (res=%d, rid=%04x, len=%d)\n", |
934 | dev->name, res, rid, len); | 935 | dev->name, res, rid, len); |
935 | return res; | ||
936 | } | ||
937 | 936 | ||
938 | if (res == -ETIMEDOUT) | 937 | if (res == -ETIMEDOUT) |
939 | prism2_hw_reset(dev); | 938 | prism2_hw_reset(dev); |
939 | } | ||
940 | 940 | ||
941 | return res; | 941 | return res; |
942 | } | 942 | } |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index f3e0ce1ee037..8b37e824dfcb 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -3358,10 +3358,6 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev, | |||
3358 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | 3358 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { |
3359 | if (!sta_ptr) | 3359 | if (!sta_ptr) |
3360 | local->tx_keyidx = i; | 3360 | local->tx_keyidx = i; |
3361 | else if (i) { | ||
3362 | ret = -EINVAL; | ||
3363 | goto done; | ||
3364 | } | ||
3365 | } | 3361 | } |
3366 | 3362 | ||
3367 | 3363 | ||
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 2e85bdced2dd..194f07097581 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -307,7 +307,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
307 | memset(hw_priv, 0, sizeof(*hw_priv)); | 307 | memset(hw_priv, 0, sizeof(*hw_priv)); |
308 | 308 | ||
309 | if (pci_enable_device(pdev)) | 309 | if (pci_enable_device(pdev)) |
310 | return -EIO; | 310 | goto err_out_free; |
311 | 311 | ||
312 | phymem = pci_resource_start(pdev, 0); | 312 | phymem = pci_resource_start(pdev, 0); |
313 | 313 | ||
@@ -368,6 +368,8 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
368 | err_out_disable: | 368 | err_out_disable: |
369 | pci_disable_device(pdev); | 369 | pci_disable_device(pdev); |
370 | prism2_free_local_data(dev); | 370 | prism2_free_local_data(dev); |
371 | |||
372 | err_out_free: | ||
371 | kfree(hw_priv); | 373 | kfree(hw_priv); |
372 | 374 | ||
373 | return -ENODEV; | 375 | return -ENODEV; |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 94fe2449f099..edaaa943eb8f 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -368,7 +368,7 @@ static int prism2_plx_check_cis(void __iomem *attr_mem, int attr_len, | |||
368 | 368 | ||
369 | switch (cis[pos]) { | 369 | switch (cis[pos]) { |
370 | case CISTPL_CONFIG: | 370 | case CISTPL_CONFIG: |
371 | if (cis[pos + 1] < 1) | 371 | if (cis[pos + 1] < 2) |
372 | goto cis_error; | 372 | goto cis_error; |
373 | rmsz = (cis[pos + 2] & 0x3c) >> 2; | 373 | rmsz = (cis[pos + 2] & 0x3c) >> 2; |
374 | rasz = cis[pos + 2] & 0x03; | 374 | rasz = cis[pos + 2] & 0x03; |
@@ -390,7 +390,7 @@ static int prism2_plx_check_cis(void __iomem *attr_mem, int attr_len, | |||
390 | break; | 390 | break; |
391 | 391 | ||
392 | case CISTPL_MANFID: | 392 | case CISTPL_MANFID: |
393 | if (cis[pos + 1] < 4) | 393 | if (cis[pos + 1] < 5) |
394 | goto cis_error; | 394 | goto cis_error; |
395 | manfid1 = cis[pos + 2] + (cis[pos + 3] << 8); | 395 | manfid1 = cis[pos + 2] + (cis[pos + 3] << 8); |
396 | manfid2 = cis[pos + 4] + (cis[pos + 5] << 8); | 396 | manfid2 = cis[pos + 4] + (cis[pos + 5] << 8); |
@@ -452,7 +452,7 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
452 | memset(hw_priv, 0, sizeof(*hw_priv)); | 452 | memset(hw_priv, 0, sizeof(*hw_priv)); |
453 | 453 | ||
454 | if (pci_enable_device(pdev)) | 454 | if (pci_enable_device(pdev)) |
455 | return -EIO; | 455 | goto err_out_free; |
456 | 456 | ||
457 | /* National Datacomm NCP130 based on TMD7160, not PLX9052. */ | 457 | /* National Datacomm NCP130 based on TMD7160, not PLX9052. */ |
458 | tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131); | 458 | tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131); |
@@ -567,9 +567,6 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
567 | return hostap_hw_ready(dev); | 567 | return hostap_hw_ready(dev); |
568 | 568 | ||
569 | fail: | 569 | fail: |
570 | prism2_free_local_data(dev); | ||
571 | kfree(hw_priv); | ||
572 | |||
573 | if (irq_registered && dev) | 570 | if (irq_registered && dev) |
574 | free_irq(dev->irq, dev); | 571 | free_irq(dev->irq, dev); |
575 | 572 | ||
@@ -577,6 +574,10 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
577 | iounmap(attr_mem); | 574 | iounmap(attr_mem); |
578 | 575 | ||
579 | pci_disable_device(pdev); | 576 | pci_disable_device(pdev); |
577 | prism2_free_local_data(dev); | ||
578 | |||
579 | err_out_free: | ||
580 | kfree(hw_priv); | ||
580 | 581 | ||
581 | return -ENODEV; | 582 | return -ENODEV; |
582 | } | 583 | } |