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