diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-10-19 22:17:52 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-10-19 22:17:52 -0400 |
commit | 4cb40f795af36b3deb743f6ccf6c3fd542c61c8d (patch) | |
tree | db3d7519932549bf528f5b8e4cb8350356cd544d /drivers/net/wireless/iwlwifi | |
parent | 79ed2a9216dd3cc35c4f2c5dbaddadb195af83ac (diff) | |
parent | 0cfd81031a26717fe14380d18275f8e217571615 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
Documentation/kernel-parameters.txt
arch/sh/include/asm/elf.h
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
30 files changed, 1010 insertions, 1269 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h index f1d002f7b790..33016fb5e9b3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h | |||
@@ -34,12 +34,12 @@ extern u32 iwl3945_debug_level; | |||
34 | #define IWL_DEBUG(level, fmt, args...) \ | 34 | #define IWL_DEBUG(level, fmt, args...) \ |
35 | do { if (iwl3945_debug_level & (level)) \ | 35 | do { if (iwl3945_debug_level & (level)) \ |
36 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ | 36 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ |
37 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 37 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) |
38 | 38 | ||
39 | #define IWL_DEBUG_LIMIT(level, fmt, args...) \ | 39 | #define IWL_DEBUG_LIMIT(level, fmt, args...) \ |
40 | do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \ | 40 | do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \ |
41 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ | 41 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ |
42 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 42 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) |
43 | 43 | ||
44 | static inline void iwl3945_print_hex_dump(int level, void *p, u32 len) | 44 | static inline void iwl3945_print_hex_dump(int level, void *p, u32 len) |
45 | { | 45 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index 0b9475114618..b3fe48de3ae7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h | |||
@@ -59,7 +59,7 @@ | |||
59 | * | 59 | * |
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define _iwl3945_write32(priv, ofs, val) writel((val), (priv)->hw_base + (ofs)) | 62 | #define _iwl3945_write32(priv, ofs, val) iowrite32((val), (priv)->hw_base + (ofs)) |
63 | #ifdef CONFIG_IWL3945_DEBUG | 63 | #ifdef CONFIG_IWL3945_DEBUG |
64 | static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *priv, | 64 | static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *priv, |
65 | u32 ofs, u32 val) | 65 | u32 ofs, u32 val) |
@@ -73,14 +73,14 @@ static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv * | |||
73 | #define iwl3945_write32(priv, ofs, val) _iwl3945_write32(priv, ofs, val) | 73 | #define iwl3945_write32(priv, ofs, val) _iwl3945_write32(priv, ofs, val) |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #define _iwl3945_read32(priv, ofs) readl((priv)->hw_base + (ofs)) | 76 | #define _iwl3945_read32(priv, ofs) ioread32((priv)->hw_base + (ofs)) |
77 | #ifdef CONFIG_IWL3945_DEBUG | 77 | #ifdef CONFIG_IWL3945_DEBUG |
78 | static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *priv, u32 ofs) | 78 | static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *priv, u32 ofs) |
79 | { | 79 | { |
80 | IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); | 80 | IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); |
81 | return _iwl3945_read32(priv, ofs); | 81 | return _iwl3945_read32(priv, ofs); |
82 | } | 82 | } |
83 | #define iwl3945_read32(priv, ofs) __iwl3945_read32(__FILE__, __LINE__, priv, ofs) | 83 | #define iwl3945_read32(priv, ofs)__iwl3945_read32(__FILE__, __LINE__, priv, ofs) |
84 | #else | 84 | #else |
85 | #define iwl3945_read32(p, o) _iwl3945_read32(p, o) | 85 | #define iwl3945_read32(p, o) _iwl3945_read32(p, o) |
86 | #endif | 86 | #endif |
@@ -153,28 +153,10 @@ static inline void __iwl3945_clear_bit(const char *f, u32 l, | |||
153 | static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv) | 153 | static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv) |
154 | { | 154 | { |
155 | int ret; | 155 | int ret; |
156 | u32 gp_ctl; | ||
157 | |||
158 | #ifdef CONFIG_IWL3945_DEBUG | 156 | #ifdef CONFIG_IWL3945_DEBUG |
159 | if (atomic_read(&priv->restrict_refcnt)) | 157 | if (atomic_read(&priv->restrict_refcnt)) |
160 | return 0; | 158 | return 0; |
161 | #endif | 159 | #endif |
162 | if (test_bit(STATUS_RF_KILL_HW, &priv->status) || | ||
163 | test_bit(STATUS_RF_KILL_SW, &priv->status)) { | ||
164 | IWL_WARNING("WARNING: Requesting MAC access during RFKILL " | ||
165 | "wakes up NIC\n"); | ||
166 | |||
167 | /* 10 msec allows time for NIC to complete its data save */ | ||
168 | gp_ctl = _iwl3945_read32(priv, CSR_GP_CNTRL); | ||
169 | if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { | ||
170 | IWL_DEBUG_RF_KILL("Wait for complete power-down, " | ||
171 | "gpctl = 0x%08x\n", gp_ctl); | ||
172 | mdelay(10); | ||
173 | } else | ||
174 | IWL_DEBUG_RF_KILL("power-down complete, " | ||
175 | "gpctl = 0x%08x\n", gp_ctl); | ||
176 | } | ||
177 | |||
178 | /* this bit wakes up the NIC */ | 160 | /* this bit wakes up the NIC */ |
179 | _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 161 | _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
180 | ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL, | 162 | ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 10c64bdb314c..6fc5e7361f26 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -36,8 +36,6 @@ | |||
36 | 36 | ||
37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
38 | 38 | ||
39 | #include "../net/mac80211/rate.h" | ||
40 | |||
41 | #include "iwl-3945.h" | 39 | #include "iwl-3945.h" |
42 | 40 | ||
43 | #define RS_NAME "iwl-3945-rs" | 41 | #define RS_NAME "iwl-3945-rs" |
@@ -65,6 +63,9 @@ struct iwl3945_rs_sta { | |||
65 | u8 ibss_sta_added; | 63 | u8 ibss_sta_added; |
66 | struct timer_list rate_scale_flush; | 64 | struct timer_list rate_scale_flush; |
67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; | 65 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; |
66 | |||
67 | /* used to be in sta_info */ | ||
68 | int last_txrate_idx; | ||
68 | }; | 69 | }; |
69 | 70 | ||
70 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { | 71 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { |
@@ -316,9 +317,10 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
316 | } | 317 | } |
317 | } | 318 | } |
318 | 319 | ||
319 | static void rs_rate_init(void *priv_rate, void *priv_sta, | 320 | static void rs_rate_init(void *priv, struct ieee80211_supported_band *sband, |
320 | struct ieee80211_local *local, struct sta_info *sta) | 321 | struct ieee80211_sta *sta, void *priv_sta) |
321 | { | 322 | { |
323 | struct iwl3945_rs_sta *rs_sta = priv_sta; | ||
322 | int i; | 324 | int i; |
323 | 325 | ||
324 | IWL_DEBUG_RATE("enter\n"); | 326 | IWL_DEBUG_RATE("enter\n"); |
@@ -329,24 +331,22 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
329 | * after assoc.. */ | 331 | * after assoc.. */ |
330 | 332 | ||
331 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { | 333 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { |
332 | if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) { | 334 | if (sta->supp_rates[sband->band] & (1 << i)) { |
333 | sta->txrate_idx = i; | 335 | rs_sta->last_txrate_idx = i; |
334 | break; | 336 | break; |
335 | } | 337 | } |
336 | } | 338 | } |
337 | 339 | ||
338 | sta->last_txrate_idx = sta->txrate_idx; | ||
339 | |||
340 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ | 340 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ |
341 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 341 | if (sband->band == IEEE80211_BAND_5GHZ) |
342 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 342 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
343 | 343 | ||
344 | IWL_DEBUG_RATE("leave\n"); | 344 | IWL_DEBUG_RATE("leave\n"); |
345 | } | 345 | } |
346 | 346 | ||
347 | static void *rs_alloc(struct ieee80211_local *local) | 347 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
348 | { | 348 | { |
349 | return local->hw.priv; | 349 | return hw->priv; |
350 | } | 350 | } |
351 | 351 | ||
352 | /* rate scale requires free function to be implemented */ | 352 | /* rate scale requires free function to be implemented */ |
@@ -354,17 +354,24 @@ static void rs_free(void *priv) | |||
354 | { | 354 | { |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | |||
357 | static void rs_clear(void *priv) | 358 | static void rs_clear(void *priv) |
358 | { | 359 | { |
359 | return; | 360 | return; |
360 | } | 361 | } |
361 | 362 | ||
362 | 363 | ||
363 | static void *rs_alloc_sta(void *priv, gfp_t gfp) | 364 | static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) |
364 | { | 365 | { |
365 | struct iwl3945_rs_sta *rs_sta; | 366 | struct iwl3945_rs_sta *rs_sta; |
367 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | ||
366 | int i; | 368 | int i; |
367 | 369 | ||
370 | /* | ||
371 | * XXX: If it's using sta->drv_priv anyway, it might | ||
372 | * as well just put all the information there. | ||
373 | */ | ||
374 | |||
368 | IWL_DEBUG_RATE("enter\n"); | 375 | IWL_DEBUG_RATE("enter\n"); |
369 | 376 | ||
370 | rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); | 377 | rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); |
@@ -373,6 +380,8 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp) | |||
373 | return NULL; | 380 | return NULL; |
374 | } | 381 | } |
375 | 382 | ||
383 | psta->rs_sta = rs_sta; | ||
384 | |||
376 | spin_lock_init(&rs_sta->lock); | 385 | spin_lock_init(&rs_sta->lock); |
377 | 386 | ||
378 | rs_sta->start_rate = IWL_RATE_INVALID; | 387 | rs_sta->start_rate = IWL_RATE_INVALID; |
@@ -398,10 +407,14 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp) | |||
398 | return rs_sta; | 407 | return rs_sta; |
399 | } | 408 | } |
400 | 409 | ||
401 | static void rs_free_sta(void *priv, void *priv_sta) | 410 | static void rs_free_sta(void *priv, struct ieee80211_sta *sta, |
411 | void *priv_sta) | ||
402 | { | 412 | { |
413 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | ||
403 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 414 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
404 | 415 | ||
416 | psta->rs_sta = NULL; | ||
417 | |||
405 | IWL_DEBUG_RATE("enter\n"); | 418 | IWL_DEBUG_RATE("enter\n"); |
406 | del_timer_sync(&rs_sta->rate_scale_flush); | 419 | del_timer_sync(&rs_sta->rate_scale_flush); |
407 | kfree(rs_sta); | 420 | kfree(rs_sta); |
@@ -443,26 +456,19 @@ static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate) | |||
443 | * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by | 456 | * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by |
444 | * the hardware for each rate. | 457 | * the hardware for each rate. |
445 | */ | 458 | */ |
446 | static void rs_tx_status(void *priv_rate, | 459 | static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, |
447 | struct net_device *dev, | 460 | struct ieee80211_sta *sta, void *priv_sta, |
448 | struct sk_buff *skb) | 461 | struct sk_buff *skb) |
449 | { | 462 | { |
450 | u8 retries, current_count; | 463 | u8 retries, current_count; |
451 | int scale_rate_index, first_index, last_index; | 464 | int scale_rate_index, first_index, last_index; |
452 | unsigned long flags; | 465 | unsigned long flags; |
453 | struct sta_info *sta; | ||
454 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
455 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; | 466 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; |
456 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 467 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
457 | struct iwl3945_rs_sta *rs_sta; | ||
458 | struct ieee80211_supported_band *sband; | ||
459 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 468 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
460 | 469 | ||
461 | IWL_DEBUG_RATE("enter\n"); | 470 | IWL_DEBUG_RATE("enter\n"); |
462 | 471 | ||
463 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
464 | |||
465 | |||
466 | retries = info->status.retry_count; | 472 | retries = info->status.retry_count; |
467 | first_index = sband->bitrates[info->tx_rate_idx].hw_value; | 473 | first_index = sband->bitrates[info->tx_rate_idx].hw_value; |
468 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { | 474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { |
@@ -470,17 +476,11 @@ static void rs_tx_status(void *priv_rate, | |||
470 | return; | 476 | return; |
471 | } | 477 | } |
472 | 478 | ||
473 | rcu_read_lock(); | 479 | if (!priv_sta) { |
474 | |||
475 | sta = sta_info_get(local, hdr->addr1); | ||
476 | if (!sta || !sta->rate_ctrl_priv) { | ||
477 | rcu_read_unlock(); | ||
478 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); | 480 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); |
479 | return; | 481 | return; |
480 | } | 482 | } |
481 | 483 | ||
482 | rs_sta = (void *)sta->rate_ctrl_priv; | ||
483 | |||
484 | rs_sta->tx_packets++; | 484 | rs_sta->tx_packets++; |
485 | 485 | ||
486 | scale_rate_index = first_index; | 486 | scale_rate_index = first_index; |
@@ -547,8 +547,6 @@ static void rs_tx_status(void *priv_rate, | |||
547 | 547 | ||
548 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 548 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
549 | 549 | ||
550 | rcu_read_unlock(); | ||
551 | |||
552 | IWL_DEBUG_RATE("leave\n"); | 550 | IWL_DEBUG_RATE("leave\n"); |
553 | 551 | ||
554 | return; | 552 | return; |
@@ -632,16 +630,15 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
632 | * rate table and must reference the driver allocated rate table | 630 | * rate table and must reference the driver allocated rate table |
633 | * | 631 | * |
634 | */ | 632 | */ |
635 | static void rs_get_rate(void *priv_rate, struct net_device *dev, | 633 | static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, |
636 | struct ieee80211_supported_band *sband, | 634 | struct ieee80211_sta *sta, void *priv_sta, |
637 | struct sk_buff *skb, | 635 | struct sk_buff *skb, struct rate_selection *sel) |
638 | struct rate_selection *sel) | ||
639 | { | 636 | { |
640 | u8 low = IWL_RATE_INVALID; | 637 | u8 low = IWL_RATE_INVALID; |
641 | u8 high = IWL_RATE_INVALID; | 638 | u8 high = IWL_RATE_INVALID; |
642 | u16 high_low; | 639 | u16 high_low; |
643 | int index; | 640 | int index; |
644 | struct iwl3945_rs_sta *rs_sta; | 641 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
645 | struct iwl3945_rate_scale_data *window = NULL; | 642 | struct iwl3945_rate_scale_data *window = NULL; |
646 | int current_tpt = IWL_INV_TPT; | 643 | int current_tpt = IWL_INV_TPT; |
647 | int low_tpt = IWL_INV_TPT; | 644 | int low_tpt = IWL_INV_TPT; |
@@ -649,40 +646,31 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
649 | u32 fail_count; | 646 | u32 fail_count; |
650 | s8 scale_action = 0; | 647 | s8 scale_action = 0; |
651 | unsigned long flags; | 648 | unsigned long flags; |
652 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
653 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 649 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
654 | struct sta_info *sta; | ||
655 | u16 fc, rate_mask; | 650 | u16 fc, rate_mask; |
656 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; | 651 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; |
657 | DECLARE_MAC_BUF(mac); | 652 | DECLARE_MAC_BUF(mac); |
658 | 653 | ||
659 | IWL_DEBUG_RATE("enter\n"); | 654 | IWL_DEBUG_RATE("enter\n"); |
660 | 655 | ||
661 | rcu_read_lock(); | ||
662 | |||
663 | sta = sta_info_get(local, hdr->addr1); | ||
664 | |||
665 | /* Send management frames and broadcast/multicast data using lowest | 656 | /* Send management frames and broadcast/multicast data using lowest |
666 | * rate. */ | 657 | * rate. */ |
667 | fc = le16_to_cpu(hdr->frame_control); | 658 | fc = le16_to_cpu(hdr->frame_control); |
668 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | 659 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || |
669 | is_multicast_ether_addr(hdr->addr1) || | 660 | is_multicast_ether_addr(hdr->addr1) || |
670 | !sta || !sta->rate_ctrl_priv) { | 661 | !sta || !priv_sta) { |
671 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); | 662 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); |
672 | sel->rate_idx = rate_lowest_index(local, sband, sta); | 663 | sel->rate_idx = rate_lowest_index(sband, sta); |
673 | rcu_read_unlock(); | ||
674 | return; | 664 | return; |
675 | } | 665 | } |
676 | 666 | ||
677 | rate_mask = sta->supp_rates[sband->band]; | 667 | rate_mask = sta->supp_rates[sband->band]; |
678 | index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); | 668 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); |
679 | 669 | ||
680 | if (sband->band == IEEE80211_BAND_5GHZ) | 670 | if (sband->band == IEEE80211_BAND_5GHZ) |
681 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | 671 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; |
682 | 672 | ||
683 | rs_sta = (void *)sta->rate_ctrl_priv; | 673 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
684 | |||
685 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | ||
686 | !rs_sta->ibss_sta_added) { | 674 | !rs_sta->ibss_sta_added) { |
687 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 675 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
688 | 676 | ||
@@ -803,17 +791,13 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
803 | 791 | ||
804 | out: | 792 | out: |
805 | 793 | ||
806 | sta->last_txrate_idx = index; | 794 | rs_sta->last_txrate_idx = index; |
807 | if (sband->band == IEEE80211_BAND_5GHZ) | 795 | if (sband->band == IEEE80211_BAND_5GHZ) |
808 | sta->txrate_idx = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; | 796 | sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; |
809 | else | 797 | else |
810 | sta->txrate_idx = sta->last_txrate_idx; | 798 | sel->rate_idx = rs_sta->last_txrate_idx; |
811 | |||
812 | rcu_read_unlock(); | ||
813 | 799 | ||
814 | IWL_DEBUG_RATE("leave: %d\n", index); | 800 | IWL_DEBUG_RATE("leave: %d\n", index); |
815 | |||
816 | sel->rate_idx = sta->txrate_idx; | ||
817 | } | 801 | } |
818 | 802 | ||
819 | static struct rate_control_ops rs_ops = { | 803 | static struct rate_control_ops rs_ops = { |
@@ -829,114 +813,28 @@ static struct rate_control_ops rs_ops = { | |||
829 | .free_sta = rs_free_sta, | 813 | .free_sta = rs_free_sta, |
830 | }; | 814 | }; |
831 | 815 | ||
832 | int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | ||
833 | { | ||
834 | struct ieee80211_local *local = hw_to_local(hw); | ||
835 | struct iwl3945_priv *priv = hw->priv; | ||
836 | struct iwl3945_rs_sta *rs_sta; | ||
837 | struct sta_info *sta; | ||
838 | unsigned long flags; | ||
839 | int count = 0, i; | ||
840 | u32 samples = 0, success = 0, good = 0; | ||
841 | unsigned long now = jiffies; | ||
842 | u32 max_time = 0; | ||
843 | |||
844 | rcu_read_lock(); | ||
845 | |||
846 | sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); | ||
847 | if (!sta || !sta->rate_ctrl_priv) { | ||
848 | if (sta) | ||
849 | IWL_DEBUG_RATE("leave - no private rate data!\n"); | ||
850 | else | ||
851 | IWL_DEBUG_RATE("leave - no station!\n"); | ||
852 | rcu_read_unlock(); | ||
853 | return sprintf(buf, "station %d not found\n", sta_id); | ||
854 | } | ||
855 | |||
856 | rs_sta = (void *)sta->rate_ctrl_priv; | ||
857 | spin_lock_irqsave(&rs_sta->lock, flags); | ||
858 | i = IWL_RATE_54M_INDEX; | ||
859 | while (1) { | ||
860 | u64 mask; | ||
861 | int j; | ||
862 | |||
863 | count += | ||
864 | sprintf(&buf[count], " %2dMbs: ", iwl3945_rates[i].ieee / 2); | ||
865 | |||
866 | mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); | ||
867 | for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) | ||
868 | buf[count++] = | ||
869 | (rs_sta->win[i].data & mask) ? '1' : '0'; | ||
870 | |||
871 | samples += rs_sta->win[i].counter; | ||
872 | good += rs_sta->win[i].success_counter; | ||
873 | success += rs_sta->win[i].success_counter * | ||
874 | iwl3945_rates[i].ieee; | ||
875 | |||
876 | if (rs_sta->win[i].stamp) { | ||
877 | int delta = | ||
878 | jiffies_to_msecs(now - rs_sta->win[i].stamp); | ||
879 | |||
880 | if (delta > max_time) | ||
881 | max_time = delta; | ||
882 | |||
883 | count += sprintf(&buf[count], "%5dms\n", delta); | ||
884 | } else | ||
885 | buf[count++] = '\n'; | ||
886 | |||
887 | j = iwl3945_get_prev_ieee_rate(i); | ||
888 | if (j == i) | ||
889 | break; | ||
890 | i = j; | ||
891 | } | ||
892 | spin_unlock_irqrestore(&rs_sta->lock, flags); | ||
893 | rcu_read_unlock(); | ||
894 | |||
895 | /* Display the average rate of all samples taken. | ||
896 | * | ||
897 | * NOTE: We multiple # of samples by 2 since the IEEE measurement | ||
898 | * added from iwl3945_rates is actually 2X the rate */ | ||
899 | if (samples) | ||
900 | count += sprintf( | ||
901 | &buf[count], | ||
902 | "\nAverage rate is %3d.%02dMbs over last %4dms\n" | ||
903 | "%3d%% success (%d good packets over %d tries)\n", | ||
904 | success / (2 * samples), (success * 5 / samples) % 10, | ||
905 | max_time, good * 100 / samples, good, samples); | ||
906 | else | ||
907 | count += sprintf(&buf[count], "\nAverage rate: 0Mbs\n"); | ||
908 | |||
909 | return count; | ||
910 | } | ||
911 | |||
912 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | 816 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) |
913 | { | 817 | { |
914 | struct iwl3945_priv *priv = hw->priv; | 818 | struct iwl3945_priv *priv = hw->priv; |
915 | s32 rssi = 0; | 819 | s32 rssi = 0; |
916 | unsigned long flags; | 820 | unsigned long flags; |
917 | struct ieee80211_local *local = hw_to_local(hw); | ||
918 | struct iwl3945_rs_sta *rs_sta; | 821 | struct iwl3945_rs_sta *rs_sta; |
919 | struct sta_info *sta; | 822 | struct ieee80211_sta *sta; |
823 | struct iwl3945_sta_priv *psta; | ||
920 | 824 | ||
921 | IWL_DEBUG_RATE("enter\n"); | 825 | IWL_DEBUG_RATE("enter\n"); |
922 | 826 | ||
923 | if (!local->rate_ctrl->ops->name || | ||
924 | strcmp(local->rate_ctrl->ops->name, RS_NAME)) { | ||
925 | IWL_WARNING("iwl-3945-rs not selected as rate control algo!\n"); | ||
926 | IWL_DEBUG_RATE("leave - mac80211 picked the wrong RC algo.\n"); | ||
927 | return; | ||
928 | } | ||
929 | |||
930 | rcu_read_lock(); | 827 | rcu_read_lock(); |
931 | 828 | ||
932 | sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); | 829 | sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr); |
933 | if (!sta || !sta->rate_ctrl_priv) { | 830 | psta = (void *) sta->drv_priv; |
831 | if (!sta || !psta) { | ||
934 | IWL_DEBUG_RATE("leave - no private rate data!\n"); | 832 | IWL_DEBUG_RATE("leave - no private rate data!\n"); |
935 | rcu_read_unlock(); | 833 | rcu_read_unlock(); |
936 | return; | 834 | return; |
937 | } | 835 | } |
938 | 836 | ||
939 | rs_sta = (void *)sta->rate_ctrl_priv; | 837 | rs_sta = psta->rs_sta; |
940 | 838 | ||
941 | spin_lock_irqsave(&rs_sta->lock, flags); | 839 | spin_lock_irqsave(&rs_sta->lock, flags); |
942 | 840 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index f085d330bdcf..98b17ae6ef24 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h | |||
@@ -176,15 +176,6 @@ static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index) | |||
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * iwl3945_fill_rs_info - Fill an output text buffer with the rate representation | ||
180 | * | ||
181 | * NOTE: This is provided as a quick mechanism for a user to visualize | ||
182 | * the performance of the rate control algorithm and is not meant to be | ||
183 | * parsed software. | ||
184 | */ | ||
185 | extern int iwl3945_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); | ||
186 | |||
187 | /** | ||
188 | * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info | 179 | * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info |
189 | * | 180 | * |
190 | * The specific throughput table used is based on the type of network | 181 | * The specific throughput table used is based on the type of network |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 3f51f3635344..7ca5627cc078 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -520,10 +520,10 @@ static int iwl3945_is_network_packet(struct iwl3945_priv *priv, | |||
520 | /* Filter incoming packets to determine if they are targeted toward | 520 | /* Filter incoming packets to determine if they are targeted toward |
521 | * this network, discarding packets coming from ourselves */ | 521 | * this network, discarding packets coming from ourselves */ |
522 | switch (priv->iw_mode) { | 522 | switch (priv->iw_mode) { |
523 | case IEEE80211_IF_TYPE_IBSS: /* Header: Dest. | Source | BSSID */ | 523 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ |
524 | /* packets to our IBSS update information */ | 524 | /* packets to our IBSS update information */ |
525 | return !compare_ether_addr(header->addr3, priv->bssid); | 525 | return !compare_ether_addr(header->addr3, priv->bssid); |
526 | case IEEE80211_IF_TYPE_STA: /* Header: Dest. | AP{BSSID} | Source */ | 526 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ |
527 | /* packets to our IBSS update information */ | 527 | /* packets to our IBSS update information */ |
528 | return !compare_ether_addr(header->addr2, priv->bssid); | 528 | return !compare_ether_addr(header->addr2, priv->bssid); |
529 | default: | 529 | default: |
@@ -531,99 +531,6 @@ static int iwl3945_is_network_packet(struct iwl3945_priv *priv, | |||
531 | } | 531 | } |
532 | } | 532 | } |
533 | 533 | ||
534 | static void iwl3945_add_radiotap(struct iwl3945_priv *priv, | ||
535 | struct sk_buff *skb, | ||
536 | struct iwl3945_rx_frame_hdr *rx_hdr, | ||
537 | struct ieee80211_rx_status *stats) | ||
538 | { | ||
539 | /* First cache any information we need before we overwrite | ||
540 | * the information provided in the skb from the hardware */ | ||
541 | s8 signal = stats->signal; | ||
542 | s8 noise = 0; | ||
543 | int rate = stats->rate_idx; | ||
544 | u64 tsf = stats->mactime; | ||
545 | __le16 phy_flags_hw = rx_hdr->phy_flags, antenna; | ||
546 | |||
547 | struct iwl3945_rt_rx_hdr { | ||
548 | struct ieee80211_radiotap_header rt_hdr; | ||
549 | __le64 rt_tsf; /* TSF */ | ||
550 | u8 rt_flags; /* radiotap packet flags */ | ||
551 | u8 rt_rate; /* rate in 500kb/s */ | ||
552 | __le16 rt_channelMHz; /* channel in MHz */ | ||
553 | __le16 rt_chbitmask; /* channel bitfield */ | ||
554 | s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ | ||
555 | s8 rt_dbmnoise; | ||
556 | u8 rt_antenna; /* antenna number */ | ||
557 | } __attribute__ ((packed)) *iwl3945_rt; | ||
558 | |||
559 | if (skb_headroom(skb) < sizeof(*iwl3945_rt)) { | ||
560 | if (net_ratelimit()) | ||
561 | printk(KERN_ERR "not enough headroom [%d] for " | ||
562 | "radiotap head [%zd]\n", | ||
563 | skb_headroom(skb), sizeof(*iwl3945_rt)); | ||
564 | return; | ||
565 | } | ||
566 | |||
567 | /* put radiotap header in front of 802.11 header and data */ | ||
568 | iwl3945_rt = (void *)skb_push(skb, sizeof(*iwl3945_rt)); | ||
569 | |||
570 | /* initialise radiotap header */ | ||
571 | iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
572 | iwl3945_rt->rt_hdr.it_pad = 0; | ||
573 | |||
574 | /* total header + data */ | ||
575 | put_unaligned_le16(sizeof(*iwl3945_rt), &iwl3945_rt->rt_hdr.it_len); | ||
576 | |||
577 | /* Indicate all the fields we add to the radiotap header */ | ||
578 | put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) | | ||
579 | (1 << IEEE80211_RADIOTAP_FLAGS) | | ||
580 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
581 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
582 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | ||
583 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | | ||
584 | (1 << IEEE80211_RADIOTAP_ANTENNA), | ||
585 | &iwl3945_rt->rt_hdr.it_present); | ||
586 | |||
587 | /* Zero the flags, we'll add to them as we go */ | ||
588 | iwl3945_rt->rt_flags = 0; | ||
589 | |||
590 | put_unaligned_le64(tsf, &iwl3945_rt->rt_tsf); | ||
591 | |||
592 | iwl3945_rt->rt_dbmsignal = signal; | ||
593 | iwl3945_rt->rt_dbmnoise = noise; | ||
594 | |||
595 | /* Convert the channel frequency and set the flags */ | ||
596 | put_unaligned_le16(stats->freq, &iwl3945_rt->rt_channelMHz); | ||
597 | if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) | ||
598 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ, | ||
599 | &iwl3945_rt->rt_chbitmask); | ||
600 | else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) | ||
601 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, | ||
602 | &iwl3945_rt->rt_chbitmask); | ||
603 | else /* 802.11g */ | ||
604 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, | ||
605 | &iwl3945_rt->rt_chbitmask); | ||
606 | |||
607 | if (rate == -1) | ||
608 | iwl3945_rt->rt_rate = 0; | ||
609 | else { | ||
610 | if (stats->band == IEEE80211_BAND_5GHZ) | ||
611 | rate += IWL_FIRST_OFDM_RATE; | ||
612 | |||
613 | iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; | ||
614 | } | ||
615 | |||
616 | /* antenna number */ | ||
617 | antenna = phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK; | ||
618 | iwl3945_rt->rt_antenna = le16_to_cpu(antenna) >> 4; | ||
619 | |||
620 | /* set the preamble flag if we have it */ | ||
621 | if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) | ||
622 | iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; | ||
623 | |||
624 | stats->flag |= RX_FLAG_RADIOTAP; | ||
625 | } | ||
626 | |||
627 | static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv, | 534 | static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv, |
628 | struct iwl3945_rx_mem_buffer *rxb, | 535 | struct iwl3945_rx_mem_buffer *rxb, |
629 | struct ieee80211_rx_status *stats) | 536 | struct ieee80211_rx_status *stats) |
@@ -657,9 +564,6 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv, | |||
657 | iwl3945_set_decrypted_flag(priv, rxb->skb, | 564 | iwl3945_set_decrypted_flag(priv, rxb->skb, |
658 | le32_to_cpu(rx_end->status), stats); | 565 | le32_to_cpu(rx_end->status), stats); |
659 | 566 | ||
660 | if (priv->add_radiotap) | ||
661 | iwl3945_add_radiotap(priv, rxb->skb, rx_hdr, stats); | ||
662 | |||
663 | #ifdef CONFIG_IWL3945_LEDS | 567 | #ifdef CONFIG_IWL3945_LEDS |
664 | if (ieee80211_is_data(hdr->frame_control)) | 568 | if (ieee80211_is_data(hdr->frame_control)) |
665 | priv->rxtxpackets += len; | 569 | priv->rxtxpackets += len; |
@@ -684,7 +588,6 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
684 | u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff); | 588 | u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff); |
685 | u8 network_packet; | 589 | u8 network_packet; |
686 | 590 | ||
687 | rx_status.antenna = 0; | ||
688 | rx_status.flag = 0; | 591 | rx_status.flag = 0; |
689 | rx_status.mactime = le64_to_cpu(rx_end->timestamp); | 592 | rx_status.mactime = le64_to_cpu(rx_end->timestamp); |
690 | rx_status.freq = | 593 | rx_status.freq = |
@@ -696,6 +599,13 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
696 | if (rx_status.band == IEEE80211_BAND_5GHZ) | 599 | if (rx_status.band == IEEE80211_BAND_5GHZ) |
697 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; | 600 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; |
698 | 601 | ||
602 | rx_status.antenna = le16_to_cpu(rx_hdr->phy_flags & | ||
603 | RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; | ||
604 | |||
605 | /* set the preamble flag if appropriate */ | ||
606 | if (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) | ||
607 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
608 | |||
699 | if ((unlikely(rx_stats->phy_count > 20))) { | 609 | if ((unlikely(rx_stats->phy_count > 20))) { |
700 | IWL_DEBUG_DROP | 610 | IWL_DEBUG_DROP |
701 | ("dsp size out of range [0,20]: " | 611 | ("dsp size out of range [0,20]: " |
@@ -771,100 +681,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
771 | priv->last_rx_noise = rx_status.noise; | 681 | priv->last_rx_noise = rx_status.noise; |
772 | } | 682 | } |
773 | 683 | ||
774 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | 684 | iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); |
775 | iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); | ||
776 | return; | ||
777 | } | ||
778 | |||
779 | switch (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FTYPE) { | ||
780 | case IEEE80211_FTYPE_MGMT: | ||
781 | switch (le16_to_cpu(header->frame_control) & | ||
782 | IEEE80211_FCTL_STYPE) { | ||
783 | case IEEE80211_STYPE_PROBE_RESP: | ||
784 | case IEEE80211_STYPE_BEACON:{ | ||
785 | /* If this is a beacon or probe response for | ||
786 | * our network then cache the beacon | ||
787 | * timestamp */ | ||
788 | if ((((priv->iw_mode == IEEE80211_IF_TYPE_STA) | ||
789 | && !compare_ether_addr(header->addr2, | ||
790 | priv->bssid)) || | ||
791 | ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | ||
792 | && !compare_ether_addr(header->addr3, | ||
793 | priv->bssid)))) { | ||
794 | struct ieee80211_mgmt *mgmt = | ||
795 | (struct ieee80211_mgmt *)header; | ||
796 | __le32 *pos; | ||
797 | pos = (__le32 *)&mgmt->u.beacon. | ||
798 | timestamp; | ||
799 | priv->timestamp0 = le32_to_cpu(pos[0]); | ||
800 | priv->timestamp1 = le32_to_cpu(pos[1]); | ||
801 | priv->beacon_int = le16_to_cpu( | ||
802 | mgmt->u.beacon.beacon_int); | ||
803 | if (priv->call_post_assoc_from_beacon && | ||
804 | (priv->iw_mode == | ||
805 | IEEE80211_IF_TYPE_STA)) | ||
806 | queue_work(priv->workqueue, | ||
807 | &priv->post_associate.work); | ||
808 | |||
809 | priv->call_post_assoc_from_beacon = 0; | ||
810 | } | ||
811 | |||
812 | break; | ||
813 | } | ||
814 | |||
815 | case IEEE80211_STYPE_ACTION: | ||
816 | /* TODO: Parse 802.11h frames for CSA... */ | ||
817 | break; | ||
818 | |||
819 | /* | ||
820 | * TODO: Use the new callback function from | ||
821 | * mac80211 instead of sniffing these packets. | ||
822 | */ | ||
823 | case IEEE80211_STYPE_ASSOC_RESP: | ||
824 | case IEEE80211_STYPE_REASSOC_RESP:{ | ||
825 | struct ieee80211_mgmt *mgnt = | ||
826 | (struct ieee80211_mgmt *)header; | ||
827 | |||
828 | /* We have just associated, give some | ||
829 | * time for the 4-way handshake if | ||
830 | * any. Don't start scan too early. */ | ||
831 | priv->next_scan_jiffies = jiffies + | ||
832 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | ||
833 | |||
834 | priv->assoc_id = (~((1 << 15) | (1 << 14)) & | ||
835 | le16_to_cpu(mgnt->u. | ||
836 | assoc_resp.aid)); | ||
837 | priv->assoc_capability = | ||
838 | le16_to_cpu(mgnt->u.assoc_resp.capab_info); | ||
839 | if (priv->beacon_int) | ||
840 | queue_work(priv->workqueue, | ||
841 | &priv->post_associate.work); | ||
842 | else | ||
843 | priv->call_post_assoc_from_beacon = 1; | ||
844 | break; | ||
845 | } | ||
846 | |||
847 | case IEEE80211_STYPE_PROBE_REQ:{ | ||
848 | DECLARE_MAC_BUF(mac1); | ||
849 | DECLARE_MAC_BUF(mac2); | ||
850 | DECLARE_MAC_BUF(mac3); | ||
851 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | ||
852 | IWL_DEBUG_DROP | ||
853 | ("Dropping (non network): %s" | ||
854 | ", %s, %s\n", | ||
855 | print_mac(mac1, header->addr1), | ||
856 | print_mac(mac2, header->addr2), | ||
857 | print_mac(mac3, header->addr3)); | ||
858 | return; | ||
859 | } | ||
860 | } | ||
861 | |||
862 | case IEEE80211_FTYPE_DATA: | ||
863 | /* fall through */ | ||
864 | default: | ||
865 | iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status); | ||
866 | break; | ||
867 | } | ||
868 | } | 685 | } |
869 | 686 | ||
870 | int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr, | 687 | int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr, |
@@ -990,7 +807,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
990 | 807 | ||
991 | priv->stations[sta_id].current_rate.rate_n_flags = rate; | 808 | priv->stations[sta_id].current_rate.rate_n_flags = rate; |
992 | 809 | ||
993 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 810 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
994 | (sta_id != priv->hw_setting.bcast_sta_id) && | 811 | (sta_id != priv->hw_setting.bcast_sta_id) && |
995 | (sta_id != IWL_MULTICAST_ID)) | 812 | (sta_id != IWL_MULTICAST_ID)) |
996 | priv->stations[IWL_STA_ID].current_rate.rate_n_flags = rate; | 813 | priv->stations[IWL_STA_ID].current_rate.rate_n_flags = rate; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index fa81ba1af3d3..bdd32475b99c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -73,6 +73,10 @@ extern struct pci_device_id iwl3945_hw_card_ids[]; | |||
73 | extern int iwl3945_param_hwcrypto; | 73 | extern int iwl3945_param_hwcrypto; |
74 | extern int iwl3945_param_queues_num; | 74 | extern int iwl3945_param_queues_num; |
75 | 75 | ||
76 | struct iwl3945_sta_priv { | ||
77 | struct iwl3945_rs_sta *rs_sta; | ||
78 | }; | ||
79 | |||
76 | enum iwl3945_antenna { | 80 | enum iwl3945_antenna { |
77 | IWL_ANTENNA_DIVERSITY, | 81 | IWL_ANTENNA_DIVERSITY, |
78 | IWL_ANTENNA_MAIN, | 82 | IWL_ANTENNA_MAIN, |
@@ -707,7 +711,6 @@ struct iwl3945_priv { | |||
707 | 711 | ||
708 | enum ieee80211_band band; | 712 | enum ieee80211_band band; |
709 | int alloc_rxb_skb; | 713 | int alloc_rxb_skb; |
710 | bool add_radiotap; | ||
711 | 714 | ||
712 | void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, | 715 | void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, |
713 | struct iwl3945_rx_mem_buffer *rxb); | 716 | struct iwl3945_rx_mem_buffer *rxb); |
@@ -852,7 +855,7 @@ struct iwl3945_priv { | |||
852 | /* eeprom */ | 855 | /* eeprom */ |
853 | struct iwl3945_eeprom eeprom; | 856 | struct iwl3945_eeprom eeprom; |
854 | 857 | ||
855 | enum ieee80211_if_types iw_mode; | 858 | enum nl80211_iftype iw_mode; |
856 | 859 | ||
857 | struct sk_buff *ibss_beacon; | 860 | struct sk_buff *ibss_beacon; |
858 | 861 | ||
@@ -895,7 +898,6 @@ struct iwl3945_priv { | |||
895 | struct delayed_work thermal_periodic; | 898 | struct delayed_work thermal_periodic; |
896 | struct delayed_work gather_stats; | 899 | struct delayed_work gather_stats; |
897 | struct delayed_work scan_check; | 900 | struct delayed_work scan_check; |
898 | struct delayed_work post_associate; | ||
899 | 901 | ||
900 | #define IWL_DEFAULT_TX_POWER 0x0F | 902 | #define IWL_DEFAULT_TX_POWER 0x0F |
901 | s8 user_txpower_limit; | 903 | s8 user_txpower_limit; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index fce950f4163c..f4793a609443 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -98,16 +98,17 @@ | |||
98 | #define IWL_RSSI_OFFSET 44 | 98 | #define IWL_RSSI_OFFSET 44 |
99 | 99 | ||
100 | 100 | ||
101 | #include "iwl-commands.h" | ||
102 | 101 | ||
103 | /* PCI registers */ | 102 | /* PCI registers */ |
104 | #define PCI_LINK_CTRL 0x0F0 /* 1 byte */ | 103 | #define PCI_CFG_RETRY_TIMEOUT 0x041 |
105 | #define PCI_POWER_SOURCE 0x0C8 | 104 | #define PCI_CFG_POWER_SOURCE 0x0C8 |
106 | #define PCI_REG_WUM8 0x0E8 | 105 | #define PCI_REG_WUM8 0x0E8 |
106 | #define PCI_CFG_LINK_CTRL 0x0F0 | ||
107 | 107 | ||
108 | /* PCI register values */ | 108 | /* PCI register values */ |
109 | #define PCI_LINK_VAL_L0S_EN 0x01 | 109 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 |
110 | #define PCI_LINK_VAL_L1_EN 0x02 | 110 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 |
111 | #define PCI_CFG_CMD_REG_INT_DIS_MSK 0x04 | ||
111 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) | 112 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) |
112 | 113 | ||
113 | #define TFD_QUEUE_SIZE_MAX (256) | 114 | #define TFD_QUEUE_SIZE_MAX (256) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 23fed3298962..9838de5f4369 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -399,7 +399,7 @@ static void iwl4965_nic_config(struct iwl_priv *priv) | |||
399 | unsigned long flags; | 399 | unsigned long flags; |
400 | u32 val; | 400 | u32 val; |
401 | u16 radio_cfg; | 401 | u16 radio_cfg; |
402 | u8 val_link; | 402 | u16 link; |
403 | 403 | ||
404 | spin_lock_irqsave(&priv->lock, flags); | 404 | spin_lock_irqsave(&priv->lock, flags); |
405 | 405 | ||
@@ -410,10 +410,10 @@ static void iwl4965_nic_config(struct iwl_priv *priv) | |||
410 | val & ~(1 << 11)); | 410 | val & ~(1 << 11)); |
411 | } | 411 | } |
412 | 412 | ||
413 | pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); | 413 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link); |
414 | 414 | ||
415 | /* L1 is enabled by BIOS */ | 415 | /* L1 is enabled by BIOS */ |
416 | if ((val_link & PCI_LINK_VAL_L1_EN) == PCI_LINK_VAL_L1_EN) | 416 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
417 | /* diable L0S disabled L1A enabled */ | 417 | /* diable L0S disabled L1A enabled */ |
418 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 418 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
419 | else | 419 | else |
@@ -1607,8 +1607,8 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1607 | return ret; | 1607 | return ret; |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | 1610 | #ifdef IEEE80211_CONF_CHANNEL_SWITCH | |
1611 | int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | 1611 | static int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) |
1612 | { | 1612 | { |
1613 | int rc; | 1613 | int rc; |
1614 | u8 band = 0; | 1614 | u8 band = 0; |
@@ -1648,6 +1648,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | |||
1648 | rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); | 1648 | rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); |
1649 | return rc; | 1649 | return rc; |
1650 | } | 1650 | } |
1651 | #endif | ||
1651 | 1652 | ||
1652 | static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv) | 1653 | static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv) |
1653 | { | 1654 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 17d4f31c5934..c479ee211c5c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -129,6 +129,13 @@ struct iwl5000_shared { | |||
129 | __le32 padding2; | 129 | __le32 padding2; |
130 | } __attribute__ ((packed)); | 130 | } __attribute__ ((packed)); |
131 | 131 | ||
132 | /* calibrations defined for 5000 */ | ||
133 | /* defines the order in which results should be sent to the runtime uCode */ | ||
134 | enum iwl5000_calib { | ||
135 | IWL5000_CALIB_LO, | ||
136 | IWL5000_CALIB_TX_IQ, | ||
137 | IWL5000_CALIB_TX_IQ_PERD, | ||
138 | }; | ||
132 | 139 | ||
133 | #endif /* __iwl_5000_hw_h__ */ | 140 | #endif /* __iwl_5000_hw_h__ */ |
134 | 141 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index b08036a9d894..5155b8a760a7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -209,14 +209,14 @@ static void iwl5000_nic_config(struct iwl_priv *priv) | |||
209 | { | 209 | { |
210 | unsigned long flags; | 210 | unsigned long flags; |
211 | u16 radio_cfg; | 211 | u16 radio_cfg; |
212 | u8 val_link; | 212 | u16 link; |
213 | 213 | ||
214 | spin_lock_irqsave(&priv->lock, flags); | 214 | spin_lock_irqsave(&priv->lock, flags); |
215 | 215 | ||
216 | pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); | 216 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link); |
217 | 217 | ||
218 | /* L1 is enabled by BIOS */ | 218 | /* L1 is enabled by BIOS */ |
219 | if ((val_link & PCI_LINK_VAL_L1_EN) == PCI_LINK_VAL_L1_EN) | 219 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
220 | /* diable L0S disabled L1A enabled */ | 220 | /* diable L0S disabled L1A enabled */ |
221 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 221 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
222 | else | 222 | else |
@@ -445,48 +445,6 @@ static int iwl5000_send_Xtal_calib(struct iwl_priv *priv) | |||
445 | sizeof(cal_cmd), &cal_cmd); | 445 | sizeof(cal_cmd), &cal_cmd); |
446 | } | 446 | } |
447 | 447 | ||
448 | static int iwl5000_send_calib_results(struct iwl_priv *priv) | ||
449 | { | ||
450 | int ret = 0; | ||
451 | |||
452 | struct iwl_host_cmd hcmd = { | ||
453 | .id = REPLY_PHY_CALIBRATION_CMD, | ||
454 | .meta.flags = CMD_SIZE_HUGE, | ||
455 | }; | ||
456 | |||
457 | if (priv->calib_results.lo_res) { | ||
458 | hcmd.len = priv->calib_results.lo_res_len; | ||
459 | hcmd.data = priv->calib_results.lo_res; | ||
460 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
461 | |||
462 | if (ret) | ||
463 | goto err; | ||
464 | } | ||
465 | |||
466 | if (priv->calib_results.tx_iq_res) { | ||
467 | hcmd.len = priv->calib_results.tx_iq_res_len; | ||
468 | hcmd.data = priv->calib_results.tx_iq_res; | ||
469 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
470 | |||
471 | if (ret) | ||
472 | goto err; | ||
473 | } | ||
474 | |||
475 | if (priv->calib_results.tx_iq_perd_res) { | ||
476 | hcmd.len = priv->calib_results.tx_iq_perd_res_len; | ||
477 | hcmd.data = priv->calib_results.tx_iq_perd_res; | ||
478 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
479 | |||
480 | if (ret) | ||
481 | goto err; | ||
482 | } | ||
483 | |||
484 | return 0; | ||
485 | err: | ||
486 | IWL_ERROR("Error %d\n", ret); | ||
487 | return ret; | ||
488 | } | ||
489 | |||
490 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) | 448 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) |
491 | { | 449 | { |
492 | struct iwl5000_calib_cfg_cmd calib_cfg_cmd; | 450 | struct iwl5000_calib_cfg_cmd calib_cfg_cmd; |
@@ -511,33 +469,30 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, | |||
511 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; | 469 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; |
512 | struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; | 470 | struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; |
513 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; | 471 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; |
514 | 472 | int index; | |
515 | iwl_free_calib_results(priv); | ||
516 | 473 | ||
517 | /* reduce the size of the length field itself */ | 474 | /* reduce the size of the length field itself */ |
518 | len -= 4; | 475 | len -= 4; |
519 | 476 | ||
477 | /* Define the order in which the results will be sent to the runtime | ||
478 | * uCode. iwl_send_calib_results sends them in a row according to their | ||
479 | * index. We sort them here */ | ||
520 | switch (hdr->op_code) { | 480 | switch (hdr->op_code) { |
521 | case IWL5000_PHY_CALIBRATE_LO_CMD: | 481 | case IWL5000_PHY_CALIBRATE_LO_CMD: |
522 | priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC); | 482 | index = IWL5000_CALIB_LO; |
523 | priv->calib_results.lo_res_len = len; | ||
524 | memcpy(priv->calib_results.lo_res, pkt->u.raw, len); | ||
525 | break; | 483 | break; |
526 | case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: | 484 | case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: |
527 | priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC); | 485 | index = IWL5000_CALIB_TX_IQ; |
528 | priv->calib_results.tx_iq_res_len = len; | ||
529 | memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len); | ||
530 | break; | 486 | break; |
531 | case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: | 487 | case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: |
532 | priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC); | 488 | index = IWL5000_CALIB_TX_IQ_PERD; |
533 | priv->calib_results.tx_iq_perd_res_len = len; | ||
534 | memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len); | ||
535 | break; | 489 | break; |
536 | default: | 490 | default: |
537 | IWL_ERROR("Unknown calibration notification %d\n", | 491 | IWL_ERROR("Unknown calibration notification %d\n", |
538 | hdr->op_code); | 492 | hdr->op_code); |
539 | return; | 493 | return; |
540 | } | 494 | } |
495 | iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len); | ||
541 | } | 496 | } |
542 | 497 | ||
543 | static void iwl5000_rx_calib_complete(struct iwl_priv *priv, | 498 | static void iwl5000_rx_calib_complete(struct iwl_priv *priv, |
@@ -832,7 +787,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) | |||
832 | iwl5000_send_Xtal_calib(priv); | 787 | iwl5000_send_Xtal_calib(priv); |
833 | 788 | ||
834 | if (priv->ucode_type == UCODE_RT) | 789 | if (priv->ucode_type == UCODE_RT) |
835 | iwl5000_send_calib_results(priv); | 790 | iwl_send_calib_results(priv); |
836 | 791 | ||
837 | return 0; | 792 | return 0; |
838 | } | 793 | } |
@@ -878,12 +833,12 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
878 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { | 833 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { |
879 | case CSR_HW_REV_TYPE_5100: | 834 | case CSR_HW_REV_TYPE_5100: |
880 | case CSR_HW_REV_TYPE_5300: | 835 | case CSR_HW_REV_TYPE_5300: |
881 | /* 5X00 wants in Celsius */ | 836 | case CSR_HW_REV_TYPE_5350: |
837 | /* 5X00 and 5350 wants in Celsius */ | ||
882 | priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; | 838 | priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; |
883 | break; | 839 | break; |
884 | case CSR_HW_REV_TYPE_5150: | 840 | case CSR_HW_REV_TYPE_5150: |
885 | case CSR_HW_REV_TYPE_5350: | 841 | /* 5150 wants in Kelvin */ |
886 | /* 5X50 wants in Kelvin */ | ||
887 | priv->hw_params.ct_kill_threshold = | 842 | priv->hw_params.ct_kill_threshold = |
888 | CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD); | 843 | CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD); |
889 | break; | 844 | break; |
@@ -1614,6 +1569,8 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1614 | .mod_params = &iwl50_mod_params, | 1569 | .mod_params = &iwl50_mod_params, |
1615 | }; | 1570 | }; |
1616 | 1571 | ||
1572 | MODULE_FIRMWARE("iwlwifi-5000" IWL5000_UCODE_API ".ucode"); | ||
1573 | |||
1617 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); | 1574 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); |
1618 | MODULE_PARM_DESC(disable50, | 1575 | MODULE_PARM_DESC(disable50, |
1619 | "manually disable the 50XX radio (default 0 [radio on])"); | 1576 | "manually disable the 50XX radio (default 0 [radio on])"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 90a2b6dee7c0..e2a58e477036 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | 37 | ||
38 | #include "../net/mac80211/rate.h" | ||
39 | |||
40 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
41 | #include "iwl-sta.h" | 39 | #include "iwl-sta.h" |
42 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
@@ -163,12 +161,15 @@ struct iwl_lq_sta { | |||
163 | u32 dbg_fixed_rate; | 161 | u32 dbg_fixed_rate; |
164 | #endif | 162 | #endif |
165 | struct iwl_priv *drv; | 163 | struct iwl_priv *drv; |
164 | |||
165 | /* used to be in sta_info */ | ||
166 | int last_txrate_idx; | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | static void rs_rate_scale_perform(struct iwl_priv *priv, | 169 | static void rs_rate_scale_perform(struct iwl_priv *priv, |
169 | struct net_device *dev, | ||
170 | struct ieee80211_hdr *hdr, | 170 | struct ieee80211_hdr *hdr, |
171 | struct sta_info *sta); | 171 | struct ieee80211_sta *sta, |
172 | struct iwl_lq_sta *lq_sta); | ||
172 | static void rs_fill_link_cmd(const struct iwl_priv *priv, | 173 | static void rs_fill_link_cmd(const struct iwl_priv *priv, |
173 | struct iwl_lq_sta *lq_sta, u32 rate_n_flags); | 174 | struct iwl_lq_sta *lq_sta, u32 rate_n_flags); |
174 | 175 | ||
@@ -354,17 +355,11 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) | |||
354 | 355 | ||
355 | static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | 356 | static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, |
356 | struct iwl_lq_sta *lq_data, u8 tid, | 357 | struct iwl_lq_sta *lq_data, u8 tid, |
357 | struct sta_info *sta) | 358 | struct ieee80211_sta *sta) |
358 | { | 359 | { |
359 | unsigned long state; | ||
360 | DECLARE_MAC_BUF(mac); | 360 | DECLARE_MAC_BUF(mac); |
361 | 361 | ||
362 | spin_lock_bh(&sta->lock); | 362 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { |
363 | state = sta->ampdu_mlme.tid_state_tx[tid]; | ||
364 | spin_unlock_bh(&sta->lock); | ||
365 | |||
366 | if (state == HT_AGG_STATE_IDLE && | ||
367 | rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { | ||
368 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", | 363 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", |
369 | print_mac(mac, sta->addr), tid); | 364 | print_mac(mac, sta->addr), tid); |
370 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); | 365 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); |
@@ -373,7 +368,7 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
373 | 368 | ||
374 | static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, | 369 | static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, |
375 | struct iwl_lq_sta *lq_data, | 370 | struct iwl_lq_sta *lq_data, |
376 | struct sta_info *sta) | 371 | struct ieee80211_sta *sta) |
377 | { | 372 | { |
378 | if ((tid < TID_MAX_LOAD_COUNT)) | 373 | if ((tid < TID_MAX_LOAD_COUNT)) |
379 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); | 374 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); |
@@ -436,7 +431,7 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, | |||
436 | /* Shift bitmap by one frame (throw away oldest history), | 431 | /* Shift bitmap by one frame (throw away oldest history), |
437 | * OR in "1", and increment "success" if this | 432 | * OR in "1", and increment "success" if this |
438 | * frame was successful. */ | 433 | * frame was successful. */ |
439 | window->data <<= 1;; | 434 | window->data <<= 1; |
440 | if (successes > 0) { | 435 | if (successes > 0) { |
441 | window->success_counter++; | 436 | window->success_counter++; |
442 | window->data |= 0x1; | 437 | window->data |= 0x1; |
@@ -773,7 +768,8 @@ out: | |||
773 | /* | 768 | /* |
774 | * mac80211 sends us Tx status | 769 | * mac80211 sends us Tx status |
775 | */ | 770 | */ |
776 | static void rs_tx_status(void *priv_rate, struct net_device *dev, | 771 | static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, |
772 | struct ieee80211_sta *sta, void *priv_sta, | ||
777 | struct sk_buff *skb) | 773 | struct sk_buff *skb) |
778 | { | 774 | { |
779 | int status; | 775 | int status; |
@@ -781,11 +777,9 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
781 | int rs_index, index = 0; | 777 | int rs_index, index = 0; |
782 | struct iwl_lq_sta *lq_sta; | 778 | struct iwl_lq_sta *lq_sta; |
783 | struct iwl_link_quality_cmd *table; | 779 | struct iwl_link_quality_cmd *table; |
784 | struct sta_info *sta; | ||
785 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 780 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
786 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | 781 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
787 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 782 | struct ieee80211_hw *hw = priv->hw; |
788 | struct ieee80211_hw *hw = local_to_hw(local); | ||
789 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 783 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
790 | struct iwl_rate_scale_data *window = NULL; | 784 | struct iwl_rate_scale_data *window = NULL; |
791 | struct iwl_rate_scale_data *search_win = NULL; | 785 | struct iwl_rate_scale_data *search_win = NULL; |
@@ -811,17 +805,9 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
811 | if (retries > 15) | 805 | if (retries > 15) |
812 | retries = 15; | 806 | retries = 15; |
813 | 807 | ||
814 | rcu_read_lock(); | 808 | lq_sta = (struct iwl_lq_sta *)priv_sta; |
815 | 809 | ||
816 | sta = sta_info_get(local, hdr->addr1); | 810 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
817 | |||
818 | if (!sta || !sta->rate_ctrl_priv) | ||
819 | goto out; | ||
820 | |||
821 | |||
822 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | ||
823 | |||
824 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | ||
825 | !lq_sta->ibss_sta_added) | 811 | !lq_sta->ibss_sta_added) |
826 | goto out; | 812 | goto out; |
827 | 813 | ||
@@ -965,9 +951,8 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
965 | } | 951 | } |
966 | 952 | ||
967 | /* See if there's a better rate or modulation mode to try. */ | 953 | /* See if there's a better rate or modulation mode to try. */ |
968 | rs_rate_scale_perform(priv, dev, hdr, sta); | 954 | rs_rate_scale_perform(priv, hdr, sta, lq_sta); |
969 | out: | 955 | out: |
970 | rcu_read_unlock(); | ||
971 | return; | 956 | return; |
972 | } | 957 | } |
973 | 958 | ||
@@ -1128,6 +1113,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, | |||
1128 | 1113 | ||
1129 | /* Higher rate not available, use the original */ | 1114 | /* Higher rate not available, use the original */ |
1130 | } else { | 1115 | } else { |
1116 | new_rate = rate; | ||
1131 | break; | 1117 | break; |
1132 | } | 1118 | } |
1133 | } | 1119 | } |
@@ -1142,7 +1128,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, | |||
1142 | static int rs_switch_to_mimo2(struct iwl_priv *priv, | 1128 | static int rs_switch_to_mimo2(struct iwl_priv *priv, |
1143 | struct iwl_lq_sta *lq_sta, | 1129 | struct iwl_lq_sta *lq_sta, |
1144 | struct ieee80211_conf *conf, | 1130 | struct ieee80211_conf *conf, |
1145 | struct sta_info *sta, | 1131 | struct ieee80211_sta *sta, |
1146 | struct iwl_scale_tbl_info *tbl, int index) | 1132 | struct iwl_scale_tbl_info *tbl, int index) |
1147 | { | 1133 | { |
1148 | u16 rate_mask; | 1134 | u16 rate_mask; |
@@ -1153,8 +1139,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1153 | !sta->ht_info.ht_supported) | 1139 | !sta->ht_info.ht_supported) |
1154 | return -1; | 1140 | return -1; |
1155 | 1141 | ||
1156 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS) >> 2) | 1142 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) |
1157 | == IWL_MIMO_PS_STATIC) | 1143 | == WLAN_HT_CAP_SM_PS_STATIC) |
1158 | return -1; | 1144 | return -1; |
1159 | 1145 | ||
1160 | /* Need both Tx chains/antennas to support MIMO */ | 1146 | /* Need both Tx chains/antennas to support MIMO */ |
@@ -1210,7 +1196,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1210 | static int rs_switch_to_siso(struct iwl_priv *priv, | 1196 | static int rs_switch_to_siso(struct iwl_priv *priv, |
1211 | struct iwl_lq_sta *lq_sta, | 1197 | struct iwl_lq_sta *lq_sta, |
1212 | struct ieee80211_conf *conf, | 1198 | struct ieee80211_conf *conf, |
1213 | struct sta_info *sta, | 1199 | struct ieee80211_sta *sta, |
1214 | struct iwl_scale_tbl_info *tbl, int index) | 1200 | struct iwl_scale_tbl_info *tbl, int index) |
1215 | { | 1201 | { |
1216 | u16 rate_mask; | 1202 | u16 rate_mask; |
@@ -1270,7 +1256,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1270 | static int rs_move_legacy_other(struct iwl_priv *priv, | 1256 | static int rs_move_legacy_other(struct iwl_priv *priv, |
1271 | struct iwl_lq_sta *lq_sta, | 1257 | struct iwl_lq_sta *lq_sta, |
1272 | struct ieee80211_conf *conf, | 1258 | struct ieee80211_conf *conf, |
1273 | struct sta_info *sta, | 1259 | struct ieee80211_sta *sta, |
1274 | int index) | 1260 | int index) |
1275 | { | 1261 | { |
1276 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 1262 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
@@ -1281,15 +1267,23 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1281 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | 1267 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
1282 | u8 start_action = tbl->action; | 1268 | u8 start_action = tbl->action; |
1283 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | 1269 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; |
1270 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | ||
1284 | int ret = 0; | 1271 | int ret = 0; |
1285 | 1272 | ||
1286 | for (; ;) { | 1273 | for (; ;) { |
1287 | switch (tbl->action) { | 1274 | switch (tbl->action) { |
1288 | case IWL_LEGACY_SWITCH_ANTENNA: | 1275 | case IWL_LEGACY_SWITCH_ANTENNA1: |
1276 | case IWL_LEGACY_SWITCH_ANTENNA2: | ||
1289 | IWL_DEBUG_RATE("LQ: Legacy toggle Antenna\n"); | 1277 | IWL_DEBUG_RATE("LQ: Legacy toggle Antenna\n"); |
1290 | 1278 | ||
1291 | lq_sta->action_counter++; | 1279 | lq_sta->action_counter++; |
1292 | 1280 | ||
1281 | if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && | ||
1282 | tx_chains_num <= 1) || | ||
1283 | (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2 && | ||
1284 | tx_chains_num <= 2)) | ||
1285 | break; | ||
1286 | |||
1293 | /* Don't change antenna if success has been great */ | 1287 | /* Don't change antenna if success has been great */ |
1294 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1288 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) |
1295 | break; | 1289 | break; |
@@ -1299,7 +1293,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1299 | 1293 | ||
1300 | if (rs_toggle_antenna(valid_tx_ant, | 1294 | if (rs_toggle_antenna(valid_tx_ant, |
1301 | &search_tbl->current_rate, search_tbl)) { | 1295 | &search_tbl->current_rate, search_tbl)) { |
1302 | lq_sta->search_better_tbl = 1; | 1296 | rs_set_expected_tpt_table(lq_sta, search_tbl); |
1303 | goto out; | 1297 | goto out; |
1304 | } | 1298 | } |
1305 | break; | 1299 | break; |
@@ -1312,43 +1306,54 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1312 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, | 1306 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, |
1313 | search_tbl, index); | 1307 | search_tbl, index); |
1314 | if (!ret) { | 1308 | if (!ret) { |
1315 | lq_sta->search_better_tbl = 1; | ||
1316 | lq_sta->action_counter = 0; | 1309 | lq_sta->action_counter = 0; |
1317 | goto out; | 1310 | goto out; |
1318 | } | 1311 | } |
1319 | 1312 | ||
1320 | break; | 1313 | break; |
1321 | case IWL_LEGACY_SWITCH_MIMO2: | 1314 | case IWL_LEGACY_SWITCH_MIMO2_AB: |
1315 | case IWL_LEGACY_SWITCH_MIMO2_AC: | ||
1316 | case IWL_LEGACY_SWITCH_MIMO2_BC: | ||
1322 | IWL_DEBUG_RATE("LQ: Legacy switch to MIMO2\n"); | 1317 | IWL_DEBUG_RATE("LQ: Legacy switch to MIMO2\n"); |
1323 | 1318 | ||
1324 | /* Set up search table to try MIMO */ | 1319 | /* Set up search table to try MIMO */ |
1325 | memcpy(search_tbl, tbl, sz); | 1320 | memcpy(search_tbl, tbl, sz); |
1326 | search_tbl->is_SGI = 0; | 1321 | search_tbl->is_SGI = 0; |
1327 | search_tbl->ant_type = ANT_AB;/*FIXME:RS*/ | 1322 | |
1328 | /*FIXME:RS:need to check ant validity*/ | 1323 | if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) |
1324 | search_tbl->ant_type = ANT_AB; | ||
1325 | else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) | ||
1326 | search_tbl->ant_type = ANT_AC; | ||
1327 | else | ||
1328 | search_tbl->ant_type = ANT_BC; | ||
1329 | |||
1330 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1331 | break; | ||
1332 | |||
1329 | ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, | 1333 | ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, |
1330 | search_tbl, index); | 1334 | search_tbl, index); |
1331 | if (!ret) { | 1335 | if (!ret) { |
1332 | lq_sta->search_better_tbl = 1; | ||
1333 | lq_sta->action_counter = 0; | 1336 | lq_sta->action_counter = 0; |
1334 | goto out; | 1337 | goto out; |
1335 | } | 1338 | } |
1336 | break; | 1339 | break; |
1337 | } | 1340 | } |
1338 | tbl->action++; | 1341 | tbl->action++; |
1339 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2) | 1342 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) |
1340 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA; | 1343 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1341 | 1344 | ||
1342 | if (tbl->action == start_action) | 1345 | if (tbl->action == start_action) |
1343 | break; | 1346 | break; |
1344 | 1347 | ||
1345 | } | 1348 | } |
1349 | search_tbl->lq_type = LQ_NONE; | ||
1346 | return 0; | 1350 | return 0; |
1347 | 1351 | ||
1348 | out: | 1352 | out: |
1353 | lq_sta->search_better_tbl = 1; | ||
1349 | tbl->action++; | 1354 | tbl->action++; |
1350 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2) | 1355 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) |
1351 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA; | 1356 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1352 | return 0; | 1357 | return 0; |
1353 | 1358 | ||
1354 | } | 1359 | } |
@@ -1359,7 +1364,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1359 | static int rs_move_siso_to_other(struct iwl_priv *priv, | 1364 | static int rs_move_siso_to_other(struct iwl_priv *priv, |
1360 | struct iwl_lq_sta *lq_sta, | 1365 | struct iwl_lq_sta *lq_sta, |
1361 | struct ieee80211_conf *conf, | 1366 | struct ieee80211_conf *conf, |
1362 | struct sta_info *sta, int index) | 1367 | struct ieee80211_sta *sta, int index) |
1363 | { | 1368 | { |
1364 | u8 is_green = lq_sta->is_green; | 1369 | u8 is_green = lq_sta->is_green; |
1365 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 1370 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
@@ -1370,34 +1375,51 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1370 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | 1375 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
1371 | u8 start_action = tbl->action; | 1376 | u8 start_action = tbl->action; |
1372 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | 1377 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; |
1378 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | ||
1373 | int ret; | 1379 | int ret; |
1374 | 1380 | ||
1375 | for (;;) { | 1381 | for (;;) { |
1376 | lq_sta->action_counter++; | 1382 | lq_sta->action_counter++; |
1377 | switch (tbl->action) { | 1383 | switch (tbl->action) { |
1378 | case IWL_SISO_SWITCH_ANTENNA: | 1384 | case IWL_SISO_SWITCH_ANTENNA1: |
1385 | case IWL_SISO_SWITCH_ANTENNA2: | ||
1379 | IWL_DEBUG_RATE("LQ: SISO toggle Antenna\n"); | 1386 | IWL_DEBUG_RATE("LQ: SISO toggle Antenna\n"); |
1387 | |||
1388 | if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && | ||
1389 | tx_chains_num <= 1) || | ||
1390 | (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && | ||
1391 | tx_chains_num <= 2)) | ||
1392 | break; | ||
1393 | |||
1380 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1394 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) |
1381 | break; | 1395 | break; |
1382 | 1396 | ||
1383 | memcpy(search_tbl, tbl, sz); | 1397 | memcpy(search_tbl, tbl, sz); |
1384 | if (rs_toggle_antenna(valid_tx_ant, | 1398 | if (rs_toggle_antenna(valid_tx_ant, |
1385 | &search_tbl->current_rate, search_tbl)) { | 1399 | &search_tbl->current_rate, search_tbl)) |
1386 | lq_sta->search_better_tbl = 1; | ||
1387 | goto out; | 1400 | goto out; |
1388 | } | ||
1389 | break; | 1401 | break; |
1390 | case IWL_SISO_SWITCH_MIMO2: | 1402 | case IWL_SISO_SWITCH_MIMO2_AB: |
1403 | case IWL_SISO_SWITCH_MIMO2_AC: | ||
1404 | case IWL_SISO_SWITCH_MIMO2_BC: | ||
1391 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n"); | 1405 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n"); |
1392 | memcpy(search_tbl, tbl, sz); | 1406 | memcpy(search_tbl, tbl, sz); |
1393 | search_tbl->is_SGI = 0; | 1407 | search_tbl->is_SGI = 0; |
1394 | search_tbl->ant_type = ANT_AB; /*FIXME:RS*/ | 1408 | |
1409 | if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) | ||
1410 | search_tbl->ant_type = ANT_AB; | ||
1411 | else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) | ||
1412 | search_tbl->ant_type = ANT_AC; | ||
1413 | else | ||
1414 | search_tbl->ant_type = ANT_BC; | ||
1415 | |||
1416 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1417 | break; | ||
1418 | |||
1395 | ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, | 1419 | ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, |
1396 | search_tbl, index); | 1420 | search_tbl, index); |
1397 | if (!ret) { | 1421 | if (!ret) |
1398 | lq_sta->search_better_tbl = 1; | ||
1399 | goto out; | 1422 | goto out; |
1400 | } | ||
1401 | break; | 1423 | break; |
1402 | case IWL_SISO_SWITCH_GI: | 1424 | case IWL_SISO_SWITCH_GI: |
1403 | if (!tbl->is_fat && | 1425 | if (!tbl->is_fat && |
@@ -1427,22 +1449,23 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1427 | } | 1449 | } |
1428 | search_tbl->current_rate = rate_n_flags_from_tbl( | 1450 | search_tbl->current_rate = rate_n_flags_from_tbl( |
1429 | search_tbl, index, is_green); | 1451 | search_tbl, index, is_green); |
1430 | lq_sta->search_better_tbl = 1; | ||
1431 | goto out; | 1452 | goto out; |
1432 | } | 1453 | } |
1433 | tbl->action++; | 1454 | tbl->action++; |
1434 | if (tbl->action > IWL_SISO_SWITCH_GI) | 1455 | if (tbl->action > IWL_SISO_SWITCH_GI) |
1435 | tbl->action = IWL_SISO_SWITCH_ANTENNA; | 1456 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1436 | 1457 | ||
1437 | if (tbl->action == start_action) | 1458 | if (tbl->action == start_action) |
1438 | break; | 1459 | break; |
1439 | } | 1460 | } |
1461 | search_tbl->lq_type = LQ_NONE; | ||
1440 | return 0; | 1462 | return 0; |
1441 | 1463 | ||
1442 | out: | 1464 | out: |
1465 | lq_sta->search_better_tbl = 1; | ||
1443 | tbl->action++; | 1466 | tbl->action++; |
1444 | if (tbl->action > IWL_SISO_SWITCH_GI) | 1467 | if (tbl->action > IWL_SISO_SWITCH_GI) |
1445 | tbl->action = IWL_SISO_SWITCH_ANTENNA; | 1468 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1446 | return 0; | 1469 | return 0; |
1447 | } | 1470 | } |
1448 | 1471 | ||
@@ -1452,43 +1475,64 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1452 | static int rs_move_mimo_to_other(struct iwl_priv *priv, | 1475 | static int rs_move_mimo_to_other(struct iwl_priv *priv, |
1453 | struct iwl_lq_sta *lq_sta, | 1476 | struct iwl_lq_sta *lq_sta, |
1454 | struct ieee80211_conf *conf, | 1477 | struct ieee80211_conf *conf, |
1455 | struct sta_info *sta, int index) | 1478 | struct ieee80211_sta *sta, int index) |
1456 | { | 1479 | { |
1457 | s8 is_green = lq_sta->is_green; | 1480 | s8 is_green = lq_sta->is_green; |
1458 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 1481 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
1459 | struct iwl_scale_tbl_info *search_tbl = | 1482 | struct iwl_scale_tbl_info *search_tbl = |
1460 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | 1483 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
1484 | struct iwl_rate_scale_data *window = &(tbl->win[index]); | ||
1461 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - | 1485 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - |
1462 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | 1486 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
1463 | u8 start_action = tbl->action; | 1487 | u8 start_action = tbl->action; |
1464 | /*u8 valid_tx_ant = priv->hw_params.valid_tx_ant;*/ | 1488 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; |
1489 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | ||
1465 | int ret; | 1490 | int ret; |
1466 | 1491 | ||
1467 | for (;;) { | 1492 | for (;;) { |
1468 | lq_sta->action_counter++; | 1493 | lq_sta->action_counter++; |
1469 | switch (tbl->action) { | 1494 | switch (tbl->action) { |
1470 | case IWL_MIMO_SWITCH_ANTENNA_A: | 1495 | case IWL_MIMO2_SWITCH_ANTENNA1: |
1471 | case IWL_MIMO_SWITCH_ANTENNA_B: | 1496 | case IWL_MIMO2_SWITCH_ANTENNA2: |
1497 | IWL_DEBUG_RATE("LQ: MIMO toggle Antennas\n"); | ||
1498 | |||
1499 | if (tx_chains_num <= 2) | ||
1500 | break; | ||
1501 | |||
1502 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | ||
1503 | break; | ||
1504 | |||
1505 | memcpy(search_tbl, tbl, sz); | ||
1506 | if (rs_toggle_antenna(valid_tx_ant, | ||
1507 | &search_tbl->current_rate, search_tbl)) | ||
1508 | goto out; | ||
1509 | break; | ||
1510 | case IWL_MIMO2_SWITCH_SISO_A: | ||
1511 | case IWL_MIMO2_SWITCH_SISO_B: | ||
1512 | case IWL_MIMO2_SWITCH_SISO_C: | ||
1472 | IWL_DEBUG_RATE("LQ: MIMO2 switch to SISO\n"); | 1513 | IWL_DEBUG_RATE("LQ: MIMO2 switch to SISO\n"); |
1473 | 1514 | ||
1474 | /* Set up new search table for SISO */ | 1515 | /* Set up new search table for SISO */ |
1475 | memcpy(search_tbl, tbl, sz); | 1516 | memcpy(search_tbl, tbl, sz); |
1476 | 1517 | ||
1477 | /*FIXME:RS:need to check ant validity + C*/ | 1518 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) |
1478 | if (tbl->action == IWL_MIMO_SWITCH_ANTENNA_A) | ||
1479 | search_tbl->ant_type = ANT_A; | 1519 | search_tbl->ant_type = ANT_A; |
1480 | else | 1520 | else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) |
1481 | search_tbl->ant_type = ANT_B; | 1521 | search_tbl->ant_type = ANT_B; |
1522 | else | ||
1523 | search_tbl->ant_type = ANT_C; | ||
1524 | |||
1525 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1526 | break; | ||
1482 | 1527 | ||
1483 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, | 1528 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, |
1484 | search_tbl, index); | 1529 | search_tbl, index); |
1485 | if (!ret) { | 1530 | if (!ret) |
1486 | lq_sta->search_better_tbl = 1; | ||
1487 | goto out; | 1531 | goto out; |
1488 | } | 1532 | |
1489 | break; | 1533 | break; |
1490 | 1534 | ||
1491 | case IWL_MIMO_SWITCH_GI: | 1535 | case IWL_MIMO2_SWITCH_GI: |
1492 | if (!tbl->is_fat && | 1536 | if (!tbl->is_fat && |
1493 | !(priv->current_ht_config.sgf & | 1537 | !(priv->current_ht_config.sgf & |
1494 | HT_SHORT_GI_20MHZ)) | 1538 | HT_SHORT_GI_20MHZ)) |
@@ -1517,23 +1561,23 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1517 | } | 1561 | } |
1518 | search_tbl->current_rate = rate_n_flags_from_tbl( | 1562 | search_tbl->current_rate = rate_n_flags_from_tbl( |
1519 | search_tbl, index, is_green); | 1563 | search_tbl, index, is_green); |
1520 | lq_sta->search_better_tbl = 1; | ||
1521 | goto out; | 1564 | goto out; |
1522 | 1565 | ||
1523 | } | 1566 | } |
1524 | tbl->action++; | 1567 | tbl->action++; |
1525 | if (tbl->action > IWL_MIMO_SWITCH_GI) | 1568 | if (tbl->action > IWL_MIMO2_SWITCH_GI) |
1526 | tbl->action = IWL_MIMO_SWITCH_ANTENNA_A; | 1569 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1527 | 1570 | ||
1528 | if (tbl->action == start_action) | 1571 | if (tbl->action == start_action) |
1529 | break; | 1572 | break; |
1530 | } | 1573 | } |
1531 | 1574 | search_tbl->lq_type = LQ_NONE; | |
1532 | return 0; | 1575 | return 0; |
1533 | out: | 1576 | out: |
1577 | lq_sta->search_better_tbl = 1; | ||
1534 | tbl->action++; | 1578 | tbl->action++; |
1535 | if (tbl->action > IWL_MIMO_SWITCH_GI) | 1579 | if (tbl->action > IWL_MIMO2_SWITCH_GI) |
1536 | tbl->action = IWL_MIMO_SWITCH_ANTENNA_A; | 1580 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1537 | return 0; | 1581 | return 0; |
1538 | 1582 | ||
1539 | } | 1583 | } |
@@ -1624,12 +1668,11 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) | |||
1624 | * Do rate scaling and search for new modulation mode. | 1668 | * Do rate scaling and search for new modulation mode. |
1625 | */ | 1669 | */ |
1626 | static void rs_rate_scale_perform(struct iwl_priv *priv, | 1670 | static void rs_rate_scale_perform(struct iwl_priv *priv, |
1627 | struct net_device *dev, | ||
1628 | struct ieee80211_hdr *hdr, | 1671 | struct ieee80211_hdr *hdr, |
1629 | struct sta_info *sta) | 1672 | struct ieee80211_sta *sta, |
1673 | struct iwl_lq_sta *lq_sta) | ||
1630 | { | 1674 | { |
1631 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1675 | struct ieee80211_hw *hw = priv->hw; |
1632 | struct ieee80211_hw *hw = local_to_hw(local); | ||
1633 | struct ieee80211_conf *conf = &hw->conf; | 1676 | struct ieee80211_conf *conf = &hw->conf; |
1634 | int low = IWL_RATE_INVALID; | 1677 | int low = IWL_RATE_INVALID; |
1635 | int high = IWL_RATE_INVALID; | 1678 | int high = IWL_RATE_INVALID; |
@@ -1644,7 +1687,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1644 | __le16 fc; | 1687 | __le16 fc; |
1645 | u16 rate_mask; | 1688 | u16 rate_mask; |
1646 | u8 update_lq = 0; | 1689 | u8 update_lq = 0; |
1647 | struct iwl_lq_sta *lq_sta; | ||
1648 | struct iwl_scale_tbl_info *tbl, *tbl1; | 1690 | struct iwl_scale_tbl_info *tbl, *tbl1; |
1649 | u16 rate_scale_index_msk = 0; | 1691 | u16 rate_scale_index_msk = 0; |
1650 | u32 rate; | 1692 | u32 rate; |
@@ -1665,10 +1707,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1665 | return; | 1707 | return; |
1666 | } | 1708 | } |
1667 | 1709 | ||
1668 | if (!sta || !sta->rate_ctrl_priv) | 1710 | if (!sta || !lq_sta) |
1669 | return; | 1711 | return; |
1670 | 1712 | ||
1671 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 1713 | lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; |
1672 | 1714 | ||
1673 | tid = rs_tl_add_packet(lq_sta, hdr); | 1715 | tid = rs_tl_add_packet(lq_sta, hdr); |
1674 | 1716 | ||
@@ -1686,7 +1728,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1686 | is_green = lq_sta->is_green; | 1728 | is_green = lq_sta->is_green; |
1687 | 1729 | ||
1688 | /* current tx rate */ | 1730 | /* current tx rate */ |
1689 | index = sta->last_txrate_idx; | 1731 | index = lq_sta->last_txrate_idx; |
1690 | 1732 | ||
1691 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, | 1733 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, |
1692 | tbl->lq_type); | 1734 | tbl->lq_type); |
@@ -1747,19 +1789,13 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1747 | rs_stay_in_table(lq_sta); | 1789 | rs_stay_in_table(lq_sta); |
1748 | 1790 | ||
1749 | goto out; | 1791 | goto out; |
1792 | } | ||
1750 | 1793 | ||
1751 | /* Else we have enough samples; calculate estimate of | 1794 | /* Else we have enough samples; calculate estimate of |
1752 | * actual average throughput */ | 1795 | * actual average throughput */ |
1753 | } else { | 1796 | |
1754 | /*FIXME:RS remove this else if we don't get this error*/ | 1797 | BUG_ON(window->average_tpt != ((window->success_ratio * |
1755 | if (window->average_tpt != ((window->success_ratio * | 1798 | tbl->expected_tpt[index] + 64) / 128)); |
1756 | tbl->expected_tpt[index] + 64) / 128)) { | ||
1757 | IWL_ERROR("expected_tpt should have been calculated" | ||
1758 | " by now\n"); | ||
1759 | window->average_tpt = ((window->success_ratio * | ||
1760 | tbl->expected_tpt[index] + 64) / 128); | ||
1761 | } | ||
1762 | } | ||
1763 | 1799 | ||
1764 | /* If we are searching for better modulation mode, check success. */ | 1800 | /* If we are searching for better modulation mode, check success. */ |
1765 | if (lq_sta->search_better_tbl) { | 1801 | if (lq_sta->search_better_tbl) { |
@@ -1769,7 +1805,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1769 | * continuing to use the setup that we've been trying. */ | 1805 | * continuing to use the setup that we've been trying. */ |
1770 | if (window->average_tpt > lq_sta->last_tpt) { | 1806 | if (window->average_tpt > lq_sta->last_tpt) { |
1771 | 1807 | ||
1772 | IWL_DEBUG_RATE("LQ: SWITCHING TO CURRENT TABLE " | 1808 | IWL_DEBUG_RATE("LQ: SWITCHING TO NEW TABLE " |
1773 | "suc=%d cur-tpt=%d old-tpt=%d\n", | 1809 | "suc=%d cur-tpt=%d old-tpt=%d\n", |
1774 | window->success_ratio, | 1810 | window->success_ratio, |
1775 | window->average_tpt, | 1811 | window->average_tpt, |
@@ -2005,15 +2041,7 @@ lq_update: | |||
2005 | out: | 2041 | out: |
2006 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); | 2042 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); |
2007 | i = index; | 2043 | i = index; |
2008 | sta->last_txrate_idx = i; | 2044 | lq_sta->last_txrate_idx = i; |
2009 | |||
2010 | /* sta->txrate_idx is an index to A mode rates which start | ||
2011 | * at IWL_FIRST_OFDM_RATE | ||
2012 | */ | ||
2013 | if (lq_sta->band == IEEE80211_BAND_5GHZ) | ||
2014 | sta->txrate_idx = i - IWL_FIRST_OFDM_RATE; | ||
2015 | else | ||
2016 | sta->txrate_idx = i; | ||
2017 | 2045 | ||
2018 | return; | 2046 | return; |
2019 | } | 2047 | } |
@@ -2021,9 +2049,9 @@ out: | |||
2021 | 2049 | ||
2022 | static void rs_initialize_lq(struct iwl_priv *priv, | 2050 | static void rs_initialize_lq(struct iwl_priv *priv, |
2023 | struct ieee80211_conf *conf, | 2051 | struct ieee80211_conf *conf, |
2024 | struct sta_info *sta) | 2052 | struct ieee80211_sta *sta, |
2053 | struct iwl_lq_sta *lq_sta) | ||
2025 | { | 2054 | { |
2026 | struct iwl_lq_sta *lq_sta; | ||
2027 | struct iwl_scale_tbl_info *tbl; | 2055 | struct iwl_scale_tbl_info *tbl; |
2028 | int rate_idx; | 2056 | int rate_idx; |
2029 | int i; | 2057 | int i; |
@@ -2032,14 +2060,13 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2032 | u8 active_tbl = 0; | 2060 | u8 active_tbl = 0; |
2033 | u8 valid_tx_ant; | 2061 | u8 valid_tx_ant; |
2034 | 2062 | ||
2035 | if (!sta || !sta->rate_ctrl_priv) | 2063 | if (!sta || !lq_sta) |
2036 | goto out; | 2064 | goto out; |
2037 | 2065 | ||
2038 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2066 | i = lq_sta->last_txrate_idx; |
2039 | i = sta->last_txrate_idx; | ||
2040 | 2067 | ||
2041 | if ((lq_sta->lq.sta_id == 0xff) && | 2068 | if ((lq_sta->lq.sta_id == 0xff) && |
2042 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 2069 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) |
2043 | goto out; | 2070 | goto out; |
2044 | 2071 | ||
2045 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2072 | valid_tx_ant = priv->hw_params.valid_tx_ant; |
@@ -2076,40 +2103,33 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2076 | return; | 2103 | return; |
2077 | } | 2104 | } |
2078 | 2105 | ||
2079 | static void rs_get_rate(void *priv_rate, struct net_device *dev, | 2106 | static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, |
2080 | struct ieee80211_supported_band *sband, | 2107 | struct ieee80211_sta *sta, void *priv_sta, |
2081 | struct sk_buff *skb, | 2108 | struct sk_buff *skb, struct rate_selection *sel) |
2082 | struct rate_selection *sel) | ||
2083 | { | 2109 | { |
2084 | 2110 | ||
2085 | int i; | 2111 | int i; |
2086 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2112 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
2087 | struct ieee80211_conf *conf = &local->hw.conf; | 2113 | struct ieee80211_conf *conf = &priv->hw->conf; |
2088 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 2114 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
2089 | struct sta_info *sta; | ||
2090 | __le16 fc; | 2115 | __le16 fc; |
2091 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | ||
2092 | struct iwl_lq_sta *lq_sta; | 2116 | struct iwl_lq_sta *lq_sta; |
2093 | 2117 | ||
2094 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 2118 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
2095 | 2119 | ||
2096 | rcu_read_lock(); | ||
2097 | |||
2098 | sta = sta_info_get(local, hdr->addr1); | ||
2099 | |||
2100 | /* Send management frames and broadcast/multicast data using lowest | 2120 | /* Send management frames and broadcast/multicast data using lowest |
2101 | * rate. */ | 2121 | * rate. */ |
2102 | fc = hdr->frame_control; | 2122 | fc = hdr->frame_control; |
2103 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || | 2123 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || |
2104 | !sta || !sta->rate_ctrl_priv) { | 2124 | !sta || !priv_sta) { |
2105 | sel->rate_idx = rate_lowest_index(local, sband, sta); | 2125 | sel->rate_idx = rate_lowest_index(sband, sta); |
2106 | goto out; | 2126 | return; |
2107 | } | 2127 | } |
2108 | 2128 | ||
2109 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2129 | lq_sta = (struct iwl_lq_sta *)priv_sta; |
2110 | i = sta->last_txrate_idx; | 2130 | i = lq_sta->last_txrate_idx; |
2111 | 2131 | ||
2112 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2132 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2113 | !lq_sta->ibss_sta_added) { | 2133 | !lq_sta->ibss_sta_added) { |
2114 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 2134 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
2115 | DECLARE_MAC_BUF(mac); | 2135 | DECLARE_MAC_BUF(mac); |
@@ -2124,23 +2144,22 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2124 | lq_sta->lq.sta_id = sta_id; | 2144 | lq_sta->lq.sta_id = sta_id; |
2125 | lq_sta->lq.rs_table[0].rate_n_flags = 0; | 2145 | lq_sta->lq.rs_table[0].rate_n_flags = 0; |
2126 | lq_sta->ibss_sta_added = 1; | 2146 | lq_sta->ibss_sta_added = 1; |
2127 | rs_initialize_lq(priv, conf, sta); | 2147 | rs_initialize_lq(priv, conf, sta, lq_sta); |
2128 | } | 2148 | } |
2129 | } | 2149 | } |
2130 | 2150 | ||
2131 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | 2151 | if ((i < 0) || (i > IWL_RATE_COUNT)) { |
2132 | sel->rate_idx = rate_lowest_index(local, sband, sta); | 2152 | sel->rate_idx = rate_lowest_index(sband, sta); |
2133 | goto out; | 2153 | return; |
2134 | } | 2154 | } |
2135 | 2155 | ||
2136 | if (sband->band == IEEE80211_BAND_5GHZ) | 2156 | if (sband->band == IEEE80211_BAND_5GHZ) |
2137 | i -= IWL_FIRST_OFDM_RATE; | 2157 | i -= IWL_FIRST_OFDM_RATE; |
2138 | sel->rate_idx = i; | 2158 | sel->rate_idx = i; |
2139 | out: | ||
2140 | rcu_read_unlock(); | ||
2141 | } | 2159 | } |
2142 | 2160 | ||
2143 | static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) | 2161 | static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, |
2162 | gfp_t gfp) | ||
2144 | { | 2163 | { |
2145 | struct iwl_lq_sta *lq_sta; | 2164 | struct iwl_lq_sta *lq_sta; |
2146 | struct iwl_priv *priv; | 2165 | struct iwl_priv *priv; |
@@ -2163,33 +2182,28 @@ static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) | |||
2163 | return lq_sta; | 2182 | return lq_sta; |
2164 | } | 2183 | } |
2165 | 2184 | ||
2166 | static void rs_rate_init(void *priv_rate, void *priv_sta, | 2185 | static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, |
2167 | struct ieee80211_local *local, | 2186 | struct ieee80211_sta *sta, void *priv_sta) |
2168 | struct sta_info *sta) | ||
2169 | { | 2187 | { |
2170 | int i, j; | 2188 | int i, j; |
2171 | struct ieee80211_conf *conf = &local->hw.conf; | 2189 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
2172 | struct ieee80211_supported_band *sband; | 2190 | struct ieee80211_conf *conf = &priv->hw->conf; |
2173 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | ||
2174 | struct iwl_lq_sta *lq_sta = priv_sta; | 2191 | struct iwl_lq_sta *lq_sta = priv_sta; |
2175 | 2192 | ||
2176 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
2177 | |||
2178 | lq_sta->flush_timer = 0; | 2193 | lq_sta->flush_timer = 0; |
2179 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2194 | lq_sta->supp_rates = sta->supp_rates[sband->band]; |
2180 | sta->txrate_idx = 3; | ||
2181 | for (j = 0; j < LQ_SIZE; j++) | 2195 | for (j = 0; j < LQ_SIZE; j++) |
2182 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2196 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2183 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); | 2197 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); |
2184 | 2198 | ||
2185 | IWL_DEBUG_RATE("LQ: *** rate scale global init ***\n"); | 2199 | IWL_DEBUG_RATE("LQ: *** rate scale station global init ***\n"); |
2186 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 2200 | /* TODO: what is a good starting rate for STA? About middle? Maybe not |
2187 | * the lowest or the highest rate.. Could consider using RSSI from | 2201 | * the lowest or the highest rate.. Could consider using RSSI from |
2188 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 2202 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
2189 | * after assoc.. */ | 2203 | * after assoc.. */ |
2190 | 2204 | ||
2191 | lq_sta->ibss_sta_added = 0; | 2205 | lq_sta->ibss_sta_added = 0; |
2192 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2206 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2193 | u8 sta_id = iwl_find_station(priv, sta->addr); | 2207 | u8 sta_id = iwl_find_station(priv, sta->addr); |
2194 | DECLARE_MAC_BUF(mac); | 2208 | DECLARE_MAC_BUF(mac); |
2195 | 2209 | ||
@@ -2212,15 +2226,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2212 | } | 2226 | } |
2213 | 2227 | ||
2214 | /* Find highest tx rate supported by hardware and destination station */ | 2228 | /* Find highest tx rate supported by hardware and destination station */ |
2229 | lq_sta->last_txrate_idx = 3; | ||
2215 | for (i = 0; i < sband->n_bitrates; i++) | 2230 | for (i = 0; i < sband->n_bitrates; i++) |
2216 | if (sta->supp_rates[sband->band] & BIT(i)) | 2231 | if (sta->supp_rates[sband->band] & BIT(i)) |
2217 | sta->txrate_idx = i; | 2232 | lq_sta->last_txrate_idx = i; |
2218 | 2233 | ||
2219 | sta->last_txrate_idx = sta->txrate_idx; | 2234 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ |
2220 | /* WTF is with this bogus comment? A doesn't have cck rates */ | 2235 | if (sband->band == IEEE80211_BAND_5GHZ) |
2221 | /* For MODE_IEEE80211A, cck rates are at end of rate table */ | 2236 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
2222 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | ||
2223 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | ||
2224 | 2237 | ||
2225 | lq_sta->is_dup = 0; | 2238 | lq_sta->is_dup = 0; |
2226 | lq_sta->is_green = rs_use_green(priv, conf); | 2239 | lq_sta->is_green = rs_use_green(priv, conf); |
@@ -2260,7 +2273,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2260 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; | 2273 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; |
2261 | lq_sta->drv = priv; | 2274 | lq_sta->drv = priv; |
2262 | 2275 | ||
2263 | rs_initialize_lq(priv, conf, sta); | 2276 | rs_initialize_lq(priv, conf, sta, lq_sta); |
2264 | } | 2277 | } |
2265 | 2278 | ||
2266 | static void rs_fill_link_cmd(const struct iwl_priv *priv, | 2279 | static void rs_fill_link_cmd(const struct iwl_priv *priv, |
@@ -2382,9 +2395,9 @@ static void rs_fill_link_cmd(const struct iwl_priv *priv, | |||
2382 | lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); | 2395 | lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); |
2383 | } | 2396 | } |
2384 | 2397 | ||
2385 | static void *rs_alloc(struct ieee80211_local *local) | 2398 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
2386 | { | 2399 | { |
2387 | return local->hw.priv; | 2400 | return hw->priv; |
2388 | } | 2401 | } |
2389 | /* rate scale requires free function to be implemented */ | 2402 | /* rate scale requires free function to be implemented */ |
2390 | static void rs_free(void *priv_rate) | 2403 | static void rs_free(void *priv_rate) |
@@ -2405,12 +2418,12 @@ static void rs_clear(void *priv_rate) | |||
2405 | #endif /* CONFIG_IWLWIFI_DEBUG */ | 2418 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
2406 | } | 2419 | } |
2407 | 2420 | ||
2408 | static void rs_free_sta(void *priv_rate, void *priv_sta) | 2421 | static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, |
2422 | void *priv_sta) | ||
2409 | { | 2423 | { |
2410 | struct iwl_lq_sta *lq_sta = priv_sta; | 2424 | struct iwl_lq_sta *lq_sta = priv_sta; |
2411 | struct iwl_priv *priv; | 2425 | struct iwl_priv *priv __maybe_unused = priv_r; |
2412 | 2426 | ||
2413 | priv = (struct iwl_priv *)priv_rate; | ||
2414 | IWL_DEBUG_RATE("enter\n"); | 2427 | IWL_DEBUG_RATE("enter\n"); |
2415 | kfree(lq_sta); | 2428 | kfree(lq_sta); |
2416 | IWL_DEBUG_RATE("leave\n"); | 2429 | IWL_DEBUG_RATE("leave\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index 84d4d1e33755..d148d73635eb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -206,21 +206,28 @@ enum { | |||
206 | #define IWL_RATE_DECREASE_TH 1920 /* 15% */ | 206 | #define IWL_RATE_DECREASE_TH 1920 /* 15% */ |
207 | 207 | ||
208 | /* possible actions when in legacy mode */ | 208 | /* possible actions when in legacy mode */ |
209 | #define IWL_LEGACY_SWITCH_ANTENNA 0 | 209 | #define IWL_LEGACY_SWITCH_ANTENNA1 0 |
210 | #define IWL_LEGACY_SWITCH_SISO 1 | 210 | #define IWL_LEGACY_SWITCH_ANTENNA2 1 |
211 | #define IWL_LEGACY_SWITCH_MIMO2 2 | 211 | #define IWL_LEGACY_SWITCH_SISO 2 |
212 | #define IWL_LEGACY_SWITCH_MIMO2_AB 3 | ||
213 | #define IWL_LEGACY_SWITCH_MIMO2_AC 4 | ||
214 | #define IWL_LEGACY_SWITCH_MIMO2_BC 5 | ||
212 | 215 | ||
213 | /* possible actions when in siso mode */ | 216 | /* possible actions when in siso mode */ |
214 | #define IWL_SISO_SWITCH_ANTENNA 0 | 217 | #define IWL_SISO_SWITCH_ANTENNA1 0 |
215 | #define IWL_SISO_SWITCH_MIMO2 1 | 218 | #define IWL_SISO_SWITCH_ANTENNA2 1 |
216 | #define IWL_SISO_SWITCH_GI 2 | 219 | #define IWL_SISO_SWITCH_MIMO2_AB 2 |
220 | #define IWL_SISO_SWITCH_MIMO2_AC 3 | ||
221 | #define IWL_SISO_SWITCH_MIMO2_BC 4 | ||
222 | #define IWL_SISO_SWITCH_GI 5 | ||
217 | 223 | ||
218 | /* possible actions when in mimo mode */ | 224 | /* possible actions when in mimo mode */ |
219 | #define IWL_MIMO_SWITCH_ANTENNA_A 0 | 225 | #define IWL_MIMO2_SWITCH_ANTENNA1 0 |
220 | #define IWL_MIMO_SWITCH_ANTENNA_B 1 | 226 | #define IWL_MIMO2_SWITCH_ANTENNA2 1 |
221 | #define IWL_MIMO_SWITCH_GI 2 | 227 | #define IWL_MIMO2_SWITCH_SISO_A 2 |
222 | 228 | #define IWL_MIMO2_SWITCH_SISO_B 3 | |
223 | /*FIXME:RS:separate MIMO2/3 transitions*/ | 229 | #define IWL_MIMO2_SWITCH_SISO_C 4 |
230 | #define IWL_MIMO2_SWITCH_GI 5 | ||
224 | 231 | ||
225 | /*FIXME:RS:add posible acctions for MIMO3*/ | 232 | /*FIXME:RS:add posible acctions for MIMO3*/ |
226 | 233 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index e01f048a02dd..24a1aeb6448f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -337,7 +337,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
337 | /* If we have set the ASSOC_MSK and we are in BSS mode then | 337 | /* If we have set the ASSOC_MSK and we are in BSS mode then |
338 | * add the IWL_AP_ID to the station rate table */ | 338 | * add the IWL_AP_ID to the station rate table */ |
339 | if (new_assoc) { | 339 | if (new_assoc) { |
340 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 340 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
341 | ret = iwl_rxon_add_station(priv, | 341 | ret = iwl_rxon_add_station(priv, |
342 | priv->active_rxon.bssid_addr, 1); | 342 | priv->active_rxon.bssid_addr, 1); |
343 | if (ret == IWL_INVALID_STATION) { | 343 | if (ret == IWL_INVALID_STATION) { |
@@ -448,8 +448,8 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, | |||
448 | const u8 *dest, int left) | 448 | const u8 *dest, int left) |
449 | { | 449 | { |
450 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 450 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || |
451 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && | 451 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && |
452 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) | 452 | (priv->iw_mode != NL80211_IFTYPE_AP))) |
453 | return 0; | 453 | return 0; |
454 | 454 | ||
455 | if (priv->ibss_beacon->len > left) | 455 | if (priv->ibss_beacon->len > left) |
@@ -485,7 +485,7 @@ static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv) | |||
485 | return IWL_RATE_6M_PLCP; | 485 | return IWL_RATE_6M_PLCP; |
486 | } | 486 | } |
487 | 487 | ||
488 | unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | 488 | static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, |
489 | struct iwl_frame *frame, u8 rate) | 489 | struct iwl_frame *frame, u8 rate) |
490 | { | 490 | { |
491 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; | 491 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; |
@@ -564,8 +564,6 @@ static void iwl4965_ht_conf(struct iwl_priv *priv, | |||
564 | if (!iwl_conf->is_ht) | 564 | if (!iwl_conf->is_ht) |
565 | return; | 565 | return; |
566 | 566 | ||
567 | priv->ps_mode = (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2); | ||
568 | |||
569 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) | 567 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) |
570 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; | 568 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; |
571 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) | 569 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) |
@@ -586,6 +584,8 @@ static void iwl4965_ht_conf(struct iwl_priv *priv, | |||
586 | iwl_conf->supported_chan_width = 0; | 584 | iwl_conf->supported_chan_width = 0; |
587 | } | 585 | } |
588 | 586 | ||
587 | iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); | ||
588 | |||
589 | memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); | 589 | memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); |
590 | 590 | ||
591 | iwl_conf->control_channel = ht_bss_conf->primary_channel; | 591 | iwl_conf->control_channel = ht_bss_conf->primary_channel; |
@@ -672,7 +672,7 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) | |||
672 | beacon_int = priv->beacon_int; | 672 | beacon_int = priv->beacon_int; |
673 | spin_unlock_irqrestore(&priv->lock, flags); | 673 | spin_unlock_irqrestore(&priv->lock, flags); |
674 | 674 | ||
675 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 675 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
676 | if (beacon_int == 0) { | 676 | if (beacon_int == 0) { |
677 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | 677 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); |
678 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | 678 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); |
@@ -721,7 +721,7 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
721 | else | 721 | else |
722 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 722 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
723 | 723 | ||
724 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 724 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
725 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 725 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
726 | 726 | ||
727 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 727 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -740,23 +740,23 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
740 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 740 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
741 | 741 | ||
742 | switch (priv->iw_mode) { | 742 | switch (priv->iw_mode) { |
743 | case IEEE80211_IF_TYPE_AP: | 743 | case NL80211_IFTYPE_AP: |
744 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 744 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
745 | break; | 745 | break; |
746 | 746 | ||
747 | case IEEE80211_IF_TYPE_STA: | 747 | case NL80211_IFTYPE_STATION: |
748 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; | 748 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; |
749 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 749 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
750 | break; | 750 | break; |
751 | 751 | ||
752 | case IEEE80211_IF_TYPE_IBSS: | 752 | case NL80211_IFTYPE_ADHOC: |
753 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; | 753 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; |
754 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 754 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
755 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | | 755 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | |
756 | RXON_FILTER_ACCEPT_GRP_MSK; | 756 | RXON_FILTER_ACCEPT_GRP_MSK; |
757 | break; | 757 | break; |
758 | 758 | ||
759 | case IEEE80211_IF_TYPE_MNTR: | 759 | case NL80211_IFTYPE_MONITOR: |
760 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; | 760 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; |
761 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | | 761 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | |
762 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 762 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
@@ -785,7 +785,7 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
785 | * in some case A channels are all non IBSS | 785 | * in some case A channels are all non IBSS |
786 | * in this case force B/G channel | 786 | * in this case force B/G channel |
787 | */ | 787 | */ |
788 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 788 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
789 | !(is_channel_ibss(ch_info))) | 789 | !(is_channel_ibss(ch_info))) |
790 | ch_info = &priv->channel_info[0]; | 790 | ch_info = &priv->channel_info[0]; |
791 | 791 | ||
@@ -1182,7 +1182,7 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | |||
1182 | le32_to_cpu(beacon->low_tsf), rate); | 1182 | le32_to_cpu(beacon->low_tsf), rate); |
1183 | #endif | 1183 | #endif |
1184 | 1184 | ||
1185 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 1185 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
1186 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) | 1186 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) |
1187 | queue_work(priv->workqueue, &priv->beacon_update); | 1187 | queue_work(priv->workqueue, &priv->beacon_update); |
1188 | } | 1188 | } |
@@ -1270,7 +1270,7 @@ int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | |||
1270 | 1270 | ||
1271 | if (src == IWL_PWR_SRC_VAUX) { | 1271 | if (src == IWL_PWR_SRC_VAUX) { |
1272 | u32 val; | 1272 | u32 val; |
1273 | ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, | 1273 | ret = pci_read_config_dword(priv->pci_dev, PCI_CFG_POWER_SOURCE, |
1274 | &val); | 1274 | &val); |
1275 | 1275 | ||
1276 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) | 1276 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) |
@@ -2388,7 +2388,7 @@ static void iwl4965_bg_set_monitor(struct work_struct *work) | |||
2388 | 2388 | ||
2389 | mutex_lock(&priv->mutex); | 2389 | mutex_lock(&priv->mutex); |
2390 | 2390 | ||
2391 | ret = iwl4965_set_mode(priv, IEEE80211_IF_TYPE_MNTR); | 2391 | ret = iwl4965_set_mode(priv, NL80211_IFTYPE_MONITOR); |
2392 | 2392 | ||
2393 | if (ret) { | 2393 | if (ret) { |
2394 | if (ret == -EAGAIN) | 2394 | if (ret == -EAGAIN) |
@@ -2469,7 +2469,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2469 | DECLARE_MAC_BUF(mac); | 2469 | DECLARE_MAC_BUF(mac); |
2470 | unsigned long flags; | 2470 | unsigned long flags; |
2471 | 2471 | ||
2472 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2472 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2473 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); | 2473 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); |
2474 | return; | 2474 | return; |
2475 | } | 2475 | } |
@@ -2486,6 +2486,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2486 | if (!priv->vif || !priv->is_open) | 2486 | if (!priv->vif || !priv->is_open) |
2487 | return; | 2487 | return; |
2488 | 2488 | ||
2489 | iwl_power_cancel_timeout(priv); | ||
2489 | iwl_scan_cancel_timeout(priv, 200); | 2490 | iwl_scan_cancel_timeout(priv, 200); |
2490 | 2491 | ||
2491 | conf = ieee80211_get_hw_conf(priv->hw); | 2492 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -2503,8 +2504,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2503 | 2504 | ||
2504 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2505 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2505 | 2506 | ||
2506 | if (priv->current_ht_config.is_ht) | 2507 | iwl_set_rxon_ht(priv, &priv->current_ht_config); |
2507 | iwl_set_rxon_ht(priv, &priv->current_ht_config); | ||
2508 | 2508 | ||
2509 | iwl_set_rxon_chain(priv); | 2509 | iwl_set_rxon_chain(priv); |
2510 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 2510 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); |
@@ -2523,7 +2523,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2523 | else | 2523 | else |
2524 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2524 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2525 | 2525 | ||
2526 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2526 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2527 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2527 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2528 | 2528 | ||
2529 | } | 2529 | } |
@@ -2531,10 +2531,10 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2531 | iwl4965_commit_rxon(priv); | 2531 | iwl4965_commit_rxon(priv); |
2532 | 2532 | ||
2533 | switch (priv->iw_mode) { | 2533 | switch (priv->iw_mode) { |
2534 | case IEEE80211_IF_TYPE_STA: | 2534 | case NL80211_IFTYPE_STATION: |
2535 | break; | 2535 | break; |
2536 | 2536 | ||
2537 | case IEEE80211_IF_TYPE_IBSS: | 2537 | case NL80211_IFTYPE_ADHOC: |
2538 | 2538 | ||
2539 | /* assume default assoc id */ | 2539 | /* assume default assoc id */ |
2540 | priv->assoc_id = 1; | 2540 | priv->assoc_id = 1; |
@@ -2550,44 +2550,23 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2550 | break; | 2550 | break; |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | /* Enable Rx differential gain and sensitivity calibrations */ | 2553 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2554 | iwl_chain_noise_reset(priv); | ||
2555 | priv->start_calib = 1; | ||
2556 | |||
2557 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | ||
2558 | priv->assoc_station_added = 1; | 2554 | priv->assoc_station_added = 1; |
2559 | 2555 | ||
2560 | spin_lock_irqsave(&priv->lock, flags); | 2556 | spin_lock_irqsave(&priv->lock, flags); |
2561 | iwl_activate_qos(priv, 0); | 2557 | iwl_activate_qos(priv, 0); |
2562 | spin_unlock_irqrestore(&priv->lock, flags); | 2558 | spin_unlock_irqrestore(&priv->lock, flags); |
2563 | 2559 | ||
2564 | iwl_power_update_mode(priv, 0); | 2560 | /* the chain noise calibration will enabled PM upon completion |
2565 | /* we have just associated, don't start scan too early */ | 2561 | * If chain noise has already been run, then we need to enable |
2566 | priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; | 2562 | * power management here */ |
2567 | } | 2563 | if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE) |
2568 | 2564 | iwl_power_enable_management(priv); | |
2569 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | ||
2570 | |||
2571 | static void iwl_bg_scan_completed(struct work_struct *work) | ||
2572 | { | ||
2573 | struct iwl_priv *priv = | ||
2574 | container_of(work, struct iwl_priv, scan_completed); | ||
2575 | |||
2576 | IWL_DEBUG_SCAN("SCAN complete scan\n"); | ||
2577 | |||
2578 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
2579 | return; | ||
2580 | |||
2581 | if (test_bit(STATUS_CONF_PENDING, &priv->status)) | ||
2582 | iwl4965_mac_config(priv->hw, ieee80211_get_hw_conf(priv->hw)); | ||
2583 | 2565 | ||
2584 | ieee80211_scan_completed(priv->hw); | 2566 | /* Enable Rx differential gain and sensitivity calibrations */ |
2567 | iwl_chain_noise_reset(priv); | ||
2568 | priv->start_calib = 1; | ||
2585 | 2569 | ||
2586 | /* Since setting the TXPOWER may have been deferred while | ||
2587 | * performing the scan, fire one off */ | ||
2588 | mutex_lock(&priv->mutex); | ||
2589 | iwl_set_tx_power(priv, priv->tx_power_user_lmt, true); | ||
2590 | mutex_unlock(&priv->mutex); | ||
2591 | } | 2570 | } |
2592 | 2571 | ||
2593 | /***************************************************************************** | 2572 | /***************************************************************************** |
@@ -2728,12 +2707,6 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2728 | 2707 | ||
2729 | IWL_DEBUG_MACDUMP("enter\n"); | 2708 | IWL_DEBUG_MACDUMP("enter\n"); |
2730 | 2709 | ||
2731 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | ||
2732 | IWL_DEBUG_MAC80211("leave - monitor\n"); | ||
2733 | dev_kfree_skb_any(skb); | ||
2734 | return 0; | ||
2735 | } | ||
2736 | |||
2737 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 2710 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
2738 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 2711 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
2739 | 2712 | ||
@@ -2798,8 +2771,6 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2798 | mutex_lock(&priv->mutex); | 2771 | mutex_lock(&priv->mutex); |
2799 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); | 2772 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); |
2800 | 2773 | ||
2801 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); | ||
2802 | |||
2803 | if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) { | 2774 | if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) { |
2804 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); | 2775 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); |
2805 | goto out; | 2776 | goto out; |
@@ -2817,7 +2788,6 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2817 | if (unlikely(!priv->cfg->mod_params->disable_hw_scan && | 2788 | if (unlikely(!priv->cfg->mod_params->disable_hw_scan && |
2818 | test_bit(STATUS_SCANNING, &priv->status))) { | 2789 | test_bit(STATUS_SCANNING, &priv->status))) { |
2819 | IWL_DEBUG_MAC80211("leave - scanning\n"); | 2790 | IWL_DEBUG_MAC80211("leave - scanning\n"); |
2820 | set_bit(STATUS_CONF_PENDING, &priv->status); | ||
2821 | mutex_unlock(&priv->mutex); | 2791 | mutex_unlock(&priv->mutex); |
2822 | return 0; | 2792 | return 0; |
2823 | } | 2793 | } |
@@ -2830,7 +2800,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2830 | goto out; | 2800 | goto out; |
2831 | } | 2801 | } |
2832 | 2802 | ||
2833 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 2803 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
2834 | !is_channel_ibss(ch_info)) { | 2804 | !is_channel_ibss(ch_info)) { |
2835 | IWL_ERROR("channel %d in band %d not IBSS channel\n", | 2805 | IWL_ERROR("channel %d in band %d not IBSS channel\n", |
2836 | conf->channel->hw_value, conf->channel->band); | 2806 | conf->channel->hw_value, conf->channel->band); |
@@ -2851,7 +2821,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2851 | ) | 2821 | ) |
2852 | priv->staging_rxon.flags = 0; | 2822 | priv->staging_rxon.flags = 0; |
2853 | 2823 | ||
2854 | iwl_set_rxon_channel(priv, conf->channel->band, channel); | 2824 | iwl_set_rxon_channel(priv, conf->channel); |
2855 | 2825 | ||
2856 | iwl_set_flags_for_band(priv, conf->channel->band); | 2826 | iwl_set_flags_for_band(priv, conf->channel->band); |
2857 | 2827 | ||
@@ -2880,6 +2850,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2880 | goto out; | 2850 | goto out; |
2881 | } | 2851 | } |
2882 | 2852 | ||
2853 | if (conf->flags & IEEE80211_CONF_PS) | ||
2854 | ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3); | ||
2855 | else | ||
2856 | ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM); | ||
2857 | if (ret) | ||
2858 | IWL_DEBUG_MAC80211("Error setting power level\n"); | ||
2859 | |||
2883 | IWL_DEBUG_MAC80211("TX Power old=%d new=%d\n", | 2860 | IWL_DEBUG_MAC80211("TX Power old=%d new=%d\n", |
2884 | priv->tx_power_user_lmt, conf->power_level); | 2861 | priv->tx_power_user_lmt, conf->power_level); |
2885 | 2862 | ||
@@ -2896,7 +2873,6 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2896 | IWL_DEBUG_MAC80211("leave\n"); | 2873 | IWL_DEBUG_MAC80211("leave\n"); |
2897 | 2874 | ||
2898 | out: | 2875 | out: |
2899 | clear_bit(STATUS_CONF_PENDING, &priv->status); | ||
2900 | mutex_unlock(&priv->mutex); | 2876 | mutex_unlock(&priv->mutex); |
2901 | return ret; | 2877 | return ret; |
2902 | } | 2878 | } |
@@ -2945,7 +2921,7 @@ static void iwl4965_config_ap(struct iwl_priv *priv) | |||
2945 | priv->staging_rxon.flags &= | 2921 | priv->staging_rxon.flags &= |
2946 | ~RXON_FLG_SHORT_SLOT_MSK; | 2922 | ~RXON_FLG_SHORT_SLOT_MSK; |
2947 | 2923 | ||
2948 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2924 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2949 | priv->staging_rxon.flags &= | 2925 | priv->staging_rxon.flags &= |
2950 | ~RXON_FLG_SHORT_SLOT_MSK; | 2926 | ~RXON_FLG_SHORT_SLOT_MSK; |
2951 | } | 2927 | } |
@@ -2984,7 +2960,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2984 | return 0; | 2960 | return 0; |
2985 | } | 2961 | } |
2986 | 2962 | ||
2987 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 2963 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
2988 | conf->changed & IEEE80211_IFCC_BEACON) { | 2964 | conf->changed & IEEE80211_IFCC_BEACON) { |
2989 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 2965 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
2990 | if (!beacon) | 2966 | if (!beacon) |
@@ -2994,7 +2970,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2994 | return rc; | 2970 | return rc; |
2995 | } | 2971 | } |
2996 | 2972 | ||
2997 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 2973 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
2998 | (!conf->ssid_len)) { | 2974 | (!conf->ssid_len)) { |
2999 | IWL_DEBUG_MAC80211 | 2975 | IWL_DEBUG_MAC80211 |
3000 | ("Leaving in AP mode because HostAPD is not ready.\n"); | 2976 | ("Leaving in AP mode because HostAPD is not ready.\n"); |
@@ -3017,7 +2993,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3017 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | 2993 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { |
3018 | */ | 2994 | */ |
3019 | 2995 | ||
3020 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2996 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
3021 | if (!conf->bssid) { | 2997 | if (!conf->bssid) { |
3022 | conf->bssid = priv->mac_addr; | 2998 | conf->bssid = priv->mac_addr; |
3023 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 2999 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
@@ -3052,11 +3028,11 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3052 | * to verify) - jpk */ | 3028 | * to verify) - jpk */ |
3053 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 3029 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
3054 | 3030 | ||
3055 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 3031 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
3056 | iwl4965_config_ap(priv); | 3032 | iwl4965_config_ap(priv); |
3057 | else { | 3033 | else { |
3058 | rc = iwl4965_commit_rxon(priv); | 3034 | rc = iwl4965_commit_rxon(priv); |
3059 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 3035 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) |
3060 | iwl_rxon_add_station( | 3036 | iwl_rxon_add_station( |
3061 | priv, priv->active_rxon.bssid_addr, 1); | 3037 | priv, priv->active_rxon.bssid_addr, 1); |
3062 | } | 3038 | } |
@@ -3092,7 +3068,7 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw, | |||
3092 | 3068 | ||
3093 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 3069 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { |
3094 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 3070 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", |
3095 | IEEE80211_IF_TYPE_MNTR, | 3071 | NL80211_IFTYPE_MONITOR, |
3096 | changed_flags, *total_flags); | 3072 | changed_flags, *total_flags); |
3097 | /* queue work 'cuz mac80211 is holding a lock which | 3073 | /* queue work 'cuz mac80211 is holding a lock which |
3098 | * prevents us from issuing (synchronous) f/w cmds */ | 3074 | * prevents us from issuing (synchronous) f/w cmds */ |
@@ -3173,6 +3149,10 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
3173 | priv->power_data.dtim_period = bss_conf->dtim_period; | 3149 | priv->power_data.dtim_period = bss_conf->dtim_period; |
3174 | priv->timestamp = bss_conf->timestamp; | 3150 | priv->timestamp = bss_conf->timestamp; |
3175 | priv->assoc_capability = bss_conf->assoc_capability; | 3151 | priv->assoc_capability = bss_conf->assoc_capability; |
3152 | |||
3153 | /* we have just associated, don't start scan too early | ||
3154 | * leave time for EAPOL exchange to complete | ||
3155 | */ | ||
3176 | priv->next_scan_jiffies = jiffies + | 3156 | priv->next_scan_jiffies = jiffies + |
3177 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | 3157 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; |
3178 | mutex_lock(&priv->mutex); | 3158 | mutex_lock(&priv->mutex); |
@@ -3189,11 +3169,11 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
3189 | 3169 | ||
3190 | } | 3170 | } |
3191 | 3171 | ||
3192 | static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | 3172 | static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len) |
3193 | { | 3173 | { |
3194 | int rc = 0; | ||
3195 | unsigned long flags; | 3174 | unsigned long flags; |
3196 | struct iwl_priv *priv = hw->priv; | 3175 | struct iwl_priv *priv = hw->priv; |
3176 | int ret; | ||
3197 | 3177 | ||
3198 | IWL_DEBUG_MAC80211("enter\n"); | 3178 | IWL_DEBUG_MAC80211("enter\n"); |
3199 | 3179 | ||
@@ -3201,41 +3181,47 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
3201 | spin_lock_irqsave(&priv->lock, flags); | 3181 | spin_lock_irqsave(&priv->lock, flags); |
3202 | 3182 | ||
3203 | if (!iwl_is_ready_rf(priv)) { | 3183 | if (!iwl_is_ready_rf(priv)) { |
3204 | rc = -EIO; | 3184 | ret = -EIO; |
3205 | IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); | 3185 | IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); |
3206 | goto out_unlock; | 3186 | goto out_unlock; |
3207 | } | 3187 | } |
3208 | 3188 | ||
3209 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */ | 3189 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ |
3210 | rc = -EIO; | 3190 | ret = -EIO; |
3211 | IWL_ERROR("ERROR: APs don't scan\n"); | 3191 | IWL_ERROR("ERROR: APs don't scan\n"); |
3212 | goto out_unlock; | 3192 | goto out_unlock; |
3213 | } | 3193 | } |
3214 | 3194 | ||
3215 | /* we don't schedule scan within next_scan_jiffies period */ | 3195 | /* We don't schedule scan within next_scan_jiffies period. |
3196 | * Avoid scanning during possible EAPOL exchange, return | ||
3197 | * success immediately. | ||
3198 | */ | ||
3216 | if (priv->next_scan_jiffies && | 3199 | if (priv->next_scan_jiffies && |
3217 | time_after(priv->next_scan_jiffies, jiffies)) { | 3200 | time_after(priv->next_scan_jiffies, jiffies)) { |
3218 | rc = -EAGAIN; | 3201 | IWL_DEBUG_SCAN("scan rejected: within next scan period\n"); |
3202 | queue_work(priv->workqueue, &priv->scan_completed); | ||
3203 | ret = 0; | ||
3219 | goto out_unlock; | 3204 | goto out_unlock; |
3220 | } | 3205 | } |
3206 | |||
3221 | /* if we just finished scan ask for delay */ | 3207 | /* if we just finished scan ask for delay */ |
3222 | if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies + | 3208 | if (iwl_is_associated(priv) && priv->last_scan_jiffies && |
3223 | IWL_DELAY_NEXT_SCAN, jiffies)) { | 3209 | time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) { |
3224 | rc = -EAGAIN; | 3210 | IWL_DEBUG_SCAN("scan rejected: within previous scan period\n"); |
3211 | queue_work(priv->workqueue, &priv->scan_completed); | ||
3212 | ret = 0; | ||
3225 | goto out_unlock; | 3213 | goto out_unlock; |
3226 | } | 3214 | } |
3227 | if (len) { | ||
3228 | IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", | ||
3229 | iwl_escape_essid(ssid, len), (int)len); | ||
3230 | 3215 | ||
3216 | if (ssid_len) { | ||
3231 | priv->one_direct_scan = 1; | 3217 | priv->one_direct_scan = 1; |
3232 | priv->direct_ssid_len = (u8) | 3218 | priv->direct_ssid_len = min_t(u8, ssid_len, IW_ESSID_MAX_SIZE); |
3233 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); | ||
3234 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | 3219 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); |
3235 | } else | 3220 | } else { |
3236 | priv->one_direct_scan = 0; | 3221 | priv->one_direct_scan = 0; |
3222 | } | ||
3237 | 3223 | ||
3238 | rc = iwl_scan_initiate(priv); | 3224 | ret = iwl_scan_initiate(priv); |
3239 | 3225 | ||
3240 | IWL_DEBUG_MAC80211("leave\n"); | 3226 | IWL_DEBUG_MAC80211("leave\n"); |
3241 | 3227 | ||
@@ -3243,7 +3229,7 @@ out_unlock: | |||
3243 | spin_unlock_irqrestore(&priv->lock, flags); | 3229 | spin_unlock_irqrestore(&priv->lock, flags); |
3244 | mutex_unlock(&priv->mutex); | 3230 | mutex_unlock(&priv->mutex); |
3245 | 3231 | ||
3246 | return rc; | 3232 | return ret; |
3247 | } | 3233 | } |
3248 | 3234 | ||
3249 | static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | 3235 | static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, |
@@ -3332,7 +3318,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3332 | * in 1X mode. | 3318 | * in 1X mode. |
3333 | * In legacy wep mode, we use another host command to the uCode */ | 3319 | * In legacy wep mode, we use another host command to the uCode */ |
3334 | if (key->alg == ALG_WEP && sta_id == priv->hw_params.bcast_sta_id && | 3320 | if (key->alg == ALG_WEP && sta_id == priv->hw_params.bcast_sta_id && |
3335 | priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 3321 | priv->iw_mode != NL80211_IFTYPE_AP) { |
3336 | if (cmd == SET_KEY) | 3322 | if (cmd == SET_KEY) |
3337 | is_default_wep_key = !priv->key_mapping_key; | 3323 | is_default_wep_key = !priv->key_mapping_key; |
3338 | else | 3324 | else |
@@ -3403,7 +3389,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3403 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | 3389 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; |
3404 | priv->qos_data.qos_active = 1; | 3390 | priv->qos_data.qos_active = 1; |
3405 | 3391 | ||
3406 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 3392 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
3407 | iwl_activate_qos(priv, 1); | 3393 | iwl_activate_qos(priv, 1); |
3408 | else if (priv->assoc_id && iwl_is_associated(priv)) | 3394 | else if (priv->assoc_id && iwl_is_associated(priv)) |
3409 | iwl_activate_qos(priv, 0); | 3395 | iwl_activate_qos(priv, 0); |
@@ -3416,13 +3402,13 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3416 | 3402 | ||
3417 | static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | 3403 | static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, |
3418 | enum ieee80211_ampdu_mlme_action action, | 3404 | enum ieee80211_ampdu_mlme_action action, |
3419 | const u8 *addr, u16 tid, u16 *ssn) | 3405 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
3420 | { | 3406 | { |
3421 | struct iwl_priv *priv = hw->priv; | 3407 | struct iwl_priv *priv = hw->priv; |
3422 | DECLARE_MAC_BUF(mac); | 3408 | DECLARE_MAC_BUF(mac); |
3423 | 3409 | ||
3424 | IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", | 3410 | IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", |
3425 | print_mac(mac, addr), tid); | 3411 | print_mac(mac, sta->addr), tid); |
3426 | 3412 | ||
3427 | if (!(priv->cfg->sku & IWL_SKU_N)) | 3413 | if (!(priv->cfg->sku & IWL_SKU_N)) |
3428 | return -EACCES; | 3414 | return -EACCES; |
@@ -3430,16 +3416,16 @@ static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3430 | switch (action) { | 3416 | switch (action) { |
3431 | case IEEE80211_AMPDU_RX_START: | 3417 | case IEEE80211_AMPDU_RX_START: |
3432 | IWL_DEBUG_HT("start Rx\n"); | 3418 | IWL_DEBUG_HT("start Rx\n"); |
3433 | return iwl_rx_agg_start(priv, addr, tid, *ssn); | 3419 | return iwl_rx_agg_start(priv, sta->addr, tid, *ssn); |
3434 | case IEEE80211_AMPDU_RX_STOP: | 3420 | case IEEE80211_AMPDU_RX_STOP: |
3435 | IWL_DEBUG_HT("stop Rx\n"); | 3421 | IWL_DEBUG_HT("stop Rx\n"); |
3436 | return iwl_rx_agg_stop(priv, addr, tid); | 3422 | return iwl_rx_agg_stop(priv, sta->addr, tid); |
3437 | case IEEE80211_AMPDU_TX_START: | 3423 | case IEEE80211_AMPDU_TX_START: |
3438 | IWL_DEBUG_HT("start Tx\n"); | 3424 | IWL_DEBUG_HT("start Tx\n"); |
3439 | return iwl_tx_agg_start(priv, addr, tid, ssn); | 3425 | return iwl_tx_agg_start(priv, sta->addr, tid, ssn); |
3440 | case IEEE80211_AMPDU_TX_STOP: | 3426 | case IEEE80211_AMPDU_TX_STOP: |
3441 | IWL_DEBUG_HT("stop Tx\n"); | 3427 | IWL_DEBUG_HT("stop Tx\n"); |
3442 | return iwl_tx_agg_stop(priv, addr, tid); | 3428 | return iwl_tx_agg_stop(priv, sta->addr, tid); |
3443 | default: | 3429 | default: |
3444 | IWL_DEBUG_HT("unknown\n"); | 3430 | IWL_DEBUG_HT("unknown\n"); |
3445 | return -EINVAL; | 3431 | return -EINVAL; |
@@ -3521,7 +3507,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3521 | 3507 | ||
3522 | priv->beacon_int = priv->hw->conf.beacon_int; | 3508 | priv->beacon_int = priv->hw->conf.beacon_int; |
3523 | priv->timestamp = 0; | 3509 | priv->timestamp = 0; |
3524 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 3510 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) |
3525 | priv->beacon_int = 0; | 3511 | priv->beacon_int = 0; |
3526 | 3512 | ||
3527 | spin_unlock_irqrestore(&priv->lock, flags); | 3513 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -3535,7 +3521,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3535 | /* we are restarting association process | 3521 | /* we are restarting association process |
3536 | * clear RXON_FILTER_ASSOC_MSK bit | 3522 | * clear RXON_FILTER_ASSOC_MSK bit |
3537 | */ | 3523 | */ |
3538 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 3524 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
3539 | iwl_scan_cancel_timeout(priv, 100); | 3525 | iwl_scan_cancel_timeout(priv, 100); |
3540 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3526 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3541 | iwl4965_commit_rxon(priv); | 3527 | iwl4965_commit_rxon(priv); |
@@ -3544,7 +3530,17 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3544 | iwl_power_update_mode(priv, 0); | 3530 | iwl_power_update_mode(priv, 0); |
3545 | 3531 | ||
3546 | /* Per mac80211.h: This is only used in IBSS mode... */ | 3532 | /* Per mac80211.h: This is only used in IBSS mode... */ |
3547 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 3533 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
3534 | |||
3535 | /* switch to CAM during association period. | ||
3536 | * the ucode will block any association/authentication | ||
3537 | * frome during assiciation period if it can not hear | ||
3538 | * the AP because of PM. the timer enable PM back is | ||
3539 | * association do not complete | ||
3540 | */ | ||
3541 | if (priv->hw->conf.channel->flags & (IEEE80211_CHAN_PASSIVE_SCAN | | ||
3542 | IEEE80211_CHAN_RADAR)) | ||
3543 | iwl_power_disable_management(priv, 3000); | ||
3548 | 3544 | ||
3549 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 3545 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
3550 | mutex_unlock(&priv->mutex); | 3546 | mutex_unlock(&priv->mutex); |
@@ -3573,7 +3569,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
3573 | return -EIO; | 3569 | return -EIO; |
3574 | } | 3570 | } |
3575 | 3571 | ||
3576 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 3572 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
3577 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 3573 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
3578 | mutex_unlock(&priv->mutex); | 3574 | mutex_unlock(&priv->mutex); |
3579 | return -EIO; | 3575 | return -EIO; |
@@ -3630,11 +3626,11 @@ static ssize_t store_debug_level(struct device *d, | |||
3630 | const char *buf, size_t count) | 3626 | const char *buf, size_t count) |
3631 | { | 3627 | { |
3632 | struct iwl_priv *priv = d->driver_data; | 3628 | struct iwl_priv *priv = d->driver_data; |
3633 | char *p = (char *)buf; | 3629 | unsigned long val; |
3634 | u32 val; | 3630 | int ret; |
3635 | 3631 | ||
3636 | val = simple_strtoul(p, &p, 0); | 3632 | ret = strict_strtoul(buf, 0, &val); |
3637 | if (p == buf) | 3633 | if (ret) |
3638 | printk(KERN_INFO DRV_NAME | 3634 | printk(KERN_INFO DRV_NAME |
3639 | ": %s is not in hex or decimal form.\n", buf); | 3635 | ": %s is not in hex or decimal form.\n", buf); |
3640 | else | 3636 | else |
@@ -3706,11 +3702,11 @@ static ssize_t store_tx_power(struct device *d, | |||
3706 | const char *buf, size_t count) | 3702 | const char *buf, size_t count) |
3707 | { | 3703 | { |
3708 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3704 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3709 | char *p = (char *)buf; | 3705 | unsigned long val; |
3710 | u32 val; | 3706 | int ret; |
3711 | 3707 | ||
3712 | val = simple_strtoul(p, &p, 10); | 3708 | ret = strict_strtoul(buf, 10, &val); |
3713 | if (p == buf) | 3709 | if (ret) |
3714 | printk(KERN_INFO DRV_NAME | 3710 | printk(KERN_INFO DRV_NAME |
3715 | ": %s is not in decimal form.\n", buf); | 3711 | ": %s is not in decimal form.\n", buf); |
3716 | else | 3712 | else |
@@ -3734,7 +3730,12 @@ static ssize_t store_flags(struct device *d, | |||
3734 | const char *buf, size_t count) | 3730 | const char *buf, size_t count) |
3735 | { | 3731 | { |
3736 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3732 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3737 | u32 flags = simple_strtoul(buf, NULL, 0); | 3733 | unsigned long val; |
3734 | u32 flags; | ||
3735 | int ret = strict_strtoul(buf, 0, &val); | ||
3736 | if (ret) | ||
3737 | return ret; | ||
3738 | flags = (u32)val; | ||
3738 | 3739 | ||
3739 | mutex_lock(&priv->mutex); | 3740 | mutex_lock(&priv->mutex); |
3740 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { | 3741 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { |
@@ -3742,8 +3743,7 @@ static ssize_t store_flags(struct device *d, | |||
3742 | if (iwl_scan_cancel_timeout(priv, 100)) | 3743 | if (iwl_scan_cancel_timeout(priv, 100)) |
3743 | IWL_WARNING("Could not cancel scan.\n"); | 3744 | IWL_WARNING("Could not cancel scan.\n"); |
3744 | else { | 3745 | else { |
3745 | IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", | 3746 | IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags); |
3746 | flags); | ||
3747 | priv->staging_rxon.flags = cpu_to_le32(flags); | 3747 | priv->staging_rxon.flags = cpu_to_le32(flags); |
3748 | iwl4965_commit_rxon(priv); | 3748 | iwl4965_commit_rxon(priv); |
3749 | } | 3749 | } |
@@ -3769,7 +3769,12 @@ static ssize_t store_filter_flags(struct device *d, | |||
3769 | const char *buf, size_t count) | 3769 | const char *buf, size_t count) |
3770 | { | 3770 | { |
3771 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3771 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3772 | u32 filter_flags = simple_strtoul(buf, NULL, 0); | 3772 | unsigned long val; |
3773 | u32 filter_flags; | ||
3774 | int ret = strict_strtoul(buf, 0, &val); | ||
3775 | if (ret) | ||
3776 | return ret; | ||
3777 | filter_flags = (u32)val; | ||
3773 | 3778 | ||
3774 | mutex_lock(&priv->mutex); | 3779 | mutex_lock(&priv->mutex); |
3775 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { | 3780 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { |
@@ -3870,10 +3875,12 @@ static ssize_t store_retry_rate(struct device *d, | |||
3870 | const char *buf, size_t count) | 3875 | const char *buf, size_t count) |
3871 | { | 3876 | { |
3872 | struct iwl_priv *priv = dev_get_drvdata(d); | 3877 | struct iwl_priv *priv = dev_get_drvdata(d); |
3878 | long val; | ||
3879 | int ret = strict_strtol(buf, 10, &val); | ||
3880 | if (!ret) | ||
3881 | return ret; | ||
3873 | 3882 | ||
3874 | priv->retry_rate = simple_strtoul(buf, NULL, 0); | 3883 | priv->retry_rate = (val > 0) ? val : 1; |
3875 | if (priv->retry_rate <= 0) | ||
3876 | priv->retry_rate = 1; | ||
3877 | 3884 | ||
3878 | return count; | 3885 | return count; |
3879 | } | 3886 | } |
@@ -3894,9 +3901,9 @@ static ssize_t store_power_level(struct device *d, | |||
3894 | { | 3901 | { |
3895 | struct iwl_priv *priv = dev_get_drvdata(d); | 3902 | struct iwl_priv *priv = dev_get_drvdata(d); |
3896 | int ret; | 3903 | int ret; |
3897 | int mode; | 3904 | unsigned long mode; |
3905 | |||
3898 | 3906 | ||
3899 | mode = simple_strtoul(buf, NULL, 0); | ||
3900 | mutex_lock(&priv->mutex); | 3907 | mutex_lock(&priv->mutex); |
3901 | 3908 | ||
3902 | if (!iwl_is_ready(priv)) { | 3909 | if (!iwl_is_ready(priv)) { |
@@ -3904,6 +3911,10 @@ static ssize_t store_power_level(struct device *d, | |||
3904 | goto out; | 3911 | goto out; |
3905 | } | 3912 | } |
3906 | 3913 | ||
3914 | ret = strict_strtoul(buf, 10, &mode); | ||
3915 | if (ret) | ||
3916 | goto out; | ||
3917 | |||
3907 | ret = iwl_power_set_user_mode(priv, mode); | 3918 | ret = iwl_power_set_user_mode(priv, mode); |
3908 | if (ret) { | 3919 | if (ret) { |
3909 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); | 3920 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); |
@@ -4080,9 +4091,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
4080 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); | 4091 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); |
4081 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); | 4092 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); |
4082 | 4093 | ||
4083 | /* FIXME : remove when resolved PENDING */ | ||
4084 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | ||
4085 | iwl_setup_scan_deferred_work(priv); | 4094 | iwl_setup_scan_deferred_work(priv); |
4095 | iwl_setup_power_deferred_work(priv); | ||
4086 | 4096 | ||
4087 | if (priv->cfg->ops->lib->setup_deferred_work) | 4097 | if (priv->cfg->ops->lib->setup_deferred_work) |
4088 | priv->cfg->ops->lib->setup_deferred_work(priv); | 4098 | priv->cfg->ops->lib->setup_deferred_work(priv); |
@@ -4102,6 +4112,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
4102 | 4112 | ||
4103 | cancel_delayed_work_sync(&priv->init_alive_start); | 4113 | cancel_delayed_work_sync(&priv->init_alive_start); |
4104 | cancel_delayed_work(&priv->scan_check); | 4114 | cancel_delayed_work(&priv->scan_check); |
4115 | cancel_delayed_work_sync(&priv->set_power_save); | ||
4105 | cancel_delayed_work(&priv->alive_start); | 4116 | cancel_delayed_work(&priv->alive_start); |
4106 | cancel_work_sync(&priv->beacon_update); | 4117 | cancel_work_sync(&priv->beacon_update); |
4107 | del_timer_sync(&priv->statistics_periodic); | 4118 | del_timer_sync(&priv->statistics_periodic); |
@@ -4150,7 +4161,7 @@ static struct ieee80211_ops iwl4965_hw_ops = { | |||
4150 | .reset_tsf = iwl4965_mac_reset_tsf, | 4161 | .reset_tsf = iwl4965_mac_reset_tsf, |
4151 | .bss_info_changed = iwl4965_bss_info_changed, | 4162 | .bss_info_changed = iwl4965_bss_info_changed, |
4152 | .ampdu_action = iwl4965_mac_ampdu_action, | 4163 | .ampdu_action = iwl4965_mac_ampdu_action, |
4153 | .hw_scan = iwl4965_mac_hw_scan | 4164 | .hw_scan = iwl_mac_hw_scan |
4154 | }; | 4165 | }; |
4155 | 4166 | ||
4156 | static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 4167 | static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
@@ -4204,13 +4215,13 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4204 | 4215 | ||
4205 | pci_set_master(pdev); | 4216 | pci_set_master(pdev); |
4206 | 4217 | ||
4207 | err = pci_set_dma_mask(pdev, DMA_64BIT_MASK); | 4218 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); |
4208 | if (!err) | 4219 | if (!err) |
4209 | err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); | 4220 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); |
4210 | if (err) { | 4221 | if (err) { |
4211 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 4222 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
4212 | if (!err) | 4223 | if (!err) |
4213 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 4224 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); |
4214 | /* both attempts failed: */ | 4225 | /* both attempts failed: */ |
4215 | if (err) { | 4226 | if (err) { |
4216 | printk(KERN_WARNING "%s: No suitable DMA available.\n", | 4227 | printk(KERN_WARNING "%s: No suitable DMA available.\n", |
@@ -4225,9 +4236,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4225 | 4236 | ||
4226 | pci_set_drvdata(pdev, priv); | 4237 | pci_set_drvdata(pdev, priv); |
4227 | 4238 | ||
4228 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | ||
4229 | * PCI Tx retries from interfering with C3 CPU state */ | ||
4230 | pci_write_config_byte(pdev, 0x41, 0x00); | ||
4231 | 4239 | ||
4232 | /*********************** | 4240 | /*********************** |
4233 | * 3. Read REV register | 4241 | * 3. Read REV register |
@@ -4247,6 +4255,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4247 | ": Detected Intel Wireless WiFi Link %s REV=0x%X\n", | 4255 | ": Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
4248 | priv->cfg->name, priv->hw_rev); | 4256 | priv->cfg->name, priv->hw_rev); |
4249 | 4257 | ||
4258 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | ||
4259 | * PCI Tx retries from interfering with C3 CPU state */ | ||
4260 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | ||
4261 | |||
4250 | /* amp init */ | 4262 | /* amp init */ |
4251 | err = priv->cfg->ops->lib->apm_ops.init(priv); | 4263 | err = priv->cfg->ops->lib->apm_ops.init(priv); |
4252 | if (err < 0) { | 4264 | if (err < 0) { |
@@ -4481,7 +4493,10 @@ static struct pci_device_id iwl_hw_card_ids[] = { | |||
4481 | {IWL_PCI_DEVICE(0x4235, PCI_ANY_ID, iwl5300_agn_cfg)}, | 4493 | {IWL_PCI_DEVICE(0x4235, PCI_ANY_ID, iwl5300_agn_cfg)}, |
4482 | {IWL_PCI_DEVICE(0x4236, PCI_ANY_ID, iwl5300_agn_cfg)}, | 4494 | {IWL_PCI_DEVICE(0x4236, PCI_ANY_ID, iwl5300_agn_cfg)}, |
4483 | {IWL_PCI_DEVICE(0x4237, PCI_ANY_ID, iwl5100_agn_cfg)}, | 4495 | {IWL_PCI_DEVICE(0x4237, PCI_ANY_ID, iwl5100_agn_cfg)}, |
4484 | {IWL_PCI_DEVICE(0x423A, PCI_ANY_ID, iwl5350_agn_cfg)}, | 4496 | /* 5350 WiFi/WiMax */ |
4497 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, | ||
4498 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, | ||
4499 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, | ||
4485 | #endif /* CONFIG_IWL5000 */ | 4500 | #endif /* CONFIG_IWL5000 */ |
4486 | {0} | 4501 | {0} |
4487 | }; | 4502 | }; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c index ef49440bd7f6..72fbf47229db 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-calib.c | |||
@@ -66,6 +66,66 @@ | |||
66 | #include "iwl-core.h" | 66 | #include "iwl-core.h" |
67 | #include "iwl-calib.h" | 67 | #include "iwl-calib.h" |
68 | 68 | ||
69 | /***************************************************************************** | ||
70 | * INIT calibrations framework | ||
71 | *****************************************************************************/ | ||
72 | |||
73 | int iwl_send_calib_results(struct iwl_priv *priv) | ||
74 | { | ||
75 | int ret = 0; | ||
76 | int i = 0; | ||
77 | |||
78 | struct iwl_host_cmd hcmd = { | ||
79 | .id = REPLY_PHY_CALIBRATION_CMD, | ||
80 | .meta.flags = CMD_SIZE_HUGE, | ||
81 | }; | ||
82 | |||
83 | for (i = 0; i < IWL_CALIB_MAX; i++) | ||
84 | if (priv->calib_results[i].buf) { | ||
85 | hcmd.len = priv->calib_results[i].buf_len; | ||
86 | hcmd.data = priv->calib_results[i].buf; | ||
87 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
88 | if (ret) | ||
89 | goto err; | ||
90 | } | ||
91 | |||
92 | return 0; | ||
93 | err: | ||
94 | IWL_ERROR("Error %d iteration %d\n", ret, i); | ||
95 | return ret; | ||
96 | } | ||
97 | EXPORT_SYMBOL(iwl_send_calib_results); | ||
98 | |||
99 | int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len) | ||
100 | { | ||
101 | if (res->buf_len != len) { | ||
102 | kfree(res->buf); | ||
103 | res->buf = kzalloc(len, GFP_ATOMIC); | ||
104 | } | ||
105 | if (unlikely(res->buf == NULL)) | ||
106 | return -ENOMEM; | ||
107 | |||
108 | res->buf_len = len; | ||
109 | memcpy(res->buf, buf, len); | ||
110 | return 0; | ||
111 | } | ||
112 | EXPORT_SYMBOL(iwl_calib_set); | ||
113 | |||
114 | void iwl_calib_free_results(struct iwl_priv *priv) | ||
115 | { | ||
116 | int i; | ||
117 | |||
118 | for (i = 0; i < IWL_CALIB_MAX; i++) { | ||
119 | kfree(priv->calib_results[i].buf); | ||
120 | priv->calib_results[i].buf = NULL; | ||
121 | priv->calib_results[i].buf_len = 0; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /***************************************************************************** | ||
126 | * RUNTIME calibrations framework | ||
127 | *****************************************************************************/ | ||
128 | |||
69 | /* "false alarms" are signals that our DSP tries to lock onto, | 129 | /* "false alarms" are signals that our DSP tries to lock onto, |
70 | * but then determines that they are either noise, or transmissions | 130 | * but then determines that they are either noise, or transmissions |
71 | * from a distant wireless network (also "noise", really) that get | 131 | * from a distant wireless network (also "noise", really) that get |
@@ -748,13 +808,11 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
748 | } | 808 | } |
749 | } | 809 | } |
750 | 810 | ||
811 | /* Save for use within RXON, TX, SCAN commands, etc. */ | ||
812 | priv->chain_noise_data.active_chains = active_chains; | ||
751 | IWL_DEBUG_CALIB("active_chains (bitwise) = 0x%x\n", | 813 | IWL_DEBUG_CALIB("active_chains (bitwise) = 0x%x\n", |
752 | active_chains); | 814 | active_chains); |
753 | 815 | ||
754 | /* Save for use within RXON, TX, SCAN commands, etc. */ | ||
755 | /*priv->valid_antenna = active_chains;*/ | ||
756 | /*FIXME: should be reflected in RX chains in RXON */ | ||
757 | |||
758 | /* Analyze noise for rx balance */ | 816 | /* Analyze noise for rx balance */ |
759 | average_noise[0] = ((data->chain_noise_a)/CAL_NUM_OF_BEACONS); | 817 | average_noise[0] = ((data->chain_noise_a)/CAL_NUM_OF_BEACONS); |
760 | average_noise[1] = ((data->chain_noise_b)/CAL_NUM_OF_BEACONS); | 818 | average_noise[1] = ((data->chain_noise_b)/CAL_NUM_OF_BEACONS); |
@@ -779,6 +837,15 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
779 | 837 | ||
780 | priv->cfg->ops->utils->gain_computation(priv, average_noise, | 838 | priv->cfg->ops->utils->gain_computation(priv, average_noise, |
781 | min_average_noise_antenna_i, min_average_noise); | 839 | min_average_noise_antenna_i, min_average_noise); |
840 | |||
841 | /* Some power changes may have been made during the calibration. | ||
842 | * Update and commit the RXON | ||
843 | */ | ||
844 | if (priv->cfg->ops->lib->update_chain_flags) | ||
845 | priv->cfg->ops->lib->update_chain_flags(priv); | ||
846 | |||
847 | data->state = IWL_CHAIN_NOISE_DONE; | ||
848 | iwl_power_enable_management(priv); | ||
782 | } | 849 | } |
783 | EXPORT_SYMBOL(iwl_chain_noise_calibration); | 850 | EXPORT_SYMBOL(iwl_chain_noise_calibration); |
784 | 851 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 28b5b09996ed..8d04e966ad48 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -163,6 +163,13 @@ enum { | |||
163 | /* iwl_cmd_header flags value */ | 163 | /* iwl_cmd_header flags value */ |
164 | #define IWL_CMD_FAILED_MSK 0x40 | 164 | #define IWL_CMD_FAILED_MSK 0x40 |
165 | 165 | ||
166 | #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) | ||
167 | #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) | ||
168 | #define SEQ_TO_INDEX(s) ((s) & 0xff) | ||
169 | #define INDEX_TO_SEQ(i) ((i) & 0xff) | ||
170 | #define SEQ_HUGE_FRAME __constant_cpu_to_le16(0x4000) | ||
171 | #define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) | ||
172 | |||
166 | /** | 173 | /** |
167 | * struct iwl_cmd_header | 174 | * struct iwl_cmd_header |
168 | * | 175 | * |
@@ -171,7 +178,7 @@ enum { | |||
171 | */ | 178 | */ |
172 | struct iwl_cmd_header { | 179 | struct iwl_cmd_header { |
173 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ | 180 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
174 | u8 flags; /* IWL_CMD_* */ | 181 | u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ |
175 | /* | 182 | /* |
176 | * The driver sets up the sequence number to values of its chosing. | 183 | * The driver sets up the sequence number to values of its chosing. |
177 | * uCode does not use this value, but passes it back to the driver | 184 | * uCode does not use this value, but passes it back to the driver |
@@ -187,11 +194,12 @@ struct iwl_cmd_header { | |||
187 | * | 194 | * |
188 | * The Linux driver uses the following format: | 195 | * The Linux driver uses the following format: |
189 | * | 196 | * |
190 | * 0:7 index/position within Tx queue | 197 | * 0:7 tfd index - position within TX queue |
191 | * 8:13 Tx queue selection | 198 | * 8:12 TX queue id |
192 | * 14:14 driver sets this to indicate command is in the 'huge' | 199 | * 13 reserved |
193 | * storage at the end of the command buffers, i.e. scan cmd | 200 | * 14 huge - driver sets this to indicate command is in the |
194 | * 15:15 uCode sets this in uCode-originated response/notification | 201 | * 'huge' storage at the end of the command buffers |
202 | * 15 unsolicited RX or uCode-originated notification | ||
195 | */ | 203 | */ |
196 | __le16 sequence; | 204 | __le16 sequence; |
197 | 205 | ||
@@ -2026,8 +2034,8 @@ struct iwl4965_spectrum_notification { | |||
2026 | * bit 2 - '0' PM have to walk up every DTIM | 2034 | * bit 2 - '0' PM have to walk up every DTIM |
2027 | * '1' PM could sleep over DTIM till listen Interval. | 2035 | * '1' PM could sleep over DTIM till listen Interval. |
2028 | * PCI power managed | 2036 | * PCI power managed |
2029 | * bit 3 - '0' (PCI_LINK_CTRL & 0x1) | 2037 | * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) |
2030 | * '1' !(PCI_LINK_CTRL & 0x1) | 2038 | * '1' !(PCI_CFG_LINK_CTRL & 0x1) |
2031 | * Force sleep Modes | 2039 | * Force sleep Modes |
2032 | * bit 31/30- '00' use both mac/xtal sleeps | 2040 | * bit 31/30- '00' use both mac/xtal sleeps |
2033 | * '01' force Mac sleep | 2041 | * '01' force Mac sleep |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 80f2f84defa8..4c312c55f90c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -306,14 +306,14 @@ void iwl_reset_qos(struct iwl_priv *priv) | |||
306 | spin_lock_irqsave(&priv->lock, flags); | 306 | spin_lock_irqsave(&priv->lock, flags); |
307 | priv->qos_data.qos_active = 0; | 307 | priv->qos_data.qos_active = 0; |
308 | 308 | ||
309 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { | 309 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { |
310 | if (priv->qos_data.qos_enable) | 310 | if (priv->qos_data.qos_enable) |
311 | priv->qos_data.qos_active = 1; | 311 | priv->qos_data.qos_active = 1; |
312 | if (!(priv->active_rate & 0xfff0)) { | 312 | if (!(priv->active_rate & 0xfff0)) { |
313 | cw_min = 31; | 313 | cw_min = 31; |
314 | is_legacy = 1; | 314 | is_legacy = 1; |
315 | } | 315 | } |
316 | } else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 316 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { |
317 | if (priv->qos_data.qos_enable) | 317 | if (priv->qos_data.qos_enable) |
318 | priv->qos_data.qos_active = 1; | 318 | priv->qos_data.qos_active = 1; |
319 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | 319 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { |
@@ -399,8 +399,8 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, | |||
399 | 399 | ||
400 | ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD; | 400 | ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD; |
401 | ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; | 401 | ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; |
402 | ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS & | 402 | ht_info->cap |= (u16)(IEEE80211_HT_CAP_SM_PS & |
403 | (IWL_MIMO_PS_NONE << 2)); | 403 | (WLAN_HT_CAP_SM_PS_DISABLED << 2)); |
404 | 404 | ||
405 | max_bit_rate = MAX_BIT_RATE_20_MHZ; | 405 | max_bit_rate = MAX_BIT_RATE_20_MHZ; |
406 | if (priv->hw_params.fat_channel & BIT(band)) { | 406 | if (priv->hw_params.fat_channel & BIT(band)) { |
@@ -646,8 +646,14 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | |||
646 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 646 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
647 | u32 val; | 647 | u32 val; |
648 | 648 | ||
649 | if (!ht_info->is_ht) | 649 | if (!ht_info->is_ht) { |
650 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | | ||
651 | RXON_FLG_CHANNEL_MODE_PURE_40_MSK | | ||
652 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | | ||
653 | RXON_FLG_FAT_PROT_MSK | | ||
654 | RXON_FLG_HT_PROT_MSK); | ||
650 | return; | 655 | return; |
656 | } | ||
651 | 657 | ||
652 | /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ | 658 | /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ |
653 | if (iwl_is_fat_tx_allowed(priv, NULL)) | 659 | if (iwl_is_fat_tx_allowed(priv, NULL)) |
@@ -697,8 +703,12 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | |||
697 | } | 703 | } |
698 | EXPORT_SYMBOL(iwl_set_rxon_ht); | 704 | EXPORT_SYMBOL(iwl_set_rxon_ht); |
699 | 705 | ||
700 | /* | 706 | #define IWL_NUM_RX_CHAINS_MULTIPLE 3 |
701 | * Determine how many receiver/antenna chains to use. | 707 | #define IWL_NUM_RX_CHAINS_SINGLE 2 |
708 | #define IWL_NUM_IDLE_CHAINS_DUAL 2 | ||
709 | #define IWL_NUM_IDLE_CHAINS_SINGLE 1 | ||
710 | |||
711 | /* Determine how many receiver/antenna chains to use. | ||
702 | * More provides better reception via diversity. Fewer saves power. | 712 | * More provides better reception via diversity. Fewer saves power. |
703 | * MIMO (dual stream) requires at least 2, but works better with 3. | 713 | * MIMO (dual stream) requires at least 2, but works better with 3. |
704 | * This does not determine *which* chains to use, just how many. | 714 | * This does not determine *which* chains to use, just how many. |
@@ -709,10 +719,11 @@ static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) | |||
709 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 719 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
710 | 720 | ||
711 | /* # of Rx chains to use when expecting MIMO. */ | 721 | /* # of Rx chains to use when expecting MIMO. */ |
712 | if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC))) | 722 | if (is_single || (!is_cam && (priv->current_ht_config.sm_ps == |
713 | return 2; | 723 | WLAN_HT_CAP_SM_PS_STATIC))) |
724 | return IWL_NUM_RX_CHAINS_SINGLE; | ||
714 | else | 725 | else |
715 | return 3; | 726 | return IWL_NUM_RX_CHAINS_MULTIPLE; |
716 | } | 727 | } |
717 | 728 | ||
718 | static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | 729 | static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) |
@@ -720,17 +731,19 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | |||
720 | int idle_cnt; | 731 | int idle_cnt; |
721 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 732 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
722 | /* # Rx chains when idling and maybe trying to save power */ | 733 | /* # Rx chains when idling and maybe trying to save power */ |
723 | switch (priv->ps_mode) { | 734 | switch (priv->current_ht_config.sm_ps) { |
724 | case IWL_MIMO_PS_STATIC: | 735 | case WLAN_HT_CAP_SM_PS_STATIC: |
725 | case IWL_MIMO_PS_DYNAMIC: | 736 | case WLAN_HT_CAP_SM_PS_DYNAMIC: |
726 | idle_cnt = (is_cam) ? 2 : 1; | 737 | idle_cnt = (is_cam) ? IWL_NUM_IDLE_CHAINS_DUAL : |
738 | IWL_NUM_IDLE_CHAINS_SINGLE; | ||
727 | break; | 739 | break; |
728 | case IWL_MIMO_PS_NONE: | 740 | case WLAN_HT_CAP_SM_PS_DISABLED: |
729 | idle_cnt = (is_cam) ? active_cnt : 1; | 741 | idle_cnt = (is_cam) ? active_cnt : IWL_NUM_IDLE_CHAINS_SINGLE; |
730 | break; | 742 | break; |
731 | case IWL_MIMO_PS_INVALID: | 743 | case WLAN_HT_CAP_SM_PS_INVALID: |
732 | default: | 744 | default: |
733 | IWL_ERROR("invalide mimo ps mode %d\n", priv->ps_mode); | 745 | IWL_ERROR("invalide mimo ps mode %d\n", |
746 | priv->current_ht_config.sm_ps); | ||
734 | WARN_ON(1); | 747 | WARN_ON(1); |
735 | idle_cnt = -1; | 748 | idle_cnt = -1; |
736 | break; | 749 | break; |
@@ -738,6 +751,17 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | |||
738 | return idle_cnt; | 751 | return idle_cnt; |
739 | } | 752 | } |
740 | 753 | ||
754 | /* up to 4 chains */ | ||
755 | static u8 iwl_count_chain_bitmap(u32 chain_bitmap) | ||
756 | { | ||
757 | u8 res; | ||
758 | res = (chain_bitmap & BIT(0)) >> 0; | ||
759 | res += (chain_bitmap & BIT(1)) >> 1; | ||
760 | res += (chain_bitmap & BIT(2)) >> 2; | ||
761 | res += (chain_bitmap & BIT(4)) >> 4; | ||
762 | return res; | ||
763 | } | ||
764 | |||
741 | /** | 765 | /** |
742 | * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image | 766 | * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image |
743 | * | 767 | * |
@@ -748,37 +772,47 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
748 | { | 772 | { |
749 | bool is_single = is_single_rx_stream(priv); | 773 | bool is_single = is_single_rx_stream(priv); |
750 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 774 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
751 | u8 idle_rx_cnt, active_rx_cnt; | 775 | u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; |
776 | u32 active_chains; | ||
752 | u16 rx_chain; | 777 | u16 rx_chain; |
753 | 778 | ||
754 | /* Tell uCode which antennas are actually connected. | 779 | /* Tell uCode which antennas are actually connected. |
755 | * Before first association, we assume all antennas are connected. | 780 | * Before first association, we assume all antennas are connected. |
756 | * Just after first association, iwl_chain_noise_calibration() | 781 | * Just after first association, iwl_chain_noise_calibration() |
757 | * checks which antennas actually *are* connected. */ | 782 | * checks which antennas actually *are* connected. */ |
758 | rx_chain = priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; | 783 | if (priv->chain_noise_data.active_chains) |
784 | active_chains = priv->chain_noise_data.active_chains; | ||
785 | else | ||
786 | active_chains = priv->hw_params.valid_rx_ant; | ||
787 | |||
788 | rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; | ||
759 | 789 | ||
760 | /* How many receivers should we use? */ | 790 | /* How many receivers should we use? */ |
761 | active_rx_cnt = iwl_get_active_rx_chain_count(priv); | 791 | active_rx_cnt = iwl_get_active_rx_chain_count(priv); |
762 | idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt); | 792 | idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt); |
763 | 793 | ||
764 | /* correct rx chain count accoridng hw settings */ | ||
765 | if (priv->hw_params.rx_chains_num < active_rx_cnt) | ||
766 | active_rx_cnt = priv->hw_params.rx_chains_num; | ||
767 | 794 | ||
768 | if (priv->hw_params.rx_chains_num < idle_rx_cnt) | 795 | /* correct rx chain count according hw settings |
769 | idle_rx_cnt = priv->hw_params.rx_chains_num; | 796 | * and chain noise calibration |
797 | */ | ||
798 | valid_rx_cnt = iwl_count_chain_bitmap(active_chains); | ||
799 | if (valid_rx_cnt < active_rx_cnt) | ||
800 | active_rx_cnt = valid_rx_cnt; | ||
801 | |||
802 | if (valid_rx_cnt < idle_rx_cnt) | ||
803 | idle_rx_cnt = valid_rx_cnt; | ||
770 | 804 | ||
771 | rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; | 805 | rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; |
772 | rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; | 806 | rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; |
773 | 807 | ||
774 | priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); | 808 | priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); |
775 | 809 | ||
776 | if (!is_single && (active_rx_cnt >= 2) && is_cam) | 810 | if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) |
777 | priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; | 811 | priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; |
778 | else | 812 | else |
779 | priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; | 813 | priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; |
780 | 814 | ||
781 | IWL_DEBUG_ASSOC("rx_chain=0x%Xi active=%d idle=%d\n", | 815 | IWL_DEBUG_ASSOC("rx_chain=0x%X active=%d idle=%d\n", |
782 | priv->staging_rxon.rx_chain, | 816 | priv->staging_rxon.rx_chain, |
783 | active_rx_cnt, idle_rx_cnt); | 817 | active_rx_cnt, idle_rx_cnt); |
784 | 818 | ||
@@ -788,7 +822,7 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
788 | EXPORT_SYMBOL(iwl_set_rxon_chain); | 822 | EXPORT_SYMBOL(iwl_set_rxon_chain); |
789 | 823 | ||
790 | /** | 824 | /** |
791 | * iwlcore_set_rxon_channel - Set the phymode and channel values in staging RXON | 825 | * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON |
792 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz | 826 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz |
793 | * @channel: Any channel valid for the requested phymode | 827 | * @channel: Any channel valid for the requested phymode |
794 | 828 | ||
@@ -797,10 +831,11 @@ EXPORT_SYMBOL(iwl_set_rxon_chain); | |||
797 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | 831 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields |
798 | * in the staging RXON flag structure based on the phymode | 832 | * in the staging RXON flag structure based on the phymode |
799 | */ | 833 | */ |
800 | int iwl_set_rxon_channel(struct iwl_priv *priv, | 834 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch) |
801 | enum ieee80211_band band, | ||
802 | u16 channel) | ||
803 | { | 835 | { |
836 | enum ieee80211_band band = ch->band; | ||
837 | u16 channel = ieee80211_frequency_to_channel(ch->center_freq); | ||
838 | |||
804 | if (!iwl_get_channel_info(priv, band, channel)) { | 839 | if (!iwl_get_channel_info(priv, band, channel)) { |
805 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | 840 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", |
806 | channel, band); | 841 | channel, band); |
@@ -834,6 +869,10 @@ int iwl_setup_mac(struct iwl_priv *priv) | |||
834 | /* Tell mac80211 our characteristics */ | 869 | /* Tell mac80211 our characteristics */ |
835 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 870 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
836 | IEEE80211_HW_NOISE_DBM; | 871 | IEEE80211_HW_NOISE_DBM; |
872 | hw->wiphy->interface_modes = | ||
873 | BIT(NL80211_IFTYPE_AP) | | ||
874 | BIT(NL80211_IFTYPE_STATION) | | ||
875 | BIT(NL80211_IFTYPE_ADHOC); | ||
837 | /* Default value; 4 EDCA QOS priorities */ | 876 | /* Default value; 4 EDCA QOS priorities */ |
838 | hw->queues = 4; | 877 | hw->queues = 4; |
839 | /* queues to support 11n aggregation */ | 878 | /* queues to support 11n aggregation */ |
@@ -891,7 +930,6 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
891 | spin_lock_init(&priv->power_data.lock); | 930 | spin_lock_init(&priv->power_data.lock); |
892 | spin_lock_init(&priv->sta_lock); | 931 | spin_lock_init(&priv->sta_lock); |
893 | spin_lock_init(&priv->hcmd_lock); | 932 | spin_lock_init(&priv->hcmd_lock); |
894 | spin_lock_init(&priv->lq_mngr.lock); | ||
895 | 933 | ||
896 | INIT_LIST_HEAD(&priv->free_frames); | 934 | INIT_LIST_HEAD(&priv->free_frames); |
897 | 935 | ||
@@ -905,10 +943,10 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
905 | priv->ieee_rates = NULL; | 943 | priv->ieee_rates = NULL; |
906 | priv->band = IEEE80211_BAND_2GHZ; | 944 | priv->band = IEEE80211_BAND_2GHZ; |
907 | 945 | ||
908 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | 946 | priv->iw_mode = NL80211_IFTYPE_STATION; |
909 | 947 | ||
910 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ | 948 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ |
911 | priv->ps_mode = IWL_MIMO_PS_NONE; | 949 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; |
912 | 950 | ||
913 | /* Choose which receivers/antennas to use */ | 951 | /* Choose which receivers/antennas to use */ |
914 | iwl_set_rxon_chain(priv); | 952 | iwl_set_rxon_chain(priv); |
@@ -922,8 +960,6 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
922 | priv->qos_data.qos_active = 0; | 960 | priv->qos_data.qos_active = 0; |
923 | priv->qos_data.qos_cap.val = 0; | 961 | priv->qos_data.qos_cap.val = 0; |
924 | 962 | ||
925 | iwl_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | ||
926 | |||
927 | priv->rates_mask = IWL_RATES_MASK; | 963 | priv->rates_mask = IWL_RATES_MASK; |
928 | /* If power management is turned on, default to AC mode */ | 964 | /* If power management is turned on, default to AC mode */ |
929 | priv->power_mode = IWL_POWER_AC; | 965 | priv->power_mode = IWL_POWER_AC; |
@@ -950,22 +986,6 @@ err: | |||
950 | } | 986 | } |
951 | EXPORT_SYMBOL(iwl_init_drv); | 987 | EXPORT_SYMBOL(iwl_init_drv); |
952 | 988 | ||
953 | void iwl_free_calib_results(struct iwl_priv *priv) | ||
954 | { | ||
955 | kfree(priv->calib_results.lo_res); | ||
956 | priv->calib_results.lo_res = NULL; | ||
957 | priv->calib_results.lo_res_len = 0; | ||
958 | |||
959 | kfree(priv->calib_results.tx_iq_res); | ||
960 | priv->calib_results.tx_iq_res = NULL; | ||
961 | priv->calib_results.tx_iq_res_len = 0; | ||
962 | |||
963 | kfree(priv->calib_results.tx_iq_perd_res); | ||
964 | priv->calib_results.tx_iq_perd_res = NULL; | ||
965 | priv->calib_results.tx_iq_perd_res_len = 0; | ||
966 | } | ||
967 | EXPORT_SYMBOL(iwl_free_calib_results); | ||
968 | |||
969 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | 989 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) |
970 | { | 990 | { |
971 | int ret = 0; | 991 | int ret = 0; |
@@ -993,10 +1013,9 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | |||
993 | } | 1013 | } |
994 | EXPORT_SYMBOL(iwl_set_tx_power); | 1014 | EXPORT_SYMBOL(iwl_set_tx_power); |
995 | 1015 | ||
996 | |||
997 | void iwl_uninit_drv(struct iwl_priv *priv) | 1016 | void iwl_uninit_drv(struct iwl_priv *priv) |
998 | { | 1017 | { |
999 | iwl_free_calib_results(priv); | 1018 | iwl_calib_free_results(priv); |
1000 | iwlcore_free_geos(priv); | 1019 | iwlcore_free_geos(priv); |
1001 | iwl_free_channel_map(priv); | 1020 | iwl_free_channel_map(priv); |
1002 | kfree(priv->scan); | 1021 | kfree(priv->scan); |
@@ -1150,7 +1169,6 @@ int iwl_verify_ucode(struct iwl_priv *priv) | |||
1150 | } | 1169 | } |
1151 | EXPORT_SYMBOL(iwl_verify_ucode); | 1170 | EXPORT_SYMBOL(iwl_verify_ucode); |
1152 | 1171 | ||
1153 | |||
1154 | static const char *desc_lookup(int i) | 1172 | static const char *desc_lookup(int i) |
1155 | { | 1173 | { |
1156 | switch (i) { | 1174 | switch (i) { |
@@ -1231,9 +1249,9 @@ EXPORT_SYMBOL(iwl_dump_nic_error_log); | |||
1231 | /** | 1249 | /** |
1232 | * iwl_print_event_log - Dump error event log to syslog | 1250 | * iwl_print_event_log - Dump error event log to syslog |
1233 | * | 1251 | * |
1234 | * NOTE: Must be called with iwl4965_grab_nic_access() already obtained! | 1252 | * NOTE: Must be called with iwl_grab_nic_access() already obtained! |
1235 | */ | 1253 | */ |
1236 | void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | 1254 | static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, |
1237 | u32 num_events, u32 mode) | 1255 | u32 num_events, u32 mode) |
1238 | { | 1256 | { |
1239 | u32 i; | 1257 | u32 i; |
@@ -1274,8 +1292,6 @@ void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | |||
1274 | } | 1292 | } |
1275 | } | 1293 | } |
1276 | } | 1294 | } |
1277 | EXPORT_SYMBOL(iwl_print_event_log); | ||
1278 | |||
1279 | 1295 | ||
1280 | void iwl_dump_nic_event_log(struct iwl_priv *priv) | 1296 | void iwl_dump_nic_event_log(struct iwl_priv *priv) |
1281 | { | 1297 | { |
@@ -1391,7 +1407,7 @@ void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv) | |||
1391 | 1407 | ||
1392 | iwl_scan_cancel(priv); | 1408 | iwl_scan_cancel(priv); |
1393 | /* FIXME: This is a workaround for AP */ | 1409 | /* FIXME: This is a workaround for AP */ |
1394 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 1410 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
1395 | spin_lock_irqsave(&priv->lock, flags); | 1411 | spin_lock_irqsave(&priv->lock, flags); |
1396 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, | 1412 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, |
1397 | CSR_UCODE_SW_BIT_RFKILL); | 1413 | CSR_UCODE_SW_BIT_RFKILL); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 64f139e97444..288b6a800e03 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -184,14 +184,10 @@ struct iwl_cfg { | |||
184 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | 184 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, |
185 | struct ieee80211_ops *hw_ops); | 185 | struct ieee80211_ops *hw_ops); |
186 | void iwl_hw_detect(struct iwl_priv *priv); | 186 | void iwl_hw_detect(struct iwl_priv *priv); |
187 | |||
188 | void iwl_clear_stations_table(struct iwl_priv *priv); | 187 | void iwl_clear_stations_table(struct iwl_priv *priv); |
189 | void iwl_free_calib_results(struct iwl_priv *priv); | ||
190 | void iwl_reset_qos(struct iwl_priv *priv); | 188 | void iwl_reset_qos(struct iwl_priv *priv); |
191 | void iwl_set_rxon_chain(struct iwl_priv *priv); | 189 | void iwl_set_rxon_chain(struct iwl_priv *priv); |
192 | int iwl_set_rxon_channel(struct iwl_priv *priv, | 190 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); |
193 | enum ieee80211_band band, | ||
194 | u16 channel); | ||
195 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); | 191 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); |
196 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, | 192 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, |
197 | struct ieee80211_ht_info *sta_ht_inf); | 193 | struct ieee80211_ht_info *sta_ht_inf); |
@@ -218,7 +214,6 @@ void iwl_rx_replenish(struct iwl_priv *priv); | |||
218 | int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 214 | int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
219 | int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn); | 215 | int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn); |
220 | int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); | 216 | int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); |
221 | /* FIXME: remove when TX is moved to iwl core */ | ||
222 | int iwl_rx_queue_restock(struct iwl_priv *priv); | 217 | int iwl_rx_queue_restock(struct iwl_priv *priv); |
223 | int iwl_rx_queue_space(const struct iwl_rx_queue *q); | 218 | int iwl_rx_queue_space(const struct iwl_rx_queue *q); |
224 | void iwl_rx_allocate(struct iwl_priv *priv); | 219 | void iwl_rx_allocate(struct iwl_priv *priv); |
@@ -237,11 +232,7 @@ void iwl_rx_statistics(struct iwl_priv *priv, | |||
237 | ******************************************************/ | 232 | ******************************************************/ |
238 | int iwl_txq_ctx_reset(struct iwl_priv *priv); | 233 | int iwl_txq_ctx_reset(struct iwl_priv *priv); |
239 | int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); | 234 | int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); |
240 | /* FIXME: remove when free Tx is fully merged into iwlcore */ | ||
241 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); | ||
242 | void iwl_hw_txq_ctx_free(struct iwl_priv *priv); | 235 | void iwl_hw_txq_ctx_free(struct iwl_priv *priv); |
243 | int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, | ||
244 | dma_addr_t addr, u16 len); | ||
245 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); | 236 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); |
246 | int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn); | 237 | int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn); |
247 | int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); | 238 | int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); |
@@ -256,6 +247,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); | |||
256 | * RF -Kill - here and not in iwl-rfkill.h to be available when | 247 | * RF -Kill - here and not in iwl-rfkill.h to be available when |
257 | * RF-kill subsystem is not compiled. | 248 | * RF-kill subsystem is not compiled. |
258 | ****************************************************/ | 249 | ****************************************************/ |
250 | void iwl_rf_kill(struct iwl_priv *priv); | ||
259 | void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv); | 251 | void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv); |
260 | int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv); | 252 | int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv); |
261 | 253 | ||
@@ -286,11 +278,17 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) | |||
286 | void iwl_init_scan_params(struct iwl_priv *priv); | 278 | void iwl_init_scan_params(struct iwl_priv *priv); |
287 | int iwl_scan_cancel(struct iwl_priv *priv); | 279 | int iwl_scan_cancel(struct iwl_priv *priv); |
288 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | 280 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); |
289 | const char *iwl_escape_essid(const char *essid, u8 essid_len); | ||
290 | int iwl_scan_initiate(struct iwl_priv *priv); | 281 | int iwl_scan_initiate(struct iwl_priv *priv); |
291 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); | 282 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); |
292 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); | 283 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); |
293 | 284 | ||
285 | /******************************************************************************* | ||
286 | * Calibrations - implemented in iwl-calib.c | ||
287 | ******************************************************************************/ | ||
288 | int iwl_send_calib_results(struct iwl_priv *priv); | ||
289 | int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len); | ||
290 | void iwl_calib_free_results(struct iwl_priv *priv); | ||
291 | |||
294 | /***************************************************** | 292 | /***************************************************** |
295 | * S e n d i n g H o s t C o m m a n d s * | 293 | * S e n d i n g H o s t C o m m a n d s * |
296 | *****************************************************/ | 294 | *****************************************************/ |
@@ -312,8 +310,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | |||
312 | /***************************************************** | 310 | /***************************************************** |
313 | * Error Handling Debugging | 311 | * Error Handling Debugging |
314 | ******************************************************/ | 312 | ******************************************************/ |
315 | void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | ||
316 | u32 num_events, u32 mode); | ||
317 | void iwl_dump_nic_error_log(struct iwl_priv *priv); | 313 | void iwl_dump_nic_error_log(struct iwl_priv *priv); |
318 | void iwl_dump_nic_event_log(struct iwl_priv *priv); | 314 | void iwl_dump_nic_event_log(struct iwl_priv *priv); |
319 | 315 | ||
@@ -337,8 +333,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv); | |||
337 | #define STATUS_SCAN_HW 15 | 333 | #define STATUS_SCAN_HW 15 |
338 | #define STATUS_POWER_PMI 16 | 334 | #define STATUS_POWER_PMI 16 |
339 | #define STATUS_FW_ERROR 17 | 335 | #define STATUS_FW_ERROR 17 |
340 | #define STATUS_CONF_PENDING 18 | 336 | #define STATUS_MODE_PENDING 18 |
341 | #define STATUS_MODE_PENDING 19 | ||
342 | 337 | ||
343 | 338 | ||
344 | static inline int iwl_is_ready(struct iwl_priv *priv) | 339 | static inline int iwl_is_ready(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 52629fbd835a..662edf4f8d22 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -64,7 +64,7 @@ | |||
64 | #define CSR_BASE (0x000) | 64 | #define CSR_BASE (0x000) |
65 | 65 | ||
66 | #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ | 66 | #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ |
67 | #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ | 67 | #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ |
68 | #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ | 68 | #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ |
69 | #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ | 69 | #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ |
70 | #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ | 70 | #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index d2daa174df22..e548d67f87fd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -110,11 +110,12 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
110 | * | 110 | * |
111 | */ | 111 | */ |
112 | 112 | ||
113 | #define IWL_DL_INFO (1 << 0) | 113 | #define IWL_DL_INFO (1 << 0) |
114 | #define IWL_DL_MAC80211 (1 << 1) | 114 | #define IWL_DL_MAC80211 (1 << 1) |
115 | #define IWL_DL_HOST_COMMAND (1 << 2) | 115 | #define IWL_DL_HCMD (1 << 2) |
116 | #define IWL_DL_STATE (1 << 3) | 116 | #define IWL_DL_STATE (1 << 3) |
117 | #define IWL_DL_MACDUMP (1 << 4) | 117 | #define IWL_DL_MACDUMP (1 << 4) |
118 | #define IWL_DL_HCMD_DUMP (1 << 5) | ||
118 | #define IWL_DL_RADIO (1 << 7) | 119 | #define IWL_DL_RADIO (1 << 7) |
119 | #define IWL_DL_POWER (1 << 8) | 120 | #define IWL_DL_POWER (1 << 8) |
120 | #define IWL_DL_TEMP (1 << 9) | 121 | #define IWL_DL_TEMP (1 << 9) |
@@ -162,7 +163,8 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
162 | #define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) | 163 | #define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) |
163 | #define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) | 164 | #define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) |
164 | #define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) | 165 | #define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) |
165 | #define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a) | 166 | #define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HCMD, f, ## a) |
167 | #define IWL_DEBUG_HC_DUMP(f, a...) IWL_DEBUG(IWL_DL_HCMD_DUMP, f, ## a) | ||
166 | #define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) | 168 | #define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) |
167 | #define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) | 169 | #define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) |
168 | #define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) | 170 | #define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index cdfb343c7ec6..c018121085e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -225,12 +225,6 @@ struct iwl_frame { | |||
225 | struct list_head list; | 225 | struct list_head list; |
226 | }; | 226 | }; |
227 | 227 | ||
228 | #define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf) | ||
229 | #define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8) | ||
230 | #define SEQ_TO_INDEX(x) ((u8)(x & 0xff)) | ||
231 | #define INDEX_TO_SEQ(x) ((u8)(x & 0xff)) | ||
232 | #define SEQ_HUGE_FRAME (0x4000) | ||
233 | #define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) | ||
234 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | 228 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) |
235 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | 229 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) |
236 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) | 230 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) |
@@ -412,6 +406,7 @@ struct iwl_ht_info { | |||
412 | /* self configuration data */ | 406 | /* self configuration data */ |
413 | u8 is_ht; | 407 | u8 is_ht; |
414 | u8 supported_chan_width; | 408 | u8 supported_chan_width; |
409 | u8 sm_ps; | ||
415 | u8 is_green_field; | 410 | u8 is_green_field; |
416 | u8 sgf; /* HT_SHORT_GI_* short guard interval */ | 411 | u8 sgf; /* HT_SHORT_GI_* short guard interval */ |
417 | u8 max_amsdu_size; | 412 | u8 max_amsdu_size; |
@@ -570,50 +565,31 @@ struct iwl_hw_params { | |||
570 | #define IWL_RX_STATS(x) (&x->u.rx_frame.stats) | 565 | #define IWL_RX_STATS(x) (&x->u.rx_frame.stats) |
571 | #define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) | 566 | #define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) |
572 | 567 | ||
573 | |||
574 | /****************************************************************************** | 568 | /****************************************************************************** |
575 | * | 569 | * |
576 | * Functions implemented in iwl-base.c which are forward declared here | 570 | * Functions implemented in core module which are forward declared here |
577 | * for use by iwl-*.c | 571 | * for use by iwl-[4-5].c |
578 | * | 572 | * |
579 | *****************************************************************************/ | 573 | * NOTE: The implementation of these functions are not hardware specific |
580 | struct iwl_addsta_cmd; | 574 | * which is why they are in the core module files. |
581 | extern int iwl_send_add_sta(struct iwl_priv *priv, | ||
582 | struct iwl_addsta_cmd *sta, u8 flags); | ||
583 | u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | ||
584 | u8 flags, struct ieee80211_ht_info *ht_info); | ||
585 | extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, | ||
586 | struct ieee80211_hdr *hdr, | ||
587 | const u8 *dest, int left); | ||
588 | extern void iwl4965_update_chain_flags(struct iwl_priv *priv); | ||
589 | int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); | ||
590 | extern int iwl4965_set_power(struct iwl_priv *priv, void *cmd); | ||
591 | |||
592 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | ||
593 | |||
594 | /****************************************************************************** | ||
595 | * | ||
596 | * Functions implemented in iwl-[34]*.c which are forward declared here | ||
597 | * for use by iwl-base.c | ||
598 | * | ||
599 | * NOTE: The implementation of these functions are hardware specific | ||
600 | * which is why they are in the hardware specific files (vs. iwl-base.c) | ||
601 | * | 575 | * |
602 | * Naming convention -- | 576 | * Naming convention -- |
603 | * iwl4965_ <-- Its part of iwlwifi (should be changed to iwl4965_) | 577 | * iwl_ <-- Is part of iwlwifi |
604 | * iwl4965_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) | ||
605 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | 578 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) |
606 | * iwl4965_bg_ <-- Called from work queue context | 579 | * iwl4965_bg_ <-- Called from work queue context |
607 | * iwl4965_mac_ <-- mac80211 callback | 580 | * iwl4965_mac_ <-- mac80211 callback |
608 | * | 581 | * |
609 | ****************************************************************************/ | 582 | ****************************************************************************/ |
583 | struct iwl_addsta_cmd; | ||
584 | extern int iwl_send_add_sta(struct iwl_priv *priv, | ||
585 | struct iwl_addsta_cmd *sta, u8 flags); | ||
586 | extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, | ||
587 | int is_ap, u8 flags, struct ieee80211_ht_info *ht_info); | ||
588 | extern void iwl4965_update_chain_flags(struct iwl_priv *priv); | ||
589 | extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); | ||
590 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | ||
610 | extern int iwl_rxq_stop(struct iwl_priv *priv); | 591 | extern int iwl_rxq_stop(struct iwl_priv *priv); |
611 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); | 592 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); |
612 | extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | ||
613 | struct iwl_frame *frame, u8 rate); | ||
614 | extern void iwl4965_disable_events(struct iwl_priv *priv); | ||
615 | |||
616 | extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel); | ||
617 | extern int iwl_queue_space(const struct iwl_queue *q); | 593 | extern int iwl_queue_space(const struct iwl_queue *q); |
618 | static inline int iwl_queue_used(const struct iwl_queue *q, int i) | 594 | static inline int iwl_queue_used(const struct iwl_queue *q, int i) |
619 | { | 595 | { |
@@ -636,12 +612,6 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) | |||
636 | 612 | ||
637 | struct iwl_priv; | 613 | struct iwl_priv; |
638 | 614 | ||
639 | /* | ||
640 | * Forward declare iwl-4965.c functions for iwl-base.c | ||
641 | */ | ||
642 | extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); | ||
643 | int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id, | ||
644 | u8 tid, int txq_id); | ||
645 | 615 | ||
646 | /* Structures, enum, and defines specific to the 4965 */ | 616 | /* Structures, enum, and defines specific to the 4965 */ |
647 | 617 | ||
@@ -656,11 +626,6 @@ struct iwl_kw { | |||
656 | #define IWL_CHANNEL_WIDTH_20MHZ 0 | 626 | #define IWL_CHANNEL_WIDTH_20MHZ 0 |
657 | #define IWL_CHANNEL_WIDTH_40MHZ 1 | 627 | #define IWL_CHANNEL_WIDTH_40MHZ 1 |
658 | 628 | ||
659 | #define IWL_MIMO_PS_STATIC 0 | ||
660 | #define IWL_MIMO_PS_NONE 3 | ||
661 | #define IWL_MIMO_PS_DYNAMIC 1 | ||
662 | #define IWL_MIMO_PS_INVALID 2 | ||
663 | |||
664 | #define IWL_OPERATION_MODE_AUTO 0 | 629 | #define IWL_OPERATION_MODE_AUTO 0 |
665 | #define IWL_OPERATION_MODE_HT_ONLY 1 | 630 | #define IWL_OPERATION_MODE_HT_ONLY 1 |
666 | #define IWL_OPERATION_MODE_MIXED 2 | 631 | #define IWL_OPERATION_MODE_MIXED 2 |
@@ -671,18 +636,6 @@ struct iwl_kw { | |||
671 | 636 | ||
672 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 | 637 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 |
673 | 638 | ||
674 | struct iwl4965_lq_mngr { | ||
675 | spinlock_t lock; | ||
676 | s32 max_window_size; | ||
677 | s32 *expected_tpt; | ||
678 | u8 *next_higher_rate; | ||
679 | u8 *next_lower_rate; | ||
680 | unsigned long stamp; | ||
681 | unsigned long stamp_last; | ||
682 | u32 flush_time; | ||
683 | u32 tx_packets; | ||
684 | }; | ||
685 | |||
686 | /* Sensitivity and chain noise calibration */ | 639 | /* Sensitivity and chain noise calibration */ |
687 | #define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) | 640 | #define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) |
688 | #define INITIALIZATION_VALUE 0xFFFF | 641 | #define INITIALIZATION_VALUE 0xFFFF |
@@ -727,8 +680,9 @@ enum iwl4965_false_alarm_state { | |||
727 | 680 | ||
728 | enum iwl4965_chain_noise_state { | 681 | enum iwl4965_chain_noise_state { |
729 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ | 682 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ |
730 | IWL_CHAIN_NOISE_ACCUMULATE = 1, | 683 | IWL_CHAIN_NOISE_ACCUMULATE, |
731 | IWL_CHAIN_NOISE_CALIBRATED = 2, | 684 | IWL_CHAIN_NOISE_CALIBRATED, |
685 | IWL_CHAIN_NOISE_DONE, | ||
732 | }; | 686 | }; |
733 | 687 | ||
734 | enum iwl4965_calib_enabled_state { | 688 | enum iwl4965_calib_enabled_state { |
@@ -745,13 +699,10 @@ struct statistics_general_data { | |||
745 | u32 beacon_energy_c; | 699 | u32 beacon_energy_c; |
746 | }; | 700 | }; |
747 | 701 | ||
748 | struct iwl_calib_results { | 702 | /* Opaque calibration results */ |
749 | void *tx_iq_res; | 703 | struct iwl_calib_result { |
750 | void *tx_iq_perd_res; | 704 | void *buf; |
751 | void *lo_res; | 705 | size_t buf_len; |
752 | u32 tx_iq_res_len; | ||
753 | u32 tx_iq_perd_res_len; | ||
754 | u32 lo_res_len; | ||
755 | }; | 706 | }; |
756 | 707 | ||
757 | enum ucode_type { | 708 | enum ucode_type { |
@@ -789,17 +740,18 @@ struct iwl_sensitivity_data { | |||
789 | 740 | ||
790 | /* Chain noise (differential Rx gain) calib data */ | 741 | /* Chain noise (differential Rx gain) calib data */ |
791 | struct iwl_chain_noise_data { | 742 | struct iwl_chain_noise_data { |
792 | u8 state; | 743 | u32 active_chains; |
793 | u16 beacon_count; | ||
794 | u32 chain_noise_a; | 744 | u32 chain_noise_a; |
795 | u32 chain_noise_b; | 745 | u32 chain_noise_b; |
796 | u32 chain_noise_c; | 746 | u32 chain_noise_c; |
797 | u32 chain_signal_a; | 747 | u32 chain_signal_a; |
798 | u32 chain_signal_b; | 748 | u32 chain_signal_b; |
799 | u32 chain_signal_c; | 749 | u32 chain_signal_c; |
750 | u16 beacon_count; | ||
800 | u8 disconn_array[NUM_RX_CHAINS]; | 751 | u8 disconn_array[NUM_RX_CHAINS]; |
801 | u8 delta_gain_code[NUM_RX_CHAINS]; | 752 | u8 delta_gain_code[NUM_RX_CHAINS]; |
802 | u8 radio_write; | 753 | u8 radio_write; |
754 | u8 state; | ||
803 | }; | 755 | }; |
804 | 756 | ||
805 | #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ | 757 | #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ |
@@ -813,6 +765,7 @@ enum { | |||
813 | 765 | ||
814 | 766 | ||
815 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ | 767 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ |
768 | #define IWL_CALIB_MAX 3 | ||
816 | 769 | ||
817 | struct iwl_priv { | 770 | struct iwl_priv { |
818 | 771 | ||
@@ -828,7 +781,6 @@ struct iwl_priv { | |||
828 | 781 | ||
829 | enum ieee80211_band band; | 782 | enum ieee80211_band band; |
830 | int alloc_rxb_skb; | 783 | int alloc_rxb_skb; |
831 | bool add_radiotap; | ||
832 | 784 | ||
833 | void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, | 785 | void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, |
834 | struct iwl_rx_mem_buffer *rxb); | 786 | struct iwl_rx_mem_buffer *rxb); |
@@ -857,7 +809,7 @@ struct iwl_priv { | |||
857 | s32 last_temperature; | 809 | s32 last_temperature; |
858 | 810 | ||
859 | /* init calibration results */ | 811 | /* init calibration results */ |
860 | struct iwl_calib_results calib_results; | 812 | struct iwl_calib_result calib_results[IWL_CALIB_MAX]; |
861 | 813 | ||
862 | /* Scan related variables */ | 814 | /* Scan related variables */ |
863 | unsigned long last_scan_jiffies; | 815 | unsigned long last_scan_jiffies; |
@@ -939,9 +891,6 @@ struct iwl_priv { | |||
939 | u8 last_phy_res[100]; | 891 | u8 last_phy_res[100]; |
940 | 892 | ||
941 | /* Rate scaling data */ | 893 | /* Rate scaling data */ |
942 | struct iwl4965_lq_mngr lq_mngr; | ||
943 | |||
944 | /* Rate scaling data */ | ||
945 | s8 data_retry_limit; | 894 | s8 data_retry_limit; |
946 | u8 retry_rate; | 895 | u8 retry_rate; |
947 | 896 | ||
@@ -1005,7 +954,7 @@ struct iwl_priv { | |||
1005 | u8 *eeprom; | 954 | u8 *eeprom; |
1006 | struct iwl_eeprom_calib_info *calib_info; | 955 | struct iwl_eeprom_calib_info *calib_info; |
1007 | 956 | ||
1008 | enum ieee80211_if_types iw_mode; | 957 | enum nl80211_iftype iw_mode; |
1009 | 958 | ||
1010 | struct sk_buff *ibss_beacon; | 959 | struct sk_buff *ibss_beacon; |
1011 | 960 | ||
@@ -1025,7 +974,6 @@ struct iwl_priv { | |||
1025 | * hardware */ | 974 | * hardware */ |
1026 | u16 assoc_id; | 975 | u16 assoc_id; |
1027 | u16 assoc_capability; | 976 | u16 assoc_capability; |
1028 | u8 ps_mode; | ||
1029 | 977 | ||
1030 | struct iwl_qos_info qos_data; | 978 | struct iwl_qos_info qos_data; |
1031 | 979 | ||
@@ -1047,6 +995,7 @@ struct iwl_priv { | |||
1047 | 995 | ||
1048 | struct tasklet_struct irq_tasklet; | 996 | struct tasklet_struct irq_tasklet; |
1049 | 997 | ||
998 | struct delayed_work set_power_save; | ||
1050 | struct delayed_work init_alive_start; | 999 | struct delayed_work init_alive_start; |
1051 | struct delayed_work alive_start; | 1000 | struct delayed_work alive_start; |
1052 | struct delayed_work scan_check; | 1001 | struct delayed_work scan_check; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index cd11c0ca2991..a72efdf6d1dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -247,8 +247,8 @@ | |||
247 | #define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */ | 247 | #define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */ |
248 | #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/ | 248 | #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/ |
249 | 249 | ||
250 | #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20) | 250 | #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20) |
251 | #define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_BITSHIFT (4) | 251 | #define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4) |
252 | #define RX_RB_TIMEOUT (0x10) | 252 | #define RX_RB_TIMEOUT (0x10) |
253 | 253 | ||
254 | #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) | 254 | #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) |
@@ -260,8 +260,9 @@ | |||
260 | #define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000) | 260 | #define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000) |
261 | #define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000) | 261 | #define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000) |
262 | 262 | ||
263 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) | 263 | #define FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004) |
264 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) | 264 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) |
265 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) | ||
265 | 266 | ||
266 | 267 | ||
267 | /** | 268 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 2eb03eea1908..8300f3d00a06 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -120,8 +120,18 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv, | |||
120 | return 1; | 120 | return 1; |
121 | } | 121 | } |
122 | 122 | ||
123 | IWL_DEBUG_HC("back from %s (0x%08X)\n", | 123 | #ifdef CONFIG_IWLWIFI_DEBUG |
124 | get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | 124 | switch (cmd->hdr.cmd) { |
125 | case REPLY_TX_LINK_QUALITY_CMD: | ||
126 | case SENSITIVITY_CMD: | ||
127 | IWL_DEBUG_HC_DUMP("back from %s (0x%08X)\n", | ||
128 | get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | ||
129 | break; | ||
130 | default: | ||
131 | IWL_DEBUG_HC("back from %s (0x%08X)\n", | ||
132 | get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | ||
133 | } | ||
134 | #endif | ||
125 | 135 | ||
126 | /* Let iwl_tx_complete free the response skb */ | 136 | /* Let iwl_tx_complete free the response skb */ |
127 | return 1; | 137 | return 1; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 5bc3df432d2d..9740fcc1805e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -61,7 +61,7 @@ | |||
61 | * | 61 | * |
62 | */ | 62 | */ |
63 | 63 | ||
64 | #define _iwl_write32(priv, ofs, val) writel((val), (priv)->hw_base + (ofs)) | 64 | #define _iwl_write32(priv, ofs, val) iowrite32((val), (priv)->hw_base + (ofs)) |
65 | #ifdef CONFIG_IWLWIFI_DEBUG | 65 | #ifdef CONFIG_IWLWIFI_DEBUG |
66 | static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, | 66 | static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, |
67 | u32 ofs, u32 val) | 67 | u32 ofs, u32 val) |
@@ -75,7 +75,7 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, | |||
75 | #define iwl_write32(priv, ofs, val) _iwl_write32(priv, ofs, val) | 75 | #define iwl_write32(priv, ofs, val) _iwl_write32(priv, ofs, val) |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #define _iwl_read32(priv, ofs) readl((priv)->hw_base + (ofs)) | 78 | #define _iwl_read32(priv, ofs) ioread32((priv)->hw_base + (ofs)) |
79 | #ifdef CONFIG_IWLWIFI_DEBUG | 79 | #ifdef CONFIG_IWLWIFI_DEBUG |
80 | static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) | 80 | static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) |
81 | { | 81 | { |
@@ -155,28 +155,10 @@ static inline void __iwl_clear_bit(const char *f, u32 l, | |||
155 | static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | 155 | static inline int _iwl_grab_nic_access(struct iwl_priv *priv) |
156 | { | 156 | { |
157 | int ret; | 157 | int ret; |
158 | u32 gp_ctl; | ||
159 | |||
160 | #ifdef CONFIG_IWLWIFI_DEBUG | 158 | #ifdef CONFIG_IWLWIFI_DEBUG |
161 | if (atomic_read(&priv->restrict_refcnt)) | 159 | if (atomic_read(&priv->restrict_refcnt)) |
162 | return 0; | 160 | return 0; |
163 | #endif | 161 | #endif |
164 | if (test_bit(STATUS_RF_KILL_HW, &priv->status) || | ||
165 | test_bit(STATUS_RF_KILL_SW, &priv->status)) { | ||
166 | IWL_WARNING("WARNING: Requesting MAC access during RFKILL " | ||
167 | "wakes up NIC\n"); | ||
168 | |||
169 | /* 10 msec allows time for NIC to complete its data save */ | ||
170 | gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); | ||
171 | if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { | ||
172 | IWL_DEBUG_RF_KILL("Wait for complete power-down, " | ||
173 | "gpctl = 0x%08x\n", gp_ctl); | ||
174 | mdelay(10); | ||
175 | } else | ||
176 | IWL_DEBUG_RF_KILL("power-down complete, " | ||
177 | "gpctl = 0x%08x\n", gp_ctl); | ||
178 | } | ||
179 | |||
180 | /* this bit wakes up the NIC */ | 162 | /* this bit wakes up the NIC */ |
181 | _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 163 | _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
182 | ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, | 164 | ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index a099c9e30e55..60a03d2d2d0e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -152,9 +152,10 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) | |||
152 | /* initialize to default */ | 152 | /* initialize to default */ |
153 | static int iwl_power_init_handle(struct iwl_priv *priv) | 153 | static int iwl_power_init_handle(struct iwl_priv *priv) |
154 | { | 154 | { |
155 | int ret = 0, i; | ||
156 | struct iwl_power_mgr *pow_data; | 155 | struct iwl_power_mgr *pow_data; |
157 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; | 156 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; |
157 | struct iwl_powertable_cmd *cmd; | ||
158 | int i; | ||
158 | u16 pci_pm; | 159 | u16 pci_pm; |
159 | 160 | ||
160 | IWL_DEBUG_POWER("Initialize power \n"); | 161 | IWL_DEBUG_POWER("Initialize power \n"); |
@@ -167,25 +168,19 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
167 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); | 168 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); |
168 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); | 169 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); |
169 | 170 | ||
170 | ret = pci_read_config_word(priv->pci_dev, | 171 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &pci_pm); |
171 | PCI_LINK_CTRL, &pci_pm); | ||
172 | if (ret != 0) | ||
173 | return 0; | ||
174 | else { | ||
175 | struct iwl_powertable_cmd *cmd; | ||
176 | 172 | ||
177 | IWL_DEBUG_POWER("adjust power command flags\n"); | 173 | IWL_DEBUG_POWER("adjust power command flags\n"); |
178 | 174 | ||
179 | for (i = 0; i < IWL_POWER_MAX; i++) { | 175 | for (i = 0; i < IWL_POWER_MAX; i++) { |
180 | cmd = &pow_data->pwr_range_0[i].cmd; | 176 | cmd = &pow_data->pwr_range_0[i].cmd; |
181 | 177 | ||
182 | if (pci_pm & 0x1) | 178 | if (pci_pm & PCI_CFG_LINK_CTRL_VAL_L0S_EN) |
183 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; | 179 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; |
184 | else | 180 | else |
185 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 181 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |
186 | } | ||
187 | } | 182 | } |
188 | return ret; | 183 | return 0; |
189 | } | 184 | } |
190 | 185 | ||
191 | /* adjust power command according to dtim period and power level*/ | 186 | /* adjust power command according to dtim period and power level*/ |
@@ -255,17 +250,26 @@ static int iwl_update_power_command(struct iwl_priv *priv, | |||
255 | 250 | ||
256 | 251 | ||
257 | /* | 252 | /* |
258 | * calucaute the final power mode index | 253 | * compute the final power mode index |
259 | */ | 254 | */ |
260 | int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh) | 255 | int iwl_power_update_mode(struct iwl_priv *priv, bool force) |
261 | { | 256 | { |
262 | struct iwl_power_mgr *setting = &(priv->power_data); | 257 | struct iwl_power_mgr *setting = &(priv->power_data); |
263 | int ret = 0; | 258 | int ret = 0; |
264 | u16 uninitialized_var(final_mode); | 259 | u16 uninitialized_var(final_mode); |
265 | 260 | ||
266 | /* If on battery, set to 3, | 261 | /* Don't update the RX chain when chain noise calibration is running */ |
267 | * if plugged into AC power, set to CAM ("continuously aware mode"), | 262 | if (priv->chain_noise_data.state != IWL_CHAIN_NOISE_DONE && |
268 | * else user level */ | 263 | priv->chain_noise_data.state != IWL_CHAIN_NOISE_ALIVE) { |
264 | IWL_DEBUG_POWER("Cannot update the power, chain noise " | ||
265 | "calibration running: %d\n", | ||
266 | priv->chain_noise_data.state); | ||
267 | return -EAGAIN; | ||
268 | } | ||
269 | |||
270 | /* If on battery, set to 3, | ||
271 | * if plugged into AC power, set to CAM ("continuously aware mode"), | ||
272 | * else user level */ | ||
269 | 273 | ||
270 | switch (setting->system_power_setting) { | 274 | switch (setting->system_power_setting) { |
271 | case IWL_POWER_SYS_AUTO: | 275 | case IWL_POWER_SYS_AUTO: |
@@ -286,11 +290,11 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh) | |||
286 | final_mode = setting->critical_power_setting; | 290 | final_mode = setting->critical_power_setting; |
287 | 291 | ||
288 | /* driver only support CAM for non STA network */ | 292 | /* driver only support CAM for non STA network */ |
289 | if (priv->iw_mode != IEEE80211_IF_TYPE_STA) | 293 | if (priv->iw_mode != NL80211_IFTYPE_STATION) |
290 | final_mode = IWL_POWER_MODE_CAM; | 294 | final_mode = IWL_POWER_MODE_CAM; |
291 | 295 | ||
292 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && | 296 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && |
293 | ((setting->power_mode != final_mode) || refresh)) { | 297 | ((setting->power_mode != final_mode) || force)) { |
294 | struct iwl_powertable_cmd cmd; | 298 | struct iwl_powertable_cmd cmd; |
295 | 299 | ||
296 | if (final_mode != IWL_POWER_MODE_CAM) | 300 | if (final_mode != IWL_POWER_MODE_CAM) |
@@ -324,7 +328,7 @@ EXPORT_SYMBOL(iwl_power_update_mode); | |||
324 | * this will be usefull for rate scale to disable PM during heavy | 328 | * this will be usefull for rate scale to disable PM during heavy |
325 | * Tx/Rx activities | 329 | * Tx/Rx activities |
326 | */ | 330 | */ |
327 | int iwl_power_disable_management(struct iwl_priv *priv) | 331 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) |
328 | { | 332 | { |
329 | u16 prev_mode; | 333 | u16 prev_mode; |
330 | int ret = 0; | 334 | int ret = 0; |
@@ -337,6 +341,11 @@ int iwl_power_disable_management(struct iwl_priv *priv) | |||
337 | ret = iwl_power_update_mode(priv, 0); | 341 | ret = iwl_power_update_mode(priv, 0); |
338 | priv->power_data.power_disabled = 1; | 342 | priv->power_data.power_disabled = 1; |
339 | priv->power_data.user_power_setting = prev_mode; | 343 | priv->power_data.user_power_setting = prev_mode; |
344 | cancel_delayed_work(&priv->set_power_save); | ||
345 | if (ms) | ||
346 | queue_delayed_work(priv->workqueue, &priv->set_power_save, | ||
347 | msecs_to_jiffies(ms)); | ||
348 | |||
340 | 349 | ||
341 | return ret; | 350 | return ret; |
342 | } | 351 | } |
@@ -359,35 +368,26 @@ EXPORT_SYMBOL(iwl_power_enable_management); | |||
359 | /* set user_power_setting */ | 368 | /* set user_power_setting */ |
360 | int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode) | 369 | int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode) |
361 | { | 370 | { |
362 | int ret = 0; | ||
363 | |||
364 | if (mode > IWL_POWER_LIMIT) | 371 | if (mode > IWL_POWER_LIMIT) |
365 | return -EINVAL; | 372 | return -EINVAL; |
366 | 373 | ||
367 | priv->power_data.user_power_setting = mode; | 374 | priv->power_data.user_power_setting = mode; |
368 | 375 | ||
369 | ret = iwl_power_update_mode(priv, 0); | 376 | return iwl_power_update_mode(priv, 0); |
370 | |||
371 | return ret; | ||
372 | } | 377 | } |
373 | EXPORT_SYMBOL(iwl_power_set_user_mode); | 378 | EXPORT_SYMBOL(iwl_power_set_user_mode); |
374 | 379 | ||
375 | |||
376 | /* set system_power_setting. This should be set by over all | 380 | /* set system_power_setting. This should be set by over all |
377 | * PM application. | 381 | * PM application. |
378 | */ | 382 | */ |
379 | int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode) | 383 | int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode) |
380 | { | 384 | { |
381 | int ret = 0; | ||
382 | |||
383 | if (mode > IWL_POWER_LIMIT) | 385 | if (mode > IWL_POWER_LIMIT) |
384 | return -EINVAL; | 386 | return -EINVAL; |
385 | 387 | ||
386 | priv->power_data.system_power_setting = mode; | 388 | priv->power_data.system_power_setting = mode; |
387 | 389 | ||
388 | ret = iwl_power_update_mode(priv, 0); | 390 | return iwl_power_update_mode(priv, 0); |
389 | |||
390 | return ret; | ||
391 | } | 391 | } |
392 | EXPORT_SYMBOL(iwl_power_set_system_mode); | 392 | EXPORT_SYMBOL(iwl_power_set_system_mode); |
393 | 393 | ||
@@ -431,3 +431,35 @@ int iwl_power_temperature_change(struct iwl_priv *priv) | |||
431 | return ret; | 431 | return ret; |
432 | } | 432 | } |
433 | EXPORT_SYMBOL(iwl_power_temperature_change); | 433 | EXPORT_SYMBOL(iwl_power_temperature_change); |
434 | |||
435 | static void iwl_bg_set_power_save(struct work_struct *work) | ||
436 | { | ||
437 | struct iwl_priv *priv = container_of(work, | ||
438 | struct iwl_priv, set_power_save.work); | ||
439 | IWL_DEBUG(IWL_DL_STATE, "update power\n"); | ||
440 | |||
441 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
442 | return; | ||
443 | |||
444 | mutex_lock(&priv->mutex); | ||
445 | |||
446 | /* on starting association we disable power managment | ||
447 | * until association, if association failed then this | ||
448 | * timer will expire and enable PM again. | ||
449 | */ | ||
450 | if (!iwl_is_associated(priv)) | ||
451 | iwl_power_enable_management(priv); | ||
452 | |||
453 | mutex_unlock(&priv->mutex); | ||
454 | } | ||
455 | void iwl_setup_power_deferred_work(struct iwl_priv *priv) | ||
456 | { | ||
457 | INIT_DELAYED_WORK(&priv->set_power_save, iwl_bg_set_power_save); | ||
458 | } | ||
459 | EXPORT_SYMBOL(iwl_setup_power_deferred_work); | ||
460 | |||
461 | void iwl_power_cancel_timeout(struct iwl_priv *priv) | ||
462 | { | ||
463 | cancel_delayed_work(&priv->set_power_save); | ||
464 | } | ||
465 | EXPORT_SYMBOL(iwl_power_cancel_timeout); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h index abcbbf96a84e..df484a90ae64 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.h +++ b/drivers/net/wireless/iwlwifi/iwl-power.h | |||
@@ -72,14 +72,16 @@ struct iwl_power_mgr { | |||
72 | /* final power level that used to calculate final power command */ | 72 | /* final power level that used to calculate final power command */ |
73 | u8 power_mode; | 73 | u8 power_mode; |
74 | u8 user_power_setting; /* set by user through mac80211 or sysfs */ | 74 | u8 user_power_setting; /* set by user through mac80211 or sysfs */ |
75 | u8 system_power_setting; /* set by kernel syatem tools */ | 75 | u8 system_power_setting; /* set by kernel system tools */ |
76 | u8 critical_power_setting; /* set if driver over heated */ | 76 | u8 critical_power_setting; /* set if driver over heated */ |
77 | u8 is_battery_active; /* DC/AC power */ | 77 | u8 is_battery_active; /* DC/AC power */ |
78 | u8 power_disabled; /* flag to disable using power saving level */ | 78 | u8 power_disabled; /* flag to disable using power saving level */ |
79 | }; | 79 | }; |
80 | 80 | ||
81 | int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh); | 81 | void iwl_setup_power_deferred_work(struct iwl_priv *priv); |
82 | int iwl_power_disable_management(struct iwl_priv *priv); | 82 | void iwl_power_cancel_timeout(struct iwl_priv *priv); |
83 | int iwl_power_update_mode(struct iwl_priv *priv, bool force); | ||
84 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms); | ||
83 | int iwl_power_enable_management(struct iwl_priv *priv); | 85 | int iwl_power_enable_management(struct iwl_priv *priv); |
84 | int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode); | 86 | int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode); |
85 | int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode); | 87 | int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index e81bfc42a7cb..7cde9d76ff5d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -376,7 +376,9 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
376 | { | 376 | { |
377 | int ret; | 377 | int ret; |
378 | unsigned long flags; | 378 | unsigned long flags; |
379 | unsigned int rb_size; | 379 | u32 rb_size; |
380 | const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ | ||
381 | const u32 rb_timeout = 0; /* FIXME: RX_RB_TIMEOUT why this stalls RX */ | ||
380 | 382 | ||
381 | spin_lock_irqsave(&priv->lock, flags); | 383 | spin_lock_irqsave(&priv->lock, flags); |
382 | ret = iwl_grab_nic_access(priv); | 384 | ret = iwl_grab_nic_access(priv); |
@@ -398,26 +400,32 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
398 | 400 | ||
399 | /* Tell device where to find RBD circular buffer in DRAM */ | 401 | /* Tell device where to find RBD circular buffer in DRAM */ |
400 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, | 402 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, |
401 | rxq->dma_addr >> 8); | 403 | (u32)(rxq->dma_addr >> 8)); |
402 | 404 | ||
403 | /* Tell device where in DRAM to update its Rx status */ | 405 | /* Tell device where in DRAM to update its Rx status */ |
404 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, | 406 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, |
405 | (priv->shared_phys + priv->rb_closed_offset) >> 4); | 407 | (priv->shared_phys + priv->rb_closed_offset) >> 4); |
406 | 408 | ||
407 | /* Enable Rx DMA, enable host interrupt, Rx buffer size 4k, 256 RBDs */ | 409 | /* Enable Rx DMA |
410 | * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set becuase of HW bug in | ||
411 | * the credit mechanism in 5000 HW RX FIFO | ||
412 | * Direct rx interrupts to hosts | ||
413 | * Rx buffer size 4 or 8k | ||
414 | * RB timeout 0x10 | ||
415 | * 256 RBDs | ||
416 | */ | ||
408 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, | 417 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, |
409 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | | 418 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | |
419 | FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY | | ||
410 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | | 420 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | |
411 | rb_size | | 421 | rb_size| |
412 | /* 0x10 << 4 | */ | 422 | (rb_timeout << FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)| |
413 | (RX_QUEUE_SIZE_LOG << | 423 | (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); |
414 | FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); | ||
415 | |||
416 | /* | ||
417 | * iwl_write32(priv,CSR_INT_COAL_REG,0); | ||
418 | */ | ||
419 | 424 | ||
420 | iwl_release_nic_access(priv); | 425 | iwl_release_nic_access(priv); |
426 | |||
427 | iwl_write32(priv, CSR_INT_COALESCING, 0x40); | ||
428 | |||
421 | spin_unlock_irqrestore(&priv->lock, flags); | 429 | spin_unlock_irqrestore(&priv->lock, flags); |
422 | 430 | ||
423 | return 0; | 431 | return 0; |
@@ -789,107 +797,6 @@ static inline void iwl_dbg_report_frame(struct iwl_priv *priv, | |||
789 | } | 797 | } |
790 | #endif | 798 | #endif |
791 | 799 | ||
792 | static void iwl_add_radiotap(struct iwl_priv *priv, | ||
793 | struct sk_buff *skb, | ||
794 | struct iwl_rx_phy_res *rx_start, | ||
795 | struct ieee80211_rx_status *stats, | ||
796 | u32 ampdu_status) | ||
797 | { | ||
798 | s8 signal = stats->signal; | ||
799 | s8 noise = 0; | ||
800 | int rate = stats->rate_idx; | ||
801 | u64 tsf = stats->mactime; | ||
802 | __le16 antenna; | ||
803 | __le16 phy_flags_hw = rx_start->phy_flags; | ||
804 | struct iwl4965_rt_rx_hdr { | ||
805 | struct ieee80211_radiotap_header rt_hdr; | ||
806 | __le64 rt_tsf; /* TSF */ | ||
807 | u8 rt_flags; /* radiotap packet flags */ | ||
808 | u8 rt_rate; /* rate in 500kb/s */ | ||
809 | __le16 rt_channelMHz; /* channel in MHz */ | ||
810 | __le16 rt_chbitmask; /* channel bitfield */ | ||
811 | s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ | ||
812 | s8 rt_dbmnoise; | ||
813 | u8 rt_antenna; /* antenna number */ | ||
814 | } __attribute__ ((packed)) *iwl4965_rt; | ||
815 | |||
816 | /* TODO: We won't have enough headroom for HT frames. Fix it later. */ | ||
817 | if (skb_headroom(skb) < sizeof(*iwl4965_rt)) { | ||
818 | if (net_ratelimit()) | ||
819 | printk(KERN_ERR "not enough headroom [%d] for " | ||
820 | "radiotap head [%zd]\n", | ||
821 | skb_headroom(skb), sizeof(*iwl4965_rt)); | ||
822 | return; | ||
823 | } | ||
824 | |||
825 | /* put radiotap header in front of 802.11 header and data */ | ||
826 | iwl4965_rt = (void *)skb_push(skb, sizeof(*iwl4965_rt)); | ||
827 | |||
828 | /* initialise radiotap header */ | ||
829 | iwl4965_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
830 | iwl4965_rt->rt_hdr.it_pad = 0; | ||
831 | |||
832 | /* total header + data */ | ||
833 | put_unaligned_le16(sizeof(*iwl4965_rt), &iwl4965_rt->rt_hdr.it_len); | ||
834 | |||
835 | /* Indicate all the fields we add to the radiotap header */ | ||
836 | put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) | | ||
837 | (1 << IEEE80211_RADIOTAP_FLAGS) | | ||
838 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
839 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
840 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | ||
841 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | | ||
842 | (1 << IEEE80211_RADIOTAP_ANTENNA), | ||
843 | &(iwl4965_rt->rt_hdr.it_present)); | ||
844 | |||
845 | /* Zero the flags, we'll add to them as we go */ | ||
846 | iwl4965_rt->rt_flags = 0; | ||
847 | |||
848 | put_unaligned_le64(tsf, &iwl4965_rt->rt_tsf); | ||
849 | |||
850 | iwl4965_rt->rt_dbmsignal = signal; | ||
851 | iwl4965_rt->rt_dbmnoise = noise; | ||
852 | |||
853 | /* Convert the channel frequency and set the flags */ | ||
854 | put_unaligned(cpu_to_le16(stats->freq), &iwl4965_rt->rt_channelMHz); | ||
855 | if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) | ||
856 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ, | ||
857 | &iwl4965_rt->rt_chbitmask); | ||
858 | else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) | ||
859 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, | ||
860 | &iwl4965_rt->rt_chbitmask); | ||
861 | else /* 802.11g */ | ||
862 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, | ||
863 | &iwl4965_rt->rt_chbitmask); | ||
864 | |||
865 | if (rate == -1) | ||
866 | iwl4965_rt->rt_rate = 0; | ||
867 | else | ||
868 | iwl4965_rt->rt_rate = iwl_rates[rate].ieee; | ||
869 | |||
870 | /* | ||
871 | * "antenna number" | ||
872 | * | ||
873 | * It seems that the antenna field in the phy flags value | ||
874 | * is actually a bitfield. This is undefined by radiotap, | ||
875 | * it wants an actual antenna number but I always get "7" | ||
876 | * for most legacy frames I receive indicating that the | ||
877 | * same frame was received on all three RX chains. | ||
878 | * | ||
879 | * I think this field should be removed in favour of a | ||
880 | * new 802.11n radiotap field "RX chains" that is defined | ||
881 | * as a bitmask. | ||
882 | */ | ||
883 | antenna = phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK; | ||
884 | iwl4965_rt->rt_antenna = le16_to_cpu(antenna) >> 4; | ||
885 | |||
886 | /* set the preamble flag if appropriate */ | ||
887 | if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) | ||
888 | iwl4965_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; | ||
889 | |||
890 | stats->flag |= RX_FLAG_RADIOTAP; | ||
891 | } | ||
892 | |||
893 | static void iwl_update_rx_stats(struct iwl_priv *priv, u16 fc, u16 len) | 800 | static void iwl_update_rx_stats(struct iwl_priv *priv, u16 fc, u16 len) |
894 | { | 801 | { |
895 | /* 0 - mgmt, 1 - cnt, 2 - data */ | 802 | /* 0 - mgmt, 1 - cnt, 2 - data */ |
@@ -1074,9 +981,6 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
1074 | iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 981 | iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats)) |
1075 | return; | 982 | return; |
1076 | 983 | ||
1077 | if (priv->add_radiotap) | ||
1078 | iwl_add_radiotap(priv, rxb->skb, rx_start, stats, ampdu_status); | ||
1079 | |||
1080 | iwl_update_rx_stats(priv, le16_to_cpu(hdr->frame_control), len); | 984 | iwl_update_rx_stats(priv, le16_to_cpu(hdr->frame_control), len); |
1081 | ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); | 985 | ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); |
1082 | priv->alloc_rxb_skb--; | 986 | priv->alloc_rxb_skb--; |
@@ -1130,10 +1034,10 @@ static int iwl_is_network_packet(struct iwl_priv *priv, | |||
1130 | /* Filter incoming packets to determine if they are targeted toward | 1034 | /* Filter incoming packets to determine if they are targeted toward |
1131 | * this network, discarding packets coming from ourselves */ | 1035 | * this network, discarding packets coming from ourselves */ |
1132 | switch (priv->iw_mode) { | 1036 | switch (priv->iw_mode) { |
1133 | case IEEE80211_IF_TYPE_IBSS: /* Header: Dest. | Source | BSSID */ | 1037 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ |
1134 | /* packets to our IBSS update information */ | 1038 | /* packets to our IBSS update information */ |
1135 | return !compare_ether_addr(header->addr3, priv->bssid); | 1039 | return !compare_ether_addr(header->addr3, priv->bssid); |
1136 | case IEEE80211_IF_TYPE_STA: /* Header: Dest. | AP{BSSID} | Source */ | 1040 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ |
1137 | /* packets to our IBSS update information */ | 1041 | /* packets to our IBSS update information */ |
1138 | return !compare_ether_addr(header->addr2, priv->bssid); | 1042 | return !compare_ether_addr(header->addr2, priv->bssid); |
1139 | default: | 1043 | default: |
@@ -1171,7 +1075,6 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1171 | if (rx_status.band == IEEE80211_BAND_5GHZ) | 1075 | if (rx_status.band == IEEE80211_BAND_5GHZ) |
1172 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; | 1076 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; |
1173 | 1077 | ||
1174 | rx_status.antenna = 0; | ||
1175 | rx_status.flag = 0; | 1078 | rx_status.flag = 0; |
1176 | 1079 | ||
1177 | /* TSF isn't reliable. In order to allow smooth user experience, | 1080 | /* TSF isn't reliable. In order to allow smooth user experience, |
@@ -1253,8 +1156,28 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1253 | rx_status.signal, rx_status.noise, rx_status.signal, | 1156 | rx_status.signal, rx_status.noise, rx_status.signal, |
1254 | (unsigned long long)rx_status.mactime); | 1157 | (unsigned long long)rx_status.mactime); |
1255 | 1158 | ||
1159 | /* | ||
1160 | * "antenna number" | ||
1161 | * | ||
1162 | * It seems that the antenna field in the phy flags value | ||
1163 | * is actually a bitfield. This is undefined by radiotap, | ||
1164 | * it wants an actual antenna number but I always get "7" | ||
1165 | * for most legacy frames I receive indicating that the | ||
1166 | * same frame was received on all three RX chains. | ||
1167 | * | ||
1168 | * I think this field should be removed in favour of a | ||
1169 | * new 802.11n radiotap field "RX chains" that is defined | ||
1170 | * as a bitmask. | ||
1171 | */ | ||
1172 | rx_status.antenna = le16_to_cpu(rx_start->phy_flags & | ||
1173 | RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; | ||
1174 | |||
1175 | /* set the preamble flag if appropriate */ | ||
1176 | if (rx_start->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) | ||
1177 | rx_status.flag |= RX_FLAG_SHORTPRE; | ||
1178 | |||
1256 | /* Take shortcut when only in monitor mode */ | 1179 | /* Take shortcut when only in monitor mode */ |
1257 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | 1180 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { |
1258 | iwl_pass_packet_to_mac80211(priv, include_phy, | 1181 | iwl_pass_packet_to_mac80211(priv, include_phy, |
1259 | rxb, &rx_status); | 1182 | rxb, &rx_status); |
1260 | return; | 1183 | return; |
@@ -1271,7 +1194,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1271 | switch (fc & IEEE80211_FCTL_FTYPE) { | 1194 | switch (fc & IEEE80211_FCTL_FTYPE) { |
1272 | case IEEE80211_FTYPE_MGMT: | 1195 | case IEEE80211_FTYPE_MGMT: |
1273 | case IEEE80211_FTYPE_DATA: | 1196 | case IEEE80211_FTYPE_DATA: |
1274 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 1197 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
1275 | iwl_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, | 1198 | iwl_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, |
1276 | header->addr2); | 1199 | header->addr2); |
1277 | /* fall through */ | 1200 | /* fall through */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 6c8ac3a87d54..3b0bee331a33 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -88,7 +88,7 @@ static int iwl_is_empty_essid(const char *essid, int essid_len) | |||
88 | 88 | ||
89 | 89 | ||
90 | 90 | ||
91 | const char *iwl_escape_essid(const char *essid, u8 essid_len) | 91 | static const char *iwl_escape_essid(const char *essid, u8 essid_len) |
92 | { | 92 | { |
93 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | 93 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
94 | const char *s = essid; | 94 | const char *s = essid; |
@@ -111,7 +111,6 @@ const char *iwl_escape_essid(const char *essid, u8 essid_len) | |||
111 | *d = '\0'; | 111 | *d = '\0'; |
112 | return escaped; | 112 | return escaped; |
113 | } | 113 | } |
114 | EXPORT_SYMBOL(iwl_escape_essid); | ||
115 | 114 | ||
116 | /** | 115 | /** |
117 | * iwl_scan_cancel - Cancel any currently executing HW scan | 116 | * iwl_scan_cancel - Cancel any currently executing HW scan |
@@ -464,11 +463,6 @@ void iwl_init_scan_params(struct iwl_priv *priv) | |||
464 | 463 | ||
465 | int iwl_scan_initiate(struct iwl_priv *priv) | 464 | int iwl_scan_initiate(struct iwl_priv *priv) |
466 | { | 465 | { |
467 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | ||
468 | IWL_ERROR("APs don't scan.\n"); | ||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | if (!iwl_is_ready_rf(priv)) { | 466 | if (!iwl_is_ready_rf(priv)) { |
473 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); | 467 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); |
474 | return -EIO; | 468 | return -EIO; |
@@ -480,8 +474,7 @@ int iwl_scan_initiate(struct iwl_priv *priv) | |||
480 | } | 474 | } |
481 | 475 | ||
482 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | 476 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { |
483 | IWL_DEBUG_SCAN("Scan request while abort pending. " | 477 | IWL_DEBUG_SCAN("Scan request while abort pending\n"); |
484 | "Queuing.\n"); | ||
485 | return -EAGAIN; | 478 | return -EAGAIN; |
486 | } | 479 | } |
487 | 480 | ||
@@ -710,7 +703,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
710 | u16 cmd_len; | 703 | u16 cmd_len; |
711 | enum ieee80211_band band; | 704 | enum ieee80211_band band; |
712 | u8 n_probes = 2; | 705 | u8 n_probes = 2; |
713 | u8 rx_chain = 0x7; /* bitmap: ABC chains */ | 706 | u8 rx_chain = priv->hw_params.valid_rx_ant; |
714 | 707 | ||
715 | conf = ieee80211_get_hw_conf(priv->hw); | 708 | conf = ieee80211_get_hw_conf(priv->hw); |
716 | 709 | ||
@@ -850,7 +843,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
850 | 843 | ||
851 | /* Force use of chains B and C (0x6) for scan Rx for 4965 | 844 | /* Force use of chains B and C (0x6) for scan Rx for 4965 |
852 | * Avoid A (0x1) because of its off-channel reception on A-band. | 845 | * Avoid A (0x1) because of its off-channel reception on A-band. |
853 | * MIMO is not used here, but value is required */ | 846 | */ |
854 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) | 847 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) |
855 | rx_chain = 0x6; | 848 | rx_chain = 0x6; |
856 | } else { | 849 | } else { |
@@ -858,6 +851,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
858 | goto done; | 851 | goto done; |
859 | } | 852 | } |
860 | 853 | ||
854 | /* MIMO is not used here, but value is required */ | ||
861 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | | 855 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | |
862 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | | 856 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | |
863 | (rx_chain << RXON_RX_CHAIN_FORCE_SEL_POS) | | 857 | (rx_chain << RXON_RX_CHAIN_FORCE_SEL_POS) | |
@@ -869,7 +863,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
869 | 863 | ||
870 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | 864 | scan->tx_cmd.len = cpu_to_le16(cmd_len); |
871 | 865 | ||
872 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | 866 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) |
873 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 867 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
874 | 868 | ||
875 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | 869 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | |
@@ -922,10 +916,29 @@ static void iwl_bg_abort_scan(struct work_struct *work) | |||
922 | mutex_unlock(&priv->mutex); | 916 | mutex_unlock(&priv->mutex); |
923 | } | 917 | } |
924 | 918 | ||
919 | static void iwl_bg_scan_completed(struct work_struct *work) | ||
920 | { | ||
921 | struct iwl_priv *priv = | ||
922 | container_of(work, struct iwl_priv, scan_completed); | ||
923 | |||
924 | IWL_DEBUG_SCAN("SCAN complete scan\n"); | ||
925 | |||
926 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
927 | return; | ||
928 | |||
929 | ieee80211_scan_completed(priv->hw); | ||
930 | |||
931 | /* Since setting the TXPOWER may have been deferred while | ||
932 | * performing the scan, fire one off */ | ||
933 | mutex_lock(&priv->mutex); | ||
934 | iwl_set_tx_power(priv, priv->tx_power_user_lmt, true); | ||
935 | mutex_unlock(&priv->mutex); | ||
936 | } | ||
937 | |||
938 | |||
925 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv) | 939 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv) |
926 | { | 940 | { |
927 | /* FIXME: move here when resolved PENDING | 941 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); |
928 | * INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); */ | ||
929 | INIT_WORK(&priv->request_scan, iwl_bg_request_scan); | 942 | INIT_WORK(&priv->request_scan, iwl_bg_request_scan); |
930 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | 943 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); |
931 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); | 944 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 6283a3a707f5..61797f3f8d5c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -47,8 +47,8 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
47 | unsigned long flags; | 47 | unsigned long flags; |
48 | DECLARE_MAC_BUF(mac); | 48 | DECLARE_MAC_BUF(mac); |
49 | 49 | ||
50 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) || | 50 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || |
51 | (priv->iw_mode == IEEE80211_IF_TYPE_AP)) | 51 | (priv->iw_mode == NL80211_IFTYPE_AP)) |
52 | start = IWL_STA_ID; | 52 | start = IWL_STA_ID; |
53 | 53 | ||
54 | if (is_broadcast_ether_addr(addr)) | 54 | if (is_broadcast_ether_addr(addr)) |
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iwl_find_station); | |||
74 | 74 | ||
75 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | 75 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) |
76 | { | 76 | { |
77 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 77 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
78 | return IWL_AP_ID; | 78 | return IWL_AP_ID; |
79 | } else { | 79 | } else { |
80 | u8 *da = ieee80211_get_DA(hdr); | 80 | u8 *da = ieee80211_get_DA(hdr); |
@@ -191,20 +191,20 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
191 | if (!sta_ht_inf || !sta_ht_inf->ht_supported) | 191 | if (!sta_ht_inf || !sta_ht_inf->ht_supported) |
192 | goto done; | 192 | goto done; |
193 | 193 | ||
194 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2; | 194 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; |
195 | 195 | ||
196 | sta_flags = priv->stations[index].sta.station_flags; | 196 | sta_flags = priv->stations[index].sta.station_flags; |
197 | 197 | ||
198 | sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); | 198 | sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); |
199 | 199 | ||
200 | switch (mimo_ps_mode) { | 200 | switch (mimo_ps_mode) { |
201 | case WLAN_HT_CAP_MIMO_PS_STATIC: | 201 | case WLAN_HT_CAP_SM_PS_STATIC: |
202 | sta_flags |= STA_FLG_MIMO_DIS_MSK; | 202 | sta_flags |= STA_FLG_MIMO_DIS_MSK; |
203 | break; | 203 | break; |
204 | case WLAN_HT_CAP_MIMO_PS_DYNAMIC: | 204 | case WLAN_HT_CAP_SM_PS_DYNAMIC: |
205 | sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; | 205 | sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; |
206 | break; | 206 | break; |
207 | case WLAN_HT_CAP_MIMO_PS_DISABLED: | 207 | case WLAN_HT_CAP_SM_PS_DISABLED: |
208 | break; | 208 | break; |
209 | default: | 209 | default: |
210 | IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode); | 210 | IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode); |
@@ -286,7 +286,7 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | |||
286 | 286 | ||
287 | /* BCAST station and IBSS stations do not work in HT mode */ | 287 | /* BCAST station and IBSS stations do not work in HT mode */ |
288 | if (sta_id != priv->hw_params.bcast_sta_id && | 288 | if (sta_id != priv->hw_params.bcast_sta_id && |
289 | priv->iw_mode != IEEE80211_IF_TYPE_IBSS) | 289 | priv->iw_mode != NL80211_IFTYPE_ADHOC) |
290 | iwl_set_ht_add_station(priv, sta_id, ht_info); | 290 | iwl_set_ht_add_station(priv, sta_id, ht_info); |
291 | 291 | ||
292 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 292 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
@@ -817,7 +817,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
817 | }; | 817 | }; |
818 | 818 | ||
819 | if ((lq->sta_id == 0xFF) && | 819 | if ((lq->sta_id == 0xFF) && |
820 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 820 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) |
821 | return -EINVAL; | 821 | return -EINVAL; |
822 | 822 | ||
823 | if (lq->sta_id == 0xFF) | 823 | if (lq->sta_id == 0xFF) |
@@ -904,7 +904,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
904 | 904 | ||
905 | if ((is_ap) && | 905 | if ((is_ap) && |
906 | (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && | 906 | (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && |
907 | (priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 907 | (priv->iw_mode == NL80211_IFTYPE_STATION)) |
908 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | 908 | sta_id = iwl_add_station_flags(priv, addr, is_ap, |
909 | 0, cur_ht_config); | 909 | 0, cur_ht_config); |
910 | else | 910 | else |
@@ -938,11 +938,11 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
938 | 938 | ||
939 | /* If we are a client station in a BSS network, use the special | 939 | /* If we are a client station in a BSS network, use the special |
940 | * AP station entry (that's the only station we communicate with) */ | 940 | * AP station entry (that's the only station we communicate with) */ |
941 | case IEEE80211_IF_TYPE_STA: | 941 | case NL80211_IFTYPE_STATION: |
942 | return IWL_AP_ID; | 942 | return IWL_AP_ID; |
943 | 943 | ||
944 | /* If we are an AP, then find the station, or use BCAST */ | 944 | /* If we are an AP, then find the station, or use BCAST */ |
945 | case IEEE80211_IF_TYPE_AP: | 945 | case NL80211_IFTYPE_AP: |
946 | sta_id = iwl_find_station(priv, hdr->addr1); | 946 | sta_id = iwl_find_station(priv, hdr->addr1); |
947 | if (sta_id != IWL_INVALID_STATION) | 947 | if (sta_id != IWL_INVALID_STATION) |
948 | return sta_id; | 948 | return sta_id; |
@@ -950,7 +950,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
950 | 950 | ||
951 | /* If this frame is going out to an IBSS network, find the station, | 951 | /* If this frame is going out to an IBSS network, find the station, |
952 | * or create a new station table entry */ | 952 | * or create a new station table entry */ |
953 | case IEEE80211_IF_TYPE_IBSS: | 953 | case NL80211_IFTYPE_ADHOC: |
954 | sta_id = iwl_find_station(priv, hdr->addr1); | 954 | sta_id = iwl_find_station(priv, hdr->addr1); |
955 | if (sta_id != IWL_INVALID_STATION) | 955 | if (sta_id != IWL_INVALID_STATION) |
956 | return sta_id; | 956 | return sta_id; |
@@ -968,6 +968,11 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
968 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 968 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
969 | return priv->hw_params.bcast_sta_id; | 969 | return priv->hw_params.bcast_sta_id; |
970 | 970 | ||
971 | /* If we are in monitor mode, use BCAST. This is required for | ||
972 | * packet injection. */ | ||
973 | case NL80211_IFTYPE_MONITOR: | ||
974 | return priv->hw_params.bcast_sta_id; | ||
975 | |||
971 | default: | 976 | default: |
972 | IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); | 977 | IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); |
973 | return priv->hw_params.bcast_sta_id; | 978 | return priv->hw_params.bcast_sta_id; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 78b1a7a4ca40..907a53ebc6e4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -63,7 +63,7 @@ static const u16 default_tid_to_tx_fifo[] = { | |||
63 | * Does NOT advance any TFD circular buffer read/write indexes | 63 | * Does NOT advance any TFD circular buffer read/write indexes |
64 | * Does NOT free the TFD itself (which is within circular buffer) | 64 | * Does NOT free the TFD itself (which is within circular buffer) |
65 | */ | 65 | */ |
66 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | 66 | static int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) |
67 | { | 67 | { |
68 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; | 68 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; |
69 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; | 69 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; |
@@ -115,10 +115,8 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
115 | } | 115 | } |
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
118 | EXPORT_SYMBOL(iwl_hw_txq_free_tfd); | ||
119 | 118 | ||
120 | 119 | static int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | |
121 | int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | ||
122 | dma_addr_t addr, u16 len) | 120 | dma_addr_t addr, u16 len) |
123 | { | 121 | { |
124 | int index, is_odd; | 122 | int index, is_odd; |
@@ -126,7 +124,7 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | |||
126 | u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); | 124 | u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); |
127 | 125 | ||
128 | /* Each TFD can point to a maximum 20 Tx buffers */ | 126 | /* Each TFD can point to a maximum 20 Tx buffers */ |
129 | if ((num_tbs >= MAX_NUM_OF_TBS) || (num_tbs < 0)) { | 127 | if (num_tbs >= MAX_NUM_OF_TBS) { |
130 | IWL_ERROR("Error can not send more than %d chunks\n", | 128 | IWL_ERROR("Error can not send more than %d chunks\n", |
131 | MAX_NUM_OF_TBS); | 129 | MAX_NUM_OF_TBS); |
132 | return -EINVAL; | 130 | return -EINVAL; |
@@ -151,7 +149,6 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | |||
151 | 149 | ||
152 | return 0; | 150 | return 0; |
153 | } | 151 | } |
154 | EXPORT_SYMBOL(iwl_hw_txq_attach_buf_to_tfd); | ||
155 | 152 | ||
156 | /** | 153 | /** |
157 | * iwl_txq_update_write_ptr - Send new write index to hardware | 154 | * iwl_txq_update_write_ptr - Send new write index to hardware |
@@ -478,7 +475,6 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
478 | } | 475 | } |
479 | EXPORT_SYMBOL(iwl_hw_txq_ctx_free); | 476 | EXPORT_SYMBOL(iwl_hw_txq_ctx_free); |
480 | 477 | ||
481 | |||
482 | /** | 478 | /** |
483 | * iwl_txq_ctx_reset - Reset TX queue context | 479 | * iwl_txq_ctx_reset - Reset TX queue context |
484 | * Destroys all DMA structures and initialise them again | 480 | * Destroys all DMA structures and initialise them again |
@@ -545,6 +541,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
545 | error_kw: | 541 | error_kw: |
546 | return ret; | 542 | return ret; |
547 | } | 543 | } |
544 | |||
548 | /** | 545 | /** |
549 | * iwl_txq_ctx_stop - Stop all Tx DMA channels, free Tx queue memory | 546 | * iwl_txq_ctx_stop - Stop all Tx DMA channels, free Tx queue memory |
550 | */ | 547 | */ |
@@ -796,11 +793,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
796 | goto drop_unlock; | 793 | goto drop_unlock; |
797 | } | 794 | } |
798 | 795 | ||
799 | if (!priv->vif) { | ||
800 | IWL_DEBUG_DROP("Dropping - !priv->vif\n"); | ||
801 | goto drop_unlock; | ||
802 | } | ||
803 | |||
804 | if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == | 796 | if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == |
805 | IWL_INVALID_RATE) { | 797 | IWL_INVALID_RATE) { |
806 | IWL_ERROR("ERROR: No TX rate available.\n"); | 798 | IWL_ERROR("ERROR: No TX rate available.\n"); |
@@ -822,16 +814,18 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
822 | 814 | ||
823 | /* drop all data frame if we are not associated */ | 815 | /* drop all data frame if we are not associated */ |
824 | if (ieee80211_is_data(fc) && | 816 | if (ieee80211_is_data(fc) && |
825 | (!iwl_is_associated(priv) || | 817 | (priv->iw_mode != NL80211_IFTYPE_MONITOR || |
826 | ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) || | 818 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */ |
827 | !priv->assoc_station_added)) { | 819 | (!iwl_is_associated(priv) || |
820 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) || | ||
821 | !priv->assoc_station_added)) { | ||
828 | IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); | 822 | IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); |
829 | goto drop_unlock; | 823 | goto drop_unlock; |
830 | } | 824 | } |
831 | 825 | ||
832 | spin_unlock_irqrestore(&priv->lock, flags); | 826 | spin_unlock_irqrestore(&priv->lock, flags); |
833 | 827 | ||
834 | hdr_len = ieee80211_get_hdrlen(le16_to_cpu(fc)); | 828 | hdr_len = ieee80211_hdrlen(fc); |
835 | 829 | ||
836 | /* Find (or create) index into station table for destination station */ | 830 | /* Find (or create) index into station table for destination station */ |
837 | sta_id = iwl_get_sta_id(priv, hdr); | 831 | sta_id = iwl_get_sta_id(priv, hdr); |
@@ -849,7 +843,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
849 | txq_id = swq_id; | 843 | txq_id = swq_id; |
850 | if (ieee80211_is_data_qos(fc)) { | 844 | if (ieee80211_is_data_qos(fc)) { |
851 | qc = ieee80211_get_qos_ctl(hdr); | 845 | qc = ieee80211_get_qos_ctl(hdr); |
852 | tid = qc[0] & 0xf; | 846 | tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
853 | seq_number = priv->stations[sta_id].tid[tid].seq_number; | 847 | seq_number = priv->stations[sta_id].tid[tid].seq_number; |
854 | seq_number &= IEEE80211_SCTL_SEQ; | 848 | seq_number &= IEEE80211_SCTL_SEQ; |
855 | hdr->seq_ctrl = hdr->seq_ctrl & | 849 | hdr->seq_ctrl = hdr->seq_ctrl & |
@@ -1064,7 +1058,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1064 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | | 1058 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | |
1065 | INDEX_TO_SEQ(q->write_ptr)); | 1059 | INDEX_TO_SEQ(q->write_ptr)); |
1066 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) | 1060 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) |
1067 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); | 1061 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
1068 | len = (idx == TFD_CMD_SLOTS) ? | 1062 | len = (idx == TFD_CMD_SLOTS) ? |
1069 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); | 1063 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); |
1070 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, | 1064 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, |
@@ -1072,12 +1066,26 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1072 | phys_addr += offsetof(struct iwl_cmd, hdr); | 1066 | phys_addr += offsetof(struct iwl_cmd, hdr); |
1073 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); | 1067 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); |
1074 | 1068 | ||
1075 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " | 1069 | #ifdef CONFIG_IWLWIFI_DEBUG |
1076 | "%d bytes at %d[%d]:%d\n", | 1070 | switch (out_cmd->hdr.cmd) { |
1077 | get_cmd_string(out_cmd->hdr.cmd), | 1071 | case REPLY_TX_LINK_QUALITY_CMD: |
1078 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), | 1072 | case SENSITIVITY_CMD: |
1079 | fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); | 1073 | IWL_DEBUG_HC_DUMP("Sending command %s (#%x), seq: 0x%04X, " |
1080 | 1074 | "%d bytes at %d[%d]:%d\n", | |
1075 | get_cmd_string(out_cmd->hdr.cmd), | ||
1076 | out_cmd->hdr.cmd, | ||
1077 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | ||
1078 | q->write_ptr, idx, IWL_CMD_QUEUE_NUM); | ||
1079 | break; | ||
1080 | default: | ||
1081 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " | ||
1082 | "%d bytes at %d[%d]:%d\n", | ||
1083 | get_cmd_string(out_cmd->hdr.cmd), | ||
1084 | out_cmd->hdr.cmd, | ||
1085 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | ||
1086 | q->write_ptr, idx, IWL_CMD_QUEUE_NUM); | ||
1087 | } | ||
1088 | #endif | ||
1081 | txq->need_update = 1; | 1089 | txq->need_update = 1; |
1082 | 1090 | ||
1083 | /* Set up entry in queue's byte count circular buffer */ | 1091 | /* Set up entry in queue's byte count circular buffer */ |
@@ -1185,17 +1193,16 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
1185 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 1193 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
1186 | int txq_id = SEQ_TO_QUEUE(sequence); | 1194 | int txq_id = SEQ_TO_QUEUE(sequence); |
1187 | int index = SEQ_TO_INDEX(sequence); | 1195 | int index = SEQ_TO_INDEX(sequence); |
1188 | int huge = sequence & SEQ_HUGE_FRAME; | ||
1189 | int cmd_index; | 1196 | int cmd_index; |
1197 | bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); | ||
1190 | struct iwl_cmd *cmd; | 1198 | struct iwl_cmd *cmd; |
1191 | 1199 | ||
1192 | /* If a Tx command is being handled and it isn't in the actual | 1200 | /* If a Tx command is being handled and it isn't in the actual |
1193 | * command queue then there a command routing bug has been introduced | 1201 | * command queue then there a command routing bug has been introduced |
1194 | * in the queue management code. */ | 1202 | * in the queue management code. */ |
1195 | if (txq_id != IWL_CMD_QUEUE_NUM) | 1203 | if (WARN(txq_id != IWL_CMD_QUEUE_NUM, |
1196 | IWL_ERROR("Error wrong command queue %d command id 0x%X\n", | 1204 | "wrong command queue %d, command id 0x%X\n", txq_id, pkt->hdr.cmd)) |
1197 | txq_id, pkt->hdr.cmd); | 1205 | return; |
1198 | BUG_ON(txq_id != IWL_CMD_QUEUE_NUM); | ||
1199 | 1206 | ||
1200 | cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); | 1207 | cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); |
1201 | cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; | 1208 | cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b775d5bab668..d15a2c997954 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1160,7 +1160,7 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv) | |||
1160 | /* If we have set the ASSOC_MSK and we are in BSS mode then | 1160 | /* If we have set the ASSOC_MSK and we are in BSS mode then |
1161 | * add the IWL_AP_ID to the station rate table */ | 1161 | * add the IWL_AP_ID to the station rate table */ |
1162 | if (iwl3945_is_associated(priv) && | 1162 | if (iwl3945_is_associated(priv) && |
1163 | (priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 1163 | (priv->iw_mode == NL80211_IFTYPE_STATION)) |
1164 | if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) | 1164 | if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) |
1165 | == IWL_INVALID_STATION) { | 1165 | == IWL_INVALID_STATION) { |
1166 | IWL_ERROR("Error adding AP address for transmit.\n"); | 1166 | IWL_ERROR("Error adding AP address for transmit.\n"); |
@@ -1447,8 +1447,8 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, | |||
1447 | { | 1447 | { |
1448 | 1448 | ||
1449 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || | 1449 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || |
1450 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && | 1450 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && |
1451 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) | 1451 | (priv->iw_mode != NL80211_IFTYPE_AP))) |
1452 | return 0; | 1452 | return 0; |
1453 | 1453 | ||
1454 | if (priv->ibss_beacon->len > left) | 1454 | if (priv->ibss_beacon->len > left) |
@@ -1746,14 +1746,14 @@ static void iwl3945_reset_qos(struct iwl3945_priv *priv) | |||
1746 | spin_lock_irqsave(&priv->lock, flags); | 1746 | spin_lock_irqsave(&priv->lock, flags); |
1747 | priv->qos_data.qos_active = 0; | 1747 | priv->qos_data.qos_active = 0; |
1748 | 1748 | ||
1749 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { | 1749 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { |
1750 | if (priv->qos_data.qos_enable) | 1750 | if (priv->qos_data.qos_enable) |
1751 | priv->qos_data.qos_active = 1; | 1751 | priv->qos_data.qos_active = 1; |
1752 | if (!(priv->active_rate & 0xfff0)) { | 1752 | if (!(priv->active_rate & 0xfff0)) { |
1753 | cw_min = 31; | 1753 | cw_min = 31; |
1754 | is_legacy = 1; | 1754 | is_legacy = 1; |
1755 | } | 1755 | } |
1756 | } else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 1756 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { |
1757 | if (priv->qos_data.qos_enable) | 1757 | if (priv->qos_data.qos_enable) |
1758 | priv->qos_data.qos_active = 1; | 1758 | priv->qos_data.qos_active = 1; |
1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | 1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { |
@@ -2120,7 +2120,7 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) | |||
2120 | beacon_int = priv->beacon_int; | 2120 | beacon_int = priv->beacon_int; |
2121 | spin_unlock_irqrestore(&priv->lock, flags); | 2121 | spin_unlock_irqrestore(&priv->lock, flags); |
2122 | 2122 | ||
2123 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 2123 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
2124 | if (beacon_int == 0) { | 2124 | if (beacon_int == 0) { |
2125 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | 2125 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); |
2126 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | 2126 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); |
@@ -2156,7 +2156,7 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) | |||
2156 | 2156 | ||
2157 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) | 2157 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) |
2158 | { | 2158 | { |
2159 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2159 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2160 | IWL_ERROR("APs don't scan.\n"); | 2160 | IWL_ERROR("APs don't scan.\n"); |
2161 | return 0; | 2161 | return 0; |
2162 | } | 2162 | } |
@@ -2218,7 +2218,7 @@ static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, | |||
2218 | else | 2218 | else |
2219 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2219 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2220 | 2220 | ||
2221 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2221 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2222 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2222 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2223 | 2223 | ||
2224 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 2224 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -2237,23 +2237,23 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2237 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 2237 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
2238 | 2238 | ||
2239 | switch (priv->iw_mode) { | 2239 | switch (priv->iw_mode) { |
2240 | case IEEE80211_IF_TYPE_AP: | 2240 | case NL80211_IFTYPE_AP: |
2241 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 2241 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
2242 | break; | 2242 | break; |
2243 | 2243 | ||
2244 | case IEEE80211_IF_TYPE_STA: | 2244 | case NL80211_IFTYPE_STATION: |
2245 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; | 2245 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; |
2246 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 2246 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
2247 | break; | 2247 | break; |
2248 | 2248 | ||
2249 | case IEEE80211_IF_TYPE_IBSS: | 2249 | case NL80211_IFTYPE_ADHOC: |
2250 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; | 2250 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; |
2251 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 2251 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
2252 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | | 2252 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | |
2253 | RXON_FILTER_ACCEPT_GRP_MSK; | 2253 | RXON_FILTER_ACCEPT_GRP_MSK; |
2254 | break; | 2254 | break; |
2255 | 2255 | ||
2256 | case IEEE80211_IF_TYPE_MNTR: | 2256 | case NL80211_IFTYPE_MONITOR: |
2257 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; | 2257 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; |
2258 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | | 2258 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | |
2259 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 2259 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
@@ -2282,7 +2282,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2282 | * in some case A channels are all non IBSS | 2282 | * in some case A channels are all non IBSS |
2283 | * in this case force B/G channel | 2283 | * in this case force B/G channel |
2284 | */ | 2284 | */ |
2285 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2285 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2286 | !(is_channel_ibss(ch_info))) | 2286 | !(is_channel_ibss(ch_info))) |
2287 | ch_info = &priv->channel_info[0]; | 2287 | ch_info = &priv->channel_info[0]; |
2288 | 2288 | ||
@@ -2302,7 +2302,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2302 | 2302 | ||
2303 | static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) | 2303 | static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) |
2304 | { | 2304 | { |
2305 | if (mode == IEEE80211_IF_TYPE_IBSS) { | 2305 | if (mode == NL80211_IFTYPE_ADHOC) { |
2306 | const struct iwl3945_channel_info *ch_info; | 2306 | const struct iwl3945_channel_info *ch_info; |
2307 | 2307 | ||
2308 | ch_info = iwl3945_get_channel_info(priv, | 2308 | ch_info = iwl3945_get_channel_info(priv, |
@@ -2469,11 +2469,11 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2469 | 2469 | ||
2470 | /* If we are a client station in a BSS network, use the special | 2470 | /* If we are a client station in a BSS network, use the special |
2471 | * AP station entry (that's the only station we communicate with) */ | 2471 | * AP station entry (that's the only station we communicate with) */ |
2472 | case IEEE80211_IF_TYPE_STA: | 2472 | case NL80211_IFTYPE_STATION: |
2473 | return IWL_AP_ID; | 2473 | return IWL_AP_ID; |
2474 | 2474 | ||
2475 | /* If we are an AP, then find the station, or use BCAST */ | 2475 | /* If we are an AP, then find the station, or use BCAST */ |
2476 | case IEEE80211_IF_TYPE_AP: | 2476 | case NL80211_IFTYPE_AP: |
2477 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 2477 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
2478 | if (sta_id != IWL_INVALID_STATION) | 2478 | if (sta_id != IWL_INVALID_STATION) |
2479 | return sta_id; | 2479 | return sta_id; |
@@ -2481,7 +2481,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2481 | 2481 | ||
2482 | /* If this frame is going out to an IBSS network, find the station, | 2482 | /* If this frame is going out to an IBSS network, find the station, |
2483 | * or create a new station table entry */ | 2483 | * or create a new station table entry */ |
2484 | case IEEE80211_IF_TYPE_IBSS: { | 2484 | case NL80211_IFTYPE_ADHOC: { |
2485 | DECLARE_MAC_BUF(mac); | 2485 | DECLARE_MAC_BUF(mac); |
2486 | 2486 | ||
2487 | /* Create new station table entry */ | 2487 | /* Create new station table entry */ |
@@ -2502,7 +2502,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2502 | } | 2502 | } |
2503 | /* If we are in monitor mode, use BCAST. This is required for | 2503 | /* If we are in monitor mode, use BCAST. This is required for |
2504 | * packet injection. */ | 2504 | * packet injection. */ |
2505 | case IEEE80211_IF_TYPE_MNTR: | 2505 | case NL80211_IFTYPE_MONITOR: |
2506 | return priv->hw_setting.bcast_sta_id; | 2506 | return priv->hw_setting.bcast_sta_id; |
2507 | 2507 | ||
2508 | default: | 2508 | default: |
@@ -2565,16 +2565,16 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2565 | 2565 | ||
2566 | /* drop all data frame if we are not associated */ | 2566 | /* drop all data frame if we are not associated */ |
2567 | if (ieee80211_is_data(fc) && | 2567 | if (ieee80211_is_data(fc) && |
2568 | (priv->iw_mode != IEEE80211_IF_TYPE_MNTR) && /* packet injection */ | 2568 | (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */ |
2569 | (!iwl3945_is_associated(priv) || | 2569 | (!iwl3945_is_associated(priv) || |
2570 | ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id))) { | 2570 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { |
2571 | IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); | 2571 | IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); |
2572 | goto drop_unlock; | 2572 | goto drop_unlock; |
2573 | } | 2573 | } |
2574 | 2574 | ||
2575 | spin_unlock_irqrestore(&priv->lock, flags); | 2575 | spin_unlock_irqrestore(&priv->lock, flags); |
2576 | 2576 | ||
2577 | hdr_len = ieee80211_get_hdrlen(le16_to_cpu(fc)); | 2577 | hdr_len = ieee80211_hdrlen(fc); |
2578 | 2578 | ||
2579 | /* Find (or create) index into station table for destination station */ | 2579 | /* Find (or create) index into station table for destination station */ |
2580 | sta_id = iwl3945_get_sta_id(priv, hdr); | 2580 | sta_id = iwl3945_get_sta_id(priv, hdr); |
@@ -2590,7 +2590,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2590 | 2590 | ||
2591 | if (ieee80211_is_data_qos(fc)) { | 2591 | if (ieee80211_is_data_qos(fc)) { |
2592 | qc = ieee80211_get_qos_ctl(hdr); | 2592 | qc = ieee80211_get_qos_ctl(hdr); |
2593 | tid = qc[0] & 0xf; | 2593 | tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
2594 | seq_number = priv->stations[sta_id].tid[tid].seq_number & | 2594 | seq_number = priv->stations[sta_id].tid[tid].seq_number & |
2595 | IEEE80211_SCTL_SEQ; | 2595 | IEEE80211_SCTL_SEQ; |
2596 | hdr->seq_ctrl = cpu_to_le16(seq_number) | | 2596 | hdr->seq_ctrl = cpu_to_le16(seq_number) | |
@@ -2709,7 +2709,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2709 | sizeof(out_cmd->cmd.tx)); | 2709 | sizeof(out_cmd->cmd.tx)); |
2710 | 2710 | ||
2711 | iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, | 2711 | iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, |
2712 | ieee80211_get_hdrlen(le16_to_cpu(fc))); | 2712 | ieee80211_hdrlen(fc)); |
2713 | 2713 | ||
2714 | /* Tell device the write index *just past* this latest filled TFD */ | 2714 | /* Tell device the write index *just past* this latest filled TFD */ |
2715 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 2715 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); |
@@ -2806,7 +2806,7 @@ static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio) | |||
2806 | if (disable_radio) { | 2806 | if (disable_radio) { |
2807 | iwl3945_scan_cancel(priv); | 2807 | iwl3945_scan_cancel(priv); |
2808 | /* FIXME: This is a workaround for AP */ | 2808 | /* FIXME: This is a workaround for AP */ |
2809 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 2809 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
2810 | spin_lock_irqsave(&priv->lock, flags); | 2810 | spin_lock_irqsave(&priv->lock, flags); |
2811 | iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, | 2811 | iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, |
2812 | CSR_UCODE_SW_BIT_RFKILL); | 2812 | CSR_UCODE_SW_BIT_RFKILL); |
@@ -3161,7 +3161,7 @@ static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv, | |||
3161 | le32_to_cpu(beacon->low_tsf), rate); | 3161 | le32_to_cpu(beacon->low_tsf), rate); |
3162 | #endif | 3162 | #endif |
3163 | 3163 | ||
3164 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 3164 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
3165 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) | 3165 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) |
3166 | queue_work(priv->workqueue, &priv->beacon_update); | 3166 | queue_work(priv->workqueue, &priv->beacon_update); |
3167 | } | 3167 | } |
@@ -4782,8 +4782,11 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4782 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after | 4782 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after |
4783 | * sending probe req. This should be set long enough to hear probe responses | 4783 | * sending probe req. This should be set long enough to hear probe responses |
4784 | * from more than one AP. */ | 4784 | * from more than one AP. */ |
4785 | #define IWL_ACTIVE_DWELL_TIME_24 (20) /* all times in msec */ | 4785 | #define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ |
4786 | #define IWL_ACTIVE_DWELL_TIME_52 (10) | 4786 | #define IWL_ACTIVE_DWELL_TIME_52 (20) |
4787 | |||
4788 | #define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3) | ||
4789 | #define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2) | ||
4787 | 4790 | ||
4788 | /* For faster active scanning, scan will move to the next channel if fewer than | 4791 | /* For faster active scanning, scan will move to the next channel if fewer than |
4789 | * PLCP_QUIET_THRESH packets are heard on this channel within | 4792 | * PLCP_QUIET_THRESH packets are heard on this channel within |
@@ -4792,7 +4795,7 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4792 | * no other traffic). | 4795 | * no other traffic). |
4793 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ | 4796 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ |
4794 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ | 4797 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ |
4795 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(5) /* msec */ | 4798 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(10) /* msec */ |
4796 | 4799 | ||
4797 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. | 4800 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. |
4798 | * Must be set longer than active dwell time. | 4801 | * Must be set longer than active dwell time. |
@@ -4802,19 +4805,23 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4802 | #define IWL_PASSIVE_DWELL_BASE (100) | 4805 | #define IWL_PASSIVE_DWELL_BASE (100) |
4803 | #define IWL_CHANNEL_TUNE_TIME 5 | 4806 | #define IWL_CHANNEL_TUNE_TIME 5 |
4804 | 4807 | ||
4808 | #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) | ||
4809 | |||
4805 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, | 4810 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, |
4806 | enum ieee80211_band band) | 4811 | enum ieee80211_band band, |
4812 | u8 n_probes) | ||
4807 | { | 4813 | { |
4808 | if (band == IEEE80211_BAND_5GHZ) | 4814 | if (band == IEEE80211_BAND_5GHZ) |
4809 | return IWL_ACTIVE_DWELL_TIME_52; | 4815 | return IWL_ACTIVE_DWELL_TIME_52 + |
4816 | IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); | ||
4810 | else | 4817 | else |
4811 | return IWL_ACTIVE_DWELL_TIME_24; | 4818 | return IWL_ACTIVE_DWELL_TIME_24 + |
4819 | IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); | ||
4812 | } | 4820 | } |
4813 | 4821 | ||
4814 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, | 4822 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, |
4815 | enum ieee80211_band band) | 4823 | enum ieee80211_band band) |
4816 | { | 4824 | { |
4817 | u16 active = iwl3945_get_active_dwell_time(priv, band); | ||
4818 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? | 4825 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
4819 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 4826 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
4820 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | 4827 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; |
@@ -4829,15 +4836,12 @@ static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, | |||
4829 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | 4836 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; |
4830 | } | 4837 | } |
4831 | 4838 | ||
4832 | if (passive <= active) | ||
4833 | passive = active + 1; | ||
4834 | |||
4835 | return passive; | 4839 | return passive; |
4836 | } | 4840 | } |
4837 | 4841 | ||
4838 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | 4842 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, |
4839 | enum ieee80211_band band, | 4843 | enum ieee80211_band band, |
4840 | u8 is_active, u8 direct_mask, | 4844 | u8 is_active, u8 n_probes, |
4841 | struct iwl3945_scan_channel *scan_ch) | 4845 | struct iwl3945_scan_channel *scan_ch) |
4842 | { | 4846 | { |
4843 | const struct ieee80211_channel *channels = NULL; | 4847 | const struct ieee80211_channel *channels = NULL; |
@@ -4853,9 +4857,12 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4853 | 4857 | ||
4854 | channels = sband->channels; | 4858 | channels = sband->channels; |
4855 | 4859 | ||
4856 | active_dwell = iwl3945_get_active_dwell_time(priv, band); | 4860 | active_dwell = iwl3945_get_active_dwell_time(priv, band, n_probes); |
4857 | passive_dwell = iwl3945_get_passive_dwell_time(priv, band); | 4861 | passive_dwell = iwl3945_get_passive_dwell_time(priv, band); |
4858 | 4862 | ||
4863 | if (passive_dwell <= active_dwell) | ||
4864 | passive_dwell = active_dwell + 1; | ||
4865 | |||
4859 | for (i = 0, added = 0; i < sband->n_channels; i++) { | 4866 | for (i = 0, added = 0; i < sband->n_channels; i++) { |
4860 | if (channels[i].flags & IEEE80211_CHAN_DISABLED) | 4867 | if (channels[i].flags & IEEE80211_CHAN_DISABLED) |
4861 | continue; | 4868 | continue; |
@@ -4875,8 +4882,8 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4875 | else | 4882 | else |
4876 | scan_ch->type = 1; /* active */ | 4883 | scan_ch->type = 1; /* active */ |
4877 | 4884 | ||
4878 | if (scan_ch->type & 1) | 4885 | if ((scan_ch->type & 1) && n_probes) |
4879 | scan_ch->type |= (direct_mask << 1); | 4886 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); |
4880 | 4887 | ||
4881 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 4888 | scan_ch->active_dwell = cpu_to_le16(active_dwell); |
4882 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | 4889 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); |
@@ -6052,7 +6059,7 @@ static void iwl3945_bg_set_monitor(struct work_struct *work) | |||
6052 | if (!iwl3945_is_ready(priv)) | 6059 | if (!iwl3945_is_ready(priv)) |
6053 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); | 6060 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); |
6054 | else | 6061 | else |
6055 | if (iwl3945_set_mode(priv, IEEE80211_IF_TYPE_MNTR) != 0) | 6062 | if (iwl3945_set_mode(priv, NL80211_IFTYPE_MONITOR) != 0) |
6056 | IWL_ERROR("iwl3945_set_mode() failed\n"); | 6063 | IWL_ERROR("iwl3945_set_mode() failed\n"); |
6057 | 6064 | ||
6058 | mutex_unlock(&priv->mutex); | 6065 | mutex_unlock(&priv->mutex); |
@@ -6093,7 +6100,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6093 | int rc = 0; | 6100 | int rc = 0; |
6094 | struct iwl3945_scan_cmd *scan; | 6101 | struct iwl3945_scan_cmd *scan; |
6095 | struct ieee80211_conf *conf = NULL; | 6102 | struct ieee80211_conf *conf = NULL; |
6096 | u8 direct_mask; | 6103 | u8 n_probes = 2; |
6097 | enum ieee80211_band band; | 6104 | enum ieee80211_band band; |
6098 | 6105 | ||
6099 | conf = ieee80211_get_hw_conf(priv->hw); | 6106 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -6201,7 +6208,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6201 | scan->direct_scan[0].len = priv->direct_ssid_len; | 6208 | scan->direct_scan[0].len = priv->direct_ssid_len; |
6202 | memcpy(scan->direct_scan[0].ssid, | 6209 | memcpy(scan->direct_scan[0].ssid, |
6203 | priv->direct_ssid, priv->direct_ssid_len); | 6210 | priv->direct_ssid, priv->direct_ssid_len); |
6204 | direct_mask = 1; | 6211 | n_probes++; |
6205 | } else if (!iwl3945_is_associated(priv) && priv->essid_len) { | 6212 | } else if (!iwl3945_is_associated(priv) && priv->essid_len) { |
6206 | IWL_DEBUG_SCAN | 6213 | IWL_DEBUG_SCAN |
6207 | ("Kicking off one direct scan for '%s' when not associated\n", | 6214 | ("Kicking off one direct scan for '%s' when not associated\n", |
@@ -6209,11 +6216,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6209 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6216 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6210 | scan->direct_scan[0].len = priv->essid_len; | 6217 | scan->direct_scan[0].len = priv->essid_len; |
6211 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6218 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
6212 | direct_mask = 1; | 6219 | n_probes++; |
6213 | } else { | 6220 | } else |
6214 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); | 6221 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); |
6215 | direct_mask = 0; | ||
6216 | } | ||
6217 | 6222 | ||
6218 | /* We don't build a direct scan probe request; the uCode will do | 6223 | /* We don't build a direct scan probe request; the uCode will do |
6219 | * that based on the direct_mask added to each channel entry */ | 6224 | * that based on the direct_mask added to each channel entry */ |
@@ -6243,21 +6248,13 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6243 | /* select Rx antennas */ | 6248 | /* select Rx antennas */ |
6244 | scan->flags |= iwl3945_get_antenna_flags(priv); | 6249 | scan->flags |= iwl3945_get_antenna_flags(priv); |
6245 | 6250 | ||
6246 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | 6251 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) |
6247 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 6252 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
6248 | 6253 | ||
6249 | if (direct_mask) | 6254 | scan->channel_count = |
6250 | scan->channel_count = | 6255 | iwl3945_get_channels_for_scan(priv, band, 1, /* active */ |
6251 | iwl3945_get_channels_for_scan( | 6256 | n_probes, |
6252 | priv, band, 1, /* active */ | 6257 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
6253 | direct_mask, | ||
6254 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
6255 | else | ||
6256 | scan->channel_count = | ||
6257 | iwl3945_get_channels_for_scan( | ||
6258 | priv, band, 0, /* passive */ | ||
6259 | direct_mask, | ||
6260 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
6261 | 6258 | ||
6262 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + | 6259 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + |
6263 | scan->channel_count * sizeof(struct iwl3945_scan_channel); | 6260 | scan->channel_count * sizeof(struct iwl3945_scan_channel); |
@@ -6320,16 +6317,13 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data) | |||
6320 | 6317 | ||
6321 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 6318 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
6322 | 6319 | ||
6323 | static void iwl3945_bg_post_associate(struct work_struct *data) | 6320 | static void iwl3945_post_associate(struct iwl3945_priv *priv) |
6324 | { | 6321 | { |
6325 | struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, | ||
6326 | post_associate.work); | ||
6327 | |||
6328 | int rc = 0; | 6322 | int rc = 0; |
6329 | struct ieee80211_conf *conf = NULL; | 6323 | struct ieee80211_conf *conf = NULL; |
6330 | DECLARE_MAC_BUF(mac); | 6324 | DECLARE_MAC_BUF(mac); |
6331 | 6325 | ||
6332 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6326 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
6333 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); | 6327 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); |
6334 | return; | 6328 | return; |
6335 | } | 6329 | } |
@@ -6342,12 +6336,9 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6342 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6336 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6343 | return; | 6337 | return; |
6344 | 6338 | ||
6345 | mutex_lock(&priv->mutex); | 6339 | if (!priv->vif || !priv->is_open) |
6346 | |||
6347 | if (!priv->vif || !priv->is_open) { | ||
6348 | mutex_unlock(&priv->mutex); | ||
6349 | return; | 6340 | return; |
6350 | } | 6341 | |
6351 | iwl3945_scan_cancel_timeout(priv, 200); | 6342 | iwl3945_scan_cancel_timeout(priv, 200); |
6352 | 6343 | ||
6353 | conf = ieee80211_get_hw_conf(priv->hw); | 6344 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -6381,7 +6372,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6381 | else | 6372 | else |
6382 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 6373 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
6383 | 6374 | ||
6384 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 6375 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
6385 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 6376 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
6386 | 6377 | ||
6387 | } | 6378 | } |
@@ -6389,11 +6380,11 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6389 | iwl3945_commit_rxon(priv); | 6380 | iwl3945_commit_rxon(priv); |
6390 | 6381 | ||
6391 | switch (priv->iw_mode) { | 6382 | switch (priv->iw_mode) { |
6392 | case IEEE80211_IF_TYPE_STA: | 6383 | case NL80211_IFTYPE_STATION: |
6393 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); | 6384 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); |
6394 | break; | 6385 | break; |
6395 | 6386 | ||
6396 | case IEEE80211_IF_TYPE_IBSS: | 6387 | case NL80211_IFTYPE_ADHOC: |
6397 | 6388 | ||
6398 | /* clear out the station table */ | 6389 | /* clear out the station table */ |
6399 | iwl3945_clear_stations_table(priv); | 6390 | iwl3945_clear_stations_table(priv); |
@@ -6419,7 +6410,6 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6419 | 6410 | ||
6420 | /* we have just associated, don't start scan too early */ | 6411 | /* we have just associated, don't start scan too early */ |
6421 | priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; | 6412 | priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; |
6422 | mutex_unlock(&priv->mutex); | ||
6423 | } | 6413 | } |
6424 | 6414 | ||
6425 | static void iwl3945_bg_abort_scan(struct work_struct *work) | 6415 | static void iwl3945_bg_abort_scan(struct work_struct *work) |
@@ -6567,7 +6557,6 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) | |||
6567 | */ | 6557 | */ |
6568 | mutex_lock(&priv->mutex); | 6558 | mutex_lock(&priv->mutex); |
6569 | iwl3945_scan_cancel_timeout(priv, 100); | 6559 | iwl3945_scan_cancel_timeout(priv, 100); |
6570 | cancel_delayed_work(&priv->post_associate); | ||
6571 | mutex_unlock(&priv->mutex); | 6560 | mutex_unlock(&priv->mutex); |
6572 | } | 6561 | } |
6573 | 6562 | ||
@@ -6650,8 +6639,6 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
6650 | mutex_lock(&priv->mutex); | 6639 | mutex_lock(&priv->mutex); |
6651 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); | 6640 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); |
6652 | 6641 | ||
6653 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); | ||
6654 | |||
6655 | if (!iwl3945_is_ready(priv)) { | 6642 | if (!iwl3945_is_ready(priv)) { |
6656 | IWL_DEBUG_MAC80211("leave - not ready\n"); | 6643 | IWL_DEBUG_MAC80211("leave - not ready\n"); |
6657 | ret = -EIO; | 6644 | ret = -EIO; |
@@ -6767,7 +6754,7 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) | |||
6767 | priv->staging_rxon.flags &= | 6754 | priv->staging_rxon.flags &= |
6768 | ~RXON_FLG_SHORT_SLOT_MSK; | 6755 | ~RXON_FLG_SHORT_SLOT_MSK; |
6769 | 6756 | ||
6770 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 6757 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
6771 | priv->staging_rxon.flags &= | 6758 | priv->staging_rxon.flags &= |
6772 | ~RXON_FLG_SHORT_SLOT_MSK; | 6759 | ~RXON_FLG_SHORT_SLOT_MSK; |
6773 | } | 6760 | } |
@@ -6804,7 +6791,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6804 | } | 6791 | } |
6805 | 6792 | ||
6806 | /* handle this temporarily here */ | 6793 | /* handle this temporarily here */ |
6807 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 6794 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
6808 | conf->changed & IEEE80211_IFCC_BEACON) { | 6795 | conf->changed & IEEE80211_IFCC_BEACON) { |
6809 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 6796 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
6810 | if (!beacon) | 6797 | if (!beacon) |
@@ -6816,7 +6803,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6816 | 6803 | ||
6817 | /* XXX: this MUST use conf->mac_addr */ | 6804 | /* XXX: this MUST use conf->mac_addr */ |
6818 | 6805 | ||
6819 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 6806 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
6820 | (!conf->ssid_len)) { | 6807 | (!conf->ssid_len)) { |
6821 | IWL_DEBUG_MAC80211 | 6808 | IWL_DEBUG_MAC80211 |
6822 | ("Leaving in AP mode because HostAPD is not ready.\n"); | 6809 | ("Leaving in AP mode because HostAPD is not ready.\n"); |
@@ -6839,7 +6826,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6839 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | 6826 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { |
6840 | */ | 6827 | */ |
6841 | 6828 | ||
6842 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6829 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
6843 | if (!conf->bssid) { | 6830 | if (!conf->bssid) { |
6844 | conf->bssid = priv->mac_addr; | 6831 | conf->bssid = priv->mac_addr; |
6845 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 6832 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
@@ -6874,11 +6861,11 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6874 | * to verify) - jpk */ | 6861 | * to verify) - jpk */ |
6875 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 6862 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
6876 | 6863 | ||
6877 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 6864 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
6878 | iwl3945_config_ap(priv); | 6865 | iwl3945_config_ap(priv); |
6879 | else { | 6866 | else { |
6880 | rc = iwl3945_commit_rxon(priv); | 6867 | rc = iwl3945_commit_rxon(priv); |
6881 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 6868 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) |
6882 | iwl3945_add_station(priv, | 6869 | iwl3945_add_station(priv, |
6883 | priv->active_rxon.bssid_addr, 1, 0); | 6870 | priv->active_rxon.bssid_addr, 1, 0); |
6884 | } | 6871 | } |
@@ -6914,7 +6901,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, | |||
6914 | 6901 | ||
6915 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 6902 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { |
6916 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 6903 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", |
6917 | IEEE80211_IF_TYPE_MNTR, | 6904 | NL80211_IFTYPE_MONITOR, |
6918 | changed_flags, *total_flags); | 6905 | changed_flags, *total_flags); |
6919 | /* queue work 'cuz mac80211 is holding a lock which | 6906 | /* queue work 'cuz mac80211 is holding a lock which |
6920 | * prevents us from issuing (synchronous) f/w cmds */ | 6907 | * prevents us from issuing (synchronous) f/w cmds */ |
@@ -6935,7 +6922,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | |||
6935 | 6922 | ||
6936 | if (iwl3945_is_ready_rf(priv)) { | 6923 | if (iwl3945_is_ready_rf(priv)) { |
6937 | iwl3945_scan_cancel_timeout(priv, 100); | 6924 | iwl3945_scan_cancel_timeout(priv, 100); |
6938 | cancel_delayed_work(&priv->post_associate); | ||
6939 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 6925 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
6940 | iwl3945_commit_rxon(priv); | 6926 | iwl3945_commit_rxon(priv); |
6941 | } | 6927 | } |
@@ -6950,6 +6936,63 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | |||
6950 | IWL_DEBUG_MAC80211("leave\n"); | 6936 | IWL_DEBUG_MAC80211("leave\n"); |
6951 | } | 6937 | } |
6952 | 6938 | ||
6939 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||
6940 | |||
6941 | static void iwl3945_bss_info_changed(struct ieee80211_hw *hw, | ||
6942 | struct ieee80211_vif *vif, | ||
6943 | struct ieee80211_bss_conf *bss_conf, | ||
6944 | u32 changes) | ||
6945 | { | ||
6946 | struct iwl3945_priv *priv = hw->priv; | ||
6947 | |||
6948 | IWL_DEBUG_MAC80211("changes = 0x%X\n", changes); | ||
6949 | |||
6950 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | ||
6951 | IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n", | ||
6952 | bss_conf->use_short_preamble); | ||
6953 | if (bss_conf->use_short_preamble) | ||
6954 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | ||
6955 | else | ||
6956 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | ||
6957 | } | ||
6958 | |||
6959 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | ||
6960 | IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot); | ||
6961 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) | ||
6962 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | ||
6963 | else | ||
6964 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | ||
6965 | } | ||
6966 | |||
6967 | if (changes & BSS_CHANGED_ASSOC) { | ||
6968 | IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc); | ||
6969 | /* This should never happen as this function should | ||
6970 | * never be called from interrupt context. */ | ||
6971 | if (WARN_ON_ONCE(in_interrupt())) | ||
6972 | return; | ||
6973 | if (bss_conf->assoc) { | ||
6974 | priv->assoc_id = bss_conf->aid; | ||
6975 | priv->beacon_int = bss_conf->beacon_int; | ||
6976 | priv->timestamp0 = bss_conf->timestamp & 0xFFFFFFFF; | ||
6977 | priv->timestamp1 = (bss_conf->timestamp >> 32) & | ||
6978 | 0xFFFFFFFF; | ||
6979 | priv->assoc_capability = bss_conf->assoc_capability; | ||
6980 | priv->next_scan_jiffies = jiffies + | ||
6981 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | ||
6982 | mutex_lock(&priv->mutex); | ||
6983 | iwl3945_post_associate(priv); | ||
6984 | mutex_unlock(&priv->mutex); | ||
6985 | } else { | ||
6986 | priv->assoc_id = 0; | ||
6987 | IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc); | ||
6988 | } | ||
6989 | } else if (changes && iwl3945_is_associated(priv) && priv->assoc_id) { | ||
6990 | IWL_DEBUG_MAC80211("Associated Changes %d\n", changes); | ||
6991 | iwl3945_send_rxon_assoc(priv); | ||
6992 | } | ||
6993 | |||
6994 | } | ||
6995 | |||
6953 | static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | 6996 | static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) |
6954 | { | 6997 | { |
6955 | int rc = 0; | 6998 | int rc = 0; |
@@ -6967,7 +7010,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
6967 | goto out_unlock; | 7010 | goto out_unlock; |
6968 | } | 7011 | } |
6969 | 7012 | ||
6970 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */ | 7013 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ |
6971 | rc = -EIO; | 7014 | rc = -EIO; |
6972 | IWL_ERROR("ERROR: APs don't scan\n"); | 7015 | IWL_ERROR("ERROR: APs don't scan\n"); |
6973 | goto out_unlock; | 7016 | goto out_unlock; |
@@ -7109,7 +7152,7 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
7109 | spin_unlock_irqrestore(&priv->lock, flags); | 7152 | spin_unlock_irqrestore(&priv->lock, flags); |
7110 | 7153 | ||
7111 | mutex_lock(&priv->mutex); | 7154 | mutex_lock(&priv->mutex); |
7112 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7155 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
7113 | iwl3945_activate_qos(priv, 1); | 7156 | iwl3945_activate_qos(priv, 1); |
7114 | else if (priv->assoc_id && iwl3945_is_associated(priv)) | 7157 | else if (priv->assoc_id && iwl3945_is_associated(priv)) |
7115 | iwl3945_activate_qos(priv, 0); | 7158 | iwl3945_activate_qos(priv, 0); |
@@ -7182,8 +7225,6 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7182 | 7225 | ||
7183 | iwl3945_reset_qos(priv); | 7226 | iwl3945_reset_qos(priv); |
7184 | 7227 | ||
7185 | cancel_delayed_work(&priv->post_associate); | ||
7186 | |||
7187 | spin_lock_irqsave(&priv->lock, flags); | 7228 | spin_lock_irqsave(&priv->lock, flags); |
7188 | priv->assoc_id = 0; | 7229 | priv->assoc_id = 0; |
7189 | priv->assoc_capability = 0; | 7230 | priv->assoc_capability = 0; |
@@ -7198,7 +7239,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7198 | priv->beacon_int = priv->hw->conf.beacon_int; | 7239 | priv->beacon_int = priv->hw->conf.beacon_int; |
7199 | priv->timestamp1 = 0; | 7240 | priv->timestamp1 = 0; |
7200 | priv->timestamp0 = 0; | 7241 | priv->timestamp0 = 0; |
7201 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 7242 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) |
7202 | priv->beacon_int = 0; | 7243 | priv->beacon_int = 0; |
7203 | 7244 | ||
7204 | spin_unlock_irqrestore(&priv->lock, flags); | 7245 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -7212,14 +7253,14 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7212 | /* we are restarting association process | 7253 | /* we are restarting association process |
7213 | * clear RXON_FILTER_ASSOC_MSK bit | 7254 | * clear RXON_FILTER_ASSOC_MSK bit |
7214 | */ | 7255 | */ |
7215 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 7256 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
7216 | iwl3945_scan_cancel_timeout(priv, 100); | 7257 | iwl3945_scan_cancel_timeout(priv, 100); |
7217 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7258 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7218 | iwl3945_commit_rxon(priv); | 7259 | iwl3945_commit_rxon(priv); |
7219 | } | 7260 | } |
7220 | 7261 | ||
7221 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7262 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7222 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7263 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
7223 | 7264 | ||
7224 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7265 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7225 | mutex_unlock(&priv->mutex); | 7266 | mutex_unlock(&priv->mutex); |
@@ -7248,7 +7289,7 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7248 | return -EIO; | 7289 | return -EIO; |
7249 | } | 7290 | } |
7250 | 7291 | ||
7251 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7292 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
7252 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 7293 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
7253 | mutex_unlock(&priv->mutex); | 7294 | mutex_unlock(&priv->mutex); |
7254 | return -EIO; | 7295 | return -EIO; |
@@ -7268,7 +7309,7 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7268 | 7309 | ||
7269 | iwl3945_reset_qos(priv); | 7310 | iwl3945_reset_qos(priv); |
7270 | 7311 | ||
7271 | queue_work(priv->workqueue, &priv->post_associate.work); | 7312 | iwl3945_post_associate(priv); |
7272 | 7313 | ||
7273 | mutex_unlock(&priv->mutex); | 7314 | mutex_unlock(&priv->mutex); |
7274 | 7315 | ||
@@ -7329,15 +7370,6 @@ static ssize_t show_temperature(struct device *d, | |||
7329 | 7370 | ||
7330 | static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); | 7371 | static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); |
7331 | 7372 | ||
7332 | static ssize_t show_rs_window(struct device *d, | ||
7333 | struct device_attribute *attr, | ||
7334 | char *buf) | ||
7335 | { | ||
7336 | struct iwl3945_priv *priv = d->driver_data; | ||
7337 | return iwl3945_fill_rs_info(priv->hw, buf, IWL_AP_ID); | ||
7338 | } | ||
7339 | static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); | ||
7340 | |||
7341 | static ssize_t show_tx_power(struct device *d, | 7373 | static ssize_t show_tx_power(struct device *d, |
7342 | struct device_attribute *attr, char *buf) | 7374 | struct device_attribute *attr, char *buf) |
7343 | { | 7375 | { |
@@ -7767,7 +7799,6 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv) | |||
7767 | INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); | 7799 | INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); |
7768 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); | 7800 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); |
7769 | INIT_WORK(&priv->set_monitor, iwl3945_bg_set_monitor); | 7801 | INIT_WORK(&priv->set_monitor, iwl3945_bg_set_monitor); |
7770 | INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate); | ||
7771 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); | 7802 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); |
7772 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); | 7803 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); |
7773 | INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); | 7804 | INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); |
@@ -7785,7 +7816,6 @@ static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv) | |||
7785 | cancel_delayed_work_sync(&priv->init_alive_start); | 7816 | cancel_delayed_work_sync(&priv->init_alive_start); |
7786 | cancel_delayed_work(&priv->scan_check); | 7817 | cancel_delayed_work(&priv->scan_check); |
7787 | cancel_delayed_work(&priv->alive_start); | 7818 | cancel_delayed_work(&priv->alive_start); |
7788 | cancel_delayed_work(&priv->post_associate); | ||
7789 | cancel_work_sync(&priv->beacon_update); | 7819 | cancel_work_sync(&priv->beacon_update); |
7790 | } | 7820 | } |
7791 | 7821 | ||
@@ -7801,7 +7831,6 @@ static struct attribute *iwl3945_sysfs_entries[] = { | |||
7801 | #endif | 7831 | #endif |
7802 | &dev_attr_power_level.attr, | 7832 | &dev_attr_power_level.attr, |
7803 | &dev_attr_retry_rate.attr, | 7833 | &dev_attr_retry_rate.attr, |
7804 | &dev_attr_rs_window.attr, | ||
7805 | &dev_attr_statistics.attr, | 7834 | &dev_attr_statistics.attr, |
7806 | &dev_attr_status.attr, | 7835 | &dev_attr_status.attr, |
7807 | &dev_attr_temperature.attr, | 7836 | &dev_attr_temperature.attr, |
@@ -7830,6 +7859,7 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
7830 | .conf_tx = iwl3945_mac_conf_tx, | 7859 | .conf_tx = iwl3945_mac_conf_tx, |
7831 | .get_tsf = iwl3945_mac_get_tsf, | 7860 | .get_tsf = iwl3945_mac_get_tsf, |
7832 | .reset_tsf = iwl3945_mac_reset_tsf, | 7861 | .reset_tsf = iwl3945_mac_reset_tsf, |
7862 | .bss_info_changed = iwl3945_bss_info_changed, | ||
7833 | .hw_scan = iwl3945_mac_hw_scan | 7863 | .hw_scan = iwl3945_mac_hw_scan |
7834 | }; | 7864 | }; |
7835 | 7865 | ||
@@ -7868,6 +7898,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7868 | SET_IEEE80211_DEV(hw, &pdev->dev); | 7898 | SET_IEEE80211_DEV(hw, &pdev->dev); |
7869 | 7899 | ||
7870 | hw->rate_control_algorithm = "iwl-3945-rs"; | 7900 | hw->rate_control_algorithm = "iwl-3945-rs"; |
7901 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | ||
7871 | 7902 | ||
7872 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 7903 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
7873 | priv = hw->priv; | 7904 | priv = hw->priv; |
@@ -7890,6 +7921,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7890 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 7921 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
7891 | IEEE80211_HW_NOISE_DBM; | 7922 | IEEE80211_HW_NOISE_DBM; |
7892 | 7923 | ||
7924 | hw->wiphy->interface_modes = | ||
7925 | BIT(NL80211_IFTYPE_AP) | | ||
7926 | BIT(NL80211_IFTYPE_STATION) | | ||
7927 | BIT(NL80211_IFTYPE_ADHOC); | ||
7928 | |||
7893 | /* 4 EDCA QOS priorities */ | 7929 | /* 4 EDCA QOS priorities */ |
7894 | hw->queues = 4; | 7930 | hw->queues = 4; |
7895 | 7931 | ||
@@ -7951,7 +7987,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7951 | IWL_DEBUG_INFO("Radio disabled.\n"); | 7987 | IWL_DEBUG_INFO("Radio disabled.\n"); |
7952 | } | 7988 | } |
7953 | 7989 | ||
7954 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | 7990 | priv->iw_mode = NL80211_IFTYPE_STATION; |
7955 | 7991 | ||
7956 | printk(KERN_INFO DRV_NAME | 7992 | printk(KERN_INFO DRV_NAME |
7957 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); | 7993 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); |
@@ -8331,6 +8367,8 @@ static void __exit iwl3945_exit(void) | |||
8331 | iwl3945_rate_control_unregister(); | 8367 | iwl3945_rate_control_unregister(); |
8332 | } | 8368 | } |
8333 | 8369 | ||
8370 | MODULE_FIRMWARE("iwlwifi-3945" IWL3945_UCODE_API ".ucode"); | ||
8371 | |||
8334 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); | 8372 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); |
8335 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 8373 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
8336 | module_param_named(disable, iwl3945_param_disable, int, 0444); | 8374 | module_param_named(disable, iwl3945_param_disable, int, 0444); |