Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'no-ath9k' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6

+794 -723
+51 -47
drivers/net/wireless/iwlwifi/Kconfig
··· 14 14 default n 15 15 16 16 config IWLWIFI_RFKILL 17 - boolean "IWLWIFI RF kill support" 17 + boolean "Iwlwifi RF kill support" 18 18 depends on IWLCORE 19 19 20 - config IWL4965 21 - tristate "Intel Wireless WiFi 4965AGN" 20 + config IWLWIFI_DEBUG 21 + bool "Enable full debugging output in iwlagn driver" 22 + depends on IWLCORE 23 + ---help--- 24 + This option will enable debug tracing output for the iwlwifi drivers 25 + 26 + This will result in the kernel module being ~100k larger. You can 27 + control which debug output is sent to the kernel log by setting the 28 + value in 29 + 30 + /sys/class/net/wlan0/device/debug_level 31 + 32 + This entry will only exist if this option is enabled. 33 + 34 + To set a value, simply echo an 8-byte hex value to the same file: 35 + 36 + % echo 0x43fff > /sys/class/net/wlan0/device/debug_level 37 + 38 + You can find the list of debug mask values in: 39 + drivers/net/wireless/iwlwifi/iwl-debug.h 40 + 41 + If this is your first time using this driver, you should say Y here 42 + as the debug information can assist others in helping you resolve 43 + any problems you may encounter. 44 + 45 + config IWLWIFI_DEBUGFS 46 + bool "Iwlwifi debugfs support" 47 + depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS 48 + ---help--- 49 + Enable creation of debugfs files for the iwlwifi drivers. 50 + 51 + config IWLAGN 52 + tristate "Intel Wireless WiFi Next Gen AGN" 22 53 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 23 54 select FW_LOADER 24 55 select IWLCORE 25 56 ---help--- 26 57 Select to build the driver supporting the: 27 58 28 - Intel Wireless WiFi Link 4965AGN 59 + Intel Wireless WiFi Link Next-Gen AGN 29 60 30 61 This driver uses the kernel's mac80211 subsystem. 31 62 ··· 73 42 If you want to compile the driver as a module ( = code which can be 74 43 inserted in and removed from the running kernel whenever you want), 75 44 say M here and read <file:Documentation/kbuild/modules.txt>. The 76 - module will be called iwl4965.ko. 45 + module will be called iwlagn.ko. 77 46 78 - config IWL4965_LEDS 79 - bool "Enable LEDS features in iwl4965 driver" 80 - depends on IWL4965 47 + config IWLAGN_SPECTRUM_MEASUREMENT 48 + bool "Enable Spectrum Measurement in iwlagn driver" 49 + depends on IWLAGN 50 + ---help--- 51 + This option will enable spectrum measurement for the iwlagn driver. 52 + 53 + config IWLAGN_LEDS 54 + bool "Enable LEDS features in iwlagn driver" 55 + depends on IWLAGN 81 56 select IWLWIFI_LEDS 82 57 ---help--- 83 - This option enables LEDS for the iwlwifi drivers 58 + This option enables LEDS for the iwlagn drivers 84 59 85 60 86 - config IWL4965_SPECTRUM_MEASUREMENT 87 - bool "Enable Spectrum Measurement in iwl4965 driver" 88 - depends on IWL4965 61 + config IWL4965 62 + bool "Intel Wireless WiFi 4965AGN" 63 + depends on IWLAGN 89 64 ---help--- 90 - This option will enable spectrum measurement for the iwl4965 driver. 91 - 92 - config IWLWIFI_DEBUG 93 - bool "Enable full debugging output in iwl4965 driver" 94 - depends on IWL4965 95 - ---help--- 96 - This option will enable debug tracing output for the iwl4965 97 - driver. 98 - 99 - This will result in the kernel module being ~100k larger. You can 100 - control which debug output is sent to the kernel log by setting the 101 - value in 102 - 103 - /sys/class/net/wlan0/device/debug_level 104 - 105 - This entry will only exist if this option is enabled. 106 - 107 - To set a value, simply echo an 8-byte hex value to the same file: 108 - 109 - % echo 0x43fff > /sys/class/net/wlan0/device/debug_level 110 - 111 - You can find the list of debug mask values in: 112 - drivers/net/wireless/iwlwifi/iwl-4965-debug.h 113 - 114 - If this is your first time using this driver, you should say Y here 115 - as the debug information can assist others in helping you resolve 116 - any problems you may encounter. 65 + This option enables support for Intel Wireless WiFi Link 4965AGN 117 66 118 67 config IWL5000 119 68 bool "Intel Wireless WiFi 5000AGN" 120 - depends on IWL4965 69 + depends on IWLAGN 121 70 ---help--- 122 71 This option enables support for Intel Wireless WiFi Link 5000AGN Family 123 - Dependency on 4965 is temporary 124 - 125 - config IWLWIFI_DEBUGFS 126 - bool "Iwlwifi debugfs support" 127 - depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS 128 - ---help--- 129 - Enable creation of debugfs files for the iwlwifi drivers. 130 72 131 73 config IWL3945 132 74 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
+6 -7
drivers/net/wireless/iwlwifi/Makefile
··· 6 6 iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o 7 7 iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o 8 8 9 + obj-$(CONFIG_IWLAGN) += iwlagn.o 10 + iwlagn-objs := iwl-agn.o iwl-agn-rs.o 11 + 12 + iwlagn-$(CONFIG_IWL4965) += iwl-4965.o 13 + iwlagn-$(CONFIG_IWL5000) += iwl-5000.o 14 + 9 15 obj-$(CONFIG_IWL3945) += iwl3945.o 10 16 iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o 11 17 iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o 12 - 13 - obj-$(CONFIG_IWL4965) += iwl4965.o 14 - iwl4965-objs := iwl4965-base.o iwl-4965.o iwl-4965-rs.o 15 - 16 - ifeq ($(CONFIG_IWL5000),y) 17 - iwl4965-objs += iwl-5000.o 18 - endif 19 18 20 19
+17 -16
drivers/net/wireless/iwlwifi/iwl-3945-led.c
··· 206 206 static int iwl3945_led_register_led(struct iwl3945_priv *priv, 207 207 struct iwl3945_led *led, 208 208 enum led_type type, u8 set_led, 209 - const char *name, char *trigger) 209 + char *trigger) 210 210 { 211 211 struct device *device = wiphy_dev(priv->hw->wiphy); 212 212 int ret; 213 213 214 - led->led_dev.name = name; 214 + led->led_dev.name = led->name; 215 215 led->led_dev.brightness_set = iwl3945_led_brightness_set; 216 216 led->led_dev.default_trigger = trigger; 217 217 ··· 308 308 int iwl3945_led_register(struct iwl3945_priv *priv) 309 309 { 310 310 char *trigger; 311 - char name[32]; 312 311 int ret; 313 312 314 313 priv->last_blink_rate = 0; ··· 317 318 priv->allow_blinking = 0; 318 319 319 320 trigger = ieee80211_get_radio_led_name(priv->hw); 320 - snprintf(name, sizeof(name), "iwl-%s:radio", 321 + snprintf(priv->led[IWL_LED_TRG_RADIO].name, 322 + sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio", 321 323 wiphy_name(priv->hw->wiphy)); 322 324 323 325 priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on; ··· 327 327 328 328 ret = iwl3945_led_register_led(priv, 329 329 &priv->led[IWL_LED_TRG_RADIO], 330 - IWL_LED_TRG_RADIO, 1, 331 - name, trigger); 330 + IWL_LED_TRG_RADIO, 1, trigger); 331 + 332 332 if (ret) 333 333 goto exit_fail; 334 334 335 335 trigger = ieee80211_get_assoc_led_name(priv->hw); 336 - snprintf(name, sizeof(name), "iwl-%s:assoc", 336 + snprintf(priv->led[IWL_LED_TRG_ASSOC].name, 337 + sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc", 337 338 wiphy_name(priv->hw->wiphy)); 338 339 339 340 ret = iwl3945_led_register_led(priv, 340 341 &priv->led[IWL_LED_TRG_ASSOC], 341 - IWL_LED_TRG_ASSOC, 0, 342 - name, trigger); 342 + IWL_LED_TRG_ASSOC, 0, trigger); 343 + 343 344 /* for assoc always turn led on */ 344 345 priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on; 345 346 priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on; ··· 350 349 goto exit_fail; 351 350 352 351 trigger = ieee80211_get_rx_led_name(priv->hw); 353 - snprintf(name, sizeof(name), "iwl-%s:RX", 352 + snprintf(priv->led[IWL_LED_TRG_RX].name, 353 + sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX", 354 354 wiphy_name(priv->hw->wiphy)); 355 - 356 355 357 356 ret = iwl3945_led_register_led(priv, 358 357 &priv->led[IWL_LED_TRG_RX], 359 - IWL_LED_TRG_RX, 0, 360 - name, trigger); 358 + IWL_LED_TRG_RX, 0, trigger); 361 359 362 360 priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated; 363 361 priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated; ··· 366 366 goto exit_fail; 367 367 368 368 trigger = ieee80211_get_tx_led_name(priv->hw); 369 - snprintf(name, sizeof(name), "iwl-%s:TX", 369 + snprintf(priv->led[IWL_LED_TRG_TX].name, 370 + sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX", 370 371 wiphy_name(priv->hw->wiphy)); 371 372 372 373 ret = iwl3945_led_register_led(priv, 373 374 &priv->led[IWL_LED_TRG_TX], 374 - IWL_LED_TRG_TX, 0, 375 - name, trigger); 375 + IWL_LED_TRG_TX, 0, trigger); 376 + 376 377 priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated; 377 378 priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated; 378 379 priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
+1
drivers/net/wireless/iwlwifi/iwl-3945-led.h
··· 50 50 struct iwl3945_led { 51 51 struct iwl3945_priv *priv; 52 52 struct led_classdev led_dev; 53 + char name[32]; 53 54 54 55 int (*led_on) (struct iwl3945_priv *priv, int led_id); 55 56 int (*led_off) (struct iwl3945_priv *priv, int led_id);
+3 -4
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 795 795 struct ieee80211_mgmt *mgmt = 796 796 (struct ieee80211_mgmt *)header; 797 797 __le32 *pos; 798 - pos = 799 - (__le32 *) & mgmt->u.beacon. 798 + pos = (__le32 *)&mgmt->u.beacon. 800 799 timestamp; 801 800 priv->timestamp0 = le32_to_cpu(pos[0]); 802 801 priv->timestamp1 = le32_to_cpu(pos[1]); ··· 1508 1509 */ 1509 1510 static inline int iwl3945_hw_reg_temp_out_of_range(int temperature) 1510 1511 { 1511 - return (((temperature < -260) || (temperature > 25)) ? 1 : 0); 1512 + return ((temperature < -260) || (temperature > 25)) ? 1 : 0; 1512 1513 } 1513 1514 1514 1515 int iwl3945_hw_get_temperature(struct iwl3945_priv *priv) ··· 2629 2630 tx_beacon_cmd->tx.supp_rates[1] = 2630 2631 (IWL_CCK_BASIC_RATES_MASK & 0xF); 2631 2632 2632 - return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size); 2633 + return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size; 2633 2634 } 2634 2635 2635 2636 void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
+114 -213
drivers/net/wireless/iwlwifi/iwl-4965-rs.c drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 42 42 #include "iwl-core.h" 43 43 #include "iwl-helpers.h" 44 44 45 - #define RS_NAME "iwl-4965-rs" 45 + #define RS_NAME "iwl-agn-rs" 46 46 47 47 #define NUM_TRY_BEFORE_ANT_TOGGLE 1 48 48 #define IWL_NUMBER_TRY 1 ··· 77 77 }; 78 78 79 79 /** 80 - * struct iwl4965_rate_scale_data -- tx success history for one rate 80 + * struct iwl_rate_scale_data -- tx success history for one rate 81 81 */ 82 - struct iwl4965_rate_scale_data { 82 + struct iwl_rate_scale_data { 83 83 u64 data; /* bitmap of successful frames */ 84 84 s32 success_counter; /* number of frames successful */ 85 85 s32 success_ratio; /* per-cent * 128 */ ··· 89 89 }; 90 90 91 91 /** 92 - * struct iwl4965_scale_tbl_info -- tx params and success history for all rates 92 + * struct iwl_scale_tbl_info -- tx params and success history for all rates 93 93 * 94 - * There are two of these in struct iwl4965_lq_sta, 94 + * There are two of these in struct iwl_lq_sta, 95 95 * one for "active", and one for "search". 96 96 */ 97 - struct iwl4965_scale_tbl_info { 97 + struct iwl_scale_tbl_info { 98 98 enum iwl_table_type lq_type; 99 99 u8 ant_type; 100 100 u8 is_SGI; /* 1 = short guard interval */ ··· 103 103 u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ 104 104 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ 105 105 u32 current_rate; /* rate_n_flags, uCode API format */ 106 - struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ 106 + struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ 107 107 }; 108 108 109 - struct iwl4965_traffic_load { 109 + struct iwl_traffic_load { 110 110 unsigned long time_stamp; /* age of the oldest statistics */ 111 111 u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time 112 112 * slice */ ··· 118 118 }; 119 119 120 120 /** 121 - * struct iwl4965_lq_sta -- driver's rate scaling private structure 121 + * struct iwl_lq_sta -- driver's rate scaling private structure 122 122 * 123 123 * Pointer to this gets passed back and forth between driver and mac80211. 124 124 */ 125 - struct iwl4965_lq_sta { 125 + struct iwl_lq_sta { 126 126 u8 active_tbl; /* index of active table, range 0-1 */ 127 127 u8 enable_counter; /* indicates HT mode */ 128 128 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ ··· 153 153 u16 active_rate_basic; 154 154 155 155 struct iwl_link_quality_cmd lq; 156 - struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 157 - struct iwl4965_traffic_load load[TID_MAX_LOAD_COUNT]; 156 + struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 157 + struct iwl_traffic_load load[TID_MAX_LOAD_COUNT]; 158 158 u8 tx_agg_tid_en; 159 159 #ifdef CONFIG_MAC80211_DEBUGFS 160 160 struct dentry *rs_sta_dbgfs_scale_table_file; ··· 170 170 struct ieee80211_hdr *hdr, 171 171 struct sta_info *sta); 172 172 static void rs_fill_link_cmd(const struct iwl_priv *priv, 173 - struct iwl4965_lq_sta *lq_sta, 174 - u32 rate_n_flags); 173 + struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 175 174 176 175 177 176 #ifdef CONFIG_MAC80211_DEBUGFS 178 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 179 - u32 *rate_n_flags, int index); 177 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 178 + u32 *rate_n_flags, int index); 180 179 #else 181 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 182 - u32 *rate_n_flags, int index) 180 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 181 + u32 *rate_n_flags, int index) 183 182 {} 184 183 #endif 185 184 ··· 233 234 return (u8)(rate_n_flags & 0xFF); 234 235 } 235 236 236 - static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window) 237 + static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) 237 238 { 238 239 window->data = 0; 239 240 window->success_counter = 0; ··· 245 246 246 247 static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) 247 248 { 248 - return ((ant_type & valid_antenna) == ant_type); 249 + return (ant_type & valid_antenna) == ant_type; 249 250 } 250 251 251 252 /* 252 253 * removes the old data from the statistics. All data that is older than 253 254 * TID_MAX_TIME_DIFF, will be deleted. 254 255 */ 255 - static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time) 256 + static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) 256 257 { 257 258 /* The oldest age we want to keep */ 258 259 u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; ··· 273 274 * increment traffic load value for tid and also remove 274 275 * any old values if passed the certain time period 275 276 */ 276 - static u8 rs_tl_add_packet(struct iwl4965_lq_sta *lq_data, 277 + static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, 277 278 struct ieee80211_hdr *hdr) 278 279 { 279 280 u32 curr_time = jiffies_to_msecs(jiffies); 280 281 u32 time_diff; 281 282 s32 index; 282 - struct iwl4965_traffic_load *tl = NULL; 283 + struct iwl_traffic_load *tl = NULL; 283 284 __le16 fc = hdr->frame_control; 284 285 u8 tid; 285 286 ··· 324 325 /* 325 326 get the traffic load value for tid 326 327 */ 327 - static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid) 328 + static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) 328 329 { 329 330 u32 curr_time = jiffies_to_msecs(jiffies); 330 331 u32 time_diff; 331 332 s32 index; 332 - struct iwl4965_traffic_load *tl = NULL; 333 + struct iwl_traffic_load *tl = NULL; 333 334 334 335 if (tid >= TID_MAX_LOAD_COUNT) 335 336 return 0; ··· 353 354 } 354 355 355 356 static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 356 - struct iwl4965_lq_sta *lq_data, u8 tid, 357 - struct sta_info *sta) 357 + struct iwl_lq_sta *lq_data, u8 tid, 358 + struct sta_info *sta) 358 359 { 359 360 unsigned long state; 360 361 DECLARE_MAC_BUF(mac); ··· 372 373 } 373 374 374 375 static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 375 - struct iwl4965_lq_sta *lq_data, 376 - struct sta_info *sta) 376 + struct iwl_lq_sta *lq_data, 377 + struct sta_info *sta) 377 378 { 378 379 if ((tid < TID_MAX_LOAD_COUNT)) 379 380 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); ··· 384 385 385 386 static inline int get_num_of_ant_from_rate(u32 rate_n_flags) 386 387 { 387 - return (!!(rate_n_flags & RATE_MCS_ANT_A_MSK) + 388 - !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + 389 - !!(rate_n_flags & RATE_MCS_ANT_C_MSK)); 388 + return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + 389 + !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + 390 + !!(rate_n_flags & RATE_MCS_ANT_C_MSK); 390 391 } 391 392 392 393 /** ··· 396 397 * at this rate. window->data contains the bitmask of successful 397 398 * packets. 398 399 */ 399 - static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, 400 + static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, 400 401 int scale_index, s32 tpt, int retries, 401 402 int successes) 402 403 { 403 - struct iwl4965_rate_scale_data *window = NULL; 404 + struct iwl_rate_scale_data *window = NULL; 404 405 static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); 405 406 s32 fail_count; 406 407 ··· 472 473 * Fill uCode API rate_n_flags field, based on "search" or "active" table. 473 474 */ 474 475 /* FIXME:RS:remove this function and put the flags statically in the table */ 475 - static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl, 476 + static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl, 476 477 int index, u8 use_green) 477 478 { 478 479 u32 rate_n_flags = 0; ··· 529 530 */ 530 531 static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, 531 532 enum ieee80211_band band, 532 - struct iwl4965_scale_tbl_info *tbl, 533 + struct iwl_scale_tbl_info *tbl, 533 534 int *rate_idx) 534 535 { 535 536 u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); ··· 590 591 /* switch to another antenna/antennas and return 1 */ 591 592 /* if no other valid antenna found, return 0 */ 592 593 static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, 593 - struct iwl4965_scale_tbl_info *tbl) 594 + struct iwl_scale_tbl_info *tbl) 594 595 { 595 596 u8 new_ant_type; 596 597 ··· 620 621 #if 0 621 622 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf) 622 623 { 623 - return ((conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && 624 + return (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && 624 625 priv->current_ht_config.is_green_field && 625 - !priv->current_ht_config.non_GF_STA_present); 626 + !priv->current_ht_config.non_GF_STA_present; 626 627 } 627 628 #endif 628 629 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf) ··· 637 638 * basic available rates. 638 639 * 639 640 */ 640 - static u16 rs_get_supported_rates(struct iwl4965_lq_sta *lq_sta, 641 - struct ieee80211_hdr *hdr, 642 - enum iwl_table_type rate_type) 641 + static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, 642 + struct ieee80211_hdr *hdr, 643 + enum iwl_table_type rate_type) 643 644 { 644 645 if (hdr && is_multicast_ether_addr(hdr->addr1) && 645 646 lq_sta->active_rate_basic) ··· 713 714 return (high << 8) | low; 714 715 } 715 716 716 - static u32 rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta, 717 - struct iwl4965_scale_tbl_info *tbl, u8 scale_index, 718 - u8 ht_possible) 717 + static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, 718 + struct iwl_scale_tbl_info *tbl, 719 + u8 scale_index, u8 ht_possible) 719 720 { 720 721 s32 low; 721 722 u16 rate_mask; ··· 779 780 int status; 780 781 u8 retries; 781 782 int rs_index, index = 0; 782 - struct iwl4965_lq_sta *lq_sta; 783 + struct iwl_lq_sta *lq_sta; 783 784 struct iwl_link_quality_cmd *table; 784 785 struct sta_info *sta; 785 786 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ··· 787 788 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 788 789 struct ieee80211_hw *hw = local_to_hw(local); 789 790 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 790 - struct iwl4965_rate_scale_data *window = NULL; 791 - struct iwl4965_rate_scale_data *search_win = NULL; 791 + struct iwl_rate_scale_data *window = NULL; 792 + struct iwl_rate_scale_data *search_win = NULL; 792 793 u32 tx_rate; 793 - struct iwl4965_scale_tbl_info tbl_type; 794 - struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl; 794 + struct iwl_scale_tbl_info tbl_type; 795 + struct iwl_scale_tbl_info *curr_tbl, *search_tbl; 795 796 u8 active_index = 0; 796 797 __le16 fc = hdr->frame_control; 797 798 s32 tpt = 0; ··· 819 820 goto out; 820 821 821 822 822 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 823 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 823 824 824 825 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && 825 826 !lq_sta->ibss_sta_added) ··· 830 831 831 832 curr_tbl = &(lq_sta->lq_info[active_index]); 832 833 search_tbl = &(lq_sta->lq_info[(1 - active_index)]); 833 - window = (struct iwl4965_rate_scale_data *) 834 - &(curr_tbl->win[0]); 835 - search_win = (struct iwl4965_rate_scale_data *) 836 - &(search_tbl->win[0]); 834 + window = (struct iwl_rate_scale_data *)&(curr_tbl->win[0]); 835 + search_win = (struct iwl_rate_scale_data *)&(search_tbl->win[0]); 837 836 838 837 /* 839 838 * Ignore this Tx frame response if its initial rate doesn't match ··· 980 983 * searching for a new mode. 981 984 */ 982 985 static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, 983 - struct iwl4965_lq_sta *lq_sta) 986 + struct iwl_lq_sta *lq_sta) 984 987 { 985 988 IWL_DEBUG_RATE("we are staying in the same table\n"); 986 989 lq_sta->stay_in_tbl = 1; /* only place this gets set */ ··· 1001 1004 /* 1002 1005 * Find correct throughput table for given mode of modulation 1003 1006 */ 1004 - static void rs_set_expected_tpt_table(struct iwl4965_lq_sta *lq_sta, 1005 - struct iwl4965_scale_tbl_info *tbl) 1007 + static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, 1008 + struct iwl_scale_tbl_info *tbl) 1006 1009 { 1007 1010 if (is_legacy(tbl->lq_type)) { 1008 1011 if (!is_a_band(tbl->lq_type)) ··· 1047 1050 * bit rate will typically need to increase, but not if performance was bad. 1048 1051 */ 1049 1052 static s32 rs_get_best_rate(struct iwl_priv *priv, 1050 - struct iwl4965_lq_sta *lq_sta, 1051 - struct iwl4965_scale_tbl_info *tbl, /* "search" */ 1053 + struct iwl_lq_sta *lq_sta, 1054 + struct iwl_scale_tbl_info *tbl, /* "search" */ 1052 1055 u16 rate_mask, s8 index) 1053 1056 { 1054 1057 /* "active" values */ 1055 - struct iwl4965_scale_tbl_info *active_tbl = 1058 + struct iwl_scale_tbl_info *active_tbl = 1056 1059 &(lq_sta->lq_info[lq_sta->active_tbl]); 1057 1060 s32 active_sr = active_tbl->win[index].success_ratio; 1058 1061 s32 active_tpt = active_tbl->expected_tpt[index]; ··· 1140 1143 * Set up search table for MIMO 1141 1144 */ 1142 1145 static int rs_switch_to_mimo2(struct iwl_priv *priv, 1143 - struct iwl4965_lq_sta *lq_sta, 1146 + struct iwl_lq_sta *lq_sta, 1144 1147 struct ieee80211_conf *conf, 1145 1148 struct sta_info *sta, 1146 - struct iwl4965_scale_tbl_info *tbl, int index) 1149 + struct iwl_scale_tbl_info *tbl, int index) 1147 1150 { 1148 1151 u16 rate_mask; 1149 1152 s32 rate; ··· 1207 1210 * Set up search table for SISO 1208 1211 */ 1209 1212 static int rs_switch_to_siso(struct iwl_priv *priv, 1210 - struct iwl4965_lq_sta *lq_sta, 1213 + struct iwl_lq_sta *lq_sta, 1211 1214 struct ieee80211_conf *conf, 1212 1215 struct sta_info *sta, 1213 - struct iwl4965_scale_tbl_info *tbl, int index) 1216 + struct iwl_scale_tbl_info *tbl, int index) 1214 1217 { 1215 1218 u16 rate_mask; 1216 1219 u8 is_green = lq_sta->is_green; ··· 1267 1270 * Try to switch to new modulation mode from legacy 1268 1271 */ 1269 1272 static int rs_move_legacy_other(struct iwl_priv *priv, 1270 - struct iwl4965_lq_sta *lq_sta, 1273 + struct iwl_lq_sta *lq_sta, 1271 1274 struct ieee80211_conf *conf, 1272 1275 struct sta_info *sta, 1273 1276 int index) 1274 1277 { 1275 - struct iwl4965_scale_tbl_info *tbl = 1276 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1277 - struct iwl4965_scale_tbl_info *search_tbl = 1278 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1279 - struct iwl4965_rate_scale_data *window = &(tbl->win[index]); 1280 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1281 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1278 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1279 + struct iwl_scale_tbl_info *search_tbl = 1280 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1281 + struct iwl_rate_scale_data *window = &(tbl->win[index]); 1282 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1283 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1282 1284 u8 start_action = tbl->action; 1283 1285 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1284 1286 int ret = 0; ··· 1356 1360 * Try to switch to new modulation mode from SISO 1357 1361 */ 1358 1362 static int rs_move_siso_to_other(struct iwl_priv *priv, 1359 - struct iwl4965_lq_sta *lq_sta, 1363 + struct iwl_lq_sta *lq_sta, 1360 1364 struct ieee80211_conf *conf, 1361 - struct sta_info *sta, 1362 - int index) 1365 + struct sta_info *sta, int index) 1363 1366 { 1364 1367 u8 is_green = lq_sta->is_green; 1365 - struct iwl4965_scale_tbl_info *tbl = 1366 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1367 - struct iwl4965_scale_tbl_info *search_tbl = 1368 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1369 - struct iwl4965_rate_scale_data *window = &(tbl->win[index]); 1370 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1371 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1368 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1369 + struct iwl_scale_tbl_info *search_tbl = 1370 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1371 + struct iwl_rate_scale_data *window = &(tbl->win[index]); 1372 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1373 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1372 1374 u8 start_action = tbl->action; 1373 1375 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1374 1376 int ret; ··· 1449 1455 * Try to switch to new modulation mode from MIMO 1450 1456 */ 1451 1457 static int rs_move_mimo_to_other(struct iwl_priv *priv, 1452 - struct iwl4965_lq_sta *lq_sta, 1458 + struct iwl_lq_sta *lq_sta, 1453 1459 struct ieee80211_conf *conf, 1454 - struct sta_info *sta, 1455 - int index) 1460 + struct sta_info *sta, int index) 1456 1461 { 1457 1462 s8 is_green = lq_sta->is_green; 1458 - struct iwl4965_scale_tbl_info *tbl = 1459 - &(lq_sta->lq_info[lq_sta->active_tbl]); 1460 - struct iwl4965_scale_tbl_info *search_tbl = 1461 - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1462 - u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - 1463 - (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); 1463 + struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1464 + struct iwl_scale_tbl_info *search_tbl = 1465 + &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1466 + u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1467 + (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1464 1468 u8 start_action = tbl->action; 1465 1469 /*u8 valid_tx_ant = priv->hw_params.valid_tx_ant;*/ 1466 1470 int ret; ··· 1544 1552 * 2) # times calling this function 1545 1553 * 3) elapsed time in this mode (not used, for now) 1546 1554 */ 1547 - static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta) 1555 + static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) 1548 1556 { 1549 - struct iwl4965_scale_tbl_info *tbl; 1557 + struct iwl_scale_tbl_info *tbl; 1550 1558 int i; 1551 1559 int active_tbl; 1552 1560 int flush_interval_passed = 0; ··· 1634 1642 int high = IWL_RATE_INVALID; 1635 1643 int index; 1636 1644 int i; 1637 - struct iwl4965_rate_scale_data *window = NULL; 1645 + struct iwl_rate_scale_data *window = NULL; 1638 1646 int current_tpt = IWL_INVALID_VALUE; 1639 1647 int low_tpt = IWL_INVALID_VALUE; 1640 1648 int high_tpt = IWL_INVALID_VALUE; ··· 1643 1651 __le16 fc; 1644 1652 u16 rate_mask; 1645 1653 u8 update_lq = 0; 1646 - struct iwl4965_lq_sta *lq_sta; 1647 - struct iwl4965_scale_tbl_info *tbl, *tbl1; 1654 + struct iwl_lq_sta *lq_sta; 1655 + struct iwl_scale_tbl_info *tbl, *tbl1; 1648 1656 u16 rate_scale_index_msk = 0; 1649 1657 u32 rate; 1650 1658 u8 is_green = 0; ··· 1667 1675 if (!sta || !sta->rate_ctrl_priv) 1668 1676 return; 1669 1677 1670 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 1678 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 1671 1679 1672 1680 tid = rs_tl_add_packet(lq_sta, hdr); 1673 1681 ··· 2022 2030 struct ieee80211_conf *conf, 2023 2031 struct sta_info *sta) 2024 2032 { 2025 - struct iwl4965_lq_sta *lq_sta; 2026 - struct iwl4965_scale_tbl_info *tbl; 2033 + struct iwl_lq_sta *lq_sta; 2034 + struct iwl_scale_tbl_info *tbl; 2027 2035 int rate_idx; 2028 2036 int i; 2029 2037 u32 rate; ··· 2034 2042 if (!sta || !sta->rate_ctrl_priv) 2035 2043 goto out; 2036 2044 2037 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 2045 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2038 2046 i = sta->last_txrate_idx; 2039 2047 2040 2048 if ((lq_sta->lq.sta_id == 0xff) && ··· 2088 2096 struct sta_info *sta; 2089 2097 __le16 fc; 2090 2098 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 2091 - struct iwl4965_lq_sta *lq_sta; 2099 + struct iwl_lq_sta *lq_sta; 2092 2100 2093 2101 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 2094 2102 ··· 2105 2113 goto out; 2106 2114 } 2107 2115 2108 - lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 2116 + lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2109 2117 i = sta->last_txrate_idx; 2110 2118 2111 2119 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && ··· 2141 2149 2142 2150 static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) 2143 2151 { 2144 - struct iwl4965_lq_sta *lq_sta; 2152 + struct iwl_lq_sta *lq_sta; 2145 2153 struct iwl_priv *priv; 2146 2154 int i, j; 2147 2155 2148 2156 priv = (struct iwl_priv *)priv_rate; 2149 2157 IWL_DEBUG_RATE("create station rate scale window\n"); 2150 2158 2151 - lq_sta = kzalloc(sizeof(struct iwl4965_lq_sta), gfp); 2159 + lq_sta = kzalloc(sizeof(struct iwl_lq_sta), gfp); 2152 2160 2153 2161 if (lq_sta == NULL) 2154 2162 return NULL; ··· 2157 2165 2158 2166 for (j = 0; j < LQ_SIZE; j++) 2159 2167 for (i = 0; i < IWL_RATE_COUNT; i++) 2160 - rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); 2168 + rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2161 2169 2162 2170 return lq_sta; 2163 2171 } ··· 2170 2178 struct ieee80211_conf *conf = &local->hw.conf; 2171 2179 struct ieee80211_supported_band *sband; 2172 2180 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 2173 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2181 + struct iwl_lq_sta *lq_sta = priv_sta; 2174 2182 2175 2183 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 2176 2184 ··· 2179 2187 sta->txrate_idx = 3; 2180 2188 for (j = 0; j < LQ_SIZE; j++) 2181 2189 for (i = 0; i < IWL_RATE_COUNT; i++) 2182 - rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); 2190 + rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2183 2191 2184 2192 IWL_DEBUG_RATE("LQ: *** rate scale global init ***\n"); 2185 2193 /* TODO: what is a good starting rate for STA? About middle? Maybe not ··· 2263 2271 } 2264 2272 2265 2273 static void rs_fill_link_cmd(const struct iwl_priv *priv, 2266 - struct iwl4965_lq_sta *lq_sta, 2267 - u32 new_rate) 2274 + struct iwl_lq_sta *lq_sta, u32 new_rate) 2268 2275 { 2269 - struct iwl4965_scale_tbl_info tbl_type; 2276 + struct iwl_scale_tbl_info tbl_type; 2270 2277 int index = 0; 2271 2278 int rate_idx; 2272 2279 int repeat_rate = 0; ··· 2393 2402 2394 2403 static void rs_clear(void *priv_rate) 2395 2404 { 2405 + #ifdef CONFIG_IWLWIFI_DEBUG 2396 2406 struct iwl_priv *priv = (struct iwl_priv *) priv_rate; 2397 2407 2398 2408 IWL_DEBUG_RATE("enter\n"); ··· 2401 2409 /* TODO - add rate scale state reset */ 2402 2410 2403 2411 IWL_DEBUG_RATE("leave\n"); 2412 + #endif /* CONFIG_IWLWIFI_DEBUG */ 2404 2413 } 2405 2414 2406 2415 static void rs_free_sta(void *priv_rate, void *priv_sta) 2407 2416 { 2408 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2417 + struct iwl_lq_sta *lq_sta = priv_sta; 2409 2418 struct iwl_priv *priv; 2410 2419 2411 2420 priv = (struct iwl_priv *)priv_rate; ··· 2422 2429 file->private_data = inode->i_private; 2423 2430 return 0; 2424 2431 } 2425 - static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, 2426 - u32 *rate_n_flags, int index) 2432 + static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 2433 + u32 *rate_n_flags, int index) 2427 2434 { 2428 2435 struct iwl_priv *priv; 2429 2436 ··· 2446 2453 static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, 2447 2454 const char __user *user_buf, size_t count, loff_t *ppos) 2448 2455 { 2449 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2456 + struct iwl_lq_sta *lq_sta = file->private_data; 2450 2457 struct iwl_priv *priv; 2451 2458 char buf[64]; 2452 2459 int buf_size; ··· 2486 2493 int desc = 0; 2487 2494 int i = 0; 2488 2495 2489 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2496 + struct iwl_lq_sta *lq_sta = file->private_data; 2490 2497 2491 2498 desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); 2492 2499 desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", ··· 2534 2541 int desc = 0; 2535 2542 int i, j; 2536 2543 2537 - struct iwl4965_lq_sta *lq_sta = file->private_data; 2544 + struct iwl_lq_sta *lq_sta = file->private_data; 2538 2545 for (i = 0; i < LQ_SIZE; i++) { 2539 2546 desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" 2540 2547 "rate=0x%X\n", ··· 2563 2570 static void rs_add_debugfs(void *priv, void *priv_sta, 2564 2571 struct dentry *dir) 2565 2572 { 2566 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2573 + struct iwl_lq_sta *lq_sta = priv_sta; 2567 2574 lq_sta->rs_sta_dbgfs_scale_table_file = 2568 2575 debugfs_create_file("rate_scale_table", 0600, dir, 2569 2576 lq_sta, &rs_sta_dbgfs_scale_table_ops); ··· 2578 2585 2579 2586 static void rs_remove_debugfs(void *priv, void *priv_sta) 2580 2587 { 2581 - struct iwl4965_lq_sta *lq_sta = priv_sta; 2588 + struct iwl_lq_sta *lq_sta = priv_sta; 2582 2589 debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); 2583 2590 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 2584 2591 debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); ··· 2602 2609 #endif 2603 2610 }; 2604 2611 2605 - int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) 2606 - { 2607 - struct ieee80211_local *local = hw_to_local(hw); 2608 - struct iwl_priv *priv = hw->priv; 2609 - struct iwl4965_lq_sta *lq_sta; 2610 - struct sta_info *sta; 2611 - int cnt = 0, i; 2612 - u32 samples = 0, success = 0, good = 0; 2613 - unsigned long now = jiffies; 2614 - u32 max_time = 0; 2615 - u8 lq_type, antenna; 2616 - 2617 - rcu_read_lock(); 2618 - 2619 - sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); 2620 - if (!sta || !sta->rate_ctrl_priv) { 2621 - if (sta) 2622 - IWL_DEBUG_RATE("leave - no private rate data!\n"); 2623 - else 2624 - IWL_DEBUG_RATE("leave - no station!\n"); 2625 - rcu_read_unlock(); 2626 - return sprintf(buf, "station %d not found\n", sta_id); 2627 - } 2628 - 2629 - lq_sta = (void *)sta->rate_ctrl_priv; 2630 - 2631 - lq_type = lq_sta->lq_info[lq_sta->active_tbl].lq_type; 2632 - antenna = lq_sta->lq_info[lq_sta->active_tbl].ant_type; 2633 - 2634 - if (is_legacy(lq_type)) 2635 - i = IWL_RATE_54M_INDEX; 2636 - else 2637 - i = IWL_RATE_60M_INDEX; 2638 - while (1) { 2639 - u64 mask; 2640 - int j; 2641 - int active = lq_sta->active_tbl; 2642 - 2643 - cnt += 2644 - sprintf(&buf[cnt], " %2dMbs: ", iwl_rates[i].ieee / 2); 2645 - 2646 - mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); 2647 - for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) 2648 - buf[cnt++] = 2649 - (lq_sta->lq_info[active].win[i].data & mask) 2650 - ? '1' : '0'; 2651 - 2652 - samples += lq_sta->lq_info[active].win[i].counter; 2653 - good += lq_sta->lq_info[active].win[i].success_counter; 2654 - success += lq_sta->lq_info[active].win[i].success_counter * 2655 - iwl_rates[i].ieee; 2656 - 2657 - if (lq_sta->lq_info[active].win[i].stamp) { 2658 - int delta = 2659 - jiffies_to_msecs(now - 2660 - lq_sta->lq_info[active].win[i].stamp); 2661 - 2662 - if (delta > max_time) 2663 - max_time = delta; 2664 - 2665 - cnt += sprintf(&buf[cnt], "%5dms\n", delta); 2666 - } else 2667 - buf[cnt++] = '\n'; 2668 - 2669 - j = iwl4965_get_prev_ieee_rate(i); 2670 - if (j == i) 2671 - break; 2672 - i = j; 2673 - } 2674 - 2675 - /* 2676 - * Display the average rate of all samples taken. 2677 - * NOTE: We multiply # of samples by 2 since the IEEE measurement 2678 - * added from iwl_rates is actually 2X the rate. 2679 - */ 2680 - if (samples) 2681 - cnt += sprintf(&buf[cnt], 2682 - "\nAverage rate is %3d.%02dMbs over last %4dms\n" 2683 - "%3d%% success (%d good packets over %d tries)\n", 2684 - success / (2 * samples), (success * 5 / samples) % 10, 2685 - max_time, good * 100 / samples, good, samples); 2686 - else 2687 - cnt += sprintf(&buf[cnt], "\nAverage rate: 0Mbs\n"); 2688 - 2689 - cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d " 2690 - "active_search %d rate index %d\n", lq_type, antenna, 2691 - lq_sta->search_better_tbl, sta->last_txrate_idx); 2692 - 2693 - rcu_read_unlock(); 2694 - return cnt; 2695 - } 2696 - 2697 - int iwl4965_rate_control_register(void) 2612 + int iwlagn_rate_control_register(void) 2698 2613 { 2699 2614 return ieee80211_rate_control_register(&rs_ops); 2700 2615 } 2701 2616 2702 - void iwl4965_rate_control_unregister(void) 2617 + void iwlagn_rate_control_unregister(void) 2703 2618 { 2704 2619 ieee80211_rate_control_unregister(&rs_ops); 2705 2620 }
+7 -16
drivers/net/wireless/iwlwifi/iwl-4965-rs.h drivers/net/wireless/iwlwifi/iwl-agn-rs.h
··· 24 24 * 25 25 *****************************************************************************/ 26 26 27 - #ifndef __iwl_4965_rs_h__ 28 - #define __iwl_4965_rs_h__ 27 + #ifndef __iwl_agn_rs_h__ 28 + #define __iwl_agn_rs_h__ 29 29 30 30 #include "iwl-dev.h" 31 31 ··· 88 88 #define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) 89 89 #define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) 90 90 91 - /* 4965 uCode API values for legacy bit rates, both OFDM and CCK */ 91 + /* uCode API values for legacy bit rates, both OFDM and CCK */ 92 92 enum { 93 93 IWL_RATE_6M_PLCP = 13, 94 94 IWL_RATE_9M_PLCP = 15, ··· 107 107 /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/ 108 108 }; 109 109 110 - /* 4965 uCode API values for OFDM high-throughput (HT) bit rates */ 110 + /* uCode API values for OFDM high-throughput (HT) bit rates */ 111 111 enum { 112 112 IWL_RATE_SISO_6M_PLCP = 0, 113 113 IWL_RATE_SISO_12M_PLCP = 1, ··· 287 287 } 288 288 289 289 /** 290 - * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation 291 - * 292 - * NOTE: This is provided as a quick mechanism for a user to visualize 293 - * the performance of the rate control algorithm and is not meant to be 294 - * parsed software. 295 - */ 296 - extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); 297 - 298 - /** 299 290 * iwl4965_rate_control_register - Register the rate control algorithm callbacks 300 291 * 301 292 * Since the rate control algorithm is hardware specific, there is no need ··· 296 305 * ieee80211_register_hw 297 306 * 298 307 */ 299 - extern int iwl4965_rate_control_register(void); 308 + extern int iwlagn_rate_control_register(void); 300 309 301 310 /** 302 311 * iwl4965_rate_control_unregister - Unregister the rate control callbacks ··· 304 313 * This should be called after calling ieee80211_unregister_hw, but before 305 314 * the driver is unloaded. 306 315 */ 307 - extern void iwl4965_rate_control_unregister(void); 316 + extern void iwlagn_rate_control_unregister(void); 308 317 309 - #endif 318 + #endif /* __iwl_agn__rs__ */
+40 -116
drivers/net/wireless/iwlwifi/iwl-4965.c
··· 341 341 return -EINVAL; 342 342 343 343 } 344 - int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 345 - { 346 - int ret; 347 - unsigned long flags; 348 - 349 - spin_lock_irqsave(&priv->lock, flags); 350 - ret = iwl_grab_nic_access(priv); 351 - if (ret) { 352 - spin_unlock_irqrestore(&priv->lock, flags); 353 - return ret; 354 - } 355 - 356 - if (src == IWL_PWR_SRC_VAUX) { 357 - u32 val; 358 - ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, 359 - &val); 360 - 361 - if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { 362 - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 363 - APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 364 - ~APMG_PS_CTRL_MSK_PWR_SRC); 365 - } 366 - } else { 367 - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 368 - APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 369 - ~APMG_PS_CTRL_MSK_PWR_SRC); 370 - } 371 - 372 - iwl_release_nic_access(priv); 373 - spin_unlock_irqrestore(&priv->lock, flags); 374 - 375 - return ret; 376 - } 377 344 378 345 /* 379 346 * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask ··· 840 873 priv->hw_params.sens = &iwl4965_sensitivity; 841 874 842 875 return 0; 843 - } 844 - 845 - /* set card power command */ 846 - static int iwl4965_set_power(struct iwl_priv *priv, 847 - void *cmd) 848 - { 849 - int ret = 0; 850 - 851 - ret = iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, 852 - sizeof(struct iwl4965_powertable_cmd), 853 - cmd, NULL); 854 - return ret; 855 876 } 856 877 857 878 static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) ··· 1515 1560 c, atten_value, power_index, 1516 1561 tx_power.s.radio_tx_gain[c], 1517 1562 tx_power.s.dsp_predis_atten[c]); 1518 - }/* for each chain */ 1563 + } /* for each chain */ 1519 1564 1520 1565 tx_power_tbl->power_tbl[i].dw = cpu_to_le32(tx_power.dw); 1521 1566 1522 - }/* for each rate */ 1567 + } /* for each rate */ 1523 1568 1524 1569 return 0; 1525 1570 } ··· 1654 1699 { 1655 1700 struct iwl4965_shared *s = priv->shared_virt; 1656 1701 return le32_to_cpu(s->rb_closed) & 0xFFF; 1657 - } 1658 - 1659 - unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 1660 - struct iwl_frame *frame, u8 rate) 1661 - { 1662 - struct iwl4965_tx_beacon_cmd *tx_beacon_cmd; 1663 - unsigned int frame_size; 1664 - 1665 - tx_beacon_cmd = &frame->u.beacon; 1666 - memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 1667 - 1668 - tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; 1669 - tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 1670 - 1671 - frame_size = iwl4965_fill_beacon_frame(priv, 1672 - tx_beacon_cmd->frame, 1673 - iwl_bcast_addr, 1674 - sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 1675 - 1676 - BUG_ON(frame_size > MAX_MPDU_SIZE); 1677 - tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); 1678 - 1679 - if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 1680 - tx_beacon_cmd->tx.rate_n_flags = 1681 - iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 1682 - else 1683 - tx_beacon_cmd->tx.rate_n_flags = 1684 - iwl_hw_set_rate_n_flags(rate, 0); 1685 - 1686 - tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 1687 - TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); 1688 - return (sizeof(*tx_beacon_cmd) + frame_size); 1689 1702 } 1690 1703 1691 1704 static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) ··· 2002 2079 return 0; 2003 2080 } 2004 2081 2005 - int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 2006 - enum ieee80211_ampdu_mlme_action action, 2007 - const u8 *addr, u16 tid, u16 *ssn) 2008 - { 2009 - struct iwl_priv *priv = hw->priv; 2010 - DECLARE_MAC_BUF(mac); 2011 - 2012 - IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", 2013 - print_mac(mac, addr), tid); 2014 - 2015 - if (!(priv->cfg->sku & IWL_SKU_N)) 2016 - return -EACCES; 2017 - 2018 - switch (action) { 2019 - case IEEE80211_AMPDU_RX_START: 2020 - IWL_DEBUG_HT("start Rx\n"); 2021 - return iwl_rx_agg_start(priv, addr, tid, *ssn); 2022 - case IEEE80211_AMPDU_RX_STOP: 2023 - IWL_DEBUG_HT("stop Rx\n"); 2024 - return iwl_rx_agg_stop(priv, addr, tid); 2025 - case IEEE80211_AMPDU_TX_START: 2026 - IWL_DEBUG_HT("start Tx\n"); 2027 - return iwl_tx_agg_start(priv, addr, tid, ssn); 2028 - case IEEE80211_AMPDU_TX_STOP: 2029 - IWL_DEBUG_HT("stop Tx\n"); 2030 - return iwl_tx_agg_stop(priv, addr, tid); 2031 - default: 2032 - IWL_DEBUG_HT("unknown\n"); 2033 - return -EINVAL; 2034 - break; 2035 - } 2036 - return 0; 2037 - } 2038 2082 2039 2083 static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len) 2040 2084 { ··· 2130 2240 bitmap = bitmap << sh; 2131 2241 sh = 0; 2132 2242 } 2133 - bitmap |= (1 << sh); 2134 - IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n", 2135 - start, (u32)(bitmap & 0xFFFFFFFF)); 2243 + bitmap |= 1ULL << sh; 2244 + IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n", 2245 + start, (unsigned long long)bitmap); 2136 2246 } 2137 2247 2138 2248 agg->bitmap = bitmap; ··· 2258 2368 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 2259 2369 } 2260 2370 2371 + static int iwl4965_calc_rssi(struct iwl_priv *priv, 2372 + struct iwl_rx_phy_res *rx_resp) 2373 + { 2374 + /* data from PHY/DSP regarding signal strength, etc., 2375 + * contents are always there, not configurable by host. */ 2376 + struct iwl4965_rx_non_cfg_phy *ncphy = 2377 + (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 2378 + u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK) 2379 + >> IWL49_AGC_DB_POS; 2380 + 2381 + u32 valid_antennae = 2382 + (le16_to_cpu(rx_resp->phy_flags) & IWL49_RX_PHY_FLAGS_ANTENNAE_MASK) 2383 + >> IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET; 2384 + u8 max_rssi = 0; 2385 + u32 i; 2386 + 2387 + /* Find max rssi among 3 possible receivers. 2388 + * These values are measured by the digital signal processor (DSP). 2389 + * They should stay fairly constant even as the signal strength varies, 2390 + * if the radio's automatic gain control (AGC) is working right. 2391 + * AGC value (see below) will provide the "interesting" info. */ 2392 + for (i = 0; i < 3; i++) 2393 + if (valid_antennae & (1 << i)) 2394 + max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); 2395 + 2396 + IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 2397 + ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], 2398 + max_rssi, agc); 2399 + 2400 + /* dBm = max_rssi dB - agc dB - constant. 2401 + * Higher AGC (higher radio gain) means lower signal. */ 2402 + return max_rssi - agc - IWL_RSSI_OFFSET; 2403 + } 2404 + 2261 2405 2262 2406 /* Set up 4965-specific Rx frame reply handlers */ 2263 2407 static void iwl4965_rx_handler_setup(struct iwl_priv *priv) ··· 2323 2399 .chain_noise_reset = iwl4965_chain_noise_reset, 2324 2400 .gain_computation = iwl4965_gain_computation, 2325 2401 .rts_tx_cmd_flag = iwl4965_rts_tx_cmd_flag, 2402 + .calc_rssi = iwl4965_calc_rssi, 2326 2403 }; 2327 2404 2328 2405 static struct iwl_lib_ops iwl4965_lib = { ··· 2365 2440 .check_version = iwl4965_eeprom_check_version, 2366 2441 .query_addr = iwlcore_eeprom_query_addr, 2367 2442 }, 2368 - .set_power = iwl4965_set_power, 2369 2443 .send_tx_power = iwl4965_send_tx_power, 2370 2444 .update_chain_flags = iwl4965_update_chain_flags, 2371 2445 .temperature = iwl4965_temperature_calib,
+64 -7
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 93 93 iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, 94 94 CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); 95 95 96 + /* Set FH wait treshold to maximum (HW error during stress W/A) */ 97 + iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); 98 + 99 + /* enable HAP INTA to move device L1a -> L0s */ 100 + iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 101 + CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); 102 + 96 103 iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL); 97 104 98 105 /* set "initialization complete" bit to move adapter ··· 236 229 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, 237 230 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | 238 231 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); 232 + 233 + /* W/A : NIC is stuck in a reset state after Early PCIe power off 234 + * (PCIe power is lost before PERST# is asserted), 235 + * causing ME FW to lose ownership and not being able to obtain it back. 236 + */ 237 + iwl_grab_nic_access(priv); 238 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 239 + APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, 240 + ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); 241 + iwl_release_nic_access(priv); 239 242 240 243 spin_unlock_irqrestore(&priv->lock, flags); 241 244 } ··· 941 924 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; 942 925 943 926 if (txq_id != IWL_CMD_QUEUE_NUM) { 944 - sta = txq->cmd[txq->q.write_ptr].cmd.tx.sta_id; 945 - sec_ctl = txq->cmd[txq->q.write_ptr].cmd.tx.sec_ctl; 927 + sta = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; 928 + sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; 946 929 947 930 switch (sec_ctl & TX_CMD_SEC_MSK) { 948 931 case TX_CMD_SEC_CCM: ··· 981 964 u8 sta = 0; 982 965 983 966 if (txq_id != IWL_CMD_QUEUE_NUM) 984 - sta = txq->cmd[txq->q.read_ptr].cmd.tx.sta_id; 967 + sta = txq->cmd[txq->q.read_ptr]->cmd.tx.sta_id; 985 968 986 969 shared_data->queues_byte_cnt_tbls[txq_id].tfd_offset[txq->q.read_ptr]. 987 970 val = cpu_to_le16(1 | (sta << 12)); ··· 1148 1131 1149 1132 static inline u32 iwl5000_get_scd_ssn(struct iwl5000_tx_resp *tx_resp) 1150 1133 { 1151 - return le32_to_cpup((__le32*)&tx_resp->status + 1134 + return le32_to_cpup((__le32 *)&tx_resp->status + 1152 1135 tx_resp->frame_count) & MAX_SN; 1153 1136 } 1154 1137 ··· 1245 1228 bitmap = bitmap << sh; 1246 1229 sh = 0; 1247 1230 } 1248 - bitmap |= (1 << sh); 1249 - IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n", 1250 - start, (u32)(bitmap & 0xFFFFFFFF)); 1231 + bitmap |= 1ULL << sh; 1232 + IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n", 1233 + start, (unsigned long long)bitmap); 1251 1234 } 1252 1235 1253 1236 agg->bitmap = bitmap; ··· 1461 1444 priv->temperature = le32_to_cpu(priv->statistics.general.temperature); 1462 1445 } 1463 1446 1447 + /* Calc max signal level (dBm) among 3 possible receivers */ 1448 + static int iwl5000_calc_rssi(struct iwl_priv *priv, 1449 + struct iwl_rx_phy_res *rx_resp) 1450 + { 1451 + /* data from PHY/DSP regarding signal strength, etc., 1452 + * contents are always there, not configurable by host 1453 + */ 1454 + struct iwl5000_non_cfg_phy *ncphy = 1455 + (struct iwl5000_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 1456 + u32 val, rssi_a, rssi_b, rssi_c, max_rssi; 1457 + u8 agc; 1458 + 1459 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_AGC_IDX]); 1460 + agc = (val & IWL50_OFDM_AGC_MSK) >> IWL50_OFDM_AGC_BIT_POS; 1461 + 1462 + /* Find max rssi among 3 possible receivers. 1463 + * These values are measured by the digital signal processor (DSP). 1464 + * They should stay fairly constant even as the signal strength varies, 1465 + * if the radio's automatic gain control (AGC) is working right. 1466 + * AGC value (see below) will provide the "interesting" info. 1467 + */ 1468 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_AB_IDX]); 1469 + rssi_a = (val & IWL50_OFDM_RSSI_A_MSK) >> IWL50_OFDM_RSSI_A_BIT_POS; 1470 + rssi_b = (val & IWL50_OFDM_RSSI_B_MSK) >> IWL50_OFDM_RSSI_B_BIT_POS; 1471 + val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_C_IDX]); 1472 + rssi_c = (val & IWL50_OFDM_RSSI_C_MSK) >> IWL50_OFDM_RSSI_C_BIT_POS; 1473 + 1474 + max_rssi = max_t(u32, rssi_a, rssi_b); 1475 + max_rssi = max_t(u32, max_rssi, rssi_c); 1476 + 1477 + IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 1478 + rssi_a, rssi_b, rssi_c, max_rssi, agc); 1479 + 1480 + /* dBm = max_rssi dB - agc dB - constant. 1481 + * Higher AGC (higher radio gain) means lower signal. */ 1482 + return max_rssi - agc - IWL_RSSI_OFFSET; 1483 + } 1484 + 1464 1485 static struct iwl_hcmd_ops iwl5000_hcmd = { 1465 1486 .rxon_assoc = iwl5000_send_rxon_assoc, 1466 1487 }; ··· 1509 1454 .gain_computation = iwl5000_gain_computation, 1510 1455 .chain_noise_reset = iwl5000_chain_noise_reset, 1511 1456 .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag, 1457 + .calc_rssi = iwl5000_calc_rssi, 1512 1458 }; 1513 1459 1514 1460 static struct iwl_lib_ops iwl5000_lib = { ··· 1530 1474 .alive_notify = iwl5000_alive_notify, 1531 1475 .send_tx_power = iwl5000_send_tx_power, 1532 1476 .temperature = iwl5000_temperature, 1477 + .update_chain_flags = iwl4965_update_chain_flags, 1533 1478 .apm_ops = { 1534 1479 .init = iwl5000_apm_init, 1535 1480 .reset = iwl5000_apm_reset,
+31 -13
drivers/net/wireless/iwlwifi/iwl-commands.h
··· 666 666 __le16 reserved; 667 667 } __attribute__ ((packed)); 668 668 669 - 670 - 669 + #define IWL_CONN_MAX_LISTEN_INTERVAL 10 671 670 672 671 /* 673 672 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) ··· 1075 1076 } __attribute__ ((packed)); 1076 1077 1077 1078 /* Fixed (non-configurable) rx data from phy */ 1078 - #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1079 - #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1080 - #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1081 - #define IWL_AGC_DB_POS (7) 1079 + 1080 + #define IWL49_RX_RES_PHY_CNT 14 1081 + #define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1082 + #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1083 + #define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1084 + #define IWL49_AGC_DB_POS (7) 1082 1085 struct iwl4965_rx_non_cfg_phy { 1083 1086 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 1084 1087 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ ··· 1088 1087 u8 pad[0]; 1089 1088 } __attribute__ ((packed)); 1090 1089 1090 + 1091 + #define IWL50_RX_RES_PHY_CNT 8 1092 + #define IWL50_RX_RES_AGC_IDX 1 1093 + #define IWL50_RX_RES_RSSI_AB_IDX 2 1094 + #define IWL50_RX_RES_RSSI_C_IDX 3 1095 + #define IWL50_OFDM_AGC_MSK 0xfe00 1096 + #define IWL50_OFDM_AGC_BIT_POS 9 1097 + #define IWL50_OFDM_RSSI_A_MSK 0x00ff 1098 + #define IWL50_OFDM_RSSI_A_BIT_POS 0 1099 + #define IWL50_OFDM_RSSI_B_MSK 0xff0000 1100 + #define IWL50_OFDM_RSSI_B_BIT_POS 16 1101 + #define IWL50_OFDM_RSSI_C_MSK 0x00ff 1102 + #define IWL50_OFDM_RSSI_C_BIT_POS 0 1103 + 1104 + struct iwl5000_non_cfg_phy { 1105 + __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* upto 8 phy entries */ 1106 + } __attribute__ ((packed)); 1107 + 1108 + 1091 1109 /* 1092 1110 * REPLY_RX = 0xc3 (response only, not a command) 1093 1111 * Used only for legacy (non 11n) frames. 1094 1112 */ 1095 - #define RX_RES_PHY_CNT 14 1096 - struct iwl4965_rx_phy_res { 1113 + struct iwl_rx_phy_res { 1097 1114 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 1098 1115 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 1099 1116 u8 stat_id; /* configurable DSP phy data set ID */ ··· 1120 1101 __le32 beacon_time_stamp; /* beacon at on-air rise */ 1121 1102 __le16 phy_flags; /* general phy flags: band, modulation, ... */ 1122 1103 __le16 channel; /* channel number */ 1123 - __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ 1124 - __le32 reserved2; 1104 + u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 1125 1105 __le32 rate_n_flags; /* RATE_MCS_* */ 1126 1106 __le16 byte_count; /* frame's byte-count */ 1127 1107 __le16 reserved3; ··· 2011 1993 *****************************************************************************/ 2012 1994 2013 1995 /** 2014 - * struct iwl4965_powertable_cmd - Power Table Command 1996 + * struct iwl_powertable_cmd - Power Table Command 2015 1997 * @flags: See below: 2016 1998 * 2017 1999 * POWER_TABLE_CMD = 0x77 (command, has simple generic response) ··· 2045 2027 #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) 2046 2028 #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) 2047 2029 2048 - struct iwl4965_powertable_cmd { 2030 + struct iwl_powertable_cmd { 2049 2031 __le16 flags; 2050 2032 u8 keep_alive_seconds; 2051 2033 u8 debug_flags; ··· 2342 2324 /* 2343 2325 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 2344 2326 */ 2345 - struct iwl4965_tx_beacon_cmd { 2327 + struct iwl_tx_beacon_cmd { 2346 2328 struct iwl_tx_cmd tx; 2347 2329 __le16 tim_idx; 2348 2330 u8 tim_size;
+4 -3
drivers/net/wireless/iwlwifi/iwl-core.c
··· 383 383 } 384 384 EXPORT_SYMBOL(iwl_reset_qos); 385 385 386 - #define MAX_BIT_RATE_40_MHZ 0x96; /* 150 Mbps */ 387 - #define MAX_BIT_RATE_20_MHZ 0x48; /* 72 Mbps */ 386 + #define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */ 387 + #define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */ 388 388 static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, 389 389 struct ieee80211_ht_info *ht_info, 390 390 enum ieee80211_band band) ··· 815 815 { 816 816 int ret; 817 817 struct ieee80211_hw *hw = priv->hw; 818 - hw->rate_control_algorithm = "iwl-4965-rs"; 818 + hw->rate_control_algorithm = "iwl-agn-rs"; 819 819 820 820 /* Tell mac80211 our characteristics */ 821 821 hw->flags = IEEE80211_HW_SIGNAL_DBM | ··· 827 827 hw->ampdu_queues = priv->cfg->mod_params->num_of_ampdu_queues; 828 828 829 829 hw->conf.beacon_int = 100; 830 + hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 830 831 831 832 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 832 833 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+2 -1
drivers/net/wireless/iwlwifi/iwl-core.h
··· 95 95 void (*chain_noise_reset)(struct iwl_priv *priv); 96 96 void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info, 97 97 __le32 *tx_flags); 98 + int (*calc_rssi)(struct iwl_priv *priv, 99 + struct iwl_rx_phy_res *rx_resp); 98 100 }; 99 101 100 102 struct iwl_lib_ops { ··· 141 139 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); 142 140 } apm_ops; 143 141 /* power */ 144 - int (*set_power)(struct iwl_priv *priv, void *cmd); 145 142 int (*send_tx_power) (struct iwl_priv *priv); 146 143 void (*update_chain_flags)(struct iwl_priv *priv); 147 144 void (*temperature) (struct iwl_priv *priv);
+9 -1
drivers/net/wireless/iwlwifi/iwl-csr.h
··· 104 104 * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step 105 105 */ 106 106 #define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) 107 + #define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240) 107 108 108 109 /* Bits for CSR_HW_IF_CONFIG_REG */ 109 110 #define CSR49_HW_IF_CONFIG_REG_BIT_4965_R (0x00000010) ··· 119 118 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) 120 119 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) 121 120 122 - #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) 121 + #define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) 122 + #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) 123 + #define CSR_HW_IF_CONFIG_REG_BIT_PCI_OWN_SEM (0x00400000) 124 + #define CSR_HW_IF_CONFIG_REG_BIT_ME_OWN (0x02000000) 125 + #define CSR_HW_IF_CONFIG_REG_BIT_WAKE_ME (0x08000000) 126 + 123 127 124 128 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma), 125 129 * acknowledged (reset) by host writing "1" to flagged bits. */ ··· 242 236 #define CSR39_ANA_PLL_CFG_VAL (0x01000000) 243 237 #define CSR50_ANA_PLL_CFG_VAL (0x00880300) 244 238 239 + /* HPET MEM debug */ 240 + #define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000) 245 241 /*=== HBUS (Host-side Bus) ===*/ 246 242 #define HBUS_BASE (0x400) 247 243 /*
+2 -2
drivers/net/wireless/iwlwifi/iwl-debug.h
··· 33 33 #define IWL_DEBUG(level, fmt, args...) \ 34 34 do { if (priv->debug_level & (level)) \ 35 35 dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \ 36 - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 36 + in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) 37 37 38 38 #define IWL_DEBUG_LIMIT(level, fmt, args...) \ 39 39 do { if ((priv->debug_level & (level)) && net_ratelimit()) \ 40 40 dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \ 41 - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 41 + in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) 42 42 43 43 #ifdef CONFIG_IWLWIFI_DEBUGFS 44 44 struct iwl_debugfs {
+7 -4
drivers/net/wireless/iwlwifi/iwl-debugfs.c
··· 231 231 DECLARE_MAC_BUF(mac); 232 232 233 233 buf = kmalloc(bufsz, GFP_KERNEL); 234 - if(!buf) 234 + if (!buf) 235 235 return -ENOMEM; 236 236 237 237 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", ··· 364 364 { 365 365 struct iwl_debugfs *dbgfs; 366 366 struct dentry *phyd = priv->hw->wiphy->debugfsdir; 367 + int ret = 0; 367 368 368 369 dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL); 369 370 if (!dbgfs) { 371 + ret = -ENOMEM; 370 372 goto err; 371 373 } 372 374 373 375 priv->dbgfs = dbgfs; 374 376 dbgfs->name = name; 375 377 dbgfs->dir_drv = debugfs_create_dir(name, phyd); 376 - if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)){ 378 + if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)) { 379 + ret = -ENOENT; 377 380 goto err; 378 381 } 379 382 ··· 397 394 err: 398 395 IWL_ERROR("Can't open the debugfs directory\n"); 399 396 iwl_dbgfs_unregister(priv); 400 - return -ENOENT; 397 + return ret; 401 398 } 402 399 EXPORT_SYMBOL(iwl_dbgfs_register); 403 400 ··· 407 404 */ 408 405 void iwl_dbgfs_unregister(struct iwl_priv *priv) 409 406 { 410 - if (!(priv->dbgfs)) 407 + if (!priv->dbgfs) 411 408 return; 412 409 413 410 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_eeprom);
+7 -15
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 36 36 #include <linux/kernel.h> 37 37 #include <net/ieee80211_radiotap.h> 38 38 39 - #define DRV_NAME "iwl4965" 39 + #define DRV_NAME "iwlagn" 40 40 #include "iwl-rfkill.h" 41 41 #include "iwl-eeprom.h" 42 42 #include "iwl-4965-hw.h" ··· 45 45 #include "iwl-debug.h" 46 46 #include "iwl-led.h" 47 47 #include "iwl-power.h" 48 + #include "iwl-agn-rs.h" 48 49 49 50 /* configuration for the iwl4965 */ 50 51 extern struct iwl_cfg iwl4965_agn_cfg; ··· 135 134 struct iwl_tx_queue { 136 135 struct iwl_queue q; 137 136 struct iwl_tfd_frame *bd; 138 - struct iwl_cmd *cmd; 139 - dma_addr_t dma_addr_cmd; 137 + struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS]; 140 138 struct iwl_tx_info *txb; 141 139 int need_update; 142 140 int sched_retry; ··· 191 191 const s8 clip_powers[IWL_MAX_RATES]; 192 192 }; 193 193 194 - #include "iwl-4965-rs.h" 195 194 196 195 #define IWL_TX_FIFO_AC0 0 197 196 #define IWL_TX_FIFO_AC1 1 ··· 218 219 struct iwl_frame { 219 220 union { 220 221 struct ieee80211_hdr frame; 221 - struct iwl4965_tx_beacon_cmd beacon; 222 + struct iwl_tx_beacon_cmd beacon; 222 223 u8 raw[IEEE80211_FRAME_LEN]; 223 224 u8 cmd[360]; 224 225 } u; ··· 282 283 u32 val32; 283 284 struct iwl4965_bt_cmd bt; 284 285 struct iwl4965_rxon_time_cmd rxon_time; 285 - struct iwl4965_powertable_cmd powertable; 286 + struct iwl_powertable_cmd powertable; 286 287 struct iwl_qosparam_cmd qosparam; 287 288 struct iwl_tx_cmd tx; 288 - struct iwl4965_tx_beacon_cmd tx_beacon; 289 289 struct iwl4965_rxon_assoc_cmd rxon_assoc; 290 290 struct iwl_rem_sta_cmd rm_sta; 291 291 u8 *indirect; ··· 588 590 const u8 *dest, int left); 589 591 extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 590 592 int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 593 + extern int iwl4965_set_power(struct iwl_priv *priv, void *cmd); 591 594 592 595 extern const u8 iwl_bcast_addr[ETH_ALEN]; 593 596 ··· 641 642 * Forward declare iwl-4965.c functions for iwl-base.c 642 643 */ 643 644 extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); 644 - 645 - int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 646 - enum ieee80211_ampdu_mlme_action action, 647 - const u8 *addr, u16 tid, u16 *ssn); 648 645 int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id, 649 646 u8 tid, int txq_id); 650 647 ··· 807 812 #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ 808 813 809 814 810 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 811 - 812 815 enum { 813 816 MEASUREMENT_READY = (1 << 0), 814 817 MEASUREMENT_ACTIVE = (1 << 1), 815 818 }; 816 819 817 - #endif 818 820 819 821 #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ 820 822 ··· 836 844 837 845 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 838 846 839 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 847 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 840 848 /* spectrum measurement report caching */ 841 849 struct iwl4965_spectrum_notification measure_report; 842 850 u8 measurement_status;
+1 -2
drivers/net/wireless/iwlwifi/iwl-eeprom.c
··· 273 273 274 274 void iwl_eeprom_free(struct iwl_priv *priv) 275 275 { 276 - if(priv->eeprom) 277 - kfree(priv->eeprom); 276 + kfree(priv->eeprom); 278 277 priv->eeprom = NULL; 279 278 } 280 279 EXPORT_SYMBOL(iwl_eeprom_free);
+1 -1
drivers/net/wireless/iwlwifi/iwl-hcmd.c
··· 228 228 * TX cmd queue. Otherwise in case the cmd comes 229 229 * in later, it will possibly set an invalid 230 230 * address (cmd->meta.source). */ 231 - qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; 231 + qcmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; 232 232 qcmd->meta.flags &= ~CMD_WANT_SKB; 233 233 } 234 234 fail:
+41 -28
drivers/net/wireless/iwlwifi/iwl-led.c
··· 161 161 /* Set led register off */ 162 162 static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) 163 163 { 164 - IWL_DEBUG_LED("radio off\n"); 164 + IWL_DEBUG_LED("LED Reg off\n"); 165 165 iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); 166 + return 0; 167 + } 168 + 169 + /* 170 + * Set led register in case of disassociation according to rfkill state 171 + */ 172 + static int iwl_led_associate(struct iwl_priv *priv, int led_id) 173 + { 174 + IWL_DEBUG_LED("Associated\n"); 175 + priv->allow_blinking = 1; 176 + return iwl4965_led_on_reg(priv, led_id); 177 + } 178 + static int iwl_led_disassociate(struct iwl_priv *priv, int led_id) 179 + { 180 + priv->allow_blinking = 0; 181 + if (iwl_is_rfkill(priv)) 182 + iwl4965_led_off_reg(priv, led_id); 183 + else 184 + iwl4965_led_on_reg(priv, led_id); 185 + 166 186 return 0; 167 187 } 168 188 ··· 219 199 led_type_str[led->type], brightness); 220 200 switch (brightness) { 221 201 case LED_FULL: 222 - if (led->type == IWL_LED_TRG_ASSOC) 223 - priv->allow_blinking = 1; 224 - 225 202 if (led->led_on) 226 203 led->led_on(priv, IWL_LED_LINK); 227 204 break; 228 205 case LED_OFF: 229 - if (led->type == IWL_LED_TRG_ASSOC) 230 - priv->allow_blinking = 0; 231 - 232 206 if (led->led_off) 233 207 led->led_off(priv, IWL_LED_LINK); 234 208 break; ··· 242 228 */ 243 229 static int iwl_leds_register_led(struct iwl_priv *priv, struct iwl_led *led, 244 230 enum led_type type, u8 set_led, 245 - const char *name, char *trigger) 231 + char *trigger) 246 232 { 247 233 struct device *device = wiphy_dev(priv->hw->wiphy); 248 234 int ret; 249 235 250 - led->led_dev.name = name; 236 + led->led_dev.name = led->name; 251 237 led->led_dev.brightness_set = iwl_led_brightness_set; 252 238 led->led_dev.default_trigger = trigger; 253 239 ··· 298 284 return i; 299 285 } 300 286 301 - static inline int is_rf_kill(struct iwl_priv *priv) 302 - { 303 - return test_bit(STATUS_RF_KILL_HW, &priv->status) || 304 - test_bit(STATUS_RF_KILL_SW, &priv->status); 305 - } 306 - 307 287 /* 308 288 * this function called from handler. Since setting Led command can 309 289 * happen very frequent we postpone led command to be called from ··· 311 303 priv->last_blink_time = 0; 312 304 return; 313 305 } 314 - if (is_rf_kill(priv)) { 306 + if (iwl_is_rfkill(priv)) { 315 307 priv->last_blink_time = 0; 316 308 return; 317 309 } ··· 345 337 int iwl_leds_register(struct iwl_priv *priv) 346 338 { 347 339 char *trigger; 348 - char name[32]; 349 340 int ret; 350 341 351 342 priv->last_blink_rate = 0; ··· 353 346 priv->allow_blinking = 0; 354 347 355 348 trigger = ieee80211_get_radio_led_name(priv->hw); 356 - snprintf(name, sizeof(name), "iwl-%s:radio", 349 + snprintf(priv->led[IWL_LED_TRG_RADIO].name, 350 + sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio", 357 351 wiphy_name(priv->hw->wiphy)); 358 352 359 353 priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg; ··· 362 354 priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL; 363 355 364 356 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RADIO], 365 - IWL_LED_TRG_RADIO, 1, name, trigger); 357 + IWL_LED_TRG_RADIO, 1, trigger); 366 358 if (ret) 367 359 goto exit_fail; 368 360 369 361 trigger = ieee80211_get_assoc_led_name(priv->hw); 370 - snprintf(name, sizeof(name), "iwl-%s:assoc", 362 + snprintf(priv->led[IWL_LED_TRG_ASSOC].name, 363 + sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc", 371 364 wiphy_name(priv->hw->wiphy)); 372 365 373 366 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_ASSOC], 374 - IWL_LED_TRG_ASSOC, 0, name, trigger); 367 + IWL_LED_TRG_ASSOC, 0, trigger); 375 368 376 369 /* for assoc always turn led on */ 377 - priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg; 378 - priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg; 370 + priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate; 371 + priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate; 379 372 priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; 380 373 381 374 if (ret) 382 375 goto exit_fail; 383 376 384 377 trigger = ieee80211_get_rx_led_name(priv->hw); 385 - snprintf(name, sizeof(name), "iwl-%s:RX", wiphy_name(priv->hw->wiphy)); 386 - 378 + snprintf(priv->led[IWL_LED_TRG_RX].name, 379 + sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX", 380 + wiphy_name(priv->hw->wiphy)); 387 381 388 382 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RX], 389 - IWL_LED_TRG_RX, 0, name, trigger); 383 + IWL_LED_TRG_RX, 0, trigger); 390 384 391 385 priv->led[IWL_LED_TRG_RX].led_on = iwl_led_associated; 392 386 priv->led[IWL_LED_TRG_RX].led_off = iwl_led_associated; ··· 398 388 goto exit_fail; 399 389 400 390 trigger = ieee80211_get_tx_led_name(priv->hw); 401 - snprintf(name, sizeof(name), "iwl-%s:TX", wiphy_name(priv->hw->wiphy)); 391 + snprintf(priv->led[IWL_LED_TRG_TX].name, 392 + sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX", 393 + wiphy_name(priv->hw->wiphy)); 394 + 402 395 ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_TX], 403 - IWL_LED_TRG_TX, 0, name, trigger); 396 + IWL_LED_TRG_TX, 0, trigger); 404 397 405 398 priv->led[IWL_LED_TRG_TX].led_on = iwl_led_associated; 406 399 priv->led[IWL_LED_TRG_TX].led_off = iwl_led_associated;
+1
drivers/net/wireless/iwlwifi/iwl-led.h
··· 52 52 struct iwl_led { 53 53 struct iwl_priv *priv; 54 54 struct led_classdev led_dev; 55 + char name[32]; 55 56 56 57 int (*led_on) (struct iwl_priv *priv, int led_id); 57 58 int (*led_off) (struct iwl_priv *priv, int led_id);
+28 -17
drivers/net/wireless/iwlwifi/iwl-power.c
··· 82 82 83 83 /* default power management (not Tx power) table values */ 84 84 /* for tim 0-10 */ 85 - static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { 85 + static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { 86 86 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 87 87 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, 88 88 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, ··· 93 93 94 94 95 95 /* for tim = 3-10 */ 96 - static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { 96 + static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { 97 97 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 98 98 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 99 99 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, ··· 103 103 }; 104 104 105 105 /* for tim > 11 */ 106 - static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = { 106 + static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { 107 107 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 108 108 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 109 109 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, ··· 112 112 {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} 113 113 }; 114 114 115 + /* set card power command */ 116 + static int iwl_set_power(struct iwl_priv *priv, void *cmd) 117 + { 118 + return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, 119 + sizeof(struct iwl_powertable_cmd), 120 + cmd, NULL); 121 + } 115 122 /* decide the right power level according to association status 116 123 * and battery status 117 124 */ 118 125 static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) 119 126 { 120 - u16 mode = priv->power_data.user_power_setting; 127 + u16 mode; 121 128 122 129 switch (priv->power_data.user_power_setting) { 123 130 case IWL_POWER_AUTO: ··· 136 129 else 137 130 mode = IWL_POWER_ON_AC_DISASSOC; 138 131 break; 132 + /* FIXME: remove battery and ac from here */ 139 133 case IWL_POWER_BATTERY: 140 134 mode = IWL_POWER_INDEX_3; 141 135 break; 142 136 case IWL_POWER_AC: 143 137 mode = IWL_POWER_MODE_CAM; 138 + break; 139 + default: 140 + mode = priv->power_data.user_power_setting; 144 141 break; 145 142 } 146 143 return mode; ··· 155 144 { 156 145 int ret = 0, i; 157 146 struct iwl_power_mgr *pow_data; 158 - int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; 147 + int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; 159 148 u16 pci_pm; 160 149 161 150 IWL_DEBUG_POWER("Initialize power \n"); ··· 173 162 if (ret != 0) 174 163 return 0; 175 164 else { 176 - struct iwl4965_powertable_cmd *cmd; 165 + struct iwl_powertable_cmd *cmd; 177 166 178 167 IWL_DEBUG_POWER("adjust power command flags\n"); 179 168 180 - for (i = 0; i < IWL_POWER_AC; i++) { 169 + for (i = 0; i < IWL_POWER_MAX; i++) { 181 170 cmd = &pow_data->pwr_range_0[i].cmd; 182 171 183 172 if (pci_pm & 0x1) ··· 191 180 192 181 /* adjust power command according to dtim period and power level*/ 193 182 static int iwl_update_power_command(struct iwl_priv *priv, 194 - struct iwl4965_powertable_cmd *cmd, 183 + struct iwl_powertable_cmd *cmd, 195 184 u16 mode) 196 185 { 197 186 int ret = 0, i; ··· 215 204 range = &pow_data->pwr_range_2[0]; 216 205 217 206 period = pow_data->dtim_period; 218 - memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd)); 207 + memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); 219 208 220 209 if (period == 0) { 221 210 period = 1; ··· 269 258 * else user level */ 270 259 271 260 switch (setting->system_power_setting) { 272 - case IWL_POWER_AUTO: 261 + case IWL_POWER_SYS_AUTO: 273 262 final_mode = iwl_get_auto_power_mode(priv); 274 263 break; 275 - case IWL_POWER_BATTERY: 264 + case IWL_POWER_SYS_BATTERY: 276 265 final_mode = IWL_POWER_INDEX_3; 277 266 break; 278 - case IWL_POWER_AC: 267 + case IWL_POWER_SYS_AC: 279 268 final_mode = IWL_POWER_MODE_CAM; 280 269 break; 281 270 default: 282 - final_mode = setting->system_power_setting; 271 + final_mode = IWL_POWER_INDEX_3; 272 + WARN_ON(1); 283 273 } 284 274 285 275 if (setting->critical_power_setting > final_mode) ··· 292 280 293 281 if (!iwl_is_rfkill(priv) && !setting->power_disabled && 294 282 ((setting->power_mode != final_mode) || refresh)) { 295 - struct iwl4965_powertable_cmd cmd; 283 + struct iwl_powertable_cmd cmd; 296 284 297 285 if (final_mode != IWL_POWER_MODE_CAM) 298 286 set_bit(STATUS_POWER_PMI, &priv->status); ··· 303 291 if (final_mode == IWL_POWER_INDEX_5) 304 292 cmd.flags |= IWL_POWER_FAST_PD; 305 293 306 - if (priv->cfg->ops->lib->set_power) 307 - ret = priv->cfg->ops->lib->set_power(priv, &cmd); 294 + ret = iwl_set_power(priv, &cmd); 308 295 309 296 if (final_mode == IWL_POWER_MODE_CAM) 310 297 clear_bit(STATUS_POWER_PMI, &priv->status); ··· 399 388 iwl_power_init_handle(priv); 400 389 priv->power_data.user_power_setting = IWL_POWER_AUTO; 401 390 priv->power_data.power_disabled = 0; 402 - priv->power_data.system_power_setting = IWL_POWER_AUTO; 391 + priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO; 403 392 priv->power_data.is_battery_active = 0; 404 393 priv->power_data.power_disabled = 0; 405 394 priv->power_data.critical_power_setting = 0;
+23 -10
drivers/net/wireless/iwlwifi/iwl-power.h
··· 33 33 34 34 struct iwl_priv; 35 35 36 - #define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */ 37 - #define IWL_POWER_INDEX_3 0x03 38 - #define IWL_POWER_INDEX_5 0x05 39 - #define IWL_POWER_AC 0x06 40 - #define IWL_POWER_BATTERY 0x07 41 - #define IWL_POWER_AUTO 0x08 36 + enum { 37 + IWL_POWER_MODE_CAM, /* Continuously Aware Mode, always on */ 38 + IWL_POWER_INDEX_1, 39 + IWL_POWER_INDEX_2, 40 + IWL_POWER_INDEX_3, 41 + IWL_POWER_INDEX_4, 42 + IWL_POWER_INDEX_5, 43 + IWL_POWER_AUTO, 44 + IWL_POWER_MAX = IWL_POWER_AUTO, 45 + IWL_POWER_AC, 46 + IWL_POWER_BATTERY, 47 + }; 48 + 49 + enum { 50 + IWL_POWER_SYS_AUTO, 51 + IWL_POWER_SYS_AC, 52 + IWL_POWER_SYS_BATTERY, 53 + }; 54 + 42 55 #define IWL_POWER_LIMIT 0x08 43 56 #define IWL_POWER_MASK 0x0F 44 57 #define IWL_POWER_ENABLED 0x10 ··· 59 46 /* Power management (not Tx power) structures */ 60 47 61 48 struct iwl_power_vec_entry { 62 - struct iwl4965_powertable_cmd cmd; 49 + struct iwl_powertable_cmd cmd; 63 50 u8 no_dtim; 64 51 }; 65 52 66 53 struct iwl_power_mgr { 67 54 spinlock_t lock; 68 - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; 69 - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; 70 - struct iwl_power_vec_entry pwr_range_2[IWL_POWER_AC]; 55 + struct iwl_power_vec_entry pwr_range_0[IWL_POWER_MAX]; 56 + struct iwl_power_vec_entry pwr_range_1[IWL_POWER_MAX]; 57 + struct iwl_power_vec_entry pwr_range_2[IWL_POWER_MAX]; 71 58 u32 dtim_period; 72 59 /* final power level that used to calculate final power command */ 73 60 u8 power_mode;
+7 -5
drivers/net/wireless/iwlwifi/iwl-prph.h
··· 84 84 #define APMG_CLK_VAL_DMA_CLK_RQT (0x00000200) 85 85 #define APMG_CLK_VAL_BSM_CLK_RQT (0x00000800) 86 86 87 - #define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) 88 87 89 - #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) 88 + #define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS (0x00400000) 89 + #define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) 90 + #define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) 91 + #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) 92 + #define APMG_PS_CTRL_VAL_PWR_SRC_MAX (0x01000000) /* 3945 only */ 93 + #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000) 90 94 91 - #define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) 92 - #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) 93 - #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x01000000) 94 95 96 + #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) 95 97 96 98 /** 97 99 * BSM (Bootstrap State Machine)
+16 -43
drivers/net/wireless/iwlwifi/iwl-rx.c
··· 791 791 792 792 static void iwl_add_radiotap(struct iwl_priv *priv, 793 793 struct sk_buff *skb, 794 - struct iwl4965_rx_phy_res *rx_start, 794 + struct iwl_rx_phy_res *rx_start, 795 795 struct ieee80211_rx_status *stats, 796 796 u32 ampdu_status) 797 797 { ··· 1010 1010 struct ieee80211_rx_status *stats) 1011 1011 { 1012 1012 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1013 - struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 1014 - (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL; 1013 + struct iwl_rx_phy_res *rx_start = (include_phy) ? 1014 + (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) : NULL; 1015 1015 struct ieee80211_hdr *hdr; 1016 1016 u16 len; 1017 1017 __le32 *rx_end; ··· 1020 1020 u32 ampdu_status_legacy; 1021 1021 1022 1022 if (!include_phy && priv->last_phy_res[0]) 1023 - rx_start = (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; 1023 + rx_start = (struct iwl_rx_phy_res *)&priv->last_phy_res[1]; 1024 1024 1025 1025 if (!rx_start) { 1026 1026 IWL_ERROR("MPDU frame without a PHY data\n"); ··· 1032 1032 1033 1033 len = le16_to_cpu(rx_start->byte_count); 1034 1034 1035 - rx_end = (__le32 *) ((u8 *) &pkt->u.raw[0] + 1036 - sizeof(struct iwl4965_rx_phy_res) + 1035 + rx_end = (__le32 *)((u8 *) &pkt->u.raw[0] + 1036 + sizeof(struct iwl_rx_phy_res) + 1037 1037 rx_start->cfg_phy_cnt + len); 1038 1038 1039 1039 } else { ··· 1084 1084 } 1085 1085 1086 1086 /* Calc max signal level (dBm) among 3 possible receivers */ 1087 - static int iwl_calc_rssi(struct iwl_priv *priv, 1088 - struct iwl4965_rx_phy_res *rx_resp) 1087 + static inline int iwl_calc_rssi(struct iwl_priv *priv, 1088 + struct iwl_rx_phy_res *rx_resp) 1089 1089 { 1090 - /* data from PHY/DSP regarding signal strength, etc., 1091 - * contents are always there, not configurable by host. */ 1092 - struct iwl4965_rx_non_cfg_phy *ncphy = 1093 - (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy; 1094 - u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL_AGC_DB_MASK) 1095 - >> IWL_AGC_DB_POS; 1096 - 1097 - u32 valid_antennae = 1098 - (le16_to_cpu(rx_resp->phy_flags) & RX_PHY_FLAGS_ANTENNAE_MASK) 1099 - >> RX_PHY_FLAGS_ANTENNAE_OFFSET; 1100 - u8 max_rssi = 0; 1101 - u32 i; 1102 - 1103 - /* Find max rssi among 3 possible receivers. 1104 - * These values are measured by the digital signal processor (DSP). 1105 - * They should stay fairly constant even as the signal strength varies, 1106 - * if the radio's automatic gain control (AGC) is working right. 1107 - * AGC value (see below) will provide the "interesting" info. */ 1108 - for (i = 0; i < 3; i++) 1109 - if (valid_antennae & (1 << i)) 1110 - max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); 1111 - 1112 - IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", 1113 - ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], 1114 - max_rssi, agc); 1115 - 1116 - /* dBm = max_rssi dB - agc dB - constant. 1117 - * Higher AGC (higher radio gain) means lower signal. */ 1118 - return max_rssi - agc - IWL_RSSI_OFFSET; 1090 + return priv->cfg->ops->utils->calc_rssi(priv, rx_resp); 1119 1091 } 1092 + 1120 1093 1121 1094 static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) 1122 1095 { ··· 1153 1180 * this rx packet for legacy frames, 1154 1181 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ 1155 1182 int include_phy = (pkt->hdr.cmd == REPLY_RX); 1156 - struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 1157 - (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : 1158 - (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; 1183 + struct iwl_rx_phy_res *rx_start = (include_phy) ? 1184 + (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) : 1185 + (struct iwl_rx_phy_res *)&priv->last_phy_res[1]; 1159 1186 __le32 *rx_end; 1160 1187 unsigned int len = 0; 1161 1188 u16 fc; ··· 1183 1210 1184 1211 if (!include_phy) { 1185 1212 if (priv->last_phy_res[0]) 1186 - rx_start = (struct iwl4965_rx_phy_res *) 1213 + rx_start = (struct iwl_rx_phy_res *) 1187 1214 &priv->last_phy_res[1]; 1188 1215 else 1189 1216 rx_start = NULL; ··· 1200 1227 1201 1228 len = le16_to_cpu(rx_start->byte_count); 1202 1229 rx_end = (__le32 *)(pkt->u.raw + rx_start->cfg_phy_cnt + 1203 - sizeof(struct iwl4965_rx_phy_res) + len); 1230 + sizeof(struct iwl_rx_phy_res) + len); 1204 1231 } else { 1205 1232 struct iwl4965_rx_mpdu_res_start *amsdu = 1206 1233 (struct iwl4965_rx_mpdu_res_start *)pkt->u.raw; ··· 1289 1316 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1290 1317 priv->last_phy_res[0] = 1; 1291 1318 memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]), 1292 - sizeof(struct iwl4965_rx_phy_res)); 1319 + sizeof(struct iwl_rx_phy_res)); 1293 1320 } 1294 1321 EXPORT_SYMBOL(iwl_rx_reply_rx_phy);
+1
drivers/net/wireless/iwlwifi/iwl-scan.c
··· 202 202 clear_bit(STATUS_SCAN_HW, &priv->status); 203 203 } 204 204 205 + priv->alloc_rxb_skb--; 205 206 dev_kfree_skb_any(cmd.meta.u.skb); 206 207 207 208 return ret;
+2 -2
drivers/net/wireless/iwlwifi/iwl-sta.c
··· 823 823 if (lq->sta_id == 0xFF) 824 824 lq->sta_id = IWL_AP_ID; 825 825 826 - iwl_dump_lq_cmd(priv,lq); 826 + iwl_dump_lq_cmd(priv, lq); 827 827 828 828 if (iwl_is_associated(priv) && priv->assoc_station_added) 829 829 return iwl_send_cmd(priv, &cmd); ··· 839 839 * for automatic fallback during transmission. 840 840 * 841 841 * NOTE: This sets up a default set of values. These will be replaced later 842 - * if the driver's iwl-4965-rs rate scaling algorithm is used, instead of 842 + * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of 843 843 * rc80211_simple. 844 844 * 845 845 * NOTE: Run REPLY_ADD_STA command to set up station table entry, before
+55 -23
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 208 208 * Free all buffers. 209 209 * 0-fill, but do not free "txq" descriptor structure. 210 210 */ 211 - static void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) 211 + static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) 212 212 { 213 + struct iwl_tx_queue *txq = &priv->txq[txq_id]; 213 214 struct iwl_queue *q = &txq->q; 214 215 struct pci_dev *dev = priv->pci_dev; 215 - int len; 216 + int i, slots_num, len; 216 217 217 218 if (q->n_bd == 0) 218 219 return; ··· 228 227 len += IWL_MAX_SCAN_SIZE; 229 228 230 229 /* De-alloc array of command/tx buffers */ 231 - pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 230 + slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? 231 + TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 232 + for (i = 0; i < slots_num; i++) 233 + kfree(txq->cmd[i]); 234 + if (txq_id == IWL_CMD_QUEUE_NUM) 235 + kfree(txq->cmd[slots_num]); 232 236 233 237 /* De-alloc circular buffer of TFDs */ 234 238 if (txq->q.n_bd) ··· 406 400 struct iwl_tx_queue *txq, 407 401 int slots_num, u32 txq_id) 408 402 { 409 - struct pci_dev *dev = priv->pci_dev; 410 - int len; 403 + int i, len; 411 404 int rc = 0; 412 405 413 406 /* ··· 417 412 * For normal Tx queues (all other queues), no super-size command 418 413 * space is needed. 419 414 */ 420 - len = sizeof(struct iwl_cmd) * slots_num; 421 - if (txq_id == IWL_CMD_QUEUE_NUM) 422 - len += IWL_MAX_SCAN_SIZE; 423 - txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 424 - if (!txq->cmd) 425 - return -ENOMEM; 415 + len = sizeof(struct iwl_cmd); 416 + for (i = 0; i <= slots_num; i++) { 417 + if (i == slots_num) { 418 + if (txq_id == IWL_CMD_QUEUE_NUM) 419 + len += IWL_MAX_SCAN_SIZE; 420 + else 421 + continue; 422 + } 423 + 424 + txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); 425 + if (!txq->cmd[i]) 426 + return -ENOMEM; 427 + } 426 428 427 429 /* Alloc driver data array and TFD circular buffer */ 428 430 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 429 431 if (rc) { 430 - pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 432 + for (i = 0; i < slots_num; i++) 433 + kfree(txq->cmd[i]); 431 434 432 435 return -ENOMEM; 433 436 } ··· 464 451 465 452 /* Tx queues */ 466 453 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 467 - iwl_tx_queue_free(priv, &priv->txq[txq_id]); 454 + iwl_tx_queue_free(priv, txq_id); 468 455 469 456 /* Keep-warm buffer */ 470 457 iwl_kw_free(priv); ··· 872 859 txq->txb[q->write_ptr].skb[0] = skb; 873 860 874 861 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 875 - out_cmd = &txq->cmd[idx]; 862 + out_cmd = txq->cmd[idx]; 876 863 tx_cmd = &out_cmd->cmd.tx; 877 864 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 878 865 memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); ··· 912 899 913 900 /* Physical address of this Tx command's header (not MAC header!), 914 901 * within command buffer array. */ 915 - txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + 916 - offsetof(struct iwl_cmd, hdr); 902 + txcmd_phys = pci_map_single(priv->pci_dev, out_cmd, 903 + sizeof(struct iwl_cmd), PCI_DMA_TODEVICE); 904 + txcmd_phys += offsetof(struct iwl_cmd, hdr); 917 905 918 906 /* Add buffer containing Tx command and MAC(!) header to TFD's 919 907 * first entry */ ··· 1018 1004 u32 idx; 1019 1005 u16 fix_size; 1020 1006 dma_addr_t phys_addr; 1021 - int ret; 1007 + int len, ret; 1022 1008 unsigned long flags; 1023 1009 1024 1010 cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); ··· 1048 1034 control_flags = (u32 *) tfd; 1049 1035 1050 1036 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); 1051 - out_cmd = &txq->cmd[idx]; 1037 + out_cmd = txq->cmd[idx]; 1052 1038 1053 1039 out_cmd->hdr.cmd = cmd->id; 1054 1040 memcpy(&out_cmd->meta, &cmd->meta, sizeof(cmd->meta)); ··· 1062 1048 INDEX_TO_SEQ(q->write_ptr)); 1063 1049 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 1064 1050 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 1065 - 1066 - phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 1067 - offsetof(struct iwl_cmd, hdr); 1051 + len = (idx == TFD_CMD_SLOTS) ? 1052 + IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 1053 + phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, 1054 + PCI_DMA_TODEVICE); 1055 + phys_addr += offsetof(struct iwl_cmd, hdr); 1068 1056 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 1069 1057 1070 1058 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " ··· 1131 1115 { 1132 1116 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 1133 1117 struct iwl_queue *q = &txq->q; 1118 + struct iwl_tfd_frame *bd = &txq->bd[index]; 1119 + dma_addr_t dma_addr; 1120 + int is_odd, buf_len; 1134 1121 int nfreed = 0; 1135 1122 1136 1123 if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { ··· 1151 1132 q->write_ptr, q->read_ptr); 1152 1133 queue_work(priv->workqueue, &priv->restart); 1153 1134 } 1135 + is_odd = (index/2) & 0x1; 1136 + if (is_odd) { 1137 + dma_addr = IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) | 1138 + (IWL_GET_BITS(bd->pa[index], 1139 + tb2_addr_hi20) << 16); 1140 + buf_len = IWL_GET_BITS(bd->pa[index], tb2_len); 1141 + } else { 1142 + dma_addr = le32_to_cpu(bd->pa[index].tb1_addr); 1143 + buf_len = IWL_GET_BITS(bd->pa[index], tb1_len); 1144 + } 1145 + 1146 + pci_unmap_single(priv->pci_dev, dma_addr, buf_len, 1147 + PCI_DMA_TODEVICE); 1154 1148 nfreed++; 1155 1149 } 1156 1150 } ··· 1195 1163 BUG_ON(txq_id != IWL_CMD_QUEUE_NUM); 1196 1164 1197 1165 cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); 1198 - cmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; 1166 + cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; 1199 1167 1200 1168 /* Input error checking is done when commands are added to queue. */ 1201 1169 if (cmd->meta.flags & CMD_WANT_SKB) { ··· 1423 1391 /* For each frame attempted in aggregation, 1424 1392 * update driver's record of tx frame's status. */ 1425 1393 for (i = 0; i < agg->frame_count ; i++) { 1426 - ack = bitmap & (1 << i); 1394 + ack = bitmap & (1ULL << i); 1427 1395 successes += !!ack; 1428 1396 IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n", 1429 1397 ack? "ACK":"NACK", i, (agg->start_idx + i) & 0xff,
+22 -34
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 275 275 return 0; 276 276 277 277 error: 278 - if (txq->txb) { 279 - kfree(txq->txb); 280 - txq->txb = NULL; 281 - } 278 + kfree(txq->txb); 279 + txq->txb = NULL; 282 280 283 281 return -ENOMEM; 284 282 } ··· 363 365 txq->q.n_bd, txq->bd, txq->q.dma_addr); 364 366 365 367 /* De-alloc array of per-TFD driver data */ 366 - if (txq->txb) { 367 - kfree(txq->txb); 368 - txq->txb = NULL; 369 - } 368 + kfree(txq->txb); 369 + txq->txb = NULL; 370 370 371 371 /* 0-fill queue descriptor structure */ 372 372 memset(txq, 0, sizeof(*txq)); ··· 2699 2703 2700 2704 if (!ieee80211_has_morefrags(hdr->frame_control)) { 2701 2705 txq->need_update = 1; 2702 - if (qc) { 2706 + if (qc) 2703 2707 priv->stations[sta_id].tid[tid].seq_number = seq_number; 2704 - } 2705 2708 } else { 2706 2709 wait_write_ptr = 1; 2707 2710 txq->need_update = 0; ··· 3808 3813 /* 100:1 or higher, divide by 10 and use table, 3809 3814 * add 20 dB to make up for divide by 10 */ 3810 3815 if (sig_ratio >= 100) 3811 - return (20 + (int)ratio2dB[sig_ratio/10]); 3816 + return 20 + (int)ratio2dB[sig_ratio/10]; 3812 3817 3813 3818 /* We shouldn't see this */ 3814 3819 if (sig_ratio < 1) ··· 5083 5088 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, 5084 5089 * looking at all data. 5085 5090 */ 5086 - static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len) 5091 + static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u32 len) 5087 5092 { 5088 5093 u32 val; 5089 5094 u32 save_len = len; ··· 5232 5237 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG); 5233 5238 for (reg = BSM_SRAM_LOWER_BOUND; 5234 5239 reg < BSM_SRAM_LOWER_BOUND + len; 5235 - reg += sizeof(u32), image ++) { 5240 + reg += sizeof(u32), image++) { 5236 5241 val = iwl3945_read_prph(priv, reg); 5237 5242 if (val != le32_to_cpu(*image)) { 5238 5243 IWL_ERROR("BSM uCode verification failed at " ··· 6331 6336 DECLARE_MAC_BUF(mac); 6332 6337 6333 6338 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 6334 - IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__); 6339 + IWL_ERROR("%s Should not be called in AP mode\n", __func__); 6335 6340 return; 6336 6341 } 6337 6342 ··· 6412 6417 6413 6418 default: 6414 6419 IWL_ERROR("%s Should not be called in %d mode\n", 6415 - __FUNCTION__, priv->iw_mode); 6420 + __func__, priv->iw_mode); 6416 6421 break; 6417 6422 } 6418 6423 ··· 6588 6593 struct iwl3945_priv *priv = hw->priv; 6589 6594 6590 6595 IWL_DEBUG_MAC80211("enter\n"); 6591 - 6592 - if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 6593 - IWL_DEBUG_MAC80211("leave - monitor\n"); 6594 - dev_kfree_skb_any(skb); 6595 - return 0; 6596 - } 6597 6596 6598 6597 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6599 6598 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); ··· 7445 7456 struct iwl3945_priv *priv = dev_get_drvdata(d); 7446 7457 struct iwl3945_spectrum_notification measure_report; 7447 7458 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7448 - u8 *data = (u8 *) & measure_report; 7459 + u8 *data = (u8 *)&measure_report; 7449 7460 unsigned long flags; 7450 7461 7451 7462 spin_lock_irqsave(&priv->lock, flags); ··· 7616 7627 else 7617 7628 p += sprintf(p, " \n"); 7618 7629 7619 - return (p - buf + 1); 7630 + return p - buf + 1; 7620 7631 7621 7632 } 7622 7633 ··· 7638 7649 struct iwl3945_priv *priv = dev_get_drvdata(d); 7639 7650 u32 size = sizeof(struct iwl3945_notif_statistics); 7640 7651 u32 len = 0, ofs = 0; 7641 - u8 *data = (u8 *) & priv->statistics; 7652 + u8 *data = (u8 *)&priv->statistics; 7642 7653 int rc = 0; 7643 7654 7644 7655 if (!iwl3945_is_alive(priv)) ··· 7992 8003 7993 8004 /* nic init */ 7994 8005 iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, 7995 - CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 8006 + CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 7996 8007 7997 - iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 7998 - err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, 7999 - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 8000 - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 8001 - if (err < 0) { 8002 - IWL_DEBUG_INFO("Failed to init the card\n"); 8008 + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 8009 + err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, 8010 + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 8011 + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 8012 + if (err < 0) { 8013 + IWL_DEBUG_INFO("Failed to init the card\n"); 8003 8014 goto out_remove_sysfs; 8004 - } 8015 + } 8005 8016 /* Read the EEPROM */ 8006 8017 err = iwl3945_eeprom_init(priv); 8007 8018 if (err) { ··· 8103 8114 iwl3945_unset_hw_setting(priv); 8104 8115 iwl3945_clear_stations_table(priv); 8105 8116 8106 - if (priv->mac80211_registered) { 8117 + if (priv->mac80211_registered) 8107 8118 ieee80211_unregister_hw(priv->hw); 8108 - } 8109 8119 8110 8120 /*netif_stop_queue(dev); */ 8111 8121 flush_workqueue(priv->workqueue);
+148 -84
drivers/net/wireless/iwlwifi/iwl4965-base.c drivers/net/wireless/iwlwifi/iwl-agn.c
··· 65 65 * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk 66 66 */ 67 67 68 - #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link 4965AGN driver for Linux" 68 + #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link AGN driver for Linux" 69 69 70 70 #ifdef CONFIG_IWLWIFI_DEBUG 71 71 #define VD "d" ··· 73 73 #define VD 74 74 #endif 75 75 76 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 76 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 77 77 #define VS "s" 78 78 #else 79 79 #define VS ··· 86 86 MODULE_VERSION(DRV_VERSION); 87 87 MODULE_AUTHOR(DRV_COPYRIGHT); 88 88 MODULE_LICENSE("GPL"); 89 + MODULE_ALIAS("iwl4965"); 89 90 90 91 /*************** STATION TABLE MANAGEMENT **** 91 92 * mac80211 should be examined to determine if sta_info is duplicating ··· 445 444 list_add(&frame->list, &priv->free_frames); 446 445 } 447 446 448 - unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, 449 - struct ieee80211_hdr *hdr, 450 - const u8 *dest, int left) 447 + static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, 448 + struct ieee80211_hdr *hdr, 449 + const u8 *dest, int left) 451 450 { 452 - 453 451 if (!iwl_is_associated(priv) || !priv->ibss_beacon || 454 452 ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && 455 453 (priv->iw_mode != IEEE80211_IF_TYPE_AP))) ··· 487 487 return IWL_RATE_6M_PLCP; 488 488 } 489 489 490 + unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 491 + struct iwl_frame *frame, u8 rate) 492 + { 493 + struct iwl_tx_beacon_cmd *tx_beacon_cmd; 494 + unsigned int frame_size; 495 + 496 + tx_beacon_cmd = &frame->u.beacon; 497 + memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 498 + 499 + tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; 500 + tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 501 + 502 + frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, 503 + iwl_bcast_addr, 504 + sizeof(frame->u) - sizeof(*tx_beacon_cmd)); 505 + 506 + BUG_ON(frame_size > MAX_MPDU_SIZE); 507 + tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); 508 + 509 + if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 510 + tx_beacon_cmd->tx.rate_n_flags = 511 + iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 512 + else 513 + tx_beacon_cmd->tx.rate_n_flags = 514 + iwl_hw_set_rate_n_flags(rate, 0); 515 + 516 + tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | 517 + TX_CMD_FLG_TSF_MSK | 518 + TX_CMD_FLG_STA_RATE_MSK; 519 + 520 + return sizeof(*tx_beacon_cmd) + frame_size; 521 + } 490 522 static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) 491 523 { 492 524 struct iwl_frame *frame; ··· 640 608 } 641 609 642 610 #define MAX_UCODE_BEACON_INTERVAL 4096 643 - #define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) 644 611 645 612 static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val) 646 613 { ··· 669 638 priv->rxon_timing.timestamp.dw[0] = 670 639 cpu_to_le32(priv->timestamp & 0xFFFFFFFF); 671 640 672 - priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL; 641 + priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); 673 642 674 643 tsf = priv->timestamp; 675 644 ··· 884 853 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 885 854 } 886 855 887 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 856 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 888 857 889 858 #include "iwl-spectrum.h" 890 859 ··· 1088 1057 static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv, 1089 1058 struct iwl_rx_mem_buffer *rxb) 1090 1059 { 1091 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 1060 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 1092 1061 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1093 1062 struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif); 1094 1063 ··· 1260 1229 queue_work(priv->workqueue, &priv->rf_kill); 1261 1230 else 1262 1231 wake_up_interruptible(&priv->wait_command_queue); 1232 + } 1233 + 1234 + int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 1235 + { 1236 + int ret; 1237 + unsigned long flags; 1238 + 1239 + spin_lock_irqsave(&priv->lock, flags); 1240 + ret = iwl_grab_nic_access(priv); 1241 + if (ret) 1242 + goto err; 1243 + 1244 + if (src == IWL_PWR_SRC_VAUX) { 1245 + u32 val; 1246 + ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, 1247 + &val); 1248 + 1249 + if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) 1250 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 1251 + APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 1252 + ~APMG_PS_CTRL_MSK_PWR_SRC); 1253 + } else { 1254 + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, 1255 + APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 1256 + ~APMG_PS_CTRL_MSK_PWR_SRC); 1257 + } 1258 + 1259 + iwl_release_nic_access(priv); 1260 + err: 1261 + spin_unlock_irqrestore(&priv->lock, flags); 1262 + return ret; 1263 1263 } 1264 1264 1265 1265 /** ··· 2232 2170 } 2233 2171 2234 2172 /* If platform's RF_KILL switch is NOT set to KILL */ 2235 - if (iwl_read32(priv, CSR_GP_CNTRL) & 2236 - CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2173 + if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2237 2174 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2238 2175 else 2239 2176 set_bit(STATUS_RF_KILL_HW, &priv->status); 2240 2177 2241 - if (!test_bit(STATUS_IN_SUSPEND, &priv->status) && 2242 - iwl_is_rfkill(priv)) { 2178 + if (iwl_is_rfkill(priv)) { 2179 + iwl4965_enable_interrupts(priv); 2243 2180 IWL_WARNING("Radio disabled by %s RF Kill switch\n", 2244 2181 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); 2245 - return -ENODEV; 2182 + return 0; 2246 2183 } 2247 2184 2248 2185 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); ··· 2276 2215 * data SRAM for a clean start when the runtime program first loads. */ 2277 2216 memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, 2278 2217 priv->ucode_data.len); 2279 - 2280 - /* We return success when we resume from suspend and rf_kill is on. */ 2281 - if (test_bit(STATUS_RF_KILL_HW, &priv->status) || 2282 - test_bit(STATUS_RF_KILL_SW, &priv->status)) 2283 - return 0; 2284 2218 2285 2219 for (i = 0; i < MAX_HW_RESTARTS; i++) { 2286 2220 ··· 2471 2415 unsigned long flags; 2472 2416 2473 2417 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 2474 - IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__); 2418 + IWL_ERROR("%s Should not be called in AP mode\n", __func__); 2475 2419 return; 2476 2420 } 2477 2421 ··· 2547 2491 2548 2492 default: 2549 2493 IWL_ERROR("%s Should not be called in %d mode\n", 2550 - __FUNCTION__, priv->iw_mode); 2494 + __func__, priv->iw_mode); 2551 2495 break; 2552 2496 } 2553 2497 ··· 2645 2589 if (ret) 2646 2590 goto out_release_irq; 2647 2591 2592 + if (iwl_is_rfkill(priv)) 2593 + goto out; 2594 + 2648 2595 IWL_DEBUG_INFO("Start UP work done.\n"); 2649 2596 2650 2597 if (test_bit(STATUS_IN_SUSPEND, &priv->status)) ··· 2667 2608 } 2668 2609 } 2669 2610 2611 + out: 2670 2612 priv->is_open = 1; 2671 2613 IWL_DEBUG_MAC80211("leave\n"); 2672 2614 return 0; ··· 2832 2772 } 2833 2773 2834 2774 spin_lock_irqsave(&priv->lock, flags); 2775 + 2835 2776 2836 2777 /* if we are switching from ht to 2.4 clear flags 2837 2778 * from any ht related info since 2.4 does not ··· 3163 3102 if (bss_conf->assoc) { 3164 3103 priv->assoc_id = bss_conf->aid; 3165 3104 priv->beacon_int = bss_conf->beacon_int; 3105 + priv->power_data.dtim_period = bss_conf->dtim_period; 3166 3106 priv->timestamp = bss_conf->timestamp; 3167 3107 priv->assoc_capability = bss_conf->assoc_capability; 3168 3108 priv->next_scan_jiffies = jiffies + ··· 3407 3345 return 0; 3408 3346 } 3409 3347 3348 + static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 3349 + enum ieee80211_ampdu_mlme_action action, 3350 + const u8 *addr, u16 tid, u16 *ssn) 3351 + { 3352 + struct iwl_priv *priv = hw->priv; 3353 + DECLARE_MAC_BUF(mac); 3354 + 3355 + IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", 3356 + print_mac(mac, addr), tid); 3357 + 3358 + if (!(priv->cfg->sku & IWL_SKU_N)) 3359 + return -EACCES; 3360 + 3361 + switch (action) { 3362 + case IEEE80211_AMPDU_RX_START: 3363 + IWL_DEBUG_HT("start Rx\n"); 3364 + return iwl_rx_agg_start(priv, addr, tid, *ssn); 3365 + case IEEE80211_AMPDU_RX_STOP: 3366 + IWL_DEBUG_HT("stop Rx\n"); 3367 + return iwl_rx_agg_stop(priv, addr, tid); 3368 + case IEEE80211_AMPDU_TX_START: 3369 + IWL_DEBUG_HT("start Tx\n"); 3370 + return iwl_tx_agg_start(priv, addr, tid, ssn); 3371 + case IEEE80211_AMPDU_TX_STOP: 3372 + IWL_DEBUG_HT("stop Tx\n"); 3373 + return iwl_tx_agg_stop(priv, addr, tid); 3374 + default: 3375 + IWL_DEBUG_HT("unknown\n"); 3376 + return -EINVAL; 3377 + break; 3378 + } 3379 + return 0; 3380 + } 3410 3381 static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, 3411 3382 struct ieee80211_tx_queue_stats *stats) 3412 3383 { ··· 3687 3592 3688 3593 static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 3689 3594 3690 - static ssize_t show_rs_window(struct device *d, 3691 - struct device_attribute *attr, 3692 - char *buf) 3693 - { 3694 - struct iwl_priv *priv = d->driver_data; 3695 - return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID); 3696 - } 3697 - static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); 3698 - 3699 3595 static ssize_t show_tx_power(struct device *d, 3700 3596 struct device_attribute *attr, char *buf) 3701 3597 { ··· 3785 3699 static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, 3786 3700 store_filter_flags); 3787 3701 3788 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 3702 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 3789 3703 3790 3704 static ssize_t show_measurement(struct device *d, 3791 3705 struct device_attribute *attr, char *buf) ··· 3793 3707 struct iwl_priv *priv = dev_get_drvdata(d); 3794 3708 struct iwl4965_spectrum_notification measure_report; 3795 3709 u32 size = sizeof(measure_report), len = 0, ofs = 0; 3796 - u8 *data = (u8 *) & measure_report; 3710 + u8 *data = (u8 *)&measure_report; 3797 3711 unsigned long flags; 3798 3712 3799 3713 spin_lock_irqsave(&priv->lock, flags); ··· 3856 3770 3857 3771 static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, 3858 3772 show_measurement, store_measurement); 3859 - #endif /* CONFIG_IWL4965_SPECTRUM_MEASUREMENT */ 3773 + #endif /* CONFIG_IWLAGN_SPECTRUM_MEASUREMENT */ 3860 3774 3861 3775 static ssize_t store_retry_rate(struct device *d, 3862 3776 struct device_attribute *attr, ··· 3886 3800 const char *buf, size_t count) 3887 3801 { 3888 3802 struct iwl_priv *priv = dev_get_drvdata(d); 3889 - int rc; 3803 + int ret; 3890 3804 int mode; 3891 3805 3892 3806 mode = simple_strtoul(buf, NULL, 0); 3893 3807 mutex_lock(&priv->mutex); 3894 3808 3895 3809 if (!iwl_is_ready(priv)) { 3896 - rc = -EAGAIN; 3810 + ret = -EAGAIN; 3897 3811 goto out; 3898 3812 } 3899 3813 3900 - rc = iwl_power_set_user_mode(priv, mode); 3901 - if (rc) { 3814 + ret = iwl_power_set_user_mode(priv, mode); 3815 + if (ret) { 3902 3816 IWL_DEBUG_MAC80211("failed setting power mode.\n"); 3903 3817 goto out; 3904 3818 } 3905 - rc = count; 3819 + ret = count; 3906 3820 3907 3821 out: 3908 3822 mutex_unlock(&priv->mutex); 3909 - return rc; 3823 + return ret; 3910 3824 } 3911 - 3912 - #define MAX_WX_STRING 80 3913 - 3914 - /* Values are in microsecond */ 3915 - static const s32 timeout_duration[] = { 3916 - 350000, 3917 - 250000, 3918 - 75000, 3919 - 37000, 3920 - 25000, 3921 - }; 3922 - static const s32 period_duration[] = { 3923 - 400000, 3924 - 700000, 3925 - 1000000, 3926 - 1000000, 3927 - 1000000 3928 - }; 3929 3825 3930 3826 static ssize_t show_power_level(struct device *d, 3931 3827 struct device_attribute *attr, char *buf) 3932 3828 { 3933 3829 struct iwl_priv *priv = dev_get_drvdata(d); 3830 + int mode = priv->power_data.user_power_setting; 3831 + int system = priv->power_data.system_power_setting; 3934 3832 int level = priv->power_data.power_mode; 3935 3833 char *p = buf; 3936 3834 3937 - p += sprintf(p, "%d ", level); 3938 - switch (level) { 3939 - case IWL_POWER_MODE_CAM: 3940 - case IWL_POWER_AC: 3941 - p += sprintf(p, "(AC)"); 3835 + switch (system) { 3836 + case IWL_POWER_SYS_AUTO: 3837 + p += sprintf(p, "SYSTEM:auto"); 3942 3838 break; 3943 - case IWL_POWER_BATTERY: 3944 - p += sprintf(p, "(BATTERY)"); 3839 + case IWL_POWER_SYS_AC: 3840 + p += sprintf(p, "SYSTEM:ac"); 3945 3841 break; 3946 - default: 3947 - p += sprintf(p, 3948 - "(Timeout %dms, Period %dms)", 3949 - timeout_duration[level - 1] / 1000, 3950 - period_duration[level - 1] / 1000); 3842 + case IWL_POWER_SYS_BATTERY: 3843 + p += sprintf(p, "SYSTEM:battery"); 3844 + break; 3951 3845 } 3952 - /* 3953 - if (!(priv->power_mode & IWL_POWER_ENABLED)) 3954 - p += sprintf(p, " OFF\n"); 3955 - else 3956 - p += sprintf(p, " \n"); 3957 - */ 3958 - p += sprintf(p, " \n"); 3959 - return (p - buf + 1); 3846 + 3847 + p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO)?"fixed":"auto"); 3848 + p += sprintf(p, "\tINDEX:%d", level); 3849 + p += sprintf(p, "\n"); 3850 + return p - buf + 1; 3960 3851 } 3961 3852 3962 3853 static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, ··· 4008 3945 struct iwl_priv *priv = dev_get_drvdata(d); 4009 3946 u32 size = sizeof(struct iwl_notif_statistics); 4010 3947 u32 len = 0, ofs = 0; 4011 - u8 *data = (u8 *) & priv->statistics; 3948 + u8 *data = (u8 *)&priv->statistics; 4012 3949 int rc = 0; 4013 3950 4014 3951 if (!iwl_is_alive(priv)) ··· 4104 4041 &dev_attr_channels.attr, 4105 4042 &dev_attr_flags.attr, 4106 4043 &dev_attr_filter_flags.attr, 4107 - #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 4044 + #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 4108 4045 &dev_attr_measurement.attr, 4109 4046 #endif 4110 4047 &dev_attr_power_level.attr, 4111 4048 &dev_attr_retry_rate.attr, 4112 - &dev_attr_rs_window.attr, 4113 4049 &dev_attr_statistics.attr, 4114 4050 &dev_attr_status.attr, 4115 4051 &dev_attr_temperature.attr, ··· 4456 4394 4457 4395 /* Hardware specific file defines the PCI IDs table for that hardware module */ 4458 4396 static struct pci_device_id iwl_hw_card_ids[] = { 4397 + #ifdef CONFIG_IWL4965 4459 4398 {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)}, 4460 4399 {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)}, 4400 + #endif /* CONFIG_IWL4965 */ 4461 4401 #ifdef CONFIG_IWL5000 4462 4402 {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bg_cfg)}, 4463 4403 {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bg_cfg)}, ··· 4495 4431 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 4496 4432 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 4497 4433 4498 - ret = iwl4965_rate_control_register(); 4434 + ret = iwlagn_rate_control_register(); 4499 4435 if (ret) { 4500 4436 IWL_ERROR("Unable to register rate control algorithm: %d\n", ret); 4501 4437 return ret; ··· 4510 4446 return ret; 4511 4447 4512 4448 error_register: 4513 - iwl4965_rate_control_unregister(); 4449 + iwlagn_rate_control_unregister(); 4514 4450 return ret; 4515 4451 } 4516 4452 4517 4453 static void __exit iwl4965_exit(void) 4518 4454 { 4519 4455 pci_unregister_driver(&iwl_driver); 4520 - iwl4965_rate_control_unregister(); 4456 + iwlagn_rate_control_unregister(); 4521 4457 } 4522 4458 4523 4459 module_exit(iwl4965_exit);
+1
drivers/net/wireless/p54/p54.h
··· 52 52 int (*open)(struct ieee80211_hw *dev); 53 53 void (*stop)(struct ieee80211_hw *dev); 54 54 int mode; 55 + struct mutex conf_mutex; 55 56 u8 mac_addr[ETH_ALEN]; 56 57 u8 bssid[ETH_ALEN]; 57 58 struct pda_iq_autocal_entry *iq_autocal;
+6
drivers/net/wireless/p54/p54common.c
··· 886 886 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 887 887 { 888 888 int ret; 889 + struct p54_common *priv = dev->priv; 889 890 891 + mutex_lock(&priv->conf_mutex); 890 892 ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); 891 893 p54_set_vdcf(dev); 894 + mutex_unlock(&priv->conf_mutex); 892 895 return ret; 893 896 } 894 897 ··· 901 898 { 902 899 struct p54_common *priv = dev->priv; 903 900 901 + mutex_lock(&priv->conf_mutex); 904 902 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642); 905 903 p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0); 906 904 p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); 907 905 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 906 + mutex_unlock(&priv->conf_mutex); 908 907 return 0; 909 908 } 910 909 ··· 1014 1009 } 1015 1010 1016 1011 p54_init_vdcf(dev); 1012 + mutex_init(&priv->conf_mutex); 1017 1013 1018 1014 return dev; 1019 1015 }
+14
drivers/net/wireless/rt2x00/rt2500usb.c
··· 633 633 rt2x00dev->link.vgc_level = value; 634 634 } 635 635 636 + /* 637 + * NOTE: This function is directly ported from legacy driver, but 638 + * despite it being declared it was never called. Although link tuning 639 + * sounds like a good idea, and usually works well for the other drivers, 640 + * it does _not_ work with rt2500usb. Enabling this function will result 641 + * in TX capabilities only until association kicks in. Immediately 642 + * after the successful association all TX frames will be kept in the 643 + * hardware queue and never transmitted. 644 + */ 645 + #if 0 636 646 static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev) 637 647 { 638 648 int rssi = rt2x00_get_link_rssi(&rt2x00dev->link); ··· 762 752 rt2x00dev->link.vgc_level = r17; 763 753 } 764 754 } 755 + #else 756 + #define rt2500usb_link_tuner NULL 757 + #endif 765 758 766 759 /* 767 760 * Initialization functions. ··· 1750 1737 __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); 1751 1738 __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags); 1752 1739 __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags); 1740 + __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags); 1753 1741 1754 1742 /* 1755 1743 * Set the rssi offset.
+13
include/linux/ieee80211.h
··· 506 506 u8 count; 507 507 } __attribute__ ((packed)); 508 508 509 + /** 510 + * struct ieee80211_tim 511 + * 512 + * This structure refers to "Traffic Indication Map information element" 513 + */ 514 + struct ieee80211_tim_ie { 515 + u8 dtim_count; 516 + u8 dtim_period; 517 + u8 bitmap_ctrl; 518 + /* variable size: 1 - 251 bytes */ 519 + u8 virtual_map[0]; 520 + } __attribute__ ((packed)); 521 + 509 522 struct ieee80211_mgmt { 510 523 __le16 frame_control; 511 524 __le16 duration;
+11 -2
include/net/mac80211.h
··· 177 177 * @aid: association ID number, valid only when @assoc is true 178 178 * @use_cts_prot: use CTS protection 179 179 * @use_short_preamble: use 802.11b short preamble 180 + * @dtim_period: num of beacons before the next DTIM, for PSM 180 181 * @timestamp: beacon timestamp 181 182 * @beacon_int: beacon interval 182 - * @assoc_capability: capabbilities taken from assoc resp 183 + * @assoc_capability: capabilities taken from assoc resp 183 184 * @assoc_ht: association in HT mode 184 185 * @ht_conf: ht capabilities 185 186 * @ht_bss_conf: ht extended capabilities ··· 192 191 /* erp related data */ 193 192 bool use_cts_prot; 194 193 bool use_short_preamble; 194 + u8 dtim_period; 195 195 u16 beacon_int; 196 196 u16 assoc_capability; 197 197 u64 timestamp; ··· 432 430 * @radio_enabled: when zero, driver is required to switch off the radio. 433 431 * TODO make a flag 434 432 * @beacon_int: beacon interval (TODO make interface config) 433 + * @listen_interval: listen interval in units of beacon interval 435 434 * @flags: configuration flags defined above 436 435 * @power_level: requested transmit power (in dBm) 437 436 * @max_antenna_gain: maximum antenna gain (in dBi) ··· 447 444 int radio_enabled; 448 445 449 446 int beacon_int; 447 + u16 listen_interval; 450 448 u32 flags; 451 449 int power_level; 452 450 int max_antenna_gain; ··· 789 785 * @max_signal: Maximum value for signal (rssi) in RX information, used 790 786 * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB 791 787 * 788 + * @max_listen_interval: max listen interval in units of beacon interval 789 + * that HW supports 790 + * 792 791 * @queues: number of available hardware transmit queues for 793 792 * data packets. WMM/QoS requires at least four, these 794 793 * queues need to have configurable access parameters. ··· 819 812 unsigned int extra_tx_headroom; 820 813 int channel_change_time; 821 814 int vif_data_size; 822 - u16 queues, ampdu_queues; 815 + u16 queues; 816 + u16 ampdu_queues; 817 + u16 max_listen_interval; 823 818 s8 max_signal; 824 819 }; 825 820
+1
net/mac80211/ieee80211_i.h
··· 82 82 83 83 u8 bssid[ETH_ALEN]; 84 84 u8 ssid[IEEE80211_MAX_SSID_LEN]; 85 + u8 dtim_period; 85 86 u16 capability; /* host byte order */ 86 87 enum ieee80211_band band; 87 88 int freq;
+5
net/mac80211/main.c
··· 1689 1689 if (local->hw.conf.beacon_int < 10) 1690 1690 local->hw.conf.beacon_int = 100; 1691 1691 1692 + if (local->hw.max_listen_interval == 0) 1693 + local->hw.max_listen_interval = 1; 1694 + 1695 + local->hw.conf.listen_interval = local->hw.max_listen_interval; 1696 + 1692 1697 local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | 1693 1698 IEEE80211_HW_SIGNAL_DB | 1694 1699 IEEE80211_HW_SIGNAL_DBM) ?
+32 -7
net/mac80211/mlme.c
··· 551 551 /* set timing information */ 552 552 sdata->bss_conf.beacon_int = bss->beacon_int; 553 553 sdata->bss_conf.timestamp = bss->timestamp; 554 + sdata->bss_conf.dtim_period = bss->dtim_period; 554 555 555 556 changed |= ieee80211_handle_bss_capability(sdata, bss); 556 557 ··· 774 773 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 775 774 IEEE80211_STYPE_REASSOC_REQ); 776 775 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); 777 - mgmt->u.reassoc_req.listen_interval = cpu_to_le16(1); 776 + mgmt->u.reassoc_req.listen_interval = 777 + cpu_to_le16(local->hw.conf.listen_interval); 778 778 memcpy(mgmt->u.reassoc_req.current_ap, ifsta->prev_bssid, 779 779 ETH_ALEN); 780 780 } else { ··· 783 781 mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, 784 782 IEEE80211_STYPE_ASSOC_REQ); 785 783 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); 786 - mgmt->u.assoc_req.listen_interval = cpu_to_le16(1); 784 + mgmt->u.reassoc_req.listen_interval = 785 + cpu_to_le16(local->hw.conf.listen_interval); 787 786 } 788 787 789 788 /* SSID */ ··· 2691 2688 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); 2692 2689 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); 2693 2690 2691 + if (elems->tim) { 2692 + struct ieee80211_tim_ie *tim_ie = 2693 + (struct ieee80211_tim_ie *)elems->tim; 2694 + bss->dtim_period = tim_ie->dtim_period; 2695 + } 2696 + 2697 + /* set default value for buggy APs */ 2698 + if (!elems->tim || bss->dtim_period == 0) 2699 + bss->dtim_period = 1; 2700 + 2694 2701 bss->supp_rates_len = 0; 2695 2702 if (elems->supp_rates) { 2696 2703 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; ··· 3663 3650 "%s\n", print_mac(mac, bssid), 3664 3651 print_mac(mac2, ifsta->bssid)); 3665 3652 #endif /* CONFIG_MAC80211_IBSS_DEBUG */ 3666 - if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && 3667 - (bss = ieee80211_rx_bss_get(dev, bssid, 3668 - local->hw.conf.channel->center_freq, 3669 - ifsta->ssid, ifsta->ssid_len))) { 3653 + 3654 + if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { 3670 3655 int ret; 3656 + int search_freq; 3657 + 3658 + if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) 3659 + search_freq = bss->freq; 3660 + else 3661 + search_freq = local->hw.conf.channel->center_freq; 3662 + 3663 + bss = ieee80211_rx_bss_get(dev, bssid, search_freq, 3664 + ifsta->ssid, ifsta->ssid_len); 3665 + if (!bss) 3666 + goto dont_join; 3667 + 3671 3668 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 3672 3669 " based on configured SSID\n", 3673 3670 dev->name, print_mac(mac, bssid)); ··· 3685 3662 ieee80211_rx_bss_put(local, bss); 3686 3663 return ret; 3687 3664 } 3665 + 3666 + dont_join: 3688 3667 #ifdef CONFIG_MAC80211_IBSS_DEBUG 3689 3668 printk(KERN_DEBUG " did not try to join ibss\n"); 3690 3669 #endif /* CONFIG_MAC80211_IBSS_DEBUG */ ··· 3920 3895 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 3921 3896 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 3922 3897 if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || 3923 - (!ifsta->state == IEEE80211_IBSS_JOINED && 3898 + (!(ifsta->state == IEEE80211_IBSS_JOINED) && 3924 3899 !ieee80211_sta_active_ibss(dev))) 3925 3900 ieee80211_sta_find_ibss(dev, ifsta); 3926 3901 }