diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
24 files changed, 1308 insertions, 939 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index fb59af2d41c6..6be2992f8f21 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -212,7 +212,7 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
212 | .temperature = iwlagn_temperature, | 212 | .temperature = iwlagn_temperature, |
213 | .set_ct_kill = iwl1000_set_ct_threshold, | 213 | .set_ct_kill = iwl1000_set_ct_threshold, |
214 | }, | 214 | }, |
215 | .add_bcast_station = iwl_add_bcast_station, | 215 | .manage_ibss_station = iwlagn_manage_ibss_station, |
216 | .debugfs_ops = { | 216 | .debugfs_ops = { |
217 | .rx_stats_read = iwl_ucode_rx_stats_read, | 217 | .rx_stats_read = iwl_ucode_rx_stats_read, |
218 | .tx_stats_read = iwl_ucode_tx_stats_read, | 218 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -224,7 +224,6 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | static const struct iwl_ops iwl1000_ops = { | 226 | static const struct iwl_ops iwl1000_ops = { |
227 | .ucode = &iwlagn_ucode, | ||
228 | .lib = &iwl1000_lib, | 227 | .lib = &iwl1000_lib, |
229 | .hcmd = &iwlagn_hcmd, | 228 | .hcmd = &iwlagn_hcmd, |
230 | .utils = &iwlagn_hcmd_utils, | 229 | .utils = &iwlagn_hcmd_utils, |
@@ -260,6 +259,9 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
260 | .chain_noise_scale = 1000, | 259 | .chain_noise_scale = 1000, |
261 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 260 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
262 | .max_event_log_size = 128, | 261 | .max_event_log_size = 128, |
262 | .ucode_tracing = true, | ||
263 | .sensitivity_calib_by_driver = true, | ||
264 | .chain_noise_calib_by_driver = true, | ||
263 | }; | 265 | }; |
264 | 266 | ||
265 | struct iwl_cfg iwl1000_bg_cfg = { | 267 | struct iwl_cfg iwl1000_bg_cfg = { |
@@ -289,6 +291,9 @@ struct iwl_cfg iwl1000_bg_cfg = { | |||
289 | .chain_noise_scale = 1000, | 291 | .chain_noise_scale = 1000, |
290 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 292 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
291 | .max_event_log_size = 128, | 293 | .max_event_log_size = 128, |
294 | .ucode_tracing = true, | ||
295 | .sensitivity_calib_by_driver = true, | ||
296 | .chain_noise_calib_by_driver = true, | ||
292 | }; | 297 | }; |
293 | 298 | ||
294 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 299 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 99b876a2feb9..068f7f8435c5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -391,6 +391,67 @@ static void iwl3945_accumulative_statistics(struct iwl_priv *priv, | |||
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | 393 | ||
394 | /** | ||
395 | * iwl3945_good_plcp_health - checks for plcp error. | ||
396 | * | ||
397 | * When the plcp error is exceeding the thresholds, reset the radio | ||
398 | * to improve the throughput. | ||
399 | */ | ||
400 | static bool iwl3945_good_plcp_health(struct iwl_priv *priv, | ||
401 | struct iwl_rx_packet *pkt) | ||
402 | { | ||
403 | bool rc = true; | ||
404 | struct iwl3945_notif_statistics current_stat; | ||
405 | int combined_plcp_delta; | ||
406 | unsigned int plcp_msec; | ||
407 | unsigned long plcp_received_jiffies; | ||
408 | |||
409 | memcpy(¤t_stat, pkt->u.raw, sizeof(struct | ||
410 | iwl3945_notif_statistics)); | ||
411 | /* | ||
412 | * check for plcp_err and trigger radio reset if it exceeds | ||
413 | * the plcp error threshold plcp_delta. | ||
414 | */ | ||
415 | plcp_received_jiffies = jiffies; | ||
416 | plcp_msec = jiffies_to_msecs((long) plcp_received_jiffies - | ||
417 | (long) priv->plcp_jiffies); | ||
418 | priv->plcp_jiffies = plcp_received_jiffies; | ||
419 | /* | ||
420 | * check to make sure plcp_msec is not 0 to prevent division | ||
421 | * by zero. | ||
422 | */ | ||
423 | if (plcp_msec) { | ||
424 | combined_plcp_delta = | ||
425 | (le32_to_cpu(current_stat.rx.ofdm.plcp_err) - | ||
426 | le32_to_cpu(priv->_3945.statistics.rx.ofdm.plcp_err)); | ||
427 | |||
428 | if ((combined_plcp_delta > 0) && | ||
429 | ((combined_plcp_delta * 100) / plcp_msec) > | ||
430 | priv->cfg->plcp_delta_threshold) { | ||
431 | /* | ||
432 | * if plcp_err exceed the threshold, the following | ||
433 | * data is printed in csv format: | ||
434 | * Text: plcp_err exceeded %d, | ||
435 | * Received ofdm.plcp_err, | ||
436 | * Current ofdm.plcp_err, | ||
437 | * combined_plcp_delta, | ||
438 | * plcp_msec | ||
439 | */ | ||
440 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | ||
441 | "%u, %d, %u mSecs\n", | ||
442 | priv->cfg->plcp_delta_threshold, | ||
443 | le32_to_cpu(current_stat.rx.ofdm.plcp_err), | ||
444 | combined_plcp_delta, plcp_msec); | ||
445 | /* | ||
446 | * Reset the RF radio due to the high plcp | ||
447 | * error rate | ||
448 | */ | ||
449 | rc = false; | ||
450 | } | ||
451 | } | ||
452 | return rc; | ||
453 | } | ||
454 | |||
394 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | 455 | void iwl3945_hw_rx_statistics(struct iwl_priv *priv, |
395 | struct iwl_rx_mem_buffer *rxb) | 456 | struct iwl_rx_mem_buffer *rxb) |
396 | { | 457 | { |
@@ -402,6 +463,7 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | |||
402 | #ifdef CONFIG_IWLWIFI_DEBUG | 463 | #ifdef CONFIG_IWLWIFI_DEBUG |
403 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); | 464 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); |
404 | #endif | 465 | #endif |
466 | iwl_recover_from_statistics(priv, pkt); | ||
405 | 467 | ||
406 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); | 468 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); |
407 | } | 469 | } |
@@ -885,7 +947,8 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
885 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); | 947 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); |
886 | } | 948 | } |
887 | 949 | ||
888 | u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) | 950 | static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, |
951 | u16 tx_rate, u8 flags) | ||
889 | { | 952 | { |
890 | unsigned long flags_spin; | 953 | unsigned long flags_spin; |
891 | struct iwl_station_entry *station; | 954 | struct iwl_station_entry *station; |
@@ -1715,6 +1778,11 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv) | |||
1715 | int ref_temp; | 1778 | int ref_temp; |
1716 | int temperature = priv->temperature; | 1779 | int temperature = priv->temperature; |
1717 | 1780 | ||
1781 | if (priv->disable_tx_power_cal || | ||
1782 | test_bit(STATUS_SCANNING, &priv->status)) { | ||
1783 | /* do not perform tx power calibration */ | ||
1784 | return 0; | ||
1785 | } | ||
1718 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ | 1786 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ |
1719 | for (i = 0; i < priv->channel_count; i++) { | 1787 | for (i = 0; i < priv->channel_count; i++) { |
1720 | ch_info = &priv->channel_info[i]; | 1788 | ch_info = &priv->channel_info[i]; |
@@ -1925,7 +1993,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1925 | "configuration (%d).\n", rc); | 1993 | "configuration (%d).\n", rc); |
1926 | return rc; | 1994 | return rc; |
1927 | } | 1995 | } |
1928 | iwl_clear_ucode_stations(priv, false); | 1996 | iwl_clear_ucode_stations(priv); |
1929 | iwl_restore_stations(priv); | 1997 | iwl_restore_stations(priv); |
1930 | } | 1998 | } |
1931 | 1999 | ||
@@ -1958,7 +2026,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1958 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 2026 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
1959 | 2027 | ||
1960 | if (!new_assoc) { | 2028 | if (!new_assoc) { |
1961 | iwl_clear_ucode_stations(priv, false); | 2029 | iwl_clear_ucode_stations(priv); |
1962 | iwl_restore_stations(priv); | 2030 | iwl_restore_stations(priv); |
1963 | } | 2031 | } |
1964 | 2032 | ||
@@ -2391,6 +2459,30 @@ static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) | |||
2391 | return (u16)sizeof(struct iwl3945_addsta_cmd); | 2459 | return (u16)sizeof(struct iwl3945_addsta_cmd); |
2392 | } | 2460 | } |
2393 | 2461 | ||
2462 | static int iwl3945_manage_ibss_station(struct iwl_priv *priv, | ||
2463 | struct ieee80211_vif *vif, bool add) | ||
2464 | { | ||
2465 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
2466 | int ret; | ||
2467 | |||
2468 | if (add) { | ||
2469 | ret = iwl_add_bssid_station(priv, vif->bss_conf.bssid, false, | ||
2470 | &vif_priv->ibss_bssid_sta_id); | ||
2471 | if (ret) | ||
2472 | return ret; | ||
2473 | |||
2474 | iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, | ||
2475 | (priv->band == IEEE80211_BAND_5GHZ) ? | ||
2476 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | ||
2477 | CMD_ASYNC); | ||
2478 | iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); | ||
2479 | |||
2480 | return 0; | ||
2481 | } | ||
2482 | |||
2483 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, | ||
2484 | vif->bss_conf.bssid); | ||
2485 | } | ||
2394 | 2486 | ||
2395 | /** | 2487 | /** |
2396 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table | 2488 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table |
@@ -2720,51 +2812,12 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) | |||
2720 | return 0; | 2812 | return 0; |
2721 | } | 2813 | } |
2722 | 2814 | ||
2723 | #define IWL3945_UCODE_GET(item) \ | ||
2724 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
2725 | u32 api_ver) \ | ||
2726 | { \ | ||
2727 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2728 | } | ||
2729 | |||
2730 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2731 | { | ||
2732 | return UCODE_HEADER_SIZE(1); | ||
2733 | } | ||
2734 | static u32 iwl3945_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
2735 | u32 api_ver) | ||
2736 | { | ||
2737 | return 0; | ||
2738 | } | ||
2739 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
2740 | u32 api_ver) | ||
2741 | { | ||
2742 | return (u8 *) ucode->u.v1.data; | ||
2743 | } | ||
2744 | |||
2745 | IWL3945_UCODE_GET(inst_size); | ||
2746 | IWL3945_UCODE_GET(data_size); | ||
2747 | IWL3945_UCODE_GET(init_size); | ||
2748 | IWL3945_UCODE_GET(init_data_size); | ||
2749 | IWL3945_UCODE_GET(boot_size); | ||
2750 | |||
2751 | static struct iwl_hcmd_ops iwl3945_hcmd = { | 2815 | static struct iwl_hcmd_ops iwl3945_hcmd = { |
2752 | .rxon_assoc = iwl3945_send_rxon_assoc, | 2816 | .rxon_assoc = iwl3945_send_rxon_assoc, |
2753 | .commit_rxon = iwl3945_commit_rxon, | 2817 | .commit_rxon = iwl3945_commit_rxon, |
2754 | .send_bt_config = iwl_send_bt_config, | 2818 | .send_bt_config = iwl_send_bt_config, |
2755 | }; | 2819 | }; |
2756 | 2820 | ||
2757 | static struct iwl_ucode_ops iwl3945_ucode = { | ||
2758 | .get_header_size = iwl3945_ucode_get_header_size, | ||
2759 | .get_build = iwl3945_ucode_get_build, | ||
2760 | .get_inst_size = iwl3945_ucode_get_inst_size, | ||
2761 | .get_data_size = iwl3945_ucode_get_data_size, | ||
2762 | .get_init_size = iwl3945_ucode_get_init_size, | ||
2763 | .get_init_data_size = iwl3945_ucode_get_init_data_size, | ||
2764 | .get_boot_size = iwl3945_ucode_get_boot_size, | ||
2765 | .get_data = iwl3945_ucode_get_data, | ||
2766 | }; | ||
2767 | |||
2768 | static struct iwl_lib_ops iwl3945_lib = { | 2821 | static struct iwl_lib_ops iwl3945_lib = { |
2769 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, | 2822 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, |
2770 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, | 2823 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, |
@@ -2798,7 +2851,8 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2798 | .post_associate = iwl3945_post_associate, | 2851 | .post_associate = iwl3945_post_associate, |
2799 | .isr = iwl_isr_legacy, | 2852 | .isr = iwl_isr_legacy, |
2800 | .config_ap = iwl3945_config_ap, | 2853 | .config_ap = iwl3945_config_ap, |
2801 | .add_bcast_station = iwl3945_add_bcast_station, | 2854 | .manage_ibss_station = iwl3945_manage_ibss_station, |
2855 | .check_plcp_health = iwl3945_good_plcp_health, | ||
2802 | 2856 | ||
2803 | .debugfs_ops = { | 2857 | .debugfs_ops = { |
2804 | .rx_stats_read = iwl3945_ucode_rx_stats_read, | 2858 | .rx_stats_read = iwl3945_ucode_rx_stats_read, |
@@ -2815,7 +2869,6 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | |||
2815 | }; | 2869 | }; |
2816 | 2870 | ||
2817 | static const struct iwl_ops iwl3945_ops = { | 2871 | static const struct iwl_ops iwl3945_ops = { |
2818 | .ucode = &iwl3945_ucode, | ||
2819 | .lib = &iwl3945_lib, | 2872 | .lib = &iwl3945_lib, |
2820 | .hcmd = &iwl3945_hcmd, | 2873 | .hcmd = &iwl3945_hcmd, |
2821 | .utils = &iwl3945_hcmd_utils, | 2874 | .utils = &iwl3945_hcmd_utils, |
@@ -2840,9 +2893,10 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2840 | .ht_greenfield_support = false, | 2893 | .ht_greenfield_support = false, |
2841 | .led_compensation = 64, | 2894 | .led_compensation = 64, |
2842 | .broken_powersave = true, | 2895 | .broken_powersave = true, |
2843 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 2896 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2844 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2897 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2845 | .max_event_log_size = 512, | 2898 | .max_event_log_size = 512, |
2899 | .tx_power_by_driver = true, | ||
2846 | }; | 2900 | }; |
2847 | 2901 | ||
2848 | static struct iwl_cfg iwl3945_abg_cfg = { | 2902 | static struct iwl_cfg iwl3945_abg_cfg = { |
@@ -2860,9 +2914,10 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2860 | .ht_greenfield_support = false, | 2914 | .ht_greenfield_support = false, |
2861 | .led_compensation = 64, | 2915 | .led_compensation = 64, |
2862 | .broken_powersave = true, | 2916 | .broken_powersave = true, |
2863 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 2917 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2864 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2918 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2865 | .max_event_log_size = 512, | 2919 | .max_event_log_size = 512, |
2920 | .tx_power_by_driver = true, | ||
2866 | }; | 2921 | }; |
2867 | 2922 | ||
2868 | DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { | 2923 | DEFINE_PCI_DEVICE_TABLE(iwl3945_hw_card_ids) = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 643adb644bb8..bb2aeebf3652 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -106,7 +106,12 @@ struct iwl3945_rs_sta { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | /* | ||
110 | * The common struct MUST be first because it is shared between | ||
111 | * 3945 and agn! | ||
112 | */ | ||
109 | struct iwl3945_sta_priv { | 113 | struct iwl3945_sta_priv { |
114 | struct iwl_station_priv_common common; | ||
110 | struct iwl3945_rs_sta rs_sta; | 115 | struct iwl3945_rs_sta rs_sta; |
111 | }; | 116 | }; |
112 | 117 | ||
@@ -211,13 +216,6 @@ extern int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
211 | char **buf, bool display); | 216 | char **buf, bool display); |
212 | extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); | 217 | extern void iwl3945_dump_nic_error_log(struct iwl_priv *priv); |
213 | 218 | ||
214 | /* | ||
215 | * Currently used by iwl-3945-rs... look at restructuring so that it doesn't | ||
216 | * call this... todo... fix that. | ||
217 | */ | ||
218 | extern u8 iwl3945_sync_station(struct iwl_priv *priv, int sta_id, | ||
219 | u16 tx_rate, u8 flags); | ||
220 | |||
221 | /****************************************************************************** | 219 | /****************************************************************************** |
222 | * | 220 | * |
223 | * Functions implemented in iwl-[34]*.c which are forward declared here | 221 | * Functions implemented in iwl-[34]*.c which are forward declared here |
@@ -268,8 +266,10 @@ void iwl3945_reply_statistics(struct iwl_priv *priv, | |||
268 | struct iwl_rx_mem_buffer *rxb); | 266 | struct iwl_rx_mem_buffer *rxb); |
269 | extern void iwl3945_disable_events(struct iwl_priv *priv); | 267 | extern void iwl3945_disable_events(struct iwl_priv *priv); |
270 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); | 268 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); |
271 | extern void iwl3945_post_associate(struct iwl_priv *priv); | 269 | extern void iwl3945_post_associate(struct iwl_priv *priv, |
272 | extern void iwl3945_config_ap(struct iwl_priv *priv); | 270 | struct ieee80211_vif *vif); |
271 | extern void iwl3945_config_ap(struct iwl_priv *priv, | ||
272 | struct ieee80211_vif *vif); | ||
273 | 273 | ||
274 | /** | 274 | /** |
275 | * iwl3945_hw_find_station - Find station id for a given BSSID | 275 | * iwl3945_hw_find_station - Find station id for a given BSSID |
@@ -288,8 +288,6 @@ extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); | |||
288 | extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); | 288 | extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); |
289 | extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); | 289 | extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); |
290 | extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); | 290 | extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); |
291 | extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, | ||
292 | u16 tx_rate, u8 flags); | ||
293 | 291 | ||
294 | extern const struct iwl_channel_info *iwl3945_get_channel_info( | 292 | extern const struct iwl_channel_info *iwl3945_get_channel_info( |
295 | const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); | 293 | const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); |
@@ -297,7 +295,7 @@ extern const struct iwl_channel_info *iwl3945_get_channel_info( | |||
297 | extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); | 295 | extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); |
298 | 296 | ||
299 | /* scanning */ | 297 | /* scanning */ |
300 | void iwl3945_request_scan(struct iwl_priv *priv); | 298 | void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); |
301 | 299 | ||
302 | /* Requires full declaration of iwl_priv before including */ | 300 | /* Requires full declaration of iwl_priv before including */ |
303 | #include "iwl-io.h" | 301 | #include "iwl-io.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 136c29067489..d3afddae8d9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1953,6 +1953,60 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
1953 | return 0; | 1953 | return 0; |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | ||
1957 | { | ||
1958 | int i; | ||
1959 | int start = 0; | ||
1960 | int ret = IWL_INVALID_STATION; | ||
1961 | unsigned long flags; | ||
1962 | |||
1963 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
1964 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
1965 | start = IWL_STA_ID; | ||
1966 | |||
1967 | if (is_broadcast_ether_addr(addr)) | ||
1968 | return priv->hw_params.bcast_sta_id; | ||
1969 | |||
1970 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1971 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
1972 | if (priv->stations[i].used && | ||
1973 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
1974 | addr))) { | ||
1975 | ret = i; | ||
1976 | goto out; | ||
1977 | } | ||
1978 | |||
1979 | IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", | ||
1980 | addr, priv->num_stations); | ||
1981 | |||
1982 | out: | ||
1983 | /* | ||
1984 | * It may be possible that more commands interacting with stations | ||
1985 | * arrive before we completed processing the adding of | ||
1986 | * station | ||
1987 | */ | ||
1988 | if (ret != IWL_INVALID_STATION && | ||
1989 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || | ||
1990 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && | ||
1991 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { | ||
1992 | IWL_ERR(priv, "Requested station info for sta %d before ready.\n", | ||
1993 | ret); | ||
1994 | ret = IWL_INVALID_STATION; | ||
1995 | } | ||
1996 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1997 | return ret; | ||
1998 | } | ||
1999 | |||
2000 | static int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
2001 | { | ||
2002 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | ||
2003 | return IWL_AP_ID; | ||
2004 | } else { | ||
2005 | u8 *da = ieee80211_get_DA(hdr); | ||
2006 | return iwl_find_station(priv, da); | ||
2007 | } | ||
2008 | } | ||
2009 | |||
1956 | /** | 2010 | /** |
1957 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response | 2011 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response |
1958 | */ | 2012 | */ |
@@ -2112,34 +2166,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | |||
2112 | cancel_work_sync(&priv->txpower_work); | 2166 | cancel_work_sync(&priv->txpower_work); |
2113 | } | 2167 | } |
2114 | 2168 | ||
2115 | #define IWL4965_UCODE_GET(item) \ | ||
2116 | static u32 iwl4965_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
2117 | u32 api_ver) \ | ||
2118 | { \ | ||
2119 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2120 | } | ||
2121 | |||
2122 | static u32 iwl4965_ucode_get_header_size(u32 api_ver) | ||
2123 | { | ||
2124 | return UCODE_HEADER_SIZE(1); | ||
2125 | } | ||
2126 | static u32 iwl4965_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
2127 | u32 api_ver) | ||
2128 | { | ||
2129 | return 0; | ||
2130 | } | ||
2131 | static u8 *iwl4965_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
2132 | u32 api_ver) | ||
2133 | { | ||
2134 | return (u8 *) ucode->u.v1.data; | ||
2135 | } | ||
2136 | |||
2137 | IWL4965_UCODE_GET(inst_size); | ||
2138 | IWL4965_UCODE_GET(data_size); | ||
2139 | IWL4965_UCODE_GET(init_size); | ||
2140 | IWL4965_UCODE_GET(init_data_size); | ||
2141 | IWL4965_UCODE_GET(boot_size); | ||
2142 | |||
2143 | static struct iwl_hcmd_ops iwl4965_hcmd = { | 2169 | static struct iwl_hcmd_ops iwl4965_hcmd = { |
2144 | .rxon_assoc = iwl4965_send_rxon_assoc, | 2170 | .rxon_assoc = iwl4965_send_rxon_assoc, |
2145 | .commit_rxon = iwl_commit_rxon, | 2171 | .commit_rxon = iwl_commit_rxon, |
@@ -2147,16 +2173,6 @@ static struct iwl_hcmd_ops iwl4965_hcmd = { | |||
2147 | .send_bt_config = iwl_send_bt_config, | 2173 | .send_bt_config = iwl_send_bt_config, |
2148 | }; | 2174 | }; |
2149 | 2175 | ||
2150 | static struct iwl_ucode_ops iwl4965_ucode = { | ||
2151 | .get_header_size = iwl4965_ucode_get_header_size, | ||
2152 | .get_build = iwl4965_ucode_get_build, | ||
2153 | .get_inst_size = iwl4965_ucode_get_inst_size, | ||
2154 | .get_data_size = iwl4965_ucode_get_data_size, | ||
2155 | .get_init_size = iwl4965_ucode_get_init_size, | ||
2156 | .get_init_data_size = iwl4965_ucode_get_init_data_size, | ||
2157 | .get_boot_size = iwl4965_ucode_get_boot_size, | ||
2158 | .get_data = iwl4965_ucode_get_data, | ||
2159 | }; | ||
2160 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | 2176 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { |
2161 | .get_hcmd_size = iwl4965_get_hcmd_size, | 2177 | .get_hcmd_size = iwl4965_get_hcmd_size, |
2162 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, | 2178 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, |
@@ -2218,7 +2234,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2218 | .temperature = iwl4965_temperature_calib, | 2234 | .temperature = iwl4965_temperature_calib, |
2219 | .set_ct_kill = iwl4965_set_ct_threshold, | 2235 | .set_ct_kill = iwl4965_set_ct_threshold, |
2220 | }, | 2236 | }, |
2221 | .add_bcast_station = iwl_add_bcast_station, | 2237 | .manage_ibss_station = iwlagn_manage_ibss_station, |
2222 | .debugfs_ops = { | 2238 | .debugfs_ops = { |
2223 | .rx_stats_read = iwl_ucode_rx_stats_read, | 2239 | .rx_stats_read = iwl_ucode_rx_stats_read, |
2224 | .tx_stats_read = iwl_ucode_tx_stats_read, | 2240 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -2228,7 +2244,6 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2228 | }; | 2244 | }; |
2229 | 2245 | ||
2230 | static const struct iwl_ops iwl4965_ops = { | 2246 | static const struct iwl_ops iwl4965_ops = { |
2231 | .ucode = &iwl4965_ucode, | ||
2232 | .lib = &iwl4965_lib, | 2247 | .lib = &iwl4965_lib, |
2233 | .hcmd = &iwl4965_hcmd, | 2248 | .hcmd = &iwl4965_hcmd, |
2234 | .utils = &iwl4965_hcmd_utils, | 2249 | .utils = &iwl4965_hcmd_utils, |
@@ -2262,7 +2277,10 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2262 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2277 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
2263 | .temperature_kelvin = true, | 2278 | .temperature_kelvin = true, |
2264 | .max_event_log_size = 512, | 2279 | .max_event_log_size = 512, |
2265 | 2280 | .tx_power_by_driver = true, | |
2281 | .ucode_tracing = true, | ||
2282 | .sensitivity_calib_by_driver = true, | ||
2283 | .chain_noise_calib_by_driver = true, | ||
2266 | /* | 2284 | /* |
2267 | * Force use of chains B and C for scan RX on 5 GHz band | 2285 | * Force use of chains B and C for scan RX on 5 GHz band |
2268 | * because the device has off-channel reception on chain A. | 2286 | * because the device has off-channel reception on chain A. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 115d3ea1142f..a28af7eb67eb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -351,7 +351,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
351 | .temperature = iwlagn_temperature, | 351 | .temperature = iwlagn_temperature, |
352 | .set_ct_kill = iwl5000_set_ct_threshold, | 352 | .set_ct_kill = iwl5000_set_ct_threshold, |
353 | }, | 353 | }, |
354 | .add_bcast_station = iwl_add_bcast_station, | 354 | .manage_ibss_station = iwlagn_manage_ibss_station, |
355 | .debugfs_ops = { | 355 | .debugfs_ops = { |
356 | .rx_stats_read = iwl_ucode_rx_stats_read, | 356 | .rx_stats_read = iwl_ucode_rx_stats_read, |
357 | .tx_stats_read = iwl_ucode_tx_stats_read, | 357 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -413,7 +413,7 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
413 | .temperature = iwl5150_temperature, | 413 | .temperature = iwl5150_temperature, |
414 | .set_ct_kill = iwl5150_set_ct_threshold, | 414 | .set_ct_kill = iwl5150_set_ct_threshold, |
415 | }, | 415 | }, |
416 | .add_bcast_station = iwl_add_bcast_station, | 416 | .manage_ibss_station = iwlagn_manage_ibss_station, |
417 | .debugfs_ops = { | 417 | .debugfs_ops = { |
418 | .rx_stats_read = iwl_ucode_rx_stats_read, | 418 | .rx_stats_read = iwl_ucode_rx_stats_read, |
419 | .tx_stats_read = iwl_ucode_tx_stats_read, | 419 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -425,7 +425,6 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
425 | }; | 425 | }; |
426 | 426 | ||
427 | static const struct iwl_ops iwl5000_ops = { | 427 | static const struct iwl_ops iwl5000_ops = { |
428 | .ucode = &iwlagn_ucode, | ||
429 | .lib = &iwl5000_lib, | 428 | .lib = &iwl5000_lib, |
430 | .hcmd = &iwlagn_hcmd, | 429 | .hcmd = &iwlagn_hcmd, |
431 | .utils = &iwlagn_hcmd_utils, | 430 | .utils = &iwlagn_hcmd_utils, |
@@ -433,7 +432,6 @@ static const struct iwl_ops iwl5000_ops = { | |||
433 | }; | 432 | }; |
434 | 433 | ||
435 | static const struct iwl_ops iwl5150_ops = { | 434 | static const struct iwl_ops iwl5150_ops = { |
436 | .ucode = &iwlagn_ucode, | ||
437 | .lib = &iwl5150_lib, | 435 | .lib = &iwl5150_lib, |
438 | .hcmd = &iwlagn_hcmd, | 436 | .hcmd = &iwlagn_hcmd, |
439 | .utils = &iwlagn_hcmd_utils, | 437 | .utils = &iwlagn_hcmd_utils, |
@@ -466,6 +464,9 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
466 | .chain_noise_scale = 1000, | 464 | .chain_noise_scale = 1000, |
467 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 465 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
468 | .max_event_log_size = 512, | 466 | .max_event_log_size = 512, |
467 | .ucode_tracing = true, | ||
468 | .sensitivity_calib_by_driver = true, | ||
469 | .chain_noise_calib_by_driver = true, | ||
469 | }; | 470 | }; |
470 | 471 | ||
471 | struct iwl_cfg iwl5100_bgn_cfg = { | 472 | struct iwl_cfg iwl5100_bgn_cfg = { |
@@ -494,6 +495,9 @@ struct iwl_cfg iwl5100_bgn_cfg = { | |||
494 | .chain_noise_scale = 1000, | 495 | .chain_noise_scale = 1000, |
495 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 496 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
496 | .max_event_log_size = 512, | 497 | .max_event_log_size = 512, |
498 | .ucode_tracing = true, | ||
499 | .sensitivity_calib_by_driver = true, | ||
500 | .chain_noise_calib_by_driver = true, | ||
497 | }; | 501 | }; |
498 | 502 | ||
499 | struct iwl_cfg iwl5100_abg_cfg = { | 503 | struct iwl_cfg iwl5100_abg_cfg = { |
@@ -520,6 +524,9 @@ struct iwl_cfg iwl5100_abg_cfg = { | |||
520 | .chain_noise_scale = 1000, | 524 | .chain_noise_scale = 1000, |
521 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 525 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
522 | .max_event_log_size = 512, | 526 | .max_event_log_size = 512, |
527 | .ucode_tracing = true, | ||
528 | .sensitivity_calib_by_driver = true, | ||
529 | .chain_noise_calib_by_driver = true, | ||
523 | }; | 530 | }; |
524 | 531 | ||
525 | struct iwl_cfg iwl5100_agn_cfg = { | 532 | struct iwl_cfg iwl5100_agn_cfg = { |
@@ -548,6 +555,9 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
548 | .chain_noise_scale = 1000, | 555 | .chain_noise_scale = 1000, |
549 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 556 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
550 | .max_event_log_size = 512, | 557 | .max_event_log_size = 512, |
558 | .ucode_tracing = true, | ||
559 | .sensitivity_calib_by_driver = true, | ||
560 | .chain_noise_calib_by_driver = true, | ||
551 | }; | 561 | }; |
552 | 562 | ||
553 | struct iwl_cfg iwl5350_agn_cfg = { | 563 | struct iwl_cfg iwl5350_agn_cfg = { |
@@ -576,6 +586,9 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
576 | .chain_noise_scale = 1000, | 586 | .chain_noise_scale = 1000, |
577 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 587 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
578 | .max_event_log_size = 512, | 588 | .max_event_log_size = 512, |
589 | .ucode_tracing = true, | ||
590 | .sensitivity_calib_by_driver = true, | ||
591 | .chain_noise_calib_by_driver = true, | ||
579 | }; | 592 | }; |
580 | 593 | ||
581 | struct iwl_cfg iwl5150_agn_cfg = { | 594 | struct iwl_cfg iwl5150_agn_cfg = { |
@@ -604,6 +617,9 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
604 | .chain_noise_scale = 1000, | 617 | .chain_noise_scale = 1000, |
605 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 618 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
606 | .max_event_log_size = 512, | 619 | .max_event_log_size = 512, |
620 | .ucode_tracing = true, | ||
621 | .sensitivity_calib_by_driver = true, | ||
622 | .chain_noise_calib_by_driver = true, | ||
607 | }; | 623 | }; |
608 | 624 | ||
609 | struct iwl_cfg iwl5150_abg_cfg = { | 625 | struct iwl_cfg iwl5150_abg_cfg = { |
@@ -630,6 +646,9 @@ struct iwl_cfg iwl5150_abg_cfg = { | |||
630 | .chain_noise_scale = 1000, | 646 | .chain_noise_scale = 1000, |
631 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 647 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
632 | .max_event_log_size = 512, | 648 | .max_event_log_size = 512, |
649 | .ucode_tracing = true, | ||
650 | .sensitivity_calib_by_driver = true, | ||
651 | .chain_noise_calib_by_driver = true, | ||
633 | }; | 652 | }; |
634 | 653 | ||
635 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 654 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 7acef703253a..9fbf54cd3e1a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -67,9 +67,10 @@ | |||
67 | #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" | 67 | #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" |
68 | #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) | 68 | #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) |
69 | 69 | ||
70 | #define IWL6000G2_FW_PRE "iwlwifi-6005-" | 70 | #define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-" |
71 | #define _IWL6000G2_MODULE_FIRMWARE(api) IWL6000G2_FW_PRE #api ".ucode" | 71 | #define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode" |
72 | #define IWL6000G2_MODULE_FIRMWARE(api) _IWL6000G2_MODULE_FIRMWARE(api) | 72 | #define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api) |
73 | |||
73 | 74 | ||
74 | static void iwl6000_set_ct_threshold(struct iwl_priv *priv) | 75 | static void iwl6000_set_ct_threshold(struct iwl_priv *priv) |
75 | { | 76 | { |
@@ -316,7 +317,7 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
316 | .temperature = iwlagn_temperature, | 317 | .temperature = iwlagn_temperature, |
317 | .set_ct_kill = iwl6000_set_ct_threshold, | 318 | .set_ct_kill = iwl6000_set_ct_threshold, |
318 | }, | 319 | }, |
319 | .add_bcast_station = iwl_add_bcast_station, | 320 | .manage_ibss_station = iwlagn_manage_ibss_station, |
320 | .debugfs_ops = { | 321 | .debugfs_ops = { |
321 | .rx_stats_read = iwl_ucode_rx_stats_read, | 322 | .rx_stats_read = iwl_ucode_rx_stats_read, |
322 | .tx_stats_read = iwl_ucode_tx_stats_read, | 323 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -328,7 +329,6 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
328 | }; | 329 | }; |
329 | 330 | ||
330 | static const struct iwl_ops iwl6000_ops = { | 331 | static const struct iwl_ops iwl6000_ops = { |
331 | .ucode = &iwlagn_ucode, | ||
332 | .lib = &iwl6000_lib, | 332 | .lib = &iwl6000_lib, |
333 | .hcmd = &iwlagn_hcmd, | 333 | .hcmd = &iwlagn_hcmd, |
334 | .utils = &iwlagn_hcmd_utils, | 334 | .utils = &iwlagn_hcmd_utils, |
@@ -389,7 +389,7 @@ static struct iwl_lib_ops iwl6050_lib = { | |||
389 | .set_ct_kill = iwl6000_set_ct_threshold, | 389 | .set_ct_kill = iwl6000_set_ct_threshold, |
390 | .set_calib_version = iwl6050_set_calib_version, | 390 | .set_calib_version = iwl6050_set_calib_version, |
391 | }, | 391 | }, |
392 | .add_bcast_station = iwl_add_bcast_station, | 392 | .manage_ibss_station = iwlagn_manage_ibss_station, |
393 | .debugfs_ops = { | 393 | .debugfs_ops = { |
394 | .rx_stats_read = iwl_ucode_rx_stats_read, | 394 | .rx_stats_read = iwl_ucode_rx_stats_read, |
395 | .tx_stats_read = iwl_ucode_tx_stats_read, | 395 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -401,19 +401,16 @@ static struct iwl_lib_ops iwl6050_lib = { | |||
401 | }; | 401 | }; |
402 | 402 | ||
403 | static const struct iwl_ops iwl6050_ops = { | 403 | static const struct iwl_ops iwl6050_ops = { |
404 | .ucode = &iwlagn_ucode, | ||
405 | .lib = &iwl6050_lib, | 404 | .lib = &iwl6050_lib, |
406 | .hcmd = &iwlagn_hcmd, | 405 | .hcmd = &iwlagn_hcmd, |
407 | .utils = &iwlagn_hcmd_utils, | 406 | .utils = &iwlagn_hcmd_utils, |
408 | .led = &iwlagn_led_ops, | 407 | .led = &iwlagn_led_ops, |
409 | }; | 408 | }; |
410 | 409 | ||
411 | /* | 410 | |
412 | * "i": Internal configuration, use internal Power Amplifier | 411 | struct iwl_cfg iwl6000g2a_2agn_cfg = { |
413 | */ | 412 | .name = "6000 Series 2x2 AGN Gen2a", |
414 | struct iwl_cfg iwl6000g2_2agn_cfg = { | 413 | .fw_name_pre = IWL6000G2A_FW_PRE, |
415 | .name = "6000 Series 2x2 AGN Gen2", | ||
416 | .fw_name_pre = IWL6000G2_FW_PRE, | ||
417 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, | 414 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, |
418 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, | 415 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, |
419 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 416 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
@@ -442,9 +439,15 @@ struct iwl_cfg iwl6000g2_2agn_cfg = { | |||
442 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 439 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
443 | .chain_noise_scale = 1000, | 440 | .chain_noise_scale = 1000, |
444 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 441 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
445 | .max_event_log_size = 1024, | 442 | .max_event_log_size = 512, |
443 | .ucode_tracing = true, | ||
444 | .sensitivity_calib_by_driver = true, | ||
445 | .chain_noise_calib_by_driver = true, | ||
446 | }; | 446 | }; |
447 | 447 | ||
448 | /* | ||
449 | * "i": Internal configuration, use internal Power Amplifier | ||
450 | */ | ||
448 | struct iwl_cfg iwl6000i_2agn_cfg = { | 451 | struct iwl_cfg iwl6000i_2agn_cfg = { |
449 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", | 452 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", |
450 | .fw_name_pre = IWL6000_FW_PRE, | 453 | .fw_name_pre = IWL6000_FW_PRE, |
@@ -477,6 +480,9 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
477 | .chain_noise_scale = 1000, | 480 | .chain_noise_scale = 1000, |
478 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 481 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
479 | .max_event_log_size = 1024, | 482 | .max_event_log_size = 1024, |
483 | .ucode_tracing = true, | ||
484 | .sensitivity_calib_by_driver = true, | ||
485 | .chain_noise_calib_by_driver = true, | ||
480 | }; | 486 | }; |
481 | 487 | ||
482 | struct iwl_cfg iwl6000i_2abg_cfg = { | 488 | struct iwl_cfg iwl6000i_2abg_cfg = { |
@@ -509,6 +515,9 @@ struct iwl_cfg iwl6000i_2abg_cfg = { | |||
509 | .chain_noise_scale = 1000, | 515 | .chain_noise_scale = 1000, |
510 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 516 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
511 | .max_event_log_size = 1024, | 517 | .max_event_log_size = 1024, |
518 | .ucode_tracing = true, | ||
519 | .sensitivity_calib_by_driver = true, | ||
520 | .chain_noise_calib_by_driver = true, | ||
512 | }; | 521 | }; |
513 | 522 | ||
514 | struct iwl_cfg iwl6000i_2bg_cfg = { | 523 | struct iwl_cfg iwl6000i_2bg_cfg = { |
@@ -541,6 +550,9 @@ struct iwl_cfg iwl6000i_2bg_cfg = { | |||
541 | .chain_noise_scale = 1000, | 550 | .chain_noise_scale = 1000, |
542 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 551 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
543 | .max_event_log_size = 1024, | 552 | .max_event_log_size = 1024, |
553 | .ucode_tracing = true, | ||
554 | .sensitivity_calib_by_driver = true, | ||
555 | .chain_noise_calib_by_driver = true, | ||
544 | }; | 556 | }; |
545 | 557 | ||
546 | struct iwl_cfg iwl6050_2agn_cfg = { | 558 | struct iwl_cfg iwl6050_2agn_cfg = { |
@@ -575,6 +587,9 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
575 | .chain_noise_scale = 1500, | 587 | .chain_noise_scale = 1500, |
576 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 588 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
577 | .max_event_log_size = 1024, | 589 | .max_event_log_size = 1024, |
590 | .ucode_tracing = true, | ||
591 | .sensitivity_calib_by_driver = true, | ||
592 | .chain_noise_calib_by_driver = true, | ||
578 | }; | 593 | }; |
579 | 594 | ||
580 | struct iwl_cfg iwl6050_2abg_cfg = { | 595 | struct iwl_cfg iwl6050_2abg_cfg = { |
@@ -607,6 +622,9 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
607 | .chain_noise_scale = 1500, | 622 | .chain_noise_scale = 1500, |
608 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 623 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
609 | .max_event_log_size = 1024, | 624 | .max_event_log_size = 1024, |
625 | .ucode_tracing = true, | ||
626 | .sensitivity_calib_by_driver = true, | ||
627 | .chain_noise_calib_by_driver = true, | ||
610 | }; | 628 | }; |
611 | 629 | ||
612 | struct iwl_cfg iwl6000_3agn_cfg = { | 630 | struct iwl_cfg iwl6000_3agn_cfg = { |
@@ -641,8 +659,11 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
641 | .chain_noise_scale = 1000, | 659 | .chain_noise_scale = 1000, |
642 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 660 | .monitor_recover_period = IWL_MONITORING_PERIOD, |
643 | .max_event_log_size = 1024, | 661 | .max_event_log_size = 1024, |
662 | .ucode_tracing = true, | ||
663 | .sensitivity_calib_by_driver = true, | ||
664 | .chain_noise_calib_by_driver = true, | ||
644 | }; | 665 | }; |
645 | 666 | ||
646 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 667 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
647 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 668 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); |
648 | MODULE_FIRMWARE(IWL6000G2_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 669 | MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c index f249b706bf17..48c023b4ca36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c | |||
@@ -709,6 +709,22 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file, | |||
709 | delta_tx->agg.rx_ba_rsp_cnt, | 709 | delta_tx->agg.rx_ba_rsp_cnt, |
710 | max_tx->agg.rx_ba_rsp_cnt); | 710 | max_tx->agg.rx_ba_rsp_cnt); |
711 | 711 | ||
712 | if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) { | ||
713 | pos += scnprintf(buf + pos, bufsz - pos, | ||
714 | "tx power: (1/2 dB step)\n"); | ||
715 | if ((priv->cfg->valid_tx_ant & ANT_A) && tx->tx_power.ant_a) | ||
716 | pos += scnprintf(buf + pos, bufsz - pos, | ||
717 | "\tantenna A: 0x%X\n", | ||
718 | tx->tx_power.ant_a); | ||
719 | if ((priv->cfg->valid_tx_ant & ANT_B) && tx->tx_power.ant_b) | ||
720 | pos += scnprintf(buf + pos, bufsz - pos, | ||
721 | "\tantenna B: 0x%X\n", | ||
722 | tx->tx_power.ant_b); | ||
723 | if ((priv->cfg->valid_tx_ant & ANT_C) && tx->tx_power.ant_c) | ||
724 | pos += scnprintf(buf + pos, bufsz - pos, | ||
725 | "\tantenna C: 0x%X\n", | ||
726 | tx->tx_power.ant_c); | ||
727 | } | ||
712 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 728 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
713 | kfree(buf); | 729 | kfree(buf); |
714 | return ret; | 730 | return ret; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index a27347425968..637d7b62fb56 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "iwl-helpers.h" | 38 | #include "iwl-helpers.h" |
39 | #include "iwl-agn-hw.h" | 39 | #include "iwl-agn-hw.h" |
40 | #include "iwl-agn.h" | 40 | #include "iwl-agn.h" |
41 | #include "iwl-sta.h" | ||
41 | 42 | ||
42 | static inline u32 iwlagn_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) | 43 | static inline u32 iwlagn_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) |
43 | { | 44 | { |
@@ -1113,8 +1114,9 @@ void iwlagn_rx_reply_rx_phy(struct iwl_priv *priv, | |||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | 1116 | static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, |
1116 | enum ieee80211_band band, | 1117 | struct ieee80211_vif *vif, |
1117 | struct iwl_scan_channel *scan_ch) | 1118 | enum ieee80211_band band, |
1119 | struct iwl_scan_channel *scan_ch) | ||
1118 | { | 1120 | { |
1119 | const struct ieee80211_supported_band *sband; | 1121 | const struct ieee80211_supported_band *sband; |
1120 | const struct iwl_channel_info *ch_info; | 1122 | const struct iwl_channel_info *ch_info; |
@@ -1130,7 +1132,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1130 | } | 1132 | } |
1131 | 1133 | ||
1132 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | 1134 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); |
1133 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1135 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1134 | 1136 | ||
1135 | if (passive_dwell <= active_dwell) | 1137 | if (passive_dwell <= active_dwell) |
1136 | passive_dwell = active_dwell + 1; | 1138 | passive_dwell = active_dwell + 1; |
@@ -1179,6 +1181,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1179 | } | 1181 | } |
1180 | 1182 | ||
1181 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, | 1183 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, |
1184 | struct ieee80211_vif *vif, | ||
1182 | enum ieee80211_band band, | 1185 | enum ieee80211_band band, |
1183 | u8 is_active, u8 n_probes, | 1186 | u8 is_active, u8 n_probes, |
1184 | struct iwl_scan_channel *scan_ch) | 1187 | struct iwl_scan_channel *scan_ch) |
@@ -1196,7 +1199,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
1196 | return 0; | 1199 | return 0; |
1197 | 1200 | ||
1198 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); | 1201 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); |
1199 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1202 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1200 | 1203 | ||
1201 | if (passive_dwell <= active_dwell) | 1204 | if (passive_dwell <= active_dwell) |
1202 | passive_dwell = active_dwell + 1; | 1205 | passive_dwell = active_dwell + 1; |
@@ -1256,7 +1259,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
1256 | return added; | 1259 | return added; |
1257 | } | 1260 | } |
1258 | 1261 | ||
1259 | void iwlagn_request_scan(struct iwl_priv *priv) | 1262 | void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) |
1260 | { | 1263 | { |
1261 | struct iwl_host_cmd cmd = { | 1264 | struct iwl_host_cmd cmd = { |
1262 | .id = REPLY_SCAN_CMD, | 1265 | .id = REPLY_SCAN_CMD, |
@@ -1342,7 +1345,7 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1342 | 1345 | ||
1343 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 1346 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
1344 | spin_lock_irqsave(&priv->lock, flags); | 1347 | spin_lock_irqsave(&priv->lock, flags); |
1345 | interval = priv->beacon_int; | 1348 | interval = vif ? vif->bss_conf.beacon_int : 0; |
1346 | spin_unlock_irqrestore(&priv->lock, flags); | 1349 | spin_unlock_irqrestore(&priv->lock, flags); |
1347 | 1350 | ||
1348 | scan->suspend_time = 0; | 1351 | scan->suspend_time = 0; |
@@ -1473,12 +1476,12 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1473 | 1476 | ||
1474 | if (priv->is_internal_short_scan) { | 1477 | if (priv->is_internal_short_scan) { |
1475 | scan->channel_count = | 1478 | scan->channel_count = |
1476 | iwl_get_single_channel_for_scan(priv, band, | 1479 | iwl_get_single_channel_for_scan(priv, vif, band, |
1477 | (void *)&scan->data[le16_to_cpu( | 1480 | (void *)&scan->data[le16_to_cpu( |
1478 | scan->tx_cmd.len)]); | 1481 | scan->tx_cmd.len)]); |
1479 | } else { | 1482 | } else { |
1480 | scan->channel_count = | 1483 | scan->channel_count = |
1481 | iwl_get_channels_for_scan(priv, band, | 1484 | iwl_get_channels_for_scan(priv, vif, band, |
1482 | is_active, n_probes, | 1485 | is_active, n_probes, |
1483 | (void *)&scan->data[le16_to_cpu( | 1486 | (void *)&scan->data[le16_to_cpu( |
1484 | scan->tx_cmd.len)]); | 1487 | scan->tx_cmd.len)]); |
@@ -1513,3 +1516,15 @@ void iwlagn_request_scan(struct iwl_priv *priv) | |||
1513 | /* inform mac80211 scan aborted */ | 1516 | /* inform mac80211 scan aborted */ |
1514 | queue_work(priv->workqueue, &priv->scan_completed); | 1517 | queue_work(priv->workqueue, &priv->scan_completed); |
1515 | } | 1518 | } |
1519 | |||
1520 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | ||
1521 | struct ieee80211_vif *vif, bool add) | ||
1522 | { | ||
1523 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
1524 | |||
1525 | if (add) | ||
1526 | return iwl_add_bssid_station(priv, vif->bss_conf.bssid, true, | ||
1527 | &vif_priv->ibss_bssid_sta_id); | ||
1528 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, | ||
1529 | vif->bss_conf.bssid); | ||
1530 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index c2a5c85542bf..c402bfc83f36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -566,11 +566,11 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
566 | 566 | ||
567 | hdr_len = ieee80211_hdrlen(fc); | 567 | hdr_len = ieee80211_hdrlen(fc); |
568 | 568 | ||
569 | /* Find (or create) index into station table for destination station */ | 569 | /* Find index into station table for destination station */ |
570 | if (info->flags & IEEE80211_TX_CTL_INJECTED) | 570 | if (!info->control.sta) |
571 | sta_id = priv->hw_params.bcast_sta_id; | 571 | sta_id = priv->hw_params.bcast_sta_id; |
572 | else | 572 | else |
573 | sta_id = iwl_get_sta_id(priv, hdr); | 573 | sta_id = iwl_sta_id(info->control.sta); |
574 | if (sta_id == IWL_INVALID_STATION) { | 574 | if (sta_id == IWL_INVALID_STATION) { |
575 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 575 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
576 | hdr->addr1); | 576 | hdr->addr1); |
@@ -961,7 +961,8 @@ static int iwlagn_txq_ctx_activate_free(struct iwl_priv *priv) | |||
961 | return -1; | 961 | return -1; |
962 | } | 962 | } |
963 | 963 | ||
964 | int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | 964 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
965 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | ||
965 | { | 966 | { |
966 | int sta_id; | 967 | int sta_id; |
967 | int tx_fifo; | 968 | int tx_fifo; |
@@ -975,9 +976,9 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
975 | return tx_fifo; | 976 | return tx_fifo; |
976 | 977 | ||
977 | IWL_WARN(priv, "%s on ra = %pM tid = %d\n", | 978 | IWL_WARN(priv, "%s on ra = %pM tid = %d\n", |
978 | __func__, ra, tid); | 979 | __func__, sta->addr, tid); |
979 | 980 | ||
980 | sta_id = iwl_find_station(priv, ra); | 981 | sta_id = iwl_sta_id(sta); |
981 | if (sta_id == IWL_INVALID_STATION) { | 982 | if (sta_id == IWL_INVALID_STATION) { |
982 | IWL_ERR(priv, "Start AGG on invalid station\n"); | 983 | IWL_ERR(priv, "Start AGG on invalid station\n"); |
983 | return -ENXIO; | 984 | return -ENXIO; |
@@ -1011,7 +1012,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1011 | if (tid_data->tfds_in_queue == 0) { | 1012 | if (tid_data->tfds_in_queue == 0) { |
1012 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); | 1013 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); |
1013 | tid_data->agg.state = IWL_AGG_ON; | 1014 | tid_data->agg.state = IWL_AGG_ON; |
1014 | ieee80211_start_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1015 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1015 | } else { | 1016 | } else { |
1016 | IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n", | 1017 | IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n", |
1017 | tid_data->tfds_in_queue); | 1018 | tid_data->tfds_in_queue); |
@@ -1020,23 +1021,19 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1020 | return ret; | 1021 | return ret; |
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | 1024 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
1025 | struct ieee80211_sta *sta, u16 tid) | ||
1024 | { | 1026 | { |
1025 | int tx_fifo_id, txq_id, sta_id, ssn = -1; | 1027 | int tx_fifo_id, txq_id, sta_id, ssn = -1; |
1026 | struct iwl_tid_data *tid_data; | 1028 | struct iwl_tid_data *tid_data; |
1027 | int write_ptr, read_ptr; | 1029 | int write_ptr, read_ptr; |
1028 | unsigned long flags; | 1030 | unsigned long flags; |
1029 | 1031 | ||
1030 | if (!ra) { | ||
1031 | IWL_ERR(priv, "ra = NULL\n"); | ||
1032 | return -EINVAL; | ||
1033 | } | ||
1034 | |||
1035 | tx_fifo_id = get_fifo_from_tid(tid); | 1032 | tx_fifo_id = get_fifo_from_tid(tid); |
1036 | if (unlikely(tx_fifo_id < 0)) | 1033 | if (unlikely(tx_fifo_id < 0)) |
1037 | return tx_fifo_id; | 1034 | return tx_fifo_id; |
1038 | 1035 | ||
1039 | sta_id = iwl_find_station(priv, ra); | 1036 | sta_id = iwl_sta_id(sta); |
1040 | 1037 | ||
1041 | if (sta_id == IWL_INVALID_STATION) { | 1038 | if (sta_id == IWL_INVALID_STATION) { |
1042 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 1039 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); |
@@ -1046,7 +1043,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1046 | if (priv->stations[sta_id].tid[tid].agg.state == | 1043 | if (priv->stations[sta_id].tid[tid].agg.state == |
1047 | IWL_EMPTYING_HW_QUEUE_ADDBA) { | 1044 | IWL_EMPTYING_HW_QUEUE_ADDBA) { |
1048 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | 1045 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); |
1049 | ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1046 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1050 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | 1047 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; |
1051 | return 0; | 1048 | return 0; |
1052 | } | 1049 | } |
@@ -1083,7 +1080,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1083 | tx_fifo_id); | 1080 | tx_fifo_id); |
1084 | spin_unlock_irqrestore(&priv->lock, flags); | 1081 | spin_unlock_irqrestore(&priv->lock, flags); |
1085 | 1082 | ||
1086 | ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid); | 1083 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1087 | 1084 | ||
1088 | return 0; | 1085 | return 0; |
1089 | } | 1086 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index ae476c234a7c..637286c396fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -52,6 +52,37 @@ static const s8 iwlagn_default_queue_to_tx_fifo[] = { | |||
52 | IWL_TX_FIFO_UNUSED, | 52 | IWL_TX_FIFO_UNUSED, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | ||
56 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, | ||
57 | 0, COEX_UNASSOC_IDLE_FLAGS}, | ||
58 | {COEX_CU_UNASSOC_MANUAL_SCAN_RP, COEX_CU_UNASSOC_MANUAL_SCAN_WP, | ||
59 | 0, COEX_UNASSOC_MANUAL_SCAN_FLAGS}, | ||
60 | {COEX_CU_UNASSOC_AUTO_SCAN_RP, COEX_CU_UNASSOC_AUTO_SCAN_WP, | ||
61 | 0, COEX_UNASSOC_AUTO_SCAN_FLAGS}, | ||
62 | {COEX_CU_CALIBRATION_RP, COEX_CU_CALIBRATION_WP, | ||
63 | 0, COEX_CALIBRATION_FLAGS}, | ||
64 | {COEX_CU_PERIODIC_CALIBRATION_RP, COEX_CU_PERIODIC_CALIBRATION_WP, | ||
65 | 0, COEX_PERIODIC_CALIBRATION_FLAGS}, | ||
66 | {COEX_CU_CONNECTION_ESTAB_RP, COEX_CU_CONNECTION_ESTAB_WP, | ||
67 | 0, COEX_CONNECTION_ESTAB_FLAGS}, | ||
68 | {COEX_CU_ASSOCIATED_IDLE_RP, COEX_CU_ASSOCIATED_IDLE_WP, | ||
69 | 0, COEX_ASSOCIATED_IDLE_FLAGS}, | ||
70 | {COEX_CU_ASSOC_MANUAL_SCAN_RP, COEX_CU_ASSOC_MANUAL_SCAN_WP, | ||
71 | 0, COEX_ASSOC_MANUAL_SCAN_FLAGS}, | ||
72 | {COEX_CU_ASSOC_AUTO_SCAN_RP, COEX_CU_ASSOC_AUTO_SCAN_WP, | ||
73 | 0, COEX_ASSOC_AUTO_SCAN_FLAGS}, | ||
74 | {COEX_CU_ASSOC_ACTIVE_LEVEL_RP, COEX_CU_ASSOC_ACTIVE_LEVEL_WP, | ||
75 | 0, COEX_ASSOC_ACTIVE_LEVEL_FLAGS}, | ||
76 | {COEX_CU_RF_ON_RP, COEX_CU_RF_ON_WP, 0, COEX_CU_RF_ON_FLAGS}, | ||
77 | {COEX_CU_RF_OFF_RP, COEX_CU_RF_OFF_WP, 0, COEX_RF_OFF_FLAGS}, | ||
78 | {COEX_CU_STAND_ALONE_DEBUG_RP, COEX_CU_STAND_ALONE_DEBUG_WP, | ||
79 | 0, COEX_STAND_ALONE_DEBUG_FLAGS}, | ||
80 | {COEX_CU_IPAN_ASSOC_LEVEL_RP, COEX_CU_IPAN_ASSOC_LEVEL_WP, | ||
81 | 0, COEX_IPAN_ASSOC_LEVEL_FLAGS}, | ||
82 | {COEX_CU_RSRVD1_RP, COEX_CU_RSRVD1_WP, 0, COEX_RSRVD1_FLAGS}, | ||
83 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} | ||
84 | }; | ||
85 | |||
55 | /* | 86 | /* |
56 | * ucode | 87 | * ucode |
57 | */ | 88 | */ |
@@ -151,55 +182,6 @@ int iwlagn_load_ucode(struct iwl_priv *priv) | |||
151 | return ret; | 182 | return ret; |
152 | } | 183 | } |
153 | 184 | ||
154 | #define IWL_UCODE_GET(item) \ | ||
155 | static u32 iwlagn_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
156 | u32 api_ver) \ | ||
157 | { \ | ||
158 | if (api_ver <= 2) \ | ||
159 | return le32_to_cpu(ucode->u.v1.item); \ | ||
160 | return le32_to_cpu(ucode->u.v2.item); \ | ||
161 | } | ||
162 | |||
163 | static u32 iwlagn_ucode_get_header_size(u32 api_ver) | ||
164 | { | ||
165 | if (api_ver <= 2) | ||
166 | return UCODE_HEADER_SIZE(1); | ||
167 | return UCODE_HEADER_SIZE(2); | ||
168 | } | ||
169 | |||
170 | static u32 iwlagn_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
171 | u32 api_ver) | ||
172 | { | ||
173 | if (api_ver <= 2) | ||
174 | return 0; | ||
175 | return le32_to_cpu(ucode->u.v2.build); | ||
176 | } | ||
177 | |||
178 | static u8 *iwlagn_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
179 | u32 api_ver) | ||
180 | { | ||
181 | if (api_ver <= 2) | ||
182 | return (u8 *) ucode->u.v1.data; | ||
183 | return (u8 *) ucode->u.v2.data; | ||
184 | } | ||
185 | |||
186 | IWL_UCODE_GET(inst_size); | ||
187 | IWL_UCODE_GET(data_size); | ||
188 | IWL_UCODE_GET(init_size); | ||
189 | IWL_UCODE_GET(init_data_size); | ||
190 | IWL_UCODE_GET(boot_size); | ||
191 | |||
192 | struct iwl_ucode_ops iwlagn_ucode = { | ||
193 | .get_header_size = iwlagn_ucode_get_header_size, | ||
194 | .get_build = iwlagn_ucode_get_build, | ||
195 | .get_inst_size = iwlagn_ucode_get_inst_size, | ||
196 | .get_data_size = iwlagn_ucode_get_data_size, | ||
197 | .get_init_size = iwlagn_ucode_get_init_size, | ||
198 | .get_init_data_size = iwlagn_ucode_get_init_data_size, | ||
199 | .get_boot_size = iwlagn_ucode_get_boot_size, | ||
200 | .get_data = iwlagn_ucode_get_data, | ||
201 | }; | ||
202 | |||
203 | /* | 185 | /* |
204 | * Calibration | 186 | * Calibration |
205 | */ | 187 | */ |
@@ -320,6 +302,33 @@ restart: | |||
320 | queue_work(priv->workqueue, &priv->restart); | 302 | queue_work(priv->workqueue, &priv->restart); |
321 | } | 303 | } |
322 | 304 | ||
305 | static int iwlagn_send_wimax_coex(struct iwl_priv *priv) | ||
306 | { | ||
307 | struct iwl_wimax_coex_cmd coex_cmd; | ||
308 | |||
309 | if (priv->cfg->support_wimax_coexist) { | ||
310 | /* UnMask wake up src at associated sleep */ | ||
311 | coex_cmd.flags = COEX_FLAGS_ASSOC_WA_UNMASK_MSK; | ||
312 | |||
313 | /* UnMask wake up src at unassociated sleep */ | ||
314 | coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK; | ||
315 | memcpy(coex_cmd.sta_prio, cu_priorities, | ||
316 | sizeof(struct iwl_wimax_coex_event_entry) * | ||
317 | COEX_NUM_OF_EVENTS); | ||
318 | |||
319 | /* enabling the coexistence feature */ | ||
320 | coex_cmd.flags |= COEX_FLAGS_COEX_ENABLE_MSK; | ||
321 | |||
322 | /* enabling the priorities tables */ | ||
323 | coex_cmd.flags |= COEX_FLAGS_STA_TABLE_VALID_MSK; | ||
324 | } else { | ||
325 | /* coexistence is disabled */ | ||
326 | memset(&coex_cmd, 0, sizeof(coex_cmd)); | ||
327 | } | ||
328 | return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD, | ||
329 | sizeof(coex_cmd), &coex_cmd); | ||
330 | } | ||
331 | |||
323 | int iwlagn_alive_notify(struct iwl_priv *priv) | 332 | int iwlagn_alive_notify(struct iwl_priv *priv) |
324 | { | 333 | { |
325 | u32 a; | 334 | u32 a; |
@@ -407,7 +416,7 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
407 | 416 | ||
408 | spin_unlock_irqrestore(&priv->lock, flags); | 417 | spin_unlock_irqrestore(&priv->lock, flags); |
409 | 418 | ||
410 | iwl_send_wimax_coex(priv); | 419 | iwlagn_send_wimax_coex(priv); |
411 | 420 | ||
412 | iwlagn_set_Xtal_calib(priv); | 421 | iwlagn_set_Xtal_calib(priv); |
413 | iwl_send_calib_results(priv); | 422 | iwl_send_calib_results(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index cc15e929a987..aef4f71f1981 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -157,7 +157,7 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
157 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); | 157 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); |
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | iwl_clear_ucode_stations(priv, false); | 160 | iwl_clear_ucode_stations(priv); |
161 | iwl_restore_stations(priv); | 161 | iwl_restore_stations(priv); |
162 | ret = iwl_restore_default_wep_keys(priv); | 162 | ret = iwl_restore_default_wep_keys(priv); |
163 | if (ret) { | 163 | if (ret) { |
@@ -189,7 +189,7 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
189 | } | 189 | } |
190 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); | 190 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); |
191 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 191 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); |
192 | iwl_clear_ucode_stations(priv, false); | 192 | iwl_clear_ucode_stations(priv); |
193 | iwl_restore_stations(priv); | 193 | iwl_restore_stations(priv); |
194 | ret = iwl_restore_default_wep_keys(priv); | 194 | ret = iwl_restore_default_wep_keys(priv); |
195 | if (ret) { | 195 | if (ret) { |
@@ -1506,9 +1506,13 @@ static void iwl_nic_start(struct iwl_priv *priv) | |||
1506 | iwl_write32(priv, CSR_RESET, 0); | 1506 | iwl_write32(priv, CSR_RESET, 0); |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | struct iwlagn_ucode_capabilities { | ||
1510 | u32 max_probe_length; | ||
1511 | }; | ||
1509 | 1512 | ||
1510 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | 1513 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); |
1511 | static int iwl_mac_setup_register(struct iwl_priv *priv); | 1514 | static int iwl_mac_setup_register(struct iwl_priv *priv, |
1515 | struct iwlagn_ucode_capabilities *capa); | ||
1512 | 1516 | ||
1513 | static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | 1517 | static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) |
1514 | { | 1518 | { |
@@ -1535,6 +1539,199 @@ static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | |||
1535 | iwl_ucode_callback); | 1539 | iwl_ucode_callback); |
1536 | } | 1540 | } |
1537 | 1541 | ||
1542 | struct iwlagn_firmware_pieces { | ||
1543 | const void *inst, *data, *init, *init_data, *boot; | ||
1544 | size_t inst_size, data_size, init_size, init_data_size, boot_size; | ||
1545 | |||
1546 | u32 build; | ||
1547 | }; | ||
1548 | |||
1549 | static int iwlagn_load_legacy_firmware(struct iwl_priv *priv, | ||
1550 | const struct firmware *ucode_raw, | ||
1551 | struct iwlagn_firmware_pieces *pieces) | ||
1552 | { | ||
1553 | struct iwl_ucode_header *ucode = (void *)ucode_raw->data; | ||
1554 | u32 api_ver, hdr_size; | ||
1555 | const u8 *src; | ||
1556 | |||
1557 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
1558 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
1559 | |||
1560 | switch (api_ver) { | ||
1561 | default: | ||
1562 | /* | ||
1563 | * 4965 doesn't revision the firmware file format | ||
1564 | * along with the API version, it always uses v1 | ||
1565 | * file format. | ||
1566 | */ | ||
1567 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != | ||
1568 | CSR_HW_REV_TYPE_4965) { | ||
1569 | hdr_size = 28; | ||
1570 | if (ucode_raw->size < hdr_size) { | ||
1571 | IWL_ERR(priv, "File size too small!\n"); | ||
1572 | return -EINVAL; | ||
1573 | } | ||
1574 | pieces->build = le32_to_cpu(ucode->u.v2.build); | ||
1575 | pieces->inst_size = le32_to_cpu(ucode->u.v2.inst_size); | ||
1576 | pieces->data_size = le32_to_cpu(ucode->u.v2.data_size); | ||
1577 | pieces->init_size = le32_to_cpu(ucode->u.v2.init_size); | ||
1578 | pieces->init_data_size = le32_to_cpu(ucode->u.v2.init_data_size); | ||
1579 | pieces->boot_size = le32_to_cpu(ucode->u.v2.boot_size); | ||
1580 | src = ucode->u.v2.data; | ||
1581 | break; | ||
1582 | } | ||
1583 | /* fall through for 4965 */ | ||
1584 | case 0: | ||
1585 | case 1: | ||
1586 | case 2: | ||
1587 | hdr_size = 24; | ||
1588 | if (ucode_raw->size < hdr_size) { | ||
1589 | IWL_ERR(priv, "File size too small!\n"); | ||
1590 | return -EINVAL; | ||
1591 | } | ||
1592 | pieces->build = 0; | ||
1593 | pieces->inst_size = le32_to_cpu(ucode->u.v1.inst_size); | ||
1594 | pieces->data_size = le32_to_cpu(ucode->u.v1.data_size); | ||
1595 | pieces->init_size = le32_to_cpu(ucode->u.v1.init_size); | ||
1596 | pieces->init_data_size = le32_to_cpu(ucode->u.v1.init_data_size); | ||
1597 | pieces->boot_size = le32_to_cpu(ucode->u.v1.boot_size); | ||
1598 | src = ucode->u.v1.data; | ||
1599 | break; | ||
1600 | } | ||
1601 | |||
1602 | /* Verify size of file vs. image size info in file's header */ | ||
1603 | if (ucode_raw->size != hdr_size + pieces->inst_size + | ||
1604 | pieces->data_size + pieces->init_size + | ||
1605 | pieces->init_data_size + pieces->boot_size) { | ||
1606 | |||
1607 | IWL_ERR(priv, | ||
1608 | "uCode file size %d does not match expected size\n", | ||
1609 | (int)ucode_raw->size); | ||
1610 | return -EINVAL; | ||
1611 | } | ||
1612 | |||
1613 | pieces->inst = src; | ||
1614 | src += pieces->inst_size; | ||
1615 | pieces->data = src; | ||
1616 | src += pieces->data_size; | ||
1617 | pieces->init = src; | ||
1618 | src += pieces->init_size; | ||
1619 | pieces->init_data = src; | ||
1620 | src += pieces->init_data_size; | ||
1621 | pieces->boot = src; | ||
1622 | src += pieces->boot_size; | ||
1623 | |||
1624 | return 0; | ||
1625 | } | ||
1626 | |||
1627 | static int iwlagn_wanted_ucode_alternative = 1; | ||
1628 | |||
1629 | static int iwlagn_load_firmware(struct iwl_priv *priv, | ||
1630 | const struct firmware *ucode_raw, | ||
1631 | struct iwlagn_firmware_pieces *pieces, | ||
1632 | struct iwlagn_ucode_capabilities *capa) | ||
1633 | { | ||
1634 | struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; | ||
1635 | struct iwl_ucode_tlv *tlv; | ||
1636 | size_t len = ucode_raw->size; | ||
1637 | const u8 *data; | ||
1638 | int wanted_alternative = iwlagn_wanted_ucode_alternative, tmp; | ||
1639 | u64 alternatives; | ||
1640 | |||
1641 | if (len < sizeof(*ucode)) | ||
1642 | return -EINVAL; | ||
1643 | |||
1644 | if (ucode->magic != cpu_to_le32(IWL_TLV_UCODE_MAGIC)) | ||
1645 | return -EINVAL; | ||
1646 | |||
1647 | /* | ||
1648 | * Check which alternatives are present, and "downgrade" | ||
1649 | * when the chosen alternative is not present, warning | ||
1650 | * the user when that happens. Some files may not have | ||
1651 | * any alternatives, so don't warn in that case. | ||
1652 | */ | ||
1653 | alternatives = le64_to_cpu(ucode->alternatives); | ||
1654 | tmp = wanted_alternative; | ||
1655 | if (wanted_alternative > 63) | ||
1656 | wanted_alternative = 63; | ||
1657 | while (wanted_alternative && !(alternatives & BIT(wanted_alternative))) | ||
1658 | wanted_alternative--; | ||
1659 | if (wanted_alternative && wanted_alternative != tmp) | ||
1660 | IWL_WARN(priv, | ||
1661 | "uCode alternative %d not available, choosing %d\n", | ||
1662 | tmp, wanted_alternative); | ||
1663 | |||
1664 | priv->ucode_ver = le32_to_cpu(ucode->ver); | ||
1665 | pieces->build = le32_to_cpu(ucode->build); | ||
1666 | data = ucode->data; | ||
1667 | |||
1668 | len -= sizeof(*ucode); | ||
1669 | |||
1670 | while (len >= sizeof(*tlv)) { | ||
1671 | u32 tlv_len; | ||
1672 | enum iwl_ucode_tlv_type tlv_type; | ||
1673 | u16 tlv_alt; | ||
1674 | const u8 *tlv_data; | ||
1675 | |||
1676 | len -= sizeof(*tlv); | ||
1677 | tlv = (void *)data; | ||
1678 | |||
1679 | tlv_len = le32_to_cpu(tlv->length); | ||
1680 | tlv_type = le16_to_cpu(tlv->type); | ||
1681 | tlv_alt = le16_to_cpu(tlv->alternative); | ||
1682 | tlv_data = tlv->data; | ||
1683 | |||
1684 | if (len < tlv_len) | ||
1685 | return -EINVAL; | ||
1686 | len -= ALIGN(tlv_len, 4); | ||
1687 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); | ||
1688 | |||
1689 | /* | ||
1690 | * Alternative 0 is always valid. | ||
1691 | * | ||
1692 | * Skip alternative TLVs that are not selected. | ||
1693 | */ | ||
1694 | if (tlv_alt != 0 && tlv_alt != wanted_alternative) | ||
1695 | continue; | ||
1696 | |||
1697 | switch (tlv_type) { | ||
1698 | case IWL_UCODE_TLV_INST: | ||
1699 | pieces->inst = tlv_data; | ||
1700 | pieces->inst_size = tlv_len; | ||
1701 | break; | ||
1702 | case IWL_UCODE_TLV_DATA: | ||
1703 | pieces->data = tlv_data; | ||
1704 | pieces->data_size = tlv_len; | ||
1705 | break; | ||
1706 | case IWL_UCODE_TLV_INIT: | ||
1707 | pieces->init = tlv_data; | ||
1708 | pieces->init_size = tlv_len; | ||
1709 | break; | ||
1710 | case IWL_UCODE_TLV_INIT_DATA: | ||
1711 | pieces->init_data = tlv_data; | ||
1712 | pieces->init_data_size = tlv_len; | ||
1713 | break; | ||
1714 | case IWL_UCODE_TLV_BOOT: | ||
1715 | pieces->boot = tlv_data; | ||
1716 | pieces->boot_size = tlv_len; | ||
1717 | break; | ||
1718 | case IWL_UCODE_TLV_PROBE_MAX_LEN: | ||
1719 | if (tlv_len != 4) | ||
1720 | return -EINVAL; | ||
1721 | capa->max_probe_length = | ||
1722 | le32_to_cpup((__le32 *)tlv_data); | ||
1723 | break; | ||
1724 | default: | ||
1725 | break; | ||
1726 | } | ||
1727 | } | ||
1728 | |||
1729 | if (len) | ||
1730 | return -EINVAL; | ||
1731 | |||
1732 | return 0; | ||
1733 | } | ||
1734 | |||
1538 | /** | 1735 | /** |
1539 | * iwl_ucode_callback - callback when firmware was loaded | 1736 | * iwl_ucode_callback - callback when firmware was loaded |
1540 | * | 1737 | * |
@@ -1545,14 +1742,18 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1545 | { | 1742 | { |
1546 | struct iwl_priv *priv = context; | 1743 | struct iwl_priv *priv = context; |
1547 | struct iwl_ucode_header *ucode; | 1744 | struct iwl_ucode_header *ucode; |
1745 | int err; | ||
1746 | struct iwlagn_firmware_pieces pieces; | ||
1548 | const unsigned int api_max = priv->cfg->ucode_api_max; | 1747 | const unsigned int api_max = priv->cfg->ucode_api_max; |
1549 | const unsigned int api_min = priv->cfg->ucode_api_min; | 1748 | const unsigned int api_min = priv->cfg->ucode_api_min; |
1550 | u8 *src; | 1749 | u32 api_ver; |
1551 | size_t len; | 1750 | char buildstr[25]; |
1552 | u32 api_ver, build; | 1751 | u32 build; |
1553 | u32 inst_size, data_size, init_size, init_data_size, boot_size; | 1752 | struct iwlagn_ucode_capabilities ucode_capa = { |
1554 | int err; | 1753 | .max_probe_length = 200, |
1555 | u16 eeprom_ver; | 1754 | }; |
1755 | |||
1756 | memset(&pieces, 0, sizeof(pieces)); | ||
1556 | 1757 | ||
1557 | if (!ucode_raw) { | 1758 | if (!ucode_raw) { |
1558 | IWL_ERR(priv, "request for firmware file '%s' failed.\n", | 1759 | IWL_ERR(priv, "request for firmware file '%s' failed.\n", |
@@ -1563,8 +1764,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1563 | IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", | 1764 | IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", |
1564 | priv->firmware_name, ucode_raw->size); | 1765 | priv->firmware_name, ucode_raw->size); |
1565 | 1766 | ||
1566 | /* Make sure that we got at least the v1 header! */ | 1767 | /* Make sure that we got at least the API version number */ |
1567 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 1768 | if (ucode_raw->size < 4) { |
1568 | IWL_ERR(priv, "File size way too small!\n"); | 1769 | IWL_ERR(priv, "File size way too small!\n"); |
1569 | goto try_again; | 1770 | goto try_again; |
1570 | } | 1771 | } |
@@ -1572,21 +1773,23 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1572 | /* Data from ucode file: header followed by uCode images */ | 1773 | /* Data from ucode file: header followed by uCode images */ |
1573 | ucode = (struct iwl_ucode_header *)ucode_raw->data; | 1774 | ucode = (struct iwl_ucode_header *)ucode_raw->data; |
1574 | 1775 | ||
1575 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 1776 | if (ucode->ver) |
1777 | err = iwlagn_load_legacy_firmware(priv, ucode_raw, &pieces); | ||
1778 | else | ||
1779 | err = iwlagn_load_firmware(priv, ucode_raw, &pieces, | ||
1780 | &ucode_capa); | ||
1781 | |||
1782 | if (err) | ||
1783 | goto try_again; | ||
1784 | |||
1576 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 1785 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
1577 | build = priv->cfg->ops->ucode->get_build(ucode, api_ver); | 1786 | build = pieces.build; |
1578 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | ||
1579 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | ||
1580 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | ||
1581 | init_data_size = | ||
1582 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | ||
1583 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | ||
1584 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
1585 | |||
1586 | /* api_ver should match the api version forming part of the | ||
1587 | * firmware filename ... but we don't check for that and only rely | ||
1588 | * on the API version read from firmware header from here on forward */ | ||
1589 | 1787 | ||
1788 | /* | ||
1789 | * api_ver should match the api version forming part of the | ||
1790 | * firmware filename ... but we don't check for that and only rely | ||
1791 | * on the API version read from firmware header from here on forward | ||
1792 | */ | ||
1590 | if (api_ver < api_min || api_ver > api_max) { | 1793 | if (api_ver < api_min || api_ver > api_max) { |
1591 | IWL_ERR(priv, "Driver unable to support your firmware API. " | 1794 | IWL_ERR(priv, "Driver unable to support your firmware API. " |
1592 | "Driver supports v%u, firmware is v%u.\n", | 1795 | "Driver supports v%u, firmware is v%u.\n", |
@@ -1600,40 +1803,26 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1600 | "from http://www.intellinuxwireless.org.\n", | 1803 | "from http://www.intellinuxwireless.org.\n", |
1601 | api_max, api_ver); | 1804 | api_max, api_ver); |
1602 | 1805 | ||
1603 | IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", | 1806 | if (build) |
1604 | IWL_UCODE_MAJOR(priv->ucode_ver), | 1807 | sprintf(buildstr, " build %u", build); |
1605 | IWL_UCODE_MINOR(priv->ucode_ver), | 1808 | else |
1606 | IWL_UCODE_API(priv->ucode_ver), | 1809 | buildstr[0] = '\0'; |
1607 | IWL_UCODE_SERIAL(priv->ucode_ver)); | 1810 | |
1811 | IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u%s\n", | ||
1812 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
1813 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
1814 | IWL_UCODE_API(priv->ucode_ver), | ||
1815 | IWL_UCODE_SERIAL(priv->ucode_ver), | ||
1816 | buildstr); | ||
1608 | 1817 | ||
1609 | snprintf(priv->hw->wiphy->fw_version, | 1818 | snprintf(priv->hw->wiphy->fw_version, |
1610 | sizeof(priv->hw->wiphy->fw_version), | 1819 | sizeof(priv->hw->wiphy->fw_version), |
1611 | "%u.%u.%u.%u", | 1820 | "%u.%u.%u.%u%s", |
1612 | IWL_UCODE_MAJOR(priv->ucode_ver), | 1821 | IWL_UCODE_MAJOR(priv->ucode_ver), |
1613 | IWL_UCODE_MINOR(priv->ucode_ver), | 1822 | IWL_UCODE_MINOR(priv->ucode_ver), |
1614 | IWL_UCODE_API(priv->ucode_ver), | 1823 | IWL_UCODE_API(priv->ucode_ver), |
1615 | IWL_UCODE_SERIAL(priv->ucode_ver)); | 1824 | IWL_UCODE_SERIAL(priv->ucode_ver), |
1616 | 1825 | buildstr); | |
1617 | if (build) | ||
1618 | IWL_DEBUG_INFO(priv, "Build %u\n", build); | ||
1619 | |||
1620 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | ||
1621 | IWL_DEBUG_INFO(priv, "NVM Type: %s, version: 0x%x\n", | ||
1622 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | ||
1623 | ? "OTP" : "EEPROM", eeprom_ver); | ||
1624 | |||
1625 | IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", | ||
1626 | priv->ucode_ver); | ||
1627 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", | ||
1628 | inst_size); | ||
1629 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", | ||
1630 | data_size); | ||
1631 | IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", | ||
1632 | init_size); | ||
1633 | IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", | ||
1634 | init_data_size); | ||
1635 | IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", | ||
1636 | boot_size); | ||
1637 | 1826 | ||
1638 | /* | 1827 | /* |
1639 | * For any of the failures below (before allocating pci memory) | 1828 | * For any of the failures below (before allocating pci memory) |
@@ -1641,43 +1830,47 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1641 | * user just got a corrupted version of the latest API. | 1830 | * user just got a corrupted version of the latest API. |
1642 | */ | 1831 | */ |
1643 | 1832 | ||
1644 | /* Verify size of file vs. image size info in file's header */ | 1833 | IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", |
1645 | if (ucode_raw->size != | 1834 | priv->ucode_ver); |
1646 | priv->cfg->ops->ucode->get_header_size(api_ver) + | 1835 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", |
1647 | inst_size + data_size + init_size + | 1836 | pieces.inst_size); |
1648 | init_data_size + boot_size) { | 1837 | IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", |
1649 | 1838 | pieces.data_size); | |
1650 | IWL_DEBUG_INFO(priv, | 1839 | IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", |
1651 | "uCode file size %d does not match expected size\n", | 1840 | pieces.init_size); |
1652 | (int)ucode_raw->size); | 1841 | IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", |
1653 | goto try_again; | 1842 | pieces.init_data_size); |
1654 | } | 1843 | IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", |
1844 | pieces.boot_size); | ||
1655 | 1845 | ||
1656 | /* Verify that uCode images will fit in card's SRAM */ | 1846 | /* Verify that uCode images will fit in card's SRAM */ |
1657 | if (inst_size > priv->hw_params.max_inst_size) { | 1847 | if (pieces.inst_size > priv->hw_params.max_inst_size) { |
1658 | IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", | 1848 | IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", |
1659 | inst_size); | 1849 | pieces.inst_size); |
1660 | goto try_again; | 1850 | goto try_again; |
1661 | } | 1851 | } |
1662 | 1852 | ||
1663 | if (data_size > priv->hw_params.max_data_size) { | 1853 | if (pieces.data_size > priv->hw_params.max_data_size) { |
1664 | IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", | 1854 | IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", |
1665 | data_size); | 1855 | pieces.data_size); |
1666 | goto try_again; | 1856 | goto try_again; |
1667 | } | 1857 | } |
1668 | if (init_size > priv->hw_params.max_inst_size) { | 1858 | |
1669 | IWL_INFO(priv, "uCode init instr len %d too large to fit in\n", | 1859 | if (pieces.init_size > priv->hw_params.max_inst_size) { |
1670 | init_size); | 1860 | IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", |
1861 | pieces.init_size); | ||
1671 | goto try_again; | 1862 | goto try_again; |
1672 | } | 1863 | } |
1673 | if (init_data_size > priv->hw_params.max_data_size) { | 1864 | |
1674 | IWL_INFO(priv, "uCode init data len %d too large to fit in\n", | 1865 | if (pieces.init_data_size > priv->hw_params.max_data_size) { |
1675 | init_data_size); | 1866 | IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", |
1867 | pieces.init_data_size); | ||
1676 | goto try_again; | 1868 | goto try_again; |
1677 | } | 1869 | } |
1678 | if (boot_size > priv->hw_params.max_bsm_size) { | 1870 | |
1679 | IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n", | 1871 | if (pieces.boot_size > priv->hw_params.max_bsm_size) { |
1680 | boot_size); | 1872 | IWL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", |
1873 | pieces.boot_size); | ||
1681 | goto try_again; | 1874 | goto try_again; |
1682 | } | 1875 | } |
1683 | 1876 | ||
@@ -1686,13 +1879,13 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1686 | /* Runtime instructions and 2 copies of data: | 1879 | /* Runtime instructions and 2 copies of data: |
1687 | * 1) unmodified from disk | 1880 | * 1) unmodified from disk |
1688 | * 2) backup cache for save/restore during power-downs */ | 1881 | * 2) backup cache for save/restore during power-downs */ |
1689 | priv->ucode_code.len = inst_size; | 1882 | priv->ucode_code.len = pieces.inst_size; |
1690 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); | 1883 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); |
1691 | 1884 | ||
1692 | priv->ucode_data.len = data_size; | 1885 | priv->ucode_data.len = pieces.data_size; |
1693 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); | 1886 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); |
1694 | 1887 | ||
1695 | priv->ucode_data_backup.len = data_size; | 1888 | priv->ucode_data_backup.len = pieces.data_size; |
1696 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 1889 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); |
1697 | 1890 | ||
1698 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || | 1891 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || |
@@ -1700,11 +1893,11 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1700 | goto err_pci_alloc; | 1893 | goto err_pci_alloc; |
1701 | 1894 | ||
1702 | /* Initialization instructions and data */ | 1895 | /* Initialization instructions and data */ |
1703 | if (init_size && init_data_size) { | 1896 | if (pieces.init_size && pieces.init_data_size) { |
1704 | priv->ucode_init.len = init_size; | 1897 | priv->ucode_init.len = pieces.init_size; |
1705 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); | 1898 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); |
1706 | 1899 | ||
1707 | priv->ucode_init_data.len = init_data_size; | 1900 | priv->ucode_init_data.len = pieces.init_data_size; |
1708 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 1901 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); |
1709 | 1902 | ||
1710 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) | 1903 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) |
@@ -1712,8 +1905,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1712 | } | 1905 | } |
1713 | 1906 | ||
1714 | /* Bootstrap (instructions only, no data) */ | 1907 | /* Bootstrap (instructions only, no data) */ |
1715 | if (boot_size) { | 1908 | if (pieces.boot_size) { |
1716 | priv->ucode_boot.len = boot_size; | 1909 | priv->ucode_boot.len = pieces.boot_size; |
1717 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1910 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); |
1718 | 1911 | ||
1719 | if (!priv->ucode_boot.v_addr) | 1912 | if (!priv->ucode_boot.v_addr) |
@@ -1723,51 +1916,48 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1723 | /* Copy images into buffers for card's bus-master reads ... */ | 1916 | /* Copy images into buffers for card's bus-master reads ... */ |
1724 | 1917 | ||
1725 | /* Runtime instructions (first block of data in file) */ | 1918 | /* Runtime instructions (first block of data in file) */ |
1726 | len = inst_size; | 1919 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", |
1727 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", len); | 1920 | pieces.inst_size); |
1728 | memcpy(priv->ucode_code.v_addr, src, len); | 1921 | memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); |
1729 | src += len; | ||
1730 | 1922 | ||
1731 | IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", | 1923 | IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", |
1732 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); | 1924 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); |
1733 | 1925 | ||
1734 | /* Runtime data (2nd block) | 1926 | /* |
1735 | * NOTE: Copy into backup buffer will be done in iwl_up() */ | 1927 | * Runtime data |
1736 | len = data_size; | 1928 | * NOTE: Copy into backup buffer will be done in iwl_up() |
1737 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", len); | 1929 | */ |
1738 | memcpy(priv->ucode_data.v_addr, src, len); | 1930 | IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", |
1739 | memcpy(priv->ucode_data_backup.v_addr, src, len); | 1931 | pieces.data_size); |
1740 | src += len; | 1932 | memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); |
1741 | 1933 | memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); | |
1742 | /* Initialization instructions (3rd block) */ | 1934 | |
1743 | if (init_size) { | 1935 | /* Initialization instructions */ |
1744 | len = init_size; | 1936 | if (pieces.init_size) { |
1745 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n", | 1937 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n", |
1746 | len); | 1938 | pieces.init_size); |
1747 | memcpy(priv->ucode_init.v_addr, src, len); | 1939 | memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size); |
1748 | src += len; | ||
1749 | } | 1940 | } |
1750 | 1941 | ||
1751 | /* Initialization data (4th block) */ | 1942 | /* Initialization data */ |
1752 | if (init_data_size) { | 1943 | if (pieces.init_data_size) { |
1753 | len = init_data_size; | ||
1754 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n", | 1944 | IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n", |
1755 | len); | 1945 | pieces.init_data_size); |
1756 | memcpy(priv->ucode_init_data.v_addr, src, len); | 1946 | memcpy(priv->ucode_init_data.v_addr, pieces.init_data, |
1757 | src += len; | 1947 | pieces.init_data_size); |
1758 | } | 1948 | } |
1759 | 1949 | ||
1760 | /* Bootstrap instructions (5th block) */ | 1950 | /* Bootstrap instructions */ |
1761 | len = boot_size; | 1951 | IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", |
1762 | IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len); | 1952 | pieces.boot_size); |
1763 | memcpy(priv->ucode_boot.v_addr, src, len); | 1953 | memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); |
1764 | 1954 | ||
1765 | /************************************************** | 1955 | /************************************************** |
1766 | * This is still part of probe() in a sense... | 1956 | * This is still part of probe() in a sense... |
1767 | * | 1957 | * |
1768 | * 9. Setup and register with mac80211 and debugfs | 1958 | * 9. Setup and register with mac80211 and debugfs |
1769 | **************************************************/ | 1959 | **************************************************/ |
1770 | err = iwl_mac_setup_register(priv); | 1960 | err = iwl_mac_setup_register(priv, &ucode_capa); |
1771 | if (err) | 1961 | if (err) |
1772 | goto out_unbind; | 1962 | goto out_unbind; |
1773 | 1963 | ||
@@ -1777,6 +1967,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1777 | 1967 | ||
1778 | /* We have our copies now, allow OS release its copies */ | 1968 | /* We have our copies now, allow OS release its copies */ |
1779 | release_firmware(ucode_raw); | 1969 | release_firmware(ucode_raw); |
1970 | complete(&priv->_agn.firmware_loading_complete); | ||
1780 | return; | 1971 | return; |
1781 | 1972 | ||
1782 | try_again: | 1973 | try_again: |
@@ -1790,6 +1981,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1790 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1981 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1791 | iwl_dealloc_ucode_pci(priv); | 1982 | iwl_dealloc_ucode_pci(priv); |
1792 | out_unbind: | 1983 | out_unbind: |
1984 | complete(&priv->_agn.firmware_loading_complete); | ||
1793 | device_release_driver(&priv->pci_dev->dev); | 1985 | device_release_driver(&priv->pci_dev->dev); |
1794 | release_firmware(ucode_raw); | 1986 | release_firmware(ucode_raw); |
1795 | } | 1987 | } |
@@ -2165,7 +2357,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2165 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2357 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2166 | } else { | 2358 | } else { |
2167 | /* Initialize our rx_config data */ | 2359 | /* Initialize our rx_config data */ |
2168 | iwl_connection_init_rx_config(priv, priv->iw_mode); | 2360 | iwl_connection_init_rx_config(priv, NULL); |
2169 | 2361 | ||
2170 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2362 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2171 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2363 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -2212,7 +2404,9 @@ static void __iwl_down(struct iwl_priv *priv) | |||
2212 | if (!exit_pending) | 2404 | if (!exit_pending) |
2213 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2405 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2214 | 2406 | ||
2215 | iwl_clear_ucode_stations(priv, true); | 2407 | iwl_clear_ucode_stations(priv); |
2408 | iwl_dealloc_bcast_station(priv); | ||
2409 | iwl_clear_driver_stations(priv); | ||
2216 | 2410 | ||
2217 | /* Unblock any waiting calls */ | 2411 | /* Unblock any waiting calls */ |
2218 | wake_up_interruptible_all(&priv->wait_command_queue); | 2412 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -2359,6 +2553,10 @@ static int __iwl_up(struct iwl_priv *priv) | |||
2359 | return -EIO; | 2553 | return -EIO; |
2360 | } | 2554 | } |
2361 | 2555 | ||
2556 | ret = iwl_alloc_bcast_station(priv, true); | ||
2557 | if (ret) | ||
2558 | return ret; | ||
2559 | |||
2362 | iwl_prepare_card_hw(priv); | 2560 | iwl_prepare_card_hw(priv); |
2363 | 2561 | ||
2364 | if (!priv->hw_ready) { | 2562 | if (!priv->hw_ready) { |
@@ -2537,12 +2735,15 @@ static void iwl_bg_rx_replenish(struct work_struct *data) | |||
2537 | 2735 | ||
2538 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 2736 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
2539 | 2737 | ||
2540 | void iwl_post_associate(struct iwl_priv *priv) | 2738 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2541 | { | 2739 | { |
2542 | struct ieee80211_conf *conf = NULL; | 2740 | struct ieee80211_conf *conf = NULL; |
2543 | int ret = 0; | 2741 | int ret = 0; |
2544 | 2742 | ||
2545 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 2743 | if (!vif || !priv->is_open) |
2744 | return; | ||
2745 | |||
2746 | if (vif->type == NL80211_IFTYPE_AP) { | ||
2546 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); | 2747 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); |
2547 | return; | 2748 | return; |
2548 | } | 2749 | } |
@@ -2550,10 +2751,6 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2550 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2751 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2551 | return; | 2752 | return; |
2552 | 2753 | ||
2553 | |||
2554 | if (!priv->vif || !priv->is_open) | ||
2555 | return; | ||
2556 | |||
2557 | iwl_scan_cancel_timeout(priv, 200); | 2754 | iwl_scan_cancel_timeout(priv, 200); |
2558 | 2755 | ||
2559 | conf = ieee80211_get_hw_conf(priv->hw); | 2756 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -2561,7 +2758,7 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2561 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2758 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2562 | iwlcore_commit_rxon(priv); | 2759 | iwlcore_commit_rxon(priv); |
2563 | 2760 | ||
2564 | iwl_setup_rxon_timing(priv); | 2761 | iwl_setup_rxon_timing(priv, vif); |
2565 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 2762 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2566 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 2763 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2567 | if (ret) | 2764 | if (ret) |
@@ -2575,49 +2772,41 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2575 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2772 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2576 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2773 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
2577 | 2774 | ||
2578 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 2775 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
2579 | 2776 | ||
2580 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 2777 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
2581 | priv->assoc_id, priv->beacon_int); | 2778 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
2582 | 2779 | ||
2583 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 2780 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
2584 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2781 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
2585 | else | 2782 | else |
2586 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 2783 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
2587 | 2784 | ||
2588 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 2785 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
2589 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 2786 | if (vif->bss_conf.assoc_capability & |
2787 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | ||
2590 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 2788 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
2591 | else | 2789 | else |
2592 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2790 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2593 | 2791 | ||
2594 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 2792 | if (vif->type == NL80211_IFTYPE_ADHOC) |
2595 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2793 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2596 | |||
2597 | } | 2794 | } |
2598 | 2795 | ||
2599 | iwlcore_commit_rxon(priv); | 2796 | iwlcore_commit_rxon(priv); |
2600 | 2797 | ||
2601 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 2798 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
2602 | priv->assoc_id, priv->active_rxon.bssid_addr); | 2799 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); |
2603 | 2800 | ||
2604 | switch (priv->iw_mode) { | 2801 | switch (vif->type) { |
2605 | case NL80211_IFTYPE_STATION: | 2802 | case NL80211_IFTYPE_STATION: |
2606 | break; | 2803 | break; |
2607 | |||
2608 | case NL80211_IFTYPE_ADHOC: | 2804 | case NL80211_IFTYPE_ADHOC: |
2609 | |||
2610 | /* assume default assoc id */ | ||
2611 | priv->assoc_id = 1; | ||
2612 | |||
2613 | iwl_add_local_station(priv, priv->bssid, true); | ||
2614 | iwl_send_beacon_cmd(priv); | 2805 | iwl_send_beacon_cmd(priv); |
2615 | |||
2616 | break; | 2806 | break; |
2617 | |||
2618 | default: | 2807 | default: |
2619 | IWL_ERR(priv, "%s Should not be called in %d mode\n", | 2808 | IWL_ERR(priv, "%s Should not be called in %d mode\n", |
2620 | __func__, priv->iw_mode); | 2809 | __func__, vif->type); |
2621 | break; | 2810 | break; |
2622 | } | 2811 | } |
2623 | 2812 | ||
@@ -2645,7 +2834,8 @@ void iwl_post_associate(struct iwl_priv *priv) | |||
2645 | * Not a mac80211 entry point function, but it fits in with all the | 2834 | * Not a mac80211 entry point function, but it fits in with all the |
2646 | * other mac80211 functions grouped here. | 2835 | * other mac80211 functions grouped here. |
2647 | */ | 2836 | */ |
2648 | static int iwl_mac_setup_register(struct iwl_priv *priv) | 2837 | static int iwl_mac_setup_register(struct iwl_priv *priv, |
2838 | struct iwlagn_ucode_capabilities *capa) | ||
2649 | { | 2839 | { |
2650 | int ret; | 2840 | int ret; |
2651 | struct ieee80211_hw *hw = priv->hw; | 2841 | struct ieee80211_hw *hw = priv->hw; |
@@ -2665,6 +2855,8 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) | |||
2665 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 2855 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
2666 | 2856 | ||
2667 | hw->sta_data_size = sizeof(struct iwl_station_priv); | 2857 | hw->sta_data_size = sizeof(struct iwl_station_priv); |
2858 | hw->vif_data_size = sizeof(struct iwl_vif_priv); | ||
2859 | |||
2668 | hw->wiphy->interface_modes = | 2860 | hw->wiphy->interface_modes = |
2669 | BIT(NL80211_IFTYPE_STATION) | | 2861 | BIT(NL80211_IFTYPE_STATION) | |
2670 | BIT(NL80211_IFTYPE_ADHOC); | 2862 | BIT(NL80211_IFTYPE_ADHOC); |
@@ -2680,7 +2872,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv) | |||
2680 | 2872 | ||
2681 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | 2873 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; |
2682 | /* we create the 802.11 header and a zero-length SSID element */ | 2874 | /* we create the 802.11 header and a zero-length SSID element */ |
2683 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 2875 | hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 2; |
2684 | 2876 | ||
2685 | /* Default value; 4 EDCA QOS priorities */ | 2877 | /* Default value; 4 EDCA QOS priorities */ |
2686 | hw->queues = 4; | 2878 | hw->queues = 4; |
@@ -2793,7 +2985,7 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2793 | return NETDEV_TX_OK; | 2985 | return NETDEV_TX_OK; |
2794 | } | 2986 | } |
2795 | 2987 | ||
2796 | void iwl_config_ap(struct iwl_priv *priv) | 2988 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2797 | { | 2989 | { |
2798 | int ret = 0; | 2990 | int ret = 0; |
2799 | 2991 | ||
@@ -2808,7 +3000,7 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2808 | iwlcore_commit_rxon(priv); | 3000 | iwlcore_commit_rxon(priv); |
2809 | 3001 | ||
2810 | /* RXON Timing */ | 3002 | /* RXON Timing */ |
2811 | iwl_setup_rxon_timing(priv); | 3003 | iwl_setup_rxon_timing(priv, vif); |
2812 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3004 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2813 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 3005 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2814 | if (ret) | 3006 | if (ret) |
@@ -2822,9 +3014,10 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2822 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3014 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2823 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 3015 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
2824 | 3016 | ||
2825 | /* FIXME: what should be the assoc_id for AP? */ | 3017 | priv->staging_rxon.assoc_id = 0; |
2826 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3018 | |
2827 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3019 | if (vif->bss_conf.assoc_capability & |
3020 | WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
2828 | priv->staging_rxon.flags |= | 3021 | priv->staging_rxon.flags |= |
2829 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3022 | RXON_FLG_SHORT_PREAMBLE_MSK; |
2830 | else | 3023 | else |
@@ -2832,22 +3025,21 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2832 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3025 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
2833 | 3026 | ||
2834 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3027 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
2835 | if (priv->assoc_capability & | 3028 | if (vif->bss_conf.assoc_capability & |
2836 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3029 | WLAN_CAPABILITY_SHORT_SLOT_TIME) |
2837 | priv->staging_rxon.flags |= | 3030 | priv->staging_rxon.flags |= |
2838 | RXON_FLG_SHORT_SLOT_MSK; | 3031 | RXON_FLG_SHORT_SLOT_MSK; |
2839 | else | 3032 | else |
2840 | priv->staging_rxon.flags &= | 3033 | priv->staging_rxon.flags &= |
2841 | ~RXON_FLG_SHORT_SLOT_MSK; | 3034 | ~RXON_FLG_SHORT_SLOT_MSK; |
2842 | 3035 | ||
2843 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3036 | if (vif->type == NL80211_IFTYPE_ADHOC) |
2844 | priv->staging_rxon.flags &= | 3037 | priv->staging_rxon.flags &= |
2845 | ~RXON_FLG_SHORT_SLOT_MSK; | 3038 | ~RXON_FLG_SHORT_SLOT_MSK; |
2846 | } | 3039 | } |
2847 | /* restore RXON assoc */ | 3040 | /* restore RXON assoc */ |
2848 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3041 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2849 | iwlcore_commit_rxon(priv); | 3042 | iwlcore_commit_rxon(priv); |
2850 | iwl_add_bcast_station(priv); | ||
2851 | } | 3043 | } |
2852 | iwl_send_beacon_cmd(priv); | 3044 | iwl_send_beacon_cmd(priv); |
2853 | 3045 | ||
@@ -2866,8 +3058,7 @@ static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
2866 | struct iwl_priv *priv = hw->priv; | 3058 | struct iwl_priv *priv = hw->priv; |
2867 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 3059 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
2868 | 3060 | ||
2869 | iwl_update_tkip_key(priv, keyconf, | 3061 | iwl_update_tkip_key(priv, keyconf, sta, |
2870 | sta ? sta->addr : iwl_bcast_addr, | ||
2871 | iv32, phase1key); | 3062 | iv32, phase1key); |
2872 | 3063 | ||
2873 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3064 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -2879,7 +3070,6 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2879 | struct ieee80211_key_conf *key) | 3070 | struct ieee80211_key_conf *key) |
2880 | { | 3071 | { |
2881 | struct iwl_priv *priv = hw->priv; | 3072 | struct iwl_priv *priv = hw->priv; |
2882 | const u8 *addr; | ||
2883 | int ret; | 3073 | int ret; |
2884 | u8 sta_id; | 3074 | u8 sta_id; |
2885 | bool is_default_wep_key = false; | 3075 | bool is_default_wep_key = false; |
@@ -2890,13 +3080,17 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2890 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); | 3080 | IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); |
2891 | return -EOPNOTSUPP; | 3081 | return -EOPNOTSUPP; |
2892 | } | 3082 | } |
2893 | addr = sta ? sta->addr : iwl_bcast_addr; | ||
2894 | sta_id = iwl_find_station(priv, addr); | ||
2895 | if (sta_id == IWL_INVALID_STATION) { | ||
2896 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | ||
2897 | addr); | ||
2898 | return -EINVAL; | ||
2899 | 3083 | ||
3084 | if (sta) { | ||
3085 | sta_id = iwl_sta_id(sta); | ||
3086 | |||
3087 | if (sta_id == IWL_INVALID_STATION) { | ||
3088 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | ||
3089 | sta->addr); | ||
3090 | return -EINVAL; | ||
3091 | } | ||
3092 | } else { | ||
3093 | sta_id = priv->hw_params.bcast_sta_id; | ||
2900 | } | 3094 | } |
2901 | 3095 | ||
2902 | mutex_lock(&priv->mutex); | 3096 | mutex_lock(&priv->mutex); |
@@ -2945,8 +3139,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2945 | 3139 | ||
2946 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | 3140 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, |
2947 | struct ieee80211_vif *vif, | 3141 | struct ieee80211_vif *vif, |
2948 | enum ieee80211_ampdu_mlme_action action, | 3142 | enum ieee80211_ampdu_mlme_action action, |
2949 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 3143 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
2950 | { | 3144 | { |
2951 | struct iwl_priv *priv = hw->priv; | 3145 | struct iwl_priv *priv = hw->priv; |
2952 | int ret; | 3146 | int ret; |
@@ -2960,17 +3154,17 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2960 | switch (action) { | 3154 | switch (action) { |
2961 | case IEEE80211_AMPDU_RX_START: | 3155 | case IEEE80211_AMPDU_RX_START: |
2962 | IWL_DEBUG_HT(priv, "start Rx\n"); | 3156 | IWL_DEBUG_HT(priv, "start Rx\n"); |
2963 | return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn); | 3157 | return iwl_sta_rx_agg_start(priv, sta, tid, *ssn); |
2964 | case IEEE80211_AMPDU_RX_STOP: | 3158 | case IEEE80211_AMPDU_RX_STOP: |
2965 | IWL_DEBUG_HT(priv, "stop Rx\n"); | 3159 | IWL_DEBUG_HT(priv, "stop Rx\n"); |
2966 | ret = iwl_sta_rx_agg_stop(priv, sta->addr, tid); | 3160 | ret = iwl_sta_rx_agg_stop(priv, sta, tid); |
2967 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3161 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2968 | return 0; | 3162 | return 0; |
2969 | else | 3163 | else |
2970 | return ret; | 3164 | return ret; |
2971 | case IEEE80211_AMPDU_TX_START: | 3165 | case IEEE80211_AMPDU_TX_START: |
2972 | IWL_DEBUG_HT(priv, "start Tx\n"); | 3166 | IWL_DEBUG_HT(priv, "start Tx\n"); |
2973 | ret = iwlagn_tx_agg_start(priv, sta->addr, tid, ssn); | 3167 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); |
2974 | if (ret == 0) { | 3168 | if (ret == 0) { |
2975 | priv->_agn.agg_tids_count++; | 3169 | priv->_agn.agg_tids_count++; |
2976 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", | 3170 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", |
@@ -2979,7 +3173,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2979 | return ret; | 3173 | return ret; |
2980 | case IEEE80211_AMPDU_TX_STOP: | 3174 | case IEEE80211_AMPDU_TX_STOP: |
2981 | IWL_DEBUG_HT(priv, "stop Tx\n"); | 3175 | IWL_DEBUG_HT(priv, "stop Tx\n"); |
2982 | ret = iwlagn_tx_agg_stop(priv, sta->addr, tid); | 3176 | ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); |
2983 | if ((ret == 0) && (priv->_agn.agg_tids_count > 0)) { | 3177 | if ((ret == 0) && (priv->_agn.agg_tids_count > 0)) { |
2984 | priv->_agn.agg_tids_count--; | 3178 | priv->_agn.agg_tids_count--; |
2985 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", | 3179 | IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", |
@@ -3021,7 +3215,7 @@ static void iwl_mac_sta_notify(struct ieee80211_hw *hw, | |||
3021 | if (!sta_priv->asleep) | 3215 | if (!sta_priv->asleep) |
3022 | break; | 3216 | break; |
3023 | sta_priv->asleep = false; | 3217 | sta_priv->asleep = false; |
3024 | sta_id = iwl_find_station(priv, sta->addr); | 3218 | sta_id = iwl_sta_id(sta); |
3025 | if (sta_id != IWL_INVALID_STATION) | 3219 | if (sta_id != IWL_INVALID_STATION) |
3026 | iwl_sta_modify_ps_wake(priv, sta_id); | 3220 | iwl_sta_modify_ps_wake(priv, sta_id); |
3027 | break; | 3221 | break; |
@@ -3036,10 +3230,12 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3036 | { | 3230 | { |
3037 | struct iwl_priv *priv = hw->priv; | 3231 | struct iwl_priv *priv = hw->priv; |
3038 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | 3232 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; |
3039 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | 3233 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3040 | int ret; | 3234 | int ret; |
3041 | u8 sta_id; | 3235 | u8 sta_id; |
3042 | 3236 | ||
3237 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3238 | |||
3043 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3239 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3044 | sta->addr); | 3240 | sta->addr); |
3045 | 3241 | ||
@@ -3056,12 +3252,14 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3056 | return ret; | 3252 | return ret; |
3057 | } | 3253 | } |
3058 | 3254 | ||
3255 | sta_priv->common.sta_id = sta_id; | ||
3256 | |||
3059 | /* Initialize rate scaling */ | 3257 | /* Initialize rate scaling */ |
3060 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3258 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3061 | sta->addr); | 3259 | sta->addr); |
3062 | iwl_rs_rate_init(priv, sta, sta_id); | 3260 | iwl_rs_rate_init(priv, sta, sta_id); |
3063 | 3261 | ||
3064 | return ret; | 3262 | return 0; |
3065 | } | 3263 | } |
3066 | 3264 | ||
3067 | /***************************************************************************** | 3265 | /***************************************************************************** |
@@ -3586,6 +3784,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3586 | iwl_power_initialize(priv); | 3784 | iwl_power_initialize(priv); |
3587 | iwl_tt_initialize(priv); | 3785 | iwl_tt_initialize(priv); |
3588 | 3786 | ||
3787 | init_completion(&priv->_agn.firmware_loading_complete); | ||
3788 | |||
3589 | err = iwl_request_firmware(priv, true); | 3789 | err = iwl_request_firmware(priv, true); |
3590 | if (err) | 3790 | if (err) |
3591 | goto out_remove_sysfs; | 3791 | goto out_remove_sysfs; |
@@ -3626,6 +3826,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3626 | if (!priv) | 3826 | if (!priv) |
3627 | return; | 3827 | return; |
3628 | 3828 | ||
3829 | wait_for_completion(&priv->_agn.firmware_loading_complete); | ||
3830 | |||
3629 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3831 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3630 | 3832 | ||
3631 | iwl_dbgfs_unregister(priv); | 3833 | iwl_dbgfs_unregister(priv); |
@@ -3783,11 +3985,10 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
3783 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, | 3985 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, |
3784 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, | 3986 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, |
3785 | 3987 | ||
3786 | /* 6x00 Series Gen2 */ | 3988 | /* 6x00 Series Gen2a */ |
3787 | {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000g2_2agn_cfg)}, | 3989 | {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000g2a_2agn_cfg)}, |
3788 | {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6000g2_2agn_cfg)}, | 3990 | {IWL_PCI_DEVICE(0x0085, 0x1211, iwl6000g2a_2agn_cfg)}, |
3789 | {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6000g2_2agn_cfg)}, | 3991 | {IWL_PCI_DEVICE(0x0082, 0x1221, iwl6000g2a_2agn_cfg)}, |
3790 | {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6000g2_2agn_cfg)}, | ||
3791 | 3992 | ||
3792 | /* 6x50 WiFi/WiMax Series */ | 3993 | /* 6x50 WiFi/WiMax Series */ |
3793 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, | 3994 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, |
@@ -3900,3 +4101,8 @@ MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); | |||
3900 | module_param_named( | 4101 | module_param_named( |
3901 | disable_hw_scan, iwlagn_mod_params.disable_hw_scan, int, S_IRUGO); | 4102 | disable_hw_scan, iwlagn_mod_params.disable_hw_scan, int, S_IRUGO); |
3902 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | 4103 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); |
4104 | |||
4105 | module_param_named(ucode_alternative, iwlagn_wanted_ucode_alternative, int, | ||
4106 | S_IRUGO); | ||
4107 | MODULE_PARM_DESC(ucode_alternative, | ||
4108 | "specify ucode alternative to use from ucode file"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index cfee9994383e..2d748053358e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -66,7 +66,6 @@ | |||
66 | #include "iwl-dev.h" | 66 | #include "iwl-dev.h" |
67 | 67 | ||
68 | extern struct iwl_mod_params iwlagn_mod_params; | 68 | extern struct iwl_mod_params iwlagn_mod_params; |
69 | extern struct iwl_ucode_ops iwlagn_ucode; | ||
70 | extern struct iwl_hcmd_ops iwlagn_hcmd; | 69 | extern struct iwl_hcmd_ops iwlagn_hcmd; |
71 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; | 70 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; |
72 | 71 | ||
@@ -136,9 +135,10 @@ void iwlagn_rx_reply_rx_phy(struct iwl_priv *priv, | |||
136 | void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, | 135 | void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, |
137 | struct ieee80211_tx_info *info); | 136 | struct ieee80211_tx_info *info); |
138 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); | 137 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); |
139 | int iwlagn_tx_agg_start(struct iwl_priv *priv, | 138 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
140 | const u8 *ra, u16 tid, u16 *ssn); | 139 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
141 | int iwlagn_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); | 140 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
141 | struct ieee80211_sta *sta, u16 tid); | ||
142 | int iwlagn_txq_check_empty(struct iwl_priv *priv, | 142 | int iwlagn_txq_check_empty(struct iwl_priv *priv, |
143 | int sta_id, u8 tid, int txq_id); | 143 | int sta_id, u8 tid, int txq_id); |
144 | void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | 144 | void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, |
@@ -172,6 +172,10 @@ static inline bool iwl_is_tx_success(u32 status) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | /* scan */ | 174 | /* scan */ |
175 | void iwlagn_request_scan(struct iwl_priv *priv); | 175 | void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif); |
176 | |||
177 | /* station mgmt */ | ||
178 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | ||
179 | struct ieee80211_vif *vif, bool add); | ||
176 | 180 | ||
177 | #endif /* __iwl_agn_h__ */ | 181 | #endif /* __iwl_agn_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 0086019b7a15..9aab020c474b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2668,7 +2668,6 @@ struct iwl_ssid_ie { | |||
2668 | #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) | 2668 | #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) |
2669 | #define IWL_MAX_SCAN_SIZE 1024 | 2669 | #define IWL_MAX_SCAN_SIZE 1024 |
2670 | #define IWL_MAX_CMD_SIZE 4096 | 2670 | #define IWL_MAX_CMD_SIZE 4096 |
2671 | #define IWL_MAX_PROBE_REQUEST 200 | ||
2672 | 2671 | ||
2673 | /* | 2672 | /* |
2674 | * REPLY_SCAN_CMD = 0x80 (command) | 2673 | * REPLY_SCAN_CMD = 0x80 (command) |
@@ -3128,6 +3127,11 @@ struct statistics_tx { | |||
3128 | __le32 cts_timeout_collision; | 3127 | __le32 cts_timeout_collision; |
3129 | __le32 ack_or_ba_timeout_collision; | 3128 | __le32 ack_or_ba_timeout_collision; |
3130 | struct statistics_tx_non_phy_agg agg; | 3129 | struct statistics_tx_non_phy_agg agg; |
3130 | /* | ||
3131 | * "tx_power" are optional parameters provided by uCode, | ||
3132 | * 6000 series is the only device provide the information, | ||
3133 | * Those are reserved fields for all the other devices | ||
3134 | */ | ||
3131 | struct statistics_tx_power tx_power; | 3135 | struct statistics_tx_power tx_power; |
3132 | __le32 reserved1; | 3136 | __le32 reserved1; |
3133 | } __attribute__ ((packed)); | 3137 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 87eb89f000f5..5a7eca8fb789 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -68,37 +68,6 @@ static bool bt_coex_active = true; | |||
68 | module_param(bt_coex_active, bool, S_IRUGO); | 68 | module_param(bt_coex_active, bool, S_IRUGO); |
69 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); | 69 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); |
70 | 70 | ||
71 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | ||
72 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, | ||
73 | 0, COEX_UNASSOC_IDLE_FLAGS}, | ||
74 | {COEX_CU_UNASSOC_MANUAL_SCAN_RP, COEX_CU_UNASSOC_MANUAL_SCAN_WP, | ||
75 | 0, COEX_UNASSOC_MANUAL_SCAN_FLAGS}, | ||
76 | {COEX_CU_UNASSOC_AUTO_SCAN_RP, COEX_CU_UNASSOC_AUTO_SCAN_WP, | ||
77 | 0, COEX_UNASSOC_AUTO_SCAN_FLAGS}, | ||
78 | {COEX_CU_CALIBRATION_RP, COEX_CU_CALIBRATION_WP, | ||
79 | 0, COEX_CALIBRATION_FLAGS}, | ||
80 | {COEX_CU_PERIODIC_CALIBRATION_RP, COEX_CU_PERIODIC_CALIBRATION_WP, | ||
81 | 0, COEX_PERIODIC_CALIBRATION_FLAGS}, | ||
82 | {COEX_CU_CONNECTION_ESTAB_RP, COEX_CU_CONNECTION_ESTAB_WP, | ||
83 | 0, COEX_CONNECTION_ESTAB_FLAGS}, | ||
84 | {COEX_CU_ASSOCIATED_IDLE_RP, COEX_CU_ASSOCIATED_IDLE_WP, | ||
85 | 0, COEX_ASSOCIATED_IDLE_FLAGS}, | ||
86 | {COEX_CU_ASSOC_MANUAL_SCAN_RP, COEX_CU_ASSOC_MANUAL_SCAN_WP, | ||
87 | 0, COEX_ASSOC_MANUAL_SCAN_FLAGS}, | ||
88 | {COEX_CU_ASSOC_AUTO_SCAN_RP, COEX_CU_ASSOC_AUTO_SCAN_WP, | ||
89 | 0, COEX_ASSOC_AUTO_SCAN_FLAGS}, | ||
90 | {COEX_CU_ASSOC_ACTIVE_LEVEL_RP, COEX_CU_ASSOC_ACTIVE_LEVEL_WP, | ||
91 | 0, COEX_ASSOC_ACTIVE_LEVEL_FLAGS}, | ||
92 | {COEX_CU_RF_ON_RP, COEX_CU_RF_ON_WP, 0, COEX_CU_RF_ON_FLAGS}, | ||
93 | {COEX_CU_RF_OFF_RP, COEX_CU_RF_OFF_WP, 0, COEX_RF_OFF_FLAGS}, | ||
94 | {COEX_CU_STAND_ALONE_DEBUG_RP, COEX_CU_STAND_ALONE_DEBUG_WP, | ||
95 | 0, COEX_STAND_ALONE_DEBUG_FLAGS}, | ||
96 | {COEX_CU_IPAN_ASSOC_LEVEL_RP, COEX_CU_IPAN_ASSOC_LEVEL_WP, | ||
97 | 0, COEX_IPAN_ASSOC_LEVEL_FLAGS}, | ||
98 | {COEX_CU_RSRVD1_RP, COEX_CU_RSRVD1_WP, 0, COEX_RSRVD1_FLAGS}, | ||
99 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} | ||
100 | }; | ||
101 | |||
102 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ | 71 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ |
103 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ | 72 | [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ |
104 | IWL_RATE_SISO_##s##M_PLCP, \ | 73 | IWL_RATE_SISO_##s##M_PLCP, \ |
@@ -512,7 +481,7 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) | |||
512 | return new_val; | 481 | return new_val; |
513 | } | 482 | } |
514 | 483 | ||
515 | void iwl_setup_rxon_timing(struct iwl_priv *priv) | 484 | void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) |
516 | { | 485 | { |
517 | u64 tsf; | 486 | u64 tsf; |
518 | s32 interval_tm, rem; | 487 | s32 interval_tm, rem; |
@@ -526,15 +495,14 @@ void iwl_setup_rxon_timing(struct iwl_priv *priv) | |||
526 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); | 495 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); |
527 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); | 496 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); |
528 | 497 | ||
529 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | 498 | beacon_int = vif->bss_conf.beacon_int; |
530 | beacon_int = priv->beacon_int; | ||
531 | priv->rxon_timing.atim_window = 0; | ||
532 | } else { | ||
533 | beacon_int = priv->vif->bss_conf.beacon_int; | ||
534 | 499 | ||
500 | if (vif->type == NL80211_IFTYPE_ADHOC) { | ||
535 | /* TODO: we need to get atim_window from upper stack | 501 | /* TODO: we need to get atim_window from upper stack |
536 | * for now we set to 0 */ | 502 | * for now we set to 0 */ |
537 | priv->rxon_timing.atim_window = 0; | 503 | priv->rxon_timing.atim_window = 0; |
504 | } else { | ||
505 | priv->rxon_timing.atim_window = 0; | ||
538 | } | 506 | } |
539 | 507 | ||
540 | beacon_int = iwl_adjust_beacon_interval(beacon_int, | 508 | beacon_int = iwl_adjust_beacon_interval(beacon_int, |
@@ -925,8 +893,9 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch) | |||
925 | } | 893 | } |
926 | EXPORT_SYMBOL(iwl_set_rxon_channel); | 894 | EXPORT_SYMBOL(iwl_set_rxon_channel); |
927 | 895 | ||
928 | void iwl_set_flags_for_band(struct iwl_priv *priv, | 896 | static void iwl_set_flags_for_band(struct iwl_priv *priv, |
929 | enum ieee80211_band band) | 897 | enum ieee80211_band band, |
898 | struct ieee80211_vif *vif) | ||
930 | { | 899 | { |
931 | if (band == IEEE80211_BAND_5GHZ) { | 900 | if (band == IEEE80211_BAND_5GHZ) { |
932 | priv->staging_rxon.flags &= | 901 | priv->staging_rxon.flags &= |
@@ -935,12 +904,12 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
935 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 904 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
936 | } else { | 905 | } else { |
937 | /* Copied from iwl_post_associate() */ | 906 | /* Copied from iwl_post_associate() */ |
938 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 907 | if (vif && vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) |
939 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 908 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
940 | else | 909 | else |
941 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 910 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
942 | 911 | ||
943 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 912 | if (vif && vif->type == NL80211_IFTYPE_ADHOC) |
944 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 913 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
945 | 914 | ||
946 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 915 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -952,13 +921,18 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
952 | /* | 921 | /* |
953 | * initialize rxon structure with default values from eeprom | 922 | * initialize rxon structure with default values from eeprom |
954 | */ | 923 | */ |
955 | void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | 924 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
925 | struct ieee80211_vif *vif) | ||
956 | { | 926 | { |
957 | const struct iwl_channel_info *ch_info; | 927 | const struct iwl_channel_info *ch_info; |
928 | enum nl80211_iftype type = NL80211_IFTYPE_STATION; | ||
929 | |||
930 | if (vif) | ||
931 | type = vif->type; | ||
958 | 932 | ||
959 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 933 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
960 | 934 | ||
961 | switch (mode) { | 935 | switch (type) { |
962 | case NL80211_IFTYPE_AP: | 936 | case NL80211_IFTYPE_AP: |
963 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 937 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
964 | break; | 938 | break; |
@@ -976,7 +950,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
976 | break; | 950 | break; |
977 | 951 | ||
978 | default: | 952 | default: |
979 | IWL_ERR(priv, "Unsupported interface type %d\n", mode); | 953 | IWL_ERR(priv, "Unsupported interface type %d\n", type); |
980 | break; | 954 | break; |
981 | } | 955 | } |
982 | 956 | ||
@@ -998,7 +972,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
998 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 972 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); |
999 | priv->band = ch_info->band; | 973 | priv->band = ch_info->band; |
1000 | 974 | ||
1001 | iwl_set_flags_for_band(priv, priv->band); | 975 | iwl_set_flags_for_band(priv, priv->band, vif); |
1002 | 976 | ||
1003 | priv->staging_rxon.ofdm_basic_rates = | 977 | priv->staging_rxon.ofdm_basic_rates = |
1004 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 978 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
@@ -1099,6 +1073,9 @@ void iwl_irq_handle_error(struct iwl_priv *priv) | |||
1099 | /* Cancel currently queued command. */ | 1073 | /* Cancel currently queued command. */ |
1100 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 1074 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
1101 | 1075 | ||
1076 | IWL_ERR(priv, "Loaded firmware version: %s\n", | ||
1077 | priv->hw->wiphy->fw_version); | ||
1078 | |||
1102 | priv->cfg->ops->lib->dump_nic_error_log(priv); | 1079 | priv->cfg->ops->lib->dump_nic_error_log(priv); |
1103 | if (priv->cfg->ops->lib->dump_csr) | 1080 | if (priv->cfg->ops->lib->dump_csr) |
1104 | priv->cfg->ops->lib->dump_csr(priv); | 1081 | priv->cfg->ops->lib->dump_csr(priv); |
@@ -1285,41 +1262,33 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
1285 | u64 multicast) | 1262 | u64 multicast) |
1286 | { | 1263 | { |
1287 | struct iwl_priv *priv = hw->priv; | 1264 | struct iwl_priv *priv = hw->priv; |
1288 | __le32 *filter_flags = &priv->staging_rxon.filter_flags; | 1265 | __le32 filter_or = 0, filter_nand = 0; |
1266 | |||
1267 | #define CHK(test, flag) do { \ | ||
1268 | if (*total_flags & (test)) \ | ||
1269 | filter_or |= (flag); \ | ||
1270 | else \ | ||
1271 | filter_nand |= (flag); \ | ||
1272 | } while (0) | ||
1289 | 1273 | ||
1290 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | 1274 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", |
1291 | changed_flags, *total_flags); | 1275 | changed_flags, *total_flags); |
1292 | 1276 | ||
1293 | if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { | 1277 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
1294 | if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) | 1278 | CHK(FIF_ALLMULTI, RXON_FILTER_ACCEPT_GRP_MSK); |
1295 | *filter_flags |= RXON_FILTER_PROMISC_MSK; | 1279 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); |
1296 | else | 1280 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); |
1297 | *filter_flags &= ~RXON_FILTER_PROMISC_MSK; | ||
1298 | } | ||
1299 | if (changed_flags & FIF_ALLMULTI) { | ||
1300 | if (*total_flags & FIF_ALLMULTI) | ||
1301 | *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK; | ||
1302 | else | ||
1303 | *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK; | ||
1304 | } | ||
1305 | if (changed_flags & FIF_CONTROL) { | ||
1306 | if (*total_flags & FIF_CONTROL) | ||
1307 | *filter_flags |= RXON_FILTER_CTL2HOST_MSK; | ||
1308 | else | ||
1309 | *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK; | ||
1310 | } | ||
1311 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | ||
1312 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | ||
1313 | *filter_flags |= RXON_FILTER_BCON_AWARE_MSK; | ||
1314 | else | ||
1315 | *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK; | ||
1316 | } | ||
1317 | 1281 | ||
1318 | /* We avoid iwl_commit_rxon here to commit the new filter flags | 1282 | #undef CHK |
1319 | * since mac80211 will call ieee80211_hw_config immediately. | 1283 | |
1320 | * (mc_list is not supported at this time). Otherwise, we need to | 1284 | mutex_lock(&priv->mutex); |
1321 | * queue a background iwl_commit_rxon work. | 1285 | |
1322 | */ | 1286 | priv->staging_rxon.filter_flags &= ~filter_nand; |
1287 | priv->staging_rxon.filter_flags |= filter_or; | ||
1288 | |||
1289 | iwlcore_commit_rxon(priv); | ||
1290 | |||
1291 | mutex_unlock(&priv->mutex); | ||
1323 | 1292 | ||
1324 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | 1293 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | |
1325 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1294 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
@@ -1771,10 +1740,11 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1771 | EXPORT_SYMBOL(iwl_mac_conf_tx); | 1740 | EXPORT_SYMBOL(iwl_mac_conf_tx); |
1772 | 1741 | ||
1773 | static void iwl_ht_conf(struct iwl_priv *priv, | 1742 | static void iwl_ht_conf(struct iwl_priv *priv, |
1774 | struct ieee80211_bss_conf *bss_conf) | 1743 | struct ieee80211_vif *vif) |
1775 | { | 1744 | { |
1776 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 1745 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; |
1777 | struct ieee80211_sta *sta; | 1746 | struct ieee80211_sta *sta; |
1747 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
1778 | 1748 | ||
1779 | IWL_DEBUG_MAC80211(priv, "enter:\n"); | 1749 | IWL_DEBUG_MAC80211(priv, "enter:\n"); |
1780 | 1750 | ||
@@ -1788,10 +1758,10 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1788 | 1758 | ||
1789 | ht_conf->single_chain_sufficient = false; | 1759 | ht_conf->single_chain_sufficient = false; |
1790 | 1760 | ||
1791 | switch (priv->iw_mode) { | 1761 | switch (vif->type) { |
1792 | case NL80211_IFTYPE_STATION: | 1762 | case NL80211_IFTYPE_STATION: |
1793 | rcu_read_lock(); | 1763 | rcu_read_lock(); |
1794 | sta = ieee80211_find_sta(priv->vif, priv->bssid); | 1764 | sta = ieee80211_find_sta(vif, bss_conf->bssid); |
1795 | if (sta) { | 1765 | if (sta) { |
1796 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 1766 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
1797 | int maxstreams; | 1767 | int maxstreams; |
@@ -1829,7 +1799,6 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1829 | 1799 | ||
1830 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) | 1800 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) |
1831 | { | 1801 | { |
1832 | priv->assoc_id = 0; | ||
1833 | iwl_led_disassociate(priv); | 1802 | iwl_led_disassociate(priv); |
1834 | /* | 1803 | /* |
1835 | * inform the ucode that there is no longer an | 1804 | * inform the ucode that there is no longer an |
@@ -1857,14 +1826,12 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1857 | 1826 | ||
1858 | mutex_lock(&priv->mutex); | 1827 | mutex_lock(&priv->mutex); |
1859 | 1828 | ||
1860 | if (changes & BSS_CHANGED_BEACON && | 1829 | if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_AP) { |
1861 | priv->iw_mode == NL80211_IFTYPE_AP) { | ||
1862 | dev_kfree_skb(priv->ibss_beacon); | 1830 | dev_kfree_skb(priv->ibss_beacon); |
1863 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | 1831 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); |
1864 | } | 1832 | } |
1865 | 1833 | ||
1866 | if (changes & BSS_CHANGED_BEACON_INT) { | 1834 | if (changes & BSS_CHANGED_BEACON_INT) { |
1867 | priv->beacon_int = bss_conf->beacon_int; | ||
1868 | /* TODO: in AP mode, do something to make this take effect */ | 1835 | /* TODO: in AP mode, do something to make this take effect */ |
1869 | } | 1836 | } |
1870 | 1837 | ||
@@ -1884,8 +1851,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1884 | } | 1851 | } |
1885 | 1852 | ||
1886 | /* mac80211 only sets assoc when in STATION mode */ | 1853 | /* mac80211 only sets assoc when in STATION mode */ |
1887 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC || | 1854 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { |
1888 | bss_conf->assoc) { | ||
1889 | memcpy(priv->staging_rxon.bssid_addr, | 1855 | memcpy(priv->staging_rxon.bssid_addr, |
1890 | bss_conf->bssid, ETH_ALEN); | 1856 | bss_conf->bssid, ETH_ALEN); |
1891 | 1857 | ||
@@ -1903,7 +1869,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1903 | * mac80211 decides to do both changes at once because | 1869 | * mac80211 decides to do both changes at once because |
1904 | * it will invoke post_associate. | 1870 | * it will invoke post_associate. |
1905 | */ | 1871 | */ |
1906 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | 1872 | if (vif->type == NL80211_IFTYPE_ADHOC && |
1907 | changes & BSS_CHANGED_BEACON) { | 1873 | changes & BSS_CHANGED_BEACON) { |
1908 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 1874 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
1909 | 1875 | ||
@@ -1946,7 +1912,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1946 | } | 1912 | } |
1947 | 1913 | ||
1948 | if (changes & BSS_CHANGED_HT) { | 1914 | if (changes & BSS_CHANGED_HT) { |
1949 | iwl_ht_conf(priv, bss_conf); | 1915 | iwl_ht_conf(priv, vif); |
1950 | 1916 | ||
1951 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1917 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1952 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 1918 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -1955,20 +1921,17 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1955 | if (changes & BSS_CHANGED_ASSOC) { | 1921 | if (changes & BSS_CHANGED_ASSOC) { |
1956 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | 1922 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); |
1957 | if (bss_conf->assoc) { | 1923 | if (bss_conf->assoc) { |
1958 | priv->assoc_id = bss_conf->aid; | ||
1959 | priv->beacon_int = bss_conf->beacon_int; | ||
1960 | priv->timestamp = bss_conf->timestamp; | 1924 | priv->timestamp = bss_conf->timestamp; |
1961 | priv->assoc_capability = bss_conf->assoc_capability; | ||
1962 | 1925 | ||
1963 | iwl_led_associate(priv); | 1926 | iwl_led_associate(priv); |
1964 | 1927 | ||
1965 | if (!iwl_is_rfkill(priv)) | 1928 | if (!iwl_is_rfkill(priv)) |
1966 | priv->cfg->ops->lib->post_associate(priv); | 1929 | priv->cfg->ops->lib->post_associate(priv, vif); |
1967 | } else | 1930 | } else |
1968 | iwl_set_no_assoc(priv); | 1931 | iwl_set_no_assoc(priv); |
1969 | } | 1932 | } |
1970 | 1933 | ||
1971 | if (changes && iwl_is_associated(priv) && priv->assoc_id) { | 1934 | if (changes && iwl_is_associated(priv) && bss_conf->aid) { |
1972 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", | 1935 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", |
1973 | changes); | 1936 | changes); |
1974 | ret = iwl_send_rxon_assoc(priv); | 1937 | ret = iwl_send_rxon_assoc(priv); |
@@ -1985,11 +1948,20 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1985 | memcpy(priv->staging_rxon.bssid_addr, | 1948 | memcpy(priv->staging_rxon.bssid_addr, |
1986 | bss_conf->bssid, ETH_ALEN); | 1949 | bss_conf->bssid, ETH_ALEN); |
1987 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 1950 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); |
1988 | iwlcore_config_ap(priv); | 1951 | iwlcore_config_ap(priv, vif); |
1989 | } else | 1952 | } else |
1990 | iwl_set_no_assoc(priv); | 1953 | iwl_set_no_assoc(priv); |
1991 | } | 1954 | } |
1992 | 1955 | ||
1956 | if (changes & BSS_CHANGED_IBSS) { | ||
1957 | ret = priv->cfg->ops->lib->manage_ibss_station(priv, vif, | ||
1958 | bss_conf->ibss_joined); | ||
1959 | if (ret) | ||
1960 | IWL_ERR(priv, "failed to %s IBSS station %pM\n", | ||
1961 | bss_conf->ibss_joined ? "add" : "remove", | ||
1962 | bss_conf->bssid); | ||
1963 | } | ||
1964 | |||
1993 | mutex_unlock(&priv->mutex); | 1965 | mutex_unlock(&priv->mutex); |
1994 | 1966 | ||
1995 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1967 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -2016,14 +1988,13 @@ int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2016 | 1988 | ||
2017 | priv->ibss_beacon = skb; | 1989 | priv->ibss_beacon = skb; |
2018 | 1990 | ||
2019 | priv->assoc_id = 0; | ||
2020 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | 1991 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; |
2021 | priv->timestamp = le64_to_cpu(timestamp); | 1992 | priv->timestamp = le64_to_cpu(timestamp); |
2022 | 1993 | ||
2023 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1994 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2024 | spin_unlock_irqrestore(&priv->lock, flags); | 1995 | spin_unlock_irqrestore(&priv->lock, flags); |
2025 | 1996 | ||
2026 | priv->cfg->ops->lib->post_associate(priv); | 1997 | priv->cfg->ops->lib->post_associate(priv, priv->vif); |
2027 | 1998 | ||
2028 | return 0; | 1999 | return 0; |
2029 | } | 2000 | } |
@@ -2031,7 +2002,7 @@ EXPORT_SYMBOL(iwl_mac_beacon_update); | |||
2031 | 2002 | ||
2032 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) | 2003 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2033 | { | 2004 | { |
2034 | iwl_connection_init_rx_config(priv, vif->type); | 2005 | iwl_connection_init_rx_config(priv, vif); |
2035 | 2006 | ||
2036 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2007 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2037 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2008 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
@@ -2071,9 +2042,6 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
2071 | if (err) | 2042 | if (err) |
2072 | goto out_err; | 2043 | goto out_err; |
2073 | 2044 | ||
2074 | /* Add the broadcast address so we can send broadcast frames */ | ||
2075 | priv->cfg->ops->lib->add_bcast_station(priv); | ||
2076 | |||
2077 | goto out; | 2045 | goto out; |
2078 | 2046 | ||
2079 | out_err: | 2047 | out_err: |
@@ -2096,8 +2064,6 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
2096 | 2064 | ||
2097 | mutex_lock(&priv->mutex); | 2065 | mutex_lock(&priv->mutex); |
2098 | 2066 | ||
2099 | iwl_clear_ucode_stations(priv, true); | ||
2100 | |||
2101 | if (iwl_is_ready_rf(priv)) { | 2067 | if (iwl_is_ready_rf(priv)) { |
2102 | iwl_scan_cancel_timeout(priv, 100); | 2068 | iwl_scan_cancel_timeout(priv, 100); |
2103 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2069 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -2203,7 +2169,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2203 | iwl_set_rxon_channel(priv, conf->channel); | 2169 | iwl_set_rxon_channel(priv, conf->channel); |
2204 | iwl_set_rxon_ht(priv, ht_conf); | 2170 | iwl_set_rxon_ht(priv, ht_conf); |
2205 | 2171 | ||
2206 | iwl_set_flags_for_band(priv, conf->channel->band); | 2172 | iwl_set_flags_for_band(priv, conf->channel->band, priv->vif); |
2207 | spin_unlock_irqrestore(&priv->lock, flags); | 2173 | spin_unlock_irqrestore(&priv->lock, flags); |
2208 | if (iwl_is_associated(priv) && | 2174 | if (iwl_is_associated(priv) && |
2209 | (le16_to_cpu(priv->active_rxon.channel) != ch) && | 2175 | (le16_to_cpu(priv->active_rxon.channel) != ch) && |
@@ -2286,8 +2252,6 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2286 | spin_unlock_irqrestore(&priv->lock, flags); | 2252 | spin_unlock_irqrestore(&priv->lock, flags); |
2287 | 2253 | ||
2288 | spin_lock_irqsave(&priv->lock, flags); | 2254 | spin_lock_irqsave(&priv->lock, flags); |
2289 | priv->assoc_id = 0; | ||
2290 | priv->assoc_capability = 0; | ||
2291 | 2255 | ||
2292 | /* new association get rid of ibss beacon skb */ | 2256 | /* new association get rid of ibss beacon skb */ |
2293 | if (priv->ibss_beacon) | 2257 | if (priv->ibss_beacon) |
@@ -2295,7 +2259,6 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2295 | 2259 | ||
2296 | priv->ibss_beacon = NULL; | 2260 | priv->ibss_beacon = NULL; |
2297 | 2261 | ||
2298 | priv->beacon_int = priv->vif->bss_conf.beacon_int; | ||
2299 | priv->timestamp = 0; | 2262 | priv->timestamp = 0; |
2300 | 2263 | ||
2301 | spin_unlock_irqrestore(&priv->lock, flags); | 2264 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -2342,34 +2305,6 @@ void iwl_free_txq_mem(struct iwl_priv *priv) | |||
2342 | } | 2305 | } |
2343 | EXPORT_SYMBOL(iwl_free_txq_mem); | 2306 | EXPORT_SYMBOL(iwl_free_txq_mem); |
2344 | 2307 | ||
2345 | int iwl_send_wimax_coex(struct iwl_priv *priv) | ||
2346 | { | ||
2347 | struct iwl_wimax_coex_cmd coex_cmd; | ||
2348 | |||
2349 | if (priv->cfg->support_wimax_coexist) { | ||
2350 | /* UnMask wake up src at associated sleep */ | ||
2351 | coex_cmd.flags = COEX_FLAGS_ASSOC_WA_UNMASK_MSK; | ||
2352 | |||
2353 | /* UnMask wake up src at unassociated sleep */ | ||
2354 | coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK; | ||
2355 | memcpy(coex_cmd.sta_prio, cu_priorities, | ||
2356 | sizeof(struct iwl_wimax_coex_event_entry) * | ||
2357 | COEX_NUM_OF_EVENTS); | ||
2358 | |||
2359 | /* enabling the coexistence feature */ | ||
2360 | coex_cmd.flags |= COEX_FLAGS_COEX_ENABLE_MSK; | ||
2361 | |||
2362 | /* enabling the priorities tables */ | ||
2363 | coex_cmd.flags |= COEX_FLAGS_STA_TABLE_VALID_MSK; | ||
2364 | } else { | ||
2365 | /* coexistence is disabled */ | ||
2366 | memset(&coex_cmd, 0, sizeof(coex_cmd)); | ||
2367 | } | ||
2368 | return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD, | ||
2369 | sizeof(coex_cmd), &coex_cmd); | ||
2370 | } | ||
2371 | EXPORT_SYMBOL(iwl_send_wimax_coex); | ||
2372 | |||
2373 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 2308 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2374 | 2309 | ||
2375 | #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) | 2310 | #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 727360944859..7e5a5ba41fd2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -106,7 +106,7 @@ struct iwl_hcmd_utils_ops { | |||
106 | __le32 *tx_flags); | 106 | __le32 *tx_flags); |
107 | int (*calc_rssi)(struct iwl_priv *priv, | 107 | int (*calc_rssi)(struct iwl_priv *priv, |
108 | struct iwl_rx_phy_res *rx_resp); | 108 | struct iwl_rx_phy_res *rx_resp); |
109 | void (*request_scan)(struct iwl_priv *priv); | 109 | void (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif); |
110 | }; | 110 | }; |
111 | 111 | ||
112 | struct iwl_apm_ops { | 112 | struct iwl_apm_ops { |
@@ -131,17 +131,6 @@ struct iwl_temp_ops { | |||
131 | void (*set_calib_version)(struct iwl_priv *priv); | 131 | void (*set_calib_version)(struct iwl_priv *priv); |
132 | }; | 132 | }; |
133 | 133 | ||
134 | struct iwl_ucode_ops { | ||
135 | u32 (*get_header_size)(u32); | ||
136 | u32 (*get_build)(const struct iwl_ucode_header *, u32); | ||
137 | u32 (*get_inst_size)(const struct iwl_ucode_header *, u32); | ||
138 | u32 (*get_data_size)(const struct iwl_ucode_header *, u32); | ||
139 | u32 (*get_init_size)(const struct iwl_ucode_header *, u32); | ||
140 | u32 (*get_init_data_size)(const struct iwl_ucode_header *, u32); | ||
141 | u32 (*get_boot_size)(const struct iwl_ucode_header *, u32); | ||
142 | u8 * (*get_data)(const struct iwl_ucode_header *, u32); | ||
143 | }; | ||
144 | |||
145 | struct iwl_lib_ops { | 134 | struct iwl_lib_ops { |
146 | /* set hw dependent parameters */ | 135 | /* set hw dependent parameters */ |
147 | int (*set_hw_params)(struct iwl_priv *priv); | 136 | int (*set_hw_params)(struct iwl_priv *priv); |
@@ -191,8 +180,9 @@ struct iwl_lib_ops { | |||
191 | /* power */ | 180 | /* power */ |
192 | int (*send_tx_power) (struct iwl_priv *priv); | 181 | int (*send_tx_power) (struct iwl_priv *priv); |
193 | void (*update_chain_flags)(struct iwl_priv *priv); | 182 | void (*update_chain_flags)(struct iwl_priv *priv); |
194 | void (*post_associate) (struct iwl_priv *priv); | 183 | void (*post_associate)(struct iwl_priv *priv, |
195 | void (*config_ap) (struct iwl_priv *priv); | 184 | struct ieee80211_vif *vif); |
185 | void (*config_ap)(struct iwl_priv *priv, struct ieee80211_vif *vif); | ||
196 | irqreturn_t (*isr) (int irq, void *data); | 186 | irqreturn_t (*isr) (int irq, void *data); |
197 | 187 | ||
198 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 188 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
@@ -201,7 +191,8 @@ struct iwl_lib_ops { | |||
201 | /* temperature */ | 191 | /* temperature */ |
202 | struct iwl_temp_ops temp_ops; | 192 | struct iwl_temp_ops temp_ops; |
203 | /* station management */ | 193 | /* station management */ |
204 | void (*add_bcast_station)(struct iwl_priv *priv); | 194 | int (*manage_ibss_station)(struct iwl_priv *priv, |
195 | struct ieee80211_vif *vif, bool add); | ||
205 | /* recover from tx queue stall */ | 196 | /* recover from tx queue stall */ |
206 | void (*recover_from_tx_stall)(unsigned long data); | 197 | void (*recover_from_tx_stall)(unsigned long data); |
207 | /* check for plcp health */ | 198 | /* check for plcp health */ |
@@ -220,7 +211,6 @@ struct iwl_led_ops { | |||
220 | }; | 211 | }; |
221 | 212 | ||
222 | struct iwl_ops { | 213 | struct iwl_ops { |
223 | const struct iwl_ucode_ops *ucode; | ||
224 | const struct iwl_lib_ops *lib; | 214 | const struct iwl_lib_ops *lib; |
225 | const struct iwl_hcmd_ops *hcmd; | 215 | const struct iwl_hcmd_ops *hcmd; |
226 | const struct iwl_hcmd_utils_ops *utils; | 216 | const struct iwl_hcmd_utils_ops *utils; |
@@ -257,6 +247,18 @@ struct iwl_mod_params { | |||
257 | * @support_wimax_coexist: support wimax/wifi co-exist | 247 | * @support_wimax_coexist: support wimax/wifi co-exist |
258 | * @plcp_delta_threshold: plcp error rate threshold used to trigger | 248 | * @plcp_delta_threshold: plcp error rate threshold used to trigger |
259 | * radio tuning when there is a high receiving plcp error rate | 249 | * radio tuning when there is a high receiving plcp error rate |
250 | * @chain_noise_scale: default chain noise scale used for gain computation | ||
251 | * @monitor_recover_period: default timer used to check stuck queues | ||
252 | * @temperature_kelvin: temperature report by uCode in kelvin | ||
253 | * @max_event_log_size: size of event log buffer size for ucode event logging | ||
254 | * @tx_power_by_driver: tx power calibration performed by driver | ||
255 | * instead of uCode | ||
256 | * @ucode_tracing: support ucode continuous tracing | ||
257 | * @sensitivity_calib_by_driver: driver has the capability to perform | ||
258 | * sensitivity calibration operation | ||
259 | * @chain_noise_calib_by_driver: driver has the capability to perform | ||
260 | * chain noise calibration operation | ||
261 | * @scan_antennas: available antenna for scan operation | ||
260 | * | 262 | * |
261 | * We enable the driver to be backward compatible wrt API version. The | 263 | * We enable the driver to be backward compatible wrt API version. The |
262 | * driver specifies which APIs it supports (with @ucode_api_max being the | 264 | * driver specifies which APIs it supports (with @ucode_api_max being the |
@@ -319,6 +321,10 @@ struct iwl_cfg { | |||
319 | u32 monitor_recover_period; | 321 | u32 monitor_recover_period; |
320 | bool temperature_kelvin; | 322 | bool temperature_kelvin; |
321 | u32 max_event_log_size; | 323 | u32 max_event_log_size; |
324 | const bool tx_power_by_driver; | ||
325 | const bool ucode_tracing; | ||
326 | const bool sensitivity_calib_by_driver; | ||
327 | const bool chain_noise_calib_by_driver; | ||
322 | u8 scan_antennas[IEEE80211_NUM_BANDS]; | 328 | u8 scan_antennas[IEEE80211_NUM_BANDS]; |
323 | }; | 329 | }; |
324 | 330 | ||
@@ -340,8 +346,8 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | |||
340 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); | 346 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
341 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 347 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
342 | struct ieee80211_sta_ht_cap *sta_ht_inf); | 348 | struct ieee80211_sta_ht_cap *sta_ht_inf); |
343 | void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band); | 349 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
344 | void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode); | 350 | struct ieee80211_vif *vif); |
345 | int iwl_set_decrypted_flag(struct iwl_priv *priv, | 351 | int iwl_set_decrypted_flag(struct iwl_priv *priv, |
346 | struct ieee80211_hdr *hdr, | 352 | struct ieee80211_hdr *hdr, |
347 | u32 decrypt_res, | 353 | u32 decrypt_res, |
@@ -351,7 +357,7 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
351 | unsigned int changed_flags, | 357 | unsigned int changed_flags, |
352 | unsigned int *total_flags, u64 multicast); | 358 | unsigned int *total_flags, u64 multicast); |
353 | int iwl_set_hw_params(struct iwl_priv *priv); | 359 | int iwl_set_hw_params(struct iwl_priv *priv); |
354 | void iwl_post_associate(struct iwl_priv *priv); | 360 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); |
355 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | 361 | void iwl_bss_info_changed(struct ieee80211_hw *hw, |
356 | struct ieee80211_vif *vif, | 362 | struct ieee80211_vif *vif, |
357 | struct ieee80211_bss_conf *bss_conf, | 363 | struct ieee80211_bss_conf *bss_conf, |
@@ -363,13 +369,12 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
363 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, | 369 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, |
364 | struct ieee80211_vif *vif); | 370 | struct ieee80211_vif *vif); |
365 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); | 371 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); |
366 | void iwl_config_ap(struct iwl_priv *priv); | 372 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif); |
367 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw); | 373 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw); |
368 | int iwl_alloc_txq_mem(struct iwl_priv *priv); | 374 | int iwl_alloc_txq_mem(struct iwl_priv *priv); |
369 | void iwl_free_txq_mem(struct iwl_priv *priv); | 375 | void iwl_free_txq_mem(struct iwl_priv *priv); |
370 | void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info, | 376 | void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info, |
371 | __le32 *tx_flags); | 377 | __le32 *tx_flags); |
372 | int iwl_send_wimax_coex(struct iwl_priv *priv); | ||
373 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 378 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
374 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); | 379 | int iwl_alloc_traffic_mem(struct iwl_priv *priv); |
375 | void iwl_free_traffic_mem(struct iwl_priv *priv); | 380 | void iwl_free_traffic_mem(struct iwl_priv *priv); |
@@ -448,6 +453,8 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
448 | struct iwl_rx_packet *pkt); | 453 | struct iwl_rx_packet *pkt); |
449 | bool iwl_good_ack_health(struct iwl_priv *priv, | 454 | bool iwl_good_ack_health(struct iwl_priv *priv, |
450 | struct iwl_rx_packet *pkt); | 455 | struct iwl_rx_packet *pkt); |
456 | void iwl_recover_from_statistics(struct iwl_priv *priv, | ||
457 | struct iwl_rx_packet *pkt); | ||
451 | void iwl_rx_statistics(struct iwl_priv *priv, | 458 | void iwl_rx_statistics(struct iwl_priv *priv, |
452 | struct iwl_rx_mem_buffer *rxb); | 459 | struct iwl_rx_mem_buffer *rxb); |
453 | void iwl_reply_statistics(struct iwl_priv *priv, | 460 | void iwl_reply_statistics(struct iwl_priv *priv, |
@@ -515,6 +522,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | |||
515 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, | 522 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, |
516 | struct ieee80211_vif *vif, | 523 | struct ieee80211_vif *vif, |
517 | struct cfg80211_scan_request *req); | 524 | struct cfg80211_scan_request *req); |
525 | void iwl_bg_start_internal_scan(struct work_struct *work); | ||
518 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); | 526 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); |
519 | int iwl_force_reset(struct iwl_priv *priv, int mode); | 527 | int iwl_force_reset(struct iwl_priv *priv, int mode); |
520 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, | 528 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, |
@@ -524,7 +532,8 @@ u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | |||
524 | enum ieee80211_band band, | 532 | enum ieee80211_band band, |
525 | u8 n_probes); | 533 | u8 n_probes); |
526 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | 534 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, |
527 | enum ieee80211_band band); | 535 | enum ieee80211_band band, |
536 | struct ieee80211_vif *vif); | ||
528 | void iwl_bg_scan_check(struct work_struct *data); | 537 | void iwl_bg_scan_check(struct work_struct *data); |
529 | void iwl_bg_abort_scan(struct work_struct *work); | 538 | void iwl_bg_abort_scan(struct work_struct *work); |
530 | void iwl_bg_scan_completed(struct work_struct *work); | 539 | void iwl_bg_scan_completed(struct work_struct *work); |
@@ -688,7 +697,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
688 | void iwl_apm_stop(struct iwl_priv *priv); | 697 | void iwl_apm_stop(struct iwl_priv *priv); |
689 | int iwl_apm_init(struct iwl_priv *priv); | 698 | int iwl_apm_init(struct iwl_priv *priv); |
690 | 699 | ||
691 | void iwl_setup_rxon_timing(struct iwl_priv *priv); | 700 | void iwl_setup_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); |
692 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) | 701 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) |
693 | { | 702 | { |
694 | return priv->cfg->ops->hcmd->rxon_assoc(priv); | 703 | return priv->cfg->ops->hcmd->rxon_assoc(priv); |
@@ -697,9 +706,10 @@ static inline int iwlcore_commit_rxon(struct iwl_priv *priv) | |||
697 | { | 706 | { |
698 | return priv->cfg->ops->hcmd->commit_rxon(priv); | 707 | return priv->cfg->ops->hcmd->commit_rxon(priv); |
699 | } | 708 | } |
700 | static inline void iwlcore_config_ap(struct iwl_priv *priv) | 709 | static inline void iwlcore_config_ap(struct iwl_priv *priv, |
710 | struct ieee80211_vif *vif) | ||
701 | { | 711 | { |
702 | priv->cfg->ops->lib->config_ap(priv); | 712 | priv->cfg->ops->lib->config_ap(priv, vif); |
703 | } | 713 | } |
704 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( | 714 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( |
705 | struct iwl_priv *priv, enum ieee80211_band band) | 715 | struct iwl_priv *priv, enum ieee80211_band band) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 4aabb542fcbe..9659c5d01df9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -1220,46 +1220,6 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, | |||
1220 | return ret; | 1220 | return ret; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | static ssize_t iwl_dbgfs_tx_power_read(struct file *file, | ||
1224 | char __user *user_buf, | ||
1225 | size_t count, loff_t *ppos) { | ||
1226 | |||
1227 | struct iwl_priv *priv = file->private_data; | ||
1228 | char buf[128]; | ||
1229 | int pos = 0; | ||
1230 | const size_t bufsz = sizeof(buf); | ||
1231 | struct statistics_tx *tx; | ||
1232 | |||
1233 | if (!iwl_is_alive(priv)) | ||
1234 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1235 | else { | ||
1236 | tx = &priv->statistics.tx; | ||
1237 | if (tx->tx_power.ant_a || | ||
1238 | tx->tx_power.ant_b || | ||
1239 | tx->tx_power.ant_c) { | ||
1240 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1241 | "tx power: (1/2 dB step)\n"); | ||
1242 | if ((priv->cfg->valid_tx_ant & ANT_A) && | ||
1243 | tx->tx_power.ant_a) | ||
1244 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1245 | "\tantenna A: 0x%X\n", | ||
1246 | tx->tx_power.ant_a); | ||
1247 | if ((priv->cfg->valid_tx_ant & ANT_B) && | ||
1248 | tx->tx_power.ant_b) | ||
1249 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1250 | "\tantenna B: 0x%X\n", | ||
1251 | tx->tx_power.ant_b); | ||
1252 | if ((priv->cfg->valid_tx_ant & ANT_C) && | ||
1253 | tx->tx_power.ant_c) | ||
1254 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1255 | "\tantenna C: 0x%X\n", | ||
1256 | tx->tx_power.ant_c); | ||
1257 | } else | ||
1258 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1259 | } | ||
1260 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1261 | } | ||
1262 | |||
1263 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | 1223 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, |
1264 | char __user *user_buf, | 1224 | char __user *user_buf, |
1265 | size_t count, loff_t *ppos) | 1225 | size_t count, loff_t *ppos) |
@@ -1571,7 +1531,6 @@ DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | |||
1571 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | 1531 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
1572 | DEBUGFS_READ_FILE_OPS(sensitivity); | 1532 | DEBUGFS_READ_FILE_OPS(sensitivity); |
1573 | DEBUGFS_READ_FILE_OPS(chain_noise); | 1533 | DEBUGFS_READ_FILE_OPS(chain_noise); |
1574 | DEBUGFS_READ_FILE_OPS(tx_power); | ||
1575 | DEBUGFS_READ_FILE_OPS(power_save_status); | 1534 | DEBUGFS_READ_FILE_OPS(power_save_status); |
1576 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); | 1535 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
1577 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | 1536 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); |
@@ -1618,8 +1577,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1618 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); | 1577 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); |
1619 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); | 1578 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); |
1620 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); | 1579 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); |
1621 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, S_IWUSR | S_IRUSR); | 1580 | if (!priv->cfg->broken_powersave) { |
1622 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); | 1581 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, |
1582 | S_IWUSR | S_IRUSR); | ||
1583 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); | ||
1584 | } | ||
1623 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); | 1585 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); |
1624 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); | 1586 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
1625 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); | 1587 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); |
@@ -1627,7 +1589,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1627 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); | 1589 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); |
1628 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); | 1590 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); |
1629 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); | 1591 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); |
1630 | DEBUGFS_ADD_FILE(tx_power, dir_debug, S_IRUSR); | ||
1631 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); | 1592 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
1632 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); | 1593 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
1633 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | 1594 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
@@ -1640,18 +1601,21 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1640 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 1601 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
1641 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); | 1602 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
1642 | 1603 | ||
1643 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1604 | if (priv->cfg->sensitivity_calib_by_driver) |
1644 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 1605 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
1606 | if (priv->cfg->chain_noise_calib_by_driver) | ||
1645 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1607 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1608 | if (priv->cfg->ucode_tracing) | ||
1646 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); | 1609 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
1647 | } | ||
1648 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1610 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1649 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1611 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1650 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, &priv->disable_sens_cal); | 1612 | if (priv->cfg->sensitivity_calib_by_driver) |
1651 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, | 1613 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, |
1652 | &priv->disable_chain_noise_cal); | 1614 | &priv->disable_sens_cal); |
1653 | if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) || | 1615 | if (priv->cfg->chain_noise_calib_by_driver) |
1654 | ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_3945)) | 1616 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
1617 | &priv->disable_chain_noise_cal); | ||
1618 | if (priv->cfg->tx_power_by_driver) | ||
1655 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, | 1619 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
1656 | &priv->disable_tx_power_cal); | 1620 | &priv->disable_tx_power_cal); |
1657 | return 0; | 1621 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 58c69a5798d4..f3f3473c5c7e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -57,8 +57,8 @@ extern struct iwl_cfg iwl5100_bgn_cfg; | |||
57 | extern struct iwl_cfg iwl5100_abg_cfg; | 57 | extern struct iwl_cfg iwl5100_abg_cfg; |
58 | extern struct iwl_cfg iwl5150_agn_cfg; | 58 | extern struct iwl_cfg iwl5150_agn_cfg; |
59 | extern struct iwl_cfg iwl5150_abg_cfg; | 59 | extern struct iwl_cfg iwl5150_abg_cfg; |
60 | extern struct iwl_cfg iwl6000g2a_2agn_cfg; | ||
60 | extern struct iwl_cfg iwl6000i_2agn_cfg; | 61 | extern struct iwl_cfg iwl6000i_2agn_cfg; |
61 | extern struct iwl_cfg iwl6000g2_2agn_cfg; | ||
62 | extern struct iwl_cfg iwl6000i_2abg_cfg; | 62 | extern struct iwl_cfg iwl6000i_2abg_cfg; |
63 | extern struct iwl_cfg iwl6000i_2bg_cfg; | 63 | extern struct iwl_cfg iwl6000i_2bg_cfg; |
64 | extern struct iwl_cfg iwl6000_3agn_cfg; | 64 | extern struct iwl_cfg iwl6000_3agn_cfg; |
@@ -497,20 +497,38 @@ struct iwl_station_entry { | |||
497 | struct iwl_link_quality_cmd *lq; | 497 | struct iwl_link_quality_cmd *lq; |
498 | }; | 498 | }; |
499 | 499 | ||
500 | struct iwl_station_priv_common { | ||
501 | u8 sta_id; | ||
502 | }; | ||
503 | |||
500 | /* | 504 | /* |
501 | * iwl_station_priv: Driver's private station information | 505 | * iwl_station_priv: Driver's private station information |
502 | * | 506 | * |
503 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 507 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
504 | * in the structure for use by driver. This structure is places in that | 508 | * in the structure for use by driver. This structure is places in that |
505 | * space. | 509 | * space. |
510 | * | ||
511 | * The common struct MUST be first because it is shared between | ||
512 | * 3945 and agn! | ||
506 | */ | 513 | */ |
507 | struct iwl_station_priv { | 514 | struct iwl_station_priv { |
515 | struct iwl_station_priv_common common; | ||
508 | struct iwl_lq_sta lq_sta; | 516 | struct iwl_lq_sta lq_sta; |
509 | atomic_t pending_frames; | 517 | atomic_t pending_frames; |
510 | bool client; | 518 | bool client; |
511 | bool asleep; | 519 | bool asleep; |
512 | }; | 520 | }; |
513 | 521 | ||
522 | /** | ||
523 | * struct iwl_vif_priv - driver's private per-interface information | ||
524 | * | ||
525 | * When mac80211 allocates a virtual interface, it can allocate | ||
526 | * space for us to put data into. | ||
527 | */ | ||
528 | struct iwl_vif_priv { | ||
529 | u8 ibss_bssid_sta_id; | ||
530 | }; | ||
531 | |||
514 | /* one for each uCode image (inst/data, boot/init/runtime) */ | 532 | /* one for each uCode image (inst/data, boot/init/runtime) */ |
515 | struct fw_desc { | 533 | struct fw_desc { |
516 | void *v_addr; /* access by driver */ | 534 | void *v_addr; /* access by driver */ |
@@ -518,7 +536,7 @@ struct fw_desc { | |||
518 | u32 len; /* bytes */ | 536 | u32 len; /* bytes */ |
519 | }; | 537 | }; |
520 | 538 | ||
521 | /* uCode file layout */ | 539 | /* v1/v2 uCode file layout */ |
522 | struct iwl_ucode_header { | 540 | struct iwl_ucode_header { |
523 | __le32 ver; /* major/minor/API/serial */ | 541 | __le32 ver; /* major/minor/API/serial */ |
524 | union { | 542 | union { |
@@ -541,7 +559,62 @@ struct iwl_ucode_header { | |||
541 | } v2; | 559 | } v2; |
542 | } u; | 560 | } u; |
543 | }; | 561 | }; |
544 | #define UCODE_HEADER_SIZE(ver) ((ver) == 1 ? 24 : 28) | 562 | |
563 | /* | ||
564 | * new TLV uCode file layout | ||
565 | * | ||
566 | * The new TLV file format contains TLVs, that each specify | ||
567 | * some piece of data. To facilitate "groups", for example | ||
568 | * different instruction image with different capabilities, | ||
569 | * bundled with the same init image, an alternative mechanism | ||
570 | * is provided: | ||
571 | * When the alternative field is 0, that means that the item | ||
572 | * is always valid. When it is non-zero, then it is only | ||
573 | * valid in conjunction with items of the same alternative, | ||
574 | * in which case the driver (user) selects one alternative | ||
575 | * to use. | ||
576 | */ | ||
577 | |||
578 | enum iwl_ucode_tlv_type { | ||
579 | IWL_UCODE_TLV_INVALID = 0, /* unused */ | ||
580 | IWL_UCODE_TLV_INST = 1, | ||
581 | IWL_UCODE_TLV_DATA = 2, | ||
582 | IWL_UCODE_TLV_INIT = 3, | ||
583 | IWL_UCODE_TLV_INIT_DATA = 4, | ||
584 | IWL_UCODE_TLV_BOOT = 5, | ||
585 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ | ||
586 | }; | ||
587 | |||
588 | struct iwl_ucode_tlv { | ||
589 | __le16 type; /* see above */ | ||
590 | __le16 alternative; /* see comment */ | ||
591 | __le32 length; /* not including type/length fields */ | ||
592 | u8 data[0]; | ||
593 | } __attribute__ ((packed)); | ||
594 | |||
595 | #define IWL_TLV_UCODE_MAGIC 0x0a4c5749 | ||
596 | |||
597 | struct iwl_tlv_ucode_header { | ||
598 | /* | ||
599 | * The TLV style ucode header is distinguished from | ||
600 | * the v1/v2 style header by first four bytes being | ||
601 | * zero, as such is an invalid combination of | ||
602 | * major/minor/API/serial versions. | ||
603 | */ | ||
604 | __le32 zero; | ||
605 | __le32 magic; | ||
606 | u8 human_readable[64]; | ||
607 | __le32 ver; /* major/minor/API/serial */ | ||
608 | __le32 build; | ||
609 | __le64 alternatives; /* bitmask of valid alternatives */ | ||
610 | /* | ||
611 | * The data contained herein has a TLV layout, | ||
612 | * see above for the TLV header and types. | ||
613 | * Note that each TLV is padded to a length | ||
614 | * that is a multiple of 4 for alignment. | ||
615 | */ | ||
616 | u8 data[0]; | ||
617 | }; | ||
545 | 618 | ||
546 | struct iwl4965_ibss_seq { | 619 | struct iwl4965_ibss_seq { |
547 | u8 mac[ETH_ALEN]; | 620 | u8 mac[ETH_ALEN]; |
@@ -1155,8 +1228,7 @@ struct iwl_priv { | |||
1155 | #endif | 1228 | #endif |
1156 | 1229 | ||
1157 | /* context information */ | 1230 | /* context information */ |
1158 | u8 bssid[ETH_ALEN]; | 1231 | u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ |
1159 | u16 rts_threshold; | ||
1160 | u8 mac_addr[ETH_ALEN]; | 1232 | u8 mac_addr[ETH_ALEN]; |
1161 | 1233 | ||
1162 | /*station table variables */ | 1234 | /*station table variables */ |
@@ -1189,7 +1261,6 @@ struct iwl_priv { | |||
1189 | 1261 | ||
1190 | /* Last Rx'd beacon timestamp */ | 1262 | /* Last Rx'd beacon timestamp */ |
1191 | u64 timestamp; | 1263 | u64 timestamp; |
1192 | u16 beacon_int; | ||
1193 | struct ieee80211_vif *vif; | 1264 | struct ieee80211_vif *vif; |
1194 | 1265 | ||
1195 | union { | 1266 | union { |
@@ -1242,6 +1313,8 @@ struct iwl_priv { | |||
1242 | 1313 | ||
1243 | struct iwl_rx_phy_res last_phy_res; | 1314 | struct iwl_rx_phy_res last_phy_res; |
1244 | bool last_phy_res_valid; | 1315 | bool last_phy_res_valid; |
1316 | |||
1317 | struct completion firmware_loading_complete; | ||
1245 | } _agn; | 1318 | } _agn; |
1246 | #endif | 1319 | #endif |
1247 | }; | 1320 | }; |
@@ -1249,10 +1322,6 @@ struct iwl_priv { | |||
1249 | struct iwl_hw_params hw_params; | 1322 | struct iwl_hw_params hw_params; |
1250 | 1323 | ||
1251 | u32 inta_mask; | 1324 | u32 inta_mask; |
1252 | /* Current association information needed to configure the | ||
1253 | * hardware */ | ||
1254 | u16 assoc_id; | ||
1255 | u16 assoc_capability; | ||
1256 | 1325 | ||
1257 | struct iwl_qos_info qos_data; | 1326 | struct iwl_qos_info qos_data; |
1258 | 1327 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index fb5bb487f3bc..ee11452519e6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -590,9 +590,16 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
590 | e[addr / 2] = cpu_to_le16(r >> 16); | 590 | e[addr / 2] = cpu_to_le16(r >> 16); |
591 | } | 591 | } |
592 | } | 592 | } |
593 | |||
594 | IWL_DEBUG_INFO(priv, "NVM Type: %s, version: 0x%x\n", | ||
595 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) | ||
596 | ? "OTP" : "EEPROM", | ||
597 | iwl_eeprom_query16(priv, EEPROM_VERSION)); | ||
598 | |||
593 | ret = 0; | 599 | ret = 0; |
594 | done: | 600 | done: |
595 | priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv); | 601 | priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv); |
602 | |||
596 | err: | 603 | err: |
597 | if (ret) | 604 | if (ret) |
598 | iwl_eeprom_free(priv); | 605 | iwl_eeprom_free(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 581c683a8507..cda6a94d6cc9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -318,10 +318,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
318 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || | 318 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || |
319 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; | 319 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; |
320 | 320 | ||
321 | if (priv->vif) | 321 | dtimper = priv->hw->conf.ps_dtim_period ?: 1; |
322 | dtimper = priv->hw->conf.ps_dtim_period; | ||
323 | else | ||
324 | dtimper = 1; | ||
325 | 322 | ||
326 | if (priv->cfg->broken_powersave) | 323 | if (priv->cfg->broken_powersave) |
327 | iwl_power_sleep_cam_cmd(priv, &cmd); | 324 | iwl_power_sleep_cam_cmd(priv, &cmd); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 267eb8935902..0a5d7cf25196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -398,7 +398,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, | |||
398 | } | 398 | } |
399 | EXPORT_SYMBOL(iwl_good_plcp_health); | 399 | EXPORT_SYMBOL(iwl_good_plcp_health); |
400 | 400 | ||
401 | static void iwl_recover_from_statistics(struct iwl_priv *priv, | 401 | void iwl_recover_from_statistics(struct iwl_priv *priv, |
402 | struct iwl_rx_packet *pkt) | 402 | struct iwl_rx_packet *pkt) |
403 | { | 403 | { |
404 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 404 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
@@ -413,9 +413,11 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
413 | */ | 413 | */ |
414 | IWL_ERR(priv, "low ack count detected, " | 414 | IWL_ERR(priv, "low ack count detected, " |
415 | "restart firmware\n"); | 415 | "restart firmware\n"); |
416 | iwl_force_reset(priv, IWL_FW_RESET); | 416 | if (!iwl_force_reset(priv, IWL_FW_RESET)) |
417 | return; | ||
417 | } | 418 | } |
418 | } else if (priv->cfg->ops->lib->check_plcp_health) { | 419 | } |
420 | if (priv->cfg->ops->lib->check_plcp_health) { | ||
419 | if (!priv->cfg->ops->lib->check_plcp_health( | 421 | if (!priv->cfg->ops->lib->check_plcp_health( |
420 | priv, pkt)) { | 422 | priv, pkt)) { |
421 | /* | 423 | /* |
@@ -427,6 +429,7 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
427 | } | 429 | } |
428 | } | 430 | } |
429 | } | 431 | } |
432 | EXPORT_SYMBOL(iwl_recover_from_statistics); | ||
430 | 433 | ||
431 | void iwl_rx_statistics(struct iwl_priv *priv, | 434 | void iwl_rx_statistics(struct iwl_priv *priv, |
432 | struct iwl_rx_mem_buffer *rxb) | 435 | struct iwl_rx_mem_buffer *rxb) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index d12fd5553846..107e173112f6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -265,7 +265,8 @@ inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | |||
265 | EXPORT_SYMBOL(iwl_get_active_dwell_time); | 265 | EXPORT_SYMBOL(iwl_get_active_dwell_time); |
266 | 266 | ||
267 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | 267 | u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, |
268 | enum ieee80211_band band) | 268 | enum ieee80211_band band, |
269 | struct ieee80211_vif *vif) | ||
269 | { | 270 | { |
270 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? | 271 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
271 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 272 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
@@ -275,7 +276,7 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | |||
275 | /* If we're associated, we clamp the maximum passive | 276 | /* If we're associated, we clamp the maximum passive |
276 | * dwell time to be 98% of the beacon interval (minus | 277 | * dwell time to be 98% of the beacon interval (minus |
277 | * 2 * channel tune time) */ | 278 | * 2 * channel tune time) */ |
278 | passive = priv->beacon_int; | 279 | passive = vif ? vif->bss_conf.beacon_int : 0; |
279 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | 280 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) |
280 | passive = IWL_PASSIVE_DWELL_BASE; | 281 | passive = IWL_PASSIVE_DWELL_BASE; |
281 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | 282 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; |
@@ -295,7 +296,7 @@ void iwl_init_scan_params(struct iwl_priv *priv) | |||
295 | } | 296 | } |
296 | EXPORT_SYMBOL(iwl_init_scan_params); | 297 | EXPORT_SYMBOL(iwl_init_scan_params); |
297 | 298 | ||
298 | static int iwl_scan_initiate(struct iwl_priv *priv) | 299 | static int iwl_scan_initiate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
299 | { | 300 | { |
300 | WARN_ON(!mutex_is_locked(&priv->mutex)); | 301 | WARN_ON(!mutex_is_locked(&priv->mutex)); |
301 | 302 | ||
@@ -307,7 +308,7 @@ static int iwl_scan_initiate(struct iwl_priv *priv) | |||
307 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) | 308 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) |
308 | return -EOPNOTSUPP; | 309 | return -EOPNOTSUPP; |
309 | 310 | ||
310 | priv->cfg->ops->utils->request_scan(priv); | 311 | priv->cfg->ops->utils->request_scan(priv, vif); |
311 | 312 | ||
312 | return 0; | 313 | return 0; |
313 | } | 314 | } |
@@ -348,7 +349,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, | |||
348 | priv->scan_band = req->channels[0]->band; | 349 | priv->scan_band = req->channels[0]->band; |
349 | priv->scan_request = req; | 350 | priv->scan_request = req; |
350 | 351 | ||
351 | ret = iwl_scan_initiate(priv); | 352 | ret = iwl_scan_initiate(priv, vif); |
352 | 353 | ||
353 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 354 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
354 | 355 | ||
@@ -368,7 +369,7 @@ void iwl_internal_short_hw_scan(struct iwl_priv *priv) | |||
368 | queue_work(priv->workqueue, &priv->start_internal_scan); | 369 | queue_work(priv->workqueue, &priv->start_internal_scan); |
369 | } | 370 | } |
370 | 371 | ||
371 | static void iwl_bg_start_internal_scan(struct work_struct *work) | 372 | void iwl_bg_start_internal_scan(struct work_struct *work) |
372 | { | 373 | { |
373 | struct iwl_priv *priv = | 374 | struct iwl_priv *priv = |
374 | container_of(work, struct iwl_priv, start_internal_scan); | 375 | container_of(work, struct iwl_priv, start_internal_scan); |
@@ -399,10 +400,11 @@ static void iwl_bg_start_internal_scan(struct work_struct *work) | |||
399 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) | 400 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) |
400 | goto unlock; | 401 | goto unlock; |
401 | 402 | ||
402 | priv->cfg->ops->utils->request_scan(priv); | 403 | priv->cfg->ops->utils->request_scan(priv, NULL); |
403 | unlock: | 404 | unlock: |
404 | mutex_unlock(&priv->mutex); | 405 | mutex_unlock(&priv->mutex); |
405 | } | 406 | } |
407 | EXPORT_SYMBOL(iwl_bg_start_internal_scan); | ||
406 | 408 | ||
407 | void iwl_bg_scan_check(struct work_struct *data) | 409 | void iwl_bg_scan_check(struct work_struct *data) |
408 | { | 410 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index db934476b5e9..85ed235ac901 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -35,62 +35,6 @@ | |||
35 | #include "iwl-core.h" | 35 | #include "iwl-core.h" |
36 | #include "iwl-sta.h" | 36 | #include "iwl-sta.h" |
37 | 37 | ||
38 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | ||
39 | { | ||
40 | int i; | ||
41 | int start = 0; | ||
42 | int ret = IWL_INVALID_STATION; | ||
43 | unsigned long flags; | ||
44 | |||
45 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
46 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
47 | start = IWL_STA_ID; | ||
48 | |||
49 | if (is_broadcast_ether_addr(addr)) | ||
50 | return priv->hw_params.bcast_sta_id; | ||
51 | |||
52 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
53 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
54 | if (priv->stations[i].used && | ||
55 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
56 | addr))) { | ||
57 | ret = i; | ||
58 | goto out; | ||
59 | } | ||
60 | |||
61 | IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", | ||
62 | addr, priv->num_stations); | ||
63 | |||
64 | out: | ||
65 | /* | ||
66 | * It may be possible that more commands interacting with stations | ||
67 | * arrive before we completed processing the adding of | ||
68 | * station | ||
69 | */ | ||
70 | if (ret != IWL_INVALID_STATION && | ||
71 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || | ||
72 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && | ||
73 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { | ||
74 | IWL_ERR(priv, "Requested station info for sta %d before ready.\n", | ||
75 | ret); | ||
76 | ret = IWL_INVALID_STATION; | ||
77 | } | ||
78 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
79 | return ret; | ||
80 | } | ||
81 | EXPORT_SYMBOL(iwl_find_station); | ||
82 | |||
83 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
84 | { | ||
85 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | ||
86 | return IWL_AP_ID; | ||
87 | } else { | ||
88 | u8 *da = ieee80211_get_DA(hdr); | ||
89 | return iwl_find_station(priv, da); | ||
90 | } | ||
91 | } | ||
92 | EXPORT_SYMBOL(iwl_get_ra_sta_id); | ||
93 | |||
94 | /* priv->sta_lock must be held */ | 38 | /* priv->sta_lock must be held */ |
95 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) | 39 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) |
96 | { | 40 | { |
@@ -340,10 +284,12 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | |||
340 | station->sta.sta.sta_id = sta_id; | 284 | station->sta.sta.sta_id = sta_id; |
341 | station->sta.station_flags = 0; | 285 | station->sta.station_flags = 0; |
342 | 286 | ||
343 | /* BCAST station and IBSS stations do not work in HT mode */ | 287 | /* |
344 | if (sta_id != priv->hw_params.bcast_sta_id && | 288 | * OK to call unconditionally, since local stations (IBSS BSSID |
345 | priv->iw_mode != NL80211_IFTYPE_ADHOC) | 289 | * STA and broadcast STA) pass in a NULL ht_info, and mac80211 |
346 | iwl_set_ht_add_station(priv, sta_id, ht_info); | 290 | * doesn't allow HT IBSS. |
291 | */ | ||
292 | iwl_set_ht_add_station(priv, sta_id, ht_info); | ||
347 | 293 | ||
348 | /* 3945 only */ | 294 | /* 3945 only */ |
349 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? | 295 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? |
@@ -418,20 +364,21 @@ int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | |||
418 | } | 364 | } |
419 | EXPORT_SYMBOL(iwl_add_station_common); | 365 | EXPORT_SYMBOL(iwl_add_station_common); |
420 | 366 | ||
421 | static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | 367 | static struct iwl_link_quality_cmd *iwl_sta_alloc_lq(struct iwl_priv *priv, |
368 | u8 sta_id) | ||
422 | { | 369 | { |
423 | int i, r; | 370 | int i, r; |
424 | struct iwl_link_quality_cmd link_cmd = { | 371 | struct iwl_link_quality_cmd *link_cmd; |
425 | .reserved1 = 0, | ||
426 | }; | ||
427 | u32 rate_flags; | 372 | u32 rate_flags; |
428 | int ret = 0; | ||
429 | 373 | ||
374 | link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); | ||
375 | if (!link_cmd) { | ||
376 | IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); | ||
377 | return NULL; | ||
378 | } | ||
430 | /* Set up the rate scaling to start at selected rate, fall back | 379 | /* Set up the rate scaling to start at selected rate, fall back |
431 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 380 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
432 | if (is_ap) | 381 | if (priv->band == IEEE80211_BAND_5GHZ) |
433 | r = IWL_RATE_54M_INDEX; | ||
434 | else if (priv->band == IEEE80211_BAND_5GHZ) | ||
435 | r = IWL_RATE_6M_INDEX; | 382 | r = IWL_RATE_6M_INDEX; |
436 | else | 383 | else |
437 | r = IWL_RATE_1M_INDEX; | 384 | r = IWL_RATE_1M_INDEX; |
@@ -444,49 +391,48 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | |||
444 | rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << | 391 | rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << |
445 | RATE_MCS_ANT_POS; | 392 | RATE_MCS_ANT_POS; |
446 | 393 | ||
447 | link_cmd.rs_table[i].rate_n_flags = | 394 | link_cmd->rs_table[i].rate_n_flags = |
448 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); | 395 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); |
449 | r = iwl_get_prev_ieee_rate(r); | 396 | r = iwl_get_prev_ieee_rate(r); |
450 | } | 397 | } |
451 | 398 | ||
452 | link_cmd.general_params.single_stream_ant_msk = | 399 | link_cmd->general_params.single_stream_ant_msk = |
453 | first_antenna(priv->hw_params.valid_tx_ant); | 400 | first_antenna(priv->hw_params.valid_tx_ant); |
454 | 401 | ||
455 | link_cmd.general_params.dual_stream_ant_msk = | 402 | link_cmd->general_params.dual_stream_ant_msk = |
456 | priv->hw_params.valid_tx_ant & | 403 | priv->hw_params.valid_tx_ant & |
457 | ~first_antenna(priv->hw_params.valid_tx_ant); | 404 | ~first_antenna(priv->hw_params.valid_tx_ant); |
458 | if (!link_cmd.general_params.dual_stream_ant_msk) { | 405 | if (!link_cmd->general_params.dual_stream_ant_msk) { |
459 | link_cmd.general_params.dual_stream_ant_msk = ANT_AB; | 406 | link_cmd->general_params.dual_stream_ant_msk = ANT_AB; |
460 | } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { | 407 | } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { |
461 | link_cmd.general_params.dual_stream_ant_msk = | 408 | link_cmd->general_params.dual_stream_ant_msk = |
462 | priv->hw_params.valid_tx_ant; | 409 | priv->hw_params.valid_tx_ant; |
463 | } | 410 | } |
464 | 411 | ||
465 | link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; | 412 | link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; |
466 | link_cmd.agg_params.agg_time_limit = | 413 | link_cmd->agg_params.agg_time_limit = |
467 | cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); | 414 | cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); |
468 | 415 | ||
469 | /* Update the rate scaling for control frame Tx to AP */ | 416 | link_cmd->sta_id = sta_id; |
470 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id; | ||
471 | 417 | ||
472 | ret = iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, | 418 | return link_cmd; |
473 | sizeof(link_cmd), &link_cmd); | ||
474 | if (ret) | ||
475 | IWL_ERR(priv, "REPLY_TX_LINK_QUALITY_CMD failed (%d)\n", ret); | ||
476 | } | 419 | } |
477 | 420 | ||
478 | /* | 421 | /* |
479 | * iwl_add_local_stations - Add stations not requested by mac80211 | 422 | * iwl_add_bssid_station - Add the special IBSS BSSID station |
480 | * | ||
481 | * This will be either the broadcast station or the bssid station needed by | ||
482 | * ad-hoc. | ||
483 | * | 423 | * |
484 | * Function sleeps. | 424 | * Function sleeps. |
485 | */ | 425 | */ |
486 | int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs) | 426 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, |
427 | u8 *sta_id_r) | ||
487 | { | 428 | { |
488 | int ret; | 429 | int ret; |
489 | u8 sta_id; | 430 | u8 sta_id; |
431 | struct iwl_link_quality_cmd *link_cmd; | ||
432 | unsigned long flags; | ||
433 | |||
434 | if (*sta_id_r) | ||
435 | *sta_id_r = IWL_INVALID_STATION; | ||
490 | 436 | ||
491 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); | 437 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); |
492 | if (ret) { | 438 | if (ret) { |
@@ -494,12 +440,34 @@ int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs) | |||
494 | return ret; | 440 | return ret; |
495 | } | 441 | } |
496 | 442 | ||
497 | if (init_rs) | 443 | if (sta_id_r) |
444 | *sta_id_r = sta_id; | ||
445 | |||
446 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
447 | priv->stations[sta_id].used |= IWL_STA_LOCAL; | ||
448 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
449 | |||
450 | if (init_rs) { | ||
498 | /* Set up default rate scaling table in device's station table */ | 451 | /* Set up default rate scaling table in device's station table */ |
499 | iwl_sta_init_lq(priv, addr, false); | 452 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); |
453 | if (!link_cmd) { | ||
454 | IWL_ERR(priv, "Unable to initialize rate scaling for station %pM.\n", | ||
455 | addr); | ||
456 | return -ENOMEM; | ||
457 | } | ||
458 | |||
459 | ret = iwl_send_lq_cmd(priv, link_cmd, CMD_SYNC, true); | ||
460 | if (ret) | ||
461 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); | ||
462 | |||
463 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
464 | priv->stations[sta_id].lq = link_cmd; | ||
465 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
466 | } | ||
467 | |||
500 | return 0; | 468 | return 0; |
501 | } | 469 | } |
502 | EXPORT_SYMBOL(iwl_add_local_station); | 470 | EXPORT_SYMBOL(iwl_add_bssid_station); |
503 | 471 | ||
504 | /** | 472 | /** |
505 | * iwl_sta_ucode_deactivate - deactivate ucode status for a station | 473 | * iwl_sta_ucode_deactivate - deactivate ucode status for a station |
@@ -509,7 +477,8 @@ EXPORT_SYMBOL(iwl_add_local_station); | |||
509 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) | 477 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) |
510 | { | 478 | { |
511 | /* Ucode must be active and driver must be non active */ | 479 | /* Ucode must be active and driver must be non active */ |
512 | if (priv->stations[sta_id].used != IWL_STA_UCODE_ACTIVE) | 480 | if ((priv->stations[sta_id].used & |
481 | (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != IWL_STA_UCODE_ACTIVE) | ||
513 | IWL_ERR(priv, "removed non active STA %u\n", sta_id); | 482 | IWL_ERR(priv, "removed non active STA %u\n", sta_id); |
514 | 483 | ||
515 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; | 484 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; |
@@ -574,18 +543,16 @@ static int iwl_send_remove_station(struct iwl_priv *priv, | |||
574 | /** | 543 | /** |
575 | * iwl_remove_station - Remove driver's knowledge of station. | 544 | * iwl_remove_station - Remove driver's knowledge of station. |
576 | */ | 545 | */ |
577 | static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | 546 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, |
547 | const u8 *addr) | ||
578 | { | 548 | { |
579 | int sta_id = IWL_INVALID_STATION; | ||
580 | int i, ret = -EINVAL; | ||
581 | unsigned long flags; | ||
582 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | ||
583 | struct iwl_station_entry *station; | 549 | struct iwl_station_entry *station; |
550 | unsigned long flags; | ||
584 | 551 | ||
585 | if (!iwl_is_ready(priv)) { | 552 | if (!iwl_is_ready(priv)) { |
586 | IWL_DEBUG_INFO(priv, | 553 | IWL_DEBUG_INFO(priv, |
587 | "Unable to remove station %pM, device not ready.\n", | 554 | "Unable to remove station %pM, device not ready.\n", |
588 | sta->addr); | 555 | addr); |
589 | /* | 556 | /* |
590 | * It is typical for stations to be removed when we are | 557 | * It is typical for stations to be removed when we are |
591 | * going down. Return success since device will be down | 558 | * going down. Return success since device will be down |
@@ -594,37 +561,30 @@ static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | |||
594 | return 0; | 561 | return 0; |
595 | } | 562 | } |
596 | 563 | ||
597 | spin_lock_irqsave(&priv->sta_lock, flags); | 564 | IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", |
598 | 565 | sta_id, addr); | |
599 | if (is_ap) | ||
600 | sta_id = IWL_AP_ID; | ||
601 | else | ||
602 | for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) | ||
603 | if (priv->stations[i].used && | ||
604 | !compare_ether_addr(priv->stations[i].sta.sta.addr, | ||
605 | sta->addr)) { | ||
606 | sta_id = i; | ||
607 | break; | ||
608 | } | ||
609 | 566 | ||
610 | if (unlikely(sta_id == IWL_INVALID_STATION)) | 567 | if (WARN_ON(sta_id == IWL_INVALID_STATION)) |
611 | goto out; | 568 | return -EINVAL; |
612 | 569 | ||
613 | IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", | 570 | spin_lock_irqsave(&priv->sta_lock, flags); |
614 | sta_id, sta->addr); | ||
615 | 571 | ||
616 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { | 572 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { |
617 | IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", | 573 | IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", |
618 | sta->addr); | 574 | addr); |
619 | goto out; | 575 | goto out_err; |
620 | } | 576 | } |
621 | 577 | ||
622 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { | 578 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { |
623 | IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", | 579 | IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", |
624 | sta->addr); | 580 | addr); |
625 | goto out; | 581 | goto out_err; |
626 | } | 582 | } |
627 | 583 | ||
584 | if (priv->stations[sta_id].used & IWL_STA_LOCAL) { | ||
585 | kfree(priv->stations[sta_id].lq); | ||
586 | priv->stations[sta_id].lq = NULL; | ||
587 | } | ||
628 | 588 | ||
629 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; | 589 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; |
630 | 590 | ||
@@ -635,56 +595,35 @@ static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | |||
635 | station = &priv->stations[sta_id]; | 595 | station = &priv->stations[sta_id]; |
636 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 596 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
637 | 597 | ||
638 | ret = iwl_send_remove_station(priv, station); | 598 | return iwl_send_remove_station(priv, station); |
639 | return ret; | 599 | out_err: |
640 | out: | ||
641 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 600 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
642 | return ret; | 601 | return -EINVAL; |
643 | } | 602 | } |
603 | EXPORT_SYMBOL_GPL(iwl_remove_station); | ||
644 | 604 | ||
645 | /** | 605 | /** |
646 | * iwl_clear_ucode_stations() - clear entire station table driver and/or ucode | 606 | * iwl_clear_ucode_stations - clear ucode station table bits |
647 | * @priv: | 607 | * |
648 | * @force: If set then the uCode station table needs to be cleared here. If | 608 | * This function clears all the bits in the driver indicating |
649 | * not set then the uCode station table has already been cleared, | 609 | * which stations are active in the ucode. Call when something |
650 | * for example after sending it a RXON command without ASSOC bit | 610 | * other than explicit station management would cause this in |
651 | * set, and we just need to change driver state here. | 611 | * the ucode, e.g. unassociated RXON. |
652 | */ | 612 | */ |
653 | void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force) | 613 | void iwl_clear_ucode_stations(struct iwl_priv *priv) |
654 | { | 614 | { |
655 | int i; | 615 | int i; |
656 | unsigned long flags_spin; | 616 | unsigned long flags_spin; |
657 | bool cleared = false; | 617 | bool cleared = false; |
658 | 618 | ||
659 | IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver%s\n", | 619 | IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); |
660 | force ? " and ucode" : ""); | ||
661 | |||
662 | if (force) { | ||
663 | if (!iwl_is_ready(priv)) { | ||
664 | /* | ||
665 | * If device is not ready at this point the station | ||
666 | * table is likely already empty (uCode not ready | ||
667 | * to receive station requests) or will soon be | ||
668 | * due to interface going down. | ||
669 | */ | ||
670 | IWL_DEBUG_INFO(priv, "Unable to remove stations from device - device not ready\n"); | ||
671 | } else { | ||
672 | iwl_send_cmd_pdu_async(priv, REPLY_REMOVE_ALL_STA, 0, NULL, NULL); | ||
673 | } | ||
674 | } | ||
675 | 620 | ||
676 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 621 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
677 | if (force) { | 622 | for (i = 0; i < priv->hw_params.max_stations; i++) { |
678 | IWL_DEBUG_INFO(priv, "Clearing all station information in driver\n"); | 623 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { |
679 | priv->num_stations = 0; | 624 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); |
680 | memset(priv->stations, 0, sizeof(priv->stations)); | 625 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; |
681 | } else { | 626 | cleared = true; |
682 | for (i = 0; i < priv->hw_params.max_stations; i++) { | ||
683 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { | ||
684 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); | ||
685 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | ||
686 | cleared = true; | ||
687 | } | ||
688 | } | 627 | } |
689 | } | 628 | } |
690 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 629 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
@@ -1027,18 +966,23 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | |||
1027 | 966 | ||
1028 | void iwl_update_tkip_key(struct iwl_priv *priv, | 967 | void iwl_update_tkip_key(struct iwl_priv *priv, |
1029 | struct ieee80211_key_conf *keyconf, | 968 | struct ieee80211_key_conf *keyconf, |
1030 | const u8 *addr, u32 iv32, u16 *phase1key) | 969 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) |
1031 | { | 970 | { |
1032 | u8 sta_id = IWL_INVALID_STATION; | 971 | u8 sta_id; |
1033 | unsigned long flags; | 972 | unsigned long flags; |
1034 | int i; | 973 | int i; |
1035 | 974 | ||
1036 | sta_id = iwl_find_station(priv, addr); | 975 | if (sta) { |
1037 | if (sta_id == IWL_INVALID_STATION) { | 976 | sta_id = iwl_sta_id(sta); |
1038 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 977 | |
1039 | addr); | 978 | if (sta_id == IWL_INVALID_STATION) { |
1040 | return; | 979 | IWL_DEBUG_MAC80211(priv, "leave - %pM not initialised.\n", |
1041 | } | 980 | sta->addr); |
981 | return; | ||
982 | } | ||
983 | } else | ||
984 | sta_id = priv->hw_params.bcast_sta_id; | ||
985 | |||
1042 | 986 | ||
1043 | if (iwl_scan_cancel(priv)) { | 987 | if (iwl_scan_cancel(priv)) { |
1044 | /* cancel scan failed, just live w/ bad key and rely | 988 | /* cancel scan failed, just live w/ bad key and rely |
@@ -1178,6 +1122,39 @@ static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, | |||
1178 | #endif | 1122 | #endif |
1179 | 1123 | ||
1180 | /** | 1124 | /** |
1125 | * is_lq_table_valid() - Test one aspect of LQ cmd for validity | ||
1126 | * | ||
1127 | * It sometimes happens when a HT rate has been in use and we | ||
1128 | * loose connectivity with AP then mac80211 will first tell us that the | ||
1129 | * current channel is not HT anymore before removing the station. In such a | ||
1130 | * scenario the RXON flags will be updated to indicate we are not | ||
1131 | * communicating HT anymore, but the LQ command may still contain HT rates. | ||
1132 | * Test for this to prevent driver from sending LQ command between the time | ||
1133 | * RXON flags are updated and when LQ command is updated. | ||
1134 | */ | ||
1135 | static bool is_lq_table_valid(struct iwl_priv *priv, | ||
1136 | struct iwl_link_quality_cmd *lq) | ||
1137 | { | ||
1138 | int i; | ||
1139 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | ||
1140 | |||
1141 | if (ht_conf->is_ht) | ||
1142 | return true; | ||
1143 | |||
1144 | IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", | ||
1145 | priv->active_rxon.channel); | ||
1146 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { | ||
1147 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { | ||
1148 | IWL_DEBUG_INFO(priv, | ||
1149 | "index %d of LQ expects HT channel\n", | ||
1150 | i); | ||
1151 | return false; | ||
1152 | } | ||
1153 | } | ||
1154 | return true; | ||
1155 | } | ||
1156 | |||
1157 | /** | ||
1181 | * iwl_send_lq_cmd() - Send link quality command | 1158 | * iwl_send_lq_cmd() - Send link quality command |
1182 | * @init: This command is sent as part of station initialization right | 1159 | * @init: This command is sent as part of station initialization right |
1183 | * after station has been added. | 1160 | * after station has been added. |
@@ -1206,8 +1183,12 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1206 | iwl_dump_lq_cmd(priv, lq); | 1183 | iwl_dump_lq_cmd(priv, lq); |
1207 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); | 1184 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); |
1208 | 1185 | ||
1209 | ret = iwl_send_cmd(priv, &cmd); | 1186 | if (is_lq_table_valid(priv, lq)) |
1210 | if (ret || (cmd.flags & CMD_ASYNC)) | 1187 | ret = iwl_send_cmd(priv, &cmd); |
1188 | else | ||
1189 | ret = -EINVAL; | ||
1190 | |||
1191 | if (cmd.flags & CMD_ASYNC) | ||
1211 | return ret; | 1192 | return ret; |
1212 | 1193 | ||
1213 | if (init) { | 1194 | if (init) { |
@@ -1217,92 +1198,72 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1217 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | 1198 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; |
1218 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 1199 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
1219 | } | 1200 | } |
1220 | return 0; | 1201 | return ret; |
1221 | } | 1202 | } |
1222 | EXPORT_SYMBOL(iwl_send_lq_cmd); | 1203 | EXPORT_SYMBOL(iwl_send_lq_cmd); |
1223 | 1204 | ||
1224 | /** | 1205 | /** |
1225 | * iwl_add_bcast_station - add broadcast station into station table. | 1206 | * iwl_alloc_bcast_station - add broadcast station into driver's station table. |
1207 | * | ||
1208 | * This adds the broadcast station into the driver's station table | ||
1209 | * and marks it driver active, so that it will be restored to the | ||
1210 | * device at the next best time. | ||
1226 | */ | 1211 | */ |
1227 | void iwl_add_bcast_station(struct iwl_priv *priv) | 1212 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq) |
1228 | { | 1213 | { |
1229 | IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n"); | 1214 | struct iwl_link_quality_cmd *link_cmd; |
1230 | iwl_add_local_station(priv, iwl_bcast_addr, true); | 1215 | unsigned long flags; |
1231 | } | 1216 | u8 sta_id; |
1232 | EXPORT_SYMBOL(iwl_add_bcast_station); | ||
1233 | 1217 | ||
1234 | /** | 1218 | spin_lock_irqsave(&priv->sta_lock, flags); |
1235 | * iwl3945_add_bcast_station - add broadcast station into station table. | 1219 | sta_id = iwl_prep_station(priv, iwl_bcast_addr, false, NULL); |
1236 | */ | 1220 | if (sta_id == IWL_INVALID_STATION) { |
1237 | void iwl3945_add_bcast_station(struct iwl_priv *priv) | 1221 | IWL_ERR(priv, "Unable to prepare broadcast station\n"); |
1238 | { | 1222 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1239 | IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n"); | ||
1240 | iwl_add_local_station(priv, iwl_bcast_addr, false); | ||
1241 | /* | ||
1242 | * It is assumed that when station is added more initialization | ||
1243 | * needs to be done, but for 3945 it is not the case and we can | ||
1244 | * just release station table access right here. | ||
1245 | */ | ||
1246 | priv->stations[priv->hw_params.bcast_sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | ||
1247 | 1223 | ||
1248 | } | 1224 | return -EINVAL; |
1249 | EXPORT_SYMBOL(iwl3945_add_bcast_station); | 1225 | } |
1250 | 1226 | ||
1251 | /** | 1227 | priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; |
1252 | * iwl_get_sta_id - Find station's index within station table | 1228 | priv->stations[sta_id].used |= IWL_STA_BCAST; |
1253 | * | 1229 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1254 | * If new IBSS station, create new entry in station table | ||
1255 | */ | ||
1256 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
1257 | { | ||
1258 | int sta_id; | ||
1259 | __le16 fc = hdr->frame_control; | ||
1260 | 1230 | ||
1261 | /* If this frame is broadcast or management, use broadcast station id */ | 1231 | if (init_lq) { |
1262 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) | 1232 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); |
1263 | return priv->hw_params.bcast_sta_id; | 1233 | if (!link_cmd) { |
1234 | IWL_ERR(priv, | ||
1235 | "Unable to initialize rate scaling for bcast station.\n"); | ||
1236 | return -ENOMEM; | ||
1237 | } | ||
1264 | 1238 | ||
1265 | switch (priv->iw_mode) { | 1239 | spin_lock_irqsave(&priv->sta_lock, flags); |
1240 | priv->stations[sta_id].lq = link_cmd; | ||
1241 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1242 | } | ||
1266 | 1243 | ||
1267 | /* If we are a client station in a BSS network, use the special | 1244 | return 0; |
1268 | * AP station entry (that's the only station we communicate with) */ | 1245 | } |
1269 | case NL80211_IFTYPE_STATION: | 1246 | EXPORT_SYMBOL_GPL(iwl_alloc_bcast_station); |
1270 | /* | ||
1271 | * If addition of station not complete yet, which means | ||
1272 | * that rate scaling has not been initialized, then return | ||
1273 | * the broadcast station. | ||
1274 | */ | ||
1275 | if (!(priv->stations[IWL_AP_ID].used & IWL_STA_UCODE_ACTIVE)) | ||
1276 | return priv->hw_params.bcast_sta_id; | ||
1277 | return IWL_AP_ID; | ||
1278 | |||
1279 | /* If we are an AP, then find the station, or use BCAST */ | ||
1280 | case NL80211_IFTYPE_AP: | ||
1281 | sta_id = iwl_find_station(priv, hdr->addr1); | ||
1282 | if (sta_id != IWL_INVALID_STATION) | ||
1283 | return sta_id; | ||
1284 | return priv->hw_params.bcast_sta_id; | ||
1285 | |||
1286 | /* If this frame is going out to an IBSS network, find the station, | ||
1287 | * or create a new station table entry */ | ||
1288 | case NL80211_IFTYPE_ADHOC: | ||
1289 | sta_id = iwl_find_station(priv, hdr->addr1); | ||
1290 | if (sta_id != IWL_INVALID_STATION) | ||
1291 | return sta_id; | ||
1292 | |||
1293 | IWL_DEBUG_DROP(priv, "Station %pM not in station map. " | ||
1294 | "Defaulting to broadcast...\n", | ||
1295 | hdr->addr1); | ||
1296 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | ||
1297 | return priv->hw_params.bcast_sta_id; | ||
1298 | 1247 | ||
1299 | default: | 1248 | void iwl_dealloc_bcast_station(struct iwl_priv *priv) |
1300 | IWL_WARN(priv, "Unknown mode of operation: %d\n", | 1249 | { |
1301 | priv->iw_mode); | 1250 | unsigned long flags; |
1302 | return priv->hw_params.bcast_sta_id; | 1251 | int i; |
1252 | |||
1253 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1254 | for (i = 0; i < priv->hw_params.max_stations; i++) { | ||
1255 | if (!(priv->stations[i].used & IWL_STA_BCAST)) | ||
1256 | continue; | ||
1257 | |||
1258 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | ||
1259 | priv->num_stations--; | ||
1260 | BUG_ON(priv->num_stations < 0); | ||
1261 | kfree(priv->stations[i].lq); | ||
1262 | priv->stations[i].lq = NULL; | ||
1303 | } | 1263 | } |
1264 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1304 | } | 1265 | } |
1305 | EXPORT_SYMBOL(iwl_get_sta_id); | 1266 | EXPORT_SYMBOL_GPL(iwl_dealloc_bcast_station); |
1306 | 1267 | ||
1307 | /** | 1268 | /** |
1308 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table | 1269 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table |
@@ -1322,13 +1283,13 @@ void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) | |||
1322 | } | 1283 | } |
1323 | EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid); | 1284 | EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid); |
1324 | 1285 | ||
1325 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | 1286 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, |
1326 | const u8 *addr, int tid, u16 ssn) | 1287 | int tid, u16 ssn) |
1327 | { | 1288 | { |
1328 | unsigned long flags; | 1289 | unsigned long flags; |
1329 | int sta_id; | 1290 | int sta_id; |
1330 | 1291 | ||
1331 | sta_id = iwl_find_station(priv, addr); | 1292 | sta_id = iwl_sta_id(sta); |
1332 | if (sta_id == IWL_INVALID_STATION) | 1293 | if (sta_id == IWL_INVALID_STATION) |
1333 | return -ENXIO; | 1294 | return -ENXIO; |
1334 | 1295 | ||
@@ -1341,16 +1302,17 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, | |||
1341 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1302 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1342 | 1303 | ||
1343 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | 1304 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, |
1344 | CMD_ASYNC); | 1305 | CMD_ASYNC); |
1345 | } | 1306 | } |
1346 | EXPORT_SYMBOL(iwl_sta_rx_agg_start); | 1307 | EXPORT_SYMBOL(iwl_sta_rx_agg_start); |
1347 | 1308 | ||
1348 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid) | 1309 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, |
1310 | int tid) | ||
1349 | { | 1311 | { |
1350 | unsigned long flags; | 1312 | unsigned long flags; |
1351 | int sta_id; | 1313 | int sta_id; |
1352 | 1314 | ||
1353 | sta_id = iwl_find_station(priv, addr); | 1315 | sta_id = iwl_sta_id(sta); |
1354 | if (sta_id == IWL_INVALID_STATION) { | 1316 | if (sta_id == IWL_INVALID_STATION) { |
1355 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 1317 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); |
1356 | return -ENXIO; | 1318 | return -ENXIO; |
@@ -1402,14 +1364,16 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) | |||
1402 | EXPORT_SYMBOL(iwl_sta_modify_sleep_tx_count); | 1364 | EXPORT_SYMBOL(iwl_sta_modify_sleep_tx_count); |
1403 | 1365 | ||
1404 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, | 1366 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, |
1405 | struct ieee80211_vif *vif, | 1367 | struct ieee80211_vif *vif, |
1406 | struct ieee80211_sta *sta) | 1368 | struct ieee80211_sta *sta) |
1407 | { | 1369 | { |
1408 | int ret; | ||
1409 | struct iwl_priv *priv = hw->priv; | 1370 | struct iwl_priv *priv = hw->priv; |
1371 | struct iwl_station_priv_common *sta_common = (void *)sta->drv_priv; | ||
1372 | int ret; | ||
1373 | |||
1410 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", | 1374 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", |
1411 | sta->addr); | 1375 | sta->addr); |
1412 | ret = iwl_remove_station(priv, sta); | 1376 | ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); |
1413 | if (ret) | 1377 | if (ret) |
1414 | IWL_ERR(priv, "Error removing station %pM\n", | 1378 | IWL_ERR(priv, "Error removing station %pM\n", |
1415 | sta->addr); | 1379 | sta->addr); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index 42cd2f4a01cd..c2a453a1a991 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #ifndef __iwl_sta_h__ | 29 | #ifndef __iwl_sta_h__ |
30 | #define __iwl_sta_h__ | 30 | #define __iwl_sta_h__ |
31 | 31 | ||
32 | #include "iwl-dev.h" | ||
33 | |||
32 | #define HW_KEY_DYNAMIC 0 | 34 | #define HW_KEY_DYNAMIC 0 |
33 | #define HW_KEY_DEFAULT 1 | 35 | #define HW_KEY_DEFAULT 1 |
34 | 36 | ||
@@ -36,14 +38,11 @@ | |||
36 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ | 38 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ |
37 | #define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of | 39 | #define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of |
38 | being activated */ | 40 | being activated */ |
41 | #define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211; | ||
42 | (this is for the IBSS BSSID stations) */ | ||
43 | #define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ | ||
39 | 44 | ||
40 | 45 | ||
41 | /** | ||
42 | * iwl_find_station - Find station id for a given BSSID | ||
43 | * @bssid: MAC address of station ID to find | ||
44 | */ | ||
45 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid); | ||
46 | |||
47 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 46 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
48 | struct ieee80211_key_conf *key); | 47 | struct ieee80211_key_conf *key); |
49 | int iwl_set_default_wep_key(struct iwl_priv *priv, | 48 | int iwl_set_default_wep_key(struct iwl_priv *priv, |
@@ -55,28 +54,57 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
55 | struct ieee80211_key_conf *key, u8 sta_id); | 54 | struct ieee80211_key_conf *key, u8 sta_id); |
56 | void iwl_update_tkip_key(struct iwl_priv *priv, | 55 | void iwl_update_tkip_key(struct iwl_priv *priv, |
57 | struct ieee80211_key_conf *keyconf, | 56 | struct ieee80211_key_conf *keyconf, |
58 | const u8 *addr, u32 iv32, u16 *phase1key); | 57 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); |
59 | 58 | ||
60 | void iwl_add_bcast_station(struct iwl_priv *priv); | ||
61 | void iwl3945_add_bcast_station(struct iwl_priv *priv); | ||
62 | void iwl_restore_stations(struct iwl_priv *priv); | 59 | void iwl_restore_stations(struct iwl_priv *priv); |
63 | void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force); | 60 | void iwl_clear_ucode_stations(struct iwl_priv *priv); |
61 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq); | ||
62 | void iwl_dealloc_bcast_station(struct iwl_priv *priv); | ||
64 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); | 63 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); |
65 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | ||
66 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | ||
67 | int iwl_send_add_sta(struct iwl_priv *priv, | 64 | int iwl_send_add_sta(struct iwl_priv *priv, |
68 | struct iwl_addsta_cmd *sta, u8 flags); | 65 | struct iwl_addsta_cmd *sta, u8 flags); |
69 | int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs); | 66 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, |
67 | u8 *sta_id_r); | ||
70 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | 68 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, |
71 | bool is_ap, | 69 | bool is_ap, |
72 | struct ieee80211_sta_ht_cap *ht_info, | 70 | struct ieee80211_sta_ht_cap *ht_info, |
73 | u8 *sta_id_r); | 71 | u8 *sta_id_r); |
72 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, | ||
73 | const u8 *addr); | ||
74 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 74 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
75 | struct ieee80211_sta *sta); | 75 | struct ieee80211_sta *sta); |
76 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); | 76 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); |
77 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | 77 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, |
78 | const u8 *addr, int tid, u16 ssn); | 78 | int tid, u16 ssn); |
79 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); | 79 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, |
80 | int tid); | ||
80 | void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id); | 81 | void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id); |
81 | void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); | 82 | void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); |
83 | |||
84 | /** | ||
85 | * iwl_clear_driver_stations - clear knowledge of all stations from driver | ||
86 | * @priv: iwl priv struct | ||
87 | * | ||
88 | * This is called during iwl_down() to make sure that in the case | ||
89 | * we're coming there from a hardware restart mac80211 will be | ||
90 | * able to reconfigure stations -- if we're getting there in the | ||
91 | * normal down flow then the stations will already be cleared. | ||
92 | */ | ||
93 | static inline void iwl_clear_driver_stations(struct iwl_priv *priv) | ||
94 | { | ||
95 | unsigned long flags; | ||
96 | |||
97 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
98 | memset(priv->stations, 0, sizeof(priv->stations)); | ||
99 | priv->num_stations = 0; | ||
100 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
101 | } | ||
102 | |||
103 | static inline int iwl_sta_id(struct ieee80211_sta *sta) | ||
104 | { | ||
105 | if (WARN_ON(!sta)) | ||
106 | return IWL_INVALID_STATION; | ||
107 | |||
108 | return ((struct iwl_station_priv_common *)sta->drv_priv)->sta_id; | ||
109 | } | ||
82 | #endif /* __iwl_sta_h__ */ | 110 | #endif /* __iwl_sta_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 1beb81c0be68..3e5bffb6034f 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -509,11 +509,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
509 | 509 | ||
510 | hdr_len = ieee80211_hdrlen(fc); | 510 | hdr_len = ieee80211_hdrlen(fc); |
511 | 511 | ||
512 | /* Find (or create) index into station table for destination station */ | 512 | /* Find index into station table for destination station */ |
513 | if (info->flags & IEEE80211_TX_CTL_INJECTED) | 513 | if (!info->control.sta) |
514 | sta_id = priv->hw_params.bcast_sta_id; | 514 | sta_id = priv->hw_params.bcast_sta_id; |
515 | else | 515 | else |
516 | sta_id = iwl_get_sta_id(priv, hdr); | 516 | sta_id = iwl_sta_id(info->control.sta); |
517 | if (sta_id == IWL_INVALID_STATION) { | 517 | if (sta_id == IWL_INVALID_STATION) { |
518 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 518 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
519 | hdr->addr1); | 519 | hdr->addr1); |
@@ -1847,7 +1847,8 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
1847 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1847 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
1848 | enum ieee80211_band band, | 1848 | enum ieee80211_band band, |
1849 | u8 is_active, u8 n_probes, | 1849 | u8 is_active, u8 n_probes, |
1850 | struct iwl3945_scan_channel *scan_ch) | 1850 | struct iwl3945_scan_channel *scan_ch, |
1851 | struct ieee80211_vif *vif) | ||
1851 | { | 1852 | { |
1852 | struct ieee80211_channel *chan; | 1853 | struct ieee80211_channel *chan; |
1853 | const struct ieee80211_supported_band *sband; | 1854 | const struct ieee80211_supported_band *sband; |
@@ -1861,7 +1862,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | |||
1861 | return 0; | 1862 | return 0; |
1862 | 1863 | ||
1863 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); | 1864 | active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); |
1864 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | 1865 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); |
1865 | 1866 | ||
1866 | if (passive_dwell <= active_dwell) | 1867 | if (passive_dwell <= active_dwell) |
1867 | passive_dwell = active_dwell + 1; | 1868 | passive_dwell = active_dwell + 1; |
@@ -2109,6 +2110,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv) | |||
2109 | iwl_write32(priv, CSR_RESET, 0); | 2110 | iwl_write32(priv, CSR_RESET, 0); |
2110 | } | 2111 | } |
2111 | 2112 | ||
2113 | #define IWL3945_UCODE_GET(item) \ | ||
2114 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ | ||
2115 | { \ | ||
2116 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2117 | } | ||
2118 | |||
2119 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2120 | { | ||
2121 | return 24; | ||
2122 | } | ||
2123 | |||
2124 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) | ||
2125 | { | ||
2126 | return (u8 *) ucode->u.v1.data; | ||
2127 | } | ||
2128 | |||
2129 | IWL3945_UCODE_GET(inst_size); | ||
2130 | IWL3945_UCODE_GET(data_size); | ||
2131 | IWL3945_UCODE_GET(init_size); | ||
2132 | IWL3945_UCODE_GET(init_data_size); | ||
2133 | IWL3945_UCODE_GET(boot_size); | ||
2134 | |||
2112 | /** | 2135 | /** |
2113 | * iwl3945_read_ucode - Read uCode images from disk file. | 2136 | * iwl3945_read_ucode - Read uCode images from disk file. |
2114 | * | 2137 | * |
@@ -2157,7 +2180,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2157 | goto error; | 2180 | goto error; |
2158 | 2181 | ||
2159 | /* Make sure that we got at least our header! */ | 2182 | /* Make sure that we got at least our header! */ |
2160 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 2183 | if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { |
2161 | IWL_ERR(priv, "File size way too small!\n"); | 2184 | IWL_ERR(priv, "File size way too small!\n"); |
2162 | ret = -EINVAL; | 2185 | ret = -EINVAL; |
2163 | goto err_release; | 2186 | goto err_release; |
@@ -2168,13 +2191,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2168 | 2191 | ||
2169 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 2192 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
2170 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 2193 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
2171 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | 2194 | inst_size = iwl3945_ucode_get_inst_size(ucode); |
2172 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | 2195 | data_size = iwl3945_ucode_get_data_size(ucode); |
2173 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | 2196 | init_size = iwl3945_ucode_get_init_size(ucode); |
2174 | init_data_size = | 2197 | init_data_size = iwl3945_ucode_get_init_data_size(ucode); |
2175 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | 2198 | boot_size = iwl3945_ucode_get_boot_size(ucode); |
2176 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | 2199 | src = iwl3945_ucode_get_data(ucode); |
2177 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
2178 | 2200 | ||
2179 | /* api_ver should match the api version forming part of the | 2201 | /* api_ver should match the api version forming part of the |
2180 | * firmware filename ... but we don't check for that and only rely | 2202 | * firmware filename ... but we don't check for that and only rely |
@@ -2223,7 +2245,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2223 | 2245 | ||
2224 | 2246 | ||
2225 | /* Verify size of file vs. image size info in file's header */ | 2247 | /* Verify size of file vs. image size info in file's header */ |
2226 | if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) + | 2248 | if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + |
2227 | inst_size + data_size + init_size + | 2249 | inst_size + data_size + init_size + |
2228 | init_data_size + boot_size) { | 2250 | init_data_size + boot_size) { |
2229 | 2251 | ||
@@ -2522,7 +2544,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2522 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2544 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2523 | } else { | 2545 | } else { |
2524 | /* Initialize our rx_config data */ | 2546 | /* Initialize our rx_config data */ |
2525 | iwl_connection_init_rx_config(priv, priv->iw_mode); | 2547 | iwl_connection_init_rx_config(priv, NULL); |
2526 | } | 2548 | } |
2527 | 2549 | ||
2528 | /* Configure Bluetooth device coexistence support */ | 2550 | /* Configure Bluetooth device coexistence support */ |
@@ -2561,7 +2583,9 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
2561 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2583 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2562 | 2584 | ||
2563 | /* Station information will now be cleared in device */ | 2585 | /* Station information will now be cleared in device */ |
2564 | iwl_clear_ucode_stations(priv, true); | 2586 | iwl_clear_ucode_stations(priv); |
2587 | iwl_dealloc_bcast_station(priv); | ||
2588 | iwl_clear_driver_stations(priv); | ||
2565 | 2589 | ||
2566 | /* Unblock any waiting calls */ | 2590 | /* Unblock any waiting calls */ |
2567 | wake_up_interruptible_all(&priv->wait_command_queue); | 2591 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -2642,6 +2666,10 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
2642 | { | 2666 | { |
2643 | int rc, i; | 2667 | int rc, i; |
2644 | 2668 | ||
2669 | rc = iwl_alloc_bcast_station(priv, false); | ||
2670 | if (rc) | ||
2671 | return rc; | ||
2672 | |||
2645 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2673 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
2646 | IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); | 2674 | IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); |
2647 | return -EIO; | 2675 | return -EIO; |
@@ -2790,7 +2818,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data) | |||
2790 | 2818 | ||
2791 | } | 2819 | } |
2792 | 2820 | ||
2793 | void iwl3945_request_scan(struct iwl_priv *priv) | 2821 | void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) |
2794 | { | 2822 | { |
2795 | struct iwl_host_cmd cmd = { | 2823 | struct iwl_host_cmd cmd = { |
2796 | .id = REPLY_SCAN_CMD, | 2824 | .id = REPLY_SCAN_CMD, |
@@ -2871,7 +2899,7 @@ void iwl3945_request_scan(struct iwl_priv *priv) | |||
2871 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 2899 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
2872 | 2900 | ||
2873 | spin_lock_irqsave(&priv->lock, flags); | 2901 | spin_lock_irqsave(&priv->lock, flags); |
2874 | interval = priv->beacon_int; | 2902 | interval = vif ? vif->bss_conf.beacon_int : 0; |
2875 | spin_unlock_irqrestore(&priv->lock, flags); | 2903 | spin_unlock_irqrestore(&priv->lock, flags); |
2876 | 2904 | ||
2877 | scan->suspend_time = 0; | 2905 | scan->suspend_time = 0; |
@@ -2966,7 +2994,7 @@ void iwl3945_request_scan(struct iwl_priv *priv) | |||
2966 | 2994 | ||
2967 | scan->channel_count = | 2995 | scan->channel_count = |
2968 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | 2996 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, |
2969 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 2997 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); |
2970 | 2998 | ||
2971 | if (scan->channel_count == 0) { | 2999 | if (scan->channel_count == 0) { |
2972 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 3000 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
@@ -3039,26 +3067,25 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data) | |||
3039 | mutex_unlock(&priv->mutex); | 3067 | mutex_unlock(&priv->mutex); |
3040 | } | 3068 | } |
3041 | 3069 | ||
3042 | void iwl3945_post_associate(struct iwl_priv *priv) | 3070 | void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3043 | { | 3071 | { |
3044 | int rc = 0; | 3072 | int rc = 0; |
3045 | struct ieee80211_conf *conf = NULL; | 3073 | struct ieee80211_conf *conf = NULL; |
3046 | 3074 | ||
3047 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 3075 | if (!vif || !priv->is_open) |
3076 | return; | ||
3077 | |||
3078 | if (vif->type == NL80211_IFTYPE_AP) { | ||
3048 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); | 3079 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); |
3049 | return; | 3080 | return; |
3050 | } | 3081 | } |
3051 | 3082 | ||
3052 | |||
3053 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 3083 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
3054 | priv->assoc_id, priv->active_rxon.bssid_addr); | 3084 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); |
3055 | 3085 | ||
3056 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3086 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3057 | return; | 3087 | return; |
3058 | 3088 | ||
3059 | if (!priv->vif || !priv->is_open) | ||
3060 | return; | ||
3061 | |||
3062 | iwl_scan_cancel_timeout(priv, 200); | 3089 | iwl_scan_cancel_timeout(priv, 200); |
3063 | 3090 | ||
3064 | conf = ieee80211_get_hw_conf(priv->hw); | 3091 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -3067,7 +3094,7 @@ void iwl3945_post_associate(struct iwl_priv *priv) | |||
3067 | iwlcore_commit_rxon(priv); | 3094 | iwlcore_commit_rxon(priv); |
3068 | 3095 | ||
3069 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3096 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3070 | iwl_setup_rxon_timing(priv); | 3097 | iwl_setup_rxon_timing(priv, vif); |
3071 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3098 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3072 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 3099 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
3073 | if (rc) | 3100 | if (rc) |
@@ -3076,51 +3103,38 @@ void iwl3945_post_associate(struct iwl_priv *priv) | |||
3076 | 3103 | ||
3077 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3104 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3078 | 3105 | ||
3079 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3106 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
3080 | 3107 | ||
3081 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 3108 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
3082 | priv->assoc_id, priv->beacon_int); | 3109 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
3083 | 3110 | ||
3084 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3111 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
3085 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 3112 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
3086 | else | 3113 | else |
3087 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3114 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3088 | 3115 | ||
3089 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3116 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
3090 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3117 | if (vif->bss_conf.assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) |
3091 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 3118 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
3092 | else | 3119 | else |
3093 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3120 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3094 | 3121 | ||
3095 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3122 | if (vif->type == NL80211_IFTYPE_ADHOC) |
3096 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3123 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3097 | |||
3098 | } | 3124 | } |
3099 | 3125 | ||
3100 | iwlcore_commit_rxon(priv); | 3126 | iwlcore_commit_rxon(priv); |
3101 | 3127 | ||
3102 | switch (priv->iw_mode) { | 3128 | switch (vif->type) { |
3103 | case NL80211_IFTYPE_STATION: | 3129 | case NL80211_IFTYPE_STATION: |
3104 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); | 3130 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); |
3105 | break; | 3131 | break; |
3106 | |||
3107 | case NL80211_IFTYPE_ADHOC: | 3132 | case NL80211_IFTYPE_ADHOC: |
3108 | |||
3109 | priv->assoc_id = 1; | ||
3110 | iwl_add_local_station(priv, priv->bssid, false); | ||
3111 | iwl3945_sync_sta(priv, IWL_STA_ID, | ||
3112 | (priv->band == IEEE80211_BAND_5GHZ) ? | ||
3113 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | ||
3114 | CMD_ASYNC); | ||
3115 | iwl3945_rate_scale_init(priv->hw, IWL_STA_ID); | ||
3116 | |||
3117 | iwl3945_send_beacon_cmd(priv); | 3133 | iwl3945_send_beacon_cmd(priv); |
3118 | |||
3119 | break; | 3134 | break; |
3120 | |||
3121 | default: | 3135 | default: |
3122 | IWL_ERR(priv, "%s Should not be called in %d mode\n", | 3136 | IWL_ERR(priv, "%s Should not be called in %d mode\n", |
3123 | __func__, priv->iw_mode); | 3137 | __func__, vif->type); |
3124 | break; | 3138 | break; |
3125 | } | 3139 | } |
3126 | } | 3140 | } |
@@ -3244,7 +3258,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3244 | return NETDEV_TX_OK; | 3258 | return NETDEV_TX_OK; |
3245 | } | 3259 | } |
3246 | 3260 | ||
3247 | void iwl3945_config_ap(struct iwl_priv *priv) | 3261 | void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3248 | { | 3262 | { |
3249 | int rc = 0; | 3263 | int rc = 0; |
3250 | 3264 | ||
@@ -3260,7 +3274,7 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3260 | 3274 | ||
3261 | /* RXON Timing */ | 3275 | /* RXON Timing */ |
3262 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3276 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3263 | iwl_setup_rxon_timing(priv); | 3277 | iwl_setup_rxon_timing(priv, vif); |
3264 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3278 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3265 | sizeof(priv->rxon_timing), | 3279 | sizeof(priv->rxon_timing), |
3266 | &priv->rxon_timing); | 3280 | &priv->rxon_timing); |
@@ -3268,9 +3282,10 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3268 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3282 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " |
3269 | "Attempting to continue.\n"); | 3283 | "Attempting to continue.\n"); |
3270 | 3284 | ||
3271 | /* FIXME: what should be the assoc_id for AP? */ | 3285 | priv->staging_rxon.assoc_id = 0; |
3272 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 3286 | |
3273 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | 3287 | if (vif->bss_conf.assoc_capability & |
3288 | WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
3274 | priv->staging_rxon.flags |= | 3289 | priv->staging_rxon.flags |= |
3275 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3290 | RXON_FLG_SHORT_PREAMBLE_MSK; |
3276 | else | 3291 | else |
@@ -3278,22 +3293,21 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3278 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3293 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3279 | 3294 | ||
3280 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3295 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { |
3281 | if (priv->assoc_capability & | 3296 | if (vif->bss_conf.assoc_capability & |
3282 | WLAN_CAPABILITY_SHORT_SLOT_TIME) | 3297 | WLAN_CAPABILITY_SHORT_SLOT_TIME) |
3283 | priv->staging_rxon.flags |= | 3298 | priv->staging_rxon.flags |= |
3284 | RXON_FLG_SHORT_SLOT_MSK; | 3299 | RXON_FLG_SHORT_SLOT_MSK; |
3285 | else | 3300 | else |
3286 | priv->staging_rxon.flags &= | 3301 | priv->staging_rxon.flags &= |
3287 | ~RXON_FLG_SHORT_SLOT_MSK; | 3302 | ~RXON_FLG_SHORT_SLOT_MSK; |
3288 | 3303 | ||
3289 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) | 3304 | if (vif->type == NL80211_IFTYPE_ADHOC) |
3290 | priv->staging_rxon.flags &= | 3305 | priv->staging_rxon.flags &= |
3291 | ~RXON_FLG_SHORT_SLOT_MSK; | 3306 | ~RXON_FLG_SHORT_SLOT_MSK; |
3292 | } | 3307 | } |
3293 | /* restore RXON assoc */ | 3308 | /* restore RXON assoc */ |
3294 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3309 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3295 | iwlcore_commit_rxon(priv); | 3310 | iwlcore_commit_rxon(priv); |
3296 | iwl_add_local_station(priv, iwl_bcast_addr, false); | ||
3297 | } | 3311 | } |
3298 | iwl3945_send_beacon_cmd(priv); | 3312 | iwl3945_send_beacon_cmd(priv); |
3299 | 3313 | ||
@@ -3308,7 +3322,6 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3308 | struct ieee80211_key_conf *key) | 3322 | struct ieee80211_key_conf *key) |
3309 | { | 3323 | { |
3310 | struct iwl_priv *priv = hw->priv; | 3324 | struct iwl_priv *priv = hw->priv; |
3311 | const u8 *addr; | ||
3312 | int ret = 0; | 3325 | int ret = 0; |
3313 | u8 sta_id = IWL_INVALID_STATION; | 3326 | u8 sta_id = IWL_INVALID_STATION; |
3314 | u8 static_key; | 3327 | u8 static_key; |
@@ -3320,15 +3333,19 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3320 | return -EOPNOTSUPP; | 3333 | return -EOPNOTSUPP; |
3321 | } | 3334 | } |
3322 | 3335 | ||
3323 | addr = sta ? sta->addr : iwl_bcast_addr; | ||
3324 | static_key = !iwl_is_associated(priv); | 3336 | static_key = !iwl_is_associated(priv); |
3325 | 3337 | ||
3326 | if (!static_key) { | 3338 | if (!static_key) { |
3327 | sta_id = iwl_find_station(priv, addr); | 3339 | if (!sta) { |
3328 | if (sta_id == IWL_INVALID_STATION) { | 3340 | sta_id = priv->hw_params.bcast_sta_id; |
3329 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 3341 | } else { |
3330 | addr); | 3342 | sta_id = iwl_sta_id(sta); |
3331 | return -EINVAL; | 3343 | if (sta_id == IWL_INVALID_STATION) { |
3344 | IWL_DEBUG_MAC80211(priv, | ||
3345 | "leave - %pM not in station map.\n", | ||
3346 | sta->addr); | ||
3347 | return -EINVAL; | ||
3348 | } | ||
3332 | } | 3349 | } |
3333 | } | 3350 | } |
3334 | 3351 | ||
@@ -3365,10 +3382,13 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3365 | struct ieee80211_sta *sta) | 3382 | struct ieee80211_sta *sta) |
3366 | { | 3383 | { |
3367 | struct iwl_priv *priv = hw->priv; | 3384 | struct iwl_priv *priv = hw->priv; |
3385 | struct iwl3945_sta_priv *sta_priv = (void *)sta->drv_priv; | ||
3368 | int ret; | 3386 | int ret; |
3369 | bool is_ap = priv->iw_mode == NL80211_IFTYPE_STATION; | 3387 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3370 | u8 sta_id; | 3388 | u8 sta_id; |
3371 | 3389 | ||
3390 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3391 | |||
3372 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3392 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3373 | sta->addr); | 3393 | sta->addr); |
3374 | 3394 | ||
@@ -3381,16 +3401,14 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3381 | return ret; | 3401 | return ret; |
3382 | } | 3402 | } |
3383 | 3403 | ||
3404 | sta_priv->common.sta_id = sta_id; | ||
3405 | |||
3384 | /* Initialize rate scaling */ | 3406 | /* Initialize rate scaling */ |
3385 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3407 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3386 | sta->addr); | 3408 | sta->addr); |
3387 | iwl3945_rs_rate_init(priv, sta, sta_id); | 3409 | iwl3945_rs_rate_init(priv, sta, sta_id); |
3388 | 3410 | ||
3389 | return 0; | 3411 | return 0; |
3390 | |||
3391 | |||
3392 | |||
3393 | return ret; | ||
3394 | } | 3412 | } |
3395 | /***************************************************************************** | 3413 | /***************************************************************************** |
3396 | * | 3414 | * |
@@ -3739,6 +3757,7 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv) | |||
3739 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); | 3757 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); |
3740 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | 3758 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); |
3741 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | 3759 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); |
3760 | INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); | ||
3742 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); | 3761 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); |
3743 | 3762 | ||
3744 | iwl3945_hw_setup_deferred_work(priv); | 3763 | iwl3945_hw_setup_deferred_work(priv); |
@@ -3761,6 +3780,7 @@ static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) | |||
3761 | cancel_delayed_work_sync(&priv->init_alive_start); | 3780 | cancel_delayed_work_sync(&priv->init_alive_start); |
3762 | cancel_delayed_work(&priv->scan_check); | 3781 | cancel_delayed_work(&priv->scan_check); |
3763 | cancel_delayed_work(&priv->alive_start); | 3782 | cancel_delayed_work(&priv->alive_start); |
3783 | cancel_work_sync(&priv->start_internal_scan); | ||
3764 | cancel_work_sync(&priv->beacon_update); | 3784 | cancel_work_sync(&priv->beacon_update); |
3765 | if (priv->cfg->ops->lib->recover_from_tx_stall) | 3785 | if (priv->cfg->ops->lib->recover_from_tx_stall) |
3766 | del_timer_sync(&priv->monitor_recover); | 3786 | del_timer_sync(&priv->monitor_recover); |
@@ -3863,6 +3883,8 @@ err: | |||
3863 | return ret; | 3883 | return ret; |
3864 | } | 3884 | } |
3865 | 3885 | ||
3886 | #define IWL3945_MAX_PROBE_REQUEST 200 | ||
3887 | |||
3866 | static int iwl3945_setup_mac(struct iwl_priv *priv) | 3888 | static int iwl3945_setup_mac(struct iwl_priv *priv) |
3867 | { | 3889 | { |
3868 | int ret; | 3890 | int ret; |
@@ -3870,6 +3892,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3870 | 3892 | ||
3871 | hw->rate_control_algorithm = "iwl-3945-rs"; | 3893 | hw->rate_control_algorithm = "iwl-3945-rs"; |
3872 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | 3894 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); |
3895 | hw->vif_data_size = sizeof(struct iwl_vif_priv); | ||
3873 | 3896 | ||
3874 | /* Tell mac80211 our characteristics */ | 3897 | /* Tell mac80211 our characteristics */ |
3875 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3898 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
@@ -3888,7 +3911,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3888 | 3911 | ||
3889 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; | 3912 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; |
3890 | /* we create the 802.11 header and a zero-length SSID element */ | 3913 | /* we create the 802.11 header and a zero-length SSID element */ |
3891 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | 3914 | hw->wiphy->max_scan_ie_len = IWL3945_MAX_PROBE_REQUEST - 24 - 2; |
3892 | 3915 | ||
3893 | /* Default value; 4 EDCA QOS priorities */ | 3916 | /* Default value; 4 EDCA QOS priorities */ |
3894 | hw->queues = 4; | 3917 | hw->queues = 4; |