diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
51 files changed, 3354 insertions, 3523 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index b0ac0ce3fb9f..47bee0ee0a7c 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -4,6 +4,7 @@ config IWLWIFI | |||
4 | config IWLCORE | 4 | config IWLCORE |
5 | tristate "Intel Wireless Wifi Core" | 5 | tristate "Intel Wireless Wifi Core" |
6 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL | 6 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL |
7 | select LIB80211 | ||
7 | select IWLWIFI | 8 | select IWLWIFI |
8 | select MAC80211_LEDS if IWLWIFI_LEDS | 9 | select MAC80211_LEDS if IWLWIFI_LEDS |
9 | select LEDS_CLASS if IWLWIFI_LEDS | 10 | select LEDS_CLASS if IWLWIFI_LEDS |
@@ -105,6 +106,7 @@ config IWL3945 | |||
105 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" | 106 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" |
106 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL | 107 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL |
107 | select FW_LOADER | 108 | select FW_LOADER |
109 | select LIB80211 | ||
108 | select IWLWIFI | 110 | select IWLWIFI |
109 | select MAC80211_LEDS if IWL3945_LEDS | 111 | select MAC80211_LEDS if IWL3945_LEDS |
110 | select LEDS_CLASS if IWL3945_LEDS | 112 | select LEDS_CLASS if IWL3945_LEDS |
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile index 47aa28f6a513..0be9e6b66aa0 100644 --- a/drivers/net/wireless/iwlwifi/Makefile +++ b/drivers/net/wireless/iwlwifi/Makefile | |||
@@ -5,9 +5,10 @@ iwlcore-objs += iwl-scan.o | |||
5 | iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o | 5 | 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 | iwlcore-$(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) += iwl-spectrum.o | ||
8 | 9 | ||
9 | obj-$(CONFIG_IWLAGN) += iwlagn.o | 10 | obj-$(CONFIG_IWLAGN) += iwlagn.o |
10 | iwlagn-objs := iwl-agn.o iwl-agn-rs.o | 11 | iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-hcmd-check.o |
11 | 12 | ||
12 | iwlagn-$(CONFIG_IWL4965) += iwl-4965.o | 13 | iwlagn-$(CONFIG_IWL4965) += iwl-4965.o |
13 | iwlagn-$(CONFIG_IWL5000) += iwl-5000.o | 14 | iwlagn-$(CONFIG_IWL5000) += iwl-5000.o |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h index 817ece773643..c6f4eb54a2b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -69,6 +69,12 @@ | |||
69 | #ifndef __iwl_3945_commands_h__ | 69 | #ifndef __iwl_3945_commands_h__ |
70 | #define __iwl_3945_commands_h__ | 70 | #define __iwl_3945_commands_h__ |
71 | 71 | ||
72 | /* uCode version contains 4 values: Major/Minor/API/Serial */ | ||
73 | #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) | ||
74 | #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) | ||
75 | #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) | ||
76 | #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) | ||
77 | |||
72 | enum { | 78 | enum { |
73 | REPLY_ALIVE = 0x1, | 79 | REPLY_ALIVE = 0x1, |
74 | REPLY_ERROR = 0x2, | 80 | REPLY_ERROR = 0x2, |
@@ -121,7 +127,7 @@ enum { | |||
121 | REPLY_TX_PWR_TABLE_CMD = 0x97, | 127 | REPLY_TX_PWR_TABLE_CMD = 0x97, |
122 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ | 128 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
123 | 129 | ||
124 | /* Bluetooth device coexistance config command */ | 130 | /* Bluetooth device coexistence config command */ |
125 | REPLY_BT_CONFIG = 0x9b, | 131 | REPLY_BT_CONFIG = 0x9b, |
126 | 132 | ||
127 | /* Statistics */ | 133 | /* Statistics */ |
@@ -158,7 +164,7 @@ struct iwl3945_cmd_header { | |||
158 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ | 164 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
159 | u8 flags; /* IWL_CMD_* */ | 165 | u8 flags; /* IWL_CMD_* */ |
160 | /* | 166 | /* |
161 | * The driver sets up the sequence number to values of its chosing. | 167 | * The driver sets up the sequence number to values of its choosing. |
162 | * uCode does not use this value, but passes it back to the driver | 168 | * uCode does not use this value, but passes it back to the driver |
163 | * when sending the response to each driver-originated command, so | 169 | * when sending the response to each driver-originated command, so |
164 | * the driver can match the response to the command. Since the values | 170 | * the driver can match the response to the command. Since the values |
@@ -220,7 +226,7 @@ struct iwl3945_power_per_rate { | |||
220 | * | 226 | * |
221 | *****************************************************************************/ | 227 | *****************************************************************************/ |
222 | 228 | ||
223 | #define UCODE_VALID_OK __constant_cpu_to_le32(0x1) | 229 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
224 | #define INITIALIZE_SUBTYPE (9) | 230 | #define INITIALIZE_SUBTYPE (9) |
225 | 231 | ||
226 | /* | 232 | /* |
@@ -322,42 +328,42 @@ enum { | |||
322 | 328 | ||
323 | /* rx_config flags */ | 329 | /* rx_config flags */ |
324 | /* band & modulation selection */ | 330 | /* band & modulation selection */ |
325 | #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) | 331 | #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) |
326 | #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) | 332 | #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) |
327 | /* auto detection enable */ | 333 | /* auto detection enable */ |
328 | #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) | 334 | #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) |
329 | /* TGg protection when tx */ | 335 | /* TGg protection when tx */ |
330 | #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) | 336 | #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) |
331 | /* cck short slot & preamble */ | 337 | /* cck short slot & preamble */ |
332 | #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) | 338 | #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) |
333 | #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) | 339 | #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) |
334 | /* antenna selection */ | 340 | /* antenna selection */ |
335 | #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) | 341 | #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) |
336 | #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) | 342 | #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) |
337 | #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) | 343 | #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
338 | #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) | 344 | #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
339 | /* radar detection enable */ | 345 | /* radar detection enable */ |
340 | #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) | 346 | #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) |
341 | #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) | 347 | #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) |
342 | /* rx response to host with 8-byte TSF | 348 | /* rx response to host with 8-byte TSF |
343 | * (according to ON_AIR deassertion) */ | 349 | * (according to ON_AIR deassertion) */ |
344 | #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) | 350 | #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) |
345 | 351 | ||
346 | /* rx_config filter flags */ | 352 | /* rx_config filter flags */ |
347 | /* accept all data frames */ | 353 | /* accept all data frames */ |
348 | #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) | 354 | #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) |
349 | /* pass control & management to host */ | 355 | /* pass control & management to host */ |
350 | #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) | 356 | #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) |
351 | /* accept multi-cast */ | 357 | /* accept multi-cast */ |
352 | #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) | 358 | #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) |
353 | /* don't decrypt uni-cast frames */ | 359 | /* don't decrypt uni-cast frames */ |
354 | #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) | 360 | #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) |
355 | /* don't decrypt multi-cast frames */ | 361 | /* don't decrypt multi-cast frames */ |
356 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) | 362 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) |
357 | /* STA is associated */ | 363 | /* STA is associated */ |
358 | #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) | 364 | #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) |
359 | /* transfer to host non bssid beacons in associated state */ | 365 | /* transfer to host non bssid beacons in associated state */ |
360 | #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) | 366 | #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) |
361 | 367 | ||
362 | /** | 368 | /** |
363 | * REPLY_RXON = 0x10 (command, has simple generic response) | 369 | * REPLY_RXON = 0x10 (command, has simple generic response) |
@@ -471,9 +477,9 @@ struct iwl3945_ac_qos { | |||
471 | } __attribute__ ((packed)); | 477 | } __attribute__ ((packed)); |
472 | 478 | ||
473 | /* QoS flags defines */ | 479 | /* QoS flags defines */ |
474 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) | 480 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) |
475 | #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) | 481 | #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) |
476 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) | 482 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) |
477 | 483 | ||
478 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ | 484 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ |
479 | #define AC_NUM 4 | 485 | #define AC_NUM 4 |
@@ -508,27 +514,27 @@ struct iwl3945_qosparam_cmd { | |||
508 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ | 514 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
509 | #define IWL_INVALID_STATION 255 | 515 | #define IWL_INVALID_STATION 255 |
510 | 516 | ||
511 | #define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1 << 2); | 517 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2); |
512 | #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8); | 518 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); |
513 | 519 | ||
514 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ | 520 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ |
515 | #define STA_CONTROL_MODIFY_MSK 0x01 | 521 | #define STA_CONTROL_MODIFY_MSK 0x01 |
516 | 522 | ||
517 | /* key flags __le16*/ | 523 | /* key flags __le16*/ |
518 | #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x0007) | 524 | #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) |
519 | #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0000) | 525 | #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) |
520 | #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x0001) | 526 | #define STA_KEY_FLG_WEP cpu_to_le16(0x0001) |
521 | #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x0002) | 527 | #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) |
522 | #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x0003) | 528 | #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) |
523 | 529 | ||
524 | #define STA_KEY_FLG_KEYID_POS 8 | 530 | #define STA_KEY_FLG_KEYID_POS 8 |
525 | #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) | 531 | #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) |
526 | /* wep key is either from global key (0) or from station info array (1) */ | 532 | /* wep key is either from global key (0) or from station info array (1) */ |
527 | #define STA_KEY_FLG_WEP_KEY_MAP_MSK __constant_cpu_to_le16(0x0008) | 533 | #define STA_KEY_FLG_WEP_KEY_MAP_MSK cpu_to_le16(0x0008) |
528 | 534 | ||
529 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ | 535 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ |
530 | #define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000) | 536 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) |
531 | #define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000) | 537 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) |
532 | 538 | ||
533 | /* Flags indicate whether to modify vs. don't change various station params */ | 539 | /* Flags indicate whether to modify vs. don't change various station params */ |
534 | #define STA_MODIFY_KEY_MASK 0x01 | 540 | #define STA_MODIFY_KEY_MASK 0x01 |
@@ -666,14 +672,14 @@ struct iwl3945_rx_frame_hdr { | |||
666 | u8 payload[0]; | 672 | u8 payload[0]; |
667 | } __attribute__ ((packed)); | 673 | } __attribute__ ((packed)); |
668 | 674 | ||
669 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) | 675 | #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) |
670 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) | 676 | #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) |
671 | 677 | ||
672 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) | 678 | #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) |
673 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) | 679 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) |
674 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) | 680 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) |
675 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) | 681 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) |
676 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) | 682 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) |
677 | 683 | ||
678 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | 684 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
679 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) | 685 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
@@ -733,57 +739,57 @@ struct iwl3945_rx_frame { | |||
733 | 739 | ||
734 | /* 1: Use Request-To-Send protocol before this frame. | 740 | /* 1: Use Request-To-Send protocol before this frame. |
735 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ | 741 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ |
736 | #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) | 742 | #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) |
737 | 743 | ||
738 | /* 1: Transmit Clear-To-Send to self before this frame. | 744 | /* 1: Transmit Clear-To-Send to self before this frame. |
739 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. | 745 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. |
740 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ | 746 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ |
741 | #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) | 747 | #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) |
742 | 748 | ||
743 | /* 1: Expect ACK from receiving station | 749 | /* 1: Expect ACK from receiving station |
744 | * 0: Don't expect ACK (MAC header's duration field s/b 0) | 750 | * 0: Don't expect ACK (MAC header's duration field s/b 0) |
745 | * Set this for unicast frames, but not broadcast/multicast. */ | 751 | * Set this for unicast frames, but not broadcast/multicast. */ |
746 | #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) | 752 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) |
747 | 753 | ||
748 | /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). | 754 | /* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). |
749 | * Tx command's initial_rate_index indicates first rate to try; | 755 | * Tx command's initial_rate_index indicates first rate to try; |
750 | * uCode walks through table for additional Tx attempts. | 756 | * uCode walks through table for additional Tx attempts. |
751 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. | 757 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. |
752 | * This rate will be used for all Tx attempts; it will not be scaled. */ | 758 | * This rate will be used for all Tx attempts; it will not be scaled. */ |
753 | #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) | 759 | #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) |
754 | 760 | ||
755 | /* 1: Expect immediate block-ack. | 761 | /* 1: Expect immediate block-ack. |
756 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ | 762 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ |
757 | #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) | 763 | #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) |
758 | 764 | ||
759 | /* 1: Frame requires full Tx-Op protection. | 765 | /* 1: Frame requires full Tx-Op protection. |
760 | * Set this if either RTS or CTS Tx Flag gets set. */ | 766 | * Set this if either RTS or CTS Tx Flag gets set. */ |
761 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) | 767 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) |
762 | 768 | ||
763 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. | 769 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. |
764 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ | 770 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ |
765 | #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) | 771 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) |
766 | #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) | 772 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
767 | #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) | 773 | #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
768 | 774 | ||
769 | /* 1: Ignore Bluetooth priority for this frame. | 775 | /* 1: Ignore Bluetooth priority for this frame. |
770 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ | 776 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ |
771 | #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) | 777 | #define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) |
772 | 778 | ||
773 | /* 1: uCode overrides sequence control field in MAC header. | 779 | /* 1: uCode overrides sequence control field in MAC header. |
774 | * 0: Driver provides sequence control field in MAC header. | 780 | * 0: Driver provides sequence control field in MAC header. |
775 | * Set this for management frames, non-QOS data frames, non-unicast frames, | 781 | * Set this for management frames, non-QOS data frames, non-unicast frames, |
776 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ | 782 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ |
777 | #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) | 783 | #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) |
778 | 784 | ||
779 | /* 1: This frame is non-last MPDU; more fragments are coming. | 785 | /* 1: This frame is non-last MPDU; more fragments are coming. |
780 | * 0: Last fragment, or not using fragmentation. */ | 786 | * 0: Last fragment, or not using fragmentation. */ |
781 | #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) | 787 | #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) |
782 | 788 | ||
783 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. | 789 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. |
784 | * 0: No TSF required in outgoing frame. | 790 | * 0: No TSF required in outgoing frame. |
785 | * Set this for transmitting beacons and probe responses. */ | 791 | * Set this for transmitting beacons and probe responses. */ |
786 | #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) | 792 | #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) |
787 | 793 | ||
788 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword | 794 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword |
789 | * alignment of frame's payload data field. | 795 | * alignment of frame's payload data field. |
@@ -791,10 +797,10 @@ struct iwl3945_rx_frame { | |||
791 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 | 797 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 |
792 | * field (but not both). Driver must align frame data (i.e. data following | 798 | * field (but not both). Driver must align frame data (i.e. data following |
793 | * MAC header) to DWORD boundary. */ | 799 | * MAC header) to DWORD boundary. */ |
794 | #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) | 800 | #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) |
795 | 801 | ||
796 | /* HCCA-AP - disable duration overwriting. */ | 802 | /* HCCA-AP - disable duration overwriting. */ |
797 | #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) | 803 | #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) |
798 | 804 | ||
799 | /* | 805 | /* |
800 | * TX command security control | 806 | * TX command security control |
@@ -991,7 +997,7 @@ struct iwl3945_rate_scaling_cmd { | |||
991 | * | 997 | * |
992 | * 3945 and 4965 support hardware handshake with Bluetooth device on | 998 | * 3945 and 4965 support hardware handshake with Bluetooth device on |
993 | * same platform. Bluetooth device alerts wireless device when it will Tx; | 999 | * same platform. Bluetooth device alerts wireless device when it will Tx; |
994 | * wireless device can delay or kill its own Tx to accomodate. | 1000 | * wireless device can delay or kill its own Tx to accommodate. |
995 | */ | 1001 | */ |
996 | struct iwl3945_bt_cmd { | 1002 | struct iwl3945_bt_cmd { |
997 | u8 flags; | 1003 | u8 flags; |
@@ -1158,9 +1164,9 @@ struct iwl3945_spectrum_notification { | |||
1158 | */ | 1164 | */ |
1159 | #define IWL_POWER_VEC_SIZE 5 | 1165 | #define IWL_POWER_VEC_SIZE 5 |
1160 | 1166 | ||
1161 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1 << 0) | 1167 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le32(1 << 0) |
1162 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1 << 2) | 1168 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le32(1 << 2) |
1163 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1 << 3) | 1169 | #define IWL_POWER_PCI_PM_MSK cpu_to_le32(1 << 3) |
1164 | struct iwl3945_powertable_cmd { | 1170 | struct iwl3945_powertable_cmd { |
1165 | __le32 flags; | 1171 | __le32 flags; |
1166 | __le32 rx_data_timeout; | 1172 | __le32 rx_data_timeout; |
@@ -1278,8 +1284,8 @@ struct iwl3945_ssid_ie { | |||
1278 | } __attribute__ ((packed)); | 1284 | } __attribute__ ((packed)); |
1279 | 1285 | ||
1280 | #define PROBE_OPTION_MAX 0x4 | 1286 | #define PROBE_OPTION_MAX 0x4 |
1281 | #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) | 1287 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) |
1282 | #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) | 1288 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) |
1283 | #define IWL_MAX_SCAN_SIZE 1024 | 1289 | #define IWL_MAX_SCAN_SIZE 1024 |
1284 | 1290 | ||
1285 | /* | 1291 | /* |
@@ -1379,7 +1385,7 @@ struct iwl3945_scan_cmd { | |||
1379 | } __attribute__ ((packed)); | 1385 | } __attribute__ ((packed)); |
1380 | 1386 | ||
1381 | /* Can abort will notify by complete notification with abort status. */ | 1387 | /* Can abort will notify by complete notification with abort status. */ |
1382 | #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) | 1388 | #define CAN_ABORT_STATUS cpu_to_le32(0x1) |
1383 | /* complete notification statuses */ | 1389 | /* complete notification statuses */ |
1384 | #define ABORT_STATUS 0x2 | 1390 | #define ABORT_STATUS 0x2 |
1385 | 1391 | ||
@@ -1572,8 +1578,8 @@ struct statistics_general { | |||
1572 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag | 1578 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag |
1573 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. | 1579 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. |
1574 | */ | 1580 | */ |
1575 | #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ | 1581 | #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ |
1576 | #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ | 1582 | #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ |
1577 | struct iwl3945_statistics_cmd { | 1583 | struct iwl3945_statistics_cmd { |
1578 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ | 1584 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
1579 | } __attribute__ ((packed)); | 1585 | } __attribute__ ((packed)); |
@@ -1593,8 +1599,8 @@ struct iwl3945_statistics_cmd { | |||
1593 | * appropriately so that each notification contains statistics for only the | 1599 | * appropriately so that each notification contains statistics for only the |
1594 | * one channel that has just been scanned. | 1600 | * one channel that has just been scanned. |
1595 | */ | 1601 | */ |
1596 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) | 1602 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) |
1597 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) | 1603 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) |
1598 | struct iwl3945_notif_statistics { | 1604 | struct iwl3945_notif_statistics { |
1599 | __le32 flag; | 1605 | __le32 flag; |
1600 | struct statistics_rx rx; | 1606 | struct statistics_rx rx; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-core.h b/drivers/net/wireless/iwlwifi/iwl-3945-core.h index bc12f97ba0b1..6f463555402c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-core.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -71,9 +71,33 @@ | |||
71 | #define IWL_SKU_G 0x1 | 71 | #define IWL_SKU_G 0x1 |
72 | #define IWL_SKU_A 0x2 | 72 | #define IWL_SKU_A 0x2 |
73 | 73 | ||
74 | /** | ||
75 | * struct iwl_3945_cfg | ||
76 | * @fw_name_pre: Firmware filename prefix. The api version and extension | ||
77 | * (.ucode) will be added to filename before loading from disk. The | ||
78 | * filename is constructed as fw_name_pre<api>.ucode. | ||
79 | * @ucode_api_max: Highest version of uCode API supported by driver. | ||
80 | * @ucode_api_min: Lowest version of uCode API supported by driver. | ||
81 | * | ||
82 | * We enable the driver to be backward compatible wrt API version. The | ||
83 | * driver specifies which APIs it supports (with @ucode_api_max being the | ||
84 | * highest and @ucode_api_min the lowest). Firmware will only be loaded if | ||
85 | * it has a supported API version. The firmware's API version will be | ||
86 | * stored in @iwl_priv, enabling the driver to make runtime changes based | ||
87 | * on firmware version used. | ||
88 | * | ||
89 | * For example, | ||
90 | * if (IWL_UCODE_API(priv->ucode_ver) >= 2) { | ||
91 | * Driver interacts with Firmware API version >= 2. | ||
92 | * } else { | ||
93 | * Driver interacts with Firmware API version 1. | ||
94 | * } | ||
95 | */ | ||
74 | struct iwl_3945_cfg { | 96 | struct iwl_3945_cfg { |
75 | const char *name; | 97 | const char *name; |
76 | const char *fw_name; | 98 | const char *fw_name_pre; |
99 | const unsigned int ucode_api_max; | ||
100 | const unsigned int ucode_api_min; | ||
77 | unsigned int sku; | 101 | unsigned int sku; |
78 | }; | 102 | }; |
79 | 103 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h index 33016fb5e9b3..85eb778f9df1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * file called LICENSE. | 21 | * file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 24 | * Intel Linux Wireless <ilw@linux.intel.com> |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 644bd9e08052..94ea0e60c410 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -103,7 +103,6 @@ | |||
103 | * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. | 103 | * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. |
104 | */ | 104 | */ |
105 | #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ | 105 | #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ |
106 | #define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */ | ||
107 | 106 | ||
108 | /* | 107 | /* |
109 | * Regulatory channel usage flags in EEPROM struct iwl_eeprom_channel.flags. | 108 | * Regulatory channel usage flags in EEPROM struct iwl_eeprom_channel.flags. |
@@ -321,6 +320,7 @@ struct iwl3945_eeprom { | |||
321 | /* RSSR */ | 320 | /* RSSR */ |
322 | #define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000) | 321 | #define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000) |
323 | #define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004) | 322 | #define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004) |
323 | #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) | ||
324 | /* TCSR */ | 324 | /* TCSR */ |
325 | #define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20) | 325 | #define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20) |
326 | #define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00) | 326 | #define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index b3fe48de3ae7..2440fd664dd5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * file called LICENSE. | 21 | * file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 24 | * Intel Linux Wireless <ilw@linux.intel.com> |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
@@ -53,7 +53,7 @@ | |||
53 | * _iwl3945_read32.) | 53 | * _iwl3945_read32.) |
54 | * | 54 | * |
55 | * These declarations are *extremely* useful in quickly isolating code deltas | 55 | * These declarations are *extremely* useful in quickly isolating code deltas |
56 | * which result in misconfiguring of the hardware I/O. In combination with | 56 | * which result in misconfiguration of the hardware I/O. In combination with |
57 | * git-bisect and the IO debug level you can quickly determine the specific | 57 | * git-bisect and the IO debug level you can quickly determine the specific |
58 | * commit which breaks the IO sequence to the hardware. | 58 | * commit which breaks the IO sequence to the hardware. |
59 | * | 59 | * |
@@ -93,7 +93,7 @@ static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr, | |||
93 | do { | 93 | do { |
94 | if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask)) | 94 | if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask)) |
95 | return i; | 95 | return i; |
96 | mdelay(10); | 96 | udelay(10); |
97 | i += 10; | 97 | i += 10; |
98 | } while (i < timeout); | 98 | } while (i < timeout); |
99 | 99 | ||
@@ -107,7 +107,7 @@ static inline int __iwl3945_poll_bit(const char *f, u32 l, | |||
107 | int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout); | 107 | int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout); |
108 | IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", | 108 | IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", |
109 | addr, bits, mask, | 109 | addr, bits, mask, |
110 | unlikely(ret == -ETIMEDOUT)?"timeout":"", f, l); | 110 | unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); |
111 | return ret; | 111 | return ret; |
112 | } | 112 | } |
113 | #define iwl3945_poll_bit(priv, addr, bits, mask, timeout) \ | 113 | #define iwl3945_poll_bit(priv, addr, bits, mask, timeout) \ |
@@ -271,16 +271,7 @@ static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv, | |||
271 | static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv, | 271 | static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv, |
272 | u32 addr, u32 mask, int timeout) | 272 | u32 addr, u32 mask, int timeout) |
273 | { | 273 | { |
274 | int i = 0; | 274 | return _iwl3945_poll_bit(priv, addr, mask, mask, timeout); |
275 | |||
276 | do { | ||
277 | if ((_iwl3945_read_direct32(priv, addr) & mask) == mask) | ||
278 | return i; | ||
279 | mdelay(10); | ||
280 | i += 10; | ||
281 | } while (i < timeout); | ||
282 | |||
283 | return -ETIMEDOUT; | ||
284 | } | 275 | } |
285 | 276 | ||
286 | #ifdef CONFIG_IWL3945_DEBUG | 277 | #ifdef CONFIG_IWL3945_DEBUG |
@@ -307,6 +298,7 @@ static inline int __iwl3945_poll_direct_bit(const char *f, u32 l, | |||
307 | static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg) | 298 | static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg) |
308 | { | 299 | { |
309 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 300 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); |
301 | rmb(); | ||
310 | return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT); | 302 | return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT); |
311 | } | 303 | } |
312 | #ifdef CONFIG_IWL3945_DEBUG | 304 | #ifdef CONFIG_IWL3945_DEBUG |
@@ -328,6 +320,7 @@ static inline void _iwl3945_write_prph(struct iwl3945_priv *priv, | |||
328 | { | 320 | { |
329 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR, | 321 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR, |
330 | ((addr & 0x0000FFFF) | (3 << 24))); | 322 | ((addr & 0x0000FFFF) | (3 << 24))); |
323 | wmb(); | ||
331 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); | 324 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); |
332 | } | 325 | } |
333 | #ifdef CONFIG_IWL3945_DEBUG | 326 | #ifdef CONFIG_IWL3945_DEBUG |
@@ -389,12 +382,14 @@ static inline void iwl3945_clear_bits_prph(struct iwl3945_priv | |||
389 | static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr) | 382 | static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr) |
390 | { | 383 | { |
391 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); | 384 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); |
385 | rmb(); | ||
392 | return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 386 | return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); |
393 | } | 387 | } |
394 | 388 | ||
395 | static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val) | 389 | static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val) |
396 | { | 390 | { |
397 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 391 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
392 | wmb(); | ||
398 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); | 393 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); |
399 | } | 394 | } |
400 | 395 | ||
@@ -402,6 +397,7 @@ static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 add | |||
402 | u32 len, u32 *values) | 397 | u32 len, u32 *values) |
403 | { | 398 | { |
404 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 399 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
400 | wmb(); | ||
405 | for (; 0 < len; len -= sizeof(u32), values++) | 401 | for (; 0 < len; len -= sizeof(u32), values++) |
406 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); | 402 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); |
407 | } | 403 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c index 705c65bed9fd..4c638909a7db 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.h b/drivers/net/wireless/iwlwifi/iwl-3945-led.h index 2fbd126c1347..749ac035fd6a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-led.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 6fc5e7361f26..9b60a0c5de5f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -63,6 +63,9 @@ struct iwl3945_rs_sta { | |||
63 | u8 ibss_sta_added; | 63 | u8 ibss_sta_added; |
64 | struct timer_list rate_scale_flush; | 64 | struct timer_list rate_scale_flush; |
65 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; | 65 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; |
66 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
67 | struct dentry *rs_sta_dbgfs_stats_table_file; | ||
68 | #endif | ||
66 | 69 | ||
67 | /* used to be in sta_info */ | 70 | /* used to be in sta_info */ |
68 | int last_txrate_idx; | 71 | int last_txrate_idx; |
@@ -114,9 +117,11 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { | |||
114 | }; | 117 | }; |
115 | 118 | ||
116 | #define IWL_RATE_MAX_WINDOW 62 | 119 | #define IWL_RATE_MAX_WINDOW 62 |
117 | #define IWL_RATE_FLUSH (3*HZ/10) | 120 | #define IWL_RATE_FLUSH (3*HZ) |
118 | #define IWL_RATE_WIN_FLUSH (HZ/2) | 121 | #define IWL_RATE_WIN_FLUSH (HZ/2) |
119 | #define IWL_RATE_HIGH_TH 11520 | 122 | #define IWL_RATE_HIGH_TH 11520 |
123 | #define IWL_SUCCESS_UP_TH 8960 | ||
124 | #define IWL_SUCCESS_DOWN_TH 10880 | ||
120 | #define IWL_RATE_MIN_FAILURE_TH 8 | 125 | #define IWL_RATE_MIN_FAILURE_TH 8 |
121 | #define IWL_RATE_MIN_SUCCESS_TH 8 | 126 | #define IWL_RATE_MIN_SUCCESS_TH 8 |
122 | #define IWL_RATE_DECREASE_TH 1920 | 127 | #define IWL_RATE_DECREASE_TH 1920 |
@@ -203,6 +208,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
203 | 208 | ||
204 | #define IWL_RATE_FLUSH_MAX 5000 /* msec */ | 209 | #define IWL_RATE_FLUSH_MAX 5000 /* msec */ |
205 | #define IWL_RATE_FLUSH_MIN 50 /* msec */ | 210 | #define IWL_RATE_FLUSH_MIN 50 /* msec */ |
211 | #define IWL_AVERAGE_PACKETS 1500 | ||
206 | 212 | ||
207 | static void iwl3945_bg_rate_scale_flush(unsigned long data) | 213 | static void iwl3945_bg_rate_scale_flush(unsigned long data) |
208 | { | 214 | { |
@@ -217,8 +223,6 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) | |||
217 | 223 | ||
218 | spin_lock_irqsave(&rs_sta->lock, flags); | 224 | spin_lock_irqsave(&rs_sta->lock, flags); |
219 | 225 | ||
220 | rs_sta->flush_pending = 0; | ||
221 | |||
222 | /* Number of packets Rx'd since last time this timer ran */ | 226 | /* Number of packets Rx'd since last time this timer ran */ |
223 | packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1; | 227 | packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1; |
224 | 228 | ||
@@ -227,7 +231,6 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) | |||
227 | if (unflushed) { | 231 | if (unflushed) { |
228 | duration = | 232 | duration = |
229 | jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); | 233 | jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); |
230 | /* duration = jiffies_to_msecs(rs_sta->flush_time); */ | ||
231 | 234 | ||
232 | IWL_DEBUG_RATE("Tx'd %d packets in %dms\n", | 235 | IWL_DEBUG_RATE("Tx'd %d packets in %dms\n", |
233 | packet_count, duration); | 236 | packet_count, duration); |
@@ -239,9 +242,11 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) | |||
239 | pps = 0; | 242 | pps = 0; |
240 | 243 | ||
241 | if (pps) { | 244 | if (pps) { |
242 | duration = IWL_RATE_FLUSH_MAX / pps; | 245 | duration = (IWL_AVERAGE_PACKETS * 1000) / pps; |
243 | if (duration < IWL_RATE_FLUSH_MIN) | 246 | if (duration < IWL_RATE_FLUSH_MIN) |
244 | duration = IWL_RATE_FLUSH_MIN; | 247 | duration = IWL_RATE_FLUSH_MIN; |
248 | else if (duration > IWL_RATE_FLUSH_MAX) | ||
249 | duration = IWL_RATE_FLUSH_MAX; | ||
245 | } else | 250 | } else |
246 | duration = IWL_RATE_FLUSH_MAX; | 251 | duration = IWL_RATE_FLUSH_MAX; |
247 | 252 | ||
@@ -254,8 +259,10 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) | |||
254 | rs_sta->flush_time); | 259 | rs_sta->flush_time); |
255 | 260 | ||
256 | rs_sta->last_partial_flush = jiffies; | 261 | rs_sta->last_partial_flush = jiffies; |
262 | } else { | ||
263 | rs_sta->flush_time = IWL_RATE_FLUSH; | ||
264 | rs_sta->flush_pending = 0; | ||
257 | } | 265 | } |
258 | |||
259 | /* If there weren't any unflushed entries, we don't schedule the timer | 266 | /* If there weren't any unflushed entries, we don't schedule the timer |
260 | * to run again */ | 267 | * to run again */ |
261 | 268 | ||
@@ -275,17 +282,18 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data) | |||
275 | */ | 282 | */ |
276 | static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | 283 | static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, |
277 | struct iwl3945_rate_scale_data *window, | 284 | struct iwl3945_rate_scale_data *window, |
278 | int success, int retries) | 285 | int success, int retries, int index) |
279 | { | 286 | { |
280 | unsigned long flags; | 287 | unsigned long flags; |
288 | s32 fail_count; | ||
281 | 289 | ||
282 | if (!retries) { | 290 | if (!retries) { |
283 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); | 291 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); |
284 | return; | 292 | return; |
285 | } | 293 | } |
286 | 294 | ||
295 | spin_lock_irqsave(&rs_sta->lock, flags); | ||
287 | while (retries--) { | 296 | while (retries--) { |
288 | spin_lock_irqsave(&rs_sta->lock, flags); | ||
289 | 297 | ||
290 | /* If we have filled up the window then subtract one from the | 298 | /* If we have filled up the window then subtract one from the |
291 | * success counter if the high-bit is counting toward | 299 | * success counter if the high-bit is counting toward |
@@ -313,14 +321,25 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
313 | /* Tag this window as having been updated */ | 321 | /* Tag this window as having been updated */ |
314 | window->stamp = jiffies; | 322 | window->stamp = jiffies; |
315 | 323 | ||
316 | spin_unlock_irqrestore(&rs_sta->lock, flags); | ||
317 | } | 324 | } |
325 | |||
326 | fail_count = window->counter - window->success_counter; | ||
327 | if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || | ||
328 | (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) | ||
329 | window->average_tpt = ((window->success_ratio * | ||
330 | rs_sta->expected_tpt[index] + 64) / 128); | ||
331 | else | ||
332 | window->average_tpt = IWL_INV_TPT; | ||
333 | |||
334 | spin_unlock_irqrestore(&rs_sta->lock, flags); | ||
335 | |||
318 | } | 336 | } |
319 | 337 | ||
320 | static void rs_rate_init(void *priv, struct ieee80211_supported_band *sband, | 338 | static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, |
321 | struct ieee80211_sta *sta, void *priv_sta) | 339 | struct ieee80211_sta *sta, void *priv_sta) |
322 | { | 340 | { |
323 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 341 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
342 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; | ||
324 | int i; | 343 | int i; |
325 | 344 | ||
326 | IWL_DEBUG_RATE("enter\n"); | 345 | IWL_DEBUG_RATE("enter\n"); |
@@ -330,16 +349,21 @@ static void rs_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
330 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 349 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
331 | * after assoc.. */ | 350 | * after assoc.. */ |
332 | 351 | ||
333 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { | 352 | for (i = sband->n_bitrates - 1; i >= 0; i--) { |
334 | if (sta->supp_rates[sband->band] & (1 << i)) { | 353 | if (sta->supp_rates[sband->band] & (1 << i)) { |
335 | rs_sta->last_txrate_idx = i; | 354 | rs_sta->last_txrate_idx = i; |
336 | break; | 355 | break; |
337 | } | 356 | } |
338 | } | 357 | } |
339 | 358 | ||
359 | priv->sta_supp_rates = sta->supp_rates[sband->band]; | ||
340 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ | 360 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ |
341 | if (sband->band == IEEE80211_BAND_5GHZ) | 361 | if (sband->band == IEEE80211_BAND_5GHZ) { |
342 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 362 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
363 | priv->sta_supp_rates = priv->sta_supp_rates << | ||
364 | IWL_FIRST_OFDM_RATE; | ||
365 | } | ||
366 | |||
343 | 367 | ||
344 | IWL_DEBUG_RATE("leave\n"); | 368 | IWL_DEBUG_RATE("leave\n"); |
345 | } | 369 | } |
@@ -355,12 +379,6 @@ static void rs_free(void *priv) | |||
355 | return; | 379 | return; |
356 | } | 380 | } |
357 | 381 | ||
358 | static void rs_clear(void *priv) | ||
359 | { | ||
360 | return; | ||
361 | } | ||
362 | |||
363 | |||
364 | static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | 382 | static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) |
365 | { | 383 | { |
366 | struct iwl3945_rs_sta *rs_sta; | 384 | struct iwl3945_rs_sta *rs_sta; |
@@ -422,34 +440,6 @@ static void rs_free_sta(void *priv, struct ieee80211_sta *sta, | |||
422 | } | 440 | } |
423 | 441 | ||
424 | 442 | ||
425 | /* | ||
426 | * get ieee prev rate from rate scale table. | ||
427 | * for A and B mode we need to overright prev | ||
428 | * value | ||
429 | */ | ||
430 | static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate) | ||
431 | { | ||
432 | int next_rate = iwl3945_get_prev_ieee_rate(rate); | ||
433 | |||
434 | switch (priv->band) { | ||
435 | case IEEE80211_BAND_5GHZ: | ||
436 | if (rate == IWL_RATE_12M_INDEX) | ||
437 | next_rate = IWL_RATE_9M_INDEX; | ||
438 | else if (rate == IWL_RATE_6M_INDEX) | ||
439 | next_rate = IWL_RATE_6M_INDEX; | ||
440 | break; | ||
441 | /* XXX cannot be invoked in current mac80211 so not a regression | ||
442 | case MODE_IEEE80211B: | ||
443 | if (rate == IWL_RATE_11M_INDEX_TABLE) | ||
444 | next_rate = IWL_RATE_5M_INDEX_TABLE; | ||
445 | break; | ||
446 | */ | ||
447 | default: | ||
448 | break; | ||
449 | } | ||
450 | |||
451 | return next_rate; | ||
452 | } | ||
453 | /** | 443 | /** |
454 | * rs_tx_status - Update rate control values based on Tx results | 444 | * rs_tx_status - Update rate control values based on Tx results |
455 | * | 445 | * |
@@ -460,7 +450,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
460 | struct ieee80211_sta *sta, void *priv_sta, | 450 | struct ieee80211_sta *sta, void *priv_sta, |
461 | struct sk_buff *skb) | 451 | struct sk_buff *skb) |
462 | { | 452 | { |
463 | u8 retries, current_count; | 453 | s8 retries = 0, current_count; |
464 | int scale_rate_index, first_index, last_index; | 454 | int scale_rate_index, first_index, last_index; |
465 | unsigned long flags; | 455 | unsigned long flags; |
466 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; | 456 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; |
@@ -469,8 +459,9 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
469 | 459 | ||
470 | IWL_DEBUG_RATE("enter\n"); | 460 | IWL_DEBUG_RATE("enter\n"); |
471 | 461 | ||
472 | retries = info->status.retry_count; | 462 | retries = info->status.rates[0].count; |
473 | first_index = sband->bitrates[info->tx_rate_idx].hw_value; | 463 | |
464 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; | ||
474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { | 465 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { |
475 | IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); | 466 | IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); |
476 | return; | 467 | return; |
@@ -496,13 +487,13 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
496 | * at which the frame was finally transmitted (or failed if no | 487 | * at which the frame was finally transmitted (or failed if no |
497 | * ACK) | 488 | * ACK) |
498 | */ | 489 | */ |
499 | while (retries > 0) { | 490 | while (retries > 1) { |
500 | if (retries < priv->retry_rate) { | 491 | if ((retries - 1) < priv->retry_rate) { |
501 | current_count = retries; | 492 | current_count = (retries - 1); |
502 | last_index = scale_rate_index; | 493 | last_index = scale_rate_index; |
503 | } else { | 494 | } else { |
504 | current_count = priv->retry_rate; | 495 | current_count = priv->retry_rate; |
505 | last_index = rs_adjust_next_rate(priv, | 496 | last_index = iwl3945_rs_next_rate(priv, |
506 | scale_rate_index); | 497 | scale_rate_index); |
507 | } | 498 | } |
508 | 499 | ||
@@ -510,15 +501,13 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
510 | * as was used for it (per current_count) */ | 501 | * as was used for it (per current_count) */ |
511 | iwl3945_collect_tx_data(rs_sta, | 502 | iwl3945_collect_tx_data(rs_sta, |
512 | &rs_sta->win[scale_rate_index], | 503 | &rs_sta->win[scale_rate_index], |
513 | 0, current_count); | 504 | 0, current_count, scale_rate_index); |
514 | IWL_DEBUG_RATE("Update rate %d for %d retries.\n", | 505 | IWL_DEBUG_RATE("Update rate %d for %d retries.\n", |
515 | scale_rate_index, current_count); | 506 | scale_rate_index, current_count); |
516 | 507 | ||
517 | retries -= current_count; | 508 | retries -= current_count; |
518 | 509 | ||
519 | if (retries) | 510 | scale_rate_index = last_index; |
520 | scale_rate_index = | ||
521 | rs_adjust_next_rate(priv, scale_rate_index); | ||
522 | } | 511 | } |
523 | 512 | ||
524 | 513 | ||
@@ -529,7 +518,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
529 | "success" : "failure"); | 518 | "success" : "failure"); |
530 | iwl3945_collect_tx_data(rs_sta, | 519 | iwl3945_collect_tx_data(rs_sta, |
531 | &rs_sta->win[last_index], | 520 | &rs_sta->win[last_index], |
532 | info->flags & IEEE80211_TX_STAT_ACK, 1); | 521 | info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); |
533 | 522 | ||
534 | /* We updated the rate scale window -- if its been more than | 523 | /* We updated the rate scale window -- if its been more than |
535 | * flush_time since the last run, schedule the flush | 524 | * flush_time since the last run, schedule the flush |
@@ -537,9 +526,10 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
537 | spin_lock_irqsave(&rs_sta->lock, flags); | 526 | spin_lock_irqsave(&rs_sta->lock, flags); |
538 | 527 | ||
539 | if (!rs_sta->flush_pending && | 528 | if (!rs_sta->flush_pending && |
540 | time_after(jiffies, rs_sta->last_partial_flush + | 529 | time_after(jiffies, rs_sta->last_flush + |
541 | rs_sta->flush_time)) { | 530 | rs_sta->flush_time)) { |
542 | 531 | ||
532 | rs_sta->last_partial_flush = jiffies; | ||
543 | rs_sta->flush_pending = 1; | 533 | rs_sta->flush_pending = 1; |
544 | mod_timer(&rs_sta->rate_scale_flush, | 534 | mod_timer(&rs_sta->rate_scale_flush, |
545 | jiffies + rs_sta->flush_time); | 535 | jiffies + rs_sta->flush_time); |
@@ -630,10 +620,11 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
630 | * rate table and must reference the driver allocated rate table | 620 | * rate table and must reference the driver allocated rate table |
631 | * | 621 | * |
632 | */ | 622 | */ |
633 | static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | 623 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, |
634 | struct ieee80211_sta *sta, void *priv_sta, | 624 | void *priv_sta, struct ieee80211_tx_rate_control *txrc) |
635 | struct sk_buff *skb, struct rate_selection *sel) | ||
636 | { | 625 | { |
626 | struct ieee80211_supported_band *sband = txrc->sband; | ||
627 | struct sk_buff *skb = txrc->skb; | ||
637 | u8 low = IWL_RATE_INVALID; | 628 | u8 low = IWL_RATE_INVALID; |
638 | u8 high = IWL_RATE_INVALID; | 629 | u8 high = IWL_RATE_INVALID; |
639 | u16 high_low; | 630 | u16 high_low; |
@@ -649,7 +640,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
649 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 640 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
650 | u16 fc, rate_mask; | 641 | u16 fc, rate_mask; |
651 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; | 642 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; |
652 | DECLARE_MAC_BUF(mac); | 643 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
653 | 644 | ||
654 | IWL_DEBUG_RATE("enter\n"); | 645 | IWL_DEBUG_RATE("enter\n"); |
655 | 646 | ||
@@ -660,7 +651,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
660 | is_multicast_ether_addr(hdr->addr1) || | 651 | is_multicast_ether_addr(hdr->addr1) || |
661 | !sta || !priv_sta) { | 652 | !sta || !priv_sta) { |
662 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); | 653 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); |
663 | sel->rate_idx = rate_lowest_index(sband, sta); | 654 | info->control.rates[0].idx = rate_lowest_index(sband, sta); |
664 | return; | 655 | return; |
665 | } | 656 | } |
666 | 657 | ||
@@ -675,8 +666,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
675 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 666 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
676 | 667 | ||
677 | if (sta_id == IWL_INVALID_STATION) { | 668 | if (sta_id == IWL_INVALID_STATION) { |
678 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 669 | IWL_DEBUG_RATE("LQ: ADD station %pm\n", |
679 | print_mac(mac, hdr->addr1)); | 670 | hdr->addr1); |
680 | sta_id = iwl3945_add_station(priv, | 671 | sta_id = iwl3945_add_station(priv, |
681 | hdr->addr1, 0, CMD_ASYNC); | 672 | hdr->addr1, 0, CMD_ASYNC); |
682 | } | 673 | } |
@@ -686,8 +677,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
686 | 677 | ||
687 | spin_lock_irqsave(&rs_sta->lock, flags); | 678 | spin_lock_irqsave(&rs_sta->lock, flags); |
688 | 679 | ||
680 | /* for recent assoc, choose best rate regarding | ||
681 | * to rssi value | ||
682 | */ | ||
689 | if (rs_sta->start_rate != IWL_RATE_INVALID) { | 683 | if (rs_sta->start_rate != IWL_RATE_INVALID) { |
690 | index = rs_sta->start_rate; | 684 | if (rs_sta->start_rate < index && |
685 | (rate_mask & (1 << rs_sta->start_rate))) | ||
686 | index = rs_sta->start_rate; | ||
691 | rs_sta->start_rate = IWL_RATE_INVALID; | 687 | rs_sta->start_rate = IWL_RATE_INVALID; |
692 | } | 688 | } |
693 | 689 | ||
@@ -697,7 +693,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
697 | 693 | ||
698 | if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) && | 694 | if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) && |
699 | (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { | 695 | (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { |
700 | window->average_tpt = IWL_INV_TPT; | ||
701 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 696 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
702 | 697 | ||
703 | IWL_DEBUG_RATE("Invalid average_tpt on rate %d: " | 698 | IWL_DEBUG_RATE("Invalid average_tpt on rate %d: " |
@@ -711,8 +706,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
711 | 706 | ||
712 | } | 707 | } |
713 | 708 | ||
714 | window->average_tpt = ((window->success_ratio * | ||
715 | rs_sta->expected_tpt[index] + 64) / 128); | ||
716 | current_tpt = window->average_tpt; | 709 | current_tpt = window->average_tpt; |
717 | 710 | ||
718 | high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, | 711 | high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, |
@@ -760,13 +753,15 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
760 | } | 753 | } |
761 | } | 754 | } |
762 | 755 | ||
763 | if ((window->success_ratio > IWL_RATE_HIGH_TH) || | 756 | if (scale_action == -1) { |
764 | (current_tpt > window->average_tpt)) { | 757 | if (window->success_ratio > IWL_SUCCESS_DOWN_TH) |
765 | IWL_DEBUG_RATE("No action -- success_ratio [%d] > HIGH_TH or " | 758 | scale_action = 0; |
766 | "current_tpt [%d] > average_tpt [%d]\n", | 759 | } else if (scale_action == 1) { |
767 | window->success_ratio, | 760 | if (window->success_ratio < IWL_SUCCESS_UP_TH) { |
768 | current_tpt, window->average_tpt); | 761 | IWL_DEBUG_RATE("No action -- success_ratio [%d] < " |
769 | scale_action = 0; | 762 | "SUCCESS UP\n", window->success_ratio); |
763 | scale_action = 0; | ||
764 | } | ||
770 | } | 765 | } |
771 | 766 | ||
772 | switch (scale_action) { | 767 | switch (scale_action) { |
@@ -793,24 +788,83 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
793 | 788 | ||
794 | rs_sta->last_txrate_idx = index; | 789 | rs_sta->last_txrate_idx = index; |
795 | if (sband->band == IEEE80211_BAND_5GHZ) | 790 | if (sband->band == IEEE80211_BAND_5GHZ) |
796 | sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; | 791 | info->control.rates[0].idx = rs_sta->last_txrate_idx - |
792 | IWL_FIRST_OFDM_RATE; | ||
797 | else | 793 | else |
798 | sel->rate_idx = rs_sta->last_txrate_idx; | 794 | info->control.rates[0].idx = rs_sta->last_txrate_idx; |
799 | 795 | ||
800 | IWL_DEBUG_RATE("leave: %d\n", index); | 796 | IWL_DEBUG_RATE("leave: %d\n", index); |
801 | } | 797 | } |
802 | 798 | ||
799 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
800 | static int iwl3945_open_file_generic(struct inode *inode, struct file *file) | ||
801 | { | ||
802 | file->private_data = inode->i_private; | ||
803 | return 0; | ||
804 | } | ||
805 | |||
806 | static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, | ||
807 | char __user *user_buf, | ||
808 | size_t count, loff_t *ppos) | ||
809 | { | ||
810 | char buff[1024]; | ||
811 | int desc = 0; | ||
812 | int j; | ||
813 | struct iwl3945_rs_sta *lq_sta = file->private_data; | ||
814 | |||
815 | desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n" | ||
816 | "rate=0x%X flush time %d\n", | ||
817 | lq_sta->tx_packets, | ||
818 | lq_sta->last_txrate_idx, | ||
819 | lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); | ||
820 | for (j = 0; j < IWL_RATE_COUNT; j++) { | ||
821 | desc += sprintf(buff+desc, | ||
822 | "counter=%d success=%d %%=%d\n", | ||
823 | lq_sta->win[j].counter, | ||
824 | lq_sta->win[j].success_counter, | ||
825 | lq_sta->win[j].success_ratio); | ||
826 | } | ||
827 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); | ||
828 | } | ||
829 | |||
830 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | ||
831 | .read = iwl3945_sta_dbgfs_stats_table_read, | ||
832 | .open = iwl3945_open_file_generic, | ||
833 | }; | ||
834 | |||
835 | static void iwl3945_add_debugfs(void *priv, void *priv_sta, | ||
836 | struct dentry *dir) | ||
837 | { | ||
838 | struct iwl3945_rs_sta *lq_sta = priv_sta; | ||
839 | |||
840 | lq_sta->rs_sta_dbgfs_stats_table_file = | ||
841 | debugfs_create_file("rate_stats_table", 0600, dir, | ||
842 | lq_sta, &rs_sta_dbgfs_stats_table_ops); | ||
843 | |||
844 | } | ||
845 | |||
846 | static void iwl3945_remove_debugfs(void *priv, void *priv_sta) | ||
847 | { | ||
848 | struct iwl3945_rs_sta *lq_sta = priv_sta; | ||
849 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); | ||
850 | } | ||
851 | #endif | ||
852 | |||
803 | static struct rate_control_ops rs_ops = { | 853 | static struct rate_control_ops rs_ops = { |
804 | .module = NULL, | 854 | .module = NULL, |
805 | .name = RS_NAME, | 855 | .name = RS_NAME, |
806 | .tx_status = rs_tx_status, | 856 | .tx_status = rs_tx_status, |
807 | .get_rate = rs_get_rate, | 857 | .get_rate = rs_get_rate, |
808 | .rate_init = rs_rate_init, | 858 | .rate_init = rs_rate_init, |
809 | .clear = rs_clear, | ||
810 | .alloc = rs_alloc, | 859 | .alloc = rs_alloc, |
811 | .free = rs_free, | 860 | .free = rs_free, |
812 | .alloc_sta = rs_alloc_sta, | 861 | .alloc_sta = rs_alloc_sta, |
813 | .free_sta = rs_free_sta, | 862 | .free_sta = rs_free_sta, |
863 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
864 | .add_sta_debugfs = iwl3945_add_debugfs, | ||
865 | .remove_sta_debugfs = iwl3945_remove_debugfs, | ||
866 | #endif | ||
867 | |||
814 | }; | 868 | }; |
815 | 869 | ||
816 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | 870 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) |
@@ -827,13 +881,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
827 | rcu_read_lock(); | 881 | rcu_read_lock(); |
828 | 882 | ||
829 | sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr); | 883 | sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr); |
830 | psta = (void *) sta->drv_priv; | 884 | if (!sta) { |
831 | if (!sta || !psta) { | ||
832 | IWL_DEBUG_RATE("leave - no private rate data!\n"); | ||
833 | rcu_read_unlock(); | 885 | rcu_read_unlock(); |
834 | return; | 886 | return; |
835 | } | 887 | } |
836 | 888 | ||
889 | psta = (void *) sta->drv_priv; | ||
837 | rs_sta = psta->rs_sta; | 890 | rs_sta = psta->rs_sta; |
838 | 891 | ||
839 | spin_lock_irqsave(&rs_sta->lock, flags); | 892 | spin_lock_irqsave(&rs_sta->lock, flags); |
@@ -857,7 +910,6 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
857 | break; | 910 | break; |
858 | } | 911 | } |
859 | 912 | ||
860 | rcu_read_unlock(); | ||
861 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 913 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
862 | 914 | ||
863 | rssi = priv->last_rx_rssi; | 915 | rssi = priv->last_rx_rssi; |
@@ -871,6 +923,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
871 | IWL_DEBUG_RATE("leave: rssi %d assign rate index: " | 923 | IWL_DEBUG_RATE("leave: rssi %d assign rate index: " |
872 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, | 924 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, |
873 | iwl3945_rates[rs_sta->start_rate].plcp); | 925 | iwl3945_rates[rs_sta->start_rate].plcp); |
926 | rcu_read_unlock(); | ||
874 | } | 927 | } |
875 | 928 | ||
876 | int iwl3945_rate_control_register(void) | 929 | int iwl3945_rate_control_register(void) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index 98b17ae6ef24..b5a66135dedd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7ca5627cc078..8fdb34222c0a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -200,7 +200,7 @@ static int iwl3945_hwrate_to_plcp_idx(u8 plcp) | |||
200 | * priv->eeprom is used to determine if antenna AUX/MAIN are reversed | 200 | * priv->eeprom is used to determine if antenna AUX/MAIN are reversed |
201 | * priv->antenna specifies the antenna diversity mode: | 201 | * priv->antenna specifies the antenna diversity mode: |
202 | * | 202 | * |
203 | * IWL_ANTENNA_DIVERISTY - NIC selects best antenna by itself | 203 | * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself |
204 | * IWL_ANTENNA_MAIN - Force MAIN antenna | 204 | * IWL_ANTENNA_MAIN - Force MAIN antenna |
205 | * IWL_ANTENNA_AUX - Force AUX antenna | 205 | * IWL_ANTENNA_AUX - Force AUX antenna |
206 | */ | 206 | */ |
@@ -261,6 +261,37 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status) | |||
261 | } | 261 | } |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | /* | ||
265 | * get ieee prev rate from rate scale table. | ||
266 | * for A and B mode we need to overright prev | ||
267 | * value | ||
268 | */ | ||
269 | int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate) | ||
270 | { | ||
271 | int next_rate = iwl3945_get_prev_ieee_rate(rate); | ||
272 | |||
273 | switch (priv->band) { | ||
274 | case IEEE80211_BAND_5GHZ: | ||
275 | if (rate == IWL_RATE_12M_INDEX) | ||
276 | next_rate = IWL_RATE_9M_INDEX; | ||
277 | else if (rate == IWL_RATE_6M_INDEX) | ||
278 | next_rate = IWL_RATE_6M_INDEX; | ||
279 | break; | ||
280 | case IEEE80211_BAND_2GHZ: | ||
281 | if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && | ||
282 | iwl3945_is_associated(priv)) { | ||
283 | if (rate == IWL_RATE_11M_INDEX) | ||
284 | next_rate = IWL_RATE_5M_INDEX; | ||
285 | } | ||
286 | break; | ||
287 | |||
288 | default: | ||
289 | break; | ||
290 | } | ||
291 | |||
292 | return next_rate; | ||
293 | } | ||
294 | |||
264 | 295 | ||
265 | /** | 296 | /** |
266 | * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd | 297 | * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd |
@@ -308,6 +339,7 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, | |||
308 | struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 339 | struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; |
309 | u32 status = le32_to_cpu(tx_resp->status); | 340 | u32 status = le32_to_cpu(tx_resp->status); |
310 | int rate_idx; | 341 | int rate_idx; |
342 | int fail; | ||
311 | 343 | ||
312 | if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) { | 344 | if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) { |
313 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " | 345 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " |
@@ -318,9 +350,18 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, | |||
318 | } | 350 | } |
319 | 351 | ||
320 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); | 352 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); |
321 | memset(&info->status, 0, sizeof(info->status)); | 353 | ieee80211_tx_info_clear_status(info); |
354 | |||
355 | /* Fill the MRR chain with some info about on-chip retransmissions */ | ||
356 | rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate); | ||
357 | if (info->band == IEEE80211_BAND_5GHZ) | ||
358 | rate_idx -= IWL_FIRST_OFDM_RATE; | ||
359 | |||
360 | fail = tx_resp->failure_frame; | ||
361 | |||
362 | info->status.rates[0].idx = rate_idx; | ||
363 | info->status.rates[0].count = fail + 1; /* add final attempt */ | ||
322 | 364 | ||
323 | info->status.retry_count = tx_resp->failure_frame; | ||
324 | /* tx_status->rts_retry_count = tx_resp->failure_rts; */ | 365 | /* tx_status->rts_retry_count = tx_resp->failure_rts; */ |
325 | info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? | 366 | info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? |
326 | IEEE80211_TX_STAT_ACK : 0; | 367 | IEEE80211_TX_STAT_ACK : 0; |
@@ -329,10 +370,6 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, | |||
329 | txq_id, iwl3945_get_tx_fail_reason(status), status, | 370 | txq_id, iwl3945_get_tx_fail_reason(status), status, |
330 | tx_resp->rate, tx_resp->failure_frame); | 371 | tx_resp->rate, tx_resp->failure_frame); |
331 | 372 | ||
332 | rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate); | ||
333 | if (info->band == IEEE80211_BAND_5GHZ) | ||
334 | rate_idx -= IWL_FIRST_OFDM_RATE; | ||
335 | info->tx_rate_idx = rate_idx; | ||
336 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); | 373 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); |
337 | iwl3945_tx_queue_reclaim(priv, txq_id, index); | 374 | iwl3945_tx_queue_reclaim(priv, txq_id, index); |
338 | 375 | ||
@@ -756,13 +793,19 @@ int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue * | |||
756 | 793 | ||
757 | u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr) | 794 | u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr) |
758 | { | 795 | { |
759 | int i; | 796 | int i, start = IWL_AP_ID; |
760 | int ret = IWL_INVALID_STATION; | 797 | int ret = IWL_INVALID_STATION; |
761 | unsigned long flags; | 798 | unsigned long flags; |
762 | DECLARE_MAC_BUF(mac); | 799 | |
800 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
801 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
802 | start = IWL_STA_ID; | ||
803 | |||
804 | if (is_broadcast_ether_addr(addr)) | ||
805 | return priv->hw_setting.bcast_sta_id; | ||
763 | 806 | ||
764 | spin_lock_irqsave(&priv->sta_lock, flags); | 807 | spin_lock_irqsave(&priv->sta_lock, flags); |
765 | for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) | 808 | for (i = start; i < priv->hw_setting.max_stations; i++) |
766 | if ((priv->stations[i].used) && | 809 | if ((priv->stations[i].used) && |
767 | (!compare_ether_addr | 810 | (!compare_ether_addr |
768 | (priv->stations[i].sta.sta.addr, addr))) { | 811 | (priv->stations[i].sta.sta.addr, addr))) { |
@@ -770,8 +813,8 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr) | |||
770 | goto out; | 813 | goto out; |
771 | } | 814 | } |
772 | 815 | ||
773 | IWL_DEBUG_INFO("can not find STA %s (total %d)\n", | 816 | IWL_DEBUG_INFO("can not find STA %pM (total %d)\n", |
774 | print_mac(mac, addr), priv->num_stations); | 817 | addr, priv->num_stations); |
775 | out: | 818 | out: |
776 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 819 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
777 | return ret; | 820 | return ret; |
@@ -1060,9 +1103,8 @@ int iwl3945_hw_nic_init(struct iwl3945_priv *priv) | |||
1060 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); | 1103 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); |
1061 | 1104 | ||
1062 | iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 1105 | iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
1063 | rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL, | 1106 | rc = iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL, |
1064 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1107 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
1065 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
1066 | if (rc < 0) { | 1108 | if (rc < 0) { |
1067 | spin_unlock_irqrestore(&priv->lock, flags); | 1109 | spin_unlock_irqrestore(&priv->lock, flags); |
1068 | IWL_DEBUG_INFO("Failed to init the card\n"); | 1110 | IWL_DEBUG_INFO("Failed to init the card\n"); |
@@ -1243,8 +1285,7 @@ int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv) | |||
1243 | IWL_DEBUG_INFO("Card in power save, master is already " | 1285 | IWL_DEBUG_INFO("Card in power save, master is already " |
1244 | "stopped\n"); | 1286 | "stopped\n"); |
1245 | else { | 1287 | else { |
1246 | rc = iwl3945_poll_bit(priv, CSR_RESET, | 1288 | rc = iwl3945_poll_direct_bit(priv, CSR_RESET, |
1247 | CSR_RESET_REG_FLAG_MASTER_DISABLED, | ||
1248 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | 1289 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
1249 | if (rc < 0) { | 1290 | if (rc < 0) { |
1250 | spin_unlock_irqrestore(&priv->lock, flags); | 1291 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1269,9 +1310,8 @@ int iwl3945_hw_nic_reset(struct iwl3945_priv *priv) | |||
1269 | 1310 | ||
1270 | iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | 1311 | iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); |
1271 | 1312 | ||
1272 | rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL, | 1313 | iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL, |
1273 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1314 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
1274 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
1275 | 1315 | ||
1276 | rc = iwl3945_grab_nic_access(priv); | 1316 | rc = iwl3945_grab_nic_access(priv); |
1277 | if (!rc) { | 1317 | if (!rc) { |
@@ -1830,7 +1870,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv) | |||
1830 | ref_temp = (s16)priv->eeprom.groups[ch_info->group_index]. | 1870 | ref_temp = (s16)priv->eeprom.groups[ch_info->group_index]. |
1831 | temperature; | 1871 | temperature; |
1832 | 1872 | ||
1833 | /* get power index adjustment based on curr and factory | 1873 | /* get power index adjustment based on current and factory |
1834 | * temps */ | 1874 | * temps */ |
1835 | delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, | 1875 | delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, |
1836 | ref_temp); | 1876 | ref_temp); |
@@ -2268,7 +2308,8 @@ int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv) | |||
2268 | } | 2308 | } |
2269 | 2309 | ||
2270 | iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0); | 2310 | iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0); |
2271 | rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); | 2311 | rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS, |
2312 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); | ||
2272 | if (rc < 0) | 2313 | if (rc < 0) |
2273 | IWL_ERROR("Can't stop Rx DMA.\n"); | 2314 | IWL_ERROR("Can't stop Rx DMA.\n"); |
2274 | 2315 | ||
@@ -2337,7 +2378,8 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2337 | iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0); | 2378 | iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0); |
2338 | table[index].try_cnt = priv->retry_rate; | 2379 | table[index].try_cnt = priv->retry_rate; |
2339 | prev_index = iwl3945_get_prev_ieee_rate(i); | 2380 | prev_index = iwl3945_get_prev_ieee_rate(i); |
2340 | table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index; | 2381 | table[index].next_rate_index = |
2382 | iwl3945_rates[prev_index].table_rs_index; | ||
2341 | } | 2383 | } |
2342 | 2384 | ||
2343 | switch (priv->band) { | 2385 | switch (priv->band) { |
@@ -2345,11 +2387,14 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2345 | IWL_DEBUG_RATE("Select A mode rate scale\n"); | 2387 | IWL_DEBUG_RATE("Select A mode rate scale\n"); |
2346 | /* If one of the following CCK rates is used, | 2388 | /* If one of the following CCK rates is used, |
2347 | * have it fall back to the 6M OFDM rate */ | 2389 | * have it fall back to the 6M OFDM rate */ |
2348 | for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) | 2390 | for (i = IWL_RATE_1M_INDEX_TABLE; |
2349 | table[i].next_rate_index = iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; | 2391 | i <= IWL_RATE_11M_INDEX_TABLE; i++) |
2392 | table[i].next_rate_index = | ||
2393 | iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; | ||
2350 | 2394 | ||
2351 | /* Don't fall back to CCK rates */ | 2395 | /* Don't fall back to CCK rates */ |
2352 | table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE; | 2396 | table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = |
2397 | IWL_RATE_9M_INDEX_TABLE; | ||
2353 | 2398 | ||
2354 | /* Don't drop out of OFDM rates */ | 2399 | /* Don't drop out of OFDM rates */ |
2355 | table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = | 2400 | table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = |
@@ -2360,11 +2405,20 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2360 | IWL_DEBUG_RATE("Select B/G mode rate scale\n"); | 2405 | IWL_DEBUG_RATE("Select B/G mode rate scale\n"); |
2361 | /* If an OFDM rate is used, have it fall back to the | 2406 | /* If an OFDM rate is used, have it fall back to the |
2362 | * 1M CCK rates */ | 2407 | * 1M CCK rates */ |
2363 | for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) | ||
2364 | table[i].next_rate_index = iwl3945_rates[IWL_FIRST_CCK_RATE].table_rs_index; | ||
2365 | 2408 | ||
2366 | /* CCK shouldn't fall back to OFDM... */ | 2409 | if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && |
2367 | table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE; | 2410 | iwl3945_is_associated(priv)) { |
2411 | |||
2412 | index = IWL_FIRST_CCK_RATE; | ||
2413 | for (i = IWL_RATE_6M_INDEX_TABLE; | ||
2414 | i <= IWL_RATE_54M_INDEX_TABLE; i++) | ||
2415 | table[i].next_rate_index = | ||
2416 | iwl3945_rates[index].table_rs_index; | ||
2417 | |||
2418 | index = IWL_RATE_11M_INDEX_TABLE; | ||
2419 | /* CCK shouldn't fall back to OFDM... */ | ||
2420 | table[index].next_rate_index = IWL_RATE_5M_INDEX_TABLE; | ||
2421 | } | ||
2368 | break; | 2422 | break; |
2369 | 2423 | ||
2370 | default: | 2424 | default: |
@@ -2428,7 +2482,6 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv, | |||
2428 | 2482 | ||
2429 | frame_size = iwl3945_fill_beacon_frame(priv, | 2483 | frame_size = iwl3945_fill_beacon_frame(priv, |
2430 | tx_beacon_cmd->frame, | 2484 | tx_beacon_cmd->frame, |
2431 | iwl3945_broadcast_addr, | ||
2432 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | 2485 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); |
2433 | 2486 | ||
2434 | BUG_ON(frame_size > MAX_MPDU_SIZE); | 2487 | BUG_ON(frame_size > MAX_MPDU_SIZE); |
@@ -2467,13 +2520,17 @@ void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv) | |||
2467 | 2520 | ||
2468 | static struct iwl_3945_cfg iwl3945_bg_cfg = { | 2521 | static struct iwl_3945_cfg iwl3945_bg_cfg = { |
2469 | .name = "3945BG", | 2522 | .name = "3945BG", |
2470 | .fw_name = "iwlwifi-3945" IWL3945_UCODE_API ".ucode", | 2523 | .fw_name_pre = IWL3945_FW_PRE, |
2524 | .ucode_api_max = IWL3945_UCODE_API_MAX, | ||
2525 | .ucode_api_min = IWL3945_UCODE_API_MIN, | ||
2471 | .sku = IWL_SKU_G, | 2526 | .sku = IWL_SKU_G, |
2472 | }; | 2527 | }; |
2473 | 2528 | ||
2474 | static struct iwl_3945_cfg iwl3945_abg_cfg = { | 2529 | static struct iwl_3945_cfg iwl3945_abg_cfg = { |
2475 | .name = "3945ABG", | 2530 | .name = "3945ABG", |
2476 | .fw_name = "iwlwifi-3945" IWL3945_UCODE_API ".ucode", | 2531 | .fw_name_pre = IWL3945_FW_PRE, |
2532 | .ucode_api_max = IWL3945_UCODE_API_MAX, | ||
2533 | .ucode_api_min = IWL3945_UCODE_API_MIN, | ||
2477 | .sku = IWL_SKU_A|IWL_SKU_G, | 2534 | .sku = IWL_SKU_A|IWL_SKU_G, |
2478 | }; | 2535 | }; |
2479 | 2536 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index bdd32475b99c..2c0ddc5110c6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -50,11 +50,15 @@ extern struct pci_device_id iwl3945_hw_card_ids[]; | |||
50 | #include "iwl-3945-debug.h" | 50 | #include "iwl-3945-debug.h" |
51 | #include "iwl-3945-led.h" | 51 | #include "iwl-3945-led.h" |
52 | 52 | ||
53 | /* Change firmware file name, using "-" and incrementing number, | 53 | /* Highest firmware API version supported */ |
54 | * *only* when uCode interface or architecture changes so that it | 54 | #define IWL3945_UCODE_API_MAX 2 |
55 | * is not compatible with earlier drivers. | 55 | |
56 | * This number will also appear in << 8 position of 1st dword of uCode file */ | 56 | /* Lowest firmware API version supported */ |
57 | #define IWL3945_UCODE_API "-1" | 57 | #define IWL3945_UCODE_API_MIN 1 |
58 | |||
59 | #define IWL3945_FW_PRE "iwlwifi-3945-" | ||
60 | #define _IWL3945_MODULE_FIRMWARE(api) IWL3945_FW_PRE #api ".ucode" | ||
61 | #define IWL3945_MODULE_FIRMWARE(api) _IWL3945_MODULE_FIRMWARE(api) | ||
58 | 62 | ||
59 | /* Default noise level to report when noise measurement is not available. | 63 | /* Default noise level to report when noise measurement is not available. |
60 | * This may be because we're: | 64 | * This may be because we're: |
@@ -401,12 +405,6 @@ struct iwl3945_rx_queue { | |||
401 | 405 | ||
402 | #define SCAN_INTERVAL 100 | 406 | #define SCAN_INTERVAL 100 |
403 | 407 | ||
404 | #define MAX_A_CHANNELS 252 | ||
405 | #define MIN_A_CHANNELS 7 | ||
406 | |||
407 | #define MAX_B_CHANNELS 14 | ||
408 | #define MIN_B_CHANNELS 1 | ||
409 | |||
410 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ | 408 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ |
411 | #define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ | 409 | #define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ |
412 | #define STATUS_INT_ENABLED 2 | 410 | #define STATUS_INT_ENABLED 2 |
@@ -472,7 +470,6 @@ union iwl3945_qos_capabity { | |||
472 | 470 | ||
473 | /* QoS structures */ | 471 | /* QoS structures */ |
474 | struct iwl3945_qos_info { | 472 | struct iwl3945_qos_info { |
475 | int qos_enable; | ||
476 | int qos_active; | 473 | int qos_active; |
477 | union iwl3945_qos_capabity qos_cap; | 474 | union iwl3945_qos_capabity qos_cap; |
478 | struct iwl3945_qosparam_cmd def_qos_parm; | 475 | struct iwl3945_qosparam_cmd def_qos_parm; |
@@ -505,7 +502,7 @@ struct fw_desc { | |||
505 | 502 | ||
506 | /* uCode file layout */ | 503 | /* uCode file layout */ |
507 | struct iwl3945_ucode { | 504 | struct iwl3945_ucode { |
508 | __le32 ver; /* major/minor/subminor */ | 505 | __le32 ver; /* major/minor/API/serial */ |
509 | __le32 inst_size; /* bytes of runtime instructions */ | 506 | __le32 inst_size; /* bytes of runtime instructions */ |
510 | __le32 data_size; /* bytes of runtime data */ | 507 | __le32 data_size; /* bytes of runtime data */ |
511 | __le32 init_size; /* bytes of initialization instructions */ | 508 | __le32 init_size; /* bytes of initialization instructions */ |
@@ -587,8 +584,7 @@ extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, | |||
587 | extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv, | 584 | extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv, |
588 | struct iwl3945_host_cmd *cmd); | 585 | struct iwl3945_host_cmd *cmd); |
589 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, | 586 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, |
590 | struct ieee80211_hdr *hdr, | 587 | struct ieee80211_hdr *hdr,int left); |
591 | const u8 *dest, int left); | ||
592 | extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, | 588 | extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, |
593 | struct iwl3945_rx_queue *q); | 589 | struct iwl3945_rx_queue *q); |
594 | extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv); | 590 | extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv); |
@@ -762,6 +758,8 @@ struct iwl3945_priv { | |||
762 | void __iomem *hw_base; | 758 | void __iomem *hw_base; |
763 | 759 | ||
764 | /* uCode images, save to reload in case of failure */ | 760 | /* uCode images, save to reload in case of failure */ |
761 | u32 ucode_ver; /* ucode version, copy of | ||
762 | iwl3945_ucode.ver */ | ||
765 | struct fw_desc ucode_code; /* runtime inst */ | 763 | struct fw_desc ucode_code; /* runtime inst */ |
766 | struct fw_desc ucode_data; /* runtime data original */ | 764 | struct fw_desc ucode_data; /* runtime data original */ |
767 | struct fw_desc ucode_data_backup; /* runtime data save/restore */ | 765 | struct fw_desc ucode_data_backup; /* runtime data save/restore */ |
@@ -804,6 +802,8 @@ struct iwl3945_priv { | |||
804 | u16 active_rate; | 802 | u16 active_rate; |
805 | u16 active_rate_basic; | 803 | u16 active_rate_basic; |
806 | 804 | ||
805 | u32 sta_supp_rates; | ||
806 | |||
807 | u8 call_post_assoc_from_beacon; | 807 | u8 call_post_assoc_from_beacon; |
808 | /* Rate scaling data */ | 808 | /* Rate scaling data */ |
809 | s8 data_retry_limit; | 809 | s8 data_retry_limit; |
@@ -828,8 +828,6 @@ struct iwl3945_priv { | |||
828 | unsigned long last_statistics_time; | 828 | unsigned long last_statistics_time; |
829 | 829 | ||
830 | /* context information */ | 830 | /* context information */ |
831 | u8 essid[IW_ESSID_MAX_SIZE]; | ||
832 | u8 essid_len; | ||
833 | u16 rates_mask; | 831 | u16 rates_mask; |
834 | 832 | ||
835 | u32 power_mode; | 833 | u32 power_mode; |
@@ -888,7 +886,6 @@ struct iwl3945_priv { | |||
888 | struct work_struct report_work; | 886 | struct work_struct report_work; |
889 | struct work_struct request_scan; | 887 | struct work_struct request_scan; |
890 | struct work_struct beacon_update; | 888 | struct work_struct beacon_update; |
891 | struct work_struct set_monitor; | ||
892 | 889 | ||
893 | struct tasklet_struct irq_tasklet; | 890 | struct tasklet_struct irq_tasklet; |
894 | 891 | ||
@@ -903,9 +900,6 @@ struct iwl3945_priv { | |||
903 | s8 user_txpower_limit; | 900 | s8 user_txpower_limit; |
904 | s8 max_channel_txpower_limit; | 901 | s8 max_channel_txpower_limit; |
905 | 902 | ||
906 | #ifdef CONFIG_PM | ||
907 | u32 pm_state[16]; | ||
908 | #endif | ||
909 | 903 | ||
910 | #ifdef CONFIG_IWL3945_DEBUG | 904 | #ifdef CONFIG_IWL3945_DEBUG |
911 | /* debugging info */ | 905 | /* debugging info */ |
@@ -954,6 +948,8 @@ static inline int is_channel_ibss(const struct iwl3945_channel_info *ch) | |||
954 | extern const struct iwl3945_channel_info *iwl3945_get_channel_info( | 948 | extern const struct iwl3945_channel_info *iwl3945_get_channel_info( |
955 | const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); | 949 | const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); |
956 | 950 | ||
951 | extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate); | ||
952 | |||
957 | /* Requires full declaration of iwl3945_priv before including */ | 953 | /* Requires full declaration of iwl3945_priv before including */ |
958 | #include "iwl-3945-io.h" | 954 | #include "iwl-3945-io.h" |
959 | 955 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index f4793a609443..6649f7b55650 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -71,7 +71,7 @@ | |||
71 | 71 | ||
72 | #include "iwl-fh.h" | 72 | #include "iwl-fh.h" |
73 | 73 | ||
74 | /* EERPROM */ | 74 | /* EEPROM */ |
75 | #define IWL4965_EEPROM_IMG_SIZE 1024 | 75 | #define IWL4965_EEPROM_IMG_SIZE 1024 |
76 | 76 | ||
77 | /* | 77 | /* |
@@ -84,12 +84,6 @@ | |||
84 | #define IWL_CMD_FIFO_NUM 4 | 84 | #define IWL_CMD_FIFO_NUM 4 |
85 | #define IWL49_FIRST_AMPDU_QUEUE 7 | 85 | #define IWL49_FIRST_AMPDU_QUEUE 7 |
86 | 86 | ||
87 | /* Tx rates */ | ||
88 | #define IWL_CCK_RATES 4 | ||
89 | #define IWL_OFDM_RATES 8 | ||
90 | #define IWL_HT_RATES 16 | ||
91 | #define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES) | ||
92 | |||
93 | /* Time constants */ | 87 | /* Time constants */ |
94 | #define SHORT_SLOT_TIME 9 | 88 | #define SHORT_SLOT_TIME 9 |
95 | #define LONG_SLOT_TIME 20 | 89 | #define LONG_SLOT_TIME 20 |
@@ -111,7 +105,6 @@ | |||
111 | #define PCI_CFG_CMD_REG_INT_DIS_MSK 0x04 | 105 | #define PCI_CFG_CMD_REG_INT_DIS_MSK 0x04 |
112 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) | 106 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) |
113 | 107 | ||
114 | #define TFD_QUEUE_SIZE_MAX (256) | ||
115 | 108 | ||
116 | #define IWL_NUM_SCAN_RATES (2) | 109 | #define IWL_NUM_SCAN_RATES (2) |
117 | 110 | ||
@@ -287,13 +280,13 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) | |||
287 | * that target txpower. | 280 | * that target txpower. |
288 | * | 281 | * |
289 | * | 282 | * |
290 | * 3) Determine (EEPROM) calibration subband for the target channel, by | 283 | * 3) Determine (EEPROM) calibration sub band for the target channel, by |
291 | * comparing against first and last channels in each subband | 284 | * comparing against first and last channels in each sub band |
292 | * (see struct iwl4965_eeprom_calib_subband_info). | 285 | * (see struct iwl4965_eeprom_calib_subband_info). |
293 | * | 286 | * |
294 | * | 287 | * |
295 | * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, | 288 | * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, |
296 | * referencing the 2 factory-measured (sample) channels within the subband. | 289 | * referencing the 2 factory-measured (sample) channels within the sub band. |
297 | * | 290 | * |
298 | * Interpolation is based on difference between target channel's frequency | 291 | * Interpolation is based on difference between target channel's frequency |
299 | * and the sample channels' frequencies. Since channel numbers are based | 292 | * and the sample channels' frequencies. Since channel numbers are based |
@@ -301,7 +294,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) | |||
301 | * to interpolating based on channel number differences. | 294 | * to interpolating based on channel number differences. |
302 | * | 295 | * |
303 | * Note that the sample channels may or may not be the channels at the | 296 | * Note that the sample channels may or may not be the channels at the |
304 | * edges of the subband. The target channel may be "outside" of the | 297 | * edges of the sub band. The target channel may be "outside" of the |
305 | * span of the sampled channels. | 298 | * span of the sampled channels. |
306 | * | 299 | * |
307 | * Driver may choose the pair (for 2 Tx chains) of measurements (see | 300 | * Driver may choose the pair (for 2 Tx chains) of measurements (see |
@@ -345,7 +338,7 @@ static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) | |||
345 | * "4965 temperature calculation". | 338 | * "4965 temperature calculation". |
346 | * | 339 | * |
347 | * If current temperature is higher than factory temperature, driver must | 340 | * If current temperature is higher than factory temperature, driver must |
348 | * increase gain (lower gain table index), and vice versa. | 341 | * increase gain (lower gain table index), and vice verse. |
349 | * | 342 | * |
350 | * Temperature affects gain differently for different channels: | 343 | * Temperature affects gain differently for different channels: |
351 | * | 344 | * |
@@ -815,125 +808,14 @@ enum { | |||
815 | * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array | 808 | * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array |
816 | * in DRAM containing 256 Transmit Frame Descriptors (TFDs). | 809 | * in DRAM containing 256 Transmit Frame Descriptors (TFDs). |
817 | */ | 810 | */ |
818 | #define IWL49_MAX_WIN_SIZE 64 | ||
819 | #define IWL49_QUEUE_SIZE 256 | ||
820 | #define IWL49_NUM_FIFOS 7 | 811 | #define IWL49_NUM_FIFOS 7 |
821 | #define IWL49_CMD_FIFO_NUM 4 | 812 | #define IWL49_CMD_FIFO_NUM 4 |
822 | #define IWL49_NUM_QUEUES 16 | 813 | #define IWL49_NUM_QUEUES 16 |
823 | #define IWL49_NUM_AMPDU_QUEUES 8 | 814 | #define IWL49_NUM_AMPDU_QUEUES 8 |
824 | 815 | ||
825 | /** | ||
826 | * struct iwl_tfd_frame_data | ||
827 | * | ||
828 | * Describes up to 2 buffers containing (contiguous) portions of a Tx frame. | ||
829 | * Each buffer must be on dword boundary. | ||
830 | * Up to 10 iwl_tfd_frame_data structures, describing up to 20 buffers, | ||
831 | * may be filled within a TFD (iwl_tfd_frame). | ||
832 | * | ||
833 | * Bit fields in tb1_addr: | ||
834 | * 31- 0: Tx buffer 1 address bits [31:0] | ||
835 | * | ||
836 | * Bit fields in val1: | ||
837 | * 31-16: Tx buffer 2 address bits [15:0] | ||
838 | * 15- 4: Tx buffer 1 length (bytes) | ||
839 | * 3- 0: Tx buffer 1 address bits [32:32] | ||
840 | * | ||
841 | * Bit fields in val2: | ||
842 | * 31-20: Tx buffer 2 length (bytes) | ||
843 | * 19- 0: Tx buffer 2 address bits [35:16] | ||
844 | */ | ||
845 | struct iwl_tfd_frame_data { | ||
846 | __le32 tb1_addr; | ||
847 | |||
848 | __le32 val1; | ||
849 | /* __le32 ptb1_32_35:4; */ | ||
850 | #define IWL_tb1_addr_hi_POS 0 | ||
851 | #define IWL_tb1_addr_hi_LEN 4 | ||
852 | #define IWL_tb1_addr_hi_SYM val1 | ||
853 | /* __le32 tb_len1:12; */ | ||
854 | #define IWL_tb1_len_POS 4 | ||
855 | #define IWL_tb1_len_LEN 12 | ||
856 | #define IWL_tb1_len_SYM val1 | ||
857 | /* __le32 ptb2_0_15:16; */ | ||
858 | #define IWL_tb2_addr_lo16_POS 16 | ||
859 | #define IWL_tb2_addr_lo16_LEN 16 | ||
860 | #define IWL_tb2_addr_lo16_SYM val1 | ||
861 | |||
862 | __le32 val2; | ||
863 | /* __le32 ptb2_16_35:20; */ | ||
864 | #define IWL_tb2_addr_hi20_POS 0 | ||
865 | #define IWL_tb2_addr_hi20_LEN 20 | ||
866 | #define IWL_tb2_addr_hi20_SYM val2 | ||
867 | /* __le32 tb_len2:12; */ | ||
868 | #define IWL_tb2_len_POS 20 | ||
869 | #define IWL_tb2_len_LEN 12 | ||
870 | #define IWL_tb2_len_SYM val2 | ||
871 | } __attribute__ ((packed)); | ||
872 | |||
873 | 816 | ||
874 | /** | 817 | /** |
875 | * struct iwl_tfd_frame | 818 | * struct iwl4965_schedq_bc_tbl |
876 | * | ||
877 | * Transmit Frame Descriptor (TFD) | ||
878 | * | ||
879 | * 4965 supports up to 16 Tx queues resident in host DRAM. | ||
880 | * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM. | ||
881 | * Both driver and device share these circular buffers, each of which must be | ||
882 | * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes for 4965. | ||
883 | * | ||
884 | * Driver must indicate the physical address of the base of each | ||
885 | * circular buffer via the 4965's FH_MEM_CBBC_QUEUE registers. | ||
886 | * | ||
887 | * Each TFD contains pointer/size information for up to 20 data buffers | ||
888 | * in host DRAM. These buffers collectively contain the (one) frame described | ||
889 | * by the TFD. Each buffer must be a single contiguous block of memory within | ||
890 | * itself, but buffers may be scattered in host DRAM. Each buffer has max size | ||
891 | * of (4K - 4). The 4965 concatenates all of a TFD's buffers into a single | ||
892 | * Tx frame, up to 8 KBytes in size. | ||
893 | * | ||
894 | * Bit fields in the control dword (val0): | ||
895 | * 31-30: # dwords (0-3) of padding required at end of frame for 16-byte bound | ||
896 | * 29: reserved | ||
897 | * 28-24: # Transmit Buffer Descriptors in TFD | ||
898 | * 23- 0: reserved | ||
899 | * | ||
900 | * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. | ||
901 | */ | ||
902 | struct iwl_tfd_frame { | ||
903 | __le32 val0; | ||
904 | /* __le32 rsvd1:24; */ | ||
905 | /* __le32 num_tbs:5; */ | ||
906 | #define IWL_num_tbs_POS 24 | ||
907 | #define IWL_num_tbs_LEN 5 | ||
908 | #define IWL_num_tbs_SYM val0 | ||
909 | /* __le32 rsvd2:1; */ | ||
910 | /* __le32 padding:2; */ | ||
911 | struct iwl_tfd_frame_data pa[10]; | ||
912 | __le32 reserved; | ||
913 | } __attribute__ ((packed)); | ||
914 | |||
915 | |||
916 | /** | ||
917 | * struct iwl4965_queue_byte_cnt_entry | ||
918 | * | ||
919 | * Byte Count Table Entry | ||
920 | * | ||
921 | * Bit fields: | ||
922 | * 15-12: reserved | ||
923 | * 11- 0: total to-be-transmitted byte count of frame (does not include command) | ||
924 | */ | ||
925 | struct iwl4965_queue_byte_cnt_entry { | ||
926 | __le16 val; | ||
927 | /* __le16 byte_cnt:12; */ | ||
928 | #define IWL_byte_cnt_POS 0 | ||
929 | #define IWL_byte_cnt_LEN 12 | ||
930 | #define IWL_byte_cnt_SYM val | ||
931 | /* __le16 rsvd:4; */ | ||
932 | } __attribute__ ((packed)); | ||
933 | |||
934 | |||
935 | /** | ||
936 | * struct iwl4965_sched_queue_byte_cnt_tbl | ||
937 | * | 819 | * |
938 | * Byte Count table | 820 | * Byte Count table |
939 | * | 821 | * |
@@ -947,71 +829,12 @@ struct iwl4965_queue_byte_cnt_entry { | |||
947 | * count table for the chosen Tx queue. If the TFD index is 0-63, the driver | 829 | * count table for the chosen Tx queue. If the TFD index is 0-63, the driver |
948 | * must duplicate the byte count entry in corresponding index 256-319. | 830 | * must duplicate the byte count entry in corresponding index 256-319. |
949 | * | 831 | * |
950 | * "dont_care" padding puts each byte count table on a 1024-byte boundary; | 832 | * padding puts each byte count table on a 1024-byte boundary; |
951 | * 4965 assumes tables are separated by 1024 bytes. | 833 | * 4965 assumes tables are separated by 1024 bytes. |
952 | */ | 834 | */ |
953 | struct iwl4965_sched_queue_byte_cnt_tbl { | 835 | struct iwl4965_scd_bc_tbl { |
954 | struct iwl4965_queue_byte_cnt_entry tfd_offset[IWL49_QUEUE_SIZE + | 836 | __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; |
955 | IWL49_MAX_WIN_SIZE]; | 837 | u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)]; |
956 | u8 dont_care[1024 - | ||
957 | (IWL49_QUEUE_SIZE + IWL49_MAX_WIN_SIZE) * | ||
958 | sizeof(__le16)]; | ||
959 | } __attribute__ ((packed)); | ||
960 | |||
961 | |||
962 | /** | ||
963 | * struct iwl4965_shared - handshake area for Tx and Rx | ||
964 | * | ||
965 | * For convenience in allocating memory, this structure combines 2 areas of | ||
966 | * DRAM which must be shared between driver and 4965. These do not need to | ||
967 | * be combined, if better allocation would result from keeping them separate: | ||
968 | * | ||
969 | * 1) The Tx byte count tables occupy 1024 bytes each (16 KBytes total for | ||
970 | * 16 queues). Driver uses SCD_DRAM_BASE_ADDR to tell 4965 where to find | ||
971 | * the first of these tables. 4965 assumes tables are 1024 bytes apart. | ||
972 | * | ||
973 | * 2) The Rx status (val0 and val1) occupies only 8 bytes. Driver uses | ||
974 | * FH_RSCSR_CHNL0_STTS_WPTR_REG to tell 4965 where to find this area. | ||
975 | * Driver reads val0 to determine the latest Receive Buffer Descriptor (RBD) | ||
976 | * that has been filled by the 4965. | ||
977 | * | ||
978 | * Bit fields val0: | ||
979 | * 31-12: Not used | ||
980 | * 11- 0: Index of last filled Rx buffer descriptor (4965 writes, driver reads) | ||
981 | * | ||
982 | * Bit fields val1: | ||
983 | * 31- 0: Not used | ||
984 | */ | ||
985 | struct iwl4965_shared { | ||
986 | struct iwl4965_sched_queue_byte_cnt_tbl | ||
987 | queues_byte_cnt_tbls[IWL49_NUM_QUEUES]; | ||
988 | __le32 rb_closed; | ||
989 | |||
990 | /* __le32 rb_closed_stts_rb_num:12; */ | ||
991 | #define IWL_rb_closed_stts_rb_num_POS 0 | ||
992 | #define IWL_rb_closed_stts_rb_num_LEN 12 | ||
993 | #define IWL_rb_closed_stts_rb_num_SYM rb_closed | ||
994 | /* __le32 rsrv1:4; */ | ||
995 | /* __le32 rb_closed_stts_rx_frame_num:12; */ | ||
996 | #define IWL_rb_closed_stts_rx_frame_num_POS 16 | ||
997 | #define IWL_rb_closed_stts_rx_frame_num_LEN 12 | ||
998 | #define IWL_rb_closed_stts_rx_frame_num_SYM rb_closed | ||
999 | /* __le32 rsrv2:4; */ | ||
1000 | |||
1001 | __le32 frm_finished; | ||
1002 | /* __le32 frame_finished_stts_rb_num:12; */ | ||
1003 | #define IWL_frame_finished_stts_rb_num_POS 0 | ||
1004 | #define IWL_frame_finished_stts_rb_num_LEN 12 | ||
1005 | #define IWL_frame_finished_stts_rb_num_SYM frm_finished | ||
1006 | /* __le32 rsrv3:4; */ | ||
1007 | /* __le32 frame_finished_stts_rx_frame_num:12; */ | ||
1008 | #define IWL_frame_finished_stts_rx_frame_num_POS 16 | ||
1009 | #define IWL_frame_finished_stts_rx_frame_num_LEN 12 | ||
1010 | #define IWL_frame_finished_stts_rx_frame_num_SYM frm_finished | ||
1011 | /* __le32 rsrv4:4; */ | ||
1012 | |||
1013 | __le32 padding1; /* so that allocation will be aligned to 16B */ | ||
1014 | __le32 padding2; | ||
1015 | } __attribute__ ((packed)); | 838 | } __attribute__ ((packed)); |
1016 | 839 | ||
1017 | #endif /* __iwl4965_4965_hw_h__ */ | 840 | #endif /* !__iwl_4965_hw_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 9838de5f4369..5a72bc0377de 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -48,18 +48,21 @@ | |||
48 | static int iwl4965_send_tx_power(struct iwl_priv *priv); | 48 | static int iwl4965_send_tx_power(struct iwl_priv *priv); |
49 | static int iwl4965_hw_get_temperature(const struct iwl_priv *priv); | 49 | static int iwl4965_hw_get_temperature(const struct iwl_priv *priv); |
50 | 50 | ||
51 | /* Change firmware file name, using "-" and incrementing number, | 51 | /* Highest firmware API version supported */ |
52 | * *only* when uCode interface or architecture changes so that it | 52 | #define IWL4965_UCODE_API_MAX 2 |
53 | * is not compatible with earlier drivers. | 53 | |
54 | * This number will also appear in << 8 position of 1st dword of uCode file */ | 54 | /* Lowest firmware API version supported */ |
55 | #define IWL4965_UCODE_API "-2" | 55 | #define IWL4965_UCODE_API_MIN 2 |
56 | |||
57 | #define IWL4965_FW_PRE "iwlwifi-4965-" | ||
58 | #define _IWL4965_MODULE_FIRMWARE(api) IWL4965_FW_PRE #api ".ucode" | ||
59 | #define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) | ||
56 | 60 | ||
57 | 61 | ||
58 | /* module parameters */ | 62 | /* module parameters */ |
59 | static struct iwl_mod_params iwl4965_mod_params = { | 63 | static struct iwl_mod_params iwl4965_mod_params = { |
60 | .num_of_queues = IWL49_NUM_QUEUES, | 64 | .num_of_queues = IWL49_NUM_QUEUES, |
61 | .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES, | 65 | .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES, |
62 | .enable_qos = 1, | ||
63 | .amsdu_size_8K = 1, | 66 | .amsdu_size_8K = 1, |
64 | .restart_fw = 1, | 67 | .restart_fw = 1, |
65 | /* the rest are 0 by default */ | 68 | /* the rest are 0 by default */ |
@@ -246,7 +249,7 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) | |||
246 | iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | 249 | iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, |
247 | priv->ucode_data.len); | 250 | priv->ucode_data.len); |
248 | 251 | ||
249 | /* Inst bytecount must be last to set up, bit 31 signals uCode | 252 | /* Inst byte count must be last to set up, bit 31 signals uCode |
250 | * that all new ptr/size info is in place */ | 253 | * that all new ptr/size info is in place */ |
251 | iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | 254 | iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, |
252 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | 255 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); |
@@ -318,31 +321,13 @@ static int is_fat_channel(__le32 rxon_flags) | |||
318 | /* | 321 | /* |
319 | * EEPROM handlers | 322 | * EEPROM handlers |
320 | */ | 323 | */ |
321 | 324 | static u16 iwl4965_eeprom_calib_version(struct iwl_priv *priv) | |
322 | static int iwl4965_eeprom_check_version(struct iwl_priv *priv) | ||
323 | { | 325 | { |
324 | u16 eeprom_ver; | 326 | return iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET); |
325 | u16 calib_ver; | ||
326 | |||
327 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | ||
328 | |||
329 | calib_ver = iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET); | ||
330 | |||
331 | if (eeprom_ver < EEPROM_4965_EEPROM_VERSION || | ||
332 | calib_ver < EEPROM_4965_TX_POWER_VERSION) | ||
333 | goto err; | ||
334 | |||
335 | return 0; | ||
336 | err: | ||
337 | IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", | ||
338 | eeprom_ver, EEPROM_4965_EEPROM_VERSION, | ||
339 | calib_ver, EEPROM_4965_TX_POWER_VERSION); | ||
340 | return -EINVAL; | ||
341 | |||
342 | } | 327 | } |
343 | 328 | ||
344 | /* | 329 | /* |
345 | * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask | 330 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask |
346 | * must be called under priv->lock and mac access | 331 | * must be called under priv->lock and mac access |
347 | */ | 332 | */ |
348 | static void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask) | 333 | static void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask) |
@@ -366,9 +351,8 @@ static int iwl4965_apm_init(struct iwl_priv *priv) | |||
366 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 351 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
367 | 352 | ||
368 | /* wait for clock stabilization */ | 353 | /* wait for clock stabilization */ |
369 | ret = iwl_poll_bit(priv, CSR_GP_CNTRL, | 354 | ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL, |
370 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 355 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
371 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
372 | if (ret < 0) { | 356 | if (ret < 0) { |
373 | IWL_DEBUG_INFO("Failed to init the card\n"); | 357 | IWL_DEBUG_INFO("Failed to init the card\n"); |
374 | goto out; | 358 | goto out; |
@@ -414,7 +398,7 @@ static void iwl4965_nic_config(struct iwl_priv *priv) | |||
414 | 398 | ||
415 | /* L1 is enabled by BIOS */ | 399 | /* L1 is enabled by BIOS */ |
416 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) | 400 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
417 | /* diable L0S disabled L1A enabled */ | 401 | /* disable L0S disabled L1A enabled */ |
418 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 402 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
419 | else | 403 | else |
420 | /* L0S enabled L1A disabled */ | 404 | /* L0S enabled L1A disabled */ |
@@ -442,7 +426,6 @@ static void iwl4965_nic_config(struct iwl_priv *priv) | |||
442 | 426 | ||
443 | static int iwl4965_apm_stop_master(struct iwl_priv *priv) | 427 | static int iwl4965_apm_stop_master(struct iwl_priv *priv) |
444 | { | 428 | { |
445 | int ret = 0; | ||
446 | unsigned long flags; | 429 | unsigned long flags; |
447 | 430 | ||
448 | spin_lock_irqsave(&priv->lock, flags); | 431 | spin_lock_irqsave(&priv->lock, flags); |
@@ -450,17 +433,13 @@ static int iwl4965_apm_stop_master(struct iwl_priv *priv) | |||
450 | /* set stop master bit */ | 433 | /* set stop master bit */ |
451 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); | 434 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); |
452 | 435 | ||
453 | ret = iwl_poll_bit(priv, CSR_RESET, | 436 | iwl_poll_direct_bit(priv, CSR_RESET, |
454 | CSR_RESET_REG_FLAG_MASTER_DISABLED, | 437 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
455 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | ||
456 | if (ret < 0) | ||
457 | goto out; | ||
458 | 438 | ||
459 | out: | ||
460 | spin_unlock_irqrestore(&priv->lock, flags); | 439 | spin_unlock_irqrestore(&priv->lock, flags); |
461 | IWL_DEBUG_INFO("stop master\n"); | 440 | IWL_DEBUG_INFO("stop master\n"); |
462 | 441 | ||
463 | return ret; | 442 | return 0; |
464 | } | 443 | } |
465 | 444 | ||
466 | static void iwl4965_apm_stop(struct iwl_priv *priv) | 445 | static void iwl4965_apm_stop(struct iwl_priv *priv) |
@@ -496,11 +475,9 @@ static int iwl4965_apm_reset(struct iwl_priv *priv) | |||
496 | 475 | ||
497 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 476 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
498 | 477 | ||
499 | ret = iwl_poll_bit(priv, CSR_RESET, | 478 | ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL, |
500 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 479 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
501 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25); | 480 | if (ret < 0) |
502 | |||
503 | if (ret) | ||
504 | goto out; | 481 | goto out; |
505 | 482 | ||
506 | udelay(10); | 483 | udelay(10); |
@@ -537,10 +514,10 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) | |||
537 | struct iwl_chain_noise_data *data = &(priv->chain_noise_data); | 514 | struct iwl_chain_noise_data *data = &(priv->chain_noise_data); |
538 | 515 | ||
539 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { | 516 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { |
540 | struct iwl4965_calibration_cmd cmd; | 517 | struct iwl_calib_diff_gain_cmd cmd; |
541 | 518 | ||
542 | memset(&cmd, 0, sizeof(cmd)); | 519 | memset(&cmd, 0, sizeof(cmd)); |
543 | cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; | 520 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; |
544 | cmd.diff_gain_a = 0; | 521 | cmd.diff_gain_a = 0; |
545 | cmd.diff_gain_b = 0; | 522 | cmd.diff_gain_b = 0; |
546 | cmd.diff_gain_c = 0; | 523 | cmd.diff_gain_c = 0; |
@@ -587,11 +564,11 @@ static void iwl4965_gain_computation(struct iwl_priv *priv, | |||
587 | 564 | ||
588 | /* Differential gain gets sent to uCode only once */ | 565 | /* Differential gain gets sent to uCode only once */ |
589 | if (!data->radio_write) { | 566 | if (!data->radio_write) { |
590 | struct iwl4965_calibration_cmd cmd; | 567 | struct iwl_calib_diff_gain_cmd cmd; |
591 | data->radio_write = 1; | 568 | data->radio_write = 1; |
592 | 569 | ||
593 | memset(&cmd, 0, sizeof(cmd)); | 570 | memset(&cmd, 0, sizeof(cmd)); |
594 | cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; | 571 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; |
595 | cmd.diff_gain_a = data->delta_gain_code[0]; | 572 | cmd.diff_gain_a = data->delta_gain_code[0]; |
596 | cmd.diff_gain_b = data->delta_gain_code[1]; | 573 | cmd.diff_gain_b = data->delta_gain_code[1]; |
597 | cmd.diff_gain_c = data->delta_gain_code[2]; | 574 | cmd.diff_gain_c = data->delta_gain_code[2]; |
@@ -619,10 +596,10 @@ static void iwl4965_gain_computation(struct iwl_priv *priv, | |||
619 | static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info, | 596 | static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info, |
620 | __le32 *tx_flags) | 597 | __le32 *tx_flags) |
621 | { | 598 | { |
622 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { | 599 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
623 | *tx_flags |= TX_CMD_FLG_RTS_MSK; | 600 | *tx_flags |= TX_CMD_FLG_RTS_MSK; |
624 | *tx_flags &= ~TX_CMD_FLG_CTS_MSK; | 601 | *tx_flags &= ~TX_CMD_FLG_CTS_MSK; |
625 | } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { | 602 | } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
626 | *tx_flags &= ~TX_CMD_FLG_RTS_MSK; | 603 | *tx_flags &= ~TX_CMD_FLG_RTS_MSK; |
627 | *tx_flags |= TX_CMD_FLG_CTS_MSK; | 604 | *tx_flags |= TX_CMD_FLG_CTS_MSK; |
628 | } | 605 | } |
@@ -643,7 +620,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work) | |||
643 | 620 | ||
644 | mutex_lock(&priv->mutex); | 621 | mutex_lock(&priv->mutex); |
645 | 622 | ||
646 | /* Regardless of if we are assocaited, we must reconfigure the | 623 | /* Regardless of if we are associated, we must reconfigure the |
647 | * TX power since frames can be sent on non-radar channels while | 624 | * TX power since frames can be sent on non-radar channels while |
648 | * not associated */ | 625 | * not associated */ |
649 | iwl4965_send_tx_power(priv); | 626 | iwl4965_send_tx_power(priv); |
@@ -679,7 +656,7 @@ static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, | |||
679 | int txq_id = txq->q.id; | 656 | int txq_id = txq->q.id; |
680 | 657 | ||
681 | /* Find out whether to activate Tx queue */ | 658 | /* Find out whether to activate Tx queue */ |
682 | int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; | 659 | int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; |
683 | 660 | ||
684 | /* Set up and activate */ | 661 | /* Set up and activate */ |
685 | iwl_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), | 662 | iwl_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), |
@@ -709,9 +686,10 @@ static const u16 default_queue_to_tx_fifo[] = { | |||
709 | static int iwl4965_alive_notify(struct iwl_priv *priv) | 686 | static int iwl4965_alive_notify(struct iwl_priv *priv) |
710 | { | 687 | { |
711 | u32 a; | 688 | u32 a; |
712 | int i = 0; | ||
713 | unsigned long flags; | 689 | unsigned long flags; |
714 | int ret; | 690 | int ret; |
691 | int i, chan; | ||
692 | u32 reg_val; | ||
715 | 693 | ||
716 | spin_lock_irqsave(&priv->lock, flags); | 694 | spin_lock_irqsave(&priv->lock, flags); |
717 | 695 | ||
@@ -733,8 +711,18 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) | |||
733 | 711 | ||
734 | /* Tel 4965 where to find Tx byte count tables */ | 712 | /* Tel 4965 where to find Tx byte count tables */ |
735 | iwl_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, | 713 | iwl_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, |
736 | (priv->shared_phys + | 714 | priv->scd_bc_tbls.dma >> 10); |
737 | offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10); | 715 | |
716 | /* Enable DMA channel */ | ||
717 | for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) | ||
718 | iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan), | ||
719 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | ||
720 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); | ||
721 | |||
722 | /* Update FH chicken bits */ | ||
723 | reg_val = iwl_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); | ||
724 | iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, | ||
725 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); | ||
738 | 726 | ||
739 | /* Disable chain mode for all queues */ | 727 | /* Disable chain mode for all queues */ |
740 | iwl_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); | 728 | iwl_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); |
@@ -766,7 +754,7 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) | |||
766 | (1 << priv->hw_params.max_txq_num) - 1); | 754 | (1 << priv->hw_params.max_txq_num) - 1); |
767 | 755 | ||
768 | /* Activate all Tx DMA/FIFO channels */ | 756 | /* Activate all Tx DMA/FIFO channels */ |
769 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); | 757 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 6)); |
770 | 758 | ||
771 | iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); | 759 | iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); |
772 | 760 | ||
@@ -822,7 +810,9 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) | |||
822 | } | 810 | } |
823 | 811 | ||
824 | priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues; | 812 | priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues; |
825 | priv->hw_params.first_ampdu_q = IWL49_FIRST_AMPDU_QUEUE; | 813 | priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; |
814 | priv->hw_params.scd_bc_tbls_size = | ||
815 | IWL49_NUM_QUEUES * sizeof(struct iwl4965_scd_bc_tbl); | ||
826 | priv->hw_params.max_stations = IWL4965_STATION_COUNT; | 816 | priv->hw_params.max_stations = IWL4965_STATION_COUNT; |
827 | priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID; | 817 | priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID; |
828 | priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; | 818 | priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; |
@@ -1650,36 +1640,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | |||
1650 | } | 1640 | } |
1651 | #endif | 1641 | #endif |
1652 | 1642 | ||
1653 | static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv) | ||
1654 | { | ||
1655 | struct iwl4965_shared *s = priv->shared_virt; | ||
1656 | return le32_to_cpu(s->rb_closed) & 0xFFF; | ||
1657 | } | ||
1658 | |||
1659 | static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) | ||
1660 | { | ||
1661 | priv->shared_virt = pci_alloc_consistent(priv->pci_dev, | ||
1662 | sizeof(struct iwl4965_shared), | ||
1663 | &priv->shared_phys); | ||
1664 | if (!priv->shared_virt) | ||
1665 | return -ENOMEM; | ||
1666 | |||
1667 | memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared)); | ||
1668 | |||
1669 | priv->rb_closed_offset = offsetof(struct iwl4965_shared, rb_closed); | ||
1670 | |||
1671 | return 0; | ||
1672 | } | ||
1673 | |||
1674 | static void iwl4965_free_shared_mem(struct iwl_priv *priv) | ||
1675 | { | ||
1676 | if (priv->shared_virt) | ||
1677 | pci_free_consistent(priv->pci_dev, | ||
1678 | sizeof(struct iwl4965_shared), | ||
1679 | priv->shared_virt, | ||
1680 | priv->shared_phys); | ||
1681 | } | ||
1682 | |||
1683 | /** | 1643 | /** |
1684 | * iwl4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array | 1644 | * iwl4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array |
1685 | */ | 1645 | */ |
@@ -1687,21 +1647,22 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
1687 | struct iwl_tx_queue *txq, | 1647 | struct iwl_tx_queue *txq, |
1688 | u16 byte_cnt) | 1648 | u16 byte_cnt) |
1689 | { | 1649 | { |
1690 | int len; | 1650 | struct iwl4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; |
1691 | int txq_id = txq->q.id; | 1651 | int txq_id = txq->q.id; |
1692 | struct iwl4965_shared *shared_data = priv->shared_virt; | 1652 | int write_ptr = txq->q.write_ptr; |
1653 | int len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | ||
1654 | __le16 bc_ent; | ||
1693 | 1655 | ||
1694 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 1656 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); |
1695 | 1657 | ||
1658 | bc_ent = cpu_to_le16(len & 0xFFF); | ||
1696 | /* Set up byte count within first 256 entries */ | 1659 | /* Set up byte count within first 256 entries */ |
1697 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 1660 | scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent; |
1698 | tfd_offset[txq->q.write_ptr], byte_cnt, len); | ||
1699 | 1661 | ||
1700 | /* If within first 64 entries, duplicate at end */ | 1662 | /* If within first 64 entries, duplicate at end */ |
1701 | if (txq->q.write_ptr < IWL49_MAX_WIN_SIZE) | 1663 | if (write_ptr < TFD_QUEUE_SIZE_BC_DUP) |
1702 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 1664 | scd_bc_tbl[txq_id]. |
1703 | tfd_offset[IWL49_QUEUE_SIZE + txq->q.write_ptr], | 1665 | tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent; |
1704 | byte_cnt, len); | ||
1705 | } | 1666 | } |
1706 | 1667 | ||
1707 | /** | 1668 | /** |
@@ -1956,7 +1917,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id, | |||
1956 | ra_tid = BUILD_RAxTID(sta_id, tid); | 1917 | ra_tid = BUILD_RAxTID(sta_id, tid); |
1957 | 1918 | ||
1958 | /* Modify device's station table to Tx this TID */ | 1919 | /* Modify device's station table to Tx this TID */ |
1959 | iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); | 1920 | iwl_sta_tx_modify_enable_tid(priv, sta_id, tid); |
1960 | 1921 | ||
1961 | spin_lock_irqsave(&priv->lock, flags); | 1922 | spin_lock_irqsave(&priv->lock, flags); |
1962 | ret = iwl_grab_nic_access(priv); | 1923 | ret = iwl_grab_nic_access(priv); |
@@ -2037,7 +1998,7 @@ static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) | |||
2037 | } | 1998 | } |
2038 | 1999 | ||
2039 | /** | 2000 | /** |
2040 | * iwl4965_tx_status_reply_tx - Handle Tx rspnse for frames in aggregation queue | 2001 | * iwl4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue |
2041 | */ | 2002 | */ |
2042 | static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | 2003 | static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, |
2043 | struct iwl_ht_agg *agg, | 2004 | struct iwl_ht_agg *agg, |
@@ -2059,7 +2020,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
2059 | agg->rate_n_flags = rate_n_flags; | 2020 | agg->rate_n_flags = rate_n_flags; |
2060 | agg->bitmap = 0; | 2021 | agg->bitmap = 0; |
2061 | 2022 | ||
2062 | /* # frames attempted by Tx command */ | 2023 | /* num frames attempted by Tx command */ |
2063 | if (agg->frame_count == 1) { | 2024 | if (agg->frame_count == 1) { |
2064 | /* Only one frame was attempted; no block-ack will arrive */ | 2025 | /* Only one frame was attempted; no block-ack will arrive */ |
2065 | status = le16_to_cpu(frame_status[0].status); | 2026 | status = le16_to_cpu(frame_status[0].status); |
@@ -2070,9 +2031,9 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
2070 | agg->frame_count, agg->start_idx, idx); | 2031 | agg->frame_count, agg->start_idx, idx); |
2071 | 2032 | ||
2072 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); | 2033 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); |
2073 | info->status.retry_count = tx_resp->failure_frame; | 2034 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
2074 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | 2035 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; |
2075 | info->flags |= iwl_is_tx_success(status)? | 2036 | info->flags |= iwl_is_tx_success(status) ? |
2076 | IEEE80211_TX_STAT_ACK : 0; | 2037 | IEEE80211_TX_STAT_ACK : 0; |
2077 | iwl_hwrate_to_tx_control(priv, rate_n_flags, info); | 2038 | iwl_hwrate_to_tx_control(priv, rate_n_flags, info); |
2078 | /* FIXME: code repetition end */ | 2039 | /* FIXME: code repetition end */ |
@@ -2158,12 +2119,13 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2158 | int txq_id = SEQ_TO_QUEUE(sequence); | 2119 | int txq_id = SEQ_TO_QUEUE(sequence); |
2159 | int index = SEQ_TO_INDEX(sequence); | 2120 | int index = SEQ_TO_INDEX(sequence); |
2160 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; | 2121 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; |
2122 | struct ieee80211_hdr *hdr; | ||
2161 | struct ieee80211_tx_info *info; | 2123 | struct ieee80211_tx_info *info; |
2162 | struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 2124 | struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; |
2163 | u32 status = le32_to_cpu(tx_resp->u.status); | 2125 | u32 status = le32_to_cpu(tx_resp->u.status); |
2164 | int tid = MAX_TID_COUNT, sta_id = IWL_INVALID_STATION; | 2126 | int tid = MAX_TID_COUNT; |
2165 | __le16 fc; | 2127 | int sta_id; |
2166 | struct ieee80211_hdr *hdr; | 2128 | int freed; |
2167 | u8 *qc = NULL; | 2129 | u8 *qc = NULL; |
2168 | 2130 | ||
2169 | if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { | 2131 | if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { |
@@ -2178,8 +2140,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2178 | memset(&info->status, 0, sizeof(info->status)); | 2140 | memset(&info->status, 0, sizeof(info->status)); |
2179 | 2141 | ||
2180 | hdr = iwl_tx_queue_get_hdr(priv, txq_id, index); | 2142 | hdr = iwl_tx_queue_get_hdr(priv, txq_id, index); |
2181 | fc = hdr->frame_control; | 2143 | if (ieee80211_is_data_qos(hdr->frame_control)) { |
2182 | if (ieee80211_is_data_qos(fc)) { | ||
2183 | qc = ieee80211_get_qos_ctl(hdr); | 2144 | qc = ieee80211_get_qos_ctl(hdr); |
2184 | tid = qc[0] & 0xf; | 2145 | tid = qc[0] & 0xf; |
2185 | } | 2146 | } |
@@ -2194,8 +2155,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2194 | const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp); | 2155 | const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp); |
2195 | struct iwl_ht_agg *agg = NULL; | 2156 | struct iwl_ht_agg *agg = NULL; |
2196 | 2157 | ||
2197 | if (!qc) | 2158 | WARN_ON(!qc); |
2198 | return; | ||
2199 | 2159 | ||
2200 | agg = &priv->stations[sta_id].tid[tid].agg; | 2160 | agg = &priv->stations[sta_id].tid[tid].agg; |
2201 | 2161 | ||
@@ -2206,54 +2166,49 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2206 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | 2166 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; |
2207 | 2167 | ||
2208 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { | 2168 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { |
2209 | int freed, ampdu_q; | ||
2210 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); | 2169 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); |
2211 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " | 2170 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " |
2212 | "%d index %d\n", scd_ssn , index); | 2171 | "%d index %d\n", scd_ssn , index); |
2213 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); | 2172 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
2214 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 2173 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
2215 | 2174 | ||
2216 | if (iwl_queue_space(&txq->q) > txq->q.low_mark && | 2175 | if (priv->mac80211_registered && |
2217 | txq_id >= 0 && priv->mac80211_registered && | 2176 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && |
2218 | agg->state != IWL_EMPTYING_HW_QUEUE_DELBA) { | 2177 | (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) { |
2219 | /* calculate mac80211 ampdu sw queue to wake */ | ||
2220 | ampdu_q = txq_id - IWL49_FIRST_AMPDU_QUEUE + | ||
2221 | priv->hw->queues; | ||
2222 | if (agg->state == IWL_AGG_OFF) | 2178 | if (agg->state == IWL_AGG_OFF) |
2223 | ieee80211_wake_queue(priv->hw, txq_id); | 2179 | ieee80211_wake_queue(priv->hw, txq_id); |
2224 | else | 2180 | else |
2225 | ieee80211_wake_queue(priv->hw, ampdu_q); | 2181 | ieee80211_wake_queue(priv->hw, |
2182 | txq->swq_id); | ||
2226 | } | 2183 | } |
2227 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
2228 | } | 2184 | } |
2229 | } else { | 2185 | } else { |
2230 | info->status.retry_count = tx_resp->failure_frame; | 2186 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
2231 | info->flags |= | 2187 | info->flags |= iwl_is_tx_success(status) ? |
2232 | iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; | 2188 | IEEE80211_TX_STAT_ACK : 0; |
2233 | iwl_hwrate_to_tx_control(priv, | 2189 | iwl_hwrate_to_tx_control(priv, |
2234 | le32_to_cpu(tx_resp->rate_n_flags), | 2190 | le32_to_cpu(tx_resp->rate_n_flags), |
2235 | info); | 2191 | info); |
2236 | 2192 | ||
2237 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags " | 2193 | IWL_DEBUG_TX_REPLY("TXQ %d status %s (0x%08x) " |
2238 | "0x%x retries %d\n", txq_id, | 2194 | "rate_n_flags 0x%x retries %d\n", |
2239 | iwl_get_tx_fail_reason(status), | 2195 | txq_id, |
2240 | status, le32_to_cpu(tx_resp->rate_n_flags), | 2196 | iwl_get_tx_fail_reason(status), status, |
2241 | tx_resp->failure_frame); | 2197 | le32_to_cpu(tx_resp->rate_n_flags), |
2198 | tx_resp->failure_frame); | ||
2242 | 2199 | ||
2243 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); | 2200 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
2244 | 2201 | if (qc && likely(sta_id != IWL_INVALID_STATION)) | |
2245 | if (index != -1) { | ||
2246 | int freed = iwl_tx_queue_reclaim(priv, txq_id, index); | ||
2247 | if (tid != MAX_TID_COUNT) | ||
2248 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 2202 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
2249 | if (iwl_queue_space(&txq->q) > txq->q.low_mark && | 2203 | |
2250 | (txq_id >= 0) && priv->mac80211_registered) | 2204 | if (priv->mac80211_registered && |
2205 | (iwl_queue_space(&txq->q) > txq->q.low_mark)) | ||
2251 | ieee80211_wake_queue(priv->hw, txq_id); | 2206 | ieee80211_wake_queue(priv->hw, txq_id); |
2252 | if (tid != MAX_TID_COUNT) | ||
2253 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
2254 | } | ||
2255 | } | 2207 | } |
2256 | 2208 | ||
2209 | if (qc && likely(sta_id != IWL_INVALID_STATION)) | ||
2210 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
2211 | |||
2257 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) | 2212 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) |
2258 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); | 2213 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); |
2259 | } | 2214 | } |
@@ -2328,9 +2283,6 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | |||
2328 | 2283 | ||
2329 | static struct iwl_lib_ops iwl4965_lib = { | 2284 | static struct iwl_lib_ops iwl4965_lib = { |
2330 | .set_hw_params = iwl4965_hw_set_hw_params, | 2285 | .set_hw_params = iwl4965_hw_set_hw_params, |
2331 | .alloc_shared_mem = iwl4965_alloc_shared_mem, | ||
2332 | .free_shared_mem = iwl4965_free_shared_mem, | ||
2333 | .shared_mem_rx_idx = iwl4965_shared_mem_rx_idx, | ||
2334 | .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, | 2286 | .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, |
2335 | .txq_set_sched = iwl4965_txq_set_sched, | 2287 | .txq_set_sched = iwl4965_txq_set_sched, |
2336 | .txq_agg_enable = iwl4965_txq_agg_enable, | 2288 | .txq_agg_enable = iwl4965_txq_agg_enable, |
@@ -2347,7 +2299,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2347 | .reset = iwl4965_apm_reset, | 2299 | .reset = iwl4965_apm_reset, |
2348 | .stop = iwl4965_apm_stop, | 2300 | .stop = iwl4965_apm_stop, |
2349 | .config = iwl4965_nic_config, | 2301 | .config = iwl4965_nic_config, |
2350 | .set_pwr_src = iwl4965_set_pwr_src, | 2302 | .set_pwr_src = iwl_set_pwr_src, |
2351 | }, | 2303 | }, |
2352 | .eeprom_ops = { | 2304 | .eeprom_ops = { |
2353 | .regulatory_bands = { | 2305 | .regulatory_bands = { |
@@ -2362,11 +2314,11 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2362 | .verify_signature = iwlcore_eeprom_verify_signature, | 2314 | .verify_signature = iwlcore_eeprom_verify_signature, |
2363 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | 2315 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, |
2364 | .release_semaphore = iwlcore_eeprom_release_semaphore, | 2316 | .release_semaphore = iwlcore_eeprom_release_semaphore, |
2365 | .check_version = iwl4965_eeprom_check_version, | 2317 | .calib_version = iwl4965_eeprom_calib_version, |
2366 | .query_addr = iwlcore_eeprom_query_addr, | 2318 | .query_addr = iwlcore_eeprom_query_addr, |
2367 | }, | 2319 | }, |
2368 | .send_tx_power = iwl4965_send_tx_power, | 2320 | .send_tx_power = iwl4965_send_tx_power, |
2369 | .update_chain_flags = iwl4965_update_chain_flags, | 2321 | .update_chain_flags = iwl_update_chain_flags, |
2370 | .temperature = iwl4965_temperature_calib, | 2322 | .temperature = iwl4965_temperature_calib, |
2371 | }; | 2323 | }; |
2372 | 2324 | ||
@@ -2378,15 +2330,19 @@ static struct iwl_ops iwl4965_ops = { | |||
2378 | 2330 | ||
2379 | struct iwl_cfg iwl4965_agn_cfg = { | 2331 | struct iwl_cfg iwl4965_agn_cfg = { |
2380 | .name = "4965AGN", | 2332 | .name = "4965AGN", |
2381 | .fw_name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode", | 2333 | .fw_name_pre = IWL4965_FW_PRE, |
2334 | .ucode_api_max = IWL4965_UCODE_API_MAX, | ||
2335 | .ucode_api_min = IWL4965_UCODE_API_MIN, | ||
2382 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 2336 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
2383 | .eeprom_size = IWL4965_EEPROM_IMG_SIZE, | 2337 | .eeprom_size = IWL4965_EEPROM_IMG_SIZE, |
2338 | .eeprom_ver = EEPROM_4965_EEPROM_VERSION, | ||
2339 | .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION, | ||
2384 | .ops = &iwl4965_ops, | 2340 | .ops = &iwl4965_ops, |
2385 | .mod_params = &iwl4965_mod_params, | 2341 | .mod_params = &iwl4965_mod_params, |
2386 | }; | 2342 | }; |
2387 | 2343 | ||
2388 | /* Module firmware */ | 2344 | /* Module firmware */ |
2389 | MODULE_FIRMWARE("iwlwifi-4965" IWL4965_UCODE_API ".ucode"); | 2345 | MODULE_FIRMWARE(IWL4965_MODULE_FIRMWARE(IWL4965_UCODE_API_MAX)); |
2390 | 2346 | ||
2391 | module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444); | 2347 | module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444); |
2392 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 2348 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
@@ -2394,7 +2350,7 @@ module_param_named(disable, iwl4965_mod_params.disable, int, 0444); | |||
2394 | MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); | 2350 | MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); |
2395 | module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444); | 2351 | module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444); |
2396 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); | 2352 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); |
2397 | module_param_named(debug, iwl4965_mod_params.debug, int, 0444); | 2353 | module_param_named(debug, iwl4965_mod_params.debug, uint, 0444); |
2398 | MODULE_PARM_DESC(debug, "debug output mask"); | 2354 | MODULE_PARM_DESC(debug, "debug output mask"); |
2399 | module_param_named( | 2355 | module_param_named( |
2400 | disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444); | 2356 | disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444); |
@@ -2402,9 +2358,6 @@ MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | |||
2402 | 2358 | ||
2403 | module_param_named(queues_num, iwl4965_mod_params.num_of_queues, int, 0444); | 2359 | module_param_named(queues_num, iwl4965_mod_params.num_of_queues, int, 0444); |
2404 | MODULE_PARM_DESC(queues_num, "number of hw queues."); | 2360 | MODULE_PARM_DESC(queues_num, "number of hw queues."); |
2405 | /* QoS */ | ||
2406 | module_param_named(qos_enable, iwl4965_mod_params.enable_qos, int, 0444); | ||
2407 | MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); | ||
2408 | /* 11n */ | 2361 | /* 11n */ |
2409 | module_param_named(11n_disable, iwl4965_mod_params.disable_11n, int, 0444); | 2362 | module_param_named(11n_disable, iwl4965_mod_params.disable_11n, int, 0444); |
2410 | MODULE_PARM_DESC(11n_disable, "disable 11n functionality"); | 2363 | MODULE_PARM_DESC(11n_disable, "disable 11n functionality"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index c479ee211c5c..82c3859ce0f8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -73,69 +73,27 @@ | |||
73 | #define IWL50_RTC_INST_SIZE (IWL50_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND) | 73 | #define IWL50_RTC_INST_SIZE (IWL50_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND) |
74 | #define IWL50_RTC_DATA_SIZE (IWL50_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND) | 74 | #define IWL50_RTC_DATA_SIZE (IWL50_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND) |
75 | 75 | ||
76 | /* EERPROM */ | 76 | /* EEPROM */ |
77 | #define IWL_5000_EEPROM_IMG_SIZE 2048 | 77 | #define IWL_5000_EEPROM_IMG_SIZE 2048 |
78 | 78 | ||
79 | |||
80 | #define IWL50_MAX_WIN_SIZE 64 | ||
81 | #define IWL50_QUEUE_SIZE 256 | ||
82 | #define IWL50_CMD_FIFO_NUM 7 | 79 | #define IWL50_CMD_FIFO_NUM 7 |
83 | #define IWL50_NUM_QUEUES 20 | 80 | #define IWL50_NUM_QUEUES 20 |
84 | #define IWL50_NUM_AMPDU_QUEUES 10 | 81 | #define IWL50_NUM_AMPDU_QUEUES 10 |
85 | #define IWL50_FIRST_AMPDU_QUEUE 10 | 82 | #define IWL50_FIRST_AMPDU_QUEUE 10 |
86 | 83 | ||
87 | #define IWL_sta_id_POS 12 | ||
88 | #define IWL_sta_id_LEN 4 | ||
89 | #define IWL_sta_id_SYM val | ||
90 | |||
91 | /* Fixed (non-configurable) rx data from phy */ | 84 | /* Fixed (non-configurable) rx data from phy */ |
92 | 85 | ||
93 | /* Base physical address of iwl5000_shared is provided to SCD_DRAM_BASE_ADDR | 86 | /** |
94 | * and &iwl5000_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */ | 87 | * struct iwl5000_schedq_bc_tbl scheduler byte count table |
95 | struct iwl5000_sched_queue_byte_cnt_tbl { | 88 | * base physical address of iwl5000_shared |
96 | struct iwl4965_queue_byte_cnt_entry tfd_offset[IWL50_QUEUE_SIZE + | 89 | * is provided to SCD_DRAM_BASE_ADDR |
97 | IWL50_MAX_WIN_SIZE]; | 90 | * @tfd_offset 0-12 - tx command byte count |
98 | } __attribute__ ((packed)); | 91 | * 12-16 - station index |
99 | 92 | */ | |
100 | struct iwl5000_shared { | 93 | struct iwl5000_scd_bc_tbl { |
101 | struct iwl5000_sched_queue_byte_cnt_tbl | 94 | __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; |
102 | queues_byte_cnt_tbls[IWL50_NUM_QUEUES]; | ||
103 | __le32 rb_closed; | ||
104 | |||
105 | /* __le32 rb_closed_stts_rb_num:12; */ | ||
106 | #define IWL_rb_closed_stts_rb_num_POS 0 | ||
107 | #define IWL_rb_closed_stts_rb_num_LEN 12 | ||
108 | #define IWL_rb_closed_stts_rb_num_SYM rb_closed | ||
109 | /* __le32 rsrv1:4; */ | ||
110 | /* __le32 rb_closed_stts_rx_frame_num:12; */ | ||
111 | #define IWL_rb_closed_stts_rx_frame_num_POS 16 | ||
112 | #define IWL_rb_closed_stts_rx_frame_num_LEN 12 | ||
113 | #define IWL_rb_closed_stts_rx_frame_num_SYM rb_closed | ||
114 | /* __le32 rsrv2:4; */ | ||
115 | |||
116 | __le32 frm_finished; | ||
117 | /* __le32 frame_finished_stts_rb_num:12; */ | ||
118 | #define IWL_frame_finished_stts_rb_num_POS 0 | ||
119 | #define IWL_frame_finished_stts_rb_num_LEN 12 | ||
120 | #define IWL_frame_finished_stts_rb_num_SYM frm_finished | ||
121 | /* __le32 rsrv3:4; */ | ||
122 | /* __le32 frame_finished_stts_rx_frame_num:12; */ | ||
123 | #define IWL_frame_finished_stts_rx_frame_num_POS 16 | ||
124 | #define IWL_frame_finished_stts_rx_frame_num_LEN 12 | ||
125 | #define IWL_frame_finished_stts_rx_frame_num_SYM frm_finished | ||
126 | /* __le32 rsrv4:4; */ | ||
127 | |||
128 | __le32 padding1; /* so that allocation will be aligned to 16B */ | ||
129 | __le32 padding2; | ||
130 | } __attribute__ ((packed)); | 95 | } __attribute__ ((packed)); |
131 | 96 | ||
132 | /* calibrations defined for 5000 */ | ||
133 | /* defines the order in which results should be sent to the runtime uCode */ | ||
134 | enum iwl5000_calib { | ||
135 | IWL5000_CALIB_LO, | ||
136 | IWL5000_CALIB_TX_IQ, | ||
137 | IWL5000_CALIB_TX_IQ_PERD, | ||
138 | }; | ||
139 | 97 | ||
140 | #endif /* __iwl_5000_hw_h__ */ | 98 | #endif /* __iwl_5000_hw_h__ */ |
141 | 99 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 5155b8a760a7..66d053d28a74 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -44,7 +44,21 @@ | |||
44 | #include "iwl-helpers.h" | 44 | #include "iwl-helpers.h" |
45 | #include "iwl-5000-hw.h" | 45 | #include "iwl-5000-hw.h" |
46 | 46 | ||
47 | #define IWL5000_UCODE_API "-1" | 47 | /* Highest firmware API version supported */ |
48 | #define IWL5000_UCODE_API_MAX 1 | ||
49 | #define IWL5150_UCODE_API_MAX 1 | ||
50 | |||
51 | /* Lowest firmware API version supported */ | ||
52 | #define IWL5000_UCODE_API_MIN 1 | ||
53 | #define IWL5150_UCODE_API_MIN 1 | ||
54 | |||
55 | #define IWL5000_FW_PRE "iwlwifi-5000-" | ||
56 | #define _IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE #api ".ucode" | ||
57 | #define IWL5000_MODULE_FIRMWARE(api) _IWL5000_MODULE_FIRMWARE(api) | ||
58 | |||
59 | #define IWL5150_FW_PRE "iwlwifi-5150-" | ||
60 | #define _IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE #api ".ucode" | ||
61 | #define IWL5150_MODULE_FIRMWARE(api) _IWL5150_MODULE_FIRMWARE(api) | ||
48 | 62 | ||
49 | static const u16 iwl5000_default_queue_to_tx_fifo[] = { | 63 | static const u16 iwl5000_default_queue_to_tx_fifo[] = { |
50 | IWL_TX_FIFO_AC3, | 64 | IWL_TX_FIFO_AC3, |
@@ -59,7 +73,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = { | |||
59 | /* FIXME: same implementation as 4965 */ | 73 | /* FIXME: same implementation as 4965 */ |
60 | static int iwl5000_apm_stop_master(struct iwl_priv *priv) | 74 | static int iwl5000_apm_stop_master(struct iwl_priv *priv) |
61 | { | 75 | { |
62 | int ret = 0; | ||
63 | unsigned long flags; | 76 | unsigned long flags; |
64 | 77 | ||
65 | spin_lock_irqsave(&priv->lock, flags); | 78 | spin_lock_irqsave(&priv->lock, flags); |
@@ -67,17 +80,13 @@ static int iwl5000_apm_stop_master(struct iwl_priv *priv) | |||
67 | /* set stop master bit */ | 80 | /* set stop master bit */ |
68 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); | 81 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); |
69 | 82 | ||
70 | ret = iwl_poll_bit(priv, CSR_RESET, | 83 | iwl_poll_direct_bit(priv, CSR_RESET, |
71 | CSR_RESET_REG_FLAG_MASTER_DISABLED, | ||
72 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | 84 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
73 | if (ret < 0) | ||
74 | goto out; | ||
75 | 85 | ||
76 | out: | ||
77 | spin_unlock_irqrestore(&priv->lock, flags); | 86 | spin_unlock_irqrestore(&priv->lock, flags); |
78 | IWL_DEBUG_INFO("stop master\n"); | 87 | IWL_DEBUG_INFO("stop master\n"); |
79 | 88 | ||
80 | return ret; | 89 | return 0; |
81 | } | 90 | } |
82 | 91 | ||
83 | 92 | ||
@@ -92,7 +101,7 @@ static int iwl5000_apm_init(struct iwl_priv *priv) | |||
92 | iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, | 101 | iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, |
93 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); | 102 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); |
94 | 103 | ||
95 | /* Set FH wait treshold to maximum (HW error during stress W/A) */ | 104 | /* Set FH wait threshold to maximum (HW error during stress W/A) */ |
96 | iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); | 105 | iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); |
97 | 106 | ||
98 | /* enable HAP INTA to move device L1a -> L0s */ | 107 | /* enable HAP INTA to move device L1a -> L0s */ |
@@ -106,9 +115,8 @@ static int iwl5000_apm_init(struct iwl_priv *priv) | |||
106 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 115 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
107 | 116 | ||
108 | /* wait for clock stabilization */ | 117 | /* wait for clock stabilization */ |
109 | ret = iwl_poll_bit(priv, CSR_GP_CNTRL, | 118 | ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL, |
110 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 119 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
111 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
112 | if (ret < 0) { | 120 | if (ret < 0) { |
113 | IWL_DEBUG_INFO("Failed to init the card\n"); | 121 | IWL_DEBUG_INFO("Failed to init the card\n"); |
114 | return ret; | 122 | return ret; |
@@ -132,7 +140,7 @@ static int iwl5000_apm_init(struct iwl_priv *priv) | |||
132 | return ret; | 140 | return ret; |
133 | } | 141 | } |
134 | 142 | ||
135 | /* FIXME: this is indentical to 4965 */ | 143 | /* FIXME: this is identical to 4965 */ |
136 | static void iwl5000_apm_stop(struct iwl_priv *priv) | 144 | static void iwl5000_apm_stop(struct iwl_priv *priv) |
137 | { | 145 | { |
138 | unsigned long flags; | 146 | unsigned long flags; |
@@ -175,9 +183,8 @@ static int iwl5000_apm_reset(struct iwl_priv *priv) | |||
175 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 183 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
176 | 184 | ||
177 | /* wait for clock stabilization */ | 185 | /* wait for clock stabilization */ |
178 | ret = iwl_poll_bit(priv, CSR_GP_CNTRL, | 186 | ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL, |
179 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 187 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
180 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
181 | if (ret < 0) { | 188 | if (ret < 0) { |
182 | IWL_DEBUG_INFO("Failed to init the card\n"); | 189 | IWL_DEBUG_INFO("Failed to init the card\n"); |
183 | goto out; | 190 | goto out; |
@@ -217,7 +224,7 @@ static void iwl5000_nic_config(struct iwl_priv *priv) | |||
217 | 224 | ||
218 | /* L1 is enabled by BIOS */ | 225 | /* L1 is enabled by BIOS */ |
219 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) | 226 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
220 | /* diable L0S disabled L1A enabled */ | 227 | /* disable L0S disabled L1A enabled */ |
221 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 228 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
222 | else | 229 | else |
223 | /* L0S enabled L1A disabled */ | 230 | /* L0S enabled L1A disabled */ |
@@ -291,30 +298,17 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address) | |||
291 | return (address & ADDRESS_MSK) + (offset << 1); | 298 | return (address & ADDRESS_MSK) + (offset << 1); |
292 | } | 299 | } |
293 | 300 | ||
294 | static int iwl5000_eeprom_check_version(struct iwl_priv *priv) | 301 | static u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv) |
295 | { | 302 | { |
296 | u16 eeprom_ver; | ||
297 | struct iwl_eeprom_calib_hdr { | 303 | struct iwl_eeprom_calib_hdr { |
298 | u8 version; | 304 | u8 version; |
299 | u8 pa_type; | 305 | u8 pa_type; |
300 | u16 voltage; | 306 | u16 voltage; |
301 | } *hdr; | 307 | } *hdr; |
302 | 308 | ||
303 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | ||
304 | |||
305 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, | 309 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, |
306 | EEPROM_5000_CALIB_ALL); | 310 | EEPROM_5000_CALIB_ALL); |
307 | 311 | return hdr->version; | |
308 | if (eeprom_ver < EEPROM_5000_EEPROM_VERSION || | ||
309 | hdr->version < EEPROM_5000_TX_POWER_VERSION) | ||
310 | goto err; | ||
311 | |||
312 | return 0; | ||
313 | err: | ||
314 | IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", | ||
315 | eeprom_ver, EEPROM_5000_EEPROM_VERSION, | ||
316 | hdr->version, EEPROM_5000_TX_POWER_VERSION); | ||
317 | return -EINVAL; | ||
318 | 312 | ||
319 | } | 313 | } |
320 | 314 | ||
@@ -348,10 +342,14 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
348 | data->delta_gain_code[1], data->delta_gain_code[2]); | 342 | data->delta_gain_code[1], data->delta_gain_code[2]); |
349 | 343 | ||
350 | if (!data->radio_write) { | 344 | if (!data->radio_write) { |
351 | struct iwl5000_calibration_chain_noise_gain_cmd cmd; | 345 | struct iwl_calib_chain_noise_gain_cmd cmd; |
346 | |||
352 | memset(&cmd, 0, sizeof(cmd)); | 347 | memset(&cmd, 0, sizeof(cmd)); |
353 | 348 | ||
354 | cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; | 349 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; |
350 | cmd.hdr.first_group = 0; | ||
351 | cmd.hdr.groups_num = 1; | ||
352 | cmd.hdr.data_valid = 1; | ||
355 | cmd.delta_gain_1 = data->delta_gain_code[1]; | 353 | cmd.delta_gain_1 = data->delta_gain_code[1]; |
356 | cmd.delta_gain_2 = data->delta_gain_code[2]; | 354 | cmd.delta_gain_2 = data->delta_gain_code[2]; |
357 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, | 355 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, |
@@ -373,14 +371,19 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
373 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) | 371 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) |
374 | { | 372 | { |
375 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; | 373 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; |
374 | int ret; | ||
376 | 375 | ||
377 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { | 376 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { |
378 | struct iwl5000_calibration_chain_noise_reset_cmd cmd; | 377 | struct iwl_calib_chain_noise_reset_cmd cmd; |
379 | |||
380 | memset(&cmd, 0, sizeof(cmd)); | 378 | memset(&cmd, 0, sizeof(cmd)); |
381 | cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; | 379 | |
382 | if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 380 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; |
383 | sizeof(cmd), &cmd)) | 381 | cmd.hdr.first_group = 0; |
382 | cmd.hdr.groups_num = 1; | ||
383 | cmd.hdr.data_valid = 1; | ||
384 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | ||
385 | sizeof(cmd), &cmd); | ||
386 | if (ret) | ||
384 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); | 387 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); |
385 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; | 388 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; |
386 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); | 389 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); |
@@ -390,8 +393,8 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv) | |||
390 | static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info, | 393 | static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info, |
391 | __le32 *tx_flags) | 394 | __le32 *tx_flags) |
392 | { | 395 | { |
393 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || | 396 | if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || |
394 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) | 397 | (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) |
395 | *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; | 398 | *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; |
396 | else | 399 | else |
397 | *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK; | 400 | *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK; |
@@ -426,31 +429,41 @@ static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, | |||
426 | return &priv->eeprom[address]; | 429 | return &priv->eeprom[address]; |
427 | } | 430 | } |
428 | 431 | ||
432 | static s32 iwl5150_get_ct_threshold(struct iwl_priv *priv) | ||
433 | { | ||
434 | const s32 volt2temp_coef = -5; | ||
435 | u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, | ||
436 | EEPROM_5000_TEMPERATURE); | ||
437 | /* offset = temperate - voltage / coef */ | ||
438 | s32 offset = temp_calib[0] - temp_calib[1] / volt2temp_coef; | ||
439 | s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD) - offset; | ||
440 | return threshold * volt2temp_coef; | ||
441 | } | ||
442 | |||
429 | /* | 443 | /* |
430 | * Calibration | 444 | * Calibration |
431 | */ | 445 | */ |
432 | static int iwl5000_send_Xtal_calib(struct iwl_priv *priv) | 446 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
433 | { | 447 | { |
448 | struct iwl_calib_xtal_freq_cmd cmd; | ||
434 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 449 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); |
435 | 450 | ||
436 | struct iwl5000_calibration cal_cmd = { | 451 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
437 | .op_code = IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD, | 452 | cmd.hdr.first_group = 0; |
438 | .data = { | 453 | cmd.hdr.groups_num = 1; |
439 | (u8)xtal_calib[0], | 454 | cmd.hdr.data_valid = 1; |
440 | (u8)xtal_calib[1], | 455 | cmd.cap_pin1 = (u8)xtal_calib[0]; |
441 | } | 456 | cmd.cap_pin2 = (u8)xtal_calib[1]; |
442 | }; | 457 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
443 | 458 | (u8 *)&cmd, sizeof(cmd)); | |
444 | return iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | ||
445 | sizeof(cal_cmd), &cal_cmd); | ||
446 | } | 459 | } |
447 | 460 | ||
448 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) | 461 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) |
449 | { | 462 | { |
450 | struct iwl5000_calib_cfg_cmd calib_cfg_cmd; | 463 | struct iwl_calib_cfg_cmd calib_cfg_cmd; |
451 | struct iwl_host_cmd cmd = { | 464 | struct iwl_host_cmd cmd = { |
452 | .id = CALIBRATION_CFG_CMD, | 465 | .id = CALIBRATION_CFG_CMD, |
453 | .len = sizeof(struct iwl5000_calib_cfg_cmd), | 466 | .len = sizeof(struct iwl_calib_cfg_cmd), |
454 | .data = &calib_cfg_cmd, | 467 | .data = &calib_cfg_cmd, |
455 | }; | 468 | }; |
456 | 469 | ||
@@ -467,7 +480,7 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, | |||
467 | struct iwl_rx_mem_buffer *rxb) | 480 | struct iwl_rx_mem_buffer *rxb) |
468 | { | 481 | { |
469 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; | 482 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; |
470 | struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; | 483 | struct iwl_calib_hdr *hdr = (struct iwl_calib_hdr *)pkt->u.raw; |
471 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; | 484 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; |
472 | int index; | 485 | int index; |
473 | 486 | ||
@@ -478,14 +491,20 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, | |||
478 | * uCode. iwl_send_calib_results sends them in a row according to their | 491 | * uCode. iwl_send_calib_results sends them in a row according to their |
479 | * index. We sort them here */ | 492 | * index. We sort them here */ |
480 | switch (hdr->op_code) { | 493 | switch (hdr->op_code) { |
481 | case IWL5000_PHY_CALIBRATE_LO_CMD: | 494 | case IWL_PHY_CALIBRATE_DC_CMD: |
482 | index = IWL5000_CALIB_LO; | 495 | index = IWL_CALIB_DC; |
496 | break; | ||
497 | case IWL_PHY_CALIBRATE_LO_CMD: | ||
498 | index = IWL_CALIB_LO; | ||
483 | break; | 499 | break; |
484 | case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: | 500 | case IWL_PHY_CALIBRATE_TX_IQ_CMD: |
485 | index = IWL5000_CALIB_TX_IQ; | 501 | index = IWL_CALIB_TX_IQ; |
486 | break; | 502 | break; |
487 | case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: | 503 | case IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD: |
488 | index = IWL5000_CALIB_TX_IQ_PERD; | 504 | index = IWL_CALIB_TX_IQ_PERD; |
505 | break; | ||
506 | case IWL_PHY_CALIBRATE_BASE_BAND_CMD: | ||
507 | index = IWL_CALIB_BASE_BAND; | ||
489 | break; | 508 | break; |
490 | default: | 509 | default: |
491 | IWL_ERROR("Unknown calibration notification %d\n", | 510 | IWL_ERROR("Unknown calibration notification %d\n", |
@@ -535,7 +554,7 @@ static int iwl5000_load_section(struct iwl_priv *priv, | |||
535 | 554 | ||
536 | iwl_write_direct32(priv, | 555 | iwl_write_direct32(priv, |
537 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), | 556 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), |
538 | (iwl_get_dma_hi_address(phy_addr) | 557 | (iwl_get_dma_hi_addr(phy_addr) |
539 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | 558 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); |
540 | 559 | ||
541 | iwl_write_direct32(priv, | 560 | iwl_write_direct32(priv, |
@@ -547,7 +566,7 @@ static int iwl5000_load_section(struct iwl_priv *priv, | |||
547 | iwl_write_direct32(priv, | 566 | iwl_write_direct32(priv, |
548 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | 567 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), |
549 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | 568 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | |
550 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL | | 569 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | |
551 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); | 570 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); |
552 | 571 | ||
553 | iwl_release_nic_access(priv); | 572 | iwl_release_nic_access(priv); |
@@ -561,14 +580,13 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv, | |||
561 | { | 580 | { |
562 | int ret = 0; | 581 | int ret = 0; |
563 | 582 | ||
564 | ret = iwl5000_load_section( | 583 | ret = iwl5000_load_section(priv, inst_image, RTC_INST_LOWER_BOUND); |
565 | priv, inst_image, RTC_INST_LOWER_BOUND); | ||
566 | if (ret) | 584 | if (ret) |
567 | return ret; | 585 | return ret; |
568 | 586 | ||
569 | IWL_DEBUG_INFO("INST uCode section being loaded...\n"); | 587 | IWL_DEBUG_INFO("INST uCode section being loaded...\n"); |
570 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | 588 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, |
571 | priv->ucode_write_complete, 5 * HZ); | 589 | priv->ucode_write_complete, 5 * HZ); |
572 | if (ret == -ERESTARTSYS) { | 590 | if (ret == -ERESTARTSYS) { |
573 | IWL_ERROR("Could not load the INST uCode section due " | 591 | IWL_ERROR("Could not load the INST uCode section due " |
574 | "to interrupt\n"); | 592 | "to interrupt\n"); |
@@ -682,7 +700,7 @@ static void iwl5000_tx_queue_set_status(struct iwl_priv *priv, | |||
682 | int tx_fifo_id, int scd_retry) | 700 | int tx_fifo_id, int scd_retry) |
683 | { | 701 | { |
684 | int txq_id = txq->q.id; | 702 | int txq_id = txq->q.id; |
685 | int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; | 703 | int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; |
686 | 704 | ||
687 | iwl_write_prph(priv, IWL50_SCD_QUEUE_STATUS_BITS(txq_id), | 705 | iwl_write_prph(priv, IWL50_SCD_QUEUE_STATUS_BITS(txq_id), |
688 | (active << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE) | | 706 | (active << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE) | |
@@ -710,9 +728,10 @@ static int iwl5000_send_wimax_coex(struct iwl_priv *priv) | |||
710 | static int iwl5000_alive_notify(struct iwl_priv *priv) | 728 | static int iwl5000_alive_notify(struct iwl_priv *priv) |
711 | { | 729 | { |
712 | u32 a; | 730 | u32 a; |
713 | int i = 0; | ||
714 | unsigned long flags; | 731 | unsigned long flags; |
715 | int ret; | 732 | int ret; |
733 | int i, chan; | ||
734 | u32 reg_val; | ||
716 | 735 | ||
717 | spin_lock_irqsave(&priv->lock, flags); | 736 | spin_lock_irqsave(&priv->lock, flags); |
718 | 737 | ||
@@ -734,11 +753,21 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) | |||
734 | iwl_write_targ_mem(priv, a, 0); | 753 | iwl_write_targ_mem(priv, a, 0); |
735 | 754 | ||
736 | iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR, | 755 | iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR, |
737 | (priv->shared_phys + | 756 | priv->scd_bc_tbls.dma >> 10); |
738 | offsetof(struct iwl5000_shared, queues_byte_cnt_tbls)) >> 10); | 757 | |
758 | /* Enable DMA channel */ | ||
759 | for (chan = 0; chan < FH50_TCSR_CHNL_NUM ; chan++) | ||
760 | iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan), | ||
761 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | ||
762 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); | ||
763 | |||
764 | /* Update FH chicken bits */ | ||
765 | reg_val = iwl_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); | ||
766 | iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, | ||
767 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); | ||
768 | |||
739 | iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL, | 769 | iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL, |
740 | IWL50_SCD_QUEUECHAIN_SEL_ALL( | 770 | IWL50_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num)); |
741 | priv->hw_params.max_txq_num)); | ||
742 | iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0); | 771 | iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0); |
743 | 772 | ||
744 | /* initiate the queues */ | 773 | /* initiate the queues */ |
@@ -765,6 +794,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) | |||
765 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); | 794 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); |
766 | 795 | ||
767 | iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); | 796 | iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); |
797 | |||
768 | /* map qos queues to fifos one-to-one */ | 798 | /* map qos queues to fifos one-to-one */ |
769 | for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) { | 799 | for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) { |
770 | int ac = iwl5000_default_queue_to_tx_fifo[i]; | 800 | int ac = iwl5000_default_queue_to_tx_fifo[i]; |
@@ -784,10 +814,8 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) | |||
784 | 814 | ||
785 | iwl5000_send_wimax_coex(priv); | 815 | iwl5000_send_wimax_coex(priv); |
786 | 816 | ||
787 | iwl5000_send_Xtal_calib(priv); | 817 | iwl5000_set_Xtal_calib(priv); |
788 | 818 | iwl_send_calib_results(priv); | |
789 | if (priv->ucode_type == UCODE_RT) | ||
790 | iwl_send_calib_results(priv); | ||
791 | 819 | ||
792 | return 0; | 820 | return 0; |
793 | } | 821 | } |
@@ -802,7 +830,9 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
802 | } | 830 | } |
803 | 831 | ||
804 | priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues; | 832 | priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues; |
805 | priv->hw_params.first_ampdu_q = IWL50_FIRST_AMPDU_QUEUE; | 833 | priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; |
834 | priv->hw_params.scd_bc_tbls_size = | ||
835 | IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl); | ||
806 | priv->hw_params.max_stations = IWL5000_STATION_COUNT; | 836 | priv->hw_params.max_stations = IWL5000_STATION_COUNT; |
807 | priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; | 837 | priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; |
808 | priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE; | 838 | priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE; |
@@ -814,10 +844,14 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
814 | 844 | ||
815 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { | 845 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { |
816 | case CSR_HW_REV_TYPE_5100: | 846 | case CSR_HW_REV_TYPE_5100: |
847 | priv->hw_params.tx_chains_num = 1; | ||
848 | priv->hw_params.rx_chains_num = 2; | ||
849 | priv->hw_params.valid_tx_ant = ANT_B; | ||
850 | priv->hw_params.valid_rx_ant = ANT_AB; | ||
851 | break; | ||
817 | case CSR_HW_REV_TYPE_5150: | 852 | case CSR_HW_REV_TYPE_5150: |
818 | priv->hw_params.tx_chains_num = 1; | 853 | priv->hw_params.tx_chains_num = 1; |
819 | priv->hw_params.rx_chains_num = 2; | 854 | priv->hw_params.rx_chains_num = 2; |
820 | /* FIXME: move to ANT_A, ANT_B, ANT_C enum */ | ||
821 | priv->hw_params.valid_tx_ant = ANT_A; | 855 | priv->hw_params.valid_tx_ant = ANT_A; |
822 | priv->hw_params.valid_rx_ant = ANT_AB; | 856 | priv->hw_params.valid_rx_ant = ANT_AB; |
823 | break; | 857 | break; |
@@ -840,43 +874,36 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
840 | case CSR_HW_REV_TYPE_5150: | 874 | case CSR_HW_REV_TYPE_5150: |
841 | /* 5150 wants in Kelvin */ | 875 | /* 5150 wants in Kelvin */ |
842 | priv->hw_params.ct_kill_threshold = | 876 | priv->hw_params.ct_kill_threshold = |
843 | CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD); | 877 | iwl5150_get_ct_threshold(priv); |
844 | break; | 878 | break; |
845 | } | 879 | } |
846 | 880 | ||
847 | return 0; | 881 | /* Set initial calibration set */ |
848 | } | 882 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { |
849 | 883 | case CSR_HW_REV_TYPE_5100: | |
850 | static int iwl5000_alloc_shared_mem(struct iwl_priv *priv) | 884 | case CSR_HW_REV_TYPE_5300: |
851 | { | 885 | case CSR_HW_REV_TYPE_5350: |
852 | priv->shared_virt = pci_alloc_consistent(priv->pci_dev, | 886 | priv->hw_params.calib_init_cfg = |
853 | sizeof(struct iwl5000_shared), | 887 | BIT(IWL_CALIB_XTAL) | |
854 | &priv->shared_phys); | 888 | BIT(IWL_CALIB_LO) | |
855 | if (!priv->shared_virt) | 889 | BIT(IWL_CALIB_TX_IQ) | |
856 | return -ENOMEM; | 890 | BIT(IWL_CALIB_TX_IQ_PERD) | |
891 | BIT(IWL_CALIB_BASE_BAND); | ||
892 | break; | ||
893 | case CSR_HW_REV_TYPE_5150: | ||
894 | priv->hw_params.calib_init_cfg = | ||
895 | BIT(IWL_CALIB_DC) | | ||
896 | BIT(IWL_CALIB_LO) | | ||
897 | BIT(IWL_CALIB_TX_IQ) | | ||
898 | BIT(IWL_CALIB_BASE_BAND); | ||
857 | 899 | ||
858 | memset(priv->shared_virt, 0, sizeof(struct iwl5000_shared)); | 900 | break; |
901 | } | ||
859 | 902 | ||
860 | priv->rb_closed_offset = offsetof(struct iwl5000_shared, rb_closed); | ||
861 | 903 | ||
862 | return 0; | 904 | return 0; |
863 | } | 905 | } |
864 | 906 | ||
865 | static void iwl5000_free_shared_mem(struct iwl_priv *priv) | ||
866 | { | ||
867 | if (priv->shared_virt) | ||
868 | pci_free_consistent(priv->pci_dev, | ||
869 | sizeof(struct iwl5000_shared), | ||
870 | priv->shared_virt, | ||
871 | priv->shared_phys); | ||
872 | } | ||
873 | |||
874 | static int iwl5000_shared_mem_rx_idx(struct iwl_priv *priv) | ||
875 | { | ||
876 | struct iwl5000_shared *s = priv->shared_virt; | ||
877 | return le32_to_cpu(s->rb_closed) & 0xFFF; | ||
878 | } | ||
879 | |||
880 | /** | 907 | /** |
881 | * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array | 908 | * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array |
882 | */ | 909 | */ |
@@ -884,16 +911,18 @@ static void iwl5000_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
884 | struct iwl_tx_queue *txq, | 911 | struct iwl_tx_queue *txq, |
885 | u16 byte_cnt) | 912 | u16 byte_cnt) |
886 | { | 913 | { |
887 | struct iwl5000_shared *shared_data = priv->shared_virt; | 914 | struct iwl5000_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; |
915 | int write_ptr = txq->q.write_ptr; | ||
888 | int txq_id = txq->q.id; | 916 | int txq_id = txq->q.id; |
889 | u8 sec_ctl = 0; | 917 | u8 sec_ctl = 0; |
890 | u8 sta = 0; | 918 | u8 sta_id = 0; |
891 | int len; | 919 | u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; |
920 | __le16 bc_ent; | ||
892 | 921 | ||
893 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 922 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); |
894 | 923 | ||
895 | if (txq_id != IWL_CMD_QUEUE_NUM) { | 924 | if (txq_id != IWL_CMD_QUEUE_NUM) { |
896 | sta = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; | 925 | sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; |
897 | sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; | 926 | sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; |
898 | 927 | ||
899 | switch (sec_ctl & TX_CMD_SEC_MSK) { | 928 | switch (sec_ctl & TX_CMD_SEC_MSK) { |
@@ -909,40 +938,35 @@ static void iwl5000_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
909 | } | 938 | } |
910 | } | 939 | } |
911 | 940 | ||
912 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 941 | bc_ent = cpu_to_le16((len & 0xFFF) | (sta_id << 12)); |
913 | tfd_offset[txq->q.write_ptr], byte_cnt, len); | ||
914 | 942 | ||
915 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 943 | scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent; |
916 | tfd_offset[txq->q.write_ptr], sta_id, sta); | ||
917 | 944 | ||
918 | if (txq->q.write_ptr < IWL50_MAX_WIN_SIZE) { | 945 | if (txq->q.write_ptr < TFD_QUEUE_SIZE_BC_DUP) |
919 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 946 | scd_bc_tbl[txq_id]. |
920 | tfd_offset[IWL50_QUEUE_SIZE + txq->q.write_ptr], | 947 | tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent; |
921 | byte_cnt, len); | ||
922 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | ||
923 | tfd_offset[IWL50_QUEUE_SIZE + txq->q.write_ptr], | ||
924 | sta_id, sta); | ||
925 | } | ||
926 | } | 948 | } |
927 | 949 | ||
928 | static void iwl5000_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, | 950 | static void iwl5000_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, |
929 | struct iwl_tx_queue *txq) | 951 | struct iwl_tx_queue *txq) |
930 | { | 952 | { |
953 | struct iwl5000_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; | ||
931 | int txq_id = txq->q.id; | 954 | int txq_id = txq->q.id; |
932 | struct iwl5000_shared *shared_data = priv->shared_virt; | 955 | int read_ptr = txq->q.read_ptr; |
933 | u8 sta = 0; | 956 | u8 sta_id = 0; |
957 | __le16 bc_ent; | ||
958 | |||
959 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); | ||
934 | 960 | ||
935 | if (txq_id != IWL_CMD_QUEUE_NUM) | 961 | if (txq_id != IWL_CMD_QUEUE_NUM) |
936 | sta = txq->cmd[txq->q.read_ptr]->cmd.tx.sta_id; | 962 | sta_id = txq->cmd[read_ptr]->cmd.tx.sta_id; |
937 | 963 | ||
938 | shared_data->queues_byte_cnt_tbls[txq_id].tfd_offset[txq->q.read_ptr]. | 964 | bc_ent = cpu_to_le16(1 | (sta_id << 12)); |
939 | val = cpu_to_le16(1 | (sta << 12)); | 965 | scd_bc_tbl[txq_id].tfd_offset[read_ptr] = bc_ent; |
940 | 966 | ||
941 | if (txq->q.write_ptr < IWL50_MAX_WIN_SIZE) { | 967 | if (txq->q.write_ptr < TFD_QUEUE_SIZE_BC_DUP) |
942 | shared_data->queues_byte_cnt_tbls[txq_id]. | 968 | scd_bc_tbl[txq_id]. |
943 | tfd_offset[IWL50_QUEUE_SIZE + txq->q.read_ptr]. | 969 | tfd_offset[TFD_QUEUE_SIZE_MAX + read_ptr] = bc_ent; |
944 | val = cpu_to_le16(1 | (sta << 12)); | ||
945 | } | ||
946 | } | 970 | } |
947 | 971 | ||
948 | static int iwl5000_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, | 972 | static int iwl5000_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, |
@@ -996,7 +1020,7 @@ static int iwl5000_txq_agg_enable(struct iwl_priv *priv, int txq_id, | |||
996 | ra_tid = BUILD_RAxTID(sta_id, tid); | 1020 | ra_tid = BUILD_RAxTID(sta_id, tid); |
997 | 1021 | ||
998 | /* Modify device's station table to Tx this TID */ | 1022 | /* Modify device's station table to Tx this TID */ |
999 | iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); | 1023 | iwl_sta_tx_modify_enable_tid(priv, sta_id, tid); |
1000 | 1024 | ||
1001 | spin_lock_irqsave(&priv->lock, flags); | 1025 | spin_lock_irqsave(&priv->lock, flags); |
1002 | ret = iwl_grab_nic_access(priv); | 1026 | ret = iwl_grab_nic_access(priv); |
@@ -1089,7 +1113,7 @@ static u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) | |||
1089 | 1113 | ||
1090 | 1114 | ||
1091 | /* | 1115 | /* |
1092 | * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask | 1116 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask |
1093 | * must be called under priv->lock and mac access | 1117 | * must be called under priv->lock and mac access |
1094 | */ | 1118 | */ |
1095 | static void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask) | 1119 | static void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask) |
@@ -1136,10 +1160,10 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv, | |||
1136 | agg->frame_count, agg->start_idx, idx); | 1160 | agg->frame_count, agg->start_idx, idx); |
1137 | 1161 | ||
1138 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); | 1162 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); |
1139 | info->status.retry_count = tx_resp->failure_frame; | 1163 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
1140 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | 1164 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; |
1141 | info->flags |= iwl_is_tx_success(status)? | 1165 | info->flags |= iwl_is_tx_success(status) ? |
1142 | IEEE80211_TX_STAT_ACK : 0; | 1166 | IEEE80211_TX_STAT_ACK : 0; |
1143 | iwl_hwrate_to_tx_control(priv, rate_n_flags, info); | 1167 | iwl_hwrate_to_tx_control(priv, rate_n_flags, info); |
1144 | 1168 | ||
1145 | /* FIXME: code repetition end */ | 1169 | /* FIXME: code repetition end */ |
@@ -1225,9 +1249,9 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv, | |||
1225 | struct ieee80211_tx_info *info; | 1249 | struct ieee80211_tx_info *info; |
1226 | struct iwl5000_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 1250 | struct iwl5000_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; |
1227 | u32 status = le16_to_cpu(tx_resp->status.status); | 1251 | u32 status = le16_to_cpu(tx_resp->status.status); |
1228 | int tid = MAX_TID_COUNT, sta_id = IWL_INVALID_STATION; | 1252 | int tid; |
1229 | struct ieee80211_hdr *hdr; | 1253 | int sta_id; |
1230 | u8 *qc = NULL; | 1254 | int freed; |
1231 | 1255 | ||
1232 | if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { | 1256 | if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { |
1233 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " | 1257 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " |
@@ -1240,25 +1264,13 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv, | |||
1240 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); | 1264 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); |
1241 | memset(&info->status, 0, sizeof(info->status)); | 1265 | memset(&info->status, 0, sizeof(info->status)); |
1242 | 1266 | ||
1243 | hdr = iwl_tx_queue_get_hdr(priv, txq_id, index); | 1267 | tid = (tx_resp->ra_tid & IWL50_TX_RES_TID_MSK) >> IWL50_TX_RES_TID_POS; |
1244 | if (ieee80211_is_data_qos(hdr->frame_control)) { | 1268 | sta_id = (tx_resp->ra_tid & IWL50_TX_RES_RA_MSK) >> IWL50_TX_RES_RA_POS; |
1245 | qc = ieee80211_get_qos_ctl(hdr); | ||
1246 | tid = qc[0] & 0xf; | ||
1247 | } | ||
1248 | |||
1249 | sta_id = iwl_get_ra_sta_id(priv, hdr); | ||
1250 | if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { | ||
1251 | IWL_ERROR("Station not known\n"); | ||
1252 | return; | ||
1253 | } | ||
1254 | 1269 | ||
1255 | if (txq->sched_retry) { | 1270 | if (txq->sched_retry) { |
1256 | const u32 scd_ssn = iwl5000_get_scd_ssn(tx_resp); | 1271 | const u32 scd_ssn = iwl5000_get_scd_ssn(tx_resp); |
1257 | struct iwl_ht_agg *agg = NULL; | 1272 | struct iwl_ht_agg *agg = NULL; |
1258 | 1273 | ||
1259 | if (!qc) | ||
1260 | return; | ||
1261 | |||
1262 | agg = &priv->stations[sta_id].tid[tid].agg; | 1274 | agg = &priv->stations[sta_id].tid[tid].agg; |
1263 | 1275 | ||
1264 | iwl5000_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); | 1276 | iwl5000_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); |
@@ -1268,58 +1280,58 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv, | |||
1268 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | 1280 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; |
1269 | 1281 | ||
1270 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { | 1282 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { |
1271 | int freed, ampdu_q; | ||
1272 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); | 1283 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); |
1273 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " | 1284 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim " |
1274 | "%d index %d\n", scd_ssn , index); | 1285 | "scd_ssn=%d idx=%d txq=%d swq=%d\n", |
1286 | scd_ssn , index, txq_id, txq->swq_id); | ||
1287 | |||
1275 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); | 1288 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
1276 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 1289 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
1277 | 1290 | ||
1278 | if (iwl_queue_space(&txq->q) > txq->q.low_mark && | 1291 | if (priv->mac80211_registered && |
1279 | txq_id >= 0 && priv->mac80211_registered && | 1292 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && |
1280 | agg->state != IWL_EMPTYING_HW_QUEUE_DELBA) { | 1293 | (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) { |
1281 | /* calculate mac80211 ampdu sw queue to wake */ | ||
1282 | ampdu_q = txq_id - IWL50_FIRST_AMPDU_QUEUE + | ||
1283 | priv->hw->queues; | ||
1284 | if (agg->state == IWL_AGG_OFF) | 1294 | if (agg->state == IWL_AGG_OFF) |
1285 | ieee80211_wake_queue(priv->hw, txq_id); | 1295 | ieee80211_wake_queue(priv->hw, txq_id); |
1286 | else | 1296 | else |
1287 | ieee80211_wake_queue(priv->hw, ampdu_q); | 1297 | ieee80211_wake_queue(priv->hw, |
1298 | txq->swq_id); | ||
1288 | } | 1299 | } |
1289 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
1290 | } | 1300 | } |
1291 | } else { | 1301 | } else { |
1292 | info->status.retry_count = tx_resp->failure_frame; | 1302 | BUG_ON(txq_id != txq->swq_id); |
1293 | info->flags = | 1303 | |
1294 | iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; | 1304 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
1305 | info->flags |= iwl_is_tx_success(status) ? | ||
1306 | IEEE80211_TX_STAT_ACK : 0; | ||
1295 | iwl_hwrate_to_tx_control(priv, | 1307 | iwl_hwrate_to_tx_control(priv, |
1296 | le32_to_cpu(tx_resp->rate_n_flags), | 1308 | le32_to_cpu(tx_resp->rate_n_flags), |
1297 | info); | 1309 | info); |
1298 | 1310 | ||
1299 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags " | 1311 | IWL_DEBUG_TX_REPLY("TXQ %d status %s (0x%08x) rate_n_flags " |
1300 | "0x%x retries %d\n", txq_id, | 1312 | "0x%x retries %d\n", |
1301 | iwl_get_tx_fail_reason(status), | 1313 | txq_id, |
1302 | status, le32_to_cpu(tx_resp->rate_n_flags), | 1314 | iwl_get_tx_fail_reason(status), status, |
1303 | tx_resp->failure_frame); | 1315 | le32_to_cpu(tx_resp->rate_n_flags), |
1316 | tx_resp->failure_frame); | ||
1304 | 1317 | ||
1305 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); | 1318 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
1306 | if (index != -1) { | 1319 | if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) |
1307 | int freed = iwl_tx_queue_reclaim(priv, txq_id, index); | ||
1308 | if (tid != MAX_TID_COUNT) | ||
1309 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 1320 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
1310 | if (iwl_queue_space(&txq->q) > txq->q.low_mark && | 1321 | |
1311 | (txq_id >= 0) && priv->mac80211_registered) | 1322 | if (priv->mac80211_registered && |
1323 | (iwl_queue_space(&txq->q) > txq->q.low_mark)) | ||
1312 | ieee80211_wake_queue(priv->hw, txq_id); | 1324 | ieee80211_wake_queue(priv->hw, txq_id); |
1313 | if (tid != MAX_TID_COUNT) | ||
1314 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
1315 | } | ||
1316 | } | 1325 | } |
1317 | 1326 | ||
1327 | if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) | ||
1328 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
1329 | |||
1318 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) | 1330 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) |
1319 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); | 1331 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); |
1320 | } | 1332 | } |
1321 | 1333 | ||
1322 | /* Currently 5000 is the supperset of everything */ | 1334 | /* Currently 5000 is the superset of everything */ |
1323 | static u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len) | 1335 | static u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len) |
1324 | { | 1336 | { |
1325 | return len; | 1337 | return len; |
@@ -1466,9 +1478,6 @@ static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { | |||
1466 | 1478 | ||
1467 | static struct iwl_lib_ops iwl5000_lib = { | 1479 | static struct iwl_lib_ops iwl5000_lib = { |
1468 | .set_hw_params = iwl5000_hw_set_hw_params, | 1480 | .set_hw_params = iwl5000_hw_set_hw_params, |
1469 | .alloc_shared_mem = iwl5000_alloc_shared_mem, | ||
1470 | .free_shared_mem = iwl5000_free_shared_mem, | ||
1471 | .shared_mem_rx_idx = iwl5000_shared_mem_rx_idx, | ||
1472 | .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, | 1481 | .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, |
1473 | .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl, | 1482 | .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl, |
1474 | .txq_set_sched = iwl5000_txq_set_sched, | 1483 | .txq_set_sched = iwl5000_txq_set_sched, |
@@ -1482,13 +1491,13 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
1482 | .alive_notify = iwl5000_alive_notify, | 1491 | .alive_notify = iwl5000_alive_notify, |
1483 | .send_tx_power = iwl5000_send_tx_power, | 1492 | .send_tx_power = iwl5000_send_tx_power, |
1484 | .temperature = iwl5000_temperature, | 1493 | .temperature = iwl5000_temperature, |
1485 | .update_chain_flags = iwl4965_update_chain_flags, | 1494 | .update_chain_flags = iwl_update_chain_flags, |
1486 | .apm_ops = { | 1495 | .apm_ops = { |
1487 | .init = iwl5000_apm_init, | 1496 | .init = iwl5000_apm_init, |
1488 | .reset = iwl5000_apm_reset, | 1497 | .reset = iwl5000_apm_reset, |
1489 | .stop = iwl5000_apm_stop, | 1498 | .stop = iwl5000_apm_stop, |
1490 | .config = iwl5000_nic_config, | 1499 | .config = iwl5000_nic_config, |
1491 | .set_pwr_src = iwl4965_set_pwr_src, | 1500 | .set_pwr_src = iwl_set_pwr_src, |
1492 | }, | 1501 | }, |
1493 | .eeprom_ops = { | 1502 | .eeprom_ops = { |
1494 | .regulatory_bands = { | 1503 | .regulatory_bands = { |
@@ -1503,7 +1512,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
1503 | .verify_signature = iwlcore_eeprom_verify_signature, | 1512 | .verify_signature = iwlcore_eeprom_verify_signature, |
1504 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | 1513 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, |
1505 | .release_semaphore = iwlcore_eeprom_release_semaphore, | 1514 | .release_semaphore = iwlcore_eeprom_release_semaphore, |
1506 | .check_version = iwl5000_eeprom_check_version, | 1515 | .calib_version = iwl5000_eeprom_calib_version, |
1507 | .query_addr = iwl5000_eeprom_query_addr, | 1516 | .query_addr = iwl5000_eeprom_query_addr, |
1508 | }, | 1517 | }, |
1509 | }; | 1518 | }; |
@@ -1517,7 +1526,6 @@ static struct iwl_ops iwl5000_ops = { | |||
1517 | static struct iwl_mod_params iwl50_mod_params = { | 1526 | static struct iwl_mod_params iwl50_mod_params = { |
1518 | .num_of_queues = IWL50_NUM_QUEUES, | 1527 | .num_of_queues = IWL50_NUM_QUEUES, |
1519 | .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES, | 1528 | .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES, |
1520 | .enable_qos = 1, | ||
1521 | .amsdu_size_8K = 1, | 1529 | .amsdu_size_8K = 1, |
1522 | .restart_fw = 1, | 1530 | .restart_fw = 1, |
1523 | /* the rest are 0 by default */ | 1531 | /* the rest are 0 by default */ |
@@ -1526,50 +1534,84 @@ static struct iwl_mod_params iwl50_mod_params = { | |||
1526 | 1534 | ||
1527 | struct iwl_cfg iwl5300_agn_cfg = { | 1535 | struct iwl_cfg iwl5300_agn_cfg = { |
1528 | .name = "5300AGN", | 1536 | .name = "5300AGN", |
1529 | .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode", | 1537 | .fw_name_pre = IWL5000_FW_PRE, |
1538 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1539 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1530 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 1540 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
1531 | .ops = &iwl5000_ops, | 1541 | .ops = &iwl5000_ops, |
1532 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | 1542 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, |
1543 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, | ||
1544 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | ||
1533 | .mod_params = &iwl50_mod_params, | 1545 | .mod_params = &iwl50_mod_params, |
1534 | }; | 1546 | }; |
1535 | 1547 | ||
1536 | struct iwl_cfg iwl5100_bg_cfg = { | 1548 | struct iwl_cfg iwl5100_bg_cfg = { |
1537 | .name = "5100BG", | 1549 | .name = "5100BG", |
1538 | .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode", | 1550 | .fw_name_pre = IWL5000_FW_PRE, |
1551 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1552 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1539 | .sku = IWL_SKU_G, | 1553 | .sku = IWL_SKU_G, |
1540 | .ops = &iwl5000_ops, | 1554 | .ops = &iwl5000_ops, |
1541 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | 1555 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, |
1556 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, | ||
1557 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | ||
1542 | .mod_params = &iwl50_mod_params, | 1558 | .mod_params = &iwl50_mod_params, |
1543 | }; | 1559 | }; |
1544 | 1560 | ||
1545 | struct iwl_cfg iwl5100_abg_cfg = { | 1561 | struct iwl_cfg iwl5100_abg_cfg = { |
1546 | .name = "5100ABG", | 1562 | .name = "5100ABG", |
1547 | .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode", | 1563 | .fw_name_pre = IWL5000_FW_PRE, |
1564 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1565 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1548 | .sku = IWL_SKU_A|IWL_SKU_G, | 1566 | .sku = IWL_SKU_A|IWL_SKU_G, |
1549 | .ops = &iwl5000_ops, | 1567 | .ops = &iwl5000_ops, |
1550 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | 1568 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, |
1569 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, | ||
1570 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | ||
1551 | .mod_params = &iwl50_mod_params, | 1571 | .mod_params = &iwl50_mod_params, |
1552 | }; | 1572 | }; |
1553 | 1573 | ||
1554 | struct iwl_cfg iwl5100_agn_cfg = { | 1574 | struct iwl_cfg iwl5100_agn_cfg = { |
1555 | .name = "5100AGN", | 1575 | .name = "5100AGN", |
1556 | .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode", | 1576 | .fw_name_pre = IWL5000_FW_PRE, |
1577 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1578 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1557 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 1579 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
1558 | .ops = &iwl5000_ops, | 1580 | .ops = &iwl5000_ops, |
1559 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | 1581 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, |
1582 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, | ||
1583 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | ||
1560 | .mod_params = &iwl50_mod_params, | 1584 | .mod_params = &iwl50_mod_params, |
1561 | }; | 1585 | }; |
1562 | 1586 | ||
1563 | struct iwl_cfg iwl5350_agn_cfg = { | 1587 | struct iwl_cfg iwl5350_agn_cfg = { |
1564 | .name = "5350AGN", | 1588 | .name = "5350AGN", |
1565 | .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode", | 1589 | .fw_name_pre = IWL5000_FW_PRE, |
1590 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1591 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1592 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | ||
1593 | .ops = &iwl5000_ops, | ||
1594 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | ||
1595 | .eeprom_ver = EEPROM_5050_EEPROM_VERSION, | ||
1596 | .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, | ||
1597 | .mod_params = &iwl50_mod_params, | ||
1598 | }; | ||
1599 | |||
1600 | struct iwl_cfg iwl5150_agn_cfg = { | ||
1601 | .name = "5150AGN", | ||
1602 | .fw_name_pre = IWL5150_FW_PRE, | ||
1603 | .ucode_api_max = IWL5150_UCODE_API_MAX, | ||
1604 | .ucode_api_min = IWL5150_UCODE_API_MIN, | ||
1566 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | 1605 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, |
1567 | .ops = &iwl5000_ops, | 1606 | .ops = &iwl5000_ops, |
1568 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, | 1607 | .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, |
1608 | .eeprom_ver = EEPROM_5050_EEPROM_VERSION, | ||
1609 | .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, | ||
1569 | .mod_params = &iwl50_mod_params, | 1610 | .mod_params = &iwl50_mod_params, |
1570 | }; | 1611 | }; |
1571 | 1612 | ||
1572 | MODULE_FIRMWARE("iwlwifi-5000" IWL5000_UCODE_API ".ucode"); | 1613 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); |
1614 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | ||
1573 | 1615 | ||
1574 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); | 1616 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); |
1575 | MODULE_PARM_DESC(disable50, | 1617 | MODULE_PARM_DESC(disable50, |
@@ -1577,12 +1619,10 @@ MODULE_PARM_DESC(disable50, | |||
1577 | module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444); | 1619 | module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444); |
1578 | MODULE_PARM_DESC(swcrypto50, | 1620 | MODULE_PARM_DESC(swcrypto50, |
1579 | "using software crypto engine (default 0 [hardware])\n"); | 1621 | "using software crypto engine (default 0 [hardware])\n"); |
1580 | module_param_named(debug50, iwl50_mod_params.debug, int, 0444); | 1622 | module_param_named(debug50, iwl50_mod_params.debug, uint, 0444); |
1581 | MODULE_PARM_DESC(debug50, "50XX debug output mask"); | 1623 | MODULE_PARM_DESC(debug50, "50XX debug output mask"); |
1582 | module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444); | 1624 | module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444); |
1583 | MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series"); | 1625 | MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series"); |
1584 | module_param_named(qos_enable50, iwl50_mod_params.enable_qos, int, 0444); | ||
1585 | MODULE_PARM_DESC(qos_enable50, "enable all 50XX QoS functionality"); | ||
1586 | module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444); | 1626 | module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444); |
1587 | MODULE_PARM_DESC(11n_disable50, "disable 50XX 11n functionality"); | 1627 | MODULE_PARM_DESC(11n_disable50, "disable 50XX 11n functionality"); |
1588 | module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K, int, 0444); | 1628 | module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K, int, 0444); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c new file mode 100644 index 000000000000..b8137eeae1db --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * GPL LICENSE SUMMARY | ||
4 | * | ||
5 | * Copyright(c) 2008 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
19 | * USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <net/mac80211.h> | ||
31 | #include "iwl-dev.h" | ||
32 | #include "iwl-debug.h" | ||
33 | #include "iwl-commands.h" | ||
34 | |||
35 | |||
36 | /** | ||
37 | * iwl_check_rxon_cmd - validate RXON structure is valid | ||
38 | * | ||
39 | * NOTE: This is really only useful during development and can eventually | ||
40 | * be #ifdef'd out once the driver is stable and folks aren't actively | ||
41 | * making changes | ||
42 | */ | ||
43 | int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon) | ||
44 | { | ||
45 | int error = 0; | ||
46 | int counter = 1; | ||
47 | |||
48 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { | ||
49 | error |= le32_to_cpu(rxon->flags & | ||
50 | (RXON_FLG_TGJ_NARROW_BAND_MSK | | ||
51 | RXON_FLG_RADAR_DETECT_MSK)); | ||
52 | if (error) | ||
53 | IWL_WARNING("check 24G fields %d | %d\n", | ||
54 | counter++, error); | ||
55 | } else { | ||
56 | error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ? | ||
57 | 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK); | ||
58 | if (error) | ||
59 | IWL_WARNING("check 52 fields %d | %d\n", | ||
60 | counter++, error); | ||
61 | error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK); | ||
62 | if (error) | ||
63 | IWL_WARNING("check 52 CCK %d | %d\n", | ||
64 | counter++, error); | ||
65 | } | ||
66 | error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1; | ||
67 | if (error) | ||
68 | IWL_WARNING("check mac addr %d | %d\n", counter++, error); | ||
69 | |||
70 | /* make sure basic rates 6Mbps and 1Mbps are supported */ | ||
71 | error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) && | ||
72 | ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0)); | ||
73 | if (error) | ||
74 | IWL_WARNING("check basic rate %d | %d\n", counter++, error); | ||
75 | |||
76 | error |= (le16_to_cpu(rxon->assoc_id) > 2007); | ||
77 | if (error) | ||
78 | IWL_WARNING("check assoc id %d | %d\n", counter++, error); | ||
79 | |||
80 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) | ||
81 | == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)); | ||
82 | if (error) | ||
83 | IWL_WARNING("check CCK and short slot %d | %d\n", | ||
84 | counter++, error); | ||
85 | |||
86 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) | ||
87 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)); | ||
88 | if (error) | ||
89 | IWL_WARNING("check CCK & auto detect %d | %d\n", | ||
90 | counter++, error); | ||
91 | |||
92 | error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | | ||
93 | RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK); | ||
94 | if (error) | ||
95 | IWL_WARNING("check TGG and auto detect %d | %d\n", | ||
96 | counter++, error); | ||
97 | |||
98 | if (error) | ||
99 | IWL_WARNING("Tuning to channel %d\n", | ||
100 | le16_to_cpu(rxon->channel)); | ||
101 | |||
102 | if (error) { | ||
103 | IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n"); | ||
104 | return -1; | ||
105 | } | ||
106 | return 0; | ||
107 | } | ||
108 | |||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index e2a58e477036..f3f17929ca0b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -38,7 +38,6 @@ | |||
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-sta.h" | 39 | #include "iwl-sta.h" |
40 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
41 | #include "iwl-helpers.h" | ||
42 | 41 | ||
43 | #define RS_NAME "iwl-agn-rs" | 42 | #define RS_NAME "iwl-agn-rs" |
44 | 43 | ||
@@ -188,7 +187,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | |||
188 | * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits | 187 | * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits |
189 | * "G" is the only table that supports CCK (the first 4 rates). | 188 | * "G" is the only table that supports CCK (the first 4 rates). |
190 | */ | 189 | */ |
191 | /*FIXME:RS:need to spearate tables for MIMO2/MIMO3*/ | 190 | /*FIXME:RS:need to separate tables for MIMO2/MIMO3*/ |
192 | static s32 expected_tpt_A[IWL_RATE_COUNT] = { | 191 | static s32 expected_tpt_A[IWL_RATE_COUNT] = { |
193 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 | 192 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 |
194 | }; | 193 | }; |
@@ -281,10 +280,9 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, | |||
281 | u32 time_diff; | 280 | u32 time_diff; |
282 | s32 index; | 281 | s32 index; |
283 | struct iwl_traffic_load *tl = NULL; | 282 | struct iwl_traffic_load *tl = NULL; |
284 | __le16 fc = hdr->frame_control; | ||
285 | u8 tid; | 283 | u8 tid; |
286 | 284 | ||
287 | if (ieee80211_is_data_qos(fc)) { | 285 | if (ieee80211_is_data_qos(hdr->frame_control)) { |
288 | u8 *qc = ieee80211_get_qos_ctl(hdr); | 286 | u8 *qc = ieee80211_get_qos_ctl(hdr); |
289 | tid = qc[0] & 0xf; | 287 | tid = qc[0] & 0xf; |
290 | } else | 288 | } else |
@@ -357,11 +355,9 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
357 | struct iwl_lq_sta *lq_data, u8 tid, | 355 | struct iwl_lq_sta *lq_data, u8 tid, |
358 | struct ieee80211_sta *sta) | 356 | struct ieee80211_sta *sta) |
359 | { | 357 | { |
360 | DECLARE_MAC_BUF(mac); | ||
361 | |||
362 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { | 358 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { |
363 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", | 359 | IWL_DEBUG_HT("Starting Tx agg: STA: %pM tid: %d\n", |
364 | print_mac(mac, sta->addr), tid); | 360 | sta->addr, tid); |
365 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); | 361 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); |
366 | } | 362 | } |
367 | } | 363 | } |
@@ -775,7 +771,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
775 | int status; | 771 | int status; |
776 | u8 retries; | 772 | u8 retries; |
777 | int rs_index, index = 0; | 773 | int rs_index, index = 0; |
778 | struct iwl_lq_sta *lq_sta; | 774 | struct iwl_lq_sta *lq_sta = priv_sta; |
779 | struct iwl_link_quality_cmd *table; | 775 | struct iwl_link_quality_cmd *table; |
780 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 776 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
781 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 777 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
@@ -787,12 +783,12 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
787 | struct iwl_scale_tbl_info tbl_type; | 783 | struct iwl_scale_tbl_info tbl_type; |
788 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; | 784 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; |
789 | u8 active_index = 0; | 785 | u8 active_index = 0; |
790 | __le16 fc = hdr->frame_control; | ||
791 | s32 tpt = 0; | 786 | s32 tpt = 0; |
792 | 787 | ||
793 | IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n"); | 788 | IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n"); |
794 | 789 | ||
795 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) | 790 | if (!ieee80211_is_data(hdr->frame_control) || |
791 | is_multicast_ether_addr(hdr->addr1)) | ||
796 | return; | 792 | return; |
797 | 793 | ||
798 | /* This packet was aggregated but doesn't carry rate scale info */ | 794 | /* This packet was aggregated but doesn't carry rate scale info */ |
@@ -800,13 +796,11 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
800 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) | 796 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
801 | return; | 797 | return; |
802 | 798 | ||
803 | retries = info->status.retry_count; | 799 | retries = info->status.rates[0].count - 1; |
804 | 800 | ||
805 | if (retries > 15) | 801 | if (retries > 15) |
806 | retries = 15; | 802 | retries = 15; |
807 | 803 | ||
808 | lq_sta = (struct iwl_lq_sta *)priv_sta; | ||
809 | |||
810 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 804 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
811 | !lq_sta->ibss_sta_added) | 805 | !lq_sta->ibss_sta_added) |
812 | goto out; | 806 | goto out; |
@@ -832,21 +826,20 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
832 | if (priv->band == IEEE80211_BAND_5GHZ) | 826 | if (priv->band == IEEE80211_BAND_5GHZ) |
833 | rs_index -= IWL_FIRST_OFDM_RATE; | 827 | rs_index -= IWL_FIRST_OFDM_RATE; |
834 | 828 | ||
835 | if ((info->tx_rate_idx < 0) || | 829 | if ((info->status.rates[0].idx < 0) || |
836 | (tbl_type.is_SGI ^ | 830 | (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) || |
837 | !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) || | 831 | (tbl_type.is_fat != !!(info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) || |
838 | (tbl_type.is_fat ^ | 832 | (tbl_type.is_dup != !!(info->status.rates[0].flags & IEEE80211_TX_RC_DUP_DATA)) || |
839 | !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) || | 833 | (tbl_type.ant_type != info->antenna_sel_tx) || |
840 | (tbl_type.is_dup ^ | 834 | (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) || |
841 | !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) || | 835 | (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) || |
842 | (tbl_type.ant_type ^ info->antenna_sel_tx) || | ||
843 | (!!(tx_rate & RATE_MCS_HT_MSK) ^ | ||
844 | !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) || | ||
845 | (!!(tx_rate & RATE_MCS_GF_MSK) ^ | ||
846 | !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) || | ||
847 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != | 836 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != |
848 | hw->wiphy->bands[info->band]->bitrates[info->tx_rate_idx].bitrate)) { | 837 | hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) { |
849 | IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); | 838 | IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); |
839 | /* the last LQ command could failed so the LQ in ucode not | ||
840 | * the same in driver sync up | ||
841 | */ | ||
842 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | ||
850 | goto out; | 843 | goto out; |
851 | } | 844 | } |
852 | 845 | ||
@@ -1135,11 +1128,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1135 | s32 rate; | 1128 | s32 rate; |
1136 | s8 is_green = lq_sta->is_green; | 1129 | s8 is_green = lq_sta->is_green; |
1137 | 1130 | ||
1138 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1131 | if (!conf->ht.enabled || !sta->ht_cap.ht_supported) |
1139 | !sta->ht_info.ht_supported) | ||
1140 | return -1; | 1132 | return -1; |
1141 | 1133 | ||
1142 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) | 1134 | if (((sta->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> 2) |
1143 | == WLAN_HT_CAP_SM_PS_STATIC) | 1135 | == WLAN_HT_CAP_SM_PS_STATIC) |
1144 | return -1; | 1136 | return -1; |
1145 | 1137 | ||
@@ -1203,8 +1195,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1203 | u8 is_green = lq_sta->is_green; | 1195 | u8 is_green = lq_sta->is_green; |
1204 | s32 rate; | 1196 | s32 rate; |
1205 | 1197 | ||
1206 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1198 | if (!conf->ht.enabled || !sta->ht_cap.ht_supported) |
1207 | !sta->ht_info.ht_supported) | ||
1208 | return -1; | 1199 | return -1; |
1209 | 1200 | ||
1210 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); | 1201 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); |
@@ -1684,7 +1675,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1684 | int high_tpt = IWL_INVALID_VALUE; | 1675 | int high_tpt = IWL_INVALID_VALUE; |
1685 | u32 fail_count; | 1676 | u32 fail_count; |
1686 | s8 scale_action = 0; | 1677 | s8 scale_action = 0; |
1687 | __le16 fc; | ||
1688 | u16 rate_mask; | 1678 | u16 rate_mask; |
1689 | u8 update_lq = 0; | 1679 | u8 update_lq = 0; |
1690 | struct iwl_scale_tbl_info *tbl, *tbl1; | 1680 | struct iwl_scale_tbl_info *tbl, *tbl1; |
@@ -1699,13 +1689,12 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1699 | 1689 | ||
1700 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); | 1690 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); |
1701 | 1691 | ||
1702 | fc = hdr->frame_control; | 1692 | /* Send management frames and broadcast/multicast data using |
1703 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) { | 1693 | * lowest rate. */ |
1704 | /* Send management frames and broadcast/multicast data using | 1694 | /* TODO: this could probably be improved.. */ |
1705 | * lowest rate. */ | 1695 | if (!ieee80211_is_data(hdr->frame_control) || |
1706 | /* TODO: this could probably be improved.. */ | 1696 | is_multicast_ether_addr(hdr->addr1)) |
1707 | return; | 1697 | return; |
1708 | } | ||
1709 | 1698 | ||
1710 | if (!sta || !lq_sta) | 1699 | if (!sta || !lq_sta) |
1711 | return; | 1700 | return; |
@@ -2003,9 +1992,8 @@ lq_update: | |||
2003 | * stay with best antenna legacy modulation for a while | 1992 | * stay with best antenna legacy modulation for a while |
2004 | * before next round of mode comparisons. */ | 1993 | * before next round of mode comparisons. */ |
2005 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); | 1994 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); |
2006 | if (is_legacy(tbl1->lq_type) && | 1995 | if (is_legacy(tbl1->lq_type) && !conf->ht.enabled && |
2007 | (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) && | 1996 | lq_sta->action_counter >= 1) { |
2008 | (lq_sta->action_counter >= 1)) { | ||
2009 | lq_sta->action_counter = 0; | 1997 | lq_sta->action_counter = 0; |
2010 | IWL_DEBUG_RATE("LQ: STAY in legacy table\n"); | 1998 | IWL_DEBUG_RATE("LQ: STAY in legacy table\n"); |
2011 | rs_set_stay_in_table(priv, 1, lq_sta); | 1999 | rs_set_stay_in_table(priv, 1, lq_sta); |
@@ -2081,15 +2069,13 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2081 | if ((i < 0) || (i >= IWL_RATE_COUNT)) | 2069 | if ((i < 0) || (i >= IWL_RATE_COUNT)) |
2082 | i = 0; | 2070 | i = 0; |
2083 | 2071 | ||
2084 | /* FIXME:RS: This is also wrong in 4965 */ | ||
2085 | rate = iwl_rates[i].plcp; | 2072 | rate = iwl_rates[i].plcp; |
2086 | rate |= RATE_MCS_ANT_B_MSK; | 2073 | tbl->ant_type = first_antenna(valid_tx_ant); |
2087 | rate &= ~RATE_MCS_ANT_A_MSK; | 2074 | rate |= tbl->ant_type << RATE_MCS_ANT_POS; |
2088 | 2075 | ||
2089 | if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) | 2076 | if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) |
2090 | rate |= RATE_MCS_CCK_MSK; | 2077 | rate |= RATE_MCS_CCK_MSK; |
2091 | 2078 | ||
2092 | tbl->ant_type = ANT_B; | ||
2093 | rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); | 2079 | rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); |
2094 | if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) | 2080 | if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) |
2095 | rs_toggle_antenna(valid_tx_ant, &rate, tbl); | 2081 | rs_toggle_antenna(valid_tx_ant, &rate, tbl); |
@@ -2103,40 +2089,38 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2103 | return; | 2089 | return; |
2104 | } | 2090 | } |
2105 | 2091 | ||
2106 | static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | 2092 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, |
2107 | struct ieee80211_sta *sta, void *priv_sta, | 2093 | struct ieee80211_tx_rate_control *txrc) |
2108 | struct sk_buff *skb, struct rate_selection *sel) | ||
2109 | { | 2094 | { |
2110 | 2095 | ||
2111 | int i; | 2096 | struct sk_buff *skb = txrc->skb; |
2097 | struct ieee80211_supported_band *sband = txrc->sband; | ||
2112 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 2098 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
2113 | struct ieee80211_conf *conf = &priv->hw->conf; | 2099 | struct ieee80211_conf *conf = &priv->hw->conf; |
2114 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 2100 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
2115 | __le16 fc; | 2101 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2116 | struct iwl_lq_sta *lq_sta; | 2102 | struct iwl_lq_sta *lq_sta = priv_sta; |
2103 | int rate_idx; | ||
2117 | 2104 | ||
2118 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 2105 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
2119 | 2106 | ||
2120 | /* Send management frames and broadcast/multicast data using lowest | 2107 | /* Send management frames and broadcast/multicast data using lowest |
2121 | * rate. */ | 2108 | * rate. */ |
2122 | fc = hdr->frame_control; | 2109 | if (!ieee80211_is_data(hdr->frame_control) || |
2123 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || | 2110 | is_multicast_ether_addr(hdr->addr1) || !sta || !lq_sta) { |
2124 | !sta || !priv_sta) { | 2111 | info->control.rates[0].idx = rate_lowest_index(sband, sta); |
2125 | sel->rate_idx = rate_lowest_index(sband, sta); | ||
2126 | return; | 2112 | return; |
2127 | } | 2113 | } |
2128 | 2114 | ||
2129 | lq_sta = (struct iwl_lq_sta *)priv_sta; | 2115 | rate_idx = lq_sta->last_txrate_idx; |
2130 | i = lq_sta->last_txrate_idx; | ||
2131 | 2116 | ||
2132 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 2117 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2133 | !lq_sta->ibss_sta_added) { | 2118 | !lq_sta->ibss_sta_added) { |
2134 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 2119 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
2135 | DECLARE_MAC_BUF(mac); | ||
2136 | 2120 | ||
2137 | if (sta_id == IWL_INVALID_STATION) { | 2121 | if (sta_id == IWL_INVALID_STATION) { |
2138 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2122 | IWL_DEBUG_RATE("LQ: ADD station %pM\n", |
2139 | print_mac(mac, hdr->addr1)); | 2123 | hdr->addr1); |
2140 | sta_id = iwl_add_station_flags(priv, hdr->addr1, | 2124 | sta_id = iwl_add_station_flags(priv, hdr->addr1, |
2141 | 0, CMD_ASYNC, NULL); | 2125 | 0, CMD_ASYNC, NULL); |
2142 | } | 2126 | } |
@@ -2148,14 +2132,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, | |||
2148 | } | 2132 | } |
2149 | } | 2133 | } |
2150 | 2134 | ||
2151 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | 2135 | if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT) |
2152 | sel->rate_idx = rate_lowest_index(sband, sta); | 2136 | rate_idx = rate_lowest_index(sband, sta); |
2153 | return; | 2137 | else if (sband->band == IEEE80211_BAND_5GHZ) |
2154 | } | 2138 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2155 | 2139 | ||
2156 | if (sband->band == IEEE80211_BAND_5GHZ) | 2140 | info->control.rates[0].idx = rate_idx; |
2157 | i -= IWL_FIRST_OFDM_RATE; | ||
2158 | sel->rate_idx = i; | ||
2159 | } | 2141 | } |
2160 | 2142 | ||
2161 | static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, | 2143 | static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, |
@@ -2189,6 +2171,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2189 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 2171 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
2190 | struct ieee80211_conf *conf = &priv->hw->conf; | 2172 | struct ieee80211_conf *conf = &priv->hw->conf; |
2191 | struct iwl_lq_sta *lq_sta = priv_sta; | 2173 | struct iwl_lq_sta *lq_sta = priv_sta; |
2174 | u16 mask_bit = 0; | ||
2192 | 2175 | ||
2193 | lq_sta->flush_timer = 0; | 2176 | lq_sta->flush_timer = 0; |
2194 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2177 | lq_sta->supp_rates = sta->supp_rates[sband->band]; |
@@ -2205,15 +2188,12 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2205 | lq_sta->ibss_sta_added = 0; | 2188 | lq_sta->ibss_sta_added = 0; |
2206 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 2189 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2207 | u8 sta_id = iwl_find_station(priv, sta->addr); | 2190 | u8 sta_id = iwl_find_station(priv, sta->addr); |
2208 | DECLARE_MAC_BUF(mac); | ||
2209 | 2191 | ||
2210 | /* for IBSS the call are from tasklet */ | 2192 | /* for IBSS the call are from tasklet */ |
2211 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2193 | IWL_DEBUG_RATE("LQ: ADD station %pM\n", sta->addr); |
2212 | print_mac(mac, sta->addr)); | ||
2213 | 2194 | ||
2214 | if (sta_id == IWL_INVALID_STATION) { | 2195 | if (sta_id == IWL_INVALID_STATION) { |
2215 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2196 | IWL_DEBUG_RATE("LQ: ADD station %pM\n", sta->addr); |
2216 | print_mac(mac, sta->addr)); | ||
2217 | sta_id = iwl_add_station_flags(priv, sta->addr, | 2197 | sta_id = iwl_add_station_flags(priv, sta->addr, |
2218 | 0, CMD_ASYNC, NULL); | 2198 | 0, CMD_ASYNC, NULL); |
2219 | } | 2199 | } |
@@ -2225,16 +2205,6 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2225 | priv->assoc_station_added = 1; | 2205 | priv->assoc_station_added = 1; |
2226 | } | 2206 | } |
2227 | 2207 | ||
2228 | /* Find highest tx rate supported by hardware and destination station */ | ||
2229 | lq_sta->last_txrate_idx = 3; | ||
2230 | for (i = 0; i < sband->n_bitrates; i++) | ||
2231 | if (sta->supp_rates[sband->band] & BIT(i)) | ||
2232 | lq_sta->last_txrate_idx = i; | ||
2233 | |||
2234 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ | ||
2235 | if (sband->band == IEEE80211_BAND_5GHZ) | ||
2236 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | ||
2237 | |||
2238 | lq_sta->is_dup = 0; | 2208 | lq_sta->is_dup = 0; |
2239 | lq_sta->is_green = rs_use_green(priv, conf); | 2209 | lq_sta->is_green = rs_use_green(priv, conf); |
2240 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); | 2210 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); |
@@ -2244,19 +2214,19 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2244 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), | 2214 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), |
2245 | * supp_rates[] does not; shift to convert format, force 9 MBits off. | 2215 | * supp_rates[] does not; shift to convert format, force 9 MBits off. |
2246 | */ | 2216 | */ |
2247 | lq_sta->active_siso_rate = conf->ht_conf.supp_mcs_set[0] << 1; | 2217 | lq_sta->active_siso_rate = sta->ht_cap.mcs.rx_mask[0] << 1; |
2248 | lq_sta->active_siso_rate |= conf->ht_conf.supp_mcs_set[0] & 0x1; | 2218 | lq_sta->active_siso_rate |= sta->ht_cap.mcs.rx_mask[0] & 0x1; |
2249 | lq_sta->active_siso_rate &= ~((u16)0x2); | 2219 | lq_sta->active_siso_rate &= ~((u16)0x2); |
2250 | lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; | 2220 | lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; |
2251 | 2221 | ||
2252 | /* Same here */ | 2222 | /* Same here */ |
2253 | lq_sta->active_mimo2_rate = conf->ht_conf.supp_mcs_set[1] << 1; | 2223 | lq_sta->active_mimo2_rate = sta->ht_cap.mcs.rx_mask[1] << 1; |
2254 | lq_sta->active_mimo2_rate |= conf->ht_conf.supp_mcs_set[1] & 0x1; | 2224 | lq_sta->active_mimo2_rate |= sta->ht_cap.mcs.rx_mask[1] & 0x1; |
2255 | lq_sta->active_mimo2_rate &= ~((u16)0x2); | 2225 | lq_sta->active_mimo2_rate &= ~((u16)0x2); |
2256 | lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; | 2226 | lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; |
2257 | 2227 | ||
2258 | lq_sta->active_mimo3_rate = conf->ht_conf.supp_mcs_set[2] << 1; | 2228 | lq_sta->active_mimo3_rate = sta->ht_cap.mcs.rx_mask[2] << 1; |
2259 | lq_sta->active_mimo3_rate |= conf->ht_conf.supp_mcs_set[2] & 0x1; | 2229 | lq_sta->active_mimo3_rate |= sta->ht_cap.mcs.rx_mask[2] & 0x1; |
2260 | lq_sta->active_mimo3_rate &= ~((u16)0x2); | 2230 | lq_sta->active_mimo3_rate &= ~((u16)0x2); |
2261 | lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; | 2231 | lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; |
2262 | 2232 | ||
@@ -2265,7 +2235,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2265 | lq_sta->active_mimo2_rate, | 2235 | lq_sta->active_mimo2_rate, |
2266 | lq_sta->active_mimo3_rate); | 2236 | lq_sta->active_mimo3_rate); |
2267 | 2237 | ||
2268 | /* These values will be overriden later */ | 2238 | /* These values will be overridden later */ |
2269 | lq_sta->lq.general_params.single_stream_ant_msk = ANT_A; | 2239 | lq_sta->lq.general_params.single_stream_ant_msk = ANT_A; |
2270 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; | 2240 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; |
2271 | 2241 | ||
@@ -2273,6 +2243,17 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2273 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; | 2243 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; |
2274 | lq_sta->drv = priv; | 2244 | lq_sta->drv = priv; |
2275 | 2245 | ||
2246 | /* Find highest tx rate supported by hardware and destination station */ | ||
2247 | mask_bit = sta->supp_rates[sband->band] & lq_sta->active_legacy_rate; | ||
2248 | lq_sta->last_txrate_idx = 3; | ||
2249 | for (i = 0; i < sband->n_bitrates; i++) | ||
2250 | if (mask_bit & BIT(i)) | ||
2251 | lq_sta->last_txrate_idx = i; | ||
2252 | |||
2253 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ | ||
2254 | if (sband->band == IEEE80211_BAND_5GHZ) | ||
2255 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | ||
2256 | |||
2276 | rs_initialize_lq(priv, conf, sta, lq_sta); | 2257 | rs_initialize_lq(priv, conf, sta, lq_sta); |
2277 | } | 2258 | } |
2278 | 2259 | ||
@@ -2405,19 +2386,6 @@ static void rs_free(void *priv_rate) | |||
2405 | return; | 2386 | return; |
2406 | } | 2387 | } |
2407 | 2388 | ||
2408 | static void rs_clear(void *priv_rate) | ||
2409 | { | ||
2410 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
2411 | struct iwl_priv *priv = (struct iwl_priv *) priv_rate; | ||
2412 | |||
2413 | IWL_DEBUG_RATE("enter\n"); | ||
2414 | |||
2415 | /* TODO - add rate scale state reset */ | ||
2416 | |||
2417 | IWL_DEBUG_RATE("leave\n"); | ||
2418 | #endif /* CONFIG_IWLWIFI_DEBUG */ | ||
2419 | } | ||
2420 | |||
2421 | static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, | 2389 | static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, |
2422 | void *priv_sta) | 2390 | void *priv_sta) |
2423 | { | 2391 | { |
@@ -2552,7 +2520,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
2552 | for (i = 0; i < LQ_SIZE; i++) { | 2520 | for (i = 0; i < LQ_SIZE; i++) { |
2553 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" | 2521 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" |
2554 | "rate=0x%X\n", | 2522 | "rate=0x%X\n", |
2555 | lq_sta->active_tbl == i?"*":"x", | 2523 | lq_sta->active_tbl == i ? "*" : "x", |
2556 | lq_sta->lq_info[i].lq_type, | 2524 | lq_sta->lq_info[i].lq_type, |
2557 | lq_sta->lq_info[i].is_SGI, | 2525 | lq_sta->lq_info[i].is_SGI, |
2558 | lq_sta->lq_info[i].is_fat, | 2526 | lq_sta->lq_info[i].is_fat, |
@@ -2605,7 +2573,6 @@ static struct rate_control_ops rs_ops = { | |||
2605 | .tx_status = rs_tx_status, | 2573 | .tx_status = rs_tx_status, |
2606 | .get_rate = rs_get_rate, | 2574 | .get_rate = rs_get_rate, |
2607 | .rate_init = rs_rate_init, | 2575 | .rate_init = rs_rate_init, |
2608 | .clear = rs_clear, | ||
2609 | .alloc = rs_alloc, | 2576 | .alloc = rs_alloc, |
2610 | .free = rs_free, | 2577 | .free = rs_free, |
2611 | .alloc_sta = rs_alloc_sta, | 2578 | .alloc_sta = rs_alloc_sta, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index d148d73635eb..78ee83adf742 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -229,7 +229,7 @@ enum { | |||
229 | #define IWL_MIMO2_SWITCH_SISO_C 4 | 229 | #define IWL_MIMO2_SWITCH_SISO_C 4 |
230 | #define IWL_MIMO2_SWITCH_GI 5 | 230 | #define IWL_MIMO2_SWITCH_GI 5 |
231 | 231 | ||
232 | /*FIXME:RS:add posible acctions for MIMO3*/ | 232 | /*FIXME:RS:add possible actions for MIMO3*/ |
233 | 233 | ||
234 | #define IWL_ACTION_LIMIT 3 /* # possible actions */ | 234 | #define IWL_ACTION_LIMIT 3 /* # possible actions */ |
235 | 235 | ||
@@ -284,7 +284,17 @@ static inline u8 num_of_ant(u8 mask) | |||
284 | !!((mask) & ANT_C); | 284 | !!((mask) & ANT_C); |
285 | } | 285 | } |
286 | 286 | ||
287 | static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) | 287 | static inline u8 first_antenna(u8 mask) |
288 | { | ||
289 | if (mask & ANT_A) | ||
290 | return ANT_A; | ||
291 | if (mask & ANT_B) | ||
292 | return ANT_B; | ||
293 | return ANT_C; | ||
294 | } | ||
295 | |||
296 | |||
297 | static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) | ||
288 | { | 298 | { |
289 | u8 rate = iwl_rates[rate_index].prev_ieee; | 299 | u8 rate = iwl_rates[rate_index].prev_ieee; |
290 | 300 | ||
@@ -294,11 +304,11 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) | |||
294 | } | 304 | } |
295 | 305 | ||
296 | /** | 306 | /** |
297 | * iwl4965_rate_control_register - Register the rate control algorithm callbacks | 307 | * iwl_rate_control_register - Register the rate control algorithm callbacks |
298 | * | 308 | * |
299 | * Since the rate control algorithm is hardware specific, there is no need | 309 | * Since the rate control algorithm is hardware specific, there is no need |
300 | * or reason to place it as a stand alone module. The driver can call | 310 | * or reason to place it as a stand alone module. The driver can call |
301 | * iwl4965_rate_control_register in order to register the rate control callbacks | 311 | * iwl_rate_control_register in order to register the rate control callbacks |
302 | * with the mac80211 subsystem. This should be performed prior to calling | 312 | * with the mac80211 subsystem. This should be performed prior to calling |
303 | * ieee80211_register_hw | 313 | * ieee80211_register_hw |
304 | * | 314 | * |
@@ -306,7 +316,7 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) | |||
306 | extern int iwlagn_rate_control_register(void); | 316 | extern int iwlagn_rate_control_register(void); |
307 | 317 | ||
308 | /** | 318 | /** |
309 | * iwl4965_rate_control_unregister - Unregister the rate control callbacks | 319 | * iwl_rate_control_unregister - Unregister the rate control callbacks |
310 | * | 320 | * |
311 | * This should be called after calling ieee80211_unregister_hw, but before | 321 | * This should be called after calling ieee80211_unregister_hw, but before |
312 | * the driver is unloaded. | 322 | * the driver is unloaded. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index c4c0371c763b..5da6b35cd26d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -83,7 +83,7 @@ | |||
83 | 83 | ||
84 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 84 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
85 | MODULE_VERSION(DRV_VERSION); | 85 | MODULE_VERSION(DRV_VERSION); |
86 | MODULE_AUTHOR(DRV_COPYRIGHT); | 86 | MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); |
87 | MODULE_LICENSE("GPL"); | 87 | MODULE_LICENSE("GPL"); |
88 | MODULE_ALIAS("iwl4965"); | 88 | MODULE_ALIAS("iwl4965"); |
89 | 89 | ||
@@ -96,7 +96,7 @@ MODULE_ALIAS("iwl4965"); | |||
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | 99 | static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) |
100 | { | 100 | { |
101 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 101 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
102 | 102 | ||
@@ -108,79 +108,6 @@ static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * iwl4965_check_rxon_cmd - validate RXON structure is valid | ||
112 | * | ||
113 | * NOTE: This is really only useful during development and can eventually | ||
114 | * be #ifdef'd out once the driver is stable and folks aren't actively | ||
115 | * making changes | ||
116 | */ | ||
117 | static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon) | ||
118 | { | ||
119 | int error = 0; | ||
120 | int counter = 1; | ||
121 | |||
122 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { | ||
123 | error |= le32_to_cpu(rxon->flags & | ||
124 | (RXON_FLG_TGJ_NARROW_BAND_MSK | | ||
125 | RXON_FLG_RADAR_DETECT_MSK)); | ||
126 | if (error) | ||
127 | IWL_WARNING("check 24G fields %d | %d\n", | ||
128 | counter++, error); | ||
129 | } else { | ||
130 | error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ? | ||
131 | 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK); | ||
132 | if (error) | ||
133 | IWL_WARNING("check 52 fields %d | %d\n", | ||
134 | counter++, error); | ||
135 | error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK); | ||
136 | if (error) | ||
137 | IWL_WARNING("check 52 CCK %d | %d\n", | ||
138 | counter++, error); | ||
139 | } | ||
140 | error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1; | ||
141 | if (error) | ||
142 | IWL_WARNING("check mac addr %d | %d\n", counter++, error); | ||
143 | |||
144 | /* make sure basic rates 6Mbps and 1Mbps are supported */ | ||
145 | error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) && | ||
146 | ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0)); | ||
147 | if (error) | ||
148 | IWL_WARNING("check basic rate %d | %d\n", counter++, error); | ||
149 | |||
150 | error |= (le16_to_cpu(rxon->assoc_id) > 2007); | ||
151 | if (error) | ||
152 | IWL_WARNING("check assoc id %d | %d\n", counter++, error); | ||
153 | |||
154 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) | ||
155 | == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)); | ||
156 | if (error) | ||
157 | IWL_WARNING("check CCK and short slot %d | %d\n", | ||
158 | counter++, error); | ||
159 | |||
160 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) | ||
161 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)); | ||
162 | if (error) | ||
163 | IWL_WARNING("check CCK & auto detect %d | %d\n", | ||
164 | counter++, error); | ||
165 | |||
166 | error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | | ||
167 | RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK); | ||
168 | if (error) | ||
169 | IWL_WARNING("check TGG and auto detect %d | %d\n", | ||
170 | counter++, error); | ||
171 | |||
172 | if (error) | ||
173 | IWL_WARNING("Tuning to channel %d\n", | ||
174 | le16_to_cpu(rxon->channel)); | ||
175 | |||
176 | if (error) { | ||
177 | IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n"); | ||
178 | return -1; | ||
179 | } | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed | 111 | * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed |
185 | * @priv: staging_rxon is compared to active_rxon | 112 | * @priv: staging_rxon is compared to active_rxon |
186 | * | 113 | * |
@@ -228,18 +155,17 @@ static int iwl_full_rxon_required(struct iwl_priv *priv) | |||
228 | } | 155 | } |
229 | 156 | ||
230 | /** | 157 | /** |
231 | * iwl4965_commit_rxon - commit staging_rxon to hardware | 158 | * iwl_commit_rxon - commit staging_rxon to hardware |
232 | * | 159 | * |
233 | * The RXON command in staging_rxon is committed to the hardware and | 160 | * The RXON command in staging_rxon is committed to the hardware and |
234 | * the active_rxon structure is updated with the new data. This | 161 | * the active_rxon structure is updated with the new data. This |
235 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 162 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
236 | * a HW tune is required based on the RXON structure changes. | 163 | * a HW tune is required based on the RXON structure changes. |
237 | */ | 164 | */ |
238 | static int iwl4965_commit_rxon(struct iwl_priv *priv) | 165 | static int iwl_commit_rxon(struct iwl_priv *priv) |
239 | { | 166 | { |
240 | /* cast away the const for active_rxon in this function */ | 167 | /* cast away the const for active_rxon in this function */ |
241 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 168 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; |
242 | DECLARE_MAC_BUF(mac); | ||
243 | int ret; | 169 | int ret; |
244 | bool new_assoc = | 170 | bool new_assoc = |
245 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | 171 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); |
@@ -253,14 +179,14 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
253 | * 5000, but will not damage 4965 */ | 179 | * 5000, but will not damage 4965 */ |
254 | priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; | 180 | priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; |
255 | 181 | ||
256 | ret = iwl4965_check_rxon_cmd(&priv->staging_rxon); | 182 | ret = iwl_agn_check_rxon_cmd(&priv->staging_rxon); |
257 | if (ret) { | 183 | if (ret) { |
258 | IWL_ERROR("Invalid RXON configuration. Not committing.\n"); | 184 | IWL_ERROR("Invalid RXON configuration. Not committing.\n"); |
259 | return -EINVAL; | 185 | return -EINVAL; |
260 | } | 186 | } |
261 | 187 | ||
262 | /* If we don't need to send a full RXON, we can use | 188 | /* If we don't need to send a full RXON, we can use |
263 | * iwl4965_rxon_assoc_cmd which is used to reconfigure filter | 189 | * iwl_rxon_assoc_cmd which is used to reconfigure filter |
264 | * and other flags for the current radio configuration. */ | 190 | * and other flags for the current radio configuration. */ |
265 | if (!iwl_full_rxon_required(priv)) { | 191 | if (!iwl_full_rxon_required(priv)) { |
266 | ret = iwl_send_rxon_assoc(priv); | 192 | ret = iwl_send_rxon_assoc(priv); |
@@ -300,12 +226,12 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
300 | IWL_DEBUG_INFO("Sending RXON\n" | 226 | IWL_DEBUG_INFO("Sending RXON\n" |
301 | "* with%s RXON_FILTER_ASSOC_MSK\n" | 227 | "* with%s RXON_FILTER_ASSOC_MSK\n" |
302 | "* channel = %d\n" | 228 | "* channel = %d\n" |
303 | "* bssid = %s\n", | 229 | "* bssid = %pM\n", |
304 | (new_assoc ? "" : "out"), | 230 | (new_assoc ? "" : "out"), |
305 | le16_to_cpu(priv->staging_rxon.channel), | 231 | le16_to_cpu(priv->staging_rxon.channel), |
306 | print_mac(mac, priv->staging_rxon.bssid_addr)); | 232 | priv->staging_rxon.bssid_addr); |
307 | 233 | ||
308 | iwl4965_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); | 234 | iwl_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); |
309 | 235 | ||
310 | /* Apply the new configuration | 236 | /* Apply the new configuration |
311 | * RXON unassoc clears the station table in uCode, send it before | 237 | * RXON unassoc clears the station table in uCode, send it before |
@@ -375,16 +301,16 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
375 | return 0; | 301 | return 0; |
376 | } | 302 | } |
377 | 303 | ||
378 | void iwl4965_update_chain_flags(struct iwl_priv *priv) | 304 | void iwl_update_chain_flags(struct iwl_priv *priv) |
379 | { | 305 | { |
380 | 306 | ||
381 | iwl_set_rxon_chain(priv); | 307 | iwl_set_rxon_chain(priv); |
382 | iwl4965_commit_rxon(priv); | 308 | iwl_commit_rxon(priv); |
383 | } | 309 | } |
384 | 310 | ||
385 | static int iwl4965_send_bt_config(struct iwl_priv *priv) | 311 | static int iwl_send_bt_config(struct iwl_priv *priv) |
386 | { | 312 | { |
387 | struct iwl4965_bt_cmd bt_cmd = { | 313 | struct iwl_bt_cmd bt_cmd = { |
388 | .flags = 3, | 314 | .flags = 3, |
389 | .lead_time = 0xAA, | 315 | .lead_time = 0xAA, |
390 | .max_kill = 1, | 316 | .max_kill = 1, |
@@ -393,7 +319,7 @@ static int iwl4965_send_bt_config(struct iwl_priv *priv) | |||
393 | }; | 319 | }; |
394 | 320 | ||
395 | return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 321 | return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
396 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); | 322 | sizeof(struct iwl_bt_cmd), &bt_cmd); |
397 | } | 323 | } |
398 | 324 | ||
399 | static void iwl_clear_free_frames(struct iwl_priv *priv) | 325 | static void iwl_clear_free_frames(struct iwl_priv *priv) |
@@ -445,7 +371,7 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) | |||
445 | 371 | ||
446 | static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, | 372 | static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, |
447 | struct ieee80211_hdr *hdr, | 373 | struct ieee80211_hdr *hdr, |
448 | const u8 *dest, int left) | 374 | int left) |
449 | { | 375 | { |
450 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 376 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || |
451 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && | 377 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && |
@@ -460,16 +386,16 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, | |||
460 | return priv->ibss_beacon->len; | 386 | return priv->ibss_beacon->len; |
461 | } | 387 | } |
462 | 388 | ||
463 | static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv) | 389 | static u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv) |
464 | { | 390 | { |
465 | int i; | 391 | int i; |
466 | int rate_mask; | 392 | int rate_mask; |
467 | 393 | ||
468 | /* Set rate mask*/ | 394 | /* Set rate mask*/ |
469 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) | 395 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) |
470 | rate_mask = priv->active_rate_basic & 0xF; | 396 | rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK; |
471 | else | 397 | else |
472 | rate_mask = priv->active_rate_basic & 0xFF0; | 398 | rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK; |
473 | 399 | ||
474 | /* Find lowest valid rate */ | 400 | /* Find lowest valid rate */ |
475 | for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; | 401 | for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; |
@@ -485,7 +411,7 @@ static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv) | |||
485 | return IWL_RATE_6M_PLCP; | 411 | return IWL_RATE_6M_PLCP; |
486 | } | 412 | } |
487 | 413 | ||
488 | static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | 414 | static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, |
489 | struct iwl_frame *frame, u8 rate) | 415 | struct iwl_frame *frame, u8 rate) |
490 | { | 416 | { |
491 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; | 417 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; |
@@ -498,7 +424,6 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
498 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 424 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
499 | 425 | ||
500 | frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, | 426 | frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, |
501 | iwl_bcast_addr, | ||
502 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | 427 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); |
503 | 428 | ||
504 | BUG_ON(frame_size > MAX_MPDU_SIZE); | 429 | BUG_ON(frame_size > MAX_MPDU_SIZE); |
@@ -517,7 +442,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
517 | 442 | ||
518 | return sizeof(*tx_beacon_cmd) + frame_size; | 443 | return sizeof(*tx_beacon_cmd) + frame_size; |
519 | } | 444 | } |
520 | static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | 445 | static int iwl_send_beacon_cmd(struct iwl_priv *priv) |
521 | { | 446 | { |
522 | struct iwl_frame *frame; | 447 | struct iwl_frame *frame; |
523 | unsigned int frame_size; | 448 | unsigned int frame_size; |
@@ -532,9 +457,9 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | |||
532 | return -ENOMEM; | 457 | return -ENOMEM; |
533 | } | 458 | } |
534 | 459 | ||
535 | rate = iwl4965_rate_get_lowest_plcp(priv); | 460 | rate = iwl_rate_get_lowest_plcp(priv); |
536 | 461 | ||
537 | frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); | 462 | frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); |
538 | 463 | ||
539 | rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, | 464 | rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, |
540 | &frame->u.cmd[0]); | 465 | &frame->u.cmd[0]); |
@@ -550,20 +475,33 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | |||
550 | * | 475 | * |
551 | ******************************************************************************/ | 476 | ******************************************************************************/ |
552 | 477 | ||
553 | static void iwl4965_ht_conf(struct iwl_priv *priv, | 478 | static void iwl_ht_conf(struct iwl_priv *priv, |
554 | struct ieee80211_bss_conf *bss_conf) | 479 | struct ieee80211_bss_conf *bss_conf) |
555 | { | 480 | { |
556 | struct ieee80211_ht_info *ht_conf = bss_conf->ht_conf; | 481 | struct ieee80211_sta_ht_cap *ht_conf; |
557 | struct ieee80211_ht_bss_info *ht_bss_conf = bss_conf->ht_bss_conf; | ||
558 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; | 482 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; |
483 | struct ieee80211_sta *sta; | ||
559 | 484 | ||
560 | IWL_DEBUG_MAC80211("enter: \n"); | 485 | IWL_DEBUG_MAC80211("enter: \n"); |
561 | 486 | ||
562 | iwl_conf->is_ht = bss_conf->assoc_ht; | ||
563 | |||
564 | if (!iwl_conf->is_ht) | 487 | if (!iwl_conf->is_ht) |
565 | return; | 488 | return; |
566 | 489 | ||
490 | |||
491 | /* | ||
492 | * It is totally wrong to base global information on something | ||
493 | * that is valid only when associated, alas, this driver works | ||
494 | * that way and I don't know how to fix it. | ||
495 | */ | ||
496 | |||
497 | rcu_read_lock(); | ||
498 | sta = ieee80211_find_sta(priv->hw, priv->bssid); | ||
499 | if (!sta) { | ||
500 | rcu_read_unlock(); | ||
501 | return; | ||
502 | } | ||
503 | ht_conf = &sta->ht_cap; | ||
504 | |||
567 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) | 505 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) |
568 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; | 506 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; |
569 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) | 507 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) |
@@ -574,29 +512,36 @@ static void iwl4965_ht_conf(struct iwl_priv *priv, | |||
574 | !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); | 512 | !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); |
575 | 513 | ||
576 | iwl_conf->supported_chan_width = | 514 | iwl_conf->supported_chan_width = |
577 | !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH); | 515 | !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40); |
578 | iwl_conf->extension_chan_offset = | 516 | |
579 | ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET; | 517 | /* |
518 | * XXX: The HT configuration needs to be moved into iwl_mac_config() | ||
519 | * to be done there correctly. | ||
520 | */ | ||
521 | |||
522 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
523 | if (priv->hw->conf.ht.channel_type == NL80211_CHAN_HT40MINUS) | ||
524 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
525 | else if(priv->hw->conf.ht.channel_type == NL80211_CHAN_HT40PLUS) | ||
526 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
527 | |||
580 | /* If no above or below channel supplied disable FAT channel */ | 528 | /* If no above or below channel supplied disable FAT channel */ |
581 | if (iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_ABOVE && | 529 | if (iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_ABOVE && |
582 | iwl_conf->extension_chan_offset != IEEE80211_HT_IE_CHA_SEC_BELOW) { | 530 | iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_BELOW) |
583 | iwl_conf->extension_chan_offset = IEEE80211_HT_IE_CHA_SEC_NONE; | ||
584 | iwl_conf->supported_chan_width = 0; | 531 | iwl_conf->supported_chan_width = 0; |
585 | } | ||
586 | 532 | ||
587 | iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); | 533 | iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); |
588 | 534 | ||
589 | memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); | 535 | memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16); |
590 | 536 | ||
591 | iwl_conf->control_channel = ht_bss_conf->primary_channel; | 537 | iwl_conf->tx_chan_width = iwl_conf->supported_chan_width != 0; |
592 | iwl_conf->tx_chan_width = | ||
593 | !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH); | ||
594 | iwl_conf->ht_protection = | 538 | iwl_conf->ht_protection = |
595 | ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_HT_PROTECTION; | 539 | bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; |
596 | iwl_conf->non_GF_STA_present = | 540 | iwl_conf->non_GF_STA_present = |
597 | !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_NON_GF_STA_PRSNT); | 541 | !!(bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); |
542 | |||
543 | rcu_read_unlock(); | ||
598 | 544 | ||
599 | IWL_DEBUG_MAC80211("control channel %d\n", iwl_conf->control_channel); | ||
600 | IWL_DEBUG_MAC80211("leave\n"); | 545 | IWL_DEBUG_MAC80211("leave\n"); |
601 | } | 546 | } |
602 | 547 | ||
@@ -608,9 +553,6 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) | |||
608 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 553 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
609 | return; | 554 | return; |
610 | 555 | ||
611 | if (!priv->qos_data.qos_enable) | ||
612 | return; | ||
613 | |||
614 | priv->qos_data.def_qos_parm.qos_flags = 0; | 556 | priv->qos_data.def_qos_parm.qos_flags = 0; |
615 | 557 | ||
616 | if (priv->qos_data.qos_cap.q_AP.queue_request && | 558 | if (priv->qos_data.qos_cap.q_AP.queue_request && |
@@ -637,23 +579,22 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) | |||
637 | 579 | ||
638 | #define MAX_UCODE_BEACON_INTERVAL 4096 | 580 | #define MAX_UCODE_BEACON_INTERVAL 4096 |
639 | 581 | ||
640 | static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val) | 582 | static u16 iwl_adjust_beacon_interval(u16 beacon_val) |
641 | { | 583 | { |
642 | u16 new_val = 0; | 584 | u16 new_val = 0; |
643 | u16 beacon_factor = 0; | 585 | u16 beacon_factor = 0; |
644 | 586 | ||
645 | beacon_factor = | 587 | beacon_factor = (beacon_val + MAX_UCODE_BEACON_INTERVAL) |
646 | (beacon_val + MAX_UCODE_BEACON_INTERVAL) | 588 | / MAX_UCODE_BEACON_INTERVAL; |
647 | / MAX_UCODE_BEACON_INTERVAL; | ||
648 | new_val = beacon_val / beacon_factor; | 589 | new_val = beacon_val / beacon_factor; |
649 | 590 | ||
650 | return cpu_to_le16(new_val); | 591 | return new_val; |
651 | } | 592 | } |
652 | 593 | ||
653 | static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) | 594 | static void iwl_setup_rxon_timing(struct iwl_priv *priv) |
654 | { | 595 | { |
655 | u64 interval_tm_unit; | 596 | u64 tsf; |
656 | u64 tsf, result; | 597 | s32 interval_tm, rem; |
657 | unsigned long flags; | 598 | unsigned long flags; |
658 | struct ieee80211_conf *conf = NULL; | 599 | struct ieee80211_conf *conf = NULL; |
659 | u16 beacon_int = 0; | 600 | u16 beacon_int = 0; |
@@ -661,49 +602,32 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) | |||
661 | conf = ieee80211_get_hw_conf(priv->hw); | 602 | conf = ieee80211_get_hw_conf(priv->hw); |
662 | 603 | ||
663 | spin_lock_irqsave(&priv->lock, flags); | 604 | spin_lock_irqsave(&priv->lock, flags); |
664 | priv->rxon_timing.timestamp.dw[1] = cpu_to_le32(priv->timestamp >> 32); | 605 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); |
665 | priv->rxon_timing.timestamp.dw[0] = | ||
666 | cpu_to_le32(priv->timestamp & 0xFFFFFFFF); | ||
667 | |||
668 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); | 606 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); |
669 | 607 | ||
670 | tsf = priv->timestamp; | ||
671 | |||
672 | beacon_int = priv->beacon_int; | ||
673 | spin_unlock_irqrestore(&priv->lock, flags); | ||
674 | |||
675 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | 608 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
676 | if (beacon_int == 0) { | 609 | beacon_int = iwl_adjust_beacon_interval(priv->beacon_int); |
677 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | ||
678 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | ||
679 | } else { | ||
680 | priv->rxon_timing.beacon_interval = | ||
681 | cpu_to_le16(beacon_int); | ||
682 | priv->rxon_timing.beacon_interval = | ||
683 | iwl4965_adjust_beacon_interval( | ||
684 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
685 | } | ||
686 | |||
687 | priv->rxon_timing.atim_window = 0; | 610 | priv->rxon_timing.atim_window = 0; |
688 | } else { | 611 | } else { |
689 | priv->rxon_timing.beacon_interval = | 612 | beacon_int = iwl_adjust_beacon_interval(conf->beacon_int); |
690 | iwl4965_adjust_beacon_interval(conf->beacon_int); | 613 | |
691 | /* TODO: we need to get atim_window from upper stack | 614 | /* TODO: we need to get atim_window from upper stack |
692 | * for now we set to 0 */ | 615 | * for now we set to 0 */ |
693 | priv->rxon_timing.atim_window = 0; | 616 | priv->rxon_timing.atim_window = 0; |
694 | } | 617 | } |
695 | 618 | ||
696 | interval_tm_unit = | 619 | priv->rxon_timing.beacon_interval = cpu_to_le16(beacon_int); |
697 | (le16_to_cpu(priv->rxon_timing.beacon_interval) * 1024); | ||
698 | result = do_div(tsf, interval_tm_unit); | ||
699 | priv->rxon_timing.beacon_init_val = | ||
700 | cpu_to_le32((u32) ((u64) interval_tm_unit - result)); | ||
701 | 620 | ||
702 | IWL_DEBUG_ASSOC | 621 | tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ |
703 | ("beacon interval %d beacon timer %d beacon tim %d\n", | 622 | interval_tm = beacon_int * 1024; |
704 | le16_to_cpu(priv->rxon_timing.beacon_interval), | 623 | rem = do_div(tsf, interval_tm); |
705 | le32_to_cpu(priv->rxon_timing.beacon_init_val), | 624 | priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem); |
706 | le16_to_cpu(priv->rxon_timing.atim_window)); | 625 | |
626 | spin_unlock_irqrestore(&priv->lock, flags); | ||
627 | IWL_DEBUG_ASSOC("beacon interval %d beacon timer %d beacon tim %d\n", | ||
628 | le16_to_cpu(priv->rxon_timing.beacon_interval), | ||
629 | le32_to_cpu(priv->rxon_timing.beacon_init_val), | ||
630 | le16_to_cpu(priv->rxon_timing.atim_window)); | ||
707 | } | 631 | } |
708 | 632 | ||
709 | static void iwl_set_flags_for_band(struct iwl_priv *priv, | 633 | static void iwl_set_flags_for_band(struct iwl_priv *priv, |
@@ -715,7 +639,7 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
715 | | RXON_FLG_CCK_MSK); | 639 | | RXON_FLG_CCK_MSK); |
716 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 640 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
717 | } else { | 641 | } else { |
718 | /* Copied from iwl4965_post_associate() */ | 642 | /* Copied from iwl_post_associate() */ |
719 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) | 643 | if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) |
720 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 644 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; |
721 | else | 645 | else |
@@ -733,13 +657,13 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
733 | /* | 657 | /* |
734 | * initialize rxon structure with default values from eeprom | 658 | * initialize rxon structure with default values from eeprom |
735 | */ | 659 | */ |
736 | static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | 660 | static void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) |
737 | { | 661 | { |
738 | const struct iwl_channel_info *ch_info; | 662 | const struct iwl_channel_info *ch_info; |
739 | 663 | ||
740 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 664 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
741 | 665 | ||
742 | switch (priv->iw_mode) { | 666 | switch (mode) { |
743 | case NL80211_IFTYPE_AP: | 667 | case NL80211_IFTYPE_AP: |
744 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 668 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
745 | break; | 669 | break; |
@@ -762,7 +686,7 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
762 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 686 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
763 | break; | 687 | break; |
764 | default: | 688 | default: |
765 | IWL_ERROR("Unsupported interface type %d\n", priv->iw_mode); | 689 | IWL_ERROR("Unsupported interface type %d\n", mode); |
766 | break; | 690 | break; |
767 | } | 691 | } |
768 | 692 | ||
@@ -808,11 +732,9 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
808 | iwl_set_rxon_chain(priv); | 732 | iwl_set_rxon_chain(priv); |
809 | } | 733 | } |
810 | 734 | ||
811 | static int iwl4965_set_mode(struct iwl_priv *priv, int mode) | 735 | static int iwl_set_mode(struct iwl_priv *priv, int mode) |
812 | { | 736 | { |
813 | priv->iw_mode = mode; | 737 | iwl_connection_init_rx_config(priv, mode); |
814 | |||
815 | iwl4965_connection_init_rx_config(priv); | ||
816 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 738 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
817 | 739 | ||
818 | iwl_clear_stations_table(priv); | 740 | iwl_clear_stations_table(priv); |
@@ -828,12 +750,12 @@ static int iwl4965_set_mode(struct iwl_priv *priv, int mode) | |||
828 | return -EAGAIN; | 750 | return -EAGAIN; |
829 | } | 751 | } |
830 | 752 | ||
831 | iwl4965_commit_rxon(priv); | 753 | iwl_commit_rxon(priv); |
832 | 754 | ||
833 | return 0; | 755 | return 0; |
834 | } | 756 | } |
835 | 757 | ||
836 | static void iwl4965_set_rate(struct iwl_priv *priv) | 758 | static void iwl_set_rate(struct iwl_priv *priv) |
837 | { | 759 | { |
838 | const struct ieee80211_supported_band *hw = NULL; | 760 | const struct ieee80211_supported_band *hw = NULL; |
839 | struct ieee80211_rate *rate; | 761 | struct ieee80211_rate *rate; |
@@ -880,138 +802,6 @@ static void iwl4965_set_rate(struct iwl_priv *priv) | |||
880 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 802 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
881 | } | 803 | } |
882 | 804 | ||
883 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | ||
884 | |||
885 | #include "iwl-spectrum.h" | ||
886 | |||
887 | #define BEACON_TIME_MASK_LOW 0x00FFFFFF | ||
888 | #define BEACON_TIME_MASK_HIGH 0xFF000000 | ||
889 | #define TIME_UNIT 1024 | ||
890 | |||
891 | /* | ||
892 | * extended beacon time format | ||
893 | * time in usec will be changed into a 32-bit value in 8:24 format | ||
894 | * the high 1 byte is the beacon counts | ||
895 | * the lower 3 bytes is the time in usec within one beacon interval | ||
896 | */ | ||
897 | |||
898 | static u32 iwl4965_usecs_to_beacons(u32 usec, u32 beacon_interval) | ||
899 | { | ||
900 | u32 quot; | ||
901 | u32 rem; | ||
902 | u32 interval = beacon_interval * 1024; | ||
903 | |||
904 | if (!interval || !usec) | ||
905 | return 0; | ||
906 | |||
907 | quot = (usec / interval) & (BEACON_TIME_MASK_HIGH >> 24); | ||
908 | rem = (usec % interval) & BEACON_TIME_MASK_LOW; | ||
909 | |||
910 | return (quot << 24) + rem; | ||
911 | } | ||
912 | |||
913 | /* base is usually what we get from ucode with each received frame, | ||
914 | * the same as HW timer counter counting down | ||
915 | */ | ||
916 | |||
917 | static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) | ||
918 | { | ||
919 | u32 base_low = base & BEACON_TIME_MASK_LOW; | ||
920 | u32 addon_low = addon & BEACON_TIME_MASK_LOW; | ||
921 | u32 interval = beacon_interval * TIME_UNIT; | ||
922 | u32 res = (base & BEACON_TIME_MASK_HIGH) + | ||
923 | (addon & BEACON_TIME_MASK_HIGH); | ||
924 | |||
925 | if (base_low > addon_low) | ||
926 | res += base_low - addon_low; | ||
927 | else if (base_low < addon_low) { | ||
928 | res += interval + base_low - addon_low; | ||
929 | res += (1 << 24); | ||
930 | } else | ||
931 | res += (1 << 24); | ||
932 | |||
933 | return cpu_to_le32(res); | ||
934 | } | ||
935 | |||
936 | static int iwl4965_get_measurement(struct iwl_priv *priv, | ||
937 | struct ieee80211_measurement_params *params, | ||
938 | u8 type) | ||
939 | { | ||
940 | struct iwl4965_spectrum_cmd spectrum; | ||
941 | struct iwl_rx_packet *res; | ||
942 | struct iwl_host_cmd cmd = { | ||
943 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, | ||
944 | .data = (void *)&spectrum, | ||
945 | .meta.flags = CMD_WANT_SKB, | ||
946 | }; | ||
947 | u32 add_time = le64_to_cpu(params->start_time); | ||
948 | int rc; | ||
949 | int spectrum_resp_status; | ||
950 | int duration = le16_to_cpu(params->duration); | ||
951 | |||
952 | if (iwl_is_associated(priv)) | ||
953 | add_time = | ||
954 | iwl4965_usecs_to_beacons( | ||
955 | le64_to_cpu(params->start_time) - priv->last_tsf, | ||
956 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
957 | |||
958 | memset(&spectrum, 0, sizeof(spectrum)); | ||
959 | |||
960 | spectrum.channel_count = cpu_to_le16(1); | ||
961 | spectrum.flags = | ||
962 | RXON_FLG_TSF2HOST_MSK | RXON_FLG_ANT_A_MSK | RXON_FLG_DIS_DIV_MSK; | ||
963 | spectrum.filter_flags = MEASUREMENT_FILTER_FLAG; | ||
964 | cmd.len = sizeof(spectrum); | ||
965 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); | ||
966 | |||
967 | if (iwl_is_associated(priv)) | ||
968 | spectrum.start_time = | ||
969 | iwl4965_add_beacon_time(priv->last_beacon_time, | ||
970 | add_time, | ||
971 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
972 | else | ||
973 | spectrum.start_time = 0; | ||
974 | |||
975 | spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); | ||
976 | spectrum.channels[0].channel = params->channel; | ||
977 | spectrum.channels[0].type = type; | ||
978 | if (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK) | ||
979 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | ||
980 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | ||
981 | |||
982 | rc = iwl_send_cmd_sync(priv, &cmd); | ||
983 | if (rc) | ||
984 | return rc; | ||
985 | |||
986 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
987 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { | ||
988 | IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); | ||
989 | rc = -EIO; | ||
990 | } | ||
991 | |||
992 | spectrum_resp_status = le16_to_cpu(res->u.spectrum.status); | ||
993 | switch (spectrum_resp_status) { | ||
994 | case 0: /* Command will be handled */ | ||
995 | if (res->u.spectrum.id != 0xff) { | ||
996 | IWL_DEBUG_INFO | ||
997 | ("Replaced existing measurement: %d\n", | ||
998 | res->u.spectrum.id); | ||
999 | priv->measurement_status &= ~MEASUREMENT_READY; | ||
1000 | } | ||
1001 | priv->measurement_status |= MEASUREMENT_ACTIVE; | ||
1002 | rc = 0; | ||
1003 | break; | ||
1004 | |||
1005 | case 1: /* Command will not be handled */ | ||
1006 | rc = -EAGAIN; | ||
1007 | break; | ||
1008 | } | ||
1009 | |||
1010 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
1011 | |||
1012 | return rc; | ||
1013 | } | ||
1014 | #endif | ||
1015 | 805 | ||
1016 | /****************************************************************************** | 806 | /****************************************************************************** |
1017 | * | 807 | * |
@@ -1054,7 +844,7 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, | |||
1054 | IWL_WARNING("uCode did not respond OK.\n"); | 844 | IWL_WARNING("uCode did not respond OK.\n"); |
1055 | } | 845 | } |
1056 | 846 | ||
1057 | static void iwl4965_rx_reply_error(struct iwl_priv *priv, | 847 | static void iwl_rx_reply_error(struct iwl_priv *priv, |
1058 | struct iwl_rx_mem_buffer *rxb) | 848 | struct iwl_rx_mem_buffer *rxb) |
1059 | { | 849 | { |
1060 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 850 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
@@ -1070,47 +860,29 @@ static void iwl4965_rx_reply_error(struct iwl_priv *priv, | |||
1070 | 860 | ||
1071 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x | 861 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x |
1072 | 862 | ||
1073 | static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | 863 | static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) |
1074 | { | 864 | { |
1075 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 865 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
1076 | struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; | 866 | struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; |
1077 | struct iwl4965_csa_notification *csa = &(pkt->u.csa_notif); | 867 | struct iwl_csa_notification *csa = &(pkt->u.csa_notif); |
1078 | IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", | 868 | IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", |
1079 | le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); | 869 | le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); |
1080 | rxon->channel = csa->channel; | 870 | rxon->channel = csa->channel; |
1081 | priv->staging_rxon.channel = csa->channel; | 871 | priv->staging_rxon.channel = csa->channel; |
1082 | } | 872 | } |
1083 | 873 | ||
1084 | static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv, | 874 | static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, |
1085 | struct iwl_rx_mem_buffer *rxb) | ||
1086 | { | ||
1087 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | ||
1088 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1089 | struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif); | ||
1090 | |||
1091 | if (!report->state) { | ||
1092 | IWL_DEBUG(IWL_DL_11H, | ||
1093 | "Spectrum Measure Notification: Start\n"); | ||
1094 | return; | ||
1095 | } | ||
1096 | |||
1097 | memcpy(&priv->measure_report, report, sizeof(*report)); | ||
1098 | priv->measurement_status |= MEASUREMENT_READY; | ||
1099 | #endif | ||
1100 | } | ||
1101 | |||
1102 | static void iwl4965_rx_pm_sleep_notif(struct iwl_priv *priv, | ||
1103 | struct iwl_rx_mem_buffer *rxb) | 875 | struct iwl_rx_mem_buffer *rxb) |
1104 | { | 876 | { |
1105 | #ifdef CONFIG_IWLWIFI_DEBUG | 877 | #ifdef CONFIG_IWLWIFI_DEBUG |
1106 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 878 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
1107 | struct iwl4965_sleep_notification *sleep = &(pkt->u.sleep_notif); | 879 | struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); |
1108 | IWL_DEBUG_RX("sleep mode: %d, src: %d\n", | 880 | IWL_DEBUG_RX("sleep mode: %d, src: %d\n", |
1109 | sleep->pm_sleep_mode, sleep->pm_wakeup_src); | 881 | sleep->pm_sleep_mode, sleep->pm_wakeup_src); |
1110 | #endif | 882 | #endif |
1111 | } | 883 | } |
1112 | 884 | ||
1113 | static void iwl4965_rx_pm_debug_statistics_notif(struct iwl_priv *priv, | 885 | static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, |
1114 | struct iwl_rx_mem_buffer *rxb) | 886 | struct iwl_rx_mem_buffer *rxb) |
1115 | { | 887 | { |
1116 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 888 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
@@ -1120,7 +892,7 @@ static void iwl4965_rx_pm_debug_statistics_notif(struct iwl_priv *priv, | |||
1120 | iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); | 892 | iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); |
1121 | } | 893 | } |
1122 | 894 | ||
1123 | static void iwl4965_bg_beacon_update(struct work_struct *work) | 895 | static void iwl_bg_beacon_update(struct work_struct *work) |
1124 | { | 896 | { |
1125 | struct iwl_priv *priv = | 897 | struct iwl_priv *priv = |
1126 | container_of(work, struct iwl_priv, beacon_update); | 898 | container_of(work, struct iwl_priv, beacon_update); |
@@ -1142,11 +914,11 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
1142 | priv->ibss_beacon = beacon; | 914 | priv->ibss_beacon = beacon; |
1143 | mutex_unlock(&priv->mutex); | 915 | mutex_unlock(&priv->mutex); |
1144 | 916 | ||
1145 | iwl4965_send_beacon_cmd(priv); | 917 | iwl_send_beacon_cmd(priv); |
1146 | } | 918 | } |
1147 | 919 | ||
1148 | /** | 920 | /** |
1149 | * iwl4965_bg_statistics_periodic - Timer callback to queue statistics | 921 | * iwl_bg_statistics_periodic - Timer callback to queue statistics |
1150 | * | 922 | * |
1151 | * This callback is provided in order to send a statistics request. | 923 | * This callback is provided in order to send a statistics request. |
1152 | * | 924 | * |
@@ -1155,22 +927,27 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
1155 | * was received. We need to ensure we receive the statistics in order | 927 | * was received. We need to ensure we receive the statistics in order |
1156 | * to update the temperature used for calibrating the TXPOWER. | 928 | * to update the temperature used for calibrating the TXPOWER. |
1157 | */ | 929 | */ |
1158 | static void iwl4965_bg_statistics_periodic(unsigned long data) | 930 | static void iwl_bg_statistics_periodic(unsigned long data) |
1159 | { | 931 | { |
1160 | struct iwl_priv *priv = (struct iwl_priv *)data; | 932 | struct iwl_priv *priv = (struct iwl_priv *)data; |
1161 | 933 | ||
1162 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 934 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
1163 | return; | 935 | return; |
1164 | 936 | ||
937 | /* dont send host command if rf-kill is on */ | ||
938 | if (!iwl_is_ready_rf(priv)) | ||
939 | return; | ||
940 | |||
1165 | iwl_send_statistics_request(priv, CMD_ASYNC); | 941 | iwl_send_statistics_request(priv, CMD_ASYNC); |
1166 | } | 942 | } |
1167 | 943 | ||
1168 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | 944 | static void iwl_rx_beacon_notif(struct iwl_priv *priv, |
1169 | struct iwl_rx_mem_buffer *rxb) | 945 | struct iwl_rx_mem_buffer *rxb) |
1170 | { | 946 | { |
1171 | #ifdef CONFIG_IWLWIFI_DEBUG | 947 | #ifdef CONFIG_IWLWIFI_DEBUG |
1172 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 948 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
1173 | struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status); | 949 | struct iwl4965_beacon_notif *beacon = |
950 | (struct iwl4965_beacon_notif *)pkt->u.raw; | ||
1174 | u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); | 951 | u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); |
1175 | 952 | ||
1176 | IWL_DEBUG_RX("beacon status %x retries %d iss %d " | 953 | IWL_DEBUG_RX("beacon status %x retries %d iss %d " |
@@ -1189,7 +966,7 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | |||
1189 | 966 | ||
1190 | /* Handle notification from uCode that card's power state is changing | 967 | /* Handle notification from uCode that card's power state is changing |
1191 | * due to software, hardware, or critical temperature RFKILL */ | 968 | * due to software, hardware, or critical temperature RFKILL */ |
1192 | static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, | 969 | static void iwl_rx_card_state_notif(struct iwl_priv *priv, |
1193 | struct iwl_rx_mem_buffer *rxb) | 970 | struct iwl_rx_mem_buffer *rxb) |
1194 | { | 971 | { |
1195 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 972 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
@@ -1258,7 +1035,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, | |||
1258 | wake_up_interruptible(&priv->wait_command_queue); | 1035 | wake_up_interruptible(&priv->wait_command_queue); |
1259 | } | 1036 | } |
1260 | 1037 | ||
1261 | int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | 1038 | int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) |
1262 | { | 1039 | { |
1263 | int ret; | 1040 | int ret; |
1264 | unsigned long flags; | 1041 | unsigned long flags; |
@@ -1290,7 +1067,7 @@ err: | |||
1290 | } | 1067 | } |
1291 | 1068 | ||
1292 | /** | 1069 | /** |
1293 | * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks | 1070 | * iwl_setup_rx_handlers - Initialize Rx handler callbacks |
1294 | * | 1071 | * |
1295 | * Setup the RX handlers for each of the reply types sent from the uCode | 1072 | * Setup the RX handlers for each of the reply types sent from the uCode |
1296 | * to the host. | 1073 | * to the host. |
@@ -1301,14 +1078,12 @@ err: | |||
1301 | static void iwl_setup_rx_handlers(struct iwl_priv *priv) | 1078 | static void iwl_setup_rx_handlers(struct iwl_priv *priv) |
1302 | { | 1079 | { |
1303 | priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; | 1080 | priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; |
1304 | priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error; | 1081 | priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; |
1305 | priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa; | 1082 | priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; |
1306 | priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = | 1083 | priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; |
1307 | iwl4965_rx_spectrum_measure_notif; | ||
1308 | priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl4965_rx_pm_sleep_notif; | ||
1309 | priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = | 1084 | priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = |
1310 | iwl4965_rx_pm_debug_statistics_notif; | 1085 | iwl_rx_pm_debug_statistics_notif; |
1311 | priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; | 1086 | priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; |
1312 | 1087 | ||
1313 | /* | 1088 | /* |
1314 | * The same handler is used for both the REPLY to a discrete | 1089 | * The same handler is used for both the REPLY to a discrete |
@@ -1318,10 +1093,11 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) | |||
1318 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_rx_statistics; | 1093 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_rx_statistics; |
1319 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_rx_statistics; | 1094 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_rx_statistics; |
1320 | 1095 | ||
1096 | iwl_setup_spectrum_handlers(priv); | ||
1321 | iwl_setup_rx_scan_handlers(priv); | 1097 | iwl_setup_rx_scan_handlers(priv); |
1322 | 1098 | ||
1323 | /* status change handler */ | 1099 | /* status change handler */ |
1324 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; | 1100 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; |
1325 | 1101 | ||
1326 | priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = | 1102 | priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = |
1327 | iwl_rx_missed_beacon_notif; | 1103 | iwl_rx_missed_beacon_notif; |
@@ -1334,16 +1110,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) | |||
1334 | priv->cfg->ops->lib->rx_handler_setup(priv); | 1110 | priv->cfg->ops->lib->rx_handler_setup(priv); |
1335 | } | 1111 | } |
1336 | 1112 | ||
1337 | /* | ||
1338 | * this should be called while priv->lock is locked | ||
1339 | */ | ||
1340 | static void __iwl_rx_replenish(struct iwl_priv *priv) | ||
1341 | { | ||
1342 | iwl_rx_allocate(priv); | ||
1343 | iwl_rx_queue_restock(priv); | ||
1344 | } | ||
1345 | |||
1346 | |||
1347 | /** | 1113 | /** |
1348 | * iwl_rx_handle - Main entry function for receiving responses from uCode | 1114 | * iwl_rx_handle - Main entry function for receiving responses from uCode |
1349 | * | 1115 | * |
@@ -1364,7 +1130,7 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1364 | 1130 | ||
1365 | /* uCode's read index (stored in shared DRAM) indicates the last Rx | 1131 | /* uCode's read index (stored in shared DRAM) indicates the last Rx |
1366 | * buffer that the driver may process (last buffer filled by ucode). */ | 1132 | * buffer that the driver may process (last buffer filled by ucode). */ |
1367 | r = priv->cfg->ops->lib->shared_mem_rx_idx(priv); | 1133 | r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; |
1368 | i = rxq->read; | 1134 | i = rxq->read; |
1369 | 1135 | ||
1370 | /* Rx interrupt, but nothing sent from uCode */ | 1136 | /* Rx interrupt, but nothing sent from uCode */ |
@@ -1400,13 +1166,14 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1400 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && | 1166 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && |
1401 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && | 1167 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && |
1402 | (pkt->hdr.cmd != REPLY_RX) && | 1168 | (pkt->hdr.cmd != REPLY_RX) && |
1169 | (pkt->hdr.cmd != REPLY_RX_MPDU_CMD) && | ||
1403 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && | 1170 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && |
1404 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && | 1171 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && |
1405 | (pkt->hdr.cmd != REPLY_TX); | 1172 | (pkt->hdr.cmd != REPLY_TX); |
1406 | 1173 | ||
1407 | /* Based on type of command response or notification, | 1174 | /* Based on type of command response or notification, |
1408 | * handle those that need handling via function in | 1175 | * handle those that need handling via function in |
1409 | * rx_handlers table. See iwl4965_setup_rx_handlers() */ | 1176 | * rx_handlers table. See iwl_setup_rx_handlers() */ |
1410 | if (priv->rx_handlers[pkt->hdr.cmd]) { | 1177 | if (priv->rx_handlers[pkt->hdr.cmd]) { |
1411 | IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r, | 1178 | IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r, |
1412 | i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 1179 | i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); |
@@ -1451,7 +1218,7 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1451 | count++; | 1218 | count++; |
1452 | if (count >= 8) { | 1219 | if (count >= 8) { |
1453 | priv->rxq.read = i; | 1220 | priv->rxq.read = i; |
1454 | __iwl_rx_replenish(priv); | 1221 | iwl_rx_queue_restock(priv); |
1455 | count = 0; | 1222 | count = 0; |
1456 | } | 1223 | } |
1457 | } | 1224 | } |
@@ -1463,10 +1230,9 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1463 | } | 1230 | } |
1464 | 1231 | ||
1465 | #ifdef CONFIG_IWLWIFI_DEBUG | 1232 | #ifdef CONFIG_IWLWIFI_DEBUG |
1466 | static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv) | 1233 | static void iwl_print_rx_config_cmd(struct iwl_priv *priv) |
1467 | { | 1234 | { |
1468 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 1235 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
1469 | DECLARE_MAC_BUF(mac); | ||
1470 | 1236 | ||
1471 | IWL_DEBUG_RADIO("RX CONFIG:\n"); | 1237 | IWL_DEBUG_RADIO("RX CONFIG:\n"); |
1472 | iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 1238 | iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
@@ -1478,50 +1244,26 @@ static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv) | |||
1478 | IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n", | 1244 | IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n", |
1479 | rxon->ofdm_basic_rates); | 1245 | rxon->ofdm_basic_rates); |
1480 | IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); | 1246 | IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); |
1481 | IWL_DEBUG_RADIO("u8[6] node_addr: %s\n", | 1247 | IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr); |
1482 | print_mac(mac, rxon->node_addr)); | 1248 | IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr); |
1483 | IWL_DEBUG_RADIO("u8[6] bssid_addr: %s\n", | ||
1484 | print_mac(mac, rxon->bssid_addr)); | ||
1485 | IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); | 1249 | IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); |
1486 | } | 1250 | } |
1487 | #endif | 1251 | #endif |
1488 | 1252 | ||
1489 | static void iwl4965_enable_interrupts(struct iwl_priv *priv) | ||
1490 | { | ||
1491 | IWL_DEBUG_ISR("Enabling interrupts\n"); | ||
1492 | set_bit(STATUS_INT_ENABLED, &priv->status); | ||
1493 | iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); | ||
1494 | } | ||
1495 | |||
1496 | /* call this function to flush any scheduled tasklet */ | 1253 | /* call this function to flush any scheduled tasklet */ |
1497 | static inline void iwl_synchronize_irq(struct iwl_priv *priv) | 1254 | static inline void iwl_synchronize_irq(struct iwl_priv *priv) |
1498 | { | 1255 | { |
1499 | /* wait to make sure we flush pedding tasklet*/ | 1256 | /* wait to make sure we flush pending tasklet*/ |
1500 | synchronize_irq(priv->pci_dev->irq); | 1257 | synchronize_irq(priv->pci_dev->irq); |
1501 | tasklet_kill(&priv->irq_tasklet); | 1258 | tasklet_kill(&priv->irq_tasklet); |
1502 | } | 1259 | } |
1503 | 1260 | ||
1504 | static inline void iwl4965_disable_interrupts(struct iwl_priv *priv) | ||
1505 | { | ||
1506 | clear_bit(STATUS_INT_ENABLED, &priv->status); | ||
1507 | |||
1508 | /* disable interrupts from uCode/NIC to host */ | ||
1509 | iwl_write32(priv, CSR_INT_MASK, 0x00000000); | ||
1510 | |||
1511 | /* acknowledge/clear/reset any interrupts still pending | ||
1512 | * from uCode or flow handler (Rx/Tx DMA) */ | ||
1513 | iwl_write32(priv, CSR_INT, 0xffffffff); | ||
1514 | iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); | ||
1515 | IWL_DEBUG_ISR("Disabled interrupts\n"); | ||
1516 | } | ||
1517 | |||
1518 | |||
1519 | /** | 1261 | /** |
1520 | * iwl4965_irq_handle_error - called for HW or SW error interrupt from card | 1262 | * iwl_irq_handle_error - called for HW or SW error interrupt from card |
1521 | */ | 1263 | */ |
1522 | static void iwl4965_irq_handle_error(struct iwl_priv *priv) | 1264 | static void iwl_irq_handle_error(struct iwl_priv *priv) |
1523 | { | 1265 | { |
1524 | /* Set the FW error flag -- cleared on iwl4965_down */ | 1266 | /* Set the FW error flag -- cleared on iwl_down */ |
1525 | set_bit(STATUS_FW_ERROR, &priv->status); | 1267 | set_bit(STATUS_FW_ERROR, &priv->status); |
1526 | 1268 | ||
1527 | /* Cancel currently queued command. */ | 1269 | /* Cancel currently queued command. */ |
@@ -1531,7 +1273,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv) | |||
1531 | if (priv->debug_level & IWL_DL_FW_ERRORS) { | 1273 | if (priv->debug_level & IWL_DL_FW_ERRORS) { |
1532 | iwl_dump_nic_error_log(priv); | 1274 | iwl_dump_nic_error_log(priv); |
1533 | iwl_dump_nic_event_log(priv); | 1275 | iwl_dump_nic_event_log(priv); |
1534 | iwl4965_print_rx_config_cmd(priv); | 1276 | iwl_print_rx_config_cmd(priv); |
1535 | } | 1277 | } |
1536 | #endif | 1278 | #endif |
1537 | 1279 | ||
@@ -1555,14 +1297,14 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv) | |||
1555 | } | 1297 | } |
1556 | } | 1298 | } |
1557 | 1299 | ||
1558 | static void iwl4965_error_recovery(struct iwl_priv *priv) | 1300 | static void iwl_error_recovery(struct iwl_priv *priv) |
1559 | { | 1301 | { |
1560 | unsigned long flags; | 1302 | unsigned long flags; |
1561 | 1303 | ||
1562 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, | 1304 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, |
1563 | sizeof(priv->staging_rxon)); | 1305 | sizeof(priv->staging_rxon)); |
1564 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1306 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1565 | iwl4965_commit_rxon(priv); | 1307 | iwl_commit_rxon(priv); |
1566 | 1308 | ||
1567 | iwl_rxon_add_station(priv, priv->bssid, 1); | 1309 | iwl_rxon_add_station(priv, priv->bssid, 1); |
1568 | 1310 | ||
@@ -1572,7 +1314,7 @@ static void iwl4965_error_recovery(struct iwl_priv *priv) | |||
1572 | spin_unlock_irqrestore(&priv->lock, flags); | 1314 | spin_unlock_irqrestore(&priv->lock, flags); |
1573 | } | 1315 | } |
1574 | 1316 | ||
1575 | static void iwl4965_irq_tasklet(struct iwl_priv *priv) | 1317 | static void iwl_irq_tasklet(struct iwl_priv *priv) |
1576 | { | 1318 | { |
1577 | u32 inta, handled = 0; | 1319 | u32 inta, handled = 0; |
1578 | u32 inta_fh; | 1320 | u32 inta_fh; |
@@ -1618,9 +1360,9 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) | |||
1618 | IWL_ERROR("Microcode HW error detected. Restarting.\n"); | 1360 | IWL_ERROR("Microcode HW error detected. Restarting.\n"); |
1619 | 1361 | ||
1620 | /* Tell the device to stop sending interrupts */ | 1362 | /* Tell the device to stop sending interrupts */ |
1621 | iwl4965_disable_interrupts(priv); | 1363 | iwl_disable_interrupts(priv); |
1622 | 1364 | ||
1623 | iwl4965_irq_handle_error(priv); | 1365 | iwl_irq_handle_error(priv); |
1624 | 1366 | ||
1625 | handled |= CSR_INT_BIT_HW_ERR; | 1367 | handled |= CSR_INT_BIT_HW_ERR; |
1626 | 1368 | ||
@@ -1652,14 +1394,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) | |||
1652 | hw_rf_kill = 1; | 1394 | hw_rf_kill = 1; |
1653 | 1395 | ||
1654 | IWL_DEBUG(IWL_DL_RF_KILL, "RF_KILL bit toggled to %s.\n", | 1396 | IWL_DEBUG(IWL_DL_RF_KILL, "RF_KILL bit toggled to %s.\n", |
1655 | hw_rf_kill ? "disable radio":"enable radio"); | 1397 | hw_rf_kill ? "disable radio" : "enable radio"); |
1656 | 1398 | ||
1657 | /* driver only loads ucode once setting the interface up. | 1399 | /* driver only loads ucode once setting the interface up. |
1658 | * the driver as well won't allow loading if RFKILL is set | 1400 | * the driver as well won't allow loading if RFKILL is set |
1659 | * therefore no need to restart the driver from this handler | 1401 | * therefore no need to restart the driver from this handler |
1660 | */ | 1402 | */ |
1661 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) | 1403 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) { |
1662 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 1404 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
1405 | if (priv->is_open && !iwl_is_rfkill(priv)) | ||
1406 | queue_work(priv->workqueue, &priv->up); | ||
1407 | } | ||
1663 | 1408 | ||
1664 | handled |= CSR_INT_BIT_RF_KILL; | 1409 | handled |= CSR_INT_BIT_RF_KILL; |
1665 | } | 1410 | } |
@@ -1674,7 +1419,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) | |||
1674 | if (inta & CSR_INT_BIT_SW_ERR) { | 1419 | if (inta & CSR_INT_BIT_SW_ERR) { |
1675 | IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", | 1420 | IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", |
1676 | inta); | 1421 | inta); |
1677 | iwl4965_irq_handle_error(priv); | 1422 | iwl_irq_handle_error(priv); |
1678 | handled |= CSR_INT_BIT_SW_ERR; | 1423 | handled |= CSR_INT_BIT_SW_ERR; |
1679 | } | 1424 | } |
1680 | 1425 | ||
@@ -1720,7 +1465,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) | |||
1720 | /* Re-enable all interrupts */ | 1465 | /* Re-enable all interrupts */ |
1721 | /* only Re-enable if diabled by irq */ | 1466 | /* only Re-enable if diabled by irq */ |
1722 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1467 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1723 | iwl4965_enable_interrupts(priv); | 1468 | iwl_enable_interrupts(priv); |
1724 | 1469 | ||
1725 | #ifdef CONFIG_IWLWIFI_DEBUG | 1470 | #ifdef CONFIG_IWLWIFI_DEBUG |
1726 | if (priv->debug_level & (IWL_DL_ISR)) { | 1471 | if (priv->debug_level & (IWL_DL_ISR)) { |
@@ -1734,7 +1479,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv) | |||
1734 | spin_unlock_irqrestore(&priv->lock, flags); | 1479 | spin_unlock_irqrestore(&priv->lock, flags); |
1735 | } | 1480 | } |
1736 | 1481 | ||
1737 | static irqreturn_t iwl4965_isr(int irq, void *data) | 1482 | static irqreturn_t iwl_isr(int irq, void *data) |
1738 | { | 1483 | { |
1739 | struct iwl_priv *priv = data; | 1484 | struct iwl_priv *priv = data; |
1740 | u32 inta, inta_mask; | 1485 | u32 inta, inta_mask; |
@@ -1766,7 +1511,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
1766 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 1511 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
1767 | /* Hardware disappeared. It might have already raised | 1512 | /* Hardware disappeared. It might have already raised |
1768 | * an interrupt */ | 1513 | * an interrupt */ |
1769 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); | 1514 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%08x\n", inta); |
1770 | goto unplugged; | 1515 | goto unplugged; |
1771 | } | 1516 | } |
1772 | 1517 | ||
@@ -1775,7 +1520,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
1775 | 1520 | ||
1776 | inta &= ~CSR_INT_BIT_SCD; | 1521 | inta &= ~CSR_INT_BIT_SCD; |
1777 | 1522 | ||
1778 | /* iwl4965_irq_tasklet() will service interrupts and re-enable them */ | 1523 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ |
1779 | if (likely(inta || inta_fh)) | 1524 | if (likely(inta || inta_fh)) |
1780 | tasklet_schedule(&priv->irq_tasklet); | 1525 | tasklet_schedule(&priv->irq_tasklet); |
1781 | 1526 | ||
@@ -1787,7 +1532,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
1787 | /* re-enable interrupts here since we don't have anything to service. */ | 1532 | /* re-enable interrupts here since we don't have anything to service. */ |
1788 | /* only Re-enable if diabled by irq */ | 1533 | /* only Re-enable if diabled by irq */ |
1789 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1534 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1790 | iwl4965_enable_interrupts(priv); | 1535 | iwl_enable_interrupts(priv); |
1791 | spin_unlock(&priv->lock); | 1536 | spin_unlock(&priv->lock); |
1792 | return IRQ_NONE; | 1537 | return IRQ_NONE; |
1793 | } | 1538 | } |
@@ -1798,7 +1543,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
1798 | * | 1543 | * |
1799 | ******************************************************************************/ | 1544 | ******************************************************************************/ |
1800 | 1545 | ||
1801 | static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) | 1546 | static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) |
1802 | { | 1547 | { |
1803 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); | 1548 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); |
1804 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); | 1549 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); |
@@ -1808,7 +1553,7 @@ static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) | |||
1808 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1553 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); |
1809 | } | 1554 | } |
1810 | 1555 | ||
1811 | static void iwl4965_nic_start(struct iwl_priv *priv) | 1556 | static void iwl_nic_start(struct iwl_priv *priv) |
1812 | { | 1557 | { |
1813 | /* Remove all resets to allow NIC to operate */ | 1558 | /* Remove all resets to allow NIC to operate */ |
1814 | iwl_write32(priv, CSR_RESET, 0); | 1559 | iwl_write32(priv, CSR_RESET, 0); |
@@ -1816,31 +1561,47 @@ static void iwl4965_nic_start(struct iwl_priv *priv) | |||
1816 | 1561 | ||
1817 | 1562 | ||
1818 | /** | 1563 | /** |
1819 | * iwl4965_read_ucode - Read uCode images from disk file. | 1564 | * iwl_read_ucode - Read uCode images from disk file. |
1820 | * | 1565 | * |
1821 | * Copy into buffers for card to fetch via bus-mastering | 1566 | * Copy into buffers for card to fetch via bus-mastering |
1822 | */ | 1567 | */ |
1823 | static int iwl4965_read_ucode(struct iwl_priv *priv) | 1568 | static int iwl_read_ucode(struct iwl_priv *priv) |
1824 | { | 1569 | { |
1825 | struct iwl_ucode *ucode; | 1570 | struct iwl_ucode *ucode; |
1826 | int ret; | 1571 | int ret = -EINVAL, index; |
1827 | const struct firmware *ucode_raw; | 1572 | const struct firmware *ucode_raw; |
1828 | const char *name = priv->cfg->fw_name; | 1573 | const char *name_pre = priv->cfg->fw_name_pre; |
1574 | const unsigned int api_max = priv->cfg->ucode_api_max; | ||
1575 | const unsigned int api_min = priv->cfg->ucode_api_min; | ||
1576 | char buf[25]; | ||
1829 | u8 *src; | 1577 | u8 *src; |
1830 | size_t len; | 1578 | size_t len; |
1831 | u32 ver, inst_size, data_size, init_size, init_data_size, boot_size; | 1579 | u32 api_ver, inst_size, data_size, init_size, init_data_size, boot_size; |
1832 | 1580 | ||
1833 | /* Ask kernel firmware_class module to get the boot firmware off disk. | 1581 | /* Ask kernel firmware_class module to get the boot firmware off disk. |
1834 | * request_firmware() is synchronous, file is in memory on return. */ | 1582 | * request_firmware() is synchronous, file is in memory on return. */ |
1835 | ret = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); | 1583 | for (index = api_max; index >= api_min; index--) { |
1836 | if (ret < 0) { | 1584 | sprintf(buf, "%s%d%s", name_pre, index, ".ucode"); |
1837 | IWL_ERROR("%s firmware file req failed: Reason %d\n", | 1585 | ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); |
1838 | name, ret); | 1586 | if (ret < 0) { |
1839 | goto error; | 1587 | IWL_ERROR("%s firmware file req failed: Reason %d\n", |
1588 | buf, ret); | ||
1589 | if (ret == -ENOENT) | ||
1590 | continue; | ||
1591 | else | ||
1592 | goto error; | ||
1593 | } else { | ||
1594 | if (index < api_max) | ||
1595 | IWL_ERROR("Loaded firmware %s, which is deprecated. Please use API v%u instead.\n", | ||
1596 | buf, api_max); | ||
1597 | IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n", | ||
1598 | buf, ucode_raw->size); | ||
1599 | break; | ||
1600 | } | ||
1840 | } | 1601 | } |
1841 | 1602 | ||
1842 | IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n", | 1603 | if (ret < 0) |
1843 | name, ucode_raw->size); | 1604 | goto error; |
1844 | 1605 | ||
1845 | /* Make sure that we got at least our header! */ | 1606 | /* Make sure that we got at least our header! */ |
1846 | if (ucode_raw->size < sizeof(*ucode)) { | 1607 | if (ucode_raw->size < sizeof(*ucode)) { |
@@ -1852,14 +1613,40 @@ static int iwl4965_read_ucode(struct iwl_priv *priv) | |||
1852 | /* Data from ucode file: header followed by uCode images */ | 1613 | /* Data from ucode file: header followed by uCode images */ |
1853 | ucode = (void *)ucode_raw->data; | 1614 | ucode = (void *)ucode_raw->data; |
1854 | 1615 | ||
1855 | ver = le32_to_cpu(ucode->ver); | 1616 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
1617 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
1856 | inst_size = le32_to_cpu(ucode->inst_size); | 1618 | inst_size = le32_to_cpu(ucode->inst_size); |
1857 | data_size = le32_to_cpu(ucode->data_size); | 1619 | data_size = le32_to_cpu(ucode->data_size); |
1858 | init_size = le32_to_cpu(ucode->init_size); | 1620 | init_size = le32_to_cpu(ucode->init_size); |
1859 | init_data_size = le32_to_cpu(ucode->init_data_size); | 1621 | init_data_size = le32_to_cpu(ucode->init_data_size); |
1860 | boot_size = le32_to_cpu(ucode->boot_size); | 1622 | boot_size = le32_to_cpu(ucode->boot_size); |
1861 | 1623 | ||
1862 | IWL_DEBUG_INFO("f/w package hdr ucode version = 0x%x\n", ver); | 1624 | /* api_ver should match the api version forming part of the |
1625 | * firmware filename ... but we don't check for that and only rely | ||
1626 | * on the API version read from firware header from here on forward */ | ||
1627 | |||
1628 | if (api_ver < api_min || api_ver > api_max) { | ||
1629 | IWL_ERROR("Driver unable to support your firmware API. " | ||
1630 | "Driver supports v%u, firmware is v%u.\n", | ||
1631 | api_max, api_ver); | ||
1632 | priv->ucode_ver = 0; | ||
1633 | ret = -EINVAL; | ||
1634 | goto err_release; | ||
1635 | } | ||
1636 | if (api_ver != api_max) | ||
1637 | IWL_ERROR("Firmware has old API version. Expected v%u, " | ||
1638 | "got v%u. New firmware can be obtained " | ||
1639 | "from http://www.intellinuxwireless.org.\n", | ||
1640 | api_max, api_ver); | ||
1641 | |||
1642 | printk(KERN_INFO DRV_NAME " loaded firmware version %u.%u.%u.%u\n", | ||
1643 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
1644 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
1645 | IWL_UCODE_API(priv->ucode_ver), | ||
1646 | IWL_UCODE_SERIAL(priv->ucode_ver)); | ||
1647 | |||
1648 | IWL_DEBUG_INFO("f/w package hdr ucode version raw = 0x%x\n", | ||
1649 | priv->ucode_ver); | ||
1863 | IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", | 1650 | IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", |
1864 | inst_size); | 1651 | inst_size); |
1865 | IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", | 1652 | IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", |
@@ -1964,7 +1751,7 @@ static int iwl4965_read_ucode(struct iwl_priv *priv) | |||
1964 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); | 1751 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); |
1965 | 1752 | ||
1966 | /* Runtime data (2nd block) | 1753 | /* Runtime data (2nd block) |
1967 | * NOTE: Copy into backup buffer will be done in iwl4965_up() */ | 1754 | * NOTE: Copy into backup buffer will be done in iwl_up() */ |
1968 | src = &ucode->data[inst_size]; | 1755 | src = &ucode->data[inst_size]; |
1969 | len = priv->ucode_data.len; | 1756 | len = priv->ucode_data.len; |
1970 | IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len); | 1757 | IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len); |
@@ -2002,7 +1789,7 @@ static int iwl4965_read_ucode(struct iwl_priv *priv) | |||
2002 | err_pci_alloc: | 1789 | err_pci_alloc: |
2003 | IWL_ERROR("failed to allocate pci memory\n"); | 1790 | IWL_ERROR("failed to allocate pci memory\n"); |
2004 | ret = -ENOMEM; | 1791 | ret = -ENOMEM; |
2005 | iwl4965_dealloc_ucode_pci(priv); | 1792 | iwl_dealloc_ucode_pci(priv); |
2006 | 1793 | ||
2007 | err_release: | 1794 | err_release: |
2008 | release_firmware(ucode_raw); | 1795 | release_firmware(ucode_raw); |
@@ -2011,6 +1798,10 @@ static int iwl4965_read_ucode(struct iwl_priv *priv) | |||
2011 | return ret; | 1798 | return ret; |
2012 | } | 1799 | } |
2013 | 1800 | ||
1801 | /* temporary */ | ||
1802 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, | ||
1803 | struct sk_buff *skb); | ||
1804 | |||
2014 | /** | 1805 | /** |
2015 | * iwl_alive_start - called after REPLY_ALIVE notification received | 1806 | * iwl_alive_start - called after REPLY_ALIVE notification received |
2016 | * from protocol/runtime uCode (initialization uCode's | 1807 | * from protocol/runtime uCode (initialization uCode's |
@@ -2047,7 +1838,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2047 | goto restart; | 1838 | goto restart; |
2048 | } | 1839 | } |
2049 | 1840 | ||
2050 | /* After the ALIVE response, we can send host commands to 4965 uCode */ | 1841 | /* After the ALIVE response, we can send host commands to the uCode */ |
2051 | set_bit(STATUS_ALIVE, &priv->status); | 1842 | set_bit(STATUS_ALIVE, &priv->status); |
2052 | 1843 | ||
2053 | if (iwl_is_rfkill(priv)) | 1844 | if (iwl_is_rfkill(priv)) |
@@ -2067,17 +1858,17 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2067 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1858 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2068 | } else { | 1859 | } else { |
2069 | /* Initialize our rx_config data */ | 1860 | /* Initialize our rx_config data */ |
2070 | iwl4965_connection_init_rx_config(priv); | 1861 | iwl_connection_init_rx_config(priv, priv->iw_mode); |
2071 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 1862 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
2072 | } | 1863 | } |
2073 | 1864 | ||
2074 | /* Configure Bluetooth device coexistence support */ | 1865 | /* Configure Bluetooth device coexistence support */ |
2075 | iwl4965_send_bt_config(priv); | 1866 | iwl_send_bt_config(priv); |
2076 | 1867 | ||
2077 | iwl_reset_run_time_calib(priv); | 1868 | iwl_reset_run_time_calib(priv); |
2078 | 1869 | ||
2079 | /* Configure the adapter for unassociated operation */ | 1870 | /* Configure the adapter for unassociated operation */ |
2080 | iwl4965_commit_rxon(priv); | 1871 | iwl_commit_rxon(priv); |
2081 | 1872 | ||
2082 | /* At this point, the NIC is initialized and operational */ | 1873 | /* At this point, the NIC is initialized and operational */ |
2083 | iwl_rf_kill_ct_config(priv); | 1874 | iwl_rf_kill_ct_config(priv); |
@@ -2089,12 +1880,21 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2089 | wake_up_interruptible(&priv->wait_command_queue); | 1880 | wake_up_interruptible(&priv->wait_command_queue); |
2090 | 1881 | ||
2091 | if (priv->error_recovering) | 1882 | if (priv->error_recovering) |
2092 | iwl4965_error_recovery(priv); | 1883 | iwl_error_recovery(priv); |
2093 | 1884 | ||
2094 | iwl_power_update_mode(priv, 1); | 1885 | iwl_power_update_mode(priv, 1); |
2095 | 1886 | ||
1887 | /* reassociate for ADHOC mode */ | ||
1888 | if (priv->vif && (priv->iw_mode == NL80211_IFTYPE_ADHOC)) { | ||
1889 | struct sk_buff *beacon = ieee80211_beacon_get(priv->hw, | ||
1890 | priv->vif); | ||
1891 | if (beacon) | ||
1892 | iwl_mac_beacon_update(priv->hw, beacon); | ||
1893 | } | ||
1894 | |||
1895 | |||
2096 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) | 1896 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) |
2097 | iwl4965_set_mode(priv, priv->iw_mode); | 1897 | iwl_set_mode(priv, priv->iw_mode); |
2098 | 1898 | ||
2099 | return; | 1899 | return; |
2100 | 1900 | ||
@@ -2104,7 +1904,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2104 | 1904 | ||
2105 | static void iwl_cancel_deferred_work(struct iwl_priv *priv); | 1905 | static void iwl_cancel_deferred_work(struct iwl_priv *priv); |
2106 | 1906 | ||
2107 | static void __iwl4965_down(struct iwl_priv *priv) | 1907 | static void __iwl_down(struct iwl_priv *priv) |
2108 | { | 1908 | { |
2109 | unsigned long flags; | 1909 | unsigned long flags; |
2110 | int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); | 1910 | int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); |
@@ -2131,14 +1931,14 @@ static void __iwl4965_down(struct iwl_priv *priv) | |||
2131 | 1931 | ||
2132 | /* tell the device to stop sending interrupts */ | 1932 | /* tell the device to stop sending interrupts */ |
2133 | spin_lock_irqsave(&priv->lock, flags); | 1933 | spin_lock_irqsave(&priv->lock, flags); |
2134 | iwl4965_disable_interrupts(priv); | 1934 | iwl_disable_interrupts(priv); |
2135 | spin_unlock_irqrestore(&priv->lock, flags); | 1935 | spin_unlock_irqrestore(&priv->lock, flags); |
2136 | iwl_synchronize_irq(priv); | 1936 | iwl_synchronize_irq(priv); |
2137 | 1937 | ||
2138 | if (priv->mac80211_registered) | 1938 | if (priv->mac80211_registered) |
2139 | ieee80211_stop_queues(priv->hw); | 1939 | ieee80211_stop_queues(priv->hw); |
2140 | 1940 | ||
2141 | /* If we have not previously called iwl4965_init() then | 1941 | /* If we have not previously called iwl_init() then |
2142 | * clear all bits but the RF Kill and SUSPEND bits and return */ | 1942 | * clear all bits but the RF Kill and SUSPEND bits and return */ |
2143 | if (!iwl_is_init(priv)) { | 1943 | if (!iwl_is_init(priv)) { |
2144 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1944 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << |
@@ -2192,8 +1992,6 @@ static void __iwl4965_down(struct iwl_priv *priv) | |||
2192 | priv->cfg->ops->lib->apm_ops.stop(priv); | 1992 | priv->cfg->ops->lib->apm_ops.stop(priv); |
2193 | else | 1993 | else |
2194 | priv->cfg->ops->lib->apm_ops.reset(priv); | 1994 | priv->cfg->ops->lib->apm_ops.reset(priv); |
2195 | priv->cfg->ops->lib->free_shared_mem(priv); | ||
2196 | |||
2197 | exit: | 1995 | exit: |
2198 | memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); | 1996 | memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); |
2199 | 1997 | ||
@@ -2205,10 +2003,10 @@ static void __iwl4965_down(struct iwl_priv *priv) | |||
2205 | iwl_clear_free_frames(priv); | 2003 | iwl_clear_free_frames(priv); |
2206 | } | 2004 | } |
2207 | 2005 | ||
2208 | static void iwl4965_down(struct iwl_priv *priv) | 2006 | static void iwl_down(struct iwl_priv *priv) |
2209 | { | 2007 | { |
2210 | mutex_lock(&priv->mutex); | 2008 | mutex_lock(&priv->mutex); |
2211 | __iwl4965_down(priv); | 2009 | __iwl_down(priv); |
2212 | mutex_unlock(&priv->mutex); | 2010 | mutex_unlock(&priv->mutex); |
2213 | 2011 | ||
2214 | iwl_cancel_deferred_work(priv); | 2012 | iwl_cancel_deferred_work(priv); |
@@ -2216,7 +2014,7 @@ static void iwl4965_down(struct iwl_priv *priv) | |||
2216 | 2014 | ||
2217 | #define MAX_HW_RESTARTS 5 | 2015 | #define MAX_HW_RESTARTS 5 |
2218 | 2016 | ||
2219 | static int __iwl4965_up(struct iwl_priv *priv) | 2017 | static int __iwl_up(struct iwl_priv *priv) |
2220 | { | 2018 | { |
2221 | int i; | 2019 | int i; |
2222 | int ret; | 2020 | int ret; |
@@ -2238,7 +2036,7 @@ static int __iwl4965_up(struct iwl_priv *priv) | |||
2238 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2036 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
2239 | 2037 | ||
2240 | if (iwl_is_rfkill(priv)) { | 2038 | if (iwl_is_rfkill(priv)) { |
2241 | iwl4965_enable_interrupts(priv); | 2039 | iwl_enable_interrupts(priv); |
2242 | IWL_WARNING("Radio disabled by %s RF Kill switch\n", | 2040 | IWL_WARNING("Radio disabled by %s RF Kill switch\n", |
2243 | test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); | 2041 | test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); |
2244 | return 0; | 2042 | return 0; |
@@ -2246,12 +2044,6 @@ static int __iwl4965_up(struct iwl_priv *priv) | |||
2246 | 2044 | ||
2247 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 2045 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
2248 | 2046 | ||
2249 | ret = priv->cfg->ops->lib->alloc_shared_mem(priv); | ||
2250 | if (ret) { | ||
2251 | IWL_ERROR("Unable to allocate shared memory\n"); | ||
2252 | return ret; | ||
2253 | } | ||
2254 | |||
2255 | ret = iwl_hw_nic_init(priv); | 2047 | ret = iwl_hw_nic_init(priv); |
2256 | if (ret) { | 2048 | if (ret) { |
2257 | IWL_ERROR("Unable to init nic\n"); | 2049 | IWL_ERROR("Unable to init nic\n"); |
@@ -2265,7 +2057,7 @@ static int __iwl4965_up(struct iwl_priv *priv) | |||
2265 | 2057 | ||
2266 | /* clear (again), then enable host interrupts */ | 2058 | /* clear (again), then enable host interrupts */ |
2267 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 2059 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
2268 | iwl4965_enable_interrupts(priv); | 2060 | iwl_enable_interrupts(priv); |
2269 | 2061 | ||
2270 | /* really make sure rfkill handshake bits are cleared */ | 2062 | /* really make sure rfkill handshake bits are cleared */ |
2271 | iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2063 | iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
@@ -2295,7 +2087,7 @@ static int __iwl4965_up(struct iwl_priv *priv) | |||
2295 | clear_bit(STATUS_FW_ERROR, &priv->status); | 2087 | clear_bit(STATUS_FW_ERROR, &priv->status); |
2296 | 2088 | ||
2297 | /* start card; "initialize" will load runtime ucode */ | 2089 | /* start card; "initialize" will load runtime ucode */ |
2298 | iwl4965_nic_start(priv); | 2090 | iwl_nic_start(priv); |
2299 | 2091 | ||
2300 | IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); | 2092 | IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); |
2301 | 2093 | ||
@@ -2303,7 +2095,7 @@ static int __iwl4965_up(struct iwl_priv *priv) | |||
2303 | } | 2095 | } |
2304 | 2096 | ||
2305 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2097 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2306 | __iwl4965_down(priv); | 2098 | __iwl_down(priv); |
2307 | clear_bit(STATUS_EXIT_PENDING, &priv->status); | 2099 | clear_bit(STATUS_EXIT_PENDING, &priv->status); |
2308 | 2100 | ||
2309 | /* tried to restart and config the device for as long as our | 2101 | /* tried to restart and config the device for as long as our |
@@ -2345,7 +2137,7 @@ static void iwl_bg_alive_start(struct work_struct *data) | |||
2345 | mutex_unlock(&priv->mutex); | 2137 | mutex_unlock(&priv->mutex); |
2346 | } | 2138 | } |
2347 | 2139 | ||
2348 | static void iwl4965_bg_rf_kill(struct work_struct *work) | 2140 | static void iwl_bg_rf_kill(struct work_struct *work) |
2349 | { | 2141 | { |
2350 | struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); | 2142 | struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); |
2351 | 2143 | ||
@@ -2379,28 +2171,6 @@ static void iwl4965_bg_rf_kill(struct work_struct *work) | |||
2379 | iwl_rfkill_set_hw_state(priv); | 2171 | iwl_rfkill_set_hw_state(priv); |
2380 | } | 2172 | } |
2381 | 2173 | ||
2382 | static void iwl4965_bg_set_monitor(struct work_struct *work) | ||
2383 | { | ||
2384 | struct iwl_priv *priv = container_of(work, | ||
2385 | struct iwl_priv, set_monitor); | ||
2386 | int ret; | ||
2387 | |||
2388 | IWL_DEBUG(IWL_DL_STATE, "setting monitor mode\n"); | ||
2389 | |||
2390 | mutex_lock(&priv->mutex); | ||
2391 | |||
2392 | ret = iwl4965_set_mode(priv, NL80211_IFTYPE_MONITOR); | ||
2393 | |||
2394 | if (ret) { | ||
2395 | if (ret == -EAGAIN) | ||
2396 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); | ||
2397 | else | ||
2398 | IWL_ERROR("iwl4965_set_mode() failed ret = %d\n", ret); | ||
2399 | } | ||
2400 | |||
2401 | mutex_unlock(&priv->mutex); | ||
2402 | } | ||
2403 | |||
2404 | static void iwl_bg_run_time_calib_work(struct work_struct *work) | 2174 | static void iwl_bg_run_time_calib_work(struct work_struct *work) |
2405 | { | 2175 | { |
2406 | struct iwl_priv *priv = container_of(work, struct iwl_priv, | 2176 | struct iwl_priv *priv = container_of(work, struct iwl_priv, |
@@ -2424,7 +2194,7 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
2424 | return; | 2194 | return; |
2425 | } | 2195 | } |
2426 | 2196 | ||
2427 | static void iwl4965_bg_up(struct work_struct *data) | 2197 | static void iwl_bg_up(struct work_struct *data) |
2428 | { | 2198 | { |
2429 | struct iwl_priv *priv = container_of(data, struct iwl_priv, up); | 2199 | struct iwl_priv *priv = container_of(data, struct iwl_priv, up); |
2430 | 2200 | ||
@@ -2432,23 +2202,23 @@ static void iwl4965_bg_up(struct work_struct *data) | |||
2432 | return; | 2202 | return; |
2433 | 2203 | ||
2434 | mutex_lock(&priv->mutex); | 2204 | mutex_lock(&priv->mutex); |
2435 | __iwl4965_up(priv); | 2205 | __iwl_up(priv); |
2436 | mutex_unlock(&priv->mutex); | 2206 | mutex_unlock(&priv->mutex); |
2437 | iwl_rfkill_set_hw_state(priv); | 2207 | iwl_rfkill_set_hw_state(priv); |
2438 | } | 2208 | } |
2439 | 2209 | ||
2440 | static void iwl4965_bg_restart(struct work_struct *data) | 2210 | static void iwl_bg_restart(struct work_struct *data) |
2441 | { | 2211 | { |
2442 | struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); | 2212 | struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); |
2443 | 2213 | ||
2444 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2214 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2445 | return; | 2215 | return; |
2446 | 2216 | ||
2447 | iwl4965_down(priv); | 2217 | iwl_down(priv); |
2448 | queue_work(priv->workqueue, &priv->up); | 2218 | queue_work(priv->workqueue, &priv->up); |
2449 | } | 2219 | } |
2450 | 2220 | ||
2451 | static void iwl4965_bg_rx_replenish(struct work_struct *data) | 2221 | static void iwl_bg_rx_replenish(struct work_struct *data) |
2452 | { | 2222 | { |
2453 | struct iwl_priv *priv = | 2223 | struct iwl_priv *priv = |
2454 | container_of(data, struct iwl_priv, rx_replenish); | 2224 | container_of(data, struct iwl_priv, rx_replenish); |
@@ -2463,11 +2233,10 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data) | |||
2463 | 2233 | ||
2464 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 2234 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
2465 | 2235 | ||
2466 | static void iwl4965_post_associate(struct iwl_priv *priv) | 2236 | static void iwl_post_associate(struct iwl_priv *priv) |
2467 | { | 2237 | { |
2468 | struct ieee80211_conf *conf = NULL; | 2238 | struct ieee80211_conf *conf = NULL; |
2469 | int ret = 0; | 2239 | int ret = 0; |
2470 | DECLARE_MAC_BUF(mac); | ||
2471 | unsigned long flags; | 2240 | unsigned long flags; |
2472 | 2241 | ||
2473 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 2242 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
@@ -2475,9 +2244,8 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2475 | return; | 2244 | return; |
2476 | } | 2245 | } |
2477 | 2246 | ||
2478 | IWL_DEBUG_ASSOC("Associated as %d to: %s\n", | 2247 | IWL_DEBUG_ASSOC("Associated as %d to: %pM\n", |
2479 | priv->assoc_id, | 2248 | priv->assoc_id, priv->active_rxon.bssid_addr); |
2480 | print_mac(mac, priv->active_rxon.bssid_addr)); | ||
2481 | 2249 | ||
2482 | 2250 | ||
2483 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2251 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
@@ -2493,10 +2261,9 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2493 | conf = ieee80211_get_hw_conf(priv->hw); | 2261 | conf = ieee80211_get_hw_conf(priv->hw); |
2494 | 2262 | ||
2495 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2263 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2496 | iwl4965_commit_rxon(priv); | 2264 | iwl_commit_rxon(priv); |
2497 | 2265 | ||
2498 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 2266 | iwl_setup_rxon_timing(priv); |
2499 | iwl4965_setup_rxon_timing(priv); | ||
2500 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 2267 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2501 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 2268 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2502 | if (ret) | 2269 | if (ret) |
@@ -2529,7 +2296,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2529 | 2296 | ||
2530 | } | 2297 | } |
2531 | 2298 | ||
2532 | iwl4965_commit_rxon(priv); | 2299 | iwl_commit_rxon(priv); |
2533 | 2300 | ||
2534 | switch (priv->iw_mode) { | 2301 | switch (priv->iw_mode) { |
2535 | case NL80211_IFTYPE_STATION: | 2302 | case NL80211_IFTYPE_STATION: |
@@ -2541,7 +2308,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2541 | priv->assoc_id = 1; | 2308 | priv->assoc_id = 1; |
2542 | 2309 | ||
2543 | iwl_rxon_add_station(priv, priv->bssid, 0); | 2310 | iwl_rxon_add_station(priv, priv->bssid, 0); |
2544 | iwl4965_send_beacon_cmd(priv); | 2311 | iwl_send_beacon_cmd(priv); |
2545 | 2312 | ||
2546 | break; | 2313 | break; |
2547 | 2314 | ||
@@ -2578,7 +2345,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2578 | 2345 | ||
2579 | #define UCODE_READY_TIMEOUT (4 * HZ) | 2346 | #define UCODE_READY_TIMEOUT (4 * HZ) |
2580 | 2347 | ||
2581 | static int iwl4965_mac_start(struct ieee80211_hw *hw) | 2348 | static int iwl_mac_start(struct ieee80211_hw *hw) |
2582 | { | 2349 | { |
2583 | struct iwl_priv *priv = hw->priv; | 2350 | struct iwl_priv *priv = hw->priv; |
2584 | int ret; | 2351 | int ret; |
@@ -2600,7 +2367,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
2600 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | 2367 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); |
2601 | } | 2368 | } |
2602 | 2369 | ||
2603 | ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, | 2370 | ret = request_irq(priv->pci_dev->irq, iwl_isr, IRQF_SHARED, |
2604 | DRV_NAME, priv); | 2371 | DRV_NAME, priv); |
2605 | if (ret) { | 2372 | if (ret) { |
2606 | IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq); | 2373 | IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq); |
@@ -2615,7 +2382,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
2615 | * ucode filename and max sizes are card-specific. */ | 2382 | * ucode filename and max sizes are card-specific. */ |
2616 | 2383 | ||
2617 | if (!priv->ucode_code.len) { | 2384 | if (!priv->ucode_code.len) { |
2618 | ret = iwl4965_read_ucode(priv); | 2385 | ret = iwl_read_ucode(priv); |
2619 | if (ret) { | 2386 | if (ret) { |
2620 | IWL_ERROR("Could not read microcode: %d\n", ret); | 2387 | IWL_ERROR("Could not read microcode: %d\n", ret); |
2621 | mutex_unlock(&priv->mutex); | 2388 | mutex_unlock(&priv->mutex); |
@@ -2623,7 +2390,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
2623 | } | 2390 | } |
2624 | } | 2391 | } |
2625 | 2392 | ||
2626 | ret = __iwl4965_up(priv); | 2393 | ret = __iwl_up(priv); |
2627 | 2394 | ||
2628 | mutex_unlock(&priv->mutex); | 2395 | mutex_unlock(&priv->mutex); |
2629 | 2396 | ||
@@ -2669,7 +2436,7 @@ out_disable_msi: | |||
2669 | return ret; | 2436 | return ret; |
2670 | } | 2437 | } |
2671 | 2438 | ||
2672 | static void iwl4965_mac_stop(struct ieee80211_hw *hw) | 2439 | static void iwl_mac_stop(struct ieee80211_hw *hw) |
2673 | { | 2440 | { |
2674 | struct iwl_priv *priv = hw->priv; | 2441 | struct iwl_priv *priv = hw->priv; |
2675 | 2442 | ||
@@ -2691,7 +2458,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) | |||
2691 | mutex_unlock(&priv->mutex); | 2458 | mutex_unlock(&priv->mutex); |
2692 | } | 2459 | } |
2693 | 2460 | ||
2694 | iwl4965_down(priv); | 2461 | iwl_down(priv); |
2695 | 2462 | ||
2696 | flush_workqueue(priv->workqueue); | 2463 | flush_workqueue(priv->workqueue); |
2697 | free_irq(priv->pci_dev->irq, priv); | 2464 | free_irq(priv->pci_dev->irq, priv); |
@@ -2702,7 +2469,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) | |||
2702 | IWL_DEBUG_MAC80211("leave\n"); | 2469 | IWL_DEBUG_MAC80211("leave\n"); |
2703 | } | 2470 | } |
2704 | 2471 | ||
2705 | static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 2472 | static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
2706 | { | 2473 | { |
2707 | struct iwl_priv *priv = hw->priv; | 2474 | struct iwl_priv *priv = hw->priv; |
2708 | 2475 | ||
@@ -2718,12 +2485,11 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2718 | return 0; | 2485 | return 0; |
2719 | } | 2486 | } |
2720 | 2487 | ||
2721 | static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | 2488 | static int iwl_mac_add_interface(struct ieee80211_hw *hw, |
2722 | struct ieee80211_if_init_conf *conf) | 2489 | struct ieee80211_if_init_conf *conf) |
2723 | { | 2490 | { |
2724 | struct iwl_priv *priv = hw->priv; | 2491 | struct iwl_priv *priv = hw->priv; |
2725 | unsigned long flags; | 2492 | unsigned long flags; |
2726 | DECLARE_MAC_BUF(mac); | ||
2727 | 2493 | ||
2728 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); | 2494 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
2729 | 2495 | ||
@@ -2734,17 +2500,18 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | |||
2734 | 2500 | ||
2735 | spin_lock_irqsave(&priv->lock, flags); | 2501 | spin_lock_irqsave(&priv->lock, flags); |
2736 | priv->vif = conf->vif; | 2502 | priv->vif = conf->vif; |
2503 | priv->iw_mode = conf->type; | ||
2737 | 2504 | ||
2738 | spin_unlock_irqrestore(&priv->lock, flags); | 2505 | spin_unlock_irqrestore(&priv->lock, flags); |
2739 | 2506 | ||
2740 | mutex_lock(&priv->mutex); | 2507 | mutex_lock(&priv->mutex); |
2741 | 2508 | ||
2742 | if (conf->mac_addr) { | 2509 | if (conf->mac_addr) { |
2743 | IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); | 2510 | IWL_DEBUG_MAC80211("Set %pM\n", conf->mac_addr); |
2744 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | 2511 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); |
2745 | } | 2512 | } |
2746 | 2513 | ||
2747 | if (iwl4965_set_mode(priv, conf->type) == -EAGAIN) | 2514 | if (iwl_set_mode(priv, conf->type) == -EAGAIN) |
2748 | /* we are not ready, will run again when ready */ | 2515 | /* we are not ready, will run again when ready */ |
2749 | set_bit(STATUS_MODE_PENDING, &priv->status); | 2516 | set_bit(STATUS_MODE_PENDING, &priv->status); |
2750 | 2517 | ||
@@ -2755,16 +2522,17 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | |||
2755 | } | 2522 | } |
2756 | 2523 | ||
2757 | /** | 2524 | /** |
2758 | * iwl4965_mac_config - mac80211 config callback | 2525 | * iwl_mac_config - mac80211 config callback |
2759 | * | 2526 | * |
2760 | * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to | 2527 | * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to |
2761 | * be set inappropriately and the driver currently sets the hardware up to | 2528 | * be set inappropriately and the driver currently sets the hardware up to |
2762 | * use it whenever needed. | 2529 | * use it whenever needed. |
2763 | */ | 2530 | */ |
2764 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | 2531 | static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) |
2765 | { | 2532 | { |
2766 | struct iwl_priv *priv = hw->priv; | 2533 | struct iwl_priv *priv = hw->priv; |
2767 | const struct iwl_channel_info *ch_info; | 2534 | const struct iwl_channel_info *ch_info; |
2535 | struct ieee80211_conf *conf = &hw->conf; | ||
2768 | unsigned long flags; | 2536 | unsigned long flags; |
2769 | int ret = 0; | 2537 | int ret = 0; |
2770 | u16 channel; | 2538 | u16 channel; |
@@ -2772,6 +2540,8 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2772 | mutex_lock(&priv->mutex); | 2540 | mutex_lock(&priv->mutex); |
2773 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); | 2541 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); |
2774 | 2542 | ||
2543 | priv->current_ht_config.is_ht = conf->ht.enabled; | ||
2544 | |||
2775 | if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) { | 2545 | if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) { |
2776 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); | 2546 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); |
2777 | goto out; | 2547 | goto out; |
@@ -2829,13 +2599,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2829 | /* The list of supported rates and rate mask can be different | 2599 | /* The list of supported rates and rate mask can be different |
2830 | * for each band; since the band may have changed, reset | 2600 | * for each band; since the band may have changed, reset |
2831 | * the rate mask to what mac80211 lists */ | 2601 | * the rate mask to what mac80211 lists */ |
2832 | iwl4965_set_rate(priv); | 2602 | iwl_set_rate(priv); |
2833 | 2603 | ||
2834 | spin_unlock_irqrestore(&priv->lock, flags); | 2604 | spin_unlock_irqrestore(&priv->lock, flags); |
2835 | 2605 | ||
2836 | #ifdef IEEE80211_CONF_CHANNEL_SWITCH | 2606 | #ifdef IEEE80211_CONF_CHANNEL_SWITCH |
2837 | if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { | 2607 | if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { |
2838 | iwl4965_hw_channel_switch(priv, conf->channel); | 2608 | iwl_hw_channel_switch(priv, conf->channel); |
2839 | goto out; | 2609 | goto out; |
2840 | } | 2610 | } |
2841 | #endif | 2611 | #endif |
@@ -2863,11 +2633,11 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2863 | 2633 | ||
2864 | iwl_set_tx_power(priv, conf->power_level, false); | 2634 | iwl_set_tx_power(priv, conf->power_level, false); |
2865 | 2635 | ||
2866 | iwl4965_set_rate(priv); | 2636 | iwl_set_rate(priv); |
2867 | 2637 | ||
2868 | if (memcmp(&priv->active_rxon, | 2638 | if (memcmp(&priv->active_rxon, |
2869 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | 2639 | &priv->staging_rxon, sizeof(priv->staging_rxon))) |
2870 | iwl4965_commit_rxon(priv); | 2640 | iwl_commit_rxon(priv); |
2871 | else | 2641 | else |
2872 | IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); | 2642 | IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); |
2873 | 2643 | ||
@@ -2878,7 +2648,7 @@ out: | |||
2878 | return ret; | 2648 | return ret; |
2879 | } | 2649 | } |
2880 | 2650 | ||
2881 | static void iwl4965_config_ap(struct iwl_priv *priv) | 2651 | static void iwl_config_ap(struct iwl_priv *priv) |
2882 | { | 2652 | { |
2883 | int ret = 0; | 2653 | int ret = 0; |
2884 | unsigned long flags; | 2654 | unsigned long flags; |
@@ -2887,15 +2657,14 @@ static void iwl4965_config_ap(struct iwl_priv *priv) | |||
2887 | return; | 2657 | return; |
2888 | 2658 | ||
2889 | /* The following should be done only at AP bring up */ | 2659 | /* The following should be done only at AP bring up */ |
2890 | if (!(iwl_is_associated(priv))) { | 2660 | if (!iwl_is_associated(priv)) { |
2891 | 2661 | ||
2892 | /* RXON - unassoc (to set timing command) */ | 2662 | /* RXON - unassoc (to set timing command) */ |
2893 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2663 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2894 | iwl4965_commit_rxon(priv); | 2664 | iwl_commit_rxon(priv); |
2895 | 2665 | ||
2896 | /* RXON Timing */ | 2666 | /* RXON Timing */ |
2897 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 2667 | iwl_setup_rxon_timing(priv); |
2898 | iwl4965_setup_rxon_timing(priv); | ||
2899 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 2668 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
2900 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 2669 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
2901 | if (ret) | 2670 | if (ret) |
@@ -2928,29 +2697,25 @@ static void iwl4965_config_ap(struct iwl_priv *priv) | |||
2928 | } | 2697 | } |
2929 | /* restore RXON assoc */ | 2698 | /* restore RXON assoc */ |
2930 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2699 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2931 | iwl4965_commit_rxon(priv); | 2700 | iwl_commit_rxon(priv); |
2932 | spin_lock_irqsave(&priv->lock, flags); | 2701 | spin_lock_irqsave(&priv->lock, flags); |
2933 | iwl_activate_qos(priv, 1); | 2702 | iwl_activate_qos(priv, 1); |
2934 | spin_unlock_irqrestore(&priv->lock, flags); | 2703 | spin_unlock_irqrestore(&priv->lock, flags); |
2935 | iwl_rxon_add_station(priv, iwl_bcast_addr, 0); | 2704 | iwl_rxon_add_station(priv, iwl_bcast_addr, 0); |
2936 | } | 2705 | } |
2937 | iwl4965_send_beacon_cmd(priv); | 2706 | iwl_send_beacon_cmd(priv); |
2938 | 2707 | ||
2939 | /* FIXME - we need to add code here to detect a totally new | 2708 | /* FIXME - we need to add code here to detect a totally new |
2940 | * configuration, reset the AP, unassoc, rxon timing, assoc, | 2709 | * configuration, reset the AP, unassoc, rxon timing, assoc, |
2941 | * clear sta table, add BCAST sta... */ | 2710 | * clear sta table, add BCAST sta... */ |
2942 | } | 2711 | } |
2943 | 2712 | ||
2944 | /* temporary */ | ||
2945 | static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); | ||
2946 | 2713 | ||
2947 | static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | 2714 | static int iwl_mac_config_interface(struct ieee80211_hw *hw, |
2948 | struct ieee80211_vif *vif, | 2715 | struct ieee80211_vif *vif, |
2949 | struct ieee80211_if_conf *conf) | 2716 | struct ieee80211_if_conf *conf) |
2950 | { | 2717 | { |
2951 | struct iwl_priv *priv = hw->priv; | 2718 | struct iwl_priv *priv = hw->priv; |
2952 | DECLARE_MAC_BUF(mac); | ||
2953 | unsigned long flags; | ||
2954 | int rc; | 2719 | int rc; |
2955 | 2720 | ||
2956 | if (conf == NULL) | 2721 | if (conf == NULL) |
@@ -2966,26 +2731,20 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2966 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 2731 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
2967 | if (!beacon) | 2732 | if (!beacon) |
2968 | return -ENOMEM; | 2733 | return -ENOMEM; |
2969 | rc = iwl4965_mac_beacon_update(hw, beacon); | 2734 | mutex_lock(&priv->mutex); |
2735 | rc = iwl_mac_beacon_update(hw, beacon); | ||
2736 | mutex_unlock(&priv->mutex); | ||
2970 | if (rc) | 2737 | if (rc) |
2971 | return rc; | 2738 | return rc; |
2972 | } | 2739 | } |
2973 | 2740 | ||
2974 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && | ||
2975 | (!conf->ssid_len)) { | ||
2976 | IWL_DEBUG_MAC80211 | ||
2977 | ("Leaving in AP mode because HostAPD is not ready.\n"); | ||
2978 | return 0; | ||
2979 | } | ||
2980 | |||
2981 | if (!iwl_is_alive(priv)) | 2741 | if (!iwl_is_alive(priv)) |
2982 | return -EAGAIN; | 2742 | return -EAGAIN; |
2983 | 2743 | ||
2984 | mutex_lock(&priv->mutex); | 2744 | mutex_lock(&priv->mutex); |
2985 | 2745 | ||
2986 | if (conf->bssid) | 2746 | if (conf->bssid) |
2987 | IWL_DEBUG_MAC80211("bssid: %s\n", | 2747 | IWL_DEBUG_MAC80211("bssid: %pM\n", conf->bssid); |
2988 | print_mac(mac, conf->bssid)); | ||
2989 | 2748 | ||
2990 | /* | 2749 | /* |
2991 | * very dubious code was here; the probe filtering flag is never set: | 2750 | * very dubious code was here; the probe filtering flag is never set: |
@@ -2998,8 +2757,8 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2998 | if (!conf->bssid) { | 2757 | if (!conf->bssid) { |
2999 | conf->bssid = priv->mac_addr; | 2758 | conf->bssid = priv->mac_addr; |
3000 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 2759 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
3001 | IWL_DEBUG_MAC80211("bssid was set to: %s\n", | 2760 | IWL_DEBUG_MAC80211("bssid was set to: %pM\n", |
3002 | print_mac(mac, conf->bssid)); | 2761 | conf->bssid); |
3003 | } | 2762 | } |
3004 | if (priv->ibss_beacon) | 2763 | if (priv->ibss_beacon) |
3005 | dev_kfree_skb(priv->ibss_beacon); | 2764 | dev_kfree_skb(priv->ibss_beacon); |
@@ -3030,9 +2789,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3030 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 2789 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
3031 | 2790 | ||
3032 | if (priv->iw_mode == NL80211_IFTYPE_AP) | 2791 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
3033 | iwl4965_config_ap(priv); | 2792 | iwl_config_ap(priv); |
3034 | else { | 2793 | else { |
3035 | rc = iwl4965_commit_rxon(priv); | 2794 | rc = iwl_commit_rxon(priv); |
3036 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | 2795 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) |
3037 | iwl_rxon_add_station( | 2796 | iwl_rxon_add_station( |
3038 | priv, priv->active_rxon.bssid_addr, 1); | 2797 | priv, priv->active_rxon.bssid_addr, 1); |
@@ -3041,45 +2800,63 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3041 | } else { | 2800 | } else { |
3042 | iwl_scan_cancel_timeout(priv, 100); | 2801 | iwl_scan_cancel_timeout(priv, 100); |
3043 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2802 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3044 | iwl4965_commit_rxon(priv); | 2803 | iwl_commit_rxon(priv); |
3045 | } | 2804 | } |
3046 | 2805 | ||
3047 | done: | 2806 | done: |
3048 | spin_lock_irqsave(&priv->lock, flags); | ||
3049 | if (!conf->ssid_len) | ||
3050 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | ||
3051 | else | ||
3052 | memcpy(priv->essid, conf->ssid, conf->ssid_len); | ||
3053 | |||
3054 | priv->essid_len = conf->ssid_len; | ||
3055 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3056 | |||
3057 | IWL_DEBUG_MAC80211("leave\n"); | 2807 | IWL_DEBUG_MAC80211("leave\n"); |
3058 | mutex_unlock(&priv->mutex); | 2808 | mutex_unlock(&priv->mutex); |
3059 | 2809 | ||
3060 | return 0; | 2810 | return 0; |
3061 | } | 2811 | } |
3062 | 2812 | ||
3063 | static void iwl4965_configure_filter(struct ieee80211_hw *hw, | 2813 | static void iwl_configure_filter(struct ieee80211_hw *hw, |
3064 | unsigned int changed_flags, | 2814 | unsigned int changed_flags, |
3065 | unsigned int *total_flags, | 2815 | unsigned int *total_flags, |
3066 | int mc_count, struct dev_addr_list *mc_list) | 2816 | int mc_count, struct dev_addr_list *mc_list) |
3067 | { | 2817 | { |
3068 | struct iwl_priv *priv = hw->priv; | 2818 | struct iwl_priv *priv = hw->priv; |
2819 | __le32 *filter_flags = &priv->staging_rxon.filter_flags; | ||
3069 | 2820 | ||
3070 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 2821 | IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n", |
3071 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 2822 | changed_flags, *total_flags); |
3072 | NL80211_IFTYPE_MONITOR, | 2823 | |
3073 | changed_flags, *total_flags); | 2824 | if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { |
3074 | /* queue work 'cuz mac80211 is holding a lock which | 2825 | if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) |
3075 | * prevents us from issuing (synchronous) f/w cmds */ | 2826 | *filter_flags |= RXON_FILTER_PROMISC_MSK; |
3076 | queue_work(priv->workqueue, &priv->set_monitor); | 2827 | else |
2828 | *filter_flags &= ~RXON_FILTER_PROMISC_MSK; | ||
2829 | } | ||
2830 | if (changed_flags & FIF_ALLMULTI) { | ||
2831 | if (*total_flags & FIF_ALLMULTI) | ||
2832 | *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK; | ||
2833 | else | ||
2834 | *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK; | ||
2835 | } | ||
2836 | if (changed_flags & FIF_CONTROL) { | ||
2837 | if (*total_flags & FIF_CONTROL) | ||
2838 | *filter_flags |= RXON_FILTER_CTL2HOST_MSK; | ||
2839 | else | ||
2840 | *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK; | ||
3077 | } | 2841 | } |
3078 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | | 2842 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
2843 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | ||
2844 | *filter_flags |= RXON_FILTER_BCON_AWARE_MSK; | ||
2845 | else | ||
2846 | *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK; | ||
2847 | } | ||
2848 | |||
2849 | /* We avoid iwl_commit_rxon here to commit the new filter flags | ||
2850 | * since mac80211 will call ieee80211_hw_config immediately. | ||
2851 | * (mc_list is not supported at this time). Otherwise, we need to | ||
2852 | * queue a background iwl_commit_rxon work. | ||
2853 | */ | ||
2854 | |||
2855 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | ||
3079 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 2856 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
3080 | } | 2857 | } |
3081 | 2858 | ||
3082 | static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | 2859 | static void iwl_mac_remove_interface(struct ieee80211_hw *hw, |
3083 | struct ieee80211_if_init_conf *conf) | 2860 | struct ieee80211_if_init_conf *conf) |
3084 | { | 2861 | { |
3085 | struct iwl_priv *priv = hw->priv; | 2862 | struct iwl_priv *priv = hw->priv; |
@@ -3091,13 +2868,11 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | |||
3091 | if (iwl_is_ready_rf(priv)) { | 2868 | if (iwl_is_ready_rf(priv)) { |
3092 | iwl_scan_cancel_timeout(priv, 100); | 2869 | iwl_scan_cancel_timeout(priv, 100); |
3093 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2870 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3094 | iwl4965_commit_rxon(priv); | 2871 | iwl_commit_rxon(priv); |
3095 | } | 2872 | } |
3096 | if (priv->vif == conf->vif) { | 2873 | if (priv->vif == conf->vif) { |
3097 | priv->vif = NULL; | 2874 | priv->vif = NULL; |
3098 | memset(priv->bssid, 0, ETH_ALEN); | 2875 | memset(priv->bssid, 0, ETH_ALEN); |
3099 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | ||
3100 | priv->essid_len = 0; | ||
3101 | } | 2876 | } |
3102 | mutex_unlock(&priv->mutex); | 2877 | mutex_unlock(&priv->mutex); |
3103 | 2878 | ||
@@ -3106,7 +2881,7 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | |||
3106 | } | 2881 | } |
3107 | 2882 | ||
3108 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | 2883 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) |
3109 | static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | 2884 | static void iwl_bss_info_changed(struct ieee80211_hw *hw, |
3110 | struct ieee80211_vif *vif, | 2885 | struct ieee80211_vif *vif, |
3111 | struct ieee80211_bss_conf *bss_conf, | 2886 | struct ieee80211_bss_conf *bss_conf, |
3112 | u32 changes) | 2887 | u32 changes) |
@@ -3133,8 +2908,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
3133 | } | 2908 | } |
3134 | 2909 | ||
3135 | if (changes & BSS_CHANGED_HT) { | 2910 | if (changes & BSS_CHANGED_HT) { |
3136 | IWL_DEBUG_MAC80211("HT %d\n", bss_conf->assoc_ht); | 2911 | iwl_ht_conf(priv, bss_conf); |
3137 | iwl4965_ht_conf(priv, bss_conf); | ||
3138 | iwl_set_rxon_chain(priv); | 2912 | iwl_set_rxon_chain(priv); |
3139 | } | 2913 | } |
3140 | 2914 | ||
@@ -3157,7 +2931,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
3157 | priv->next_scan_jiffies = jiffies + | 2931 | priv->next_scan_jiffies = jiffies + |
3158 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | 2932 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; |
3159 | mutex_lock(&priv->mutex); | 2933 | mutex_lock(&priv->mutex); |
3160 | iwl4965_post_associate(priv); | 2934 | iwl_post_associate(priv); |
3161 | mutex_unlock(&priv->mutex); | 2935 | mutex_unlock(&priv->mutex); |
3162 | } else { | 2936 | } else { |
3163 | priv->assoc_id = 0; | 2937 | priv->assoc_id = 0; |
@@ -3187,12 +2961,6 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len) | |||
3187 | goto out_unlock; | 2961 | goto out_unlock; |
3188 | } | 2962 | } |
3189 | 2963 | ||
3190 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ | ||
3191 | ret = -EIO; | ||
3192 | IWL_ERROR("ERROR: APs don't scan\n"); | ||
3193 | goto out_unlock; | ||
3194 | } | ||
3195 | |||
3196 | /* We don't schedule scan within next_scan_jiffies period. | 2964 | /* We don't schedule scan within next_scan_jiffies period. |
3197 | * Avoid scanning during possible EAPOL exchange, return | 2965 | * Avoid scanning during possible EAPOL exchange, return |
3198 | * success immediately. | 2966 | * success immediately. |
@@ -3233,64 +3001,24 @@ out_unlock: | |||
3233 | return ret; | 3001 | return ret; |
3234 | } | 3002 | } |
3235 | 3003 | ||
3236 | static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | 3004 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, |
3237 | struct ieee80211_key_conf *keyconf, const u8 *addr, | 3005 | struct ieee80211_key_conf *keyconf, const u8 *addr, |
3238 | u32 iv32, u16 *phase1key) | 3006 | u32 iv32, u16 *phase1key) |
3239 | { | 3007 | { |
3240 | struct iwl_priv *priv = hw->priv; | ||
3241 | u8 sta_id = IWL_INVALID_STATION; | ||
3242 | unsigned long flags; | ||
3243 | __le16 key_flags = 0; | ||
3244 | int i; | ||
3245 | DECLARE_MAC_BUF(mac); | ||
3246 | 3008 | ||
3009 | struct iwl_priv *priv = hw->priv; | ||
3247 | IWL_DEBUG_MAC80211("enter\n"); | 3010 | IWL_DEBUG_MAC80211("enter\n"); |
3248 | 3011 | ||
3249 | sta_id = iwl_find_station(priv, addr); | 3012 | iwl_update_tkip_key(priv, keyconf, addr, iv32, phase1key); |
3250 | if (sta_id == IWL_INVALID_STATION) { | ||
3251 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | ||
3252 | print_mac(mac, addr)); | ||
3253 | return; | ||
3254 | } | ||
3255 | |||
3256 | if (iwl_scan_cancel(priv)) { | ||
3257 | /* cancel scan failed, just live w/ bad key and rely | ||
3258 | briefly on SW decryption */ | ||
3259 | return; | ||
3260 | } | ||
3261 | |||
3262 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | ||
3263 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | ||
3264 | key_flags &= ~STA_KEY_FLG_INVALID; | ||
3265 | |||
3266 | if (sta_id == priv->hw_params.bcast_sta_id) | ||
3267 | key_flags |= STA_KEY_MULTICAST_MSK; | ||
3268 | |||
3269 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
3270 | |||
3271 | priv->stations[sta_id].sta.key.key_flags = key_flags; | ||
3272 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | ||
3273 | |||
3274 | for (i = 0; i < 5; i++) | ||
3275 | priv->stations[sta_id].sta.key.tkip_rx_ttak[i] = | ||
3276 | cpu_to_le16(phase1key[i]); | ||
3277 | |||
3278 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | ||
3279 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
3280 | |||
3281 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | ||
3282 | |||
3283 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
3284 | 3013 | ||
3285 | IWL_DEBUG_MAC80211("leave\n"); | 3014 | IWL_DEBUG_MAC80211("leave\n"); |
3286 | } | 3015 | } |
3287 | 3016 | ||
3288 | static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 3017 | static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
3289 | const u8 *local_addr, const u8 *addr, | 3018 | const u8 *local_addr, const u8 *addr, |
3290 | struct ieee80211_key_conf *key) | 3019 | struct ieee80211_key_conf *key) |
3291 | { | 3020 | { |
3292 | struct iwl_priv *priv = hw->priv; | 3021 | struct iwl_priv *priv = hw->priv; |
3293 | DECLARE_MAC_BUF(mac); | ||
3294 | int ret = 0; | 3022 | int ret = 0; |
3295 | u8 sta_id = IWL_INVALID_STATION; | 3023 | u8 sta_id = IWL_INVALID_STATION; |
3296 | u8 is_default_wep_key = 0; | 3024 | u8 is_default_wep_key = 0; |
@@ -3308,8 +3036,8 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3308 | 3036 | ||
3309 | sta_id = iwl_find_station(priv, addr); | 3037 | sta_id = iwl_find_station(priv, addr); |
3310 | if (sta_id == IWL_INVALID_STATION) { | 3038 | if (sta_id == IWL_INVALID_STATION) { |
3311 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | 3039 | IWL_DEBUG_MAC80211("leave - %pM not in station map.\n", |
3312 | print_mac(mac, addr)); | 3040 | addr); |
3313 | return -EINVAL; | 3041 | return -EINVAL; |
3314 | 3042 | ||
3315 | } | 3043 | } |
@@ -3357,7 +3085,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3357 | return ret; | 3085 | return ret; |
3358 | } | 3086 | } |
3359 | 3087 | ||
3360 | static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | 3088 | static int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
3361 | const struct ieee80211_tx_queue_params *params) | 3089 | const struct ieee80211_tx_queue_params *params) |
3362 | { | 3090 | { |
3363 | struct iwl_priv *priv = hw->priv; | 3091 | struct iwl_priv *priv = hw->priv; |
@@ -3376,11 +3104,6 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3376 | return 0; | 3104 | return 0; |
3377 | } | 3105 | } |
3378 | 3106 | ||
3379 | if (!priv->qos_data.qos_enable) { | ||
3380 | priv->qos_data.qos_active = 0; | ||
3381 | IWL_DEBUG_MAC80211("leave - qos not enabled\n"); | ||
3382 | return 0; | ||
3383 | } | ||
3384 | q = AC_NUM - 1 - queue; | 3107 | q = AC_NUM - 1 - queue; |
3385 | 3108 | ||
3386 | spin_lock_irqsave(&priv->lock, flags); | 3109 | spin_lock_irqsave(&priv->lock, flags); |
@@ -3405,15 +3128,14 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3405 | return 0; | 3128 | return 0; |
3406 | } | 3129 | } |
3407 | 3130 | ||
3408 | static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | 3131 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, |
3409 | enum ieee80211_ampdu_mlme_action action, | 3132 | enum ieee80211_ampdu_mlme_action action, |
3410 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 3133 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
3411 | { | 3134 | { |
3412 | struct iwl_priv *priv = hw->priv; | 3135 | struct iwl_priv *priv = hw->priv; |
3413 | DECLARE_MAC_BUF(mac); | ||
3414 | 3136 | ||
3415 | IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", | 3137 | IWL_DEBUG_HT("A-MPDU action on addr %pM tid %d\n", |
3416 | print_mac(mac, sta->addr), tid); | 3138 | sta->addr, tid); |
3417 | 3139 | ||
3418 | if (!(priv->cfg->sku & IWL_SKU_N)) | 3140 | if (!(priv->cfg->sku & IWL_SKU_N)) |
3419 | return -EACCES; | 3141 | return -EACCES; |
@@ -3421,10 +3143,10 @@ static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3421 | switch (action) { | 3143 | switch (action) { |
3422 | case IEEE80211_AMPDU_RX_START: | 3144 | case IEEE80211_AMPDU_RX_START: |
3423 | IWL_DEBUG_HT("start Rx\n"); | 3145 | IWL_DEBUG_HT("start Rx\n"); |
3424 | return iwl_rx_agg_start(priv, sta->addr, tid, *ssn); | 3146 | return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn); |
3425 | case IEEE80211_AMPDU_RX_STOP: | 3147 | case IEEE80211_AMPDU_RX_STOP: |
3426 | IWL_DEBUG_HT("stop Rx\n"); | 3148 | IWL_DEBUG_HT("stop Rx\n"); |
3427 | return iwl_rx_agg_stop(priv, sta->addr, tid); | 3149 | return iwl_sta_rx_agg_stop(priv, sta->addr, tid); |
3428 | case IEEE80211_AMPDU_TX_START: | 3150 | case IEEE80211_AMPDU_TX_START: |
3429 | IWL_DEBUG_HT("start Tx\n"); | 3151 | IWL_DEBUG_HT("start Tx\n"); |
3430 | return iwl_tx_agg_start(priv, sta->addr, tid, ssn); | 3152 | return iwl_tx_agg_start(priv, sta->addr, tid, ssn); |
@@ -3438,7 +3160,8 @@ static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3438 | } | 3160 | } |
3439 | return 0; | 3161 | return 0; |
3440 | } | 3162 | } |
3441 | static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, | 3163 | |
3164 | static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, | ||
3442 | struct ieee80211_tx_queue_stats *stats) | 3165 | struct ieee80211_tx_queue_stats *stats) |
3443 | { | 3166 | { |
3444 | struct iwl_priv *priv = hw->priv; | 3167 | struct iwl_priv *priv = hw->priv; |
@@ -3473,7 +3196,7 @@ static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, | |||
3473 | return 0; | 3196 | return 0; |
3474 | } | 3197 | } |
3475 | 3198 | ||
3476 | static int iwl4965_mac_get_stats(struct ieee80211_hw *hw, | 3199 | static int iwl_mac_get_stats(struct ieee80211_hw *hw, |
3477 | struct ieee80211_low_level_stats *stats) | 3200 | struct ieee80211_low_level_stats *stats) |
3478 | { | 3201 | { |
3479 | struct iwl_priv *priv = hw->priv; | 3202 | struct iwl_priv *priv = hw->priv; |
@@ -3485,7 +3208,7 @@ static int iwl4965_mac_get_stats(struct ieee80211_hw *hw, | |||
3485 | return 0; | 3208 | return 0; |
3486 | } | 3209 | } |
3487 | 3210 | ||
3488 | static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | 3211 | static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) |
3489 | { | 3212 | { |
3490 | struct iwl_priv *priv = hw->priv; | 3213 | struct iwl_priv *priv = hw->priv; |
3491 | unsigned long flags; | 3214 | unsigned long flags; |
@@ -3529,7 +3252,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3529 | if (priv->iw_mode != NL80211_IFTYPE_AP) { | 3252 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
3530 | iwl_scan_cancel_timeout(priv, 100); | 3253 | iwl_scan_cancel_timeout(priv, 100); |
3531 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3254 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3532 | iwl4965_commit_rxon(priv); | 3255 | iwl_commit_rxon(priv); |
3533 | } | 3256 | } |
3534 | 3257 | ||
3535 | iwl_power_update_mode(priv, 0); | 3258 | iwl_power_update_mode(priv, 0); |
@@ -3552,31 +3275,28 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3552 | return; | 3275 | return; |
3553 | } | 3276 | } |
3554 | 3277 | ||
3555 | iwl4965_set_rate(priv); | 3278 | iwl_set_rate(priv); |
3556 | 3279 | ||
3557 | mutex_unlock(&priv->mutex); | 3280 | mutex_unlock(&priv->mutex); |
3558 | 3281 | ||
3559 | IWL_DEBUG_MAC80211("leave\n"); | 3282 | IWL_DEBUG_MAC80211("leave\n"); |
3560 | } | 3283 | } |
3561 | 3284 | ||
3562 | static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | 3285 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) |
3563 | { | 3286 | { |
3564 | struct iwl_priv *priv = hw->priv; | 3287 | struct iwl_priv *priv = hw->priv; |
3565 | unsigned long flags; | 3288 | unsigned long flags; |
3566 | __le64 timestamp; | 3289 | __le64 timestamp; |
3567 | 3290 | ||
3568 | mutex_lock(&priv->mutex); | ||
3569 | IWL_DEBUG_MAC80211("enter\n"); | 3291 | IWL_DEBUG_MAC80211("enter\n"); |
3570 | 3292 | ||
3571 | if (!iwl_is_ready_rf(priv)) { | 3293 | if (!iwl_is_ready_rf(priv)) { |
3572 | IWL_DEBUG_MAC80211("leave - RF not ready\n"); | 3294 | IWL_DEBUG_MAC80211("leave - RF not ready\n"); |
3573 | mutex_unlock(&priv->mutex); | ||
3574 | return -EIO; | 3295 | return -EIO; |
3575 | } | 3296 | } |
3576 | 3297 | ||
3577 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | 3298 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
3578 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 3299 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
3579 | mutex_unlock(&priv->mutex); | ||
3580 | return -EIO; | 3300 | return -EIO; |
3581 | } | 3301 | } |
3582 | 3302 | ||
@@ -3596,9 +3316,8 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
3596 | 3316 | ||
3597 | iwl_reset_qos(priv); | 3317 | iwl_reset_qos(priv); |
3598 | 3318 | ||
3599 | iwl4965_post_associate(priv); | 3319 | iwl_post_associate(priv); |
3600 | 3320 | ||
3601 | mutex_unlock(&priv->mutex); | ||
3602 | 3321 | ||
3603 | return 0; | 3322 | return 0; |
3604 | } | 3323 | } |
@@ -3613,7 +3332,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
3613 | 3332 | ||
3614 | /* | 3333 | /* |
3615 | * The following adds a new attribute to the sysfs representation | 3334 | * The following adds a new attribute to the sysfs representation |
3616 | * of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/) | 3335 | * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) |
3617 | * used for controlling the debug level. | 3336 | * used for controlling the debug level. |
3618 | * | 3337 | * |
3619 | * See the level definitions in iwl for details. | 3338 | * See the level definitions in iwl for details. |
@@ -3699,7 +3418,11 @@ static ssize_t show_tx_power(struct device *d, | |||
3699 | struct device_attribute *attr, char *buf) | 3418 | struct device_attribute *attr, char *buf) |
3700 | { | 3419 | { |
3701 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 3420 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
3702 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | 3421 | |
3422 | if (!iwl_is_ready_rf(priv)) | ||
3423 | return sprintf(buf, "off\n"); | ||
3424 | else | ||
3425 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | ||
3703 | } | 3426 | } |
3704 | 3427 | ||
3705 | static ssize_t store_tx_power(struct device *d, | 3428 | static ssize_t store_tx_power(struct device *d, |
@@ -3750,7 +3473,7 @@ static ssize_t store_flags(struct device *d, | |||
3750 | else { | 3473 | else { |
3751 | IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags); | 3474 | IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags); |
3752 | priv->staging_rxon.flags = cpu_to_le32(flags); | 3475 | priv->staging_rxon.flags = cpu_to_le32(flags); |
3753 | iwl4965_commit_rxon(priv); | 3476 | iwl_commit_rxon(priv); |
3754 | } | 3477 | } |
3755 | } | 3478 | } |
3756 | mutex_unlock(&priv->mutex); | 3479 | mutex_unlock(&priv->mutex); |
@@ -3791,7 +3514,7 @@ static ssize_t store_filter_flags(struct device *d, | |||
3791 | "0x%04X\n", filter_flags); | 3514 | "0x%04X\n", filter_flags); |
3792 | priv->staging_rxon.filter_flags = | 3515 | priv->staging_rxon.filter_flags = |
3793 | cpu_to_le32(filter_flags); | 3516 | cpu_to_le32(filter_flags); |
3794 | iwl4965_commit_rxon(priv); | 3517 | iwl_commit_rxon(priv); |
3795 | } | 3518 | } |
3796 | } | 3519 | } |
3797 | mutex_unlock(&priv->mutex); | 3520 | mutex_unlock(&priv->mutex); |
@@ -3802,79 +3525,6 @@ static ssize_t store_filter_flags(struct device *d, | |||
3802 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, | 3525 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, |
3803 | store_filter_flags); | 3526 | store_filter_flags); |
3804 | 3527 | ||
3805 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | ||
3806 | |||
3807 | static ssize_t show_measurement(struct device *d, | ||
3808 | struct device_attribute *attr, char *buf) | ||
3809 | { | ||
3810 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
3811 | struct iwl4965_spectrum_notification measure_report; | ||
3812 | u32 size = sizeof(measure_report), len = 0, ofs = 0; | ||
3813 | u8 *data = (u8 *)&measure_report; | ||
3814 | unsigned long flags; | ||
3815 | |||
3816 | spin_lock_irqsave(&priv->lock, flags); | ||
3817 | if (!(priv->measurement_status & MEASUREMENT_READY)) { | ||
3818 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3819 | return 0; | ||
3820 | } | ||
3821 | memcpy(&measure_report, &priv->measure_report, size); | ||
3822 | priv->measurement_status = 0; | ||
3823 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3824 | |||
3825 | while (size && (PAGE_SIZE - len)) { | ||
3826 | hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, | ||
3827 | PAGE_SIZE - len, 1); | ||
3828 | len = strlen(buf); | ||
3829 | if (PAGE_SIZE - len) | ||
3830 | buf[len++] = '\n'; | ||
3831 | |||
3832 | ofs += 16; | ||
3833 | size -= min(size, 16U); | ||
3834 | } | ||
3835 | |||
3836 | return len; | ||
3837 | } | ||
3838 | |||
3839 | static ssize_t store_measurement(struct device *d, | ||
3840 | struct device_attribute *attr, | ||
3841 | const char *buf, size_t count) | ||
3842 | { | ||
3843 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
3844 | struct ieee80211_measurement_params params = { | ||
3845 | .channel = le16_to_cpu(priv->active_rxon.channel), | ||
3846 | .start_time = cpu_to_le64(priv->last_tsf), | ||
3847 | .duration = cpu_to_le16(1), | ||
3848 | }; | ||
3849 | u8 type = IWL_MEASURE_BASIC; | ||
3850 | u8 buffer[32]; | ||
3851 | u8 channel; | ||
3852 | |||
3853 | if (count) { | ||
3854 | char *p = buffer; | ||
3855 | strncpy(buffer, buf, min(sizeof(buffer), count)); | ||
3856 | channel = simple_strtoul(p, NULL, 0); | ||
3857 | if (channel) | ||
3858 | params.channel = channel; | ||
3859 | |||
3860 | p = buffer; | ||
3861 | while (*p && *p != ' ') | ||
3862 | p++; | ||
3863 | if (*p) | ||
3864 | type = simple_strtoul(p + 1, NULL, 0); | ||
3865 | } | ||
3866 | |||
3867 | IWL_DEBUG_INFO("Invoking measurement of type %d on " | ||
3868 | "channel %d (for '%s')\n", type, params.channel, buf); | ||
3869 | iwl4965_get_measurement(priv, ¶ms, type); | ||
3870 | |||
3871 | return count; | ||
3872 | } | ||
3873 | |||
3874 | static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, | ||
3875 | show_measurement, store_measurement); | ||
3876 | #endif /* CONFIG_IWLAGN_SPECTRUM_MEASUREMENT */ | ||
3877 | |||
3878 | static ssize_t store_retry_rate(struct device *d, | 3528 | static ssize_t store_retry_rate(struct device *d, |
3879 | struct device_attribute *attr, | 3529 | struct device_attribute *attr, |
3880 | const char *buf, size_t count) | 3530 | const char *buf, size_t count) |
@@ -3953,7 +3603,8 @@ static ssize_t show_power_level(struct device *d, | |||
3953 | break; | 3603 | break; |
3954 | } | 3604 | } |
3955 | 3605 | ||
3956 | p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO)?"fixed":"auto"); | 3606 | p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ? |
3607 | "fixed" : "auto"); | ||
3957 | p += sprintf(p, "\tINDEX:%d", level); | 3608 | p += sprintf(p, "\tINDEX:%d", level); |
3958 | p += sprintf(p, "\n"); | 3609 | p += sprintf(p, "\n"); |
3959 | return p - buf + 1; | 3610 | return p - buf + 1; |
@@ -3962,68 +3613,6 @@ static ssize_t show_power_level(struct device *d, | |||
3962 | static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, | 3613 | static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, |
3963 | store_power_level); | 3614 | store_power_level); |
3964 | 3615 | ||
3965 | static ssize_t show_channels(struct device *d, | ||
3966 | struct device_attribute *attr, char *buf) | ||
3967 | { | ||
3968 | |||
3969 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
3970 | struct ieee80211_channel *channels = NULL; | ||
3971 | const struct ieee80211_supported_band *supp_band = NULL; | ||
3972 | int len = 0, i; | ||
3973 | int count = 0; | ||
3974 | |||
3975 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | ||
3976 | return -EAGAIN; | ||
3977 | |||
3978 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | ||
3979 | channels = supp_band->channels; | ||
3980 | count = supp_band->n_channels; | ||
3981 | |||
3982 | len += sprintf(&buf[len], | ||
3983 | "Displaying %d channels in 2.4GHz band " | ||
3984 | "(802.11bg):\n", count); | ||
3985 | |||
3986 | for (i = 0; i < count; i++) | ||
3987 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
3988 | ieee80211_frequency_to_channel( | ||
3989 | channels[i].center_freq), | ||
3990 | channels[i].max_power, | ||
3991 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
3992 | " (IEEE 802.11h required)" : "", | ||
3993 | (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
3994 | || (channels[i].flags & | ||
3995 | IEEE80211_CHAN_RADAR)) ? "" : | ||
3996 | ", IBSS", | ||
3997 | channels[i].flags & | ||
3998 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
3999 | "passive only" : "active/passive"); | ||
4000 | |||
4001 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); | ||
4002 | channels = supp_band->channels; | ||
4003 | count = supp_band->n_channels; | ||
4004 | |||
4005 | len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band " | ||
4006 | "(802.11a):\n", count); | ||
4007 | |||
4008 | for (i = 0; i < count; i++) | ||
4009 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
4010 | ieee80211_frequency_to_channel( | ||
4011 | channels[i].center_freq), | ||
4012 | channels[i].max_power, | ||
4013 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
4014 | " (IEEE 802.11h required)" : "", | ||
4015 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
4016 | || (channels[i].flags & | ||
4017 | IEEE80211_CHAN_RADAR)) ? "" : | ||
4018 | ", IBSS", | ||
4019 | channels[i].flags & | ||
4020 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
4021 | "passive only" : "active/passive"); | ||
4022 | |||
4023 | return len; | ||
4024 | } | ||
4025 | |||
4026 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | ||
4027 | 3616 | ||
4028 | static ssize_t show_statistics(struct device *d, | 3617 | static ssize_t show_statistics(struct device *d, |
4029 | struct device_attribute *attr, char *buf) | 3618 | struct device_attribute *attr, char *buf) |
@@ -4086,12 +3675,11 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
4086 | 3675 | ||
4087 | init_waitqueue_head(&priv->wait_command_queue); | 3676 | init_waitqueue_head(&priv->wait_command_queue); |
4088 | 3677 | ||
4089 | INIT_WORK(&priv->up, iwl4965_bg_up); | 3678 | INIT_WORK(&priv->up, iwl_bg_up); |
4090 | INIT_WORK(&priv->restart, iwl4965_bg_restart); | 3679 | INIT_WORK(&priv->restart, iwl_bg_restart); |
4091 | INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); | 3680 | INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); |
4092 | INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); | 3681 | INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); |
4093 | INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); | 3682 | INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); |
4094 | INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor); | ||
4095 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); | 3683 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); |
4096 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); | 3684 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); |
4097 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); | 3685 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); |
@@ -4104,10 +3692,10 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
4104 | 3692 | ||
4105 | init_timer(&priv->statistics_periodic); | 3693 | init_timer(&priv->statistics_periodic); |
4106 | priv->statistics_periodic.data = (unsigned long)priv; | 3694 | priv->statistics_periodic.data = (unsigned long)priv; |
4107 | priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; | 3695 | priv->statistics_periodic.function = iwl_bg_statistics_periodic; |
4108 | 3696 | ||
4109 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 3697 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) |
4110 | iwl4965_irq_tasklet, (unsigned long)priv); | 3698 | iwl_irq_tasklet, (unsigned long)priv); |
4111 | } | 3699 | } |
4112 | 3700 | ||
4113 | static void iwl_cancel_deferred_work(struct iwl_priv *priv) | 3701 | static void iwl_cancel_deferred_work(struct iwl_priv *priv) |
@@ -4123,13 +3711,9 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
4123 | del_timer_sync(&priv->statistics_periodic); | 3711 | del_timer_sync(&priv->statistics_periodic); |
4124 | } | 3712 | } |
4125 | 3713 | ||
4126 | static struct attribute *iwl4965_sysfs_entries[] = { | 3714 | static struct attribute *iwl_sysfs_entries[] = { |
4127 | &dev_attr_channels.attr, | ||
4128 | &dev_attr_flags.attr, | 3715 | &dev_attr_flags.attr, |
4129 | &dev_attr_filter_flags.attr, | 3716 | &dev_attr_filter_flags.attr, |
4130 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | ||
4131 | &dev_attr_measurement.attr, | ||
4132 | #endif | ||
4133 | &dev_attr_power_level.attr, | 3717 | &dev_attr_power_level.attr, |
4134 | &dev_attr_retry_rate.attr, | 3718 | &dev_attr_retry_rate.attr, |
4135 | &dev_attr_statistics.attr, | 3719 | &dev_attr_statistics.attr, |
@@ -4144,39 +3728,38 @@ static struct attribute *iwl4965_sysfs_entries[] = { | |||
4144 | NULL | 3728 | NULL |
4145 | }; | 3729 | }; |
4146 | 3730 | ||
4147 | static struct attribute_group iwl4965_attribute_group = { | 3731 | static struct attribute_group iwl_attribute_group = { |
4148 | .name = NULL, /* put in device directory */ | 3732 | .name = NULL, /* put in device directory */ |
4149 | .attrs = iwl4965_sysfs_entries, | 3733 | .attrs = iwl_sysfs_entries, |
4150 | }; | 3734 | }; |
4151 | 3735 | ||
4152 | static struct ieee80211_ops iwl4965_hw_ops = { | 3736 | static struct ieee80211_ops iwl_hw_ops = { |
4153 | .tx = iwl4965_mac_tx, | 3737 | .tx = iwl_mac_tx, |
4154 | .start = iwl4965_mac_start, | 3738 | .start = iwl_mac_start, |
4155 | .stop = iwl4965_mac_stop, | 3739 | .stop = iwl_mac_stop, |
4156 | .add_interface = iwl4965_mac_add_interface, | 3740 | .add_interface = iwl_mac_add_interface, |
4157 | .remove_interface = iwl4965_mac_remove_interface, | 3741 | .remove_interface = iwl_mac_remove_interface, |
4158 | .config = iwl4965_mac_config, | 3742 | .config = iwl_mac_config, |
4159 | .config_interface = iwl4965_mac_config_interface, | 3743 | .config_interface = iwl_mac_config_interface, |
4160 | .configure_filter = iwl4965_configure_filter, | 3744 | .configure_filter = iwl_configure_filter, |
4161 | .set_key = iwl4965_mac_set_key, | 3745 | .set_key = iwl_mac_set_key, |
4162 | .update_tkip_key = iwl4965_mac_update_tkip_key, | 3746 | .update_tkip_key = iwl_mac_update_tkip_key, |
4163 | .get_stats = iwl4965_mac_get_stats, | 3747 | .get_stats = iwl_mac_get_stats, |
4164 | .get_tx_stats = iwl4965_mac_get_tx_stats, | 3748 | .get_tx_stats = iwl_mac_get_tx_stats, |
4165 | .conf_tx = iwl4965_mac_conf_tx, | 3749 | .conf_tx = iwl_mac_conf_tx, |
4166 | .reset_tsf = iwl4965_mac_reset_tsf, | 3750 | .reset_tsf = iwl_mac_reset_tsf, |
4167 | .bss_info_changed = iwl4965_bss_info_changed, | 3751 | .bss_info_changed = iwl_bss_info_changed, |
4168 | .ampdu_action = iwl4965_mac_ampdu_action, | 3752 | .ampdu_action = iwl_mac_ampdu_action, |
4169 | .hw_scan = iwl_mac_hw_scan | 3753 | .hw_scan = iwl_mac_hw_scan |
4170 | }; | 3754 | }; |
4171 | 3755 | ||
4172 | static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 3756 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
4173 | { | 3757 | { |
4174 | int err = 0; | 3758 | int err = 0; |
4175 | struct iwl_priv *priv; | 3759 | struct iwl_priv *priv; |
4176 | struct ieee80211_hw *hw; | 3760 | struct ieee80211_hw *hw; |
4177 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 3761 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
4178 | unsigned long flags; | 3762 | unsigned long flags; |
4179 | DECLARE_MAC_BUF(mac); | ||
4180 | 3763 | ||
4181 | /************************ | 3764 | /************************ |
4182 | * 1. Allocating HW data | 3765 | * 1. Allocating HW data |
@@ -4188,10 +3771,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4188 | if (cfg->mod_params->debug & IWL_DL_INFO) | 3771 | if (cfg->mod_params->debug & IWL_DL_INFO) |
4189 | dev_printk(KERN_DEBUG, &(pdev->dev), | 3772 | dev_printk(KERN_DEBUG, &(pdev->dev), |
4190 | "Disabling hw_scan\n"); | 3773 | "Disabling hw_scan\n"); |
4191 | iwl4965_hw_ops.hw_scan = NULL; | 3774 | iwl_hw_ops.hw_scan = NULL; |
4192 | } | 3775 | } |
4193 | 3776 | ||
4194 | hw = iwl_alloc_all(cfg, &iwl4965_hw_ops); | 3777 | hw = iwl_alloc_all(cfg, &iwl_hw_ops); |
4195 | if (!hw) { | 3778 | if (!hw) { |
4196 | err = -ENOMEM; | 3779 | err = -ENOMEM; |
4197 | goto out; | 3780 | goto out; |
@@ -4285,7 +3868,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4285 | 3868 | ||
4286 | /* extract MAC Address */ | 3869 | /* extract MAC Address */ |
4287 | iwl_eeprom_get_mac(priv, priv->mac_addr); | 3870 | iwl_eeprom_get_mac(priv, priv->mac_addr); |
4288 | IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); | 3871 | IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr); |
4289 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | 3872 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); |
4290 | 3873 | ||
4291 | /************************ | 3874 | /************************ |
@@ -4319,10 +3902,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4319 | * 8. Setup services | 3902 | * 8. Setup services |
4320 | ********************/ | 3903 | ********************/ |
4321 | spin_lock_irqsave(&priv->lock, flags); | 3904 | spin_lock_irqsave(&priv->lock, flags); |
4322 | iwl4965_disable_interrupts(priv); | 3905 | iwl_disable_interrupts(priv); |
4323 | spin_unlock_irqrestore(&priv->lock, flags); | 3906 | spin_unlock_irqrestore(&priv->lock, flags); |
4324 | 3907 | ||
4325 | err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 3908 | err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); |
4326 | if (err) { | 3909 | if (err) { |
4327 | IWL_ERROR("failed to create sysfs device attributes\n"); | 3910 | IWL_ERROR("failed to create sysfs device attributes\n"); |
4328 | goto out_uninit_drv; | 3911 | goto out_uninit_drv; |
@@ -4358,7 +3941,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4358 | return 0; | 3941 | return 0; |
4359 | 3942 | ||
4360 | out_remove_sysfs: | 3943 | out_remove_sysfs: |
4361 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 3944 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); |
4362 | out_uninit_drv: | 3945 | out_uninit_drv: |
4363 | iwl_uninit_drv(priv); | 3946 | iwl_uninit_drv(priv); |
4364 | out_free_eeprom: | 3947 | out_free_eeprom: |
@@ -4376,7 +3959,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4376 | return err; | 3959 | return err; |
4377 | } | 3960 | } |
4378 | 3961 | ||
4379 | static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | 3962 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) |
4380 | { | 3963 | { |
4381 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 3964 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
4382 | unsigned long flags; | 3965 | unsigned long flags; |
@@ -4387,10 +3970,10 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | |||
4387 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); | 3970 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); |
4388 | 3971 | ||
4389 | iwl_dbgfs_unregister(priv); | 3972 | iwl_dbgfs_unregister(priv); |
4390 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 3973 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); |
4391 | 3974 | ||
4392 | /* ieee80211_unregister_hw call wil cause iwl4965_mac_stop to | 3975 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to |
4393 | * to be called and iwl4965_down since we are removing the device | 3976 | * to be called and iwl_down since we are removing the device |
4394 | * we need to set STATUS_EXIT_PENDING bit. | 3977 | * we need to set STATUS_EXIT_PENDING bit. |
4395 | */ | 3978 | */ |
4396 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 3979 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
@@ -4398,20 +3981,20 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | |||
4398 | ieee80211_unregister_hw(priv->hw); | 3981 | ieee80211_unregister_hw(priv->hw); |
4399 | priv->mac80211_registered = 0; | 3982 | priv->mac80211_registered = 0; |
4400 | } else { | 3983 | } else { |
4401 | iwl4965_down(priv); | 3984 | iwl_down(priv); |
4402 | } | 3985 | } |
4403 | 3986 | ||
4404 | /* make sure we flush any pending irq or | 3987 | /* make sure we flush any pending irq or |
4405 | * tasklet for the driver | 3988 | * tasklet for the driver |
4406 | */ | 3989 | */ |
4407 | spin_lock_irqsave(&priv->lock, flags); | 3990 | spin_lock_irqsave(&priv->lock, flags); |
4408 | iwl4965_disable_interrupts(priv); | 3991 | iwl_disable_interrupts(priv); |
4409 | spin_unlock_irqrestore(&priv->lock, flags); | 3992 | spin_unlock_irqrestore(&priv->lock, flags); |
4410 | 3993 | ||
4411 | iwl_synchronize_irq(priv); | 3994 | iwl_synchronize_irq(priv); |
4412 | 3995 | ||
4413 | iwl_rfkill_unregister(priv); | 3996 | iwl_rfkill_unregister(priv); |
4414 | iwl4965_dealloc_ucode_pci(priv); | 3997 | iwl_dealloc_ucode_pci(priv); |
4415 | 3998 | ||
4416 | if (priv->rxq.bd) | 3999 | if (priv->rxq.bd) |
4417 | iwl_rx_queue_free(priv, &priv->rxq); | 4000 | iwl_rx_queue_free(priv, &priv->rxq); |
@@ -4424,7 +4007,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | |||
4424 | /*netif_stop_queue(dev); */ | 4007 | /*netif_stop_queue(dev); */ |
4425 | flush_workqueue(priv->workqueue); | 4008 | flush_workqueue(priv->workqueue); |
4426 | 4009 | ||
4427 | /* ieee80211_unregister_hw calls iwl4965_mac_stop, which flushes | 4010 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes |
4428 | * priv->workqueue... so we can't take down the workqueue | 4011 | * priv->workqueue... so we can't take down the workqueue |
4429 | * until now... */ | 4012 | * until now... */ |
4430 | destroy_workqueue(priv->workqueue); | 4013 | destroy_workqueue(priv->workqueue); |
@@ -4445,13 +4028,13 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | |||
4445 | 4028 | ||
4446 | #ifdef CONFIG_PM | 4029 | #ifdef CONFIG_PM |
4447 | 4030 | ||
4448 | static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 4031 | static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
4449 | { | 4032 | { |
4450 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 4033 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
4451 | 4034 | ||
4452 | if (priv->is_open) { | 4035 | if (priv->is_open) { |
4453 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 4036 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
4454 | iwl4965_mac_stop(priv->hw); | 4037 | iwl_mac_stop(priv->hw); |
4455 | priv->is_open = 1; | 4038 | priv->is_open = 1; |
4456 | } | 4039 | } |
4457 | 4040 | ||
@@ -4460,14 +4043,14 @@ static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4460 | return 0; | 4043 | return 0; |
4461 | } | 4044 | } |
4462 | 4045 | ||
4463 | static int iwl4965_pci_resume(struct pci_dev *pdev) | 4046 | static int iwl_pci_resume(struct pci_dev *pdev) |
4464 | { | 4047 | { |
4465 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 4048 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
4466 | 4049 | ||
4467 | pci_set_power_state(pdev, PCI_D0); | 4050 | pci_set_power_state(pdev, PCI_D0); |
4468 | 4051 | ||
4469 | if (priv->is_open) | 4052 | if (priv->is_open) |
4470 | iwl4965_mac_start(priv->hw); | 4053 | iwl_mac_start(priv->hw); |
4471 | 4054 | ||
4472 | clear_bit(STATUS_IN_SUSPEND, &priv->status); | 4055 | clear_bit(STATUS_IN_SUSPEND, &priv->status); |
4473 | return 0; | 4056 | return 0; |
@@ -4502,7 +4085,11 @@ static struct pci_device_id iwl_hw_card_ids[] = { | |||
4502 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, | 4085 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, |
4503 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, | 4086 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, |
4504 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, | 4087 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, |
4088 | /* 5150 Wifi/WiMax */ | ||
4089 | {IWL_PCI_DEVICE(0x423C, PCI_ANY_ID, iwl5150_agn_cfg)}, | ||
4090 | {IWL_PCI_DEVICE(0x423D, PCI_ANY_ID, iwl5150_agn_cfg)}, | ||
4505 | #endif /* CONFIG_IWL5000 */ | 4091 | #endif /* CONFIG_IWL5000 */ |
4092 | |||
4506 | {0} | 4093 | {0} |
4507 | }; | 4094 | }; |
4508 | MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | 4095 | MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); |
@@ -4510,15 +4097,15 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | |||
4510 | static struct pci_driver iwl_driver = { | 4097 | static struct pci_driver iwl_driver = { |
4511 | .name = DRV_NAME, | 4098 | .name = DRV_NAME, |
4512 | .id_table = iwl_hw_card_ids, | 4099 | .id_table = iwl_hw_card_ids, |
4513 | .probe = iwl4965_pci_probe, | 4100 | .probe = iwl_pci_probe, |
4514 | .remove = __devexit_p(iwl4965_pci_remove), | 4101 | .remove = __devexit_p(iwl_pci_remove), |
4515 | #ifdef CONFIG_PM | 4102 | #ifdef CONFIG_PM |
4516 | .suspend = iwl4965_pci_suspend, | 4103 | .suspend = iwl_pci_suspend, |
4517 | .resume = iwl4965_pci_resume, | 4104 | .resume = iwl_pci_resume, |
4518 | #endif | 4105 | #endif |
4519 | }; | 4106 | }; |
4520 | 4107 | ||
4521 | static int __init iwl4965_init(void) | 4108 | static int __init iwl_init(void) |
4522 | { | 4109 | { |
4523 | 4110 | ||
4524 | int ret; | 4111 | int ret; |
@@ -4544,11 +4131,11 @@ error_register: | |||
4544 | return ret; | 4131 | return ret; |
4545 | } | 4132 | } |
4546 | 4133 | ||
4547 | static void __exit iwl4965_exit(void) | 4134 | static void __exit iwl_exit(void) |
4548 | { | 4135 | { |
4549 | pci_unregister_driver(&iwl_driver); | 4136 | pci_unregister_driver(&iwl_driver); |
4550 | iwlagn_rate_control_unregister(); | 4137 | iwlagn_rate_control_unregister(); |
4551 | } | 4138 | } |
4552 | 4139 | ||
4553 | module_exit(iwl4965_exit); | 4140 | module_exit(iwl_exit); |
4554 | module_init(iwl4965_init); | 4141 | module_init(iwl_init); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c index 72fbf47229db..f836ecc55758 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-calib.c | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -70,7 +70,16 @@ | |||
70 | * INIT calibrations framework | 70 | * INIT calibrations framework |
71 | *****************************************************************************/ | 71 | *****************************************************************************/ |
72 | 72 | ||
73 | int iwl_send_calib_results(struct iwl_priv *priv) | 73 | struct statistics_general_data { |
74 | u32 beacon_silence_rssi_a; | ||
75 | u32 beacon_silence_rssi_b; | ||
76 | u32 beacon_silence_rssi_c; | ||
77 | u32 beacon_energy_a; | ||
78 | u32 beacon_energy_b; | ||
79 | u32 beacon_energy_c; | ||
80 | }; | ||
81 | |||
82 | int iwl_send_calib_results(struct iwl_priv *priv) | ||
74 | { | 83 | { |
75 | int ret = 0; | 84 | int ret = 0; |
76 | int i = 0; | 85 | int i = 0; |
@@ -80,14 +89,16 @@ | |||
80 | .meta.flags = CMD_SIZE_HUGE, | 89 | .meta.flags = CMD_SIZE_HUGE, |
81 | }; | 90 | }; |
82 | 91 | ||
83 | for (i = 0; i < IWL_CALIB_MAX; i++) | 92 | for (i = 0; i < IWL_CALIB_MAX; i++) { |
84 | if (priv->calib_results[i].buf) { | 93 | if ((BIT(i) & priv->hw_params.calib_init_cfg) && |
94 | priv->calib_results[i].buf) { | ||
85 | hcmd.len = priv->calib_results[i].buf_len; | 95 | hcmd.len = priv->calib_results[i].buf_len; |
86 | hcmd.data = priv->calib_results[i].buf; | 96 | hcmd.data = priv->calib_results[i].buf; |
87 | ret = iwl_send_cmd_sync(priv, &hcmd); | 97 | ret = iwl_send_cmd_sync(priv, &hcmd); |
88 | if (ret) | 98 | if (ret) |
89 | goto err; | 99 | goto err; |
90 | } | 100 | } |
101 | } | ||
91 | 102 | ||
92 | return 0; | 103 | return 0; |
93 | err: | 104 | err: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.h b/drivers/net/wireless/iwlwifi/iwl-calib.h index 94c8e316382a..1abe84bb74ad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.h +++ b/drivers/net/wireless/iwlwifi/iwl-calib.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 8d04e966ad48..52966ffbef6e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -66,8 +66,14 @@ | |||
66 | * Please use iwl-dev.h for driver implementation definitions. | 66 | * Please use iwl-dev.h for driver implementation definitions. |
67 | */ | 67 | */ |
68 | 68 | ||
69 | #ifndef __iwl4965_commands_h__ | 69 | #ifndef __iwl_commands_h__ |
70 | #define __iwl4965_commands_h__ | 70 | #define __iwl_commands_h__ |
71 | |||
72 | /* uCode version contains 4 values: Major/Minor/API/Serial */ | ||
73 | #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) | ||
74 | #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) | ||
75 | #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) | ||
76 | #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) | ||
71 | 77 | ||
72 | enum { | 78 | enum { |
73 | REPLY_ALIVE = 0x1, | 79 | REPLY_ALIVE = 0x1, |
@@ -88,6 +94,7 @@ enum { | |||
88 | REPLY_WEPKEY = 0x20, | 94 | REPLY_WEPKEY = 0x20, |
89 | 95 | ||
90 | /* RX, TX, LEDs */ | 96 | /* RX, TX, LEDs */ |
97 | REPLY_3945_RX = 0x1b, /* 3945 only */ | ||
91 | REPLY_TX = 0x1c, | 98 | REPLY_TX = 0x1c, |
92 | REPLY_RATE_SCALE = 0x47, /* 3945 only */ | 99 | REPLY_RATE_SCALE = 0x47, /* 3945 only */ |
93 | REPLY_LEDS_CMD = 0x48, | 100 | REPLY_LEDS_CMD = 0x48, |
@@ -98,6 +105,11 @@ enum { | |||
98 | COEX_MEDIUM_NOTIFICATION = 0x5b, | 105 | COEX_MEDIUM_NOTIFICATION = 0x5b, |
99 | COEX_EVENT_CMD = 0x5c, | 106 | COEX_EVENT_CMD = 0x5c, |
100 | 107 | ||
108 | /* Calibration */ | ||
109 | CALIBRATION_CFG_CMD = 0x65, | ||
110 | CALIBRATION_RES_NOTIFICATION = 0x66, | ||
111 | CALIBRATION_COMPLETE_NOTIFICATION = 0x67, | ||
112 | |||
101 | /* 802.11h related */ | 113 | /* 802.11h related */ |
102 | RADAR_NOTIFICATION = 0x70, /* not used */ | 114 | RADAR_NOTIFICATION = 0x70, /* not used */ |
103 | REPLY_QUIET_CMD = 0x71, /* not used */ | 115 | REPLY_QUIET_CMD = 0x71, /* not used */ |
@@ -129,7 +141,7 @@ enum { | |||
129 | REPLY_TX_POWER_DBM_CMD = 0x98, | 141 | REPLY_TX_POWER_DBM_CMD = 0x98, |
130 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ | 142 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
131 | 143 | ||
132 | /* Bluetooth device coexistance config command */ | 144 | /* Bluetooth device coexistence config command */ |
133 | REPLY_BT_CONFIG = 0x9b, | 145 | REPLY_BT_CONFIG = 0x9b, |
134 | 146 | ||
135 | /* Statistics */ | 147 | /* Statistics */ |
@@ -167,8 +179,8 @@ enum { | |||
167 | #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) | 179 | #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) |
168 | #define SEQ_TO_INDEX(s) ((s) & 0xff) | 180 | #define SEQ_TO_INDEX(s) ((s) & 0xff) |
169 | #define INDEX_TO_SEQ(i) ((i) & 0xff) | 181 | #define INDEX_TO_SEQ(i) ((i) & 0xff) |
170 | #define SEQ_HUGE_FRAME __constant_cpu_to_le16(0x4000) | 182 | #define SEQ_HUGE_FRAME cpu_to_le16(0x4000) |
171 | #define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) | 183 | #define SEQ_RX_FRAME cpu_to_le16(0x8000) |
172 | 184 | ||
173 | /** | 185 | /** |
174 | * struct iwl_cmd_header | 186 | * struct iwl_cmd_header |
@@ -180,7 +192,7 @@ struct iwl_cmd_header { | |||
180 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ | 192 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
181 | u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ | 193 | u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ |
182 | /* | 194 | /* |
183 | * The driver sets up the sequence number to values of its chosing. | 195 | * The driver sets up the sequence number to values of its choosing. |
184 | * uCode does not use this value, but passes it back to the driver | 196 | * uCode does not use this value, but passes it back to the driver |
185 | * when sending the response to each driver-originated command, so | 197 | * when sending the response to each driver-originated command, so |
186 | * the driver can match the response to the command. Since the values | 198 | * the driver can match the response to the command. Since the values |
@@ -208,10 +220,11 @@ struct iwl_cmd_header { | |||
208 | } __attribute__ ((packed)); | 220 | } __attribute__ ((packed)); |
209 | 221 | ||
210 | /** | 222 | /** |
211 | * 4965 rate_n_flags bit fields | 223 | * iwlagn rate_n_flags bit fields |
212 | * | 224 | * |
213 | * rate_n_flags format is used in following 4965 commands: | 225 | * rate_n_flags format is used in following iwlagn commands: |
214 | * REPLY_RX (response only) | 226 | * REPLY_RX (response only) |
227 | * REPLY_RX_MPDU (response only) | ||
215 | * REPLY_TX (both command and response) | 228 | * REPLY_TX (both command and response) |
216 | * REPLY_TX_LINK_QUALITY_CMD | 229 | * REPLY_TX_LINK_QUALITY_CMD |
217 | * | 230 | * |
@@ -225,8 +238,9 @@ struct iwl_cmd_header { | |||
225 | * 6) 54 Mbps | 238 | * 6) 54 Mbps |
226 | * 7) 60 Mbps | 239 | * 7) 60 Mbps |
227 | * | 240 | * |
228 | * 3: 0) Single stream (SISO) | 241 | * 4-3: 0) Single stream (SISO) |
229 | * 1) Dual stream (MIMO) | 242 | * 1) Dual stream (MIMO) |
243 | * 2) Triple stream (MIMO) | ||
230 | * | 244 | * |
231 | * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data | 245 | * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data |
232 | * | 246 | * |
@@ -247,8 +261,8 @@ struct iwl_cmd_header { | |||
247 | * 110) 11 Mbps | 261 | * 110) 11 Mbps |
248 | */ | 262 | */ |
249 | #define RATE_MCS_CODE_MSK 0x7 | 263 | #define RATE_MCS_CODE_MSK 0x7 |
250 | #define RATE_MCS_MIMO_POS 3 | 264 | #define RATE_MCS_SPATIAL_POS 3 |
251 | #define RATE_MCS_MIMO_MSK 0x8 | 265 | #define RATE_MCS_SPATIAL_MSK 0x18 |
252 | #define RATE_MCS_HT_DUP_POS 5 | 266 | #define RATE_MCS_HT_DUP_POS 5 |
253 | #define RATE_MCS_HT_DUP_MSK 0x20 | 267 | #define RATE_MCS_HT_DUP_MSK 0x20 |
254 | 268 | ||
@@ -278,18 +292,20 @@ struct iwl_cmd_header { | |||
278 | #define RATE_MCS_SGI_MSK 0x2000 | 292 | #define RATE_MCS_SGI_MSK 0x2000 |
279 | 293 | ||
280 | /** | 294 | /** |
281 | * rate_n_flags Tx antenna masks (4965 has 2 transmitters): | 295 | * rate_n_flags Tx antenna masks |
282 | * bit14:15 01 B inactive, A active | 296 | * 4965 has 2 transmitters |
283 | * 10 B active, A inactive | 297 | * 5100 has 1 transmitter B |
284 | * 11 Both active | 298 | * 5150 has 1 transmitter A |
299 | * 5300 has 3 transmitters | ||
300 | * 5350 has 3 transmitters | ||
301 | * bit14:16 | ||
285 | */ | 302 | */ |
286 | #define RATE_MCS_ANT_POS 14 | 303 | #define RATE_MCS_ANT_POS 14 |
287 | #define RATE_MCS_ANT_A_MSK 0x04000 | 304 | #define RATE_MCS_ANT_A_MSK 0x04000 |
288 | #define RATE_MCS_ANT_B_MSK 0x08000 | 305 | #define RATE_MCS_ANT_B_MSK 0x08000 |
289 | #define RATE_MCS_ANT_C_MSK 0x10000 | 306 | #define RATE_MCS_ANT_C_MSK 0x10000 |
290 | #define RATE_MCS_ANT_ABC_MSK 0x1C000 | 307 | #define RATE_MCS_ANT_ABC_MSK 0x1C000 |
291 | 308 | #define RATE_ANT_NUM 3 | |
292 | #define RATE_MCS_ANT_INIT_IND 1 | ||
293 | 309 | ||
294 | #define POWER_TABLE_NUM_ENTRIES 33 | 310 | #define POWER_TABLE_NUM_ENTRIES 33 |
295 | #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 | 311 | #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 |
@@ -340,7 +356,7 @@ struct iwl4965_tx_power_db { | |||
340 | } __attribute__ ((packed)); | 356 | } __attribute__ ((packed)); |
341 | 357 | ||
342 | /** | 358 | /** |
343 | * Commad REPLY_TX_POWER_DBM_CMD = 0x98 | 359 | * Command REPLY_TX_POWER_DBM_CMD = 0x98 |
344 | * struct iwl5000_tx_power_dbm_cmd | 360 | * struct iwl5000_tx_power_dbm_cmd |
345 | */ | 361 | */ |
346 | #define IWL50_TX_POWER_AUTO 0x7f | 362 | #define IWL50_TX_POWER_AUTO 0x7f |
@@ -359,7 +375,7 @@ struct iwl5000_tx_power_dbm_cmd { | |||
359 | * | 375 | * |
360 | *****************************************************************************/ | 376 | *****************************************************************************/ |
361 | 377 | ||
362 | #define UCODE_VALID_OK __constant_cpu_to_le32(0x1) | 378 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
363 | #define INITIALIZE_SUBTYPE (9) | 379 | #define INITIALIZE_SUBTYPE (9) |
364 | 380 | ||
365 | /* | 381 | /* |
@@ -376,7 +392,7 @@ struct iwl5000_tx_power_dbm_cmd { | |||
376 | * calculating txpower settings: | 392 | * calculating txpower settings: |
377 | * | 393 | * |
378 | * 1) Power supply voltage indication. The voltage sensor outputs higher | 394 | * 1) Power supply voltage indication. The voltage sensor outputs higher |
379 | * values for lower voltage, and vice versa. | 395 | * values for lower voltage, and vice verse. |
380 | * | 396 | * |
381 | * 2) Temperature measurement parameters, for each of two channel widths | 397 | * 2) Temperature measurement parameters, for each of two channel widths |
382 | * (20 MHz and 40 MHz) supported by the radios. Temperature sensing | 398 | * (20 MHz and 40 MHz) supported by the radios. Temperature sensing |
@@ -477,11 +493,6 @@ struct iwl_alive_resp { | |||
477 | } __attribute__ ((packed)); | 493 | } __attribute__ ((packed)); |
478 | 494 | ||
479 | 495 | ||
480 | union tsf { | ||
481 | u8 byte[8]; | ||
482 | __le16 word[4]; | ||
483 | __le32 dw[2]; | ||
484 | }; | ||
485 | 496 | ||
486 | /* | 497 | /* |
487 | * REPLY_ERROR = 0x2 (response only, not a command) | 498 | * REPLY_ERROR = 0x2 (response only, not a command) |
@@ -492,7 +503,7 @@ struct iwl_error_resp { | |||
492 | u8 reserved1; | 503 | u8 reserved1; |
493 | __le16 bad_cmd_seq_num; | 504 | __le16 bad_cmd_seq_num; |
494 | __le32 error_info; | 505 | __le32 error_info; |
495 | union tsf timestamp; | 506 | __le64 timestamp; |
496 | } __attribute__ ((packed)); | 507 | } __attribute__ ((packed)); |
497 | 508 | ||
498 | /****************************************************************************** | 509 | /****************************************************************************** |
@@ -513,75 +524,75 @@ enum { | |||
513 | }; | 524 | }; |
514 | 525 | ||
515 | 526 | ||
516 | #define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1 << 0) | 527 | #define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) |
517 | #define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7 << 1) | 528 | #define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) |
518 | #define RXON_RX_CHAIN_VALID_POS (1) | 529 | #define RXON_RX_CHAIN_VALID_POS (1) |
519 | #define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7 << 4) | 530 | #define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) |
520 | #define RXON_RX_CHAIN_FORCE_SEL_POS (4) | 531 | #define RXON_RX_CHAIN_FORCE_SEL_POS (4) |
521 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7 << 7) | 532 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) |
522 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) | 533 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) |
523 | #define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3 << 10) | 534 | #define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) |
524 | #define RXON_RX_CHAIN_CNT_POS (10) | 535 | #define RXON_RX_CHAIN_CNT_POS (10) |
525 | #define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3 << 12) | 536 | #define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) |
526 | #define RXON_RX_CHAIN_MIMO_CNT_POS (12) | 537 | #define RXON_RX_CHAIN_MIMO_CNT_POS (12) |
527 | #define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1 << 14) | 538 | #define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) |
528 | #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) | 539 | #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) |
529 | 540 | ||
530 | /* rx_config flags */ | 541 | /* rx_config flags */ |
531 | /* band & modulation selection */ | 542 | /* band & modulation selection */ |
532 | #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) | 543 | #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) |
533 | #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) | 544 | #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) |
534 | /* auto detection enable */ | 545 | /* auto detection enable */ |
535 | #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) | 546 | #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) |
536 | /* TGg protection when tx */ | 547 | /* TGg protection when tx */ |
537 | #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) | 548 | #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) |
538 | /* cck short slot & preamble */ | 549 | /* cck short slot & preamble */ |
539 | #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) | 550 | #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) |
540 | #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) | 551 | #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) |
541 | /* antenna selection */ | 552 | /* antenna selection */ |
542 | #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) | 553 | #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) |
543 | #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) | 554 | #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) |
544 | #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) | 555 | #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
545 | #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) | 556 | #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
546 | /* radar detection enable */ | 557 | /* radar detection enable */ |
547 | #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) | 558 | #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) |
548 | #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) | 559 | #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) |
549 | /* rx response to host with 8-byte TSF | 560 | /* rx response to host with 8-byte TSF |
550 | * (according to ON_AIR deassertion) */ | 561 | * (according to ON_AIR deassertion) */ |
551 | #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) | 562 | #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) |
552 | 563 | ||
553 | 564 | ||
554 | /* HT flags */ | 565 | /* HT flags */ |
555 | #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) | 566 | #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) |
556 | #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1 << 22) | 567 | #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) |
557 | 568 | ||
558 | #define RXON_FLG_HT_OPERATING_MODE_POS (23) | 569 | #define RXON_FLG_HT_OPERATING_MODE_POS (23) |
559 | 570 | ||
560 | #define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1 << 23) | 571 | #define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) |
561 | #define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2 << 23) | 572 | #define RXON_FLG_FAT_PROT_MSK cpu_to_le32(0x2 << 23) |
562 | 573 | ||
563 | #define RXON_FLG_CHANNEL_MODE_POS (25) | 574 | #define RXON_FLG_CHANNEL_MODE_POS (25) |
564 | #define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3 << 25) | 575 | #define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) |
565 | #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1 << 25) | 576 | #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK cpu_to_le32(0x1 << 25) |
566 | #define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2 << 25) | 577 | #define RXON_FLG_CHANNEL_MODE_MIXED_MSK cpu_to_le32(0x2 << 25) |
567 | /* CTS to self (if spec allows) flag */ | 578 | /* CTS to self (if spec allows) flag */ |
568 | #define RXON_FLG_SELF_CTS_EN __constant_cpu_to_le32(0x1<<30) | 579 | #define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) |
569 | 580 | ||
570 | /* rx_config filter flags */ | 581 | /* rx_config filter flags */ |
571 | /* accept all data frames */ | 582 | /* accept all data frames */ |
572 | #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) | 583 | #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) |
573 | /* pass control & management to host */ | 584 | /* pass control & management to host */ |
574 | #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) | 585 | #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) |
575 | /* accept multi-cast */ | 586 | /* accept multi-cast */ |
576 | #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) | 587 | #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) |
577 | /* don't decrypt uni-cast frames */ | 588 | /* don't decrypt uni-cast frames */ |
578 | #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) | 589 | #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) |
579 | /* don't decrypt multi-cast frames */ | 590 | /* don't decrypt multi-cast frames */ |
580 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) | 591 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) |
581 | /* STA is associated */ | 592 | /* STA is associated */ |
582 | #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) | 593 | #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) |
583 | /* transfer to host non bssid beacons in associated state */ | 594 | /* transfer to host non bssid beacons in associated state */ |
584 | #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) | 595 | #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) |
585 | 596 | ||
586 | /** | 597 | /** |
587 | * REPLY_RXON = 0x10 (command, has simple generic response) | 598 | * REPLY_RXON = 0x10 (command, has simple generic response) |
@@ -620,7 +631,7 @@ struct iwl4965_rxon_cmd { | |||
620 | u8 ofdm_ht_dual_stream_basic_rates; | 631 | u8 ofdm_ht_dual_stream_basic_rates; |
621 | } __attribute__ ((packed)); | 632 | } __attribute__ ((packed)); |
622 | 633 | ||
623 | /* 5000 HW just extend this cmmand */ | 634 | /* 5000 HW just extend this command */ |
624 | struct iwl_rxon_cmd { | 635 | struct iwl_rxon_cmd { |
625 | u8 node_addr[6]; | 636 | u8 node_addr[6]; |
626 | __le16 reserved1; | 637 | __le16 reserved1; |
@@ -679,8 +690,8 @@ struct iwl4965_rxon_assoc_cmd { | |||
679 | /* | 690 | /* |
680 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) | 691 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) |
681 | */ | 692 | */ |
682 | struct iwl4965_rxon_time_cmd { | 693 | struct iwl_rxon_time_cmd { |
683 | union tsf timestamp; | 694 | __le64 timestamp; |
684 | __le16 beacon_interval; | 695 | __le16 beacon_interval; |
685 | __le16 atim_window; | 696 | __le16 atim_window; |
686 | __le32 beacon_init_val; | 697 | __le32 beacon_init_val; |
@@ -691,7 +702,7 @@ struct iwl4965_rxon_time_cmd { | |||
691 | /* | 702 | /* |
692 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) | 703 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) |
693 | */ | 704 | */ |
694 | struct iwl4965_channel_switch_cmd { | 705 | struct iwl_channel_switch_cmd { |
695 | u8 band; | 706 | u8 band; |
696 | u8 expect_beacon; | 707 | u8 expect_beacon; |
697 | __le16 channel; | 708 | __le16 channel; |
@@ -704,7 +715,7 @@ struct iwl4965_channel_switch_cmd { | |||
704 | /* | 715 | /* |
705 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) | 716 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) |
706 | */ | 717 | */ |
707 | struct iwl4965_csa_notification { | 718 | struct iwl_csa_notification { |
708 | __le16 band; | 719 | __le16 band; |
709 | __le16 channel; | 720 | __le16 channel; |
710 | __le32 status; /* 0 - OK, 1 - fail */ | 721 | __le32 status; /* 0 - OK, 1 - fail */ |
@@ -741,9 +752,9 @@ struct iwl_ac_qos { | |||
741 | } __attribute__ ((packed)); | 752 | } __attribute__ ((packed)); |
742 | 753 | ||
743 | /* QoS flags defines */ | 754 | /* QoS flags defines */ |
744 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) | 755 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) |
745 | #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) | 756 | #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) |
746 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) | 757 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) |
747 | 758 | ||
748 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ | 759 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ |
749 | #define AC_NUM 4 | 760 | #define AC_NUM 4 |
@@ -780,34 +791,34 @@ struct iwl_qosparam_cmd { | |||
780 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ | 791 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
781 | #define IWL_INVALID_STATION 255 | 792 | #define IWL_INVALID_STATION 255 |
782 | 793 | ||
783 | #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8); | 794 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); |
784 | #define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17) | 795 | #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) |
785 | #define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18) | 796 | #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) |
786 | #define STA_FLG_MAX_AGG_SIZE_POS (19) | 797 | #define STA_FLG_MAX_AGG_SIZE_POS (19) |
787 | #define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19) | 798 | #define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) |
788 | #define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21) | 799 | #define STA_FLG_FAT_EN_MSK cpu_to_le32(1 << 21) |
789 | #define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22) | 800 | #define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) |
790 | #define STA_FLG_AGG_MPDU_DENSITY_POS (23) | 801 | #define STA_FLG_AGG_MPDU_DENSITY_POS (23) |
791 | #define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23) | 802 | #define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) |
792 | 803 | ||
793 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ | 804 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ |
794 | #define STA_CONTROL_MODIFY_MSK 0x01 | 805 | #define STA_CONTROL_MODIFY_MSK 0x01 |
795 | 806 | ||
796 | /* key flags __le16*/ | 807 | /* key flags __le16*/ |
797 | #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x0007) | 808 | #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) |
798 | #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0000) | 809 | #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) |
799 | #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x0001) | 810 | #define STA_KEY_FLG_WEP cpu_to_le16(0x0001) |
800 | #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x0002) | 811 | #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) |
801 | #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x0003) | 812 | #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) |
802 | 813 | ||
803 | #define STA_KEY_FLG_KEYID_POS 8 | 814 | #define STA_KEY_FLG_KEYID_POS 8 |
804 | #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) | 815 | #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) |
805 | /* wep key is either from global key (0) or from station info array (1) */ | 816 | /* wep key is either from global key (0) or from station info array (1) */ |
806 | #define STA_KEY_FLG_MAP_KEY_MSK __constant_cpu_to_le16(0x0008) | 817 | #define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) |
807 | 818 | ||
808 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ | 819 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ |
809 | #define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000) | 820 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) |
810 | #define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000) | 821 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) |
811 | #define STA_KEY_MAX_NUM 8 | 822 | #define STA_KEY_MAX_NUM 8 |
812 | 823 | ||
813 | /* Flags indicate whether to modify vs. don't change various station params */ | 824 | /* Flags indicate whether to modify vs. don't change various station params */ |
@@ -1013,33 +1024,14 @@ struct iwl_wep_cmd { | |||
1013 | * | 1024 | * |
1014 | *****************************************************************************/ | 1025 | *****************************************************************************/ |
1015 | 1026 | ||
1016 | struct iwl4965_rx_frame_stats { | 1027 | #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) |
1017 | u8 phy_count; | 1028 | #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) |
1018 | u8 id; | ||
1019 | u8 rssi; | ||
1020 | u8 agc; | ||
1021 | __le16 sig_avg; | ||
1022 | __le16 noise_diff; | ||
1023 | u8 payload[0]; | ||
1024 | } __attribute__ ((packed)); | ||
1025 | |||
1026 | struct iwl4965_rx_frame_hdr { | ||
1027 | __le16 channel; | ||
1028 | __le16 phy_flags; | ||
1029 | u8 reserved1; | ||
1030 | u8 rate; | ||
1031 | __le16 len; | ||
1032 | u8 payload[0]; | ||
1033 | } __attribute__ ((packed)); | ||
1034 | |||
1035 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) | ||
1036 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) | ||
1037 | 1029 | ||
1038 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) | 1030 | #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) |
1039 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) | 1031 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) |
1040 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) | 1032 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) |
1041 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) | 1033 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) |
1042 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) | 1034 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) |
1043 | 1035 | ||
1044 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | 1036 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
1045 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) | 1037 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
@@ -1062,26 +1054,6 @@ struct iwl4965_rx_frame_hdr { | |||
1062 | #define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) | 1054 | #define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) |
1063 | #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) | 1055 | #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) |
1064 | 1056 | ||
1065 | struct iwl4965_rx_frame_end { | ||
1066 | __le32 status; | ||
1067 | __le64 timestamp; | ||
1068 | __le32 beacon_timestamp; | ||
1069 | } __attribute__ ((packed)); | ||
1070 | |||
1071 | /* | ||
1072 | * REPLY_3945_RX = 0x1b (response only, not a command) | ||
1073 | * | ||
1074 | * NOTE: DO NOT dereference from casts to this structure | ||
1075 | * It is provided only for calculating minimum data set size. | ||
1076 | * The actual offsets of the hdr and end are dynamic based on | ||
1077 | * stats.phy_count | ||
1078 | */ | ||
1079 | struct iwl4965_rx_frame { | ||
1080 | struct iwl4965_rx_frame_stats stats; | ||
1081 | struct iwl4965_rx_frame_hdr hdr; | ||
1082 | struct iwl4965_rx_frame_end end; | ||
1083 | } __attribute__ ((packed)); | ||
1084 | |||
1085 | /* Fixed (non-configurable) rx data from phy */ | 1057 | /* Fixed (non-configurable) rx data from phy */ |
1086 | 1058 | ||
1087 | #define IWL49_RX_RES_PHY_CNT 14 | 1059 | #define IWL49_RX_RES_PHY_CNT 14 |
@@ -1111,7 +1083,7 @@ struct iwl4965_rx_non_cfg_phy { | |||
1111 | #define IWL50_OFDM_RSSI_C_BIT_POS 0 | 1083 | #define IWL50_OFDM_RSSI_C_BIT_POS 0 |
1112 | 1084 | ||
1113 | struct iwl5000_non_cfg_phy { | 1085 | struct iwl5000_non_cfg_phy { |
1114 | __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* upto 8 phy entries */ | 1086 | __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* up to 8 phy entries */ |
1115 | } __attribute__ ((packed)); | 1087 | } __attribute__ ((packed)); |
1116 | 1088 | ||
1117 | 1089 | ||
@@ -1167,24 +1139,24 @@ struct iwl4965_rx_mpdu_res_start { | |||
1167 | 1139 | ||
1168 | /* REPLY_TX Tx flags field */ | 1140 | /* REPLY_TX Tx flags field */ |
1169 | 1141 | ||
1170 | /* 1: Use RTS/CTS protocol or CTS-to-self if spec alows it | 1142 | /* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it |
1171 | * before this frame. if CTS-to-self required check | 1143 | * before this frame. if CTS-to-self required check |
1172 | * RXON_FLG_SELF_CTS_EN status. */ | 1144 | * RXON_FLG_SELF_CTS_EN status. */ |
1173 | #define TX_CMD_FLG_RTS_CTS_MSK __constant_cpu_to_le32(1 << 0) | 1145 | #define TX_CMD_FLG_RTS_CTS_MSK cpu_to_le32(1 << 0) |
1174 | 1146 | ||
1175 | /* 1: Use Request-To-Send protocol before this frame. | 1147 | /* 1: Use Request-To-Send protocol before this frame. |
1176 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ | 1148 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ |
1177 | #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) | 1149 | #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) |
1178 | 1150 | ||
1179 | /* 1: Transmit Clear-To-Send to self before this frame. | 1151 | /* 1: Transmit Clear-To-Send to self before this frame. |
1180 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. | 1152 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. |
1181 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ | 1153 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ |
1182 | #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) | 1154 | #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) |
1183 | 1155 | ||
1184 | /* 1: Expect ACK from receiving station | 1156 | /* 1: Expect ACK from receiving station |
1185 | * 0: Don't expect ACK (MAC header's duration field s/b 0) | 1157 | * 0: Don't expect ACK (MAC header's duration field s/b 0) |
1186 | * Set this for unicast frames, but not broadcast/multicast. */ | 1158 | * Set this for unicast frames, but not broadcast/multicast. */ |
1187 | #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) | 1159 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) |
1188 | 1160 | ||
1189 | /* For 4965: | 1161 | /* For 4965: |
1190 | * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). | 1162 | * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). |
@@ -1192,40 +1164,40 @@ struct iwl4965_rx_mpdu_res_start { | |||
1192 | * uCode walks through table for additional Tx attempts. | 1164 | * uCode walks through table for additional Tx attempts. |
1193 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. | 1165 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. |
1194 | * This rate will be used for all Tx attempts; it will not be scaled. */ | 1166 | * This rate will be used for all Tx attempts; it will not be scaled. */ |
1195 | #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) | 1167 | #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) |
1196 | 1168 | ||
1197 | /* 1: Expect immediate block-ack. | 1169 | /* 1: Expect immediate block-ack. |
1198 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ | 1170 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ |
1199 | #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) | 1171 | #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) |
1200 | 1172 | ||
1201 | /* 1: Frame requires full Tx-Op protection. | 1173 | /* 1: Frame requires full Tx-Op protection. |
1202 | * Set this if either RTS or CTS Tx Flag gets set. */ | 1174 | * Set this if either RTS or CTS Tx Flag gets set. */ |
1203 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) | 1175 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) |
1204 | 1176 | ||
1205 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. | 1177 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. |
1206 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ | 1178 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ |
1207 | #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) | 1179 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) |
1208 | #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) | 1180 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
1209 | #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) | 1181 | #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) |
1210 | 1182 | ||
1211 | /* 1: Ignore Bluetooth priority for this frame. | 1183 | /* 1: Ignore Bluetooth priority for this frame. |
1212 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ | 1184 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ |
1213 | #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) | 1185 | #define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) |
1214 | 1186 | ||
1215 | /* 1: uCode overrides sequence control field in MAC header. | 1187 | /* 1: uCode overrides sequence control field in MAC header. |
1216 | * 0: Driver provides sequence control field in MAC header. | 1188 | * 0: Driver provides sequence control field in MAC header. |
1217 | * Set this for management frames, non-QOS data frames, non-unicast frames, | 1189 | * Set this for management frames, non-QOS data frames, non-unicast frames, |
1218 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ | 1190 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ |
1219 | #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) | 1191 | #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) |
1220 | 1192 | ||
1221 | /* 1: This frame is non-last MPDU; more fragments are coming. | 1193 | /* 1: This frame is non-last MPDU; more fragments are coming. |
1222 | * 0: Last fragment, or not using fragmentation. */ | 1194 | * 0: Last fragment, or not using fragmentation. */ |
1223 | #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) | 1195 | #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) |
1224 | 1196 | ||
1225 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. | 1197 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. |
1226 | * 0: No TSF required in outgoing frame. | 1198 | * 0: No TSF required in outgoing frame. |
1227 | * Set this for transmitting beacons and probe responses. */ | 1199 | * Set this for transmitting beacons and probe responses. */ |
1228 | #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) | 1200 | #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) |
1229 | 1201 | ||
1230 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword | 1202 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword |
1231 | * alignment of frame's payload data field. | 1203 | * alignment of frame's payload data field. |
@@ -1233,14 +1205,14 @@ struct iwl4965_rx_mpdu_res_start { | |||
1233 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 | 1205 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 |
1234 | * field (but not both). Driver must align frame data (i.e. data following | 1206 | * field (but not both). Driver must align frame data (i.e. data following |
1235 | * MAC header) to DWORD boundary. */ | 1207 | * MAC header) to DWORD boundary. */ |
1236 | #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) | 1208 | #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) |
1237 | 1209 | ||
1238 | /* accelerate aggregation support | 1210 | /* accelerate aggregation support |
1239 | * 0 - no CCMP encryption; 1 - CCMP encryption */ | 1211 | * 0 - no CCMP encryption; 1 - CCMP encryption */ |
1240 | #define TX_CMD_FLG_AGG_CCMP_MSK __constant_cpu_to_le32(1 << 22) | 1212 | #define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) |
1241 | 1213 | ||
1242 | /* HCCA-AP - disable duration overwriting. */ | 1214 | /* HCCA-AP - disable duration overwriting. */ |
1243 | #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) | 1215 | #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) |
1244 | 1216 | ||
1245 | 1217 | ||
1246 | /* | 1218 | /* |
@@ -1266,7 +1238,7 @@ struct iwl4965_rx_mpdu_res_start { | |||
1266 | * Used for managing Tx retries when expecting block-acks. | 1238 | * Used for managing Tx retries when expecting block-acks. |
1267 | * Driver should set these fields to 0. | 1239 | * Driver should set these fields to 0. |
1268 | */ | 1240 | */ |
1269 | struct iwl4965_dram_scratch { | 1241 | struct iwl_dram_scratch { |
1270 | u8 try_cnt; /* Tx attempts */ | 1242 | u8 try_cnt; /* Tx attempts */ |
1271 | u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ | 1243 | u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ |
1272 | __le16 reserved; | 1244 | __le16 reserved; |
@@ -1297,9 +1269,9 @@ struct iwl_tx_cmd { | |||
1297 | 1269 | ||
1298 | __le32 tx_flags; /* TX_CMD_FLG_* */ | 1270 | __le32 tx_flags; /* TX_CMD_FLG_* */ |
1299 | 1271 | ||
1300 | /* 4965's uCode may modify this field of the Tx command (in host DRAM!). | 1272 | /* uCode may modify this field of the Tx command (in host DRAM!). |
1301 | * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ | 1273 | * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ |
1302 | struct iwl4965_dram_scratch scratch; | 1274 | struct iwl_dram_scratch scratch; |
1303 | 1275 | ||
1304 | /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ | 1276 | /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ |
1305 | __le32 rate_n_flags; /* RATE_MCS_* */ | 1277 | __le32 rate_n_flags; /* RATE_MCS_* */ |
@@ -1411,21 +1383,21 @@ enum { | |||
1411 | }; | 1383 | }; |
1412 | 1384 | ||
1413 | enum { | 1385 | enum { |
1414 | TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ | 1386 | TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ |
1415 | TX_STATUS_DELAY_MSK = 0x00000040, | 1387 | TX_STATUS_DELAY_MSK = 0x00000040, |
1416 | TX_STATUS_ABORT_MSK = 0x00000080, | 1388 | TX_STATUS_ABORT_MSK = 0x00000080, |
1417 | TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ | 1389 | TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ |
1418 | TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ | 1390 | TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ |
1419 | TX_RESERVED = 0x00780000, /* bits 19:22 */ | 1391 | TX_RESERVED = 0x00780000, /* bits 19:22 */ |
1420 | TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ | 1392 | TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ |
1421 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ | 1393 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ |
1422 | }; | 1394 | }; |
1423 | 1395 | ||
1424 | static inline int iwl_is_tx_success(u32 status) | 1396 | static inline bool iwl_is_tx_success(u32 status) |
1425 | { | 1397 | { |
1426 | status &= TX_STATUS_MSK; | 1398 | status &= TX_STATUS_MSK; |
1427 | return (status == TX_STATUS_SUCCESS) | 1399 | return (status == TX_STATUS_SUCCESS) || |
1428 | || (status == TX_STATUS_DIRECT_DONE); | 1400 | (status == TX_STATUS_DIRECT_DONE); |
1429 | } | 1401 | } |
1430 | 1402 | ||
1431 | 1403 | ||
@@ -1450,10 +1422,9 @@ enum { | |||
1450 | AGG_TX_STATE_DELAY_TX_MSK = 0x400 | 1422 | AGG_TX_STATE_DELAY_TX_MSK = 0x400 |
1451 | }; | 1423 | }; |
1452 | 1424 | ||
1453 | #define AGG_TX_STATE_LAST_SENT_MSK \ | 1425 | #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ |
1454 | (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ | 1426 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ |
1455 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ | 1427 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) |
1456 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) | ||
1457 | 1428 | ||
1458 | /* # tx attempts for first frame in aggregation */ | 1429 | /* # tx attempts for first frame in aggregation */ |
1459 | #define AGG_TX_STATE_TRY_CNT_POS 12 | 1430 | #define AGG_TX_STATE_TRY_CNT_POS 12 |
@@ -1526,6 +1497,28 @@ struct iwl4965_tx_resp { | |||
1526 | } u; | 1497 | } u; |
1527 | } __attribute__ ((packed)); | 1498 | } __attribute__ ((packed)); |
1528 | 1499 | ||
1500 | /* | ||
1501 | * definitions for initial rate index field | ||
1502 | * bits [3:0] initial rate index | ||
1503 | * bits [6:4] rate table color, used for the initial rate | ||
1504 | * bit-7 invalid rate indication | ||
1505 | * i.e. rate was not chosen from rate table | ||
1506 | * or rate table color was changed during frame retries | ||
1507 | * refer tlc rate info | ||
1508 | */ | ||
1509 | |||
1510 | #define IWL50_TX_RES_INIT_RATE_INDEX_POS 0 | ||
1511 | #define IWL50_TX_RES_INIT_RATE_INDEX_MSK 0x0f | ||
1512 | #define IWL50_TX_RES_RATE_TABLE_COLOR_POS 4 | ||
1513 | #define IWL50_TX_RES_RATE_TABLE_COLOR_MSK 0x70 | ||
1514 | #define IWL50_TX_RES_INV_RATE_INDEX_MSK 0x80 | ||
1515 | |||
1516 | /* refer to ra_tid */ | ||
1517 | #define IWL50_TX_RES_TID_POS 0 | ||
1518 | #define IWL50_TX_RES_TID_MSK 0x0f | ||
1519 | #define IWL50_TX_RES_RA_POS 4 | ||
1520 | #define IWL50_TX_RES_RA_MSK 0xf0 | ||
1521 | |||
1529 | struct iwl5000_tx_resp { | 1522 | struct iwl5000_tx_resp { |
1530 | u8 frame_count; /* 1 no aggregation, >1 aggregation */ | 1523 | u8 frame_count; /* 1 no aggregation, >1 aggregation */ |
1531 | u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ | 1524 | u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ |
@@ -1540,14 +1533,17 @@ struct iwl5000_tx_resp { | |||
1540 | * For agg: RTS + CTS + aggregation tx time + block-ack time. */ | 1533 | * For agg: RTS + CTS + aggregation tx time + block-ack time. */ |
1541 | __le16 wireless_media_time; /* uSecs */ | 1534 | __le16 wireless_media_time; /* uSecs */ |
1542 | 1535 | ||
1543 | __le16 reserved; | 1536 | u8 pa_status; /* RF power amplifier measurement (not used) */ |
1544 | __le32 pa_power1; /* RF power amplifier measurement (not used) */ | 1537 | u8 pa_integ_res_a[3]; |
1545 | __le32 pa_power2; | 1538 | u8 pa_integ_res_b[3]; |
1539 | u8 pa_integ_res_C[3]; | ||
1546 | 1540 | ||
1547 | __le32 tfd_info; | 1541 | __le32 tfd_info; |
1548 | __le16 seq_ctl; | 1542 | __le16 seq_ctl; |
1549 | __le16 byte_cnt; | 1543 | __le16 byte_cnt; |
1550 | __le32 tlc_info; | 1544 | u8 tlc_info; |
1545 | u8 ra_tid; /* tid (0:3), sta_id (4:7) */ | ||
1546 | __le16 frame_ctrl; | ||
1551 | /* | 1547 | /* |
1552 | * For non-agg: frame status TX_STATUS_* | 1548 | * For non-agg: frame status TX_STATUS_* |
1553 | * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status | 1549 | * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status |
@@ -1742,7 +1738,7 @@ struct iwl_link_qual_agg_params { | |||
1742 | * match the modulation characteristics of the history set. | 1738 | * match the modulation characteristics of the history set. |
1743 | * | 1739 | * |
1744 | * When using block-ack (aggregation), all frames are transmitted at the same | 1740 | * When using block-ack (aggregation), all frames are transmitted at the same |
1745 | * rate, since there is no per-attempt acknowledgement from the destination | 1741 | * rate, since there is no per-attempt acknowledgment from the destination |
1746 | * station. The Tx response struct iwl_tx_resp indicates the Tx rate in | 1742 | * station. The Tx response struct iwl_tx_resp indicates the Tx rate in |
1747 | * rate_n_flags field. After receiving a block-ack, the driver can update | 1743 | * rate_n_flags field. After receiving a block-ack, the driver can update |
1748 | * history for the entire block all at once. | 1744 | * history for the entire block all at once. |
@@ -1881,9 +1877,9 @@ struct iwl_link_quality_cmd { | |||
1881 | * | 1877 | * |
1882 | * 3945 and 4965 support hardware handshake with Bluetooth device on | 1878 | * 3945 and 4965 support hardware handshake with Bluetooth device on |
1883 | * same platform. Bluetooth device alerts wireless device when it will Tx; | 1879 | * same platform. Bluetooth device alerts wireless device when it will Tx; |
1884 | * wireless device can delay or kill its own Tx to accomodate. | 1880 | * wireless device can delay or kill its own Tx to accommodate. |
1885 | */ | 1881 | */ |
1886 | struct iwl4965_bt_cmd { | 1882 | struct iwl_bt_cmd { |
1887 | u8 flags; | 1883 | u8 flags; |
1888 | u8 lead_time; | 1884 | u8 lead_time; |
1889 | u8 max_kill; | 1885 | u8 max_kill; |
@@ -1909,18 +1905,18 @@ struct iwl4965_bt_cmd { | |||
1909 | RXON_FILTER_ASSOC_MSK | \ | 1905 | RXON_FILTER_ASSOC_MSK | \ |
1910 | RXON_FILTER_BCON_AWARE_MSK) | 1906 | RXON_FILTER_BCON_AWARE_MSK) |
1911 | 1907 | ||
1912 | struct iwl4965_measure_channel { | 1908 | struct iwl_measure_channel { |
1913 | __le32 duration; /* measurement duration in extended beacon | 1909 | __le32 duration; /* measurement duration in extended beacon |
1914 | * format */ | 1910 | * format */ |
1915 | u8 channel; /* channel to measure */ | 1911 | u8 channel; /* channel to measure */ |
1916 | u8 type; /* see enum iwl4965_measure_type */ | 1912 | u8 type; /* see enum iwl_measure_type */ |
1917 | __le16 reserved; | 1913 | __le16 reserved; |
1918 | } __attribute__ ((packed)); | 1914 | } __attribute__ ((packed)); |
1919 | 1915 | ||
1920 | /* | 1916 | /* |
1921 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) | 1917 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) |
1922 | */ | 1918 | */ |
1923 | struct iwl4965_spectrum_cmd { | 1919 | struct iwl_spectrum_cmd { |
1924 | __le16 len; /* number of bytes starting from token */ | 1920 | __le16 len; /* number of bytes starting from token */ |
1925 | u8 token; /* token id */ | 1921 | u8 token; /* token id */ |
1926 | u8 id; /* measurement id -- 0 or 1 */ | 1922 | u8 id; /* measurement id -- 0 or 1 */ |
@@ -1933,13 +1929,13 @@ struct iwl4965_spectrum_cmd { | |||
1933 | __le32 filter_flags; /* rxon filter flags */ | 1929 | __le32 filter_flags; /* rxon filter flags */ |
1934 | __le16 channel_count; /* minimum 1, maximum 10 */ | 1930 | __le16 channel_count; /* minimum 1, maximum 10 */ |
1935 | __le16 reserved3; | 1931 | __le16 reserved3; |
1936 | struct iwl4965_measure_channel channels[10]; | 1932 | struct iwl_measure_channel channels[10]; |
1937 | } __attribute__ ((packed)); | 1933 | } __attribute__ ((packed)); |
1938 | 1934 | ||
1939 | /* | 1935 | /* |
1940 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) | 1936 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) |
1941 | */ | 1937 | */ |
1942 | struct iwl4965_spectrum_resp { | 1938 | struct iwl_spectrum_resp { |
1943 | u8 token; | 1939 | u8 token; |
1944 | u8 id; /* id of the prior command replaced, or 0xff */ | 1940 | u8 id; /* id of the prior command replaced, or 0xff */ |
1945 | __le16 status; /* 0 - command will be handled | 1941 | __le16 status; /* 0 - command will be handled |
@@ -1947,12 +1943,12 @@ struct iwl4965_spectrum_resp { | |||
1947 | * measurement) */ | 1943 | * measurement) */ |
1948 | } __attribute__ ((packed)); | 1944 | } __attribute__ ((packed)); |
1949 | 1945 | ||
1950 | enum iwl4965_measurement_state { | 1946 | enum iwl_measurement_state { |
1951 | IWL_MEASUREMENT_START = 0, | 1947 | IWL_MEASUREMENT_START = 0, |
1952 | IWL_MEASUREMENT_STOP = 1, | 1948 | IWL_MEASUREMENT_STOP = 1, |
1953 | }; | 1949 | }; |
1954 | 1950 | ||
1955 | enum iwl4965_measurement_status { | 1951 | enum iwl_measurement_status { |
1956 | IWL_MEASUREMENT_OK = 0, | 1952 | IWL_MEASUREMENT_OK = 0, |
1957 | IWL_MEASUREMENT_CONCURRENT = 1, | 1953 | IWL_MEASUREMENT_CONCURRENT = 1, |
1958 | IWL_MEASUREMENT_CSA_CONFLICT = 2, | 1954 | IWL_MEASUREMENT_CSA_CONFLICT = 2, |
@@ -1965,18 +1961,18 @@ enum iwl4965_measurement_status { | |||
1965 | 1961 | ||
1966 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 | 1962 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 |
1967 | 1963 | ||
1968 | struct iwl4965_measurement_histogram { | 1964 | struct iwl_measurement_histogram { |
1969 | __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ | 1965 | __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ |
1970 | __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ | 1966 | __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ |
1971 | } __attribute__ ((packed)); | 1967 | } __attribute__ ((packed)); |
1972 | 1968 | ||
1973 | /* clear channel availability counters */ | 1969 | /* clear channel availability counters */ |
1974 | struct iwl4965_measurement_cca_counters { | 1970 | struct iwl_measurement_cca_counters { |
1975 | __le32 ofdm; | 1971 | __le32 ofdm; |
1976 | __le32 cck; | 1972 | __le32 cck; |
1977 | } __attribute__ ((packed)); | 1973 | } __attribute__ ((packed)); |
1978 | 1974 | ||
1979 | enum iwl4965_measure_type { | 1975 | enum iwl_measure_type { |
1980 | IWL_MEASURE_BASIC = (1 << 0), | 1976 | IWL_MEASURE_BASIC = (1 << 0), |
1981 | IWL_MEASURE_CHANNEL_LOAD = (1 << 1), | 1977 | IWL_MEASURE_CHANNEL_LOAD = (1 << 1), |
1982 | IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), | 1978 | IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), |
@@ -1989,7 +1985,7 @@ enum iwl4965_measure_type { | |||
1989 | /* | 1985 | /* |
1990 | * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) | 1986 | * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) |
1991 | */ | 1987 | */ |
1992 | struct iwl4965_spectrum_notification { | 1988 | struct iwl_spectrum_notification { |
1993 | u8 id; /* measurement id -- 0 or 1 */ | 1989 | u8 id; /* measurement id -- 0 or 1 */ |
1994 | u8 token; | 1990 | u8 token; |
1995 | u8 channel_index; /* index in measurement channel list */ | 1991 | u8 channel_index; /* index in measurement channel list */ |
@@ -1997,7 +1993,7 @@ struct iwl4965_spectrum_notification { | |||
1997 | __le32 start_time; /* lower 32-bits of TSF */ | 1993 | __le32 start_time; /* lower 32-bits of TSF */ |
1998 | u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ | 1994 | u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ |
1999 | u8 channel; | 1995 | u8 channel; |
2000 | u8 type; /* see enum iwl4965_measurement_type */ | 1996 | u8 type; /* see enum iwl_measurement_type */ |
2001 | u8 reserved1; | 1997 | u8 reserved1; |
2002 | /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only | 1998 | /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only |
2003 | * valid if applicable for measurement type requested. */ | 1999 | * valid if applicable for measurement type requested. */ |
@@ -2007,9 +2003,9 @@ struct iwl4965_spectrum_notification { | |||
2007 | u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - | 2003 | u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - |
2008 | * unidentified */ | 2004 | * unidentified */ |
2009 | u8 reserved2[3]; | 2005 | u8 reserved2[3]; |
2010 | struct iwl4965_measurement_histogram histogram; | 2006 | struct iwl_measurement_histogram histogram; |
2011 | __le32 stop_time; /* lower 32-bits of TSF */ | 2007 | __le32 stop_time; /* lower 32-bits of TSF */ |
2012 | __le32 status; /* see iwl4965_measurement_status */ | 2008 | __le32 status; /* see iwl_measurement_status */ |
2013 | } __attribute__ ((packed)); | 2009 | } __attribute__ ((packed)); |
2014 | 2010 | ||
2015 | /****************************************************************************** | 2011 | /****************************************************************************** |
@@ -2043,15 +2039,15 @@ struct iwl4965_spectrum_notification { | |||
2043 | * '11' Illegal set | 2039 | * '11' Illegal set |
2044 | * | 2040 | * |
2045 | * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then | 2041 | * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then |
2046 | * ucode assume sleep over DTIM is allowed and we don't need to wakeup | 2042 | * ucode assume sleep over DTIM is allowed and we don't need to wake up |
2047 | * for every DTIM. | 2043 | * for every DTIM. |
2048 | */ | 2044 | */ |
2049 | #define IWL_POWER_VEC_SIZE 5 | 2045 | #define IWL_POWER_VEC_SIZE 5 |
2050 | 2046 | ||
2051 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1 << 0) | 2047 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(1 << 0) |
2052 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1 << 2) | 2048 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(1 << 2) |
2053 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) | 2049 | #define IWL_POWER_PCI_PM_MSK cpu_to_le16(1 << 3) |
2054 | #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) | 2050 | #define IWL_POWER_FAST_PD cpu_to_le16(1 << 4) |
2055 | 2051 | ||
2056 | struct iwl_powertable_cmd { | 2052 | struct iwl_powertable_cmd { |
2057 | __le16 flags; | 2053 | __le16 flags; |
@@ -2067,7 +2063,7 @@ struct iwl_powertable_cmd { | |||
2067 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) | 2063 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) |
2068 | * 3945 and 4965 identical. | 2064 | * 3945 and 4965 identical. |
2069 | */ | 2065 | */ |
2070 | struct iwl4965_sleep_notification { | 2066 | struct iwl_sleep_notification { |
2071 | u8 pm_sleep_mode; | 2067 | u8 pm_sleep_mode; |
2072 | u8 pm_wakeup_src; | 2068 | u8 pm_wakeup_src; |
2073 | __le16 reserved; | 2069 | __le16 reserved; |
@@ -2097,14 +2093,14 @@ enum { | |||
2097 | #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ | 2093 | #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ |
2098 | #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ | 2094 | #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ |
2099 | #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ | 2095 | #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ |
2100 | struct iwl4965_card_state_cmd { | 2096 | struct iwl_card_state_cmd { |
2101 | __le32 status; /* CARD_STATE_CMD_* request new power state */ | 2097 | __le32 status; /* CARD_STATE_CMD_* request new power state */ |
2102 | } __attribute__ ((packed)); | 2098 | } __attribute__ ((packed)); |
2103 | 2099 | ||
2104 | /* | 2100 | /* |
2105 | * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) | 2101 | * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) |
2106 | */ | 2102 | */ |
2107 | struct iwl4965_card_state_notif { | 2103 | struct iwl_card_state_notif { |
2108 | __le32 flags; | 2104 | __le32 flags; |
2109 | } __attribute__ ((packed)); | 2105 | } __attribute__ ((packed)); |
2110 | 2106 | ||
@@ -2125,8 +2121,8 @@ struct iwl_ct_kill_config { | |||
2125 | * | 2121 | * |
2126 | *****************************************************************************/ | 2122 | *****************************************************************************/ |
2127 | 2123 | ||
2128 | #define SCAN_CHANNEL_TYPE_PASSIVE __constant_cpu_to_le32(0) | 2124 | #define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) |
2129 | #define SCAN_CHANNEL_TYPE_ACTIVE __constant_cpu_to_le32(1) | 2125 | #define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) |
2130 | 2126 | ||
2131 | /** | 2127 | /** |
2132 | * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table | 2128 | * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table |
@@ -2167,7 +2163,7 @@ struct iwl_scan_channel { | |||
2167 | * struct iwl_ssid_ie - directed scan network information element | 2163 | * struct iwl_ssid_ie - directed scan network information element |
2168 | * | 2164 | * |
2169 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field | 2165 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field |
2170 | * in struct iwl4965_scan_channel; each channel may select different ssids from | 2166 | * in struct iwl_scan_channel; each channel may select different ssids from |
2171 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. | 2167 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. |
2172 | */ | 2168 | */ |
2173 | struct iwl_ssid_ie { | 2169 | struct iwl_ssid_ie { |
@@ -2177,8 +2173,8 @@ struct iwl_ssid_ie { | |||
2177 | } __attribute__ ((packed)); | 2173 | } __attribute__ ((packed)); |
2178 | 2174 | ||
2179 | #define PROBE_OPTION_MAX 0x14 | 2175 | #define PROBE_OPTION_MAX 0x14 |
2180 | #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) | 2176 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) |
2181 | #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) | 2177 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) |
2182 | #define IWL_MAX_SCAN_SIZE 1024 | 2178 | #define IWL_MAX_SCAN_SIZE 1024 |
2183 | 2179 | ||
2184 | /* | 2180 | /* |
@@ -2267,7 +2263,7 @@ struct iwl_scan_cmd { | |||
2267 | * Number of channels in list is specified by channel_count. | 2263 | * Number of channels in list is specified by channel_count. |
2268 | * Each channel in list is of type: | 2264 | * Each channel in list is of type: |
2269 | * | 2265 | * |
2270 | * struct iwl4965_scan_channel channels[0]; | 2266 | * struct iwl_scan_channel channels[0]; |
2271 | * | 2267 | * |
2272 | * NOTE: Only one band of channels can be scanned per pass. You | 2268 | * NOTE: Only one band of channels can be scanned per pass. You |
2273 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait | 2269 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait |
@@ -2278,7 +2274,7 @@ struct iwl_scan_cmd { | |||
2278 | } __attribute__ ((packed)); | 2274 | } __attribute__ ((packed)); |
2279 | 2275 | ||
2280 | /* Can abort will notify by complete notification with abort status. */ | 2276 | /* Can abort will notify by complete notification with abort status. */ |
2281 | #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) | 2277 | #define CAN_ABORT_STATUS cpu_to_le32(0x1) |
2282 | /* complete notification statuses */ | 2278 | /* complete notification statuses */ |
2283 | #define ABORT_STATUS 0x2 | 2279 | #define ABORT_STATUS 0x2 |
2284 | 2280 | ||
@@ -2422,6 +2418,8 @@ struct statistics_rx_ht_phy { | |||
2422 | __le32 reserved2; | 2418 | __le32 reserved2; |
2423 | } __attribute__ ((packed)); | 2419 | } __attribute__ ((packed)); |
2424 | 2420 | ||
2421 | #define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) | ||
2422 | |||
2425 | struct statistics_rx_non_phy { | 2423 | struct statistics_rx_non_phy { |
2426 | __le32 bogus_cts; /* CTS received when not expecting CTS */ | 2424 | __le32 bogus_cts; /* CTS received when not expecting CTS */ |
2427 | __le32 bogus_ack; /* ACK received when not expecting ACK */ | 2425 | __le32 bogus_ack; /* ACK received when not expecting ACK */ |
@@ -2540,8 +2538,8 @@ struct statistics_general { | |||
2540 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag | 2538 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag |
2541 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. | 2539 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. |
2542 | */ | 2540 | */ |
2543 | #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ | 2541 | #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ |
2544 | #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ | 2542 | #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ |
2545 | struct iwl_statistics_cmd { | 2543 | struct iwl_statistics_cmd { |
2546 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ | 2544 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
2547 | } __attribute__ ((packed)); | 2545 | } __attribute__ ((packed)); |
@@ -2561,8 +2559,8 @@ struct iwl_statistics_cmd { | |||
2561 | * appropriately so that each notification contains statistics for only the | 2559 | * appropriately so that each notification contains statistics for only the |
2562 | * one channel that has just been scanned. | 2560 | * one channel that has just been scanned. |
2563 | */ | 2561 | */ |
2564 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) | 2562 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) |
2565 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) | 2563 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) |
2566 | struct iwl_notif_statistics { | 2564 | struct iwl_notif_statistics { |
2567 | __le32 flag; | 2565 | __le32 flag; |
2568 | struct statistics_rx rx; | 2566 | struct statistics_rx rx; |
@@ -2578,7 +2576,7 @@ struct iwl_notif_statistics { | |||
2578 | * then this notification will be sent. */ | 2576 | * then this notification will be sent. */ |
2579 | #define CONSECUTIVE_MISSED_BCONS_TH 20 | 2577 | #define CONSECUTIVE_MISSED_BCONS_TH 20 |
2580 | 2578 | ||
2581 | struct iwl4965_missed_beacon_notif { | 2579 | struct iwl_missed_beacon_notif { |
2582 | __le32 consequtive_missed_beacons; | 2580 | __le32 consequtive_missed_beacons; |
2583 | __le32 total_missed_becons; | 2581 | __le32 total_missed_becons; |
2584 | __le32 num_expected_beacons; | 2582 | __le32 num_expected_beacons; |
@@ -2778,8 +2776,8 @@ struct iwl4965_missed_beacon_notif { | |||
2778 | #define HD_OFDM_ENERGY_TH_IN_INDEX (10) | 2776 | #define HD_OFDM_ENERGY_TH_IN_INDEX (10) |
2779 | 2777 | ||
2780 | /* Control field in struct iwl_sensitivity_cmd */ | 2778 | /* Control field in struct iwl_sensitivity_cmd */ |
2781 | #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE __constant_cpu_to_le16(0) | 2779 | #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) |
2782 | #define SENSITIVITY_CMD_CONTROL_WORK_TABLE __constant_cpu_to_le16(1) | 2780 | #define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) |
2783 | 2781 | ||
2784 | /** | 2782 | /** |
2785 | * struct iwl_sensitivity_cmd | 2783 | * struct iwl_sensitivity_cmd |
@@ -2849,56 +2847,26 @@ struct iwl_sensitivity_cmd { | |||
2849 | * 1-0: amount of gain, units of 1.5 dB | 2847 | * 1-0: amount of gain, units of 1.5 dB |
2850 | */ | 2848 | */ |
2851 | 2849 | ||
2852 | /* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */ | 2850 | /* Phy calibration command for series */ |
2853 | #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) | ||
2854 | |||
2855 | struct iwl4965_calibration_cmd { | ||
2856 | u8 opCode; /* PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ | ||
2857 | u8 flags; /* not used */ | ||
2858 | __le16 reserved; | ||
2859 | s8 diff_gain_a; /* see above */ | ||
2860 | s8 diff_gain_b; | ||
2861 | s8 diff_gain_c; | ||
2862 | u8 reserved1; | ||
2863 | } __attribute__ ((packed)); | ||
2864 | |||
2865 | /* Phy calibration command for 5000 series */ | ||
2866 | |||
2867 | enum { | ||
2868 | IWL5000_PHY_CALIBRATE_DC_CMD = 8, | ||
2869 | IWL5000_PHY_CALIBRATE_LO_CMD = 9, | ||
2870 | IWL5000_PHY_CALIBRATE_RX_BB_CMD = 10, | ||
2871 | IWL5000_PHY_CALIBRATE_TX_IQ_CMD = 11, | ||
2872 | IWL5000_PHY_CALIBRATE_RX_IQ_CMD = 12, | ||
2873 | IWL5000_PHY_CALIBRATION_NOISE_CMD = 13, | ||
2874 | IWL5000_PHY_CALIBRATE_AGC_TABLE_CMD = 14, | ||
2875 | IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, | ||
2876 | IWL5000_PHY_CALIBRATE_BASE_BAND_CMD = 16, | ||
2877 | IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, | ||
2878 | IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, | ||
2879 | IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, | ||
2880 | }; | ||
2881 | 2851 | ||
2882 | enum { | 2852 | enum { |
2883 | CALIBRATION_CFG_CMD = 0x65, | 2853 | IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, |
2884 | CALIBRATION_RES_NOTIFICATION = 0x66, | 2854 | IWL_PHY_CALIBRATE_DC_CMD = 8, |
2885 | CALIBRATION_COMPLETE_NOTIFICATION = 0x67 | 2855 | IWL_PHY_CALIBRATE_LO_CMD = 9, |
2856 | IWL_PHY_CALIBRATE_RX_BB_CMD = 10, | ||
2857 | IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, | ||
2858 | IWL_PHY_CALIBRATE_RX_IQ_CMD = 12, | ||
2859 | IWL_PHY_CALIBRATION_NOISE_CMD = 13, | ||
2860 | IWL_PHY_CALIBRATE_AGC_TABLE_CMD = 14, | ||
2861 | IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, | ||
2862 | IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, | ||
2863 | IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, | ||
2864 | IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, | ||
2865 | IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, | ||
2886 | }; | 2866 | }; |
2887 | 2867 | ||
2888 | struct iwl_cal_crystal_freq_cmd { | ||
2889 | u8 cap_pin1; | ||
2890 | u8 cap_pin2; | ||
2891 | } __attribute__ ((packed)); | ||
2892 | |||
2893 | struct iwl5000_calibration { | ||
2894 | u8 op_code; | ||
2895 | u8 first_group; | ||
2896 | u8 num_groups; | ||
2897 | u8 all_data_valid; | ||
2898 | struct iwl_cal_crystal_freq_cmd data; | ||
2899 | } __attribute__ ((packed)); | ||
2900 | 2868 | ||
2901 | #define IWL_CALIB_INIT_CFG_ALL __constant_cpu_to_le32(0xffffffff) | 2869 | #define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff) |
2902 | 2870 | ||
2903 | struct iwl_calib_cfg_elmnt_s { | 2871 | struct iwl_calib_cfg_elmnt_s { |
2904 | __le32 is_enable; | 2872 | __le32 is_enable; |
@@ -2914,32 +2882,52 @@ struct iwl_calib_cfg_status_s { | |||
2914 | __le32 flags; | 2882 | __le32 flags; |
2915 | } __attribute__ ((packed)); | 2883 | } __attribute__ ((packed)); |
2916 | 2884 | ||
2917 | struct iwl5000_calib_cfg_cmd { | 2885 | struct iwl_calib_cfg_cmd { |
2918 | struct iwl_calib_cfg_status_s ucd_calib_cfg; | 2886 | struct iwl_calib_cfg_status_s ucd_calib_cfg; |
2919 | struct iwl_calib_cfg_status_s drv_calib_cfg; | 2887 | struct iwl_calib_cfg_status_s drv_calib_cfg; |
2920 | __le32 reserved1; | 2888 | __le32 reserved1; |
2921 | } __attribute__ ((packed)); | 2889 | } __attribute__ ((packed)); |
2922 | 2890 | ||
2923 | struct iwl5000_calib_hdr { | 2891 | struct iwl_calib_hdr { |
2924 | u8 op_code; | 2892 | u8 op_code; |
2925 | u8 first_group; | 2893 | u8 first_group; |
2926 | u8 groups_num; | 2894 | u8 groups_num; |
2927 | u8 data_valid; | 2895 | u8 data_valid; |
2928 | } __attribute__ ((packed)); | 2896 | } __attribute__ ((packed)); |
2929 | 2897 | ||
2930 | struct iwl5000_calibration_chain_noise_reset_cmd { | 2898 | struct iwl_calib_cmd { |
2931 | u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ | 2899 | struct iwl_calib_hdr hdr; |
2932 | u8 flags; /* not used */ | 2900 | u8 data[0]; |
2933 | __le16 reserved; | ||
2934 | } __attribute__ ((packed)); | 2901 | } __attribute__ ((packed)); |
2935 | 2902 | ||
2936 | struct iwl5000_calibration_chain_noise_gain_cmd { | 2903 | /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ |
2937 | u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ | 2904 | struct iwl_calib_diff_gain_cmd { |
2938 | u8 flags; /* not used */ | 2905 | struct iwl_calib_hdr hdr; |
2939 | __le16 reserved; | 2906 | s8 diff_gain_a; /* see above */ |
2907 | s8 diff_gain_b; | ||
2908 | s8 diff_gain_c; | ||
2909 | u8 reserved1; | ||
2910 | } __attribute__ ((packed)); | ||
2911 | |||
2912 | struct iwl_calib_xtal_freq_cmd { | ||
2913 | struct iwl_calib_hdr hdr; | ||
2914 | u8 cap_pin1; | ||
2915 | u8 cap_pin2; | ||
2916 | u8 pad[2]; | ||
2917 | } __attribute__ ((packed)); | ||
2918 | |||
2919 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ | ||
2920 | struct iwl_calib_chain_noise_reset_cmd { | ||
2921 | struct iwl_calib_hdr hdr; | ||
2922 | u8 data[0]; | ||
2923 | }; | ||
2924 | |||
2925 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ | ||
2926 | struct iwl_calib_chain_noise_gain_cmd { | ||
2927 | struct iwl_calib_hdr hdr; | ||
2940 | u8 delta_gain_1; | 2928 | u8 delta_gain_1; |
2941 | u8 delta_gain_2; | 2929 | u8 delta_gain_2; |
2942 | __le16 reserved1; | 2930 | u8 pad[2]; |
2943 | } __attribute__ ((packed)); | 2931 | } __attribute__ ((packed)); |
2944 | 2932 | ||
2945 | /****************************************************************************** | 2933 | /****************************************************************************** |
@@ -2999,11 +2987,11 @@ struct iwl_wimax_coex_event_entry { | |||
2999 | 2987 | ||
3000 | /* COEX flag masks */ | 2988 | /* COEX flag masks */ |
3001 | 2989 | ||
3002 | /* Staion table is valid */ | 2990 | /* Station table is valid */ |
3003 | #define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) | 2991 | #define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) |
3004 | /* UnMask wakeup src at unassociated sleep */ | 2992 | /* UnMask wake up src at unassociated sleep */ |
3005 | #define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) | 2993 | #define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) |
3006 | /* UnMask wakeup src at associated sleep */ | 2994 | /* UnMask wake up src at associated sleep */ |
3007 | #define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) | 2995 | #define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) |
3008 | /* Enable CoEx feature. */ | 2996 | /* Enable CoEx feature. */ |
3009 | #define COEX_FLAGS_COEX_ENABLE_MSK (0x80) | 2997 | #define COEX_FLAGS_COEX_ENABLE_MSK (0x80) |
@@ -3025,26 +3013,22 @@ struct iwl_rx_packet { | |||
3025 | struct iwl_cmd_header hdr; | 3013 | struct iwl_cmd_header hdr; |
3026 | union { | 3014 | union { |
3027 | struct iwl_alive_resp alive_frame; | 3015 | struct iwl_alive_resp alive_frame; |
3028 | struct iwl4965_rx_frame rx_frame; | 3016 | struct iwl_spectrum_notification spectrum_notif; |
3029 | struct iwl4965_tx_resp tx_resp; | 3017 | struct iwl_csa_notification csa_notif; |
3030 | struct iwl4965_spectrum_notification spectrum_notif; | ||
3031 | struct iwl4965_csa_notification csa_notif; | ||
3032 | struct iwl_error_resp err_resp; | 3018 | struct iwl_error_resp err_resp; |
3033 | struct iwl4965_card_state_notif card_state_notif; | 3019 | struct iwl_card_state_notif card_state_notif; |
3034 | struct iwl4965_beacon_notif beacon_status; | ||
3035 | struct iwl_add_sta_resp add_sta; | 3020 | struct iwl_add_sta_resp add_sta; |
3036 | struct iwl_rem_sta_resp rem_sta; | 3021 | struct iwl_rem_sta_resp rem_sta; |
3037 | struct iwl4965_sleep_notification sleep_notif; | 3022 | struct iwl_sleep_notification sleep_notif; |
3038 | struct iwl4965_spectrum_resp spectrum; | 3023 | struct iwl_spectrum_resp spectrum; |
3039 | struct iwl_notif_statistics stats; | 3024 | struct iwl_notif_statistics stats; |
3040 | struct iwl_compressed_ba_resp compressed_ba; | 3025 | struct iwl_compressed_ba_resp compressed_ba; |
3041 | struct iwl4965_missed_beacon_notif missed_beacon; | 3026 | struct iwl_missed_beacon_notif missed_beacon; |
3042 | struct iwl5000_calibration calib; | ||
3043 | __le32 status; | 3027 | __le32 status; |
3044 | u8 raw[0]; | 3028 | u8 raw[0]; |
3045 | } u; | 3029 | } u; |
3046 | } __attribute__ ((packed)); | 3030 | } __attribute__ ((packed)); |
3047 | 3031 | ||
3048 | #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame)) | 3032 | int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon); |
3049 | 3033 | ||
3050 | #endif /* __iwl4965_commands_h__ */ | 3034 | #endif /* __iwl_commands_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 01a845851338..73d7973707eb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * in the file called LICENSE.GPL. | 22 | * in the file called LICENSE.GPL. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * Tomas Winkler <tomas.winkler@intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
@@ -30,19 +30,19 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <net/mac80211.h> | 31 | #include <net/mac80211.h> |
32 | 32 | ||
33 | struct iwl_priv; /* FIXME: remove */ | ||
34 | #include "iwl-debug.h" | ||
35 | #include "iwl-eeprom.h" | 33 | #include "iwl-eeprom.h" |
36 | #include "iwl-dev.h" /* FIXME: remove */ | 34 | #include "iwl-dev.h" /* FIXME: remove */ |
35 | #include "iwl-debug.h" | ||
37 | #include "iwl-core.h" | 36 | #include "iwl-core.h" |
38 | #include "iwl-io.h" | 37 | #include "iwl-io.h" |
39 | #include "iwl-rfkill.h" | 38 | #include "iwl-rfkill.h" |
40 | #include "iwl-power.h" | 39 | #include "iwl-power.h" |
40 | #include "iwl-sta.h" | ||
41 | 41 | ||
42 | 42 | ||
43 | MODULE_DESCRIPTION("iwl core"); | 43 | MODULE_DESCRIPTION("iwl core"); |
44 | MODULE_VERSION(IWLWIFI_VERSION); | 44 | MODULE_VERSION(IWLWIFI_VERSION); |
45 | MODULE_AUTHOR(DRV_COPYRIGHT); | 45 | MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); |
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | 47 | ||
48 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ | 48 | #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ |
@@ -88,26 +88,27 @@ EXPORT_SYMBOL(iwl_rates); | |||
88 | * translate ucode response to mac80211 tx status control values | 88 | * translate ucode response to mac80211 tx status control values |
89 | */ | 89 | */ |
90 | void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, | 90 | void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, |
91 | struct ieee80211_tx_info *control) | 91 | struct ieee80211_tx_info *info) |
92 | { | 92 | { |
93 | int rate_index; | 93 | int rate_index; |
94 | struct ieee80211_tx_rate *r = &info->control.rates[0]; | ||
94 | 95 | ||
95 | control->antenna_sel_tx = | 96 | info->antenna_sel_tx = |
96 | ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); | 97 | ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); |
97 | if (rate_n_flags & RATE_MCS_HT_MSK) | 98 | if (rate_n_flags & RATE_MCS_HT_MSK) |
98 | control->flags |= IEEE80211_TX_CTL_OFDM_HT; | 99 | r->flags |= IEEE80211_TX_RC_MCS; |
99 | if (rate_n_flags & RATE_MCS_GF_MSK) | 100 | if (rate_n_flags & RATE_MCS_GF_MSK) |
100 | control->flags |= IEEE80211_TX_CTL_GREEN_FIELD; | 101 | r->flags |= IEEE80211_TX_RC_GREEN_FIELD; |
101 | if (rate_n_flags & RATE_MCS_FAT_MSK) | 102 | if (rate_n_flags & RATE_MCS_FAT_MSK) |
102 | control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH; | 103 | r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; |
103 | if (rate_n_flags & RATE_MCS_DUP_MSK) | 104 | if (rate_n_flags & RATE_MCS_DUP_MSK) |
104 | control->flags |= IEEE80211_TX_CTL_DUP_DATA; | 105 | r->flags |= IEEE80211_TX_RC_DUP_DATA; |
105 | if (rate_n_flags & RATE_MCS_SGI_MSK) | 106 | if (rate_n_flags & RATE_MCS_SGI_MSK) |
106 | control->flags |= IEEE80211_TX_CTL_SHORT_GI; | 107 | r->flags |= IEEE80211_TX_RC_SHORT_GI; |
107 | rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags); | 108 | rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags); |
108 | if (control->band == IEEE80211_BAND_5GHZ) | 109 | if (info->band == IEEE80211_BAND_5GHZ) |
109 | rate_index -= IWL_FIRST_OFDM_RATE; | 110 | rate_index -= IWL_FIRST_OFDM_RATE; |
110 | control->tx_rate_idx = rate_index; | 111 | r->idx = rate_index; |
111 | } | 112 | } |
112 | EXPORT_SYMBOL(iwl_hwrate_to_tx_control); | 113 | EXPORT_SYMBOL(iwl_hwrate_to_tx_control); |
113 | 114 | ||
@@ -119,7 +120,9 @@ int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) | |||
119 | if (rate_n_flags & RATE_MCS_HT_MSK) { | 120 | if (rate_n_flags & RATE_MCS_HT_MSK) { |
120 | idx = (rate_n_flags & 0xff); | 121 | idx = (rate_n_flags & 0xff); |
121 | 122 | ||
122 | if (idx >= IWL_RATE_MIMO2_6M_PLCP) | 123 | if (idx >= IWL_RATE_MIMO3_6M_PLCP) |
124 | idx = idx - IWL_RATE_MIMO3_6M_PLCP; | ||
125 | else if (idx >= IWL_RATE_MIMO2_6M_PLCP) | ||
123 | idx = idx - IWL_RATE_MIMO2_6M_PLCP; | 126 | idx = idx - IWL_RATE_MIMO2_6M_PLCP; |
124 | 127 | ||
125 | idx += IWL_FIRST_OFDM_RATE; | 128 | idx += IWL_FIRST_OFDM_RATE; |
@@ -140,7 +143,17 @@ int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) | |||
140 | } | 143 | } |
141 | EXPORT_SYMBOL(iwl_hwrate_to_plcp_idx); | 144 | EXPORT_SYMBOL(iwl_hwrate_to_plcp_idx); |
142 | 145 | ||
143 | 146 | u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant) | |
147 | { | ||
148 | int i; | ||
149 | u8 ind = ant; | ||
150 | for (i = 0; i < RATE_ANT_NUM - 1; i++) { | ||
151 | ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; | ||
152 | if (priv->hw_params.valid_tx_ant & BIT(ind)) | ||
153 | return ind; | ||
154 | } | ||
155 | return ant; | ||
156 | } | ||
144 | 157 | ||
145 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 158 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
146 | EXPORT_SYMBOL(iwl_bcast_addr); | 159 | EXPORT_SYMBOL(iwl_bcast_addr); |
@@ -177,52 +190,6 @@ void iwl_hw_detect(struct iwl_priv *priv) | |||
177 | } | 190 | } |
178 | EXPORT_SYMBOL(iwl_hw_detect); | 191 | EXPORT_SYMBOL(iwl_hw_detect); |
179 | 192 | ||
180 | /* Tell nic where to find the "keep warm" buffer */ | ||
181 | int iwl_kw_init(struct iwl_priv *priv) | ||
182 | { | ||
183 | unsigned long flags; | ||
184 | int ret; | ||
185 | |||
186 | spin_lock_irqsave(&priv->lock, flags); | ||
187 | ret = iwl_grab_nic_access(priv); | ||
188 | if (ret) | ||
189 | goto out; | ||
190 | |||
191 | iwl_write_direct32(priv, FH_KW_MEM_ADDR_REG, | ||
192 | priv->kw.dma_addr >> 4); | ||
193 | iwl_release_nic_access(priv); | ||
194 | out: | ||
195 | spin_unlock_irqrestore(&priv->lock, flags); | ||
196 | return ret; | ||
197 | } | ||
198 | |||
199 | int iwl_kw_alloc(struct iwl_priv *priv) | ||
200 | { | ||
201 | struct pci_dev *dev = priv->pci_dev; | ||
202 | struct iwl_kw *kw = &priv->kw; | ||
203 | |||
204 | kw->size = IWL_KW_SIZE; | ||
205 | kw->v_addr = pci_alloc_consistent(dev, kw->size, &kw->dma_addr); | ||
206 | if (!kw->v_addr) | ||
207 | return -ENOMEM; | ||
208 | |||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | /** | ||
213 | * iwl_kw_free - Free the "keep warm" buffer | ||
214 | */ | ||
215 | void iwl_kw_free(struct iwl_priv *priv) | ||
216 | { | ||
217 | struct pci_dev *dev = priv->pci_dev; | ||
218 | struct iwl_kw *kw = &priv->kw; | ||
219 | |||
220 | if (kw->v_addr) { | ||
221 | pci_free_consistent(dev, kw->size, kw->v_addr, kw->dma_addr); | ||
222 | memset(kw, 0, sizeof(*kw)); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | int iwl_hw_nic_init(struct iwl_priv *priv) | 193 | int iwl_hw_nic_init(struct iwl_priv *priv) |
227 | { | 194 | { |
228 | unsigned long flags; | 195 | unsigned long flags; |
@@ -271,55 +238,30 @@ int iwl_hw_nic_init(struct iwl_priv *priv) | |||
271 | } | 238 | } |
272 | EXPORT_SYMBOL(iwl_hw_nic_init); | 239 | EXPORT_SYMBOL(iwl_hw_nic_init); |
273 | 240 | ||
274 | /** | ||
275 | * iwl_clear_stations_table - Clear the driver's station table | ||
276 | * | ||
277 | * NOTE: This does not clear or otherwise alter the device's station table. | ||
278 | */ | ||
279 | void iwl_clear_stations_table(struct iwl_priv *priv) | ||
280 | { | ||
281 | unsigned long flags; | ||
282 | |||
283 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
284 | |||
285 | if (iwl_is_alive(priv) && | ||
286 | !test_bit(STATUS_EXIT_PENDING, &priv->status) && | ||
287 | iwl_send_cmd_pdu_async(priv, REPLY_REMOVE_ALL_STA, 0, NULL, NULL)) | ||
288 | IWL_ERROR("Couldn't clear the station table\n"); | ||
289 | |||
290 | priv->num_stations = 0; | ||
291 | memset(priv->stations, 0, sizeof(priv->stations)); | ||
292 | |||
293 | /* clean ucode key table bit map */ | ||
294 | priv->ucode_key_table = 0; | ||
295 | |||
296 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
297 | } | ||
298 | EXPORT_SYMBOL(iwl_clear_stations_table); | ||
299 | |||
300 | void iwl_reset_qos(struct iwl_priv *priv) | 241 | void iwl_reset_qos(struct iwl_priv *priv) |
301 | { | 242 | { |
302 | u16 cw_min = 15; | 243 | u16 cw_min = 15; |
303 | u16 cw_max = 1023; | 244 | u16 cw_max = 1023; |
304 | u8 aifs = 2; | 245 | u8 aifs = 2; |
305 | u8 is_legacy = 0; | 246 | bool is_legacy = false; |
306 | unsigned long flags; | 247 | unsigned long flags; |
307 | int i; | 248 | int i; |
308 | 249 | ||
309 | spin_lock_irqsave(&priv->lock, flags); | 250 | spin_lock_irqsave(&priv->lock, flags); |
310 | priv->qos_data.qos_active = 0; | 251 | /* QoS always active in AP and ADHOC mode |
252 | * In STA mode wait for association | ||
253 | */ | ||
254 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC || | ||
255 | priv->iw_mode == NL80211_IFTYPE_AP) | ||
256 | priv->qos_data.qos_active = 1; | ||
257 | else | ||
258 | priv->qos_data.qos_active = 0; | ||
311 | 259 | ||
312 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { | 260 | /* check for legacy mode */ |
313 | if (priv->qos_data.qos_enable) | 261 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC && |
314 | priv->qos_data.qos_active = 1; | 262 | (priv->active_rate & IWL_OFDM_RATES_MASK) == 0) || |
315 | if (!(priv->active_rate & 0xfff0)) { | 263 | (priv->iw_mode == NL80211_IFTYPE_STATION && |
316 | cw_min = 31; | 264 | (priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK) == 0)) { |
317 | is_legacy = 1; | ||
318 | } | ||
319 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
320 | if (priv->qos_data.qos_enable) | ||
321 | priv->qos_data.qos_active = 1; | ||
322 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | ||
323 | cw_min = 31; | 265 | cw_min = 31; |
324 | is_legacy = 1; | 266 | is_legacy = 1; |
325 | } | 267 | } |
@@ -385,10 +327,10 @@ void iwl_reset_qos(struct iwl_priv *priv) | |||
385 | } | 327 | } |
386 | EXPORT_SYMBOL(iwl_reset_qos); | 328 | EXPORT_SYMBOL(iwl_reset_qos); |
387 | 329 | ||
388 | #define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */ | 330 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ |
389 | #define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */ | 331 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ |
390 | static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, | 332 | static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, |
391 | struct ieee80211_ht_info *ht_info, | 333 | struct ieee80211_sta_ht_cap *ht_info, |
392 | enum ieee80211_band band) | 334 | enum ieee80211_band band) |
393 | { | 335 | { |
394 | u16 max_bit_rate = 0; | 336 | u16 max_bit_rate = 0; |
@@ -396,45 +338,46 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, | |||
396 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | 338 | u8 tx_chains_num = priv->hw_params.tx_chains_num; |
397 | 339 | ||
398 | ht_info->cap = 0; | 340 | ht_info->cap = 0; |
399 | memset(ht_info->supp_mcs_set, 0, 16); | 341 | memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); |
400 | 342 | ||
401 | ht_info->ht_supported = 1; | 343 | ht_info->ht_supported = true; |
402 | 344 | ||
403 | ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD; | 345 | ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; |
404 | ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; | 346 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; |
405 | ht_info->cap |= (u16)(IEEE80211_HT_CAP_SM_PS & | 347 | ht_info->cap |= (IEEE80211_HT_CAP_SM_PS & |
406 | (WLAN_HT_CAP_SM_PS_DISABLED << 2)); | 348 | (WLAN_HT_CAP_SM_PS_DISABLED << 2)); |
407 | 349 | ||
408 | max_bit_rate = MAX_BIT_RATE_20_MHZ; | 350 | max_bit_rate = MAX_BIT_RATE_20_MHZ; |
409 | if (priv->hw_params.fat_channel & BIT(band)) { | 351 | if (priv->hw_params.fat_channel & BIT(band)) { |
410 | ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH; | 352 | ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
411 | ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40; | 353 | ht_info->cap |= IEEE80211_HT_CAP_SGI_40; |
412 | ht_info->supp_mcs_set[4] = 0x01; | 354 | ht_info->mcs.rx_mask[4] = 0x01; |
413 | max_bit_rate = MAX_BIT_RATE_40_MHZ; | 355 | max_bit_rate = MAX_BIT_RATE_40_MHZ; |
414 | } | 356 | } |
415 | 357 | ||
416 | if (priv->cfg->mod_params->amsdu_size_8K) | 358 | if (priv->cfg->mod_params->amsdu_size_8K) |
417 | ht_info->cap |= (u16)IEEE80211_HT_CAP_MAX_AMSDU; | 359 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
418 | 360 | ||
419 | ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; | 361 | ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; |
420 | ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; | 362 | ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; |
421 | 363 | ||
422 | ht_info->supp_mcs_set[0] = 0xFF; | 364 | ht_info->mcs.rx_mask[0] = 0xFF; |
423 | if (rx_chains_num >= 2) | 365 | if (rx_chains_num >= 2) |
424 | ht_info->supp_mcs_set[1] = 0xFF; | 366 | ht_info->mcs.rx_mask[1] = 0xFF; |
425 | if (rx_chains_num >= 3) | 367 | if (rx_chains_num >= 3) |
426 | ht_info->supp_mcs_set[2] = 0xFF; | 368 | ht_info->mcs.rx_mask[2] = 0xFF; |
427 | 369 | ||
428 | /* Highest supported Rx data rate */ | 370 | /* Highest supported Rx data rate */ |
429 | max_bit_rate *= rx_chains_num; | 371 | max_bit_rate *= rx_chains_num; |
430 | ht_info->supp_mcs_set[10] = (u8)(max_bit_rate & 0x00FF); | 372 | WARN_ON(max_bit_rate & ~IEEE80211_HT_MCS_RX_HIGHEST_MASK); |
431 | ht_info->supp_mcs_set[11] = (u8)((max_bit_rate & 0xFF00) >> 8); | 373 | ht_info->mcs.rx_highest = cpu_to_le16(max_bit_rate); |
432 | 374 | ||
433 | /* Tx MCS capabilities */ | 375 | /* Tx MCS capabilities */ |
434 | ht_info->supp_mcs_set[12] = IEEE80211_HT_CAP_MCS_TX_DEFINED; | 376 | ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; |
435 | if (tx_chains_num != rx_chains_num) { | 377 | if (tx_chains_num != rx_chains_num) { |
436 | ht_info->supp_mcs_set[12] |= IEEE80211_HT_CAP_MCS_TX_RX_DIFF; | 378 | ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; |
437 | ht_info->supp_mcs_set[12] |= ((tx_chains_num - 1) << 2); | 379 | ht_info->mcs.tx_params |= ((tx_chains_num - 1) << |
380 | IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); | ||
438 | } | 381 | } |
439 | } | 382 | } |
440 | 383 | ||
@@ -498,7 +441,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv) | |||
498 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | 441 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; |
499 | 442 | ||
500 | if (priv->cfg->sku & IWL_SKU_N) | 443 | if (priv->cfg->sku & IWL_SKU_N) |
501 | iwlcore_init_ht_hw_capab(priv, &sband->ht_info, | 444 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
502 | IEEE80211_BAND_5GHZ); | 445 | IEEE80211_BAND_5GHZ); |
503 | 446 | ||
504 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; | 447 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
@@ -508,7 +451,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv) | |||
508 | sband->n_bitrates = IWL_RATE_COUNT; | 451 | sband->n_bitrates = IWL_RATE_COUNT; |
509 | 452 | ||
510 | if (priv->cfg->sku & IWL_SKU_N) | 453 | if (priv->cfg->sku & IWL_SKU_N) |
511 | iwlcore_init_ht_hw_capab(priv, &sband->ht_info, | 454 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
512 | IEEE80211_BAND_2GHZ); | 455 | IEEE80211_BAND_2GHZ); |
513 | 456 | ||
514 | priv->ieee_channels = channels; | 457 | priv->ieee_channels = channels; |
@@ -598,8 +541,8 @@ static void iwlcore_free_geos(struct iwl_priv *priv) | |||
598 | static bool is_single_rx_stream(struct iwl_priv *priv) | 541 | static bool is_single_rx_stream(struct iwl_priv *priv) |
599 | { | 542 | { |
600 | return !priv->current_ht_config.is_ht || | 543 | return !priv->current_ht_config.is_ht || |
601 | ((priv->current_ht_config.supp_mcs_set[1] == 0) && | 544 | ((priv->current_ht_config.mcs.rx_mask[1] == 0) && |
602 | (priv->current_ht_config.supp_mcs_set[2] == 0)); | 545 | (priv->current_ht_config.mcs.rx_mask[2] == 0)); |
603 | } | 546 | } |
604 | 547 | ||
605 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, | 548 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, |
@@ -612,10 +555,10 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, | |||
612 | if (!is_channel_valid(ch_info)) | 555 | if (!is_channel_valid(ch_info)) |
613 | return 0; | 556 | return 0; |
614 | 557 | ||
615 | if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) | 558 | if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) |
616 | return !(ch_info->fat_extension_channel & | 559 | return !(ch_info->fat_extension_channel & |
617 | IEEE80211_CHAN_NO_FAT_ABOVE); | 560 | IEEE80211_CHAN_NO_FAT_ABOVE); |
618 | else if (extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) | 561 | else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) |
619 | return !(ch_info->fat_extension_channel & | 562 | return !(ch_info->fat_extension_channel & |
620 | IEEE80211_CHAN_NO_FAT_BELOW); | 563 | IEEE80211_CHAN_NO_FAT_BELOW); |
621 | 564 | ||
@@ -623,24 +566,24 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, | |||
623 | } | 566 | } |
624 | 567 | ||
625 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, | 568 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, |
626 | struct ieee80211_ht_info *sta_ht_inf) | 569 | struct ieee80211_sta_ht_cap *sta_ht_inf) |
627 | { | 570 | { |
628 | struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; | 571 | struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; |
629 | 572 | ||
630 | if ((!iwl_ht_conf->is_ht) || | 573 | if ((!iwl_ht_conf->is_ht) || |
631 | (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || | 574 | (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || |
632 | (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE)) | 575 | (iwl_ht_conf->extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_NONE)) |
633 | return 0; | 576 | return 0; |
634 | 577 | ||
635 | if (sta_ht_inf) { | 578 | if (sta_ht_inf) { |
636 | if ((!sta_ht_inf->ht_supported) || | 579 | if ((!sta_ht_inf->ht_supported) || |
637 | (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))) | 580 | (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))) |
638 | return 0; | 581 | return 0; |
639 | } | 582 | } |
640 | 583 | ||
641 | return iwl_is_channel_extension(priv, priv->band, | 584 | return iwl_is_channel_extension(priv, priv->band, |
642 | iwl_ht_conf->control_channel, | 585 | le16_to_cpu(priv->staging_rxon.channel), |
643 | iwl_ht_conf->extension_chan_offset); | 586 | iwl_ht_conf->extension_chan_offset); |
644 | } | 587 | } |
645 | EXPORT_SYMBOL(iwl_is_fat_tx_allowed); | 588 | EXPORT_SYMBOL(iwl_is_fat_tx_allowed); |
646 | 589 | ||
@@ -665,22 +608,15 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | |||
665 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | | 608 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | |
666 | RXON_FLG_CHANNEL_MODE_PURE_40_MSK); | 609 | RXON_FLG_CHANNEL_MODE_PURE_40_MSK); |
667 | 610 | ||
668 | if (le16_to_cpu(rxon->channel) != ht_info->control_channel) { | ||
669 | IWL_DEBUG_ASSOC("control diff than current %d %d\n", | ||
670 | le16_to_cpu(rxon->channel), | ||
671 | ht_info->control_channel); | ||
672 | return; | ||
673 | } | ||
674 | |||
675 | /* Note: control channel is opposite of extension channel */ | 611 | /* Note: control channel is opposite of extension channel */ |
676 | switch (ht_info->extension_chan_offset) { | 612 | switch (ht_info->extension_chan_offset) { |
677 | case IEEE80211_HT_IE_CHA_SEC_ABOVE: | 613 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
678 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | 614 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); |
679 | break; | 615 | break; |
680 | case IEEE80211_HT_IE_CHA_SEC_BELOW: | 616 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: |
681 | rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; | 617 | rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; |
682 | break; | 618 | break; |
683 | case IEEE80211_HT_IE_CHA_SEC_NONE: | 619 | case IEEE80211_HT_PARAM_CHA_SEC_NONE: |
684 | default: | 620 | default: |
685 | rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK; | 621 | rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK; |
686 | break; | 622 | break; |
@@ -694,14 +630,12 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | |||
694 | 630 | ||
695 | IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X " | 631 | IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X " |
696 | "rxon flags 0x%X operation mode :0x%X " | 632 | "rxon flags 0x%X operation mode :0x%X " |
697 | "extension channel offset 0x%x " | 633 | "extension channel offset 0x%x\n", |
698 | "control chan %d\n", | 634 | ht_info->mcs.rx_mask[0], |
699 | ht_info->supp_mcs_set[0], | 635 | ht_info->mcs.rx_mask[1], |
700 | ht_info->supp_mcs_set[1], | 636 | ht_info->mcs.rx_mask[2], |
701 | ht_info->supp_mcs_set[2], | ||
702 | le32_to_cpu(rxon->flags), ht_info->ht_protection, | 637 | le32_to_cpu(rxon->flags), ht_info->ht_protection, |
703 | ht_info->extension_chan_offset, | 638 | ht_info->extension_chan_offset); |
704 | ht_info->control_channel); | ||
705 | return; | 639 | return; |
706 | } | 640 | } |
707 | EXPORT_SYMBOL(iwl_set_rxon_ht); | 641 | EXPORT_SYMBOL(iwl_set_rxon_ht); |
@@ -745,7 +679,7 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | |||
745 | break; | 679 | break; |
746 | case WLAN_HT_CAP_SM_PS_INVALID: | 680 | case WLAN_HT_CAP_SM_PS_INVALID: |
747 | default: | 681 | default: |
748 | IWL_ERROR("invalide mimo ps mode %d\n", | 682 | IWL_ERROR("invalid mimo ps mode %d\n", |
749 | priv->current_ht_config.sm_ps); | 683 | priv->current_ht_config.sm_ps); |
750 | WARN_ON(1); | 684 | WARN_ON(1); |
751 | idle_cnt = -1; | 685 | idle_cnt = -1; |
@@ -871,11 +805,14 @@ int iwl_setup_mac(struct iwl_priv *priv) | |||
871 | 805 | ||
872 | /* Tell mac80211 our characteristics */ | 806 | /* Tell mac80211 our characteristics */ |
873 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 807 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
874 | IEEE80211_HW_NOISE_DBM; | 808 | IEEE80211_HW_NOISE_DBM | |
809 | IEEE80211_HW_AMPDU_AGGREGATION; | ||
875 | hw->wiphy->interface_modes = | 810 | hw->wiphy->interface_modes = |
876 | BIT(NL80211_IFTYPE_AP) | | ||
877 | BIT(NL80211_IFTYPE_STATION) | | 811 | BIT(NL80211_IFTYPE_STATION) | |
878 | BIT(NL80211_IFTYPE_ADHOC); | 812 | BIT(NL80211_IFTYPE_ADHOC); |
813 | |||
814 | hw->wiphy->fw_handles_regulatory = true; | ||
815 | |||
879 | /* Default value; 4 EDCA QOS priorities */ | 816 | /* Default value; 4 EDCA QOS priorities */ |
880 | hw->queues = 4; | 817 | hw->queues = 4; |
881 | /* queues to support 11n aggregation */ | 818 | /* queues to support 11n aggregation */ |
@@ -948,16 +885,12 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
948 | 885 | ||
949 | priv->iw_mode = NL80211_IFTYPE_STATION; | 886 | priv->iw_mode = NL80211_IFTYPE_STATION; |
950 | 887 | ||
951 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ | ||
952 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; | 888 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; |
953 | 889 | ||
954 | /* Choose which receivers/antennas to use */ | 890 | /* Choose which receivers/antennas to use */ |
955 | iwl_set_rxon_chain(priv); | 891 | iwl_set_rxon_chain(priv); |
956 | iwl_init_scan_params(priv); | 892 | iwl_init_scan_params(priv); |
957 | 893 | ||
958 | if (priv->cfg->mod_params->enable_qos) | ||
959 | priv->qos_data.qos_enable = 1; | ||
960 | |||
961 | iwl_reset_qos(priv); | 894 | iwl_reset_qos(priv); |
962 | 895 | ||
963 | priv->qos_data.qos_active = 0; | 896 | priv->qos_data.qos_active = 0; |
@@ -1025,6 +958,30 @@ void iwl_uninit_drv(struct iwl_priv *priv) | |||
1025 | } | 958 | } |
1026 | EXPORT_SYMBOL(iwl_uninit_drv); | 959 | EXPORT_SYMBOL(iwl_uninit_drv); |
1027 | 960 | ||
961 | |||
962 | void iwl_disable_interrupts(struct iwl_priv *priv) | ||
963 | { | ||
964 | clear_bit(STATUS_INT_ENABLED, &priv->status); | ||
965 | |||
966 | /* disable interrupts from uCode/NIC to host */ | ||
967 | iwl_write32(priv, CSR_INT_MASK, 0x00000000); | ||
968 | |||
969 | /* acknowledge/clear/reset any interrupts still pending | ||
970 | * from uCode or flow handler (Rx/Tx DMA) */ | ||
971 | iwl_write32(priv, CSR_INT, 0xffffffff); | ||
972 | iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); | ||
973 | IWL_DEBUG_ISR("Disabled interrupts\n"); | ||
974 | } | ||
975 | EXPORT_SYMBOL(iwl_disable_interrupts); | ||
976 | |||
977 | void iwl_enable_interrupts(struct iwl_priv *priv) | ||
978 | { | ||
979 | IWL_DEBUG_ISR("Enabling interrupts\n"); | ||
980 | set_bit(STATUS_INT_ENABLED, &priv->status); | ||
981 | iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); | ||
982 | } | ||
983 | EXPORT_SYMBOL(iwl_enable_interrupts); | ||
984 | |||
1028 | int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags) | 985 | int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags) |
1029 | { | 986 | { |
1030 | u32 stat_flags = 0; | 987 | u32 stat_flags = 0; |
@@ -1172,24 +1129,47 @@ int iwl_verify_ucode(struct iwl_priv *priv) | |||
1172 | } | 1129 | } |
1173 | EXPORT_SYMBOL(iwl_verify_ucode); | 1130 | EXPORT_SYMBOL(iwl_verify_ucode); |
1174 | 1131 | ||
1132 | |||
1133 | static const char *desc_lookup_text[] = { | ||
1134 | "OK", | ||
1135 | "FAIL", | ||
1136 | "BAD_PARAM", | ||
1137 | "BAD_CHECKSUM", | ||
1138 | "NMI_INTERRUPT_WDG", | ||
1139 | "SYSASSERT", | ||
1140 | "FATAL_ERROR", | ||
1141 | "BAD_COMMAND", | ||
1142 | "HW_ERROR_TUNE_LOCK", | ||
1143 | "HW_ERROR_TEMPERATURE", | ||
1144 | "ILLEGAL_CHAN_FREQ", | ||
1145 | "VCC_NOT_STABLE", | ||
1146 | "FH_ERROR", | ||
1147 | "NMI_INTERRUPT_HOST", | ||
1148 | "NMI_INTERRUPT_ACTION_PT", | ||
1149 | "NMI_INTERRUPT_UNKNOWN", | ||
1150 | "UCODE_VERSION_MISMATCH", | ||
1151 | "HW_ERROR_ABS_LOCK", | ||
1152 | "HW_ERROR_CAL_LOCK_FAIL", | ||
1153 | "NMI_INTERRUPT_INST_ACTION_PT", | ||
1154 | "NMI_INTERRUPT_DATA_ACTION_PT", | ||
1155 | "NMI_TRM_HW_ER", | ||
1156 | "NMI_INTERRUPT_TRM", | ||
1157 | "NMI_INTERRUPT_BREAK_POINT" | ||
1158 | "DEBUG_0", | ||
1159 | "DEBUG_1", | ||
1160 | "DEBUG_2", | ||
1161 | "DEBUG_3", | ||
1162 | "UNKNOWN" | ||
1163 | }; | ||
1164 | |||
1175 | static const char *desc_lookup(int i) | 1165 | static const char *desc_lookup(int i) |
1176 | { | 1166 | { |
1177 | switch (i) { | 1167 | int max = ARRAY_SIZE(desc_lookup_text) - 1; |
1178 | case 1: | ||
1179 | return "FAIL"; | ||
1180 | case 2: | ||
1181 | return "BAD_PARAM"; | ||
1182 | case 3: | ||
1183 | return "BAD_CHECKSUM"; | ||
1184 | case 4: | ||
1185 | return "NMI_INTERRUPT"; | ||
1186 | case 5: | ||
1187 | return "SYSASSERT"; | ||
1188 | case 6: | ||
1189 | return "FATAL_ERROR"; | ||
1190 | } | ||
1191 | 1168 | ||
1192 | return "UNKNOWN"; | 1169 | if (i < 0 || i > max) |
1170 | i = max; | ||
1171 | |||
1172 | return desc_lookup_text[i]; | ||
1193 | } | 1173 | } |
1194 | 1174 | ||
1195 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 1175 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
@@ -1235,9 +1215,9 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) | |||
1235 | line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); | 1215 | line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); |
1236 | time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); | 1216 | time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); |
1237 | 1217 | ||
1238 | IWL_ERROR("Desc Time " | 1218 | IWL_ERROR("Desc Time " |
1239 | "data1 data2 line\n"); | 1219 | "data1 data2 line\n"); |
1240 | IWL_ERROR("%-13s (#%d) %010u 0x%08X 0x%08X %u\n", | 1220 | IWL_ERROR("%-28s (#%02d) %010u 0x%08X 0x%08X %u\n", |
1241 | desc_lookup(desc), desc, time, data1, data2, line); | 1221 | desc_lookup(desc), desc, time, data1, data2, line); |
1242 | IWL_ERROR("blink1 blink2 ilink1 ilink2\n"); | 1222 | IWL_ERROR("blink1 blink2 ilink1 ilink2\n"); |
1243 | IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, | 1223 | IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, |
@@ -1377,6 +1357,7 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv) | |||
1377 | } | 1357 | } |
1378 | EXPORT_SYMBOL(iwl_rf_kill_ct_config); | 1358 | EXPORT_SYMBOL(iwl_rf_kill_ct_config); |
1379 | 1359 | ||
1360 | |||
1380 | /* | 1361 | /* |
1381 | * CARD_STATE_CMD | 1362 | * CARD_STATE_CMD |
1382 | * | 1363 | * |
@@ -1465,6 +1446,16 @@ int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv) | |||
1465 | return 0; | 1446 | return 0; |
1466 | } | 1447 | } |
1467 | 1448 | ||
1449 | /* when driver is up while rfkill is on, it wont receive | ||
1450 | * any CARD_STATE_NOTIFICATION notifications so we have to | ||
1451 | * restart it in here | ||
1452 | */ | ||
1453 | if (priv->is_open && !test_bit(STATUS_ALIVE, &priv->status)) { | ||
1454 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | ||
1455 | if (!iwl_is_rfkill(priv)) | ||
1456 | queue_work(priv->workqueue, &priv->up); | ||
1457 | } | ||
1458 | |||
1468 | /* If the driver is already loaded, it will receive | 1459 | /* If the driver is already loaded, it will receive |
1469 | * CARD_STATE_NOTIFICATION notifications and the handler will | 1460 | * CARD_STATE_NOTIFICATION notifications and the handler will |
1470 | * call restart to reload the driver. | 1461 | * call restart to reload the driver. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 288b6a800e03..7c3a20a986bb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -72,6 +72,7 @@ struct iwl_cmd; | |||
72 | 72 | ||
73 | #define IWLWIFI_VERSION "1.3.27k" | 73 | #define IWLWIFI_VERSION "1.3.27k" |
74 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" | 74 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" |
75 | #define DRV_AUTHOR "<ilw@linux.intel.com>" | ||
75 | 76 | ||
76 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | 77 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ |
77 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | 78 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ |
@@ -100,12 +101,8 @@ struct iwl_hcmd_utils_ops { | |||
100 | }; | 101 | }; |
101 | 102 | ||
102 | struct iwl_lib_ops { | 103 | struct iwl_lib_ops { |
103 | /* set hw dependant perameters */ | 104 | /* set hw dependent parameters */ |
104 | int (*set_hw_params)(struct iwl_priv *priv); | 105 | int (*set_hw_params)(struct iwl_priv *priv); |
105 | /* ucode shared memory */ | ||
106 | int (*alloc_shared_mem)(struct iwl_priv *priv); | ||
107 | void (*free_shared_mem)(struct iwl_priv *priv); | ||
108 | int (*shared_mem_rx_idx)(struct iwl_priv *priv); | ||
109 | /* Handling TX */ | 106 | /* Handling TX */ |
110 | void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, | 107 | void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, |
111 | struct iwl_tx_queue *txq, | 108 | struct iwl_tx_queue *txq, |
@@ -157,22 +154,53 @@ struct iwl_ops { | |||
157 | struct iwl_mod_params { | 154 | struct iwl_mod_params { |
158 | int disable; /* def: 0 = enable radio */ | 155 | int disable; /* def: 0 = enable radio */ |
159 | int sw_crypto; /* def: 0 = using hardware encryption */ | 156 | int sw_crypto; /* def: 0 = using hardware encryption */ |
160 | int debug; /* def: 0 = minimal debug log messages */ | 157 | u32 debug; /* def: 0 = minimal debug log messages */ |
161 | int disable_hw_scan; /* def: 0 = use h/w scan */ | 158 | int disable_hw_scan; /* def: 0 = use h/w scan */ |
162 | int num_of_queues; /* def: HW dependent */ | 159 | int num_of_queues; /* def: HW dependent */ |
163 | int num_of_ampdu_queues;/* def: HW dependent */ | 160 | int num_of_ampdu_queues;/* def: HW dependent */ |
164 | int enable_qos; /* def: 1 = use quality of service */ | ||
165 | int disable_11n; /* def: 0 = disable 11n capabilities */ | 161 | int disable_11n; /* def: 0 = disable 11n capabilities */ |
166 | int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */ | 162 | int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */ |
167 | int antenna; /* def: 0 = both antennas (use diversity) */ | 163 | int antenna; /* def: 0 = both antennas (use diversity) */ |
168 | int restart_fw; /* def: 1 = restart firmware */ | 164 | int restart_fw; /* def: 1 = restart firmware */ |
169 | }; | 165 | }; |
170 | 166 | ||
167 | /** | ||
168 | * struct iwl_cfg | ||
169 | * @fw_name_pre: Firmware filename prefix. The api version and extension | ||
170 | * (.ucode) will be added to filename before loading from disk. The | ||
171 | * filename is constructed as fw_name_pre<api>.ucode. | ||
172 | * @ucode_api_max: Highest version of uCode API supported by driver. | ||
173 | * @ucode_api_min: Lowest version of uCode API supported by driver. | ||
174 | * | ||
175 | * We enable the driver to be backward compatible wrt API version. The | ||
176 | * driver specifies which APIs it supports (with @ucode_api_max being the | ||
177 | * highest and @ucode_api_min the lowest). Firmware will only be loaded if | ||
178 | * it has a supported API version. The firmware's API version will be | ||
179 | * stored in @iwl_priv, enabling the driver to make runtime changes based | ||
180 | * on firmware version used. | ||
181 | * | ||
182 | * For example, | ||
183 | * if (IWL_UCODE_API(priv->ucode_ver) >= 2) { | ||
184 | * Driver interacts with Firmware API version >= 2. | ||
185 | * } else { | ||
186 | * Driver interacts with Firmware API version 1. | ||
187 | * } | ||
188 | * | ||
189 | * The ideal usage of this infrastructure is to treat a new ucode API | ||
190 | * release as a new hardware revision. That is, through utilizing the | ||
191 | * iwl_hcmd_utils_ops etc. we accommodate different command structures | ||
192 | * and flows between hardware versions (4965/5000) as well as their API | ||
193 | * versions. | ||
194 | */ | ||
171 | struct iwl_cfg { | 195 | struct iwl_cfg { |
172 | const char *name; | 196 | const char *name; |
173 | const char *fw_name; | 197 | const char *fw_name_pre; |
198 | const unsigned int ucode_api_max; | ||
199 | const unsigned int ucode_api_min; | ||
174 | unsigned int sku; | 200 | unsigned int sku; |
175 | int eeprom_size; | 201 | int eeprom_size; |
202 | u16 eeprom_ver; | ||
203 | u16 eeprom_calib_ver; | ||
176 | const struct iwl_ops *ops; | 204 | const struct iwl_ops *ops; |
177 | const struct iwl_mod_params *mod_params; | 205 | const struct iwl_mod_params *mod_params; |
178 | }; | 206 | }; |
@@ -184,22 +212,17 @@ struct iwl_cfg { | |||
184 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | 212 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, |
185 | struct ieee80211_ops *hw_ops); | 213 | struct ieee80211_ops *hw_ops); |
186 | void iwl_hw_detect(struct iwl_priv *priv); | 214 | void iwl_hw_detect(struct iwl_priv *priv); |
187 | void iwl_clear_stations_table(struct iwl_priv *priv); | ||
188 | void iwl_reset_qos(struct iwl_priv *priv); | 215 | void iwl_reset_qos(struct iwl_priv *priv); |
189 | void iwl_set_rxon_chain(struct iwl_priv *priv); | 216 | void iwl_set_rxon_chain(struct iwl_priv *priv); |
190 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | 217 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); |
191 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); | 218 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); |
192 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, | 219 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, |
193 | struct ieee80211_ht_info *sta_ht_inf); | 220 | struct ieee80211_sta_ht_cap *sta_ht_inf); |
194 | int iwl_hw_nic_init(struct iwl_priv *priv); | 221 | int iwl_hw_nic_init(struct iwl_priv *priv); |
195 | int iwl_setup_mac(struct iwl_priv *priv); | 222 | int iwl_setup_mac(struct iwl_priv *priv); |
196 | int iwl_set_hw_params(struct iwl_priv *priv); | 223 | int iwl_set_hw_params(struct iwl_priv *priv); |
197 | int iwl_init_drv(struct iwl_priv *priv); | 224 | int iwl_init_drv(struct iwl_priv *priv); |
198 | void iwl_uninit_drv(struct iwl_priv *priv); | 225 | void iwl_uninit_drv(struct iwl_priv *priv); |
199 | /* "keep warm" functions */ | ||
200 | int iwl_kw_init(struct iwl_priv *priv); | ||
201 | int iwl_kw_alloc(struct iwl_priv *priv); | ||
202 | void iwl_kw_free(struct iwl_priv *priv); | ||
203 | 226 | ||
204 | /***************************************************** | 227 | /***************************************************** |
205 | * RX | 228 | * RX |
@@ -212,8 +235,6 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, | |||
212 | void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 235 | void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
213 | void iwl_rx_replenish(struct iwl_priv *priv); | 236 | void iwl_rx_replenish(struct iwl_priv *priv); |
214 | int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 237 | int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
215 | int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn); | ||
216 | int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); | ||
217 | int iwl_rx_queue_restock(struct iwl_priv *priv); | 238 | int iwl_rx_queue_restock(struct iwl_priv *priv); |
218 | int iwl_rx_queue_space(const struct iwl_rx_queue *q); | 239 | int iwl_rx_queue_space(const struct iwl_rx_queue *q); |
219 | void iwl_rx_allocate(struct iwl_priv *priv); | 240 | void iwl_rx_allocate(struct iwl_priv *priv); |
@@ -237,7 +258,6 @@ int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); | |||
237 | int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn); | 258 | int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn); |
238 | int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); | 259 | int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); |
239 | int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id); | 260 | int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id); |
240 | |||
241 | /***************************************************** | 261 | /***************************************************** |
242 | * TX power | 262 | * TX power |
243 | ****************************************************/ | 263 | ****************************************************/ |
@@ -259,6 +279,13 @@ void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, | |||
259 | struct ieee80211_tx_info *info); | 279 | struct ieee80211_tx_info *info); |
260 | int iwl_hwrate_to_plcp_idx(u32 rate_n_flags); | 280 | int iwl_hwrate_to_plcp_idx(u32 rate_n_flags); |
261 | 281 | ||
282 | u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx); | ||
283 | |||
284 | static inline u32 iwl_ant_idx_to_flags(u8 ant_idx) | ||
285 | { | ||
286 | return BIT(ant_idx) << RATE_MCS_ANT_POS; | ||
287 | } | ||
288 | |||
262 | static inline u8 iwl_hw_get_rate(__le32 rate_n_flags) | 289 | static inline u8 iwl_hw_get_rate(__le32 rate_n_flags) |
263 | { | 290 | { |
264 | return le32_to_cpu(rate_n_flags) & 0xFF; | 291 | return le32_to_cpu(rate_n_flags) & 0xFF; |
@@ -289,6 +316,14 @@ int iwl_send_calib_results(struct iwl_priv *priv); | |||
289 | int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len); | 316 | int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len); |
290 | void iwl_calib_free_results(struct iwl_priv *priv); | 317 | void iwl_calib_free_results(struct iwl_priv *priv); |
291 | 318 | ||
319 | /******************************************************************************* | ||
320 | * Spectrum Measureemtns in iwl-spectrum.c | ||
321 | ******************************************************************************/ | ||
322 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | ||
323 | void iwl_setup_spectrum_handlers(struct iwl_priv *priv); | ||
324 | #else | ||
325 | static inline void iwl_setup_spectrum_handlers(struct iwl_priv *priv) {} | ||
326 | #endif | ||
292 | /***************************************************** | 327 | /***************************************************** |
293 | * S e n d i n g H o s t C o m m a n d s * | 328 | * S e n d i n g H o s t C o m m a n d s * |
294 | *****************************************************/ | 329 | *****************************************************/ |
@@ -308,11 +343,18 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, | |||
308 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | 343 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); |
309 | 344 | ||
310 | /***************************************************** | 345 | /***************************************************** |
346 | * PCI * | ||
347 | *****************************************************/ | ||
348 | void iwl_disable_interrupts(struct iwl_priv *priv); | ||
349 | void iwl_enable_interrupts(struct iwl_priv *priv); | ||
350 | |||
351 | /***************************************************** | ||
311 | * Error Handling Debugging | 352 | * Error Handling Debugging |
312 | ******************************************************/ | 353 | ******************************************************/ |
313 | void iwl_dump_nic_error_log(struct iwl_priv *priv); | 354 | void iwl_dump_nic_error_log(struct iwl_priv *priv); |
314 | void iwl_dump_nic_event_log(struct iwl_priv *priv); | 355 | void iwl_dump_nic_event_log(struct iwl_priv *priv); |
315 | 356 | ||
357 | |||
316 | /*************** DRIVER STATUS FUNCTIONS *****/ | 358 | /*************** DRIVER STATUS FUNCTIONS *****/ |
317 | 359 | ||
318 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ | 360 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 662edf4f8d22..f34ede44ed10 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -60,6 +60,8 @@ | |||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 | * | 61 | * |
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | #ifndef __iwl_csr_h__ | ||
64 | #define __iwl_csr_h__ | ||
63 | /*=== CSR (control and status registers) ===*/ | 65 | /*=== CSR (control and status registers) ===*/ |
64 | #define CSR_BASE (0x000) | 66 | #define CSR_BASE (0x000) |
65 | 67 | ||
@@ -214,6 +216,8 @@ | |||
214 | /* EEPROM REG */ | 216 | /* EEPROM REG */ |
215 | #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) | 217 | #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) |
216 | #define CSR_EEPROM_REG_BIT_CMD (0x00000002) | 218 | #define CSR_EEPROM_REG_BIT_CMD (0x00000002) |
219 | #define CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC) | ||
220 | #define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) | ||
217 | 221 | ||
218 | /* EEPROM GP */ | 222 | /* EEPROM GP */ |
219 | #define CSR_EEPROM_GP_VALID_MSK (0x00000006) | 223 | #define CSR_EEPROM_GP_VALID_MSK (0x00000006) |
@@ -286,4 +290,4 @@ | |||
286 | #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) | 290 | #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) |
287 | 291 | ||
288 | 292 | ||
289 | 293 | #endif /* !__iwl_csr_h__ */ | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index e548d67f87fd..56c13b458de7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * file called LICENSE. | 21 | * file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 24 | * Intel Linux Wireless <ilw@linux.intel.com> |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
@@ -40,6 +40,13 @@ 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', __func__ , ## args); } while (0) | 41 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) |
42 | 42 | ||
43 | #define iwl_print_hex_dump(priv, level, p, len) \ | ||
44 | do { \ | ||
45 | if (priv->debug_level & level) \ | ||
46 | print_hex_dump(KERN_DEBUG, "iwl data: ", \ | ||
47 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | ||
48 | } while (0) | ||
49 | |||
43 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 50 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
44 | struct iwl_debugfs { | 51 | struct iwl_debugfs { |
45 | const char *name; | 52 | const char *name; |
@@ -53,6 +60,7 @@ struct iwl_debugfs { | |||
53 | struct dentry *file_rx_statistics; | 60 | struct dentry *file_rx_statistics; |
54 | struct dentry *file_tx_statistics; | 61 | struct dentry *file_tx_statistics; |
55 | struct dentry *file_log_event; | 62 | struct dentry *file_log_event; |
63 | struct dentry *file_channels; | ||
56 | } dbgfs_data_files; | 64 | } dbgfs_data_files; |
57 | struct dir_rf_files { | 65 | struct dir_rf_files { |
58 | struct dentry *file_disable_sensitivity; | 66 | struct dentry *file_disable_sensitivity; |
@@ -70,6 +78,9 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv); | |||
70 | #else | 78 | #else |
71 | #define IWL_DEBUG(level, fmt, args...) | 79 | #define IWL_DEBUG(level, fmt, args...) |
72 | #define IWL_DEBUG_LIMIT(level, fmt, args...) | 80 | #define IWL_DEBUG_LIMIT(level, fmt, args...) |
81 | static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, | ||
82 | void *p, u32 len) | ||
83 | {} | ||
73 | #endif /* CONFIG_IWLWIFI_DEBUG */ | 84 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
74 | 85 | ||
75 | 86 | ||
@@ -85,29 +96,25 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
85 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | 96 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
86 | 97 | ||
87 | /* | 98 | /* |
88 | * To use the debug system; | 99 | * To use the debug system: |
89 | * | 100 | * |
90 | * If you are defining a new debug classification, simply add it to the #define | 101 | * If you are defining a new debug classification, simply add it to the #define |
91 | * list here in the form of: | 102 | * list here in the form of |
92 | * | 103 | * |
93 | * #define IWL_DL_xxxx VALUE | 104 | * #define IWL_DL_xxxx VALUE |
94 | * | 105 | * |
95 | * shifting value to the left one bit from the previous entry. xxxx should be | 106 | * where xxxx should be the name of the classification (for example, WEP). |
96 | * the name of the classification (for example, WEP) | ||
97 | * | 107 | * |
98 | * You then need to either add a IWL_xxxx_DEBUG() macro definition for your | 108 | * You then need to either add a IWL_xxxx_DEBUG() macro definition for your |
99 | * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want | 109 | * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want |
100 | * to send output to that classification. | 110 | * to send output to that classification. |
101 | * | 111 | * |
102 | * To add your debug level to the list of levels seen when you perform | 112 | * The active debug levels can be accessed via files |
103 | * | ||
104 | * % cat /proc/net/iwl/debug_level | ||
105 | * | ||
106 | * you simply need to add your entry to the iwl_debug_levels array. | ||
107 | * | 113 | * |
108 | * If you do not see debug_level in /proc/net/iwl then you do not have | 114 | * /sys/module/iwlagn/parameters/debug{50} |
109 | * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration | 115 | * /sys/class/net/wlan0/device/debug_level |
110 | * | 116 | * |
117 | * when CONFIG_IWLWIFI_DEBUG=y. | ||
111 | */ | 118 | */ |
112 | 119 | ||
113 | #define IWL_DL_INFO (1 << 0) | 120 | #define IWL_DL_INFO (1 << 0) |
@@ -183,6 +190,8 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
183 | #define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) | 190 | #define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) |
184 | #define IWL_DEBUG_STATS_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_STATS, f, ## a) | 191 | #define IWL_DEBUG_STATS_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_STATS, f, ## a) |
185 | #define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) | 192 | #define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) |
193 | #define IWL_DEBUG_TX_REPLY_LIMIT(f, a...) \ | ||
194 | IWL_DEBUG_LIMIT(IWL_DL_TX_REPLY, f, ## a) | ||
186 | #define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) | 195 | #define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) |
187 | #define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) | 196 | #define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) |
188 | #define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) | 197 | #define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 20db0eb636a8..d5253a179dec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * in the file called LICENSE.GPL. | 22 | * in the file called LICENSE.GPL. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * Tomas Winkler <tomas.winkler@intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
@@ -58,7 +58,8 @@ | |||
58 | #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ | 58 | #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ |
59 | dbgfs->dbgfs_##parent##_files.file_##name = \ | 59 | dbgfs->dbgfs_##parent##_files.file_##name = \ |
60 | debugfs_create_bool(#name, 0644, dbgfs->dir_##parent, ptr); \ | 60 | debugfs_create_bool(#name, 0644, dbgfs->dir_##parent, ptr); \ |
61 | if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name)) \ | 61 | if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \ |
62 | || !dbgfs->dbgfs_##parent##_files.file_##name) \ | ||
62 | goto err; \ | 63 | goto err; \ |
63 | } while (0) | 64 | } while (0) |
64 | 65 | ||
@@ -228,7 +229,6 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, | |||
228 | ssize_t ret; | 229 | ssize_t ret; |
229 | /* Add 30 for initial string */ | 230 | /* Add 30 for initial string */ |
230 | const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); | 231 | const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); |
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) |
@@ -242,7 +242,6 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, | |||
242 | if (station->used) { | 242 | if (station->used) { |
243 | pos += scnprintf(buf + pos, bufsz - pos, | 243 | pos += scnprintf(buf + pos, bufsz - pos, |
244 | "station %d:\ngeneral data:\n", i+1); | 244 | "station %d:\ngeneral data:\n", i+1); |
245 | print_mac(mac, station->sta.sta.addr); | ||
246 | pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n", | 245 | pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n", |
247 | station->sta.sta.sta_id); | 246 | station->sta.sta.sta_id); |
248 | pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n", | 247 | pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n", |
@@ -349,12 +348,86 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, | |||
349 | return count; | 348 | return count; |
350 | } | 349 | } |
351 | 350 | ||
351 | |||
352 | |||
353 | static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, | ||
354 | size_t count, loff_t *ppos) | ||
355 | { | ||
356 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
357 | struct ieee80211_channel *channels = NULL; | ||
358 | const struct ieee80211_supported_band *supp_band = NULL; | ||
359 | int pos = 0, i, bufsz = PAGE_SIZE; | ||
360 | char *buf; | ||
361 | ssize_t ret; | ||
362 | |||
363 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | ||
364 | return -EAGAIN; | ||
365 | |||
366 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
367 | if (!buf) { | ||
368 | IWL_ERROR("Can not allocate Buffer\n"); | ||
369 | return -ENOMEM; | ||
370 | } | ||
371 | |||
372 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | ||
373 | channels = supp_band->channels; | ||
374 | |||
375 | pos += scnprintf(buf + pos, bufsz - pos, | ||
376 | "Displaying %d channels in 2.4GHz band 802.11bg):\n", | ||
377 | supp_band->n_channels); | ||
378 | |||
379 | for (i = 0; i < supp_band->n_channels; i++) | ||
380 | pos += scnprintf(buf + pos, bufsz - pos, | ||
381 | "%d: %ddBm: BSS%s%s, %s.\n", | ||
382 | ieee80211_frequency_to_channel( | ||
383 | channels[i].center_freq), | ||
384 | channels[i].max_power, | ||
385 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
386 | " (IEEE 802.11h required)" : "", | ||
387 | (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
388 | || (channels[i].flags & | ||
389 | IEEE80211_CHAN_RADAR)) ? "" : | ||
390 | ", IBSS", | ||
391 | channels[i].flags & | ||
392 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
393 | "passive only" : "active/passive"); | ||
394 | |||
395 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); | ||
396 | channels = supp_band->channels; | ||
397 | |||
398 | pos += scnprintf(buf + pos, bufsz - pos, | ||
399 | "Displaying %d channels in 5.2GHz band (802.11a)\n", | ||
400 | supp_band->n_channels); | ||
401 | |||
402 | for (i = 0; i < supp_band->n_channels; i++) | ||
403 | pos += scnprintf(buf + pos, bufsz - pos, | ||
404 | "%d: %ddBm: BSS%s%s, %s.\n", | ||
405 | ieee80211_frequency_to_channel( | ||
406 | channels[i].center_freq), | ||
407 | channels[i].max_power, | ||
408 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
409 | " (IEEE 802.11h required)" : "", | ||
410 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
411 | || (channels[i].flags & | ||
412 | IEEE80211_CHAN_RADAR)) ? "" : | ||
413 | ", IBSS", | ||
414 | channels[i].flags & | ||
415 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
416 | "passive only" : "active/passive"); | ||
417 | |||
418 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
419 | kfree(buf); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | |||
352 | DEBUGFS_READ_WRITE_FILE_OPS(sram); | 424 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
353 | DEBUGFS_WRITE_FILE_OPS(log_event); | 425 | DEBUGFS_WRITE_FILE_OPS(log_event); |
354 | DEBUGFS_READ_FILE_OPS(eeprom); | 426 | DEBUGFS_READ_FILE_OPS(eeprom); |
355 | DEBUGFS_READ_FILE_OPS(stations); | 427 | DEBUGFS_READ_FILE_OPS(stations); |
356 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 428 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
357 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 429 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
430 | DEBUGFS_READ_FILE_OPS(channels); | ||
358 | 431 | ||
359 | /* | 432 | /* |
360 | * Create the debugfs files and directories | 433 | * Create the debugfs files and directories |
@@ -388,6 +461,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
388 | DEBUGFS_ADD_FILE(stations, data); | 461 | DEBUGFS_ADD_FILE(stations, data); |
389 | DEBUGFS_ADD_FILE(rx_statistics, data); | 462 | DEBUGFS_ADD_FILE(rx_statistics, data); |
390 | DEBUGFS_ADD_FILE(tx_statistics, data); | 463 | DEBUGFS_ADD_FILE(tx_statistics, data); |
464 | DEBUGFS_ADD_FILE(channels, data); | ||
391 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); | 465 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); |
392 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, | 466 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, |
393 | &priv->disable_chain_noise_cal); | 467 | &priv->disable_chain_noise_cal); |
@@ -416,6 +490,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
416 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); | 490 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); |
417 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); | 491 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); |
418 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); | 492 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); |
493 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels); | ||
419 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); | 494 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); |
420 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); | 495 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); |
421 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); | 496 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 9966d4e384ce..0468fcc1ea98 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -54,6 +54,7 @@ extern struct iwl_cfg iwl5100_agn_cfg; | |||
54 | extern struct iwl_cfg iwl5350_agn_cfg; | 54 | extern struct iwl_cfg iwl5350_agn_cfg; |
55 | extern struct iwl_cfg iwl5100_bg_cfg; | 55 | extern struct iwl_cfg iwl5100_bg_cfg; |
56 | extern struct iwl_cfg iwl5100_abg_cfg; | 56 | extern struct iwl_cfg iwl5100_abg_cfg; |
57 | extern struct iwl_cfg iwl5150_agn_cfg; | ||
57 | 58 | ||
58 | /* CT-KILL constants */ | 59 | /* CT-KILL constants */ |
59 | #define CT_KILL_THRESHOLD 110 /* in Celsius */ | 60 | #define CT_KILL_THRESHOLD 110 /* in Celsius */ |
@@ -113,11 +114,9 @@ struct iwl_queue { | |||
113 | * space less than this */ | 114 | * space less than this */ |
114 | } __attribute__ ((packed)); | 115 | } __attribute__ ((packed)); |
115 | 116 | ||
116 | #define MAX_NUM_OF_TBS (20) | ||
117 | |||
118 | /* One for each TFD */ | 117 | /* One for each TFD */ |
119 | struct iwl_tx_info { | 118 | struct iwl_tx_info { |
120 | struct sk_buff *skb[MAX_NUM_OF_TBS]; | 119 | struct sk_buff *skb[IWL_NUM_OF_TBS - 1]; |
121 | }; | 120 | }; |
122 | 121 | ||
123 | /** | 122 | /** |
@@ -135,12 +134,13 @@ struct iwl_tx_info { | |||
135 | */ | 134 | */ |
136 | struct iwl_tx_queue { | 135 | struct iwl_tx_queue { |
137 | struct iwl_queue q; | 136 | struct iwl_queue q; |
138 | struct iwl_tfd_frame *bd; | 137 | struct iwl_tfd *tfds; |
139 | struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS]; | 138 | struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS]; |
140 | struct iwl_tx_info *txb; | 139 | struct iwl_tx_info *txb; |
141 | int need_update; | 140 | u8 need_update; |
142 | int sched_retry; | 141 | u8 sched_retry; |
143 | int active; | 142 | u8 active; |
143 | u8 swq_id; | ||
144 | }; | 144 | }; |
145 | 145 | ||
146 | #define IWL_NUM_SCAN_RATES (2) | 146 | #define IWL_NUM_SCAN_RATES (2) |
@@ -186,12 +186,6 @@ struct iwl_channel_info { | |||
186 | u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */ | 186 | u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */ |
187 | }; | 187 | }; |
188 | 188 | ||
189 | struct iwl4965_clip_group { | ||
190 | /* maximum power level to prevent clipping for each rate, derived by | ||
191 | * us from this band's saturation power in EEPROM */ | ||
192 | const s8 clip_powers[IWL_MAX_RATES]; | ||
193 | }; | ||
194 | |||
195 | 189 | ||
196 | #define IWL_TX_FIFO_AC0 0 | 190 | #define IWL_TX_FIFO_AC0 0 |
197 | #define IWL_TX_FIFO_AC1 1 | 191 | #define IWL_TX_FIFO_AC1 1 |
@@ -253,7 +247,8 @@ struct iwl_cmd_meta { | |||
253 | /* The CMD_SIZE_HUGE flag bit indicates that the command | 247 | /* The CMD_SIZE_HUGE flag bit indicates that the command |
254 | * structure is stored at the end of the shared queue memory. */ | 248 | * structure is stored at the end of the shared queue memory. */ |
255 | u32 flags; | 249 | u32 flags; |
256 | 250 | DECLARE_PCI_UNMAP_ADDR(mapping) | |
251 | DECLARE_PCI_UNMAP_LEN(len) | ||
257 | } __attribute__ ((packed)); | 252 | } __attribute__ ((packed)); |
258 | 253 | ||
259 | #define IWL_CMD_MAX_PAYLOAD 320 | 254 | #define IWL_CMD_MAX_PAYLOAD 320 |
@@ -269,24 +264,16 @@ struct iwl_cmd { | |||
269 | struct iwl_cmd_meta meta; /* driver data */ | 264 | struct iwl_cmd_meta meta; /* driver data */ |
270 | struct iwl_cmd_header hdr; /* uCode API */ | 265 | struct iwl_cmd_header hdr; /* uCode API */ |
271 | union { | 266 | union { |
272 | struct iwl_addsta_cmd addsta; | ||
273 | struct iwl_led_cmd led; | ||
274 | u32 flags; | 267 | u32 flags; |
275 | u8 val8; | 268 | u8 val8; |
276 | u16 val16; | 269 | u16 val16; |
277 | u32 val32; | 270 | u32 val32; |
278 | struct iwl4965_bt_cmd bt; | ||
279 | struct iwl4965_rxon_time_cmd rxon_time; | ||
280 | struct iwl_powertable_cmd powertable; | ||
281 | struct iwl_qosparam_cmd qosparam; | ||
282 | struct iwl_tx_cmd tx; | 271 | struct iwl_tx_cmd tx; |
283 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | ||
284 | struct iwl_rem_sta_cmd rm_sta; | ||
285 | u8 *indirect; | ||
286 | u8 payload[IWL_CMD_MAX_PAYLOAD]; | 272 | u8 payload[IWL_CMD_MAX_PAYLOAD]; |
287 | } __attribute__ ((packed)) cmd; | 273 | } __attribute__ ((packed)) cmd; |
288 | } __attribute__ ((packed)); | 274 | } __attribute__ ((packed)); |
289 | 275 | ||
276 | |||
290 | struct iwl_host_cmd { | 277 | struct iwl_host_cmd { |
291 | u8 id; | 278 | u8 id; |
292 | u16 len; | 279 | u16 len; |
@@ -309,7 +296,6 @@ struct iwl_host_cmd { | |||
309 | 296 | ||
310 | /** | 297 | /** |
311 | * struct iwl_rx_queue - Rx queue | 298 | * struct iwl_rx_queue - Rx queue |
312 | * @processed: Internal index to last handled Rx packet | ||
313 | * @read: Shared index to newest available Rx buffer | 299 | * @read: Shared index to newest available Rx buffer |
314 | * @write: Shared index to oldest written Rx packet | 300 | * @write: Shared index to oldest written Rx packet |
315 | * @free_count: Number of pre-allocated buffers in rx_free | 301 | * @free_count: Number of pre-allocated buffers in rx_free |
@@ -324,26 +310,19 @@ struct iwl_rx_queue { | |||
324 | dma_addr_t dma_addr; | 310 | dma_addr_t dma_addr; |
325 | struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; | 311 | struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; |
326 | struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; | 312 | struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; |
327 | u32 processed; | ||
328 | u32 read; | 313 | u32 read; |
329 | u32 write; | 314 | u32 write; |
330 | u32 free_count; | 315 | u32 free_count; |
331 | struct list_head rx_free; | 316 | struct list_head rx_free; |
332 | struct list_head rx_used; | 317 | struct list_head rx_used; |
333 | int need_update; | 318 | int need_update; |
319 | struct iwl_rb_status *rb_stts; | ||
320 | dma_addr_t rb_stts_dma; | ||
334 | spinlock_t lock; | 321 | spinlock_t lock; |
335 | }; | 322 | }; |
336 | 323 | ||
337 | #define IWL_SUPPORTED_RATES_IE_LEN 8 | 324 | #define IWL_SUPPORTED_RATES_IE_LEN 8 |
338 | 325 | ||
339 | #define SCAN_INTERVAL 100 | ||
340 | |||
341 | #define MAX_A_CHANNELS 252 | ||
342 | #define MIN_A_CHANNELS 7 | ||
343 | |||
344 | #define MAX_B_CHANNELS 14 | ||
345 | #define MIN_B_CHANNELS 1 | ||
346 | |||
347 | #define MAX_TID_COUNT 9 | 326 | #define MAX_TID_COUNT 9 |
348 | 327 | ||
349 | #define IWL_INVALID_RATE 0xFF | 328 | #define IWL_INVALID_RATE 0xFF |
@@ -413,9 +392,8 @@ struct iwl_ht_info { | |||
413 | u8 max_amsdu_size; | 392 | u8 max_amsdu_size; |
414 | u8 ampdu_factor; | 393 | u8 ampdu_factor; |
415 | u8 mpdu_density; | 394 | u8 mpdu_density; |
416 | u8 supp_mcs_set[16]; | 395 | struct ieee80211_mcs_info mcs; |
417 | /* BSS related data */ | 396 | /* BSS related data */ |
418 | u8 control_channel; | ||
419 | u8 extension_chan_offset; | 397 | u8 extension_chan_offset; |
420 | u8 tx_chan_width; | 398 | u8 tx_chan_width; |
421 | u8 ht_protection; | 399 | u8 ht_protection; |
@@ -444,7 +422,6 @@ union iwl_qos_capabity { | |||
444 | 422 | ||
445 | /* QoS structures */ | 423 | /* QoS structures */ |
446 | struct iwl_qos_info { | 424 | struct iwl_qos_info { |
447 | int qos_enable; | ||
448 | int qos_active; | 425 | int qos_active; |
449 | union iwl_qos_capabity qos_cap; | 426 | union iwl_qos_capabity qos_cap; |
450 | struct iwl_qosparam_cmd def_qos_parm; | 427 | struct iwl_qosparam_cmd def_qos_parm; |
@@ -470,7 +447,7 @@ struct fw_desc { | |||
470 | 447 | ||
471 | /* uCode file layout */ | 448 | /* uCode file layout */ |
472 | struct iwl_ucode { | 449 | struct iwl_ucode { |
473 | __le32 ver; /* major/minor/subminor */ | 450 | __le32 ver; /* major/minor/API/serial */ |
474 | __le32 inst_size; /* bytes of runtime instructions */ | 451 | __le32 inst_size; /* bytes of runtime instructions */ |
475 | __le32 data_size; /* bytes of runtime data */ | 452 | __le32 data_size; /* bytes of runtime data */ |
476 | __le32 init_size; /* bytes of initialization instructions */ | 453 | __le32 init_size; /* bytes of initialization instructions */ |
@@ -511,11 +488,15 @@ struct iwl_sensitivity_ranges { | |||
511 | }; | 488 | }; |
512 | 489 | ||
513 | 490 | ||
514 | #define IWL_FAT_CHANNEL_52 BIT(IEEE80211_BAND_5GHZ) | 491 | #define KELVIN_TO_CELSIUS(x) ((x)-273) |
492 | #define CELSIUS_TO_KELVIN(x) ((x)+273) | ||
493 | |||
515 | 494 | ||
516 | /** | 495 | /** |
517 | * struct iwl_hw_params | 496 | * struct iwl_hw_params |
518 | * @max_txq_num: Max # Tx queues supported | 497 | * @max_txq_num: Max # Tx queues supported |
498 | * @dma_chnl_num: Number of Tx DMA/FIFO channels | ||
499 | * @scd_bc_tbls_size: size of scheduler byte count tables | ||
519 | * @tx/rx_chains_num: Number of TX/RX chains | 500 | * @tx/rx_chains_num: Number of TX/RX chains |
520 | * @valid_tx/rx_ant: usable antennas | 501 | * @valid_tx/rx_ant: usable antennas |
521 | * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) | 502 | * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) |
@@ -528,11 +509,13 @@ struct iwl_sensitivity_ranges { | |||
528 | * @sw_crypto: 0 for hw, 1 for sw | 509 | * @sw_crypto: 0 for hw, 1 for sw |
529 | * @max_xxx_size: for ucode uses | 510 | * @max_xxx_size: for ucode uses |
530 | * @ct_kill_threshold: temperature threshold | 511 | * @ct_kill_threshold: temperature threshold |
512 | * @calib_init_cfg: setup initial calibrations for the hw | ||
531 | * @struct iwl_sensitivity_ranges: range of sensitivity values | 513 | * @struct iwl_sensitivity_ranges: range of sensitivity values |
532 | * @first_ampdu_q: first HW queue available for ampdu | ||
533 | */ | 514 | */ |
534 | struct iwl_hw_params { | 515 | struct iwl_hw_params { |
535 | u16 max_txq_num; | 516 | u8 max_txq_num; |
517 | u8 dma_chnl_num; | ||
518 | u16 scd_bc_tbls_size; | ||
536 | u8 tx_chains_num; | 519 | u8 tx_chains_num; |
537 | u8 rx_chains_num; | 520 | u8 rx_chains_num; |
538 | u8 valid_tx_ant; | 521 | u8 valid_tx_ant; |
@@ -549,22 +532,10 @@ struct iwl_hw_params { | |||
549 | u32 max_data_size; | 532 | u32 max_data_size; |
550 | u32 max_bsm_size; | 533 | u32 max_bsm_size; |
551 | u32 ct_kill_threshold; /* value in hw-dependent units */ | 534 | u32 ct_kill_threshold; /* value in hw-dependent units */ |
535 | u32 calib_init_cfg; | ||
552 | const struct iwl_sensitivity_ranges *sens; | 536 | const struct iwl_sensitivity_ranges *sens; |
553 | u8 first_ampdu_q; | ||
554 | }; | 537 | }; |
555 | 538 | ||
556 | #define HT_SHORT_GI_20MHZ (1 << 0) | ||
557 | #define HT_SHORT_GI_40MHZ (1 << 1) | ||
558 | |||
559 | |||
560 | #define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\ | ||
561 | x->u.rx_frame.stats.payload + \ | ||
562 | x->u.rx_frame.stats.phy_count)) | ||
563 | #define IWL_RX_END(x) ((struct iwl4965_rx_frame_end *)(\ | ||
564 | IWL_RX_HDR(x)->payload + \ | ||
565 | le16_to_cpu(IWL_RX_HDR(x)->len))) | ||
566 | #define IWL_RX_STATS(x) (&x->u.rx_frame.stats) | ||
567 | #define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) | ||
568 | 539 | ||
569 | /****************************************************************************** | 540 | /****************************************************************************** |
570 | * | 541 | * |
@@ -581,13 +552,8 @@ struct iwl_hw_params { | |||
581 | * iwl4965_mac_ <-- mac80211 callback | 552 | * iwl4965_mac_ <-- mac80211 callback |
582 | * | 553 | * |
583 | ****************************************************************************/ | 554 | ****************************************************************************/ |
584 | struct iwl_addsta_cmd; | 555 | extern void iwl_update_chain_flags(struct iwl_priv *priv); |
585 | extern int iwl_send_add_sta(struct iwl_priv *priv, | 556 | extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); |
586 | struct iwl_addsta_cmd *sta, u8 flags); | ||
587 | extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, | ||
588 | int is_ap, u8 flags, struct ieee80211_ht_info *ht_info); | ||
589 | extern void iwl4965_update_chain_flags(struct iwl_priv *priv); | ||
590 | extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); | ||
591 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | 557 | extern const u8 iwl_bcast_addr[ETH_ALEN]; |
592 | extern int iwl_rxq_stop(struct iwl_priv *priv); | 558 | extern int iwl_rxq_stop(struct iwl_priv *priv); |
593 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); | 559 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); |
@@ -611,19 +577,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) | |||
611 | } | 577 | } |
612 | 578 | ||
613 | 579 | ||
614 | struct iwl_priv; | 580 | struct iwl_dma_ptr { |
615 | 581 | dma_addr_t dma; | |
616 | 582 | void *addr; | |
617 | /* Structures, enum, and defines specific to the 4965 */ | ||
618 | |||
619 | #define IWL_KW_SIZE 0x1000 /*4k */ | ||
620 | |||
621 | struct iwl_kw { | ||
622 | dma_addr_t dma_addr; | ||
623 | void *v_addr; | ||
624 | size_t size; | 583 | size_t size; |
625 | }; | 584 | }; |
626 | 585 | ||
586 | #define HT_SHORT_GI_20MHZ (1 << 0) | ||
587 | #define HT_SHORT_GI_40MHZ (1 << 1) | ||
588 | |||
627 | #define IWL_CHANNEL_WIDTH_20MHZ 0 | 589 | #define IWL_CHANNEL_WIDTH_20MHZ 0 |
628 | #define IWL_CHANNEL_WIDTH_40MHZ 1 | 590 | #define IWL_CHANNEL_WIDTH_40MHZ 1 |
629 | 591 | ||
@@ -638,7 +600,6 @@ struct iwl_kw { | |||
638 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 | 600 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 |
639 | 601 | ||
640 | /* Sensitivity and chain noise calibration */ | 602 | /* Sensitivity and chain noise calibration */ |
641 | #define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) | ||
642 | #define INITIALIZATION_VALUE 0xFFFF | 603 | #define INITIALIZATION_VALUE 0xFFFF |
643 | #define CAL_NUM_OF_BEACONS 20 | 604 | #define CAL_NUM_OF_BEACONS 20 |
644 | #define MAXIMUM_ALLOWED_PATHLOSS 15 | 605 | #define MAXIMUM_ALLOWED_PATHLOSS 15 |
@@ -691,13 +652,20 @@ enum iwl4965_calib_enabled_state { | |||
691 | IWL_CALIB_ENABLED = 1, | 652 | IWL_CALIB_ENABLED = 1, |
692 | }; | 653 | }; |
693 | 654 | ||
694 | struct statistics_general_data { | 655 | |
695 | u32 beacon_silence_rssi_a; | 656 | /* |
696 | u32 beacon_silence_rssi_b; | 657 | * enum iwl_calib |
697 | u32 beacon_silence_rssi_c; | 658 | * defines the order in which results of initial calibrations |
698 | u32 beacon_energy_a; | 659 | * should be sent to the runtime uCode |
699 | u32 beacon_energy_b; | 660 | */ |
700 | u32 beacon_energy_c; | 661 | enum iwl_calib { |
662 | IWL_CALIB_XTAL, | ||
663 | IWL_CALIB_DC, | ||
664 | IWL_CALIB_LO, | ||
665 | IWL_CALIB_TX_IQ, | ||
666 | IWL_CALIB_TX_IQ_PERD, | ||
667 | IWL_CALIB_BASE_BAND, | ||
668 | IWL_CALIB_MAX | ||
701 | }; | 669 | }; |
702 | 670 | ||
703 | /* Opaque calibration results */ | 671 | /* Opaque calibration results */ |
@@ -766,7 +734,6 @@ enum { | |||
766 | 734 | ||
767 | 735 | ||
768 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ | 736 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ |
769 | #define IWL_CALIB_MAX 3 | ||
770 | 737 | ||
771 | struct iwl_priv { | 738 | struct iwl_priv { |
772 | 739 | ||
@@ -790,7 +757,7 @@ struct iwl_priv { | |||
790 | 757 | ||
791 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT | 758 | #ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT |
792 | /* spectrum measurement report caching */ | 759 | /* spectrum measurement report caching */ |
793 | struct iwl4965_spectrum_notification measure_report; | 760 | struct iwl_spectrum_notification measure_report; |
794 | u8 measurement_status; | 761 | u8 measurement_status; |
795 | #endif | 762 | #endif |
796 | /* ucode beacon time */ | 763 | /* ucode beacon time */ |
@@ -801,10 +768,6 @@ struct iwl_priv { | |||
801 | struct iwl_channel_info *channel_info; /* channel info array */ | 768 | struct iwl_channel_info *channel_info; /* channel info array */ |
802 | u8 channel_count; /* # of channels */ | 769 | u8 channel_count; /* # of channels */ |
803 | 770 | ||
804 | /* each calibration channel group in the EEPROM has a derived | ||
805 | * clip setting for each rate. */ | ||
806 | const struct iwl4965_clip_group clip_groups[5]; | ||
807 | |||
808 | /* thermal calibration */ | 771 | /* thermal calibration */ |
809 | s32 temperature; /* degrees Kelvin */ | 772 | s32 temperature; /* degrees Kelvin */ |
810 | s32 last_temperature; | 773 | s32 last_temperature; |
@@ -818,12 +781,13 @@ struct iwl_priv { | |||
818 | unsigned long scan_start; | 781 | unsigned long scan_start; |
819 | unsigned long scan_pass_start; | 782 | unsigned long scan_pass_start; |
820 | unsigned long scan_start_tsf; | 783 | unsigned long scan_start_tsf; |
784 | struct iwl_scan_cmd *scan; | ||
821 | int scan_bands; | 785 | int scan_bands; |
822 | int one_direct_scan; | 786 | int one_direct_scan; |
823 | u8 direct_ssid_len; | 787 | u8 direct_ssid_len; |
824 | u8 direct_ssid[IW_ESSID_MAX_SIZE]; | 788 | u8 direct_ssid[IW_ESSID_MAX_SIZE]; |
825 | struct iwl_scan_cmd *scan; | 789 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; |
826 | u32 scan_tx_ant[IEEE80211_NUM_BANDS]; | 790 | u8 mgmt_tx_ant; |
827 | 791 | ||
828 | /* spinlock */ | 792 | /* spinlock */ |
829 | spinlock_t lock; /* protect general shared data */ | 793 | spinlock_t lock; /* protect general shared data */ |
@@ -840,6 +804,8 @@ struct iwl_priv { | |||
840 | u8 rev_id; | 804 | u8 rev_id; |
841 | 805 | ||
842 | /* uCode images, save to reload in case of failure */ | 806 | /* uCode images, save to reload in case of failure */ |
807 | u32 ucode_ver; /* version of ucode, copy of | ||
808 | iwl_ucode.ver */ | ||
843 | struct fw_desc ucode_code; /* runtime inst */ | 809 | struct fw_desc ucode_code; /* runtime inst */ |
844 | struct fw_desc ucode_data; /* runtime data original */ | 810 | struct fw_desc ucode_data; /* runtime data original */ |
845 | struct fw_desc ucode_data_backup; /* runtime data save/restore */ | 811 | struct fw_desc ucode_data_backup; /* runtime data save/restore */ |
@@ -850,7 +816,7 @@ struct iwl_priv { | |||
850 | u8 ucode_write_complete; /* the image write is complete */ | 816 | u8 ucode_write_complete; /* the image write is complete */ |
851 | 817 | ||
852 | 818 | ||
853 | struct iwl4965_rxon_time_cmd rxon_timing; | 819 | struct iwl_rxon_time_cmd rxon_timing; |
854 | 820 | ||
855 | /* We declare this const so it can only be | 821 | /* We declare this const so it can only be |
856 | * changed via explicit cast within the | 822 | * changed via explicit cast within the |
@@ -882,7 +848,6 @@ struct iwl_priv { | |||
882 | u16 active_rate_basic; | 848 | u16 active_rate_basic; |
883 | 849 | ||
884 | u8 assoc_station_added; | 850 | u8 assoc_station_added; |
885 | u8 use_ant_b_for_management_frame; /* Tx antenna selection */ | ||
886 | u8 start_calib; | 851 | u8 start_calib; |
887 | struct iwl_sensitivity_data sensitivity_data; | 852 | struct iwl_sensitivity_data sensitivity_data; |
888 | struct iwl_chain_noise_data chain_noise_data; | 853 | struct iwl_chain_noise_data chain_noise_data; |
@@ -903,12 +868,14 @@ struct iwl_priv { | |||
903 | struct iwl_rx_queue rxq; | 868 | struct iwl_rx_queue rxq; |
904 | struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; | 869 | struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; |
905 | unsigned long txq_ctx_active_msk; | 870 | unsigned long txq_ctx_active_msk; |
906 | struct iwl_kw kw; /* keep warm address */ | 871 | struct iwl_dma_ptr kw; /* keep warm address */ |
872 | struct iwl_dma_ptr scd_bc_tbls; | ||
873 | |||
907 | u32 scd_base_addr; /* scheduler sram base address */ | 874 | u32 scd_base_addr; /* scheduler sram base address */ |
908 | 875 | ||
909 | unsigned long status; | 876 | unsigned long status; |
910 | 877 | ||
911 | int last_rx_rssi; /* From Rx packet statisitics */ | 878 | int last_rx_rssi; /* From Rx packet statistics */ |
912 | int last_rx_noise; /* From beacon statistics */ | 879 | int last_rx_noise; /* From beacon statistics */ |
913 | 880 | ||
914 | /* counts mgmt, ctl, and data packets */ | 881 | /* counts mgmt, ctl, and data packets */ |
@@ -923,8 +890,6 @@ struct iwl_priv { | |||
923 | unsigned long last_statistics_time; | 890 | unsigned long last_statistics_time; |
924 | 891 | ||
925 | /* context information */ | 892 | /* context information */ |
926 | u8 essid[IW_ESSID_MAX_SIZE]; | ||
927 | u8 essid_len; | ||
928 | u16 rates_mask; | 893 | u16 rates_mask; |
929 | 894 | ||
930 | u32 power_mode; | 895 | u32 power_mode; |
@@ -965,11 +930,7 @@ struct iwl_priv { | |||
965 | struct ieee80211_vif *vif; | 930 | struct ieee80211_vif *vif; |
966 | 931 | ||
967 | struct iwl_hw_params hw_params; | 932 | struct iwl_hw_params hw_params; |
968 | /* driver/uCode shared Tx Byte Counts and Rx status */ | 933 | |
969 | void *shared_virt; | ||
970 | int rb_closed_offset; | ||
971 | /* Physical Pointer to Tx Byte Counts and Rx status */ | ||
972 | dma_addr_t shared_phys; | ||
973 | 934 | ||
974 | /* Current association information needed to configure the | 935 | /* Current association information needed to configure the |
975 | * hardware */ | 936 | * hardware */ |
@@ -992,7 +953,6 @@ struct iwl_priv { | |||
992 | struct work_struct report_work; | 953 | struct work_struct report_work; |
993 | struct work_struct request_scan; | 954 | struct work_struct request_scan; |
994 | struct work_struct beacon_update; | 955 | struct work_struct beacon_update; |
995 | struct work_struct set_monitor; | ||
996 | 956 | ||
997 | struct tasklet_struct irq_tasklet; | 957 | struct tasklet_struct irq_tasklet; |
998 | 958 | ||
@@ -1004,9 +964,6 @@ struct iwl_priv { | |||
1004 | s8 tx_power_user_lmt; | 964 | s8 tx_power_user_lmt; |
1005 | s8 tx_power_channel_lmt; | 965 | s8 tx_power_channel_lmt; |
1006 | 966 | ||
1007 | #ifdef CONFIG_PM | ||
1008 | u32 pm_state[16]; | ||
1009 | #endif | ||
1010 | 967 | ||
1011 | #ifdef CONFIG_IWLWIFI_DEBUG | 968 | #ifdef CONFIG_IWLWIFI_DEBUG |
1012 | /* debugging info */ | 969 | /* debugging info */ |
@@ -1091,26 +1048,4 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
1091 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | 1048 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; |
1092 | } | 1049 | } |
1093 | 1050 | ||
1094 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
1095 | static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, | ||
1096 | void *p, u32 len) | ||
1097 | { | ||
1098 | if (!(priv->debug_level & level)) | ||
1099 | return; | ||
1100 | |||
1101 | print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, | ||
1102 | p, len, 1); | ||
1103 | } | ||
1104 | #else | ||
1105 | static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, | ||
1106 | void *p, u32 len) | ||
1107 | { | ||
1108 | } | ||
1109 | #endif | ||
1110 | |||
1111 | extern const struct iwl_channel_info *iwl_get_channel_info( | ||
1112 | const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); | ||
1113 | |||
1114 | /* Requires full declaration of iwl_priv before including */ | ||
1115 | |||
1116 | #endif /* __iwl_dev_h__ */ | 1051 | #endif /* __iwl_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 37155755efc5..ce2f47306cea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -169,10 +169,9 @@ int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv) | |||
169 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); | 169 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); |
170 | 170 | ||
171 | /* See if we got it */ | 171 | /* See if we got it */ |
172 | ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | 172 | ret = iwl_poll_direct_bit(priv, CSR_HW_IF_CONFIG_REG, |
173 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, | 173 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, |
174 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, | 174 | EEPROM_SEM_TIMEOUT); |
175 | EEPROM_SEM_TIMEOUT); | ||
176 | if (ret >= 0) { | 175 | if (ret >= 0) { |
177 | IWL_DEBUG_IO("Acquired semaphore after %d tries.\n", | 176 | IWL_DEBUG_IO("Acquired semaphore after %d tries.\n", |
178 | count+1); | 177 | count+1); |
@@ -210,10 +209,8 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
210 | { | 209 | { |
211 | u16 *e; | 210 | u16 *e; |
212 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 211 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
213 | u32 r; | ||
214 | int sz = priv->cfg->eeprom_size; | 212 | int sz = priv->cfg->eeprom_size; |
215 | int ret; | 213 | int ret; |
216 | int i; | ||
217 | u16 addr; | 214 | u16 addr; |
218 | 215 | ||
219 | /* allocate eeprom */ | 216 | /* allocate eeprom */ |
@@ -241,22 +238,19 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
241 | 238 | ||
242 | /* eeprom is an array of 16bit values */ | 239 | /* eeprom is an array of 16bit values */ |
243 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 240 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
244 | _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); | 241 | u32 r; |
245 | _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); | 242 | |
246 | 243 | _iwl_write32(priv, CSR_EEPROM_REG, | |
247 | for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; | 244 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); |
248 | i += IWL_EEPROM_ACCESS_DELAY) { | ||
249 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | ||
250 | if (r & CSR_EEPROM_REG_READ_VALID_MSK) | ||
251 | break; | ||
252 | udelay(IWL_EEPROM_ACCESS_DELAY); | ||
253 | } | ||
254 | 245 | ||
255 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { | 246 | ret = iwl_poll_direct_bit(priv, CSR_EEPROM_REG, |
247 | CSR_EEPROM_REG_READ_VALID_MSK, | ||
248 | IWL_EEPROM_ACCESS_TIMEOUT); | ||
249 | if (ret < 0) { | ||
256 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); | 250 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); |
257 | ret = -ETIMEDOUT; | ||
258 | goto done; | 251 | goto done; |
259 | } | 252 | } |
253 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | ||
260 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 254 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); |
261 | } | 255 | } |
262 | ret = 0; | 256 | ret = 0; |
@@ -279,7 +273,23 @@ EXPORT_SYMBOL(iwl_eeprom_free); | |||
279 | 273 | ||
280 | int iwl_eeprom_check_version(struct iwl_priv *priv) | 274 | int iwl_eeprom_check_version(struct iwl_priv *priv) |
281 | { | 275 | { |
282 | return priv->cfg->ops->lib->eeprom_ops.check_version(priv); | 276 | u16 eeprom_ver; |
277 | u16 calib_ver; | ||
278 | |||
279 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | ||
280 | calib_ver = priv->cfg->ops->lib->eeprom_ops.calib_version(priv); | ||
281 | |||
282 | if (eeprom_ver < priv->cfg->eeprom_ver || | ||
283 | calib_ver < priv->cfg->eeprom_calib_ver) | ||
284 | goto err; | ||
285 | |||
286 | return 0; | ||
287 | err: | ||
288 | IWL_ERROR("Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", | ||
289 | eeprom_ver, priv->cfg->eeprom_ver, | ||
290 | calib_ver, priv->cfg->eeprom_calib_ver); | ||
291 | return -EINVAL; | ||
292 | |||
283 | } | 293 | } |
284 | EXPORT_SYMBOL(iwl_eeprom_check_version); | 294 | EXPORT_SYMBOL(iwl_eeprom_check_version); |
285 | 295 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index d3a2a5b4ac56..603c84bed630 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * Tomas Winkler <tomas.winkler@intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -68,17 +68,14 @@ struct iwl_priv; | |||
68 | /* | 68 | /* |
69 | * EEPROM access time values: | 69 | * EEPROM access time values: |
70 | * | 70 | * |
71 | * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG, | 71 | * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG. |
72 | * then clearing (with subsequent read/modify/write) CSR_EEPROM_REG bit | ||
73 | * CSR_EEPROM_REG_BIT_CMD (0x2). | ||
74 | * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1). | 72 | * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1). |
75 | * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. | 73 | * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. |
76 | * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. | 74 | * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. |
77 | */ | 75 | */ |
78 | #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ | 76 | #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ |
79 | #define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */ | ||
80 | 77 | ||
81 | #define IWL_EEPROM_SEM_TIMEOUT 10 /* milliseconds */ | 78 | #define IWL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ |
82 | #define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ | 79 | #define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ |
83 | 80 | ||
84 | 81 | ||
@@ -147,6 +144,7 @@ struct iwl_eeprom_channel { | |||
147 | /*5000 calibrations */ | 144 | /*5000 calibrations */ |
148 | #define EEPROM_5000_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) | 145 | #define EEPROM_5000_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) |
149 | #define EEPROM_5000_XTAL ((2*0x128) | EEPROM_5000_CALIB_ALL) | 146 | #define EEPROM_5000_XTAL ((2*0x128) | EEPROM_5000_CALIB_ALL) |
147 | #define EEPROM_5000_TEMPERATURE ((2*0x12A) | EEPROM_5000_CALIB_ALL) | ||
150 | 148 | ||
151 | /* 5000 links */ | 149 | /* 5000 links */ |
152 | #define EEPROM_5000_LINK_HOST (2*0x64) | 150 | #define EEPROM_5000_LINK_HOST (2*0x64) |
@@ -174,6 +172,9 @@ struct iwl_eeprom_channel { | |||
174 | #define EEPROM_5000_REG_BAND_52_FAT_CHANNELS ((0x92)\ | 172 | #define EEPROM_5000_REG_BAND_52_FAT_CHANNELS ((0x92)\ |
175 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */ | 173 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */ |
176 | 174 | ||
175 | /* 5050 Specific */ | ||
176 | #define EEPROM_5050_TX_POWER_VERSION (4) | ||
177 | #define EEPROM_5050_EEPROM_VERSION (0x21E) | ||
177 | 178 | ||
178 | /* 2.4 GHz */ | 179 | /* 2.4 GHz */ |
179 | extern const u8 iwl_eeprom_band_1[14]; | 180 | extern const u8 iwl_eeprom_band_1[14]; |
@@ -371,7 +372,7 @@ struct iwl_eeprom_ops { | |||
371 | int (*verify_signature) (struct iwl_priv *priv); | 372 | int (*verify_signature) (struct iwl_priv *priv); |
372 | int (*acquire_semaphore) (struct iwl_priv *priv); | 373 | int (*acquire_semaphore) (struct iwl_priv *priv); |
373 | void (*release_semaphore) (struct iwl_priv *priv); | 374 | void (*release_semaphore) (struct iwl_priv *priv); |
374 | int (*check_version) (struct iwl_priv *priv); | 375 | u16 (*calib_version) (struct iwl_priv *priv); |
375 | const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset); | 376 | const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset); |
376 | }; | 377 | }; |
377 | 378 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index a72efdf6d1dd..d7da19864550 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -60,6 +60,8 @@ | |||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 | * | 61 | * |
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | #ifndef __iwl_fh_h__ | ||
64 | #define __iwl_fh_h__ | ||
63 | 65 | ||
64 | /****************************/ | 66 | /****************************/ |
65 | /* Flow Handler Definitions */ | 67 | /* Flow Handler Definitions */ |
@@ -70,7 +72,7 @@ | |||
70 | * Addresses are offsets from device's PCI hardware base address. | 72 | * Addresses are offsets from device's PCI hardware base address. |
71 | */ | 73 | */ |
72 | #define FH_MEM_LOWER_BOUND (0x1000) | 74 | #define FH_MEM_LOWER_BOUND (0x1000) |
73 | #define FH_MEM_UPPER_BOUND (0x1EF0) | 75 | #define FH_MEM_UPPER_BOUND (0x2000) |
74 | 76 | ||
75 | /** | 77 | /** |
76 | * Keep-Warm (KW) buffer base address. | 78 | * Keep-Warm (KW) buffer base address. |
@@ -264,6 +266,7 @@ | |||
264 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) | 266 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) |
265 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) | 267 | #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) |
266 | 268 | ||
269 | #define FH_RSCSR_FRAME_SIZE_MSK (0x00003FFF) /* bits 0-13 */ | ||
267 | 270 | ||
268 | /** | 271 | /** |
269 | * Rx Shared Status Registers (RSSR) | 272 | * Rx Shared Status Registers (RSSR) |
@@ -290,6 +293,13 @@ | |||
290 | 293 | ||
291 | #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 | 294 | #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 |
292 | 295 | ||
296 | /* TFDB Area - TFDs buffer table */ | ||
297 | #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) | ||
298 | #define FH_TFDIB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x900) | ||
299 | #define FH_TFDIB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x958) | ||
300 | #define FH_TFDIB_CTRL0_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl)) | ||
301 | #define FH_TFDIB_CTRL1_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4) | ||
302 | |||
293 | /** | 303 | /** |
294 | * Transmit DMA Channel Control/Status Registers (TCSR) | 304 | * Transmit DMA Channel Control/Status Registers (TCSR) |
295 | * | 305 | * |
@@ -316,34 +326,41 @@ | |||
316 | #define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60) | 326 | #define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60) |
317 | 327 | ||
318 | /* Find Control/Status reg for given Tx DMA/FIFO channel */ | 328 | /* Find Control/Status reg for given Tx DMA/FIFO channel */ |
319 | #define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ | 329 | #define FH49_TCSR_CHNL_NUM (7) |
320 | (FH_TCSR_LOWER_BOUND + 0x20 * _chnl) | 330 | #define FH50_TCSR_CHNL_NUM (8) |
331 | |||
332 | /* TCSR: tx_config register values */ | ||
333 | #define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ | ||
334 | (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl)) | ||
335 | #define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ | ||
336 | (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4) | ||
337 | #define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ | ||
338 | (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8) | ||
339 | |||
340 | #define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) | ||
341 | #define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001) | ||
321 | 342 | ||
322 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) | 343 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000) |
323 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) | 344 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008) |
324 | 345 | ||
325 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) | 346 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) |
326 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) | 347 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) |
327 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) | 348 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) |
328 | 349 | ||
329 | #define FH_TCSR_CHNL_NUM (7) | 350 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) |
351 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000) | ||
352 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000) | ||
330 | 353 | ||
331 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) | 354 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) |
332 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) | 355 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) |
333 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) | 356 | #define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) |
334 | 357 | ||
335 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) | 358 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) |
336 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) | 359 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) |
337 | #define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) | 360 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) |
338 | 361 | ||
339 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) | 362 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) |
340 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) | 363 | #define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) |
341 | #define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ | ||
342 | (FH_TCSR_LOWER_BOUND + 0x20 * _chnl) | ||
343 | #define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ | ||
344 | (FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x4) | ||
345 | #define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ | ||
346 | (FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x8) | ||
347 | 364 | ||
348 | /** | 365 | /** |
349 | * Tx Shared Status Registers (TSSR) | 366 | * Tx Shared Status Registers (TSSR) |
@@ -360,7 +377,7 @@ | |||
360 | #define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0) | 377 | #define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0) |
361 | #define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0) | 378 | #define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0) |
362 | 379 | ||
363 | #define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010) | 380 | #define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010) |
364 | 381 | ||
365 | #define FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) ((1 << (_chnl)) << 24) | 382 | #define FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) ((1 << (_chnl)) << 24) |
366 | #define FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) ((1 << (_chnl)) << 16) | 383 | #define FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) ((1 << (_chnl)) << 16) |
@@ -369,25 +386,99 @@ | |||
369 | (FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ | 386 | (FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ |
370 | FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) | 387 | FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) |
371 | 388 | ||
372 | |||
373 | |||
374 | #define FH_REGS_LOWER_BOUND (0x1000) | ||
375 | #define FH_REGS_UPPER_BOUND (0x2000) | ||
376 | |||
377 | /* Tx service channels */ | 389 | /* Tx service channels */ |
378 | #define FH_SRVC_CHNL (9) | 390 | #define FH_SRVC_CHNL (9) |
379 | #define FH_SRVC_LOWER_BOUND (FH_REGS_LOWER_BOUND + 0x9C8) | 391 | #define FH_SRVC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9C8) |
380 | #define FH_SRVC_UPPER_BOUND (FH_REGS_LOWER_BOUND + 0x9D0) | 392 | #define FH_SRVC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) |
381 | #define FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ | 393 | #define FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ |
382 | (FH_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4) | 394 | (FH_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4) |
383 | 395 | ||
384 | /* TFDB Area - TFDs buffer table */ | 396 | #define FH_TX_CHICKEN_BITS_REG (FH_MEM_LOWER_BOUND + 0xE98) |
385 | #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) | 397 | /* Instruct FH to increment the retry count of a packet when |
386 | #define FH_TFDIB_LOWER_BOUND (FH_REGS_LOWER_BOUND + 0x900) | 398 | * it is brought from the memory to TX-FIFO |
387 | #define FH_TFDIB_UPPER_BOUND (FH_REGS_LOWER_BOUND + 0x958) | 399 | */ |
388 | #define FH_TFDIB_CTRL0_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl)) | 400 | #define FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002) |
389 | #define FH_TFDIB_CTRL1_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4) | ||
390 | 401 | ||
391 | /* TCSR: tx_config register values */ | 402 | /** |
392 | #define FH_RSCSR_FRAME_SIZE_MSK (0x00003FFF) /* bits 0-13 */ | 403 | * struct iwl_rb_status - reseve buffer status |
404 | * host memory mapped FH registers | ||
405 | * @closed_rb_num [0:11] - Indicates the index of the RB which was closed | ||
406 | * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed | ||
407 | * @finished_rb_num [0:11] - Indicates the index of the current RB | ||
408 | * in which the last frame was written to | ||
409 | * @finished_fr_num [0:11] - Indicates the index of the RX Frame | ||
410 | * which was transfered | ||
411 | */ | ||
412 | struct iwl_rb_status { | ||
413 | __le16 closed_rb_num; | ||
414 | __le16 closed_fr_num; | ||
415 | __le16 finished_rb_num; | ||
416 | __le16 finished_fr_nam; | ||
417 | } __attribute__ ((packed)); | ||
418 | |||
419 | |||
420 | #define TFD_QUEUE_SIZE_MAX (256) | ||
421 | #define TFD_QUEUE_SIZE_BC_DUP (64) | ||
422 | #define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) | ||
423 | #define IWL_TX_DMA_MASK DMA_BIT_MASK(36) | ||
424 | #define IWL_NUM_OF_TBS 20 | ||
425 | |||
426 | static inline u8 iwl_get_dma_hi_addr(dma_addr_t addr) | ||
427 | { | ||
428 | return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF; | ||
429 | } | ||
430 | /** | ||
431 | * struct iwl_tfd_tb transmit buffer descriptor within transmit frame descriptor | ||
432 | * | ||
433 | * This structure contains dma address and length of transmission address | ||
434 | * | ||
435 | * @lo: low [31:0] portion of the dma address of TX buffer | ||
436 | * every even is unaligned on 16 bit boundary | ||
437 | * @hi_n_len 0-3 [35:32] portion of dma | ||
438 | * 4-15 length of the tx buffer | ||
439 | */ | ||
440 | struct iwl_tfd_tb { | ||
441 | __le32 lo; | ||
442 | __le16 hi_n_len; | ||
443 | } __attribute__((packed)); | ||
444 | |||
445 | /** | ||
446 | * struct iwl_tfd | ||
447 | * | ||
448 | * Transmit Frame Descriptor (TFD) | ||
449 | * | ||
450 | * @ __reserved1[3] reserved | ||
451 | * @ num_tbs 0-4 number of active tbs | ||
452 | * 5 reserved | ||
453 | * 6-7 padding (not used) | ||
454 | * @ tbs[20] transmit frame buffer descriptors | ||
455 | * @ __pad padding | ||
456 | * | ||
457 | * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM. | ||
458 | * Both driver and device share these circular buffers, each of which must be | ||
459 | * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes | ||
460 | * | ||
461 | * Driver must indicate the physical address of the base of each | ||
462 | * circular buffer via the FH_MEM_CBBC_QUEUE registers. | ||
463 | * | ||
464 | * Each TFD contains pointer/size information for up to 20 data buffers | ||
465 | * in host DRAM. These buffers collectively contain the (one) frame described | ||
466 | * by the TFD. Each buffer must be a single contiguous block of memory within | ||
467 | * itself, but buffers may be scattered in host DRAM. Each buffer has max size | ||
468 | * of (4K - 4). The concatenates all of a TFD's buffers into a single | ||
469 | * Tx frame, up to 8 KBytes in size. | ||
470 | * | ||
471 | * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. | ||
472 | */ | ||
473 | struct iwl_tfd { | ||
474 | u8 __reserved1[3]; | ||
475 | u8 num_tbs; | ||
476 | struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS]; | ||
477 | __le32 __pad; | ||
478 | } __attribute__ ((packed)); | ||
479 | |||
480 | |||
481 | /* Keep Warm Size */ | ||
482 | #define IWL_KW_SIZE 0x1000 /* 4k */ | ||
393 | 483 | ||
484 | #endif /* !__iwl_fh_h__ */ | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 8300f3d00a06..01a2169cecec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * in the file called LICENSE.GPL. | 22 | * in the file called LICENSE.GPL. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * Tomas Winkler <tomas.winkler@intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
@@ -36,7 +36,7 @@ | |||
36 | #include "iwl-core.h" | 36 | #include "iwl-core.h" |
37 | 37 | ||
38 | 38 | ||
39 | #define IWL_CMD(x) case x : return #x | 39 | #define IWL_CMD(x) case x: return #x |
40 | 40 | ||
41 | const char *get_cmd_string(u8 cmd) | 41 | const char *get_cmd_string(u8 cmd) |
42 | { | 42 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 41eed6793328..ca4f638ab9d0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -32,110 +32,6 @@ | |||
32 | 32 | ||
33 | #include <linux/ctype.h> | 33 | #include <linux/ctype.h> |
34 | 34 | ||
35 | /* | ||
36 | * The structures defined by the hardware/uCode interface | ||
37 | * have bit-wise operations. For each bit-field there is | ||
38 | * a data symbol in the structure, the start bit position | ||
39 | * and the length of the bit-field. | ||
40 | * | ||
41 | * iwl_get_bits and iwl_set_bits will return or set the | ||
42 | * appropriate bits on a 32-bit value. | ||
43 | * | ||
44 | * IWL_GET_BITS and IWL_SET_BITS use symbol expansion to | ||
45 | * expand out to the appropriate call to iwl_get_bits | ||
46 | * and iwl_set_bits without having to reference all of the | ||
47 | * numerical constants and defines provided in the hardware | ||
48 | * definition | ||
49 | */ | ||
50 | |||
51 | /** | ||
52 | * iwl_get_bits - Extract a hardware bit-field value | ||
53 | * @src: source hardware value (__le32) | ||
54 | * @pos: bit-position (0-based) of first bit of value | ||
55 | * @len: length of bit-field | ||
56 | * | ||
57 | * iwl_get_bits will return the bit-field in cpu endian ordering. | ||
58 | * | ||
59 | * NOTE: If used from IWL_GET_BITS then pos and len are compile-constants and | ||
60 | * will collapse to minimal code by the compiler. | ||
61 | */ | ||
62 | static inline u32 iwl_get_bits(__le32 src, u8 pos, u8 len) | ||
63 | { | ||
64 | u32 tmp = le32_to_cpu(src); | ||
65 | |||
66 | tmp >>= pos; | ||
67 | tmp &= (1UL << len) - 1; | ||
68 | return tmp; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * iwl_set_bits - Set a hardware bit-field value | ||
73 | * @dst: Address of __le32 hardware value | ||
74 | * @pos: bit-position (0-based) of first bit of value | ||
75 | * @len: length of bit-field | ||
76 | * @val: cpu endian value to encode into the bit-field | ||
77 | * | ||
78 | * iwl_set_bits will encode val into dst, masked to be len bits long at bit | ||
79 | * position pos. | ||
80 | * | ||
81 | * NOTE: If used IWL_SET_BITS pos and len will be compile-constants and | ||
82 | * will collapse to minimal code by the compiler. | ||
83 | */ | ||
84 | static inline void iwl_set_bits(__le32 *dst, u8 pos, u8 len, int val) | ||
85 | { | ||
86 | u32 tmp = le32_to_cpu(*dst); | ||
87 | |||
88 | tmp &= ~(((1UL << len) - 1) << pos); | ||
89 | tmp |= (val & ((1UL << len) - 1)) << pos; | ||
90 | *dst = cpu_to_le32(tmp); | ||
91 | } | ||
92 | |||
93 | static inline void iwl_set_bits16(__le16 *dst, u8 pos, u8 len, int val) | ||
94 | { | ||
95 | u16 tmp = le16_to_cpu(*dst); | ||
96 | |||
97 | tmp &= ~((1UL << (pos + len)) - (1UL << pos)); | ||
98 | tmp |= (val & ((1UL << len) - 1)) << pos; | ||
99 | *dst = cpu_to_le16(tmp); | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * The bit-field definitions in iwl-xxxx-hw.h are in the form of: | ||
104 | * | ||
105 | * struct example { | ||
106 | * __le32 val1; | ||
107 | * #define IWL_name_POS 8 | ||
108 | * #define IWL_name_LEN 4 | ||
109 | * #define IWL_name_SYM val1 | ||
110 | * }; | ||
111 | * | ||
112 | * The IWL_SET_BITS and IWL_GET_BITS macros are provided to allow the driver | ||
113 | * to call: | ||
114 | * | ||
115 | * struct example bar; | ||
116 | * u32 val = IWL_GET_BITS(bar, name); | ||
117 | * val = val * 2; | ||
118 | * IWL_SET_BITS(bar, name, val); | ||
119 | * | ||
120 | * All cpu / host ordering, masking, and shifts are performed by the macros | ||
121 | * and iwl_{get,set}_bits. | ||
122 | * | ||
123 | */ | ||
124 | #define IWL_SET_BITS(s, sym, v) \ | ||
125 | iwl_set_bits(&(s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ | ||
126 | IWL_ ## sym ## _LEN, (v)) | ||
127 | |||
128 | #define IWL_SET_BITS16(s, sym, v) \ | ||
129 | iwl_set_bits16(&(s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ | ||
130 | IWL_ ## sym ## _LEN, (v)) | ||
131 | |||
132 | #define IWL_GET_BITS(s, sym) \ | ||
133 | iwl_get_bits((s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ | ||
134 | IWL_ ## sym ## _LEN) | ||
135 | |||
136 | |||
137 | #define KELVIN_TO_CELSIUS(x) ((x)-273) | ||
138 | #define CELSIUS_TO_KELVIN(x) ((x)+273) | ||
139 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) | 35 | #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) |
140 | 36 | ||
141 | 37 | ||
@@ -159,11 +55,6 @@ static inline unsigned long elapsed_jiffies(unsigned long start, | |||
159 | return end + (MAX_JIFFY_OFFSET - start) + 1; | 55 | return end + (MAX_JIFFY_OFFSET - start) + 1; |
160 | } | 56 | } |
161 | 57 | ||
162 | static inline u8 iwl_get_dma_hi_address(dma_addr_t addr) | ||
163 | { | ||
164 | return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; | ||
165 | } | ||
166 | |||
167 | /** | 58 | /** |
168 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning | 59 | * iwl_queue_inc_wrap - increment queue index, wrap back to beginning |
169 | * @index -- current index | 60 | * @index -- current index |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 9740fcc1805e..0a92e7431ada 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * file called LICENSE. | 21 | * file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 24 | * Intel Linux Wireless <ilw@linux.intel.com> |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
@@ -55,7 +55,7 @@ | |||
55 | * _iwl_read32.) | 55 | * _iwl_read32.) |
56 | * | 56 | * |
57 | * These declarations are *extremely* useful in quickly isolating code deltas | 57 | * These declarations are *extremely* useful in quickly isolating code deltas |
58 | * which result in misconfiguring of the hardware I/O. In combination with | 58 | * which result in misconfiguration of the hardware I/O. In combination with |
59 | * git-bisect and the IO debug level you can quickly determine the specific | 59 | * git-bisect and the IO debug level you can quickly determine the specific |
60 | * commit which breaks the IO sequence to the hardware. | 60 | * commit which breaks the IO sequence to the hardware. |
61 | * | 61 | * |
@@ -87,17 +87,18 @@ static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) | |||
87 | #define iwl_read32(p, o) _iwl_read32(p, o) | 87 | #define iwl_read32(p, o) _iwl_read32(p, o) |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | #define IWL_POLL_INTERVAL 10 /* microseconds */ | ||
90 | static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, | 91 | static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, |
91 | u32 bits, u32 mask, int timeout) | 92 | u32 bits, u32 mask, int timeout) |
92 | { | 93 | { |
93 | int i = 0; | 94 | int t = 0; |
94 | 95 | ||
95 | do { | 96 | do { |
96 | if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) | 97 | if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) |
97 | return i; | 98 | return t; |
98 | mdelay(10); | 99 | udelay(IWL_POLL_INTERVAL); |
99 | i += 10; | 100 | t += IWL_POLL_INTERVAL; |
100 | } while (i < timeout); | 101 | } while (t < timeout); |
101 | 102 | ||
102 | return -ETIMEDOUT; | 103 | return -ETIMEDOUT; |
103 | } | 104 | } |
@@ -109,7 +110,7 @@ static inline int __iwl_poll_bit(const char *f, u32 l, | |||
109 | int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); | 110 | int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); |
110 | IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", | 111 | IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", |
111 | addr, bits, mask, | 112 | addr, bits, mask, |
112 | unlikely(ret == -ETIMEDOUT)?"timeout":"", f, l); | 113 | unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); |
113 | return ret; | 114 | return ret; |
114 | } | 115 | } |
115 | #define iwl_poll_bit(priv, addr, bits, mask, timeout) \ | 116 | #define iwl_poll_bit(priv, addr, bits, mask, timeout) \ |
@@ -269,19 +270,10 @@ static inline void iwl_write_reg_buf(struct iwl_priv *priv, | |||
269 | } | 270 | } |
270 | } | 271 | } |
271 | 272 | ||
272 | static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, | 273 | static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, u32 addr, |
273 | u32 addr, u32 mask, int timeout) | 274 | u32 mask, int timeout) |
274 | { | 275 | { |
275 | int i = 0; | 276 | return _iwl_poll_bit(priv, addr, mask, mask, timeout); |
276 | |||
277 | do { | ||
278 | if ((_iwl_read_direct32(priv, addr) & mask) == mask) | ||
279 | return i; | ||
280 | mdelay(10); | ||
281 | i += 10; | ||
282 | } while (i < timeout); | ||
283 | |||
284 | return -ETIMEDOUT; | ||
285 | } | 277 | } |
286 | 278 | ||
287 | #ifdef CONFIG_IWLWIFI_DEBUG | 279 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -308,6 +300,7 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l, | |||
308 | static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) | 300 | static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) |
309 | { | 301 | { |
310 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 302 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); |
303 | rmb(); | ||
311 | return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); | 304 | return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); |
312 | } | 305 | } |
313 | #ifdef CONFIG_IWLWIFI_DEBUG | 306 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -330,6 +323,7 @@ static inline void _iwl_write_prph(struct iwl_priv *priv, | |||
330 | { | 323 | { |
331 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, | 324 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, |
332 | ((addr & 0x0000FFFF) | (3 << 24))); | 325 | ((addr & 0x0000FFFF) | (3 << 24))); |
326 | wmb(); | ||
333 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); | 327 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); |
334 | } | 328 | } |
335 | #ifdef CONFIG_IWLWIFI_DEBUG | 329 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -392,12 +386,14 @@ static inline void iwl_clear_bits_prph(struct iwl_priv | |||
392 | static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) | 386 | static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) |
393 | { | 387 | { |
394 | iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); | 388 | iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); |
389 | rmb(); | ||
395 | return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 390 | return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); |
396 | } | 391 | } |
397 | 392 | ||
398 | static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) | 393 | static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) |
399 | { | 394 | { |
400 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 395 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
396 | wmb(); | ||
401 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); | 397 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); |
402 | } | 398 | } |
403 | 399 | ||
@@ -405,6 +401,7 @@ static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, | |||
405 | u32 len, u32 *values) | 401 | u32 len, u32 *values) |
406 | { | 402 | { |
407 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 403 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
404 | wmb(); | ||
408 | for (; 0 < len; len -= sizeof(u32), values++) | 405 | for (; 0 < len; len -= sizeof(u32), values++) |
409 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); | 406 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); |
410 | } | 407 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 4eee1b163cd2..11eccd7d268c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
@@ -41,7 +41,6 @@ | |||
41 | #include "iwl-dev.h" | 41 | #include "iwl-dev.h" |
42 | #include "iwl-core.h" | 42 | #include "iwl-core.h" |
43 | #include "iwl-io.h" | 43 | #include "iwl-io.h" |
44 | #include "iwl-helpers.h" | ||
45 | 44 | ||
46 | #ifdef CONFIG_IWLWIFI_DEBUG | 45 | #ifdef CONFIG_IWLWIFI_DEBUG |
47 | static const char *led_type_str[] = { | 46 | static const char *led_type_str[] = { |
@@ -278,7 +277,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv) | |||
278 | /* FIXME: + priv->rx_stats[2].bytes; */ | 277 | /* FIXME: + priv->rx_stats[2].bytes; */ |
279 | s64 tpt = current_tpt - priv->led_tpt; | 278 | s64 tpt = current_tpt - priv->led_tpt; |
280 | 279 | ||
281 | if (tpt < 0) /* wrapparound */ | 280 | if (tpt < 0) /* wraparound */ |
282 | tpt = -tpt; | 281 | tpt = -tpt; |
283 | 282 | ||
284 | IWL_DEBUG_LED("tpt %lld current_tpt %llu\n", | 283 | IWL_DEBUG_LED("tpt %lld current_tpt %llu\n", |
@@ -293,7 +292,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv) | |||
293 | if (tpt > (blink_tbl[i].tpt * IWL_1MB_RATE)) | 292 | if (tpt > (blink_tbl[i].tpt * IWL_1MB_RATE)) |
294 | break; | 293 | break; |
295 | 294 | ||
296 | IWL_DEBUG_LED("LED BLINK IDX=%d", i); | 295 | IWL_DEBUG_LED("LED BLINK IDX=%d\n", i); |
297 | return i; | 296 | return i; |
298 | } | 297 | } |
299 | 298 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.h b/drivers/net/wireless/iwlwifi/iwl-led.h index 588c9ad20e83..021e00bcd1be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.h +++ b/drivers/net/wireless/iwlwifi/iwl-led.h | |||
@@ -19,7 +19,7 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * Contact Information: | 21 | * Contact Information: |
22 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | 24 | * |
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 60a03d2d2d0e..75ca6a542174 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
@@ -39,7 +39,6 @@ | |||
39 | #include "iwl-commands.h" | 39 | #include "iwl-commands.h" |
40 | #include "iwl-debug.h" | 40 | #include "iwl-debug.h" |
41 | #include "iwl-power.h" | 41 | #include "iwl-power.h" |
42 | #include "iwl-helpers.h" | ||
43 | 42 | ||
44 | /* | 43 | /* |
45 | * Setting power level allow the card to go to sleep when not busy | 44 | * Setting power level allow the card to go to sleep when not busy |
@@ -80,7 +79,7 @@ | |||
80 | #define IWL_REDUCED_POWER_TEMPERATURE 95 | 79 | #define IWL_REDUCED_POWER_TEMPERATURE 95 |
81 | 80 | ||
82 | /* default power management (not Tx power) table values */ | 81 | /* default power management (not Tx power) table values */ |
83 | /* for tim 0-10 */ | 82 | /* for TIM 0-10 */ |
84 | static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { | 83 | static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { |
85 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 84 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
86 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, | 85 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, |
@@ -91,7 +90,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { | |||
91 | }; | 90 | }; |
92 | 91 | ||
93 | 92 | ||
94 | /* for tim = 3-10 */ | 93 | /* for TIM = 3-10 */ |
95 | static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { | 94 | static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { |
96 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 95 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
97 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, | 96 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, |
@@ -101,7 +100,7 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { | |||
101 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 7, 10, 10)}, 2} | 100 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 7, 10, 10)}, 2} |
102 | }; | 101 | }; |
103 | 102 | ||
104 | /* for tim > 11 */ | 103 | /* for TIM > 11 */ |
105 | static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { | 104 | static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { |
106 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 105 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
107 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, | 106 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, |
@@ -183,7 +182,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
183 | return 0; | 182 | return 0; |
184 | } | 183 | } |
185 | 184 | ||
186 | /* adjust power command according to dtim period and power level*/ | 185 | /* adjust power command according to DTIM period and power level*/ |
187 | static int iwl_update_power_command(struct iwl_priv *priv, | 186 | static int iwl_update_power_command(struct iwl_priv *priv, |
188 | struct iwl_powertable_cmd *cmd, | 187 | struct iwl_powertable_cmd *cmd, |
189 | u16 mode) | 188 | u16 mode) |
@@ -257,15 +256,11 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
257 | struct iwl_power_mgr *setting = &(priv->power_data); | 256 | struct iwl_power_mgr *setting = &(priv->power_data); |
258 | int ret = 0; | 257 | int ret = 0; |
259 | u16 uninitialized_var(final_mode); | 258 | u16 uninitialized_var(final_mode); |
259 | bool update_chains; | ||
260 | 260 | ||
261 | /* Don't update the RX chain when chain noise calibration is running */ | 261 | /* Don't update the RX chain when chain noise calibration is running */ |
262 | if (priv->chain_noise_data.state != IWL_CHAIN_NOISE_DONE && | 262 | update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || |
263 | priv->chain_noise_data.state != IWL_CHAIN_NOISE_ALIVE) { | 263 | priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; |
264 | IWL_DEBUG_POWER("Cannot update the power, chain noise " | ||
265 | "calibration running: %d\n", | ||
266 | priv->chain_noise_data.state); | ||
267 | return -EAGAIN; | ||
268 | } | ||
269 | 264 | ||
270 | /* If on battery, set to 3, | 265 | /* If on battery, set to 3, |
271 | * if plugged into AC power, set to CAM ("continuously aware mode"), | 266 | * if plugged into AC power, set to CAM ("continuously aware mode"), |
@@ -313,9 +308,12 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
313 | else | 308 | else |
314 | set_bit(STATUS_POWER_PMI, &priv->status); | 309 | set_bit(STATUS_POWER_PMI, &priv->status); |
315 | 310 | ||
316 | if (priv->cfg->ops->lib->update_chain_flags) | 311 | if (priv->cfg->ops->lib->update_chain_flags && update_chains) |
317 | priv->cfg->ops->lib->update_chain_flags(priv); | 312 | priv->cfg->ops->lib->update_chain_flags(priv); |
318 | 313 | else | |
314 | IWL_DEBUG_POWER("Cannot update the power, chain noise " | ||
315 | "calibration running: %d\n", | ||
316 | priv->chain_noise_data.state); | ||
319 | if (!ret) | 317 | if (!ret) |
320 | setting->power_mode = final_mode; | 318 | setting->power_mode = final_mode; |
321 | } | 319 | } |
@@ -325,7 +323,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
325 | EXPORT_SYMBOL(iwl_power_update_mode); | 323 | EXPORT_SYMBOL(iwl_power_update_mode); |
326 | 324 | ||
327 | /* Allow other iwl code to disable/enable power management active | 325 | /* Allow other iwl code to disable/enable power management active |
328 | * this will be usefull for rate scale to disable PM during heavy | 326 | * this will be useful for rate scale to disable PM during heavy |
329 | * Tx/Rx activities | 327 | * Tx/Rx activities |
330 | */ | 328 | */ |
331 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) | 329 | int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) |
@@ -352,8 +350,8 @@ int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) | |||
352 | EXPORT_SYMBOL(iwl_power_disable_management); | 350 | EXPORT_SYMBOL(iwl_power_disable_management); |
353 | 351 | ||
354 | /* Allow other iwl code to disable/enable power management active | 352 | /* Allow other iwl code to disable/enable power management active |
355 | * this will be usefull for rate scale to disable PM during hight | 353 | * this will be useful for rate scale to disable PM during high |
356 | * valume activities | 354 | * volume activities |
357 | */ | 355 | */ |
358 | int iwl_power_enable_management(struct iwl_priv *priv) | 356 | int iwl_power_enable_management(struct iwl_priv *priv) |
359 | { | 357 | { |
@@ -391,7 +389,7 @@ int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode) | |||
391 | } | 389 | } |
392 | EXPORT_SYMBOL(iwl_power_set_system_mode); | 390 | EXPORT_SYMBOL(iwl_power_set_system_mode); |
393 | 391 | ||
394 | /* initilize to default */ | 392 | /* initialize to default */ |
395 | void iwl_power_initialize(struct iwl_priv *priv) | 393 | void iwl_power_initialize(struct iwl_priv *priv) |
396 | { | 394 | { |
397 | 395 | ||
@@ -443,7 +441,7 @@ static void iwl_bg_set_power_save(struct work_struct *work) | |||
443 | 441 | ||
444 | mutex_lock(&priv->mutex); | 442 | mutex_lock(&priv->mutex); |
445 | 443 | ||
446 | /* on starting association we disable power managment | 444 | /* on starting association we disable power management |
447 | * until association, if association failed then this | 445 | * until association, if association failed then this |
448 | * timer will expire and enable PM again. | 446 | * timer will expire and enable PM again. |
449 | */ | 447 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h index df484a90ae64..fa098d8975ce 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.h +++ b/drivers/net/wireless/iwlwifi/iwl-power.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | #ifndef __iwl_power_setting_h__ | 28 | #ifndef __iwl_power_setting_h__ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index ee5afd48d3af..b7a5f23351c3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -25,7 +25,7 @@ | |||
25 | * in the file called LICENSE.GPL. | 25 | * in the file called LICENSE.GPL. |
26 | * | 26 | * |
27 | * Contact Information: | 27 | * Contact Information: |
28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | * | 30 | * |
31 | * BSD LICENSE | 31 | * BSD LICENSE |
@@ -158,9 +158,9 @@ | |||
158 | * | 158 | * |
159 | * 4) Point (via BSM_DRAM_*) to the "runtime" uCode data and instruction | 159 | * 4) Point (via BSM_DRAM_*) to the "runtime" uCode data and instruction |
160 | * images in host DRAM. The last register loaded must be the instruction | 160 | * images in host DRAM. The last register loaded must be the instruction |
161 | * bytecount register ("1" in MSbit tells initialization uCode to load | 161 | * byte count register ("1" in MSbit tells initialization uCode to load |
162 | * the runtime uCode): | 162 | * the runtime uCode): |
163 | * BSM_DRAM_INST_BYTECOUNT_REG = bytecount | BSM_DRAM_INST_LOAD | 163 | * BSM_DRAM_INST_BYTECOUNT_REG = byte count | BSM_DRAM_INST_LOAD |
164 | * | 164 | * |
165 | * 5) Wait for "alive" notification, then issue normal runtime commands. | 165 | * 5) Wait for "alive" notification, then issue normal runtime commands. |
166 | * | 166 | * |
@@ -244,7 +244,7 @@ | |||
244 | /** | 244 | /** |
245 | * Tx Scheduler | 245 | * Tx Scheduler |
246 | * | 246 | * |
247 | * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs | 247 | * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs |
248 | * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in | 248 | * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in |
249 | * host DRAM. It steers each frame's Tx command (which contains the frame | 249 | * host DRAM. It steers each frame's Tx command (which contains the frame |
250 | * data) into one of up to 7 prioritized Tx DMA FIFO channels within the | 250 | * data) into one of up to 7 prioritized Tx DMA FIFO channels within the |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c index 5d642298f04c..4b69da30665c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c +++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -34,8 +34,6 @@ | |||
34 | #include "iwl-eeprom.h" | 34 | #include "iwl-eeprom.h" |
35 | #include "iwl-dev.h" | 35 | #include "iwl-dev.h" |
36 | #include "iwl-core.h" | 36 | #include "iwl-core.h" |
37 | #include "iwl-helpers.h" | ||
38 | |||
39 | 37 | ||
40 | /* software rf-kill from user */ | 38 | /* software rf-kill from user */ |
41 | static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state) | 39 | static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state) |
@@ -64,7 +62,7 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state) | |||
64 | iwl_radio_kill_sw_disable_radio(priv); | 62 | iwl_radio_kill_sw_disable_radio(priv); |
65 | break; | 63 | break; |
66 | default: | 64 | default: |
67 | IWL_WARNING("we recieved unexpected RFKILL state %d\n", state); | 65 | IWL_WARNING("we received unexpected RFKILL state %d\n", state); |
68 | break; | 66 | break; |
69 | } | 67 | } |
70 | out_unlock: | 68 | out_unlock: |
@@ -83,7 +81,7 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
83 | IWL_DEBUG_RF_KILL("Initializing RFKILL.\n"); | 81 | IWL_DEBUG_RF_KILL("Initializing RFKILL.\n"); |
84 | priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); | 82 | priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); |
85 | if (!priv->rfkill) { | 83 | if (!priv->rfkill) { |
86 | IWL_ERROR("Unable to allocate rfkill device.\n"); | 84 | IWL_ERROR("Unable to allocate RFKILL device.\n"); |
87 | ret = -ENOMEM; | 85 | ret = -ENOMEM; |
88 | goto error; | 86 | goto error; |
89 | } | 87 | } |
@@ -99,7 +97,7 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
99 | 97 | ||
100 | ret = rfkill_register(priv->rfkill); | 98 | ret = rfkill_register(priv->rfkill); |
101 | if (ret) { | 99 | if (ret) { |
102 | IWL_ERROR("Unable to register rfkill: %d\n", ret); | 100 | IWL_ERROR("Unable to register RFKILL: %d\n", ret); |
103 | goto free_rfkill; | 101 | goto free_rfkill; |
104 | } | 102 | } |
105 | 103 | ||
@@ -127,7 +125,7 @@ void iwl_rfkill_unregister(struct iwl_priv *priv) | |||
127 | } | 125 | } |
128 | EXPORT_SYMBOL(iwl_rfkill_unregister); | 126 | EXPORT_SYMBOL(iwl_rfkill_unregister); |
129 | 127 | ||
130 | /* set rf-kill to the right state. */ | 128 | /* set RFKILL to the right state. */ |
131 | void iwl_rfkill_set_hw_state(struct iwl_priv *priv) | 129 | void iwl_rfkill_set_hw_state(struct iwl_priv *priv) |
132 | { | 130 | { |
133 | if (!priv->rfkill) | 131 | if (!priv->rfkill) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.h b/drivers/net/wireless/iwlwifi/iwl-rfkill.h index 402fd4c781da..86dc055a2e94 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rfkill.h +++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | #ifndef __iwl_rf_kill_h__ | 28 | #ifndef __iwl_rf_kill_h__ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 0509c16dbe75..c5f1aa0feac8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -218,8 +218,7 @@ int iwl_rx_queue_restock(struct iwl_priv *priv) | |||
218 | 218 | ||
219 | /* If we've added more space for the firmware to place data, tell it. | 219 | /* If we've added more space for the firmware to place data, tell it. |
220 | * Increment device's write pointer in multiples of 8. */ | 220 | * Increment device's write pointer in multiples of 8. */ |
221 | if ((write != (rxq->write & ~0x7)) | 221 | if (write != (rxq->write & ~0x7)) { |
222 | || (abs(rxq->write - rxq->read) > 7)) { | ||
223 | spin_lock_irqsave(&rxq->lock, flags); | 222 | spin_lock_irqsave(&rxq->lock, flags); |
224 | rxq->need_update = 1; | 223 | rxq->need_update = 1; |
225 | spin_unlock_irqrestore(&rxq->lock, flags); | 224 | spin_unlock_irqrestore(&rxq->lock, flags); |
@@ -245,25 +244,31 @@ void iwl_rx_allocate(struct iwl_priv *priv) | |||
245 | struct list_head *element; | 244 | struct list_head *element; |
246 | struct iwl_rx_mem_buffer *rxb; | 245 | struct iwl_rx_mem_buffer *rxb; |
247 | unsigned long flags; | 246 | unsigned long flags; |
248 | spin_lock_irqsave(&rxq->lock, flags); | 247 | |
249 | while (!list_empty(&rxq->rx_used)) { | 248 | while (1) { |
249 | spin_lock_irqsave(&rxq->lock, flags); | ||
250 | |||
251 | if (list_empty(&rxq->rx_used)) { | ||
252 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
253 | return; | ||
254 | } | ||
250 | element = rxq->rx_used.next; | 255 | element = rxq->rx_used.next; |
251 | rxb = list_entry(element, struct iwl_rx_mem_buffer, list); | 256 | rxb = list_entry(element, struct iwl_rx_mem_buffer, list); |
257 | list_del(element); | ||
258 | |||
259 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
252 | 260 | ||
253 | /* Alloc a new receive buffer */ | 261 | /* Alloc a new receive buffer */ |
254 | rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, | 262 | rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, |
255 | __GFP_NOWARN | GFP_ATOMIC); | 263 | GFP_KERNEL); |
256 | if (!rxb->skb) { | 264 | if (!rxb->skb) { |
257 | if (net_ratelimit()) | 265 | printk(KERN_CRIT DRV_NAME |
258 | printk(KERN_CRIT DRV_NAME | 266 | "Can not allocate SKB buffers\n"); |
259 | ": Can not allocate SKB buffers\n"); | ||
260 | /* We don't reschedule replenish work here -- we will | 267 | /* We don't reschedule replenish work here -- we will |
261 | * call the restock method and if it still needs | 268 | * call the restock method and if it still needs |
262 | * more buffers it will schedule replenish */ | 269 | * more buffers it will schedule replenish */ |
263 | break; | 270 | break; |
264 | } | 271 | } |
265 | priv->alloc_rxb_skb++; | ||
266 | list_del(element); | ||
267 | 272 | ||
268 | /* Get physical address of RB/SKB */ | 273 | /* Get physical address of RB/SKB */ |
269 | rxb->real_dma_addr = pci_map_single( | 274 | rxb->real_dma_addr = pci_map_single( |
@@ -277,12 +282,15 @@ void iwl_rx_allocate(struct iwl_priv *priv) | |||
277 | rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256); | 282 | rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256); |
278 | skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); | 283 | skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); |
279 | 284 | ||
285 | spin_lock_irqsave(&rxq->lock, flags); | ||
286 | |||
280 | list_add_tail(&rxb->list, &rxq->rx_free); | 287 | list_add_tail(&rxb->list, &rxq->rx_free); |
281 | rxq->free_count++; | 288 | rxq->free_count++; |
289 | priv->alloc_rxb_skb++; | ||
290 | |||
291 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
282 | } | 292 | } |
283 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
284 | } | 293 | } |
285 | EXPORT_SYMBOL(iwl_rx_allocate); | ||
286 | 294 | ||
287 | void iwl_rx_replenish(struct iwl_priv *priv) | 295 | void iwl_rx_replenish(struct iwl_priv *priv) |
288 | { | 296 | { |
@@ -317,7 +325,10 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
317 | 325 | ||
318 | pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 326 | pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
319 | rxq->dma_addr); | 327 | rxq->dma_addr); |
328 | pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), | ||
329 | rxq->rb_stts, rxq->rb_stts_dma); | ||
320 | rxq->bd = NULL; | 330 | rxq->bd = NULL; |
331 | rxq->rb_stts = NULL; | ||
321 | } | 332 | } |
322 | EXPORT_SYMBOL(iwl_rx_queue_free); | 333 | EXPORT_SYMBOL(iwl_rx_queue_free); |
323 | 334 | ||
@@ -334,7 +345,12 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) | |||
334 | /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ | 345 | /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ |
335 | rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); | 346 | rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); |
336 | if (!rxq->bd) | 347 | if (!rxq->bd) |
337 | return -ENOMEM; | 348 | goto err_bd; |
349 | |||
350 | rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status), | ||
351 | &rxq->rb_stts_dma); | ||
352 | if (!rxq->rb_stts) | ||
353 | goto err_rb; | ||
338 | 354 | ||
339 | /* Fill the rx_used queue with _all_ of the Rx buffers */ | 355 | /* Fill the rx_used queue with _all_ of the Rx buffers */ |
340 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) | 356 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) |
@@ -346,6 +362,12 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) | |||
346 | rxq->free_count = 0; | 362 | rxq->free_count = 0; |
347 | rxq->need_update = 0; | 363 | rxq->need_update = 0; |
348 | return 0; | 364 | return 0; |
365 | |||
366 | err_rb: | ||
367 | pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, | ||
368 | rxq->dma_addr); | ||
369 | err_bd: | ||
370 | return -ENOMEM; | ||
349 | } | 371 | } |
350 | EXPORT_SYMBOL(iwl_rx_queue_alloc); | 372 | EXPORT_SYMBOL(iwl_rx_queue_alloc); |
351 | 373 | ||
@@ -412,10 +434,10 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
412 | 434 | ||
413 | /* Tell device where in DRAM to update its Rx status */ | 435 | /* Tell device where in DRAM to update its Rx status */ |
414 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, | 436 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, |
415 | (priv->shared_phys + priv->rb_closed_offset) >> 4); | 437 | rxq->rb_stts_dma >> 4); |
416 | 438 | ||
417 | /* Enable Rx DMA | 439 | /* Enable Rx DMA |
418 | * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set becuase of HW bug in | 440 | * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set because of HW bug in |
419 | * the credit mechanism in 5000 HW RX FIFO | 441 | * the credit mechanism in 5000 HW RX FIFO |
420 | * Direct rx interrupts to hosts | 442 | * Direct rx interrupts to hosts |
421 | * Rx buffer size 4 or 8k | 443 | * Rx buffer size 4 or 8k |
@@ -426,6 +448,7 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
426 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | | 448 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | |
427 | FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY | | 449 | FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY | |
428 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | | 450 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | |
451 | FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK | | ||
429 | rb_size| | 452 | rb_size| |
430 | (rb_timeout << FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)| | 453 | (rb_timeout << FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)| |
431 | (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); | 454 | (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); |
@@ -453,10 +476,8 @@ int iwl_rxq_stop(struct iwl_priv *priv) | |||
453 | 476 | ||
454 | /* stop Rx DMA */ | 477 | /* stop Rx DMA */ |
455 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); | 478 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); |
456 | ret = iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, | 479 | iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, |
457 | (1 << 24), 1000); | 480 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); |
458 | if (ret < 0) | ||
459 | IWL_ERROR("Can't stop Rx DMA.\n"); | ||
460 | 481 | ||
461 | iwl_release_nic_access(priv); | 482 | iwl_release_nic_access(priv); |
462 | spin_unlock_irqrestore(&priv->lock, flags); | 483 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -470,7 +491,7 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | |||
470 | 491 | ||
471 | { | 492 | { |
472 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 493 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
473 | struct iwl4965_missed_beacon_notif *missed_beacon; | 494 | struct iwl_missed_beacon_notif *missed_beacon; |
474 | 495 | ||
475 | missed_beacon = &pkt->u.missed_beacon; | 496 | missed_beacon = &pkt->u.missed_beacon; |
476 | if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) { | 497 | if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) { |
@@ -485,49 +506,6 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | |||
485 | } | 506 | } |
486 | EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); | 507 | EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); |
487 | 508 | ||
488 | int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn) | ||
489 | { | ||
490 | unsigned long flags; | ||
491 | int sta_id; | ||
492 | |||
493 | sta_id = iwl_find_station(priv, addr); | ||
494 | if (sta_id == IWL_INVALID_STATION) | ||
495 | return -ENXIO; | ||
496 | |||
497 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
498 | priv->stations[sta_id].sta.station_flags_msk = 0; | ||
499 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; | ||
500 | priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; | ||
501 | priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); | ||
502 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
503 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
504 | |||
505 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | ||
506 | CMD_ASYNC); | ||
507 | } | ||
508 | EXPORT_SYMBOL(iwl_rx_agg_start); | ||
509 | |||
510 | int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid) | ||
511 | { | ||
512 | unsigned long flags; | ||
513 | int sta_id; | ||
514 | |||
515 | sta_id = iwl_find_station(priv, addr); | ||
516 | if (sta_id == IWL_INVALID_STATION) | ||
517 | return -ENXIO; | ||
518 | |||
519 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
520 | priv->stations[sta_id].sta.station_flags_msk = 0; | ||
521 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; | ||
522 | priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; | ||
523 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
524 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
525 | |||
526 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | ||
527 | CMD_ASYNC); | ||
528 | } | ||
529 | EXPORT_SYMBOL(iwl_rx_agg_stop); | ||
530 | |||
531 | 509 | ||
532 | /* Calculate noise level, based on measurements during network silence just | 510 | /* Calculate noise level, based on measurements during network silence just |
533 | * before arriving beacon. This measurement can be done only if we know | 511 | * before arriving beacon. This measurement can be done only if we know |
@@ -651,20 +629,24 @@ static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) | |||
651 | return sig_qual; | 629 | return sig_qual; |
652 | } | 630 | } |
653 | 631 | ||
654 | #ifdef CONFIG_IWLWIFI_DEBUG | 632 | /* Calc max signal level (dBm) among 3 possible receivers */ |
633 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | ||
634 | struct iwl_rx_phy_res *rx_resp) | ||
635 | { | ||
636 | return priv->cfg->ops->utils->calc_rssi(priv, rx_resp); | ||
637 | } | ||
655 | 638 | ||
639 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
656 | /** | 640 | /** |
657 | * iwl_dbg_report_frame - dump frame to syslog during debug sessions | 641 | * iwl_dbg_report_frame - dump frame to syslog during debug sessions |
658 | * | 642 | * |
659 | * You may hack this function to show different aspects of received frames, | 643 | * You may hack this function to show different aspects of received frames, |
660 | * including selective frame dumps. | 644 | * including selective frame dumps. |
661 | * group100 parameter selects whether to show 1 out of 100 good frames. | 645 | * group100 parameter selects whether to show 1 out of 100 good data frames. |
662 | * | 646 | * All beacon and probe response frames are printed. |
663 | * TODO: This was originally written for 3945, need to audit for | ||
664 | * proper operation with 4965. | ||
665 | */ | 647 | */ |
666 | static void iwl_dbg_report_frame(struct iwl_priv *priv, | 648 | static void iwl_dbg_report_frame(struct iwl_priv *priv, |
667 | struct iwl_rx_packet *pkt, | 649 | struct iwl_rx_phy_res *phy_res, u16 length, |
668 | struct ieee80211_hdr *header, int group100) | 650 | struct ieee80211_hdr *header, int group100) |
669 | { | 651 | { |
670 | u32 to_us; | 652 | u32 to_us; |
@@ -676,20 +658,9 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv, | |||
676 | u16 seq_ctl; | 658 | u16 seq_ctl; |
677 | u16 channel; | 659 | u16 channel; |
678 | u16 phy_flags; | 660 | u16 phy_flags; |
679 | int rate_sym; | 661 | u32 rate_n_flags; |
680 | u16 length; | ||
681 | u16 status; | ||
682 | u16 bcn_tmr; | ||
683 | u32 tsf_low; | 662 | u32 tsf_low; |
684 | u64 tsf; | 663 | int rssi; |
685 | u8 rssi; | ||
686 | u8 agc; | ||
687 | u16 sig_avg; | ||
688 | u16 noise_diff; | ||
689 | struct iwl4965_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); | ||
690 | struct iwl4965_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); | ||
691 | struct iwl4965_rx_frame_end *rx_end = IWL_RX_END(pkt); | ||
692 | u8 *data = IWL_RX_DATA(pkt); | ||
693 | 664 | ||
694 | if (likely(!(priv->debug_level & IWL_DL_RX))) | 665 | if (likely(!(priv->debug_level & IWL_DL_RX))) |
695 | return; | 666 | return; |
@@ -699,22 +670,13 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv, | |||
699 | seq_ctl = le16_to_cpu(header->seq_ctrl); | 670 | seq_ctl = le16_to_cpu(header->seq_ctrl); |
700 | 671 | ||
701 | /* metadata */ | 672 | /* metadata */ |
702 | channel = le16_to_cpu(rx_hdr->channel); | 673 | channel = le16_to_cpu(phy_res->channel); |
703 | phy_flags = le16_to_cpu(rx_hdr->phy_flags); | 674 | phy_flags = le16_to_cpu(phy_res->phy_flags); |
704 | rate_sym = rx_hdr->rate; | 675 | rate_n_flags = le32_to_cpu(phy_res->rate_n_flags); |
705 | length = le16_to_cpu(rx_hdr->len); | ||
706 | |||
707 | /* end-of-frame status and timestamp */ | ||
708 | status = le32_to_cpu(rx_end->status); | ||
709 | bcn_tmr = le32_to_cpu(rx_end->beacon_timestamp); | ||
710 | tsf_low = le64_to_cpu(rx_end->timestamp) & 0x0ffffffff; | ||
711 | tsf = le64_to_cpu(rx_end->timestamp); | ||
712 | 676 | ||
713 | /* signal statistics */ | 677 | /* signal statistics */ |
714 | rssi = rx_stats->rssi; | 678 | rssi = iwl_calc_rssi(priv, phy_res); |
715 | agc = rx_stats->agc; | 679 | tsf_low = le64_to_cpu(phy_res->timestamp) & 0x0ffffffff; |
716 | sig_avg = le16_to_cpu(rx_stats->sig_avg); | ||
717 | noise_diff = le16_to_cpu(rx_stats->noise_diff); | ||
718 | 680 | ||
719 | to_us = !compare_ether_addr(header->addr1, priv->mac_addr); | 681 | to_us = !compare_ether_addr(header->addr1, priv->mac_addr); |
720 | 682 | ||
@@ -768,11 +730,13 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv, | |||
768 | else | 730 | else |
769 | title = "Frame"; | 731 | title = "Frame"; |
770 | 732 | ||
771 | rate_idx = iwl_hwrate_to_plcp_idx(rate_sym); | 733 | rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags); |
772 | if (unlikely(rate_idx == -1)) | 734 | if (unlikely((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT))) { |
773 | bitrate = 0; | 735 | bitrate = 0; |
774 | else | 736 | WARN_ON_ONCE(1); |
737 | } else { | ||
775 | bitrate = iwl_rates[rate_idx].ieee / 2; | 738 | bitrate = iwl_rates[rate_idx].ieee / 2; |
739 | } | ||
776 | 740 | ||
777 | /* print frame summary. | 741 | /* print frame summary. |
778 | * MAC addresses show just the last byte (for brevity), | 742 | * MAC addresses show just the last byte (for brevity), |
@@ -784,24 +748,17 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv, | |||
784 | length, rssi, channel, bitrate); | 748 | length, rssi, channel, bitrate); |
785 | else { | 749 | else { |
786 | /* src/dst addresses assume managed mode */ | 750 | /* src/dst addresses assume managed mode */ |
787 | IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " | 751 | IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, src=0x%02x, " |
788 | "src=0x%02x, rssi=%u, tim=%lu usec, " | 752 | "len=%u, rssi=%d, tim=%lu usec, " |
789 | "phy=0x%02x, chnl=%d\n", | 753 | "phy=0x%02x, chnl=%d\n", |
790 | title, le16_to_cpu(fc), header->addr1[5], | 754 | title, le16_to_cpu(fc), header->addr1[5], |
791 | header->addr3[5], rssi, | 755 | header->addr3[5], length, rssi, |
792 | tsf_low - priv->scan_start_tsf, | 756 | tsf_low - priv->scan_start_tsf, |
793 | phy_flags, channel); | 757 | phy_flags, channel); |
794 | } | 758 | } |
795 | } | 759 | } |
796 | if (print_dump) | 760 | if (print_dump) |
797 | iwl_print_hex_dump(priv, IWL_DL_RX, data, length); | 761 | iwl_print_hex_dump(priv, IWL_DL_RX, header, length); |
798 | } | ||
799 | #else | ||
800 | static inline void iwl_dbg_report_frame(struct iwl_priv *priv, | ||
801 | struct iwl_rx_packet *pkt, | ||
802 | struct ieee80211_hdr *header, | ||
803 | int group100) | ||
804 | { | ||
805 | } | 762 | } |
806 | #endif | 763 | #endif |
807 | 764 | ||
@@ -995,46 +952,6 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
995 | rxb->skb = NULL; | 952 | rxb->skb = NULL; |
996 | } | 953 | } |
997 | 954 | ||
998 | /* Calc max signal level (dBm) among 3 possible receivers */ | ||
999 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | ||
1000 | struct iwl_rx_phy_res *rx_resp) | ||
1001 | { | ||
1002 | return priv->cfg->ops->utils->calc_rssi(priv, rx_resp); | ||
1003 | } | ||
1004 | |||
1005 | |||
1006 | static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) | ||
1007 | { | ||
1008 | unsigned long flags; | ||
1009 | |||
1010 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1011 | priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; | ||
1012 | priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; | ||
1013 | priv->stations[sta_id].sta.sta.modify_mask = 0; | ||
1014 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
1015 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1016 | |||
1017 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | ||
1018 | } | ||
1019 | |||
1020 | static void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) | ||
1021 | { | ||
1022 | /* FIXME: need locking over ps_status ??? */ | ||
1023 | u8 sta_id = iwl_find_station(priv, addr); | ||
1024 | |||
1025 | if (sta_id != IWL_INVALID_STATION) { | ||
1026 | u8 sta_awake = priv->stations[sta_id]. | ||
1027 | ps_status == STA_PS_STATUS_WAKE; | ||
1028 | |||
1029 | if (sta_awake && ps_bit) | ||
1030 | priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP; | ||
1031 | else if (!sta_awake && !ps_bit) { | ||
1032 | iwl_sta_modify_ps_wake(priv, sta_id); | ||
1033 | priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE; | ||
1034 | } | ||
1035 | } | ||
1036 | } | ||
1037 | |||
1038 | /* This is necessary only for a number of statistics, see the caller. */ | 955 | /* This is necessary only for a number of statistics, see the caller. */ |
1039 | static int iwl_is_network_packet(struct iwl_priv *priv, | 956 | static int iwl_is_network_packet(struct iwl_priv *priv, |
1040 | struct ieee80211_hdr *header) | 957 | struct ieee80211_hdr *header) |
@@ -1157,9 +1074,10 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1157 | priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1074 | priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
1158 | 1075 | ||
1159 | /* Set "1" to report good data frames in groups of 100 */ | 1076 | /* Set "1" to report good data frames in groups of 100 */ |
1160 | /* FIXME: need to optimze the call: */ | 1077 | #ifdef CONFIG_IWLWIFI_DEBUG |
1161 | iwl_dbg_report_frame(priv, pkt, header, 1); | 1078 | if (unlikely(priv->debug_level & IWL_DL_RX)) |
1162 | 1079 | iwl_dbg_report_frame(priv, rx_start, len, header, 1); | |
1080 | #endif | ||
1163 | IWL_DEBUG_STATS_LIMIT("Rssi %d, noise %d, qual %d, TSF %llu\n", | 1081 | IWL_DEBUG_STATS_LIMIT("Rssi %d, noise %d, qual %d, TSF %llu\n", |
1164 | rx_status.signal, rx_status.noise, rx_status.signal, | 1082 | rx_status.signal, rx_status.noise, rx_status.signal, |
1165 | (unsigned long long)rx_status.mactime); | 1083 | (unsigned long long)rx_status.mactime); |
@@ -1168,12 +1086,12 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1168 | * "antenna number" | 1086 | * "antenna number" |
1169 | * | 1087 | * |
1170 | * It seems that the antenna field in the phy flags value | 1088 | * It seems that the antenna field in the phy flags value |
1171 | * is actually a bitfield. This is undefined by radiotap, | 1089 | * is actually a bit field. This is undefined by radiotap, |
1172 | * it wants an actual antenna number but I always get "7" | 1090 | * it wants an actual antenna number but I always get "7" |
1173 | * for most legacy frames I receive indicating that the | 1091 | * for most legacy frames I receive indicating that the |
1174 | * same frame was received on all three RX chains. | 1092 | * same frame was received on all three RX chains. |
1175 | * | 1093 | * |
1176 | * I think this field should be removed in favour of a | 1094 | * I think this field should be removed in favor of a |
1177 | * new 802.11n radiotap field "RX chains" that is defined | 1095 | * new 802.11n radiotap field "RX chains" that is defined |
1178 | * as a bitmask. | 1096 | * as a bitmask. |
1179 | */ | 1097 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index c89365e2ca58..3c803f6922ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -22,11 +22,13 @@ | |||
22 | * in the file called LICENSE.GPL. | 22 | * in the file called LICENSE.GPL. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * Tomas Winkler <tomas.winkler@intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | #include <net/mac80211.h> | 28 | #include <linux/types.h> |
29 | #include <linux/etherdevice.h> | 29 | #include <linux/etherdevice.h> |
30 | #include <net/lib80211.h> | ||
31 | #include <net/mac80211.h> | ||
30 | 32 | ||
31 | #include "iwl-eeprom.h" | 33 | #include "iwl-eeprom.h" |
32 | #include "iwl-dev.h" | 34 | #include "iwl-dev.h" |
@@ -64,54 +66,6 @@ | |||
64 | #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) | 66 | #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) |
65 | 67 | ||
66 | 68 | ||
67 | static int scan_tx_ant[3] = { | ||
68 | RATE_MCS_ANT_A_MSK, RATE_MCS_ANT_B_MSK, RATE_MCS_ANT_C_MSK | ||
69 | }; | ||
70 | |||
71 | |||
72 | |||
73 | static int iwl_is_empty_essid(const char *essid, int essid_len) | ||
74 | { | ||
75 | /* Single white space is for Linksys APs */ | ||
76 | if (essid_len == 1 && essid[0] == ' ') | ||
77 | return 1; | ||
78 | |||
79 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ | ||
80 | while (essid_len) { | ||
81 | essid_len--; | ||
82 | if (essid[essid_len] != '\0') | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | return 1; | ||
87 | } | ||
88 | |||
89 | |||
90 | |||
91 | static const char *iwl_escape_essid(const char *essid, u8 essid_len) | ||
92 | { | ||
93 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
94 | const char *s = essid; | ||
95 | char *d = escaped; | ||
96 | |||
97 | if (iwl_is_empty_essid(essid, essid_len)) { | ||
98 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
99 | return escaped; | ||
100 | } | ||
101 | |||
102 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
103 | while (essid_len--) { | ||
104 | if (*s == '\0') { | ||
105 | *d++ = '\\'; | ||
106 | *d++ = '0'; | ||
107 | s++; | ||
108 | } else | ||
109 | *d++ = *s++; | ||
110 | } | ||
111 | *d = '\0'; | ||
112 | return escaped; | ||
113 | } | ||
114 | |||
115 | /** | 69 | /** |
116 | * iwl_scan_cancel - Cancel any currently executing HW scan | 70 | * iwl_scan_cancel - Cancel any currently executing HW scan |
117 | * | 71 | * |
@@ -455,10 +409,11 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
455 | 409 | ||
456 | void iwl_init_scan_params(struct iwl_priv *priv) | 410 | void iwl_init_scan_params(struct iwl_priv *priv) |
457 | { | 411 | { |
412 | u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; | ||
458 | if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) | 413 | if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) |
459 | priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = RATE_MCS_ANT_INIT_IND; | 414 | priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; |
460 | if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) | 415 | if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) |
461 | priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = RATE_MCS_ANT_INIT_IND; | 416 | priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; |
462 | } | 417 | } |
463 | 418 | ||
464 | int iwl_scan_initiate(struct iwl_priv *priv) | 419 | int iwl_scan_initiate(struct iwl_priv *priv) |
@@ -550,7 +505,7 @@ static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband, | |||
550 | { | 505 | { |
551 | struct ieee80211_ht_cap *ht_cap; | 506 | struct ieee80211_ht_cap *ht_cap; |
552 | 507 | ||
553 | if (!sband || !sband->ht_info.ht_supported) | 508 | if (!sband || !sband->ht_cap.ht_supported) |
554 | return; | 509 | return; |
555 | 510 | ||
556 | if (*left < sizeof(struct ieee80211_ht_cap)) | 511 | if (*left < sizeof(struct ieee80211_ht_cap)) |
@@ -559,12 +514,12 @@ static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband, | |||
559 | *pos++ = sizeof(struct ieee80211_ht_cap); | 514 | *pos++ = sizeof(struct ieee80211_ht_cap); |
560 | ht_cap = (struct ieee80211_ht_cap *) pos; | 515 | ht_cap = (struct ieee80211_ht_cap *) pos; |
561 | 516 | ||
562 | ht_cap->cap_info = cpu_to_le16(sband->ht_info.cap); | 517 | ht_cap->cap_info = cpu_to_le16(sband->ht_cap.cap); |
563 | memcpy(ht_cap->supp_mcs_set, sband->ht_info.supp_mcs_set, 16); | 518 | memcpy(&ht_cap->mcs, &sband->ht_cap.mcs, 16); |
564 | ht_cap->ampdu_params_info = | 519 | ht_cap->ampdu_params_info = |
565 | (sband->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) | | 520 | (sband->ht_cap.ampdu_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) | |
566 | ((sband->ht_info.ampdu_density << 2) & | 521 | ((sband->ht_cap.ampdu_density << 2) & |
567 | IEEE80211_HT_CAP_AMPDU_DENSITY); | 522 | IEEE80211_HT_AMPDU_PARM_DENSITY); |
568 | *left -= sizeof(struct ieee80211_ht_cap); | 523 | *left -= sizeof(struct ieee80211_ht_cap); |
569 | } | 524 | } |
570 | 525 | ||
@@ -670,23 +625,6 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
670 | return (u16)len; | 625 | return (u16)len; |
671 | } | 626 | } |
672 | 627 | ||
673 | static u32 iwl_scan_tx_ant(struct iwl_priv *priv, enum ieee80211_band band) | ||
674 | { | ||
675 | int i, ind; | ||
676 | |||
677 | ind = priv->scan_tx_ant[band]; | ||
678 | for (i = 0; i < priv->hw_params.tx_chains_num; i++) { | ||
679 | ind = (ind+1) >= priv->hw_params.tx_chains_num ? 0 : ind+1; | ||
680 | if (priv->hw_params.valid_tx_ant & (1 << ind)) { | ||
681 | priv->scan_tx_ant[band] = ind; | ||
682 | break; | ||
683 | } | ||
684 | } | ||
685 | IWL_DEBUG_SCAN("select TX ANT = %c\n", 'A' + ind); | ||
686 | return scan_tx_ant[ind]; | ||
687 | } | ||
688 | |||
689 | |||
690 | static void iwl_bg_request_scan(struct work_struct *data) | 628 | static void iwl_bg_request_scan(struct work_struct *data) |
691 | { | 629 | { |
692 | struct iwl_priv *priv = | 630 | struct iwl_priv *priv = |
@@ -699,11 +637,13 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
699 | struct iwl_scan_cmd *scan; | 637 | struct iwl_scan_cmd *scan; |
700 | struct ieee80211_conf *conf = NULL; | 638 | struct ieee80211_conf *conf = NULL; |
701 | int ret = 0; | 639 | int ret = 0; |
702 | u32 tx_ant; | 640 | u32 rate_flags = 0; |
703 | u16 cmd_len; | 641 | u16 cmd_len; |
704 | enum ieee80211_band band; | 642 | enum ieee80211_band band; |
705 | u8 n_probes = 2; | 643 | u8 n_probes = 2; |
706 | u8 rx_chain = priv->hw_params.valid_rx_ant; | 644 | u8 rx_chain = priv->hw_params.valid_rx_ant; |
645 | u8 rate; | ||
646 | DECLARE_SSID_BUF(ssid); | ||
707 | 647 | ||
708 | conf = ieee80211_get_hw_conf(priv->hw); | 648 | conf = ieee80211_get_hw_conf(priv->hw); |
709 | 649 | ||
@@ -714,7 +654,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
714 | goto done; | 654 | goto done; |
715 | } | 655 | } |
716 | 656 | ||
717 | /* Make sure the scan wasn't cancelled before this queued work | 657 | /* Make sure the scan wasn't canceled before this queued work |
718 | * was given the chance to run... */ | 658 | * was given the chance to run... */ |
719 | if (!test_bit(STATUS_SCANNING, &priv->status)) | 659 | if (!test_bit(STATUS_SCANNING, &priv->status)) |
720 | goto done; | 660 | goto done; |
@@ -796,20 +736,13 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
796 | /* We should add the ability for user to lock to PASSIVE ONLY */ | 736 | /* We should add the ability for user to lock to PASSIVE ONLY */ |
797 | if (priv->one_direct_scan) { | 737 | if (priv->one_direct_scan) { |
798 | IWL_DEBUG_SCAN("Start direct scan for '%s'\n", | 738 | IWL_DEBUG_SCAN("Start direct scan for '%s'\n", |
799 | iwl_escape_essid(priv->direct_ssid, | 739 | print_ssid(ssid, priv->direct_ssid, |
800 | priv->direct_ssid_len)); | 740 | priv->direct_ssid_len)); |
801 | scan->direct_scan[0].id = WLAN_EID_SSID; | 741 | scan->direct_scan[0].id = WLAN_EID_SSID; |
802 | scan->direct_scan[0].len = priv->direct_ssid_len; | 742 | scan->direct_scan[0].len = priv->direct_ssid_len; |
803 | memcpy(scan->direct_scan[0].ssid, | 743 | memcpy(scan->direct_scan[0].ssid, |
804 | priv->direct_ssid, priv->direct_ssid_len); | 744 | priv->direct_ssid, priv->direct_ssid_len); |
805 | n_probes++; | 745 | n_probes++; |
806 | } else if (!iwl_is_associated(priv) && priv->essid_len) { | ||
807 | IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n", | ||
808 | iwl_escape_essid(priv->essid, priv->essid_len)); | ||
809 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
810 | scan->direct_scan[0].len = priv->essid_len; | ||
811 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | ||
812 | n_probes++; | ||
813 | } else { | 746 | } else { |
814 | IWL_DEBUG_SCAN("Start indirect scan.\n"); | 747 | IWL_DEBUG_SCAN("Start indirect scan.\n"); |
815 | } | 748 | } |
@@ -822,23 +755,16 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
822 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { | 755 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { |
823 | band = IEEE80211_BAND_2GHZ; | 756 | band = IEEE80211_BAND_2GHZ; |
824 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 757 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
825 | tx_ant = iwl_scan_tx_ant(priv, band); | 758 | if (priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) { |
826 | if (priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) | 759 | rate = IWL_RATE_6M_PLCP; |
827 | scan->tx_cmd.rate_n_flags = | 760 | } else { |
828 | iwl_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | 761 | rate = IWL_RATE_1M_PLCP; |
829 | tx_ant); | 762 | rate_flags = RATE_MCS_CCK_MSK; |
830 | else | 763 | } |
831 | scan->tx_cmd.rate_n_flags = | ||
832 | iwl_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, | ||
833 | tx_ant | | ||
834 | RATE_MCS_CCK_MSK); | ||
835 | scan->good_CRC_th = 0; | 764 | scan->good_CRC_th = 0; |
836 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { | 765 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { |
837 | band = IEEE80211_BAND_5GHZ; | 766 | band = IEEE80211_BAND_5GHZ; |
838 | tx_ant = iwl_scan_tx_ant(priv, band); | 767 | rate = IWL_RATE_6M_PLCP; |
839 | scan->tx_cmd.rate_n_flags = | ||
840 | iwl_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | ||
841 | tx_ant); | ||
842 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 768 | scan->good_CRC_th = IWL_GOOD_CRC_TH; |
843 | 769 | ||
844 | /* Force use of chains B and C (0x6) for scan Rx for 4965 | 770 | /* Force use of chains B and C (0x6) for scan Rx for 4965 |
@@ -851,6 +777,11 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
851 | goto done; | 777 | goto done; |
852 | } | 778 | } |
853 | 779 | ||
780 | priv->scan_tx_ant[band] = | ||
781 | iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]); | ||
782 | rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); | ||
783 | scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags); | ||
784 | |||
854 | /* MIMO is not used here, but value is required */ | 785 | /* MIMO is not used here, but value is required */ |
855 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | | 786 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | |
856 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | | 787 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-spectrum.c b/drivers/net/wireless/iwlwifi/iwl-spectrum.c new file mode 100644 index 000000000000..836c3c80b69e --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-spectrum.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * Portions of this file are derived from the ipw3945 project, as well | ||
6 | * as portions of the ieee80211 subsystem header files. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of version 2 of the GNU General Public License as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along with | ||
18 | * this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution in the | ||
22 | * file called LICENSE. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | * | ||
28 | *****************************************************************************/ | ||
29 | |||
30 | #include <linux/kernel.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/pci.h> | ||
34 | #include <linux/delay.h> | ||
35 | #include <linux/skbuff.h> | ||
36 | #include <linux/netdevice.h> | ||
37 | #include <linux/wireless.h> | ||
38 | |||
39 | #include <net/mac80211.h> | ||
40 | |||
41 | #include "iwl-eeprom.h" | ||
42 | #include "iwl-dev.h" | ||
43 | #include "iwl-core.h" | ||
44 | #include "iwl-io.h" | ||
45 | #include "iwl-spectrum.h" | ||
46 | |||
47 | #define BEACON_TIME_MASK_LOW 0x00FFFFFF | ||
48 | #define BEACON_TIME_MASK_HIGH 0xFF000000 | ||
49 | #define TIME_UNIT 1024 | ||
50 | |||
51 | /* | ||
52 | * extended beacon time format | ||
53 | * time in usec will be changed into a 32-bit value in 8:24 format | ||
54 | * the high 1 byte is the beacon counts | ||
55 | * the lower 3 bytes is the time in usec within one beacon interval | ||
56 | */ | ||
57 | |||
58 | /* TOOD: was used in sysfs debug interface need to add to mac */ | ||
59 | #if 0 | ||
60 | static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) | ||
61 | { | ||
62 | u32 quot; | ||
63 | u32 rem; | ||
64 | u32 interval = beacon_interval * 1024; | ||
65 | |||
66 | if (!interval || !usec) | ||
67 | return 0; | ||
68 | |||
69 | quot = (usec / interval) & (BEACON_TIME_MASK_HIGH >> 24); | ||
70 | rem = (usec % interval) & BEACON_TIME_MASK_LOW; | ||
71 | |||
72 | return (quot << 24) + rem; | ||
73 | } | ||
74 | |||
75 | /* base is usually what we get from ucode with each received frame, | ||
76 | * the same as HW timer counter counting down | ||
77 | */ | ||
78 | |||
79 | static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) | ||
80 | { | ||
81 | u32 base_low = base & BEACON_TIME_MASK_LOW; | ||
82 | u32 addon_low = addon & BEACON_TIME_MASK_LOW; | ||
83 | u32 interval = beacon_interval * TIME_UNIT; | ||
84 | u32 res = (base & BEACON_TIME_MASK_HIGH) + | ||
85 | (addon & BEACON_TIME_MASK_HIGH); | ||
86 | |||
87 | if (base_low > addon_low) | ||
88 | res += base_low - addon_low; | ||
89 | else if (base_low < addon_low) { | ||
90 | res += interval + base_low - addon_low; | ||
91 | res += (1 << 24); | ||
92 | } else | ||
93 | res += (1 << 24); | ||
94 | |||
95 | return cpu_to_le32(res); | ||
96 | } | ||
97 | static int iwl_get_measurement(struct iwl_priv *priv, | ||
98 | struct ieee80211_measurement_params *params, | ||
99 | u8 type) | ||
100 | { | ||
101 | struct iwl4965_spectrum_cmd spectrum; | ||
102 | struct iwl_rx_packet *res; | ||
103 | struct iwl_host_cmd cmd = { | ||
104 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, | ||
105 | .data = (void *)&spectrum, | ||
106 | .meta.flags = CMD_WANT_SKB, | ||
107 | }; | ||
108 | u32 add_time = le64_to_cpu(params->start_time); | ||
109 | int rc; | ||
110 | int spectrum_resp_status; | ||
111 | int duration = le16_to_cpu(params->duration); | ||
112 | |||
113 | if (iwl_is_associated(priv)) | ||
114 | add_time = | ||
115 | iwl_usecs_to_beacons( | ||
116 | le64_to_cpu(params->start_time) - priv->last_tsf, | ||
117 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
118 | |||
119 | memset(&spectrum, 0, sizeof(spectrum)); | ||
120 | |||
121 | spectrum.channel_count = cpu_to_le16(1); | ||
122 | spectrum.flags = | ||
123 | RXON_FLG_TSF2HOST_MSK | RXON_FLG_ANT_A_MSK | RXON_FLG_DIS_DIV_MSK; | ||
124 | spectrum.filter_flags = MEASUREMENT_FILTER_FLAG; | ||
125 | cmd.len = sizeof(spectrum); | ||
126 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); | ||
127 | |||
128 | if (iwl_is_associated(priv)) | ||
129 | spectrum.start_time = | ||
130 | iwl_add_beacon_time(priv->last_beacon_time, | ||
131 | add_time, | ||
132 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
133 | else | ||
134 | spectrum.start_time = 0; | ||
135 | |||
136 | spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); | ||
137 | spectrum.channels[0].channel = params->channel; | ||
138 | spectrum.channels[0].type = type; | ||
139 | if (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK) | ||
140 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | ||
141 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | ||
142 | |||
143 | rc = iwl_send_cmd_sync(priv, &cmd); | ||
144 | if (rc) | ||
145 | return rc; | ||
146 | |||
147 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
148 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { | ||
149 | IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); | ||
150 | rc = -EIO; | ||
151 | } | ||
152 | |||
153 | spectrum_resp_status = le16_to_cpu(res->u.spectrum.status); | ||
154 | switch (spectrum_resp_status) { | ||
155 | case 0: /* Command will be handled */ | ||
156 | if (res->u.spectrum.id != 0xff) { | ||
157 | IWL_DEBUG_INFO | ||
158 | ("Replaced existing measurement: %d\n", | ||
159 | res->u.spectrum.id); | ||
160 | priv->measurement_status &= ~MEASUREMENT_READY; | ||
161 | } | ||
162 | priv->measurement_status |= MEASUREMENT_ACTIVE; | ||
163 | rc = 0; | ||
164 | break; | ||
165 | |||
166 | case 1: /* Command will not be handled */ | ||
167 | rc = -EAGAIN; | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
172 | |||
173 | return rc; | ||
174 | } | ||
175 | #endif | ||
176 | |||
177 | static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, | ||
178 | struct iwl_rx_mem_buffer *rxb) | ||
179 | { | ||
180 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
181 | struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); | ||
182 | |||
183 | if (!report->state) { | ||
184 | IWL_DEBUG(IWL_DL_11H, | ||
185 | "Spectrum Measure Notification: Start\n"); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | memcpy(&priv->measure_report, report, sizeof(*report)); | ||
190 | priv->measurement_status |= MEASUREMENT_READY; | ||
191 | } | ||
192 | |||
193 | void iwl_setup_spectrum_handlers(struct iwl_priv *priv) | ||
194 | { | ||
195 | priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = | ||
196 | iwl_rx_spectrum_measure_notif; | ||
197 | } | ||
198 | EXPORT_SYMBOL(iwl_setup_spectrum_handlers); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-spectrum.h b/drivers/net/wireless/iwlwifi/iwl-spectrum.h index a40a2174df98..b7d7943e476b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-spectrum.h +++ b/drivers/net/wireless/iwlwifi/iwl-spectrum.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * file called LICENSE. | 21 | * file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 24 | * Intel Linux Wireless <ilw@linux.intel.com> |
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
@@ -88,4 +88,5 @@ struct ieee80211_measurement_report { | |||
88 | struct ieee80211_basic_report basic[0]; | 88 | struct ieee80211_basic_report basic[0]; |
89 | } u; | 89 | } u; |
90 | } __attribute__ ((packed)); | 90 | } __attribute__ ((packed)); |
91 | |||
91 | #endif | 92 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 26f7084d3011..412f66bac1af 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -33,8 +33,6 @@ | |||
33 | #include "iwl-dev.h" | 33 | #include "iwl-dev.h" |
34 | #include "iwl-core.h" | 34 | #include "iwl-core.h" |
35 | #include "iwl-sta.h" | 35 | #include "iwl-sta.h" |
36 | #include "iwl-helpers.h" | ||
37 | |||
38 | 36 | ||
39 | #define IWL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ | 37 | #define IWL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ |
40 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ | 38 | #define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ |
@@ -45,7 +43,6 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
45 | int start = 0; | 43 | int start = 0; |
46 | int ret = IWL_INVALID_STATION; | 44 | int ret = IWL_INVALID_STATION; |
47 | unsigned long flags; | 45 | unsigned long flags; |
48 | DECLARE_MAC_BUF(mac); | ||
49 | 46 | ||
50 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | 47 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || |
51 | (priv->iw_mode == NL80211_IFTYPE_AP)) | 48 | (priv->iw_mode == NL80211_IFTYPE_AP)) |
@@ -63,8 +60,8 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
63 | goto out; | 60 | goto out; |
64 | } | 61 | } |
65 | 62 | ||
66 | IWL_DEBUG_ASSOC_LIMIT("can not find STA %s total %d\n", | 63 | IWL_DEBUG_ASSOC_LIMIT("can not find STA %pM total %d\n", |
67 | print_mac(mac, addr), priv->num_stations); | 64 | addr, priv->num_stations); |
68 | 65 | ||
69 | out: | 66 | out: |
70 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 67 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
@@ -86,7 +83,6 @@ EXPORT_SYMBOL(iwl_get_ra_sta_id); | |||
86 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) | 83 | static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) |
87 | { | 84 | { |
88 | unsigned long flags; | 85 | unsigned long flags; |
89 | DECLARE_MAC_BUF(mac); | ||
90 | 86 | ||
91 | spin_lock_irqsave(&priv->sta_lock, flags); | 87 | spin_lock_irqsave(&priv->sta_lock, flags); |
92 | 88 | ||
@@ -94,8 +90,8 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) | |||
94 | IWL_ERROR("ACTIVATE a non DRIVER active station %d\n", sta_id); | 90 | IWL_ERROR("ACTIVATE a non DRIVER active station %d\n", sta_id); |
95 | 91 | ||
96 | priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; | 92 | priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; |
97 | IWL_DEBUG_ASSOC("Added STA to Ucode: %s\n", | 93 | IWL_DEBUG_ASSOC("Added STA to Ucode: %pM\n", |
98 | print_mac(mac, priv->stations[sta_id].sta.sta.addr)); | 94 | priv->stations[sta_id].sta.sta.addr); |
99 | 95 | ||
100 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 96 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
101 | } | 97 | } |
@@ -104,7 +100,9 @@ static int iwl_add_sta_callback(struct iwl_priv *priv, | |||
104 | struct iwl_cmd *cmd, struct sk_buff *skb) | 100 | struct iwl_cmd *cmd, struct sk_buff *skb) |
105 | { | 101 | { |
106 | struct iwl_rx_packet *res = NULL; | 102 | struct iwl_rx_packet *res = NULL; |
107 | u8 sta_id = cmd->cmd.addsta.sta.sta_id; | 103 | struct iwl_addsta_cmd *addsta = |
104 | (struct iwl_addsta_cmd *)cmd->cmd.payload; | ||
105 | u8 sta_id = addsta->sta.sta_id; | ||
108 | 106 | ||
109 | if (!skb) { | 107 | if (!skb) { |
110 | IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); | 108 | IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); |
@@ -132,7 +130,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv, | |||
132 | return 1; | 130 | return 1; |
133 | } | 131 | } |
134 | 132 | ||
135 | int iwl_send_add_sta(struct iwl_priv *priv, | 133 | static int iwl_send_add_sta(struct iwl_priv *priv, |
136 | struct iwl_addsta_cmd *sta, u8 flags) | 134 | struct iwl_addsta_cmd *sta, u8 flags) |
137 | { | 135 | { |
138 | struct iwl_rx_packet *res = NULL; | 136 | struct iwl_rx_packet *res = NULL; |
@@ -180,10 +178,9 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
180 | 178 | ||
181 | return ret; | 179 | return ret; |
182 | } | 180 | } |
183 | EXPORT_SYMBOL(iwl_send_add_sta); | ||
184 | 181 | ||
185 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | 182 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, |
186 | struct ieee80211_ht_info *sta_ht_inf) | 183 | struct ieee80211_sta_ht_cap *sta_ht_inf) |
187 | { | 184 | { |
188 | __le32 sta_flags; | 185 | __le32 sta_flags; |
189 | u8 mimo_ps_mode; | 186 | u8 mimo_ps_mode; |
@@ -231,13 +228,12 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
231 | * iwl_add_station_flags - Add station to tables in driver and device | 228 | * iwl_add_station_flags - Add station to tables in driver and device |
232 | */ | 229 | */ |
233 | u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | 230 | u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, |
234 | u8 flags, struct ieee80211_ht_info *ht_info) | 231 | u8 flags, struct ieee80211_sta_ht_cap *ht_info) |
235 | { | 232 | { |
236 | int i; | 233 | int i; |
237 | int sta_id = IWL_INVALID_STATION; | 234 | int sta_id = IWL_INVALID_STATION; |
238 | struct iwl_station_entry *station; | 235 | struct iwl_station_entry *station; |
239 | unsigned long flags_spin; | 236 | unsigned long flags_spin; |
240 | DECLARE_MAC_BUF(mac); | ||
241 | 237 | ||
242 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 238 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
243 | if (is_ap) | 239 | if (is_ap) |
@@ -273,8 +269,8 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | |||
273 | 269 | ||
274 | station = &priv->stations[sta_id]; | 270 | station = &priv->stations[sta_id]; |
275 | station->used = IWL_STA_DRIVER_ACTIVE; | 271 | station->used = IWL_STA_DRIVER_ACTIVE; |
276 | IWL_DEBUG_ASSOC("Add STA to driver ID %d: %s\n", | 272 | IWL_DEBUG_ASSOC("Add STA to driver ID %d: %pM\n", |
277 | sta_id, print_mac(mac, addr)); | 273 | sta_id, addr); |
278 | priv->num_stations++; | 274 | priv->num_stations++; |
279 | 275 | ||
280 | /* Set up the REPLY_ADD_STA command to send to device */ | 276 | /* Set up the REPLY_ADD_STA command to send to device */ |
@@ -301,14 +297,11 @@ EXPORT_SYMBOL(iwl_add_station_flags); | |||
301 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) | 297 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) |
302 | { | 298 | { |
303 | unsigned long flags; | 299 | unsigned long flags; |
304 | DECLARE_MAC_BUF(mac); | ||
305 | |||
306 | u8 sta_id = iwl_find_station(priv, addr); | 300 | u8 sta_id = iwl_find_station(priv, addr); |
307 | 301 | ||
308 | BUG_ON(sta_id == IWL_INVALID_STATION); | 302 | BUG_ON(sta_id == IWL_INVALID_STATION); |
309 | 303 | ||
310 | IWL_DEBUG_ASSOC("Removed STA from Ucode: %s\n", | 304 | IWL_DEBUG_ASSOC("Removed STA from Ucode: %pM\n", addr); |
311 | print_mac(mac, addr)); | ||
312 | 305 | ||
313 | spin_lock_irqsave(&priv->sta_lock, flags); | 306 | spin_lock_irqsave(&priv->sta_lock, flags); |
314 | 307 | ||
@@ -326,7 +319,9 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv, | |||
326 | struct iwl_cmd *cmd, struct sk_buff *skb) | 319 | struct iwl_cmd *cmd, struct sk_buff *skb) |
327 | { | 320 | { |
328 | struct iwl_rx_packet *res = NULL; | 321 | struct iwl_rx_packet *res = NULL; |
329 | const char *addr = cmd->cmd.rm_sta.addr; | 322 | struct iwl_rem_sta_cmd *rm_sta = |
323 | (struct iwl_rem_sta_cmd *)cmd->cmd.payload; | ||
324 | const char *addr = rm_sta->addr; | ||
330 | 325 | ||
331 | if (!skb) { | 326 | if (!skb) { |
332 | IWL_ERROR("Error: Response NULL in REPLY_REMOVE_STA.\n"); | 327 | IWL_ERROR("Error: Response NULL in REPLY_REMOVE_STA.\n"); |
@@ -415,7 +410,6 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
415 | int sta_id = IWL_INVALID_STATION; | 410 | int sta_id = IWL_INVALID_STATION; |
416 | int i, ret = -EINVAL; | 411 | int i, ret = -EINVAL; |
417 | unsigned long flags; | 412 | unsigned long flags; |
418 | DECLARE_MAC_BUF(mac); | ||
419 | 413 | ||
420 | spin_lock_irqsave(&priv->sta_lock, flags); | 414 | spin_lock_irqsave(&priv->sta_lock, flags); |
421 | 415 | ||
@@ -435,18 +429,18 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
435 | if (unlikely(sta_id == IWL_INVALID_STATION)) | 429 | if (unlikely(sta_id == IWL_INVALID_STATION)) |
436 | goto out; | 430 | goto out; |
437 | 431 | ||
438 | IWL_DEBUG_ASSOC("Removing STA from driver:%d %s\n", | 432 | IWL_DEBUG_ASSOC("Removing STA from driver:%d %pM\n", |
439 | sta_id, print_mac(mac, addr)); | 433 | sta_id, addr); |
440 | 434 | ||
441 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { | 435 | if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { |
442 | IWL_ERROR("Removing %s but non DRIVER active\n", | 436 | IWL_ERROR("Removing %pM but non DRIVER active\n", |
443 | print_mac(mac, addr)); | 437 | addr); |
444 | goto out; | 438 | goto out; |
445 | } | 439 | } |
446 | 440 | ||
447 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { | 441 | if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { |
448 | IWL_ERROR("Removing %s but non UCODE active\n", | 442 | IWL_ERROR("Removing %pM but non UCODE active\n", |
449 | print_mac(mac, addr)); | 443 | addr); |
450 | goto out; | 444 | goto out; |
451 | } | 445 | } |
452 | 446 | ||
@@ -467,6 +461,29 @@ out: | |||
467 | } | 461 | } |
468 | EXPORT_SYMBOL(iwl_remove_station); | 462 | EXPORT_SYMBOL(iwl_remove_station); |
469 | 463 | ||
464 | /** | ||
465 | * iwl_clear_stations_table - Clear the driver's station table | ||
466 | * | ||
467 | * NOTE: This does not clear or otherwise alter the device's station table. | ||
468 | */ | ||
469 | void iwl_clear_stations_table(struct iwl_priv *priv) | ||
470 | { | ||
471 | unsigned long flags; | ||
472 | |||
473 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
474 | |||
475 | if (iwl_is_alive(priv) && | ||
476 | !test_bit(STATUS_EXIT_PENDING, &priv->status) && | ||
477 | iwl_send_cmd_pdu_async(priv, REPLY_REMOVE_ALL_STA, 0, NULL, NULL)) | ||
478 | IWL_ERROR("Couldn't clear the station table\n"); | ||
479 | |||
480 | priv->num_stations = 0; | ||
481 | memset(priv->stations, 0, sizeof(priv->stations)); | ||
482 | |||
483 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
484 | } | ||
485 | EXPORT_SYMBOL(iwl_clear_stations_table); | ||
486 | |||
470 | static int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | 487 | static int iwl_get_free_ucode_key_index(struct iwl_priv *priv) |
471 | { | 488 | { |
472 | int i; | 489 | int i; |
@@ -717,6 +734,55 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | |||
717 | return ret; | 734 | return ret; |
718 | } | 735 | } |
719 | 736 | ||
737 | void iwl_update_tkip_key(struct iwl_priv *priv, | ||
738 | struct ieee80211_key_conf *keyconf, | ||
739 | const u8 *addr, u32 iv32, u16 *phase1key) | ||
740 | { | ||
741 | u8 sta_id = IWL_INVALID_STATION; | ||
742 | unsigned long flags; | ||
743 | __le16 key_flags = 0; | ||
744 | int i; | ||
745 | DECLARE_MAC_BUF(mac); | ||
746 | |||
747 | sta_id = iwl_find_station(priv, addr); | ||
748 | if (sta_id == IWL_INVALID_STATION) { | ||
749 | IWL_DEBUG_MAC80211("leave - %pM not in station map.\n", | ||
750 | addr); | ||
751 | return; | ||
752 | } | ||
753 | |||
754 | if (iwl_scan_cancel(priv)) { | ||
755 | /* cancel scan failed, just live w/ bad key and rely | ||
756 | briefly on SW decryption */ | ||
757 | return; | ||
758 | } | ||
759 | |||
760 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | ||
761 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | ||
762 | key_flags &= ~STA_KEY_FLG_INVALID; | ||
763 | |||
764 | if (sta_id == priv->hw_params.bcast_sta_id) | ||
765 | key_flags |= STA_KEY_MULTICAST_MSK; | ||
766 | |||
767 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
768 | |||
769 | priv->stations[sta_id].sta.key.key_flags = key_flags; | ||
770 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | ||
771 | |||
772 | for (i = 0; i < 5; i++) | ||
773 | priv->stations[sta_id].sta.key.tkip_rx_ttak[i] = | ||
774 | cpu_to_le16(phase1key[i]); | ||
775 | |||
776 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | ||
777 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
778 | |||
779 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | ||
780 | |||
781 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
782 | |||
783 | } | ||
784 | EXPORT_SYMBOL(iwl_update_tkip_key); | ||
785 | |||
720 | int iwl_remove_dynamic_key(struct iwl_priv *priv, | 786 | int iwl_remove_dynamic_key(struct iwl_priv *priv, |
721 | struct ieee80211_key_conf *keyconf, | 787 | struct ieee80211_key_conf *keyconf, |
722 | u8 sta_id) | 788 | u8 sta_id) |
@@ -809,7 +875,7 @@ static void iwl_dump_lq_cmd(struct iwl_priv *priv, | |||
809 | { | 875 | { |
810 | int i; | 876 | int i; |
811 | IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id); | 877 | IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id); |
812 | IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n", | 878 | IWL_DEBUG_RATE("lq ant 0x%X 0x%X\n", |
813 | lq->general_params.single_stream_ant_msk, | 879 | lq->general_params.single_stream_ant_msk, |
814 | lq->general_params.dual_stream_ant_msk); | 880 | lq->general_params.dual_stream_ant_msk); |
815 | 881 | ||
@@ -870,7 +936,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
870 | struct iwl_link_quality_cmd link_cmd = { | 936 | struct iwl_link_quality_cmd link_cmd = { |
871 | .reserved1 = 0, | 937 | .reserved1 = 0, |
872 | }; | 938 | }; |
873 | u16 rate_flags; | 939 | u32 rate_flags; |
874 | 940 | ||
875 | /* Set up the rate scaling to start at selected rate, fall back | 941 | /* Set up the rate scaling to start at selected rate, fall back |
876 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 942 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
@@ -886,15 +952,16 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
886 | if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) | 952 | if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) |
887 | rate_flags |= RATE_MCS_CCK_MSK; | 953 | rate_flags |= RATE_MCS_CCK_MSK; |
888 | 954 | ||
889 | /* Use Tx antenna B only */ | 955 | rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << |
890 | rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/ | 956 | RATE_MCS_ANT_POS; |
891 | 957 | ||
892 | link_cmd.rs_table[i].rate_n_flags = | 958 | link_cmd.rs_table[i].rate_n_flags = |
893 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); | 959 | iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); |
894 | r = iwl4965_get_prev_ieee_rate(r); | 960 | r = iwl_get_prev_ieee_rate(r); |
895 | } | 961 | } |
896 | 962 | ||
897 | link_cmd.general_params.single_stream_ant_msk = 2; | 963 | link_cmd.general_params.single_stream_ant_msk = |
964 | first_antenna(priv->hw_params.valid_tx_ant); | ||
898 | link_cmd.general_params.dual_stream_ant_msk = 3; | 965 | link_cmd.general_params.dual_stream_ant_msk = 3; |
899 | link_cmd.agg_params.agg_dis_start_th = 3; | 966 | link_cmd.agg_params.agg_dis_start_th = 3; |
900 | link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000); | 967 | link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000); |
@@ -910,24 +977,35 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
910 | * iwl_rxon_add_station - add station into station table. | 977 | * iwl_rxon_add_station - add station into station table. |
911 | * | 978 | * |
912 | * there is only one AP station with id= IWL_AP_ID | 979 | * there is only one AP station with id= IWL_AP_ID |
913 | * NOTE: mutex must be held before calling this fnction | 980 | * NOTE: mutex must be held before calling this function |
914 | */ | 981 | */ |
915 | int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | 982 | int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) |
916 | { | 983 | { |
984 | struct ieee80211_sta *sta; | ||
985 | struct ieee80211_sta_ht_cap ht_config; | ||
986 | struct ieee80211_sta_ht_cap *cur_ht_config = NULL; | ||
917 | u8 sta_id; | 987 | u8 sta_id; |
918 | 988 | ||
919 | /* Add station to device's station table */ | 989 | /* Add station to device's station table */ |
920 | struct ieee80211_conf *conf = &priv->hw->conf; | 990 | |
921 | struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf; | 991 | /* |
922 | 992 | * XXX: This check is definitely not correct, if we're an AP | |
923 | if ((is_ap) && | 993 | * it'll always be false which is not what we want, but |
924 | (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && | 994 | * it doesn't look like iwlagn is prepared to be an HT |
925 | (priv->iw_mode == NL80211_IFTYPE_STATION)) | 995 | * AP anyway. |
926 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | 996 | */ |
927 | 0, cur_ht_config); | 997 | if (priv->current_ht_config.is_ht) { |
928 | else | 998 | rcu_read_lock(); |
929 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | 999 | sta = ieee80211_find_sta(priv->hw, addr); |
930 | 0, NULL); | 1000 | if (sta) { |
1001 | memcpy(&ht_config, &sta->ht_cap, sizeof(ht_config)); | ||
1002 | cur_ht_config = &ht_config; | ||
1003 | } | ||
1004 | rcu_read_unlock(); | ||
1005 | } | ||
1006 | |||
1007 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | ||
1008 | 0, cur_ht_config); | ||
931 | 1009 | ||
932 | /* Set up default rate scaling table in device's station table */ | 1010 | /* Set up default rate scaling table in device's station table */ |
933 | iwl_sta_init_lq(priv, addr, is_ap); | 1011 | iwl_sta_init_lq(priv, addr, is_ap); |
@@ -945,7 +1023,6 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
945 | { | 1023 | { |
946 | int sta_id; | 1024 | int sta_id; |
947 | u16 fc = le16_to_cpu(hdr->frame_control); | 1025 | u16 fc = le16_to_cpu(hdr->frame_control); |
948 | DECLARE_MAC_BUF(mac); | ||
949 | 1026 | ||
950 | /* If this frame is broadcast or management, use broadcast station id */ | 1027 | /* If this frame is broadcast or management, use broadcast station id */ |
951 | if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || | 1028 | if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || |
@@ -980,9 +1057,9 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
980 | if (sta_id != IWL_INVALID_STATION) | 1057 | if (sta_id != IWL_INVALID_STATION) |
981 | return sta_id; | 1058 | return sta_id; |
982 | 1059 | ||
983 | IWL_DEBUG_DROP("Station %s not in station map. " | 1060 | IWL_DEBUG_DROP("Station %pM not in station map. " |
984 | "Defaulting to broadcast...\n", | 1061 | "Defaulting to broadcast...\n", |
985 | print_mac(mac, hdr->addr1)); | 1062 | hdr->addr1); |
986 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 1063 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
987 | return priv->hw_params.bcast_sta_id; | 1064 | return priv->hw_params.bcast_sta_id; |
988 | 1065 | ||
@@ -999,9 +1076,9 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
999 | EXPORT_SYMBOL(iwl_get_sta_id); | 1076 | EXPORT_SYMBOL(iwl_get_sta_id); |
1000 | 1077 | ||
1001 | /** | 1078 | /** |
1002 | * iwl_sta_modify_enable_tid_tx - Enable Tx for this TID in station table | 1079 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table |
1003 | */ | 1080 | */ |
1004 | void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid) | 1081 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) |
1005 | { | 1082 | { |
1006 | unsigned long flags; | 1083 | unsigned long flags; |
1007 | 1084 | ||
@@ -1014,5 +1091,81 @@ void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid) | |||
1014 | 1091 | ||
1015 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | 1092 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); |
1016 | } | 1093 | } |
1017 | EXPORT_SYMBOL(iwl_sta_modify_enable_tid_tx); | 1094 | EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid); |
1095 | |||
1096 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | ||
1097 | const u8 *addr, int tid, u16 ssn) | ||
1098 | { | ||
1099 | unsigned long flags; | ||
1100 | int sta_id; | ||
1101 | |||
1102 | sta_id = iwl_find_station(priv, addr); | ||
1103 | if (sta_id == IWL_INVALID_STATION) | ||
1104 | return -ENXIO; | ||
1105 | |||
1106 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1107 | priv->stations[sta_id].sta.station_flags_msk = 0; | ||
1108 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; | ||
1109 | priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; | ||
1110 | priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); | ||
1111 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
1112 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1113 | |||
1114 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | ||
1115 | CMD_ASYNC); | ||
1116 | } | ||
1117 | EXPORT_SYMBOL(iwl_sta_rx_agg_start); | ||
1118 | |||
1119 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid) | ||
1120 | { | ||
1121 | unsigned long flags; | ||
1122 | int sta_id; | ||
1123 | |||
1124 | sta_id = iwl_find_station(priv, addr); | ||
1125 | if (sta_id == IWL_INVALID_STATION) | ||
1126 | return -ENXIO; | ||
1127 | |||
1128 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1129 | priv->stations[sta_id].sta.station_flags_msk = 0; | ||
1130 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; | ||
1131 | priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; | ||
1132 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
1133 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1134 | |||
1135 | return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, | ||
1136 | CMD_ASYNC); | ||
1137 | } | ||
1138 | EXPORT_SYMBOL(iwl_sta_rx_agg_stop); | ||
1139 | |||
1140 | static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) | ||
1141 | { | ||
1142 | unsigned long flags; | ||
1143 | |||
1144 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1145 | priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; | ||
1146 | priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; | ||
1147 | priv->stations[sta_id].sta.sta.modify_mask = 0; | ||
1148 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
1149 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1150 | |||
1151 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | ||
1152 | } | ||
1153 | |||
1154 | void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) | ||
1155 | { | ||
1156 | /* FIXME: need locking over ps_status ??? */ | ||
1157 | u8 sta_id = iwl_find_station(priv, addr); | ||
1158 | |||
1159 | if (sta_id != IWL_INVALID_STATION) { | ||
1160 | u8 sta_awake = priv->stations[sta_id]. | ||
1161 | ps_status == STA_PS_STATUS_WAKE; | ||
1162 | |||
1163 | if (sta_awake && ps_bit) | ||
1164 | priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP; | ||
1165 | else if (!sta_awake && !ps_bit) { | ||
1166 | iwl_sta_modify_ps_wake(priv, sta_id); | ||
1167 | priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE; | ||
1168 | } | ||
1169 | } | ||
1170 | } | ||
1018 | 1171 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index 221b93e670a6..9bb7cefc1f3c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -47,9 +47,21 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
47 | struct ieee80211_key_conf *key, u8 sta_id); | 47 | struct ieee80211_key_conf *key, u8 sta_id); |
48 | int iwl_remove_dynamic_key(struct iwl_priv *priv, | 48 | int iwl_remove_dynamic_key(struct iwl_priv *priv, |
49 | struct ieee80211_key_conf *key, u8 sta_id); | 49 | struct ieee80211_key_conf *key, u8 sta_id); |
50 | void iwl_update_tkip_key(struct iwl_priv *priv, | ||
51 | struct ieee80211_key_conf *keyconf, | ||
52 | const u8 *addr, u32 iv32, u16 *phase1key); | ||
53 | |||
50 | int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap); | 54 | int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap); |
51 | int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap); | 55 | int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap); |
56 | void iwl_clear_stations_table(struct iwl_priv *priv); | ||
52 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | 57 | int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); |
53 | void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid); | ||
54 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); | 58 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); |
59 | u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, | ||
60 | int is_ap, u8 flags, | ||
61 | struct ieee80211_sta_ht_cap *ht_info); | ||
62 | void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); | ||
63 | int iwl_sta_rx_agg_start(struct iwl_priv *priv, | ||
64 | const u8 *addr, int tid, u16 ssn); | ||
65 | int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid); | ||
66 | void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr); | ||
55 | #endif /* __iwl_sta_h__ */ | 67 | #endif /* __iwl_sta_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 907a53ebc6e4..b0ee86c62685 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -56,96 +56,132 @@ static const u16 default_tid_to_tx_fifo[] = { | |||
56 | IWL_TX_FIFO_AC3 | 56 | IWL_TX_FIFO_AC3 |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static inline int iwl_alloc_dma_ptr(struct iwl_priv *priv, | ||
60 | struct iwl_dma_ptr *ptr, size_t size) | ||
61 | { | ||
62 | ptr->addr = pci_alloc_consistent(priv->pci_dev, size, &ptr->dma); | ||
63 | if (!ptr->addr) | ||
64 | return -ENOMEM; | ||
65 | ptr->size = size; | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static inline void iwl_free_dma_ptr(struct iwl_priv *priv, | ||
70 | struct iwl_dma_ptr *ptr) | ||
71 | { | ||
72 | if (unlikely(!ptr->addr)) | ||
73 | return; | ||
74 | |||
75 | pci_free_consistent(priv->pci_dev, ptr->size, ptr->addr, ptr->dma); | ||
76 | memset(ptr, 0, sizeof(*ptr)); | ||
77 | } | ||
78 | |||
79 | static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) | ||
80 | { | ||
81 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
82 | |||
83 | dma_addr_t addr = get_unaligned_le32(&tb->lo); | ||
84 | if (sizeof(dma_addr_t) > sizeof(u32)) | ||
85 | addr |= | ||
86 | ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16; | ||
87 | |||
88 | return addr; | ||
89 | } | ||
90 | |||
91 | static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) | ||
92 | { | ||
93 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
94 | |||
95 | return le16_to_cpu(tb->hi_n_len) >> 4; | ||
96 | } | ||
97 | |||
98 | static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, | ||
99 | dma_addr_t addr, u16 len) | ||
100 | { | ||
101 | struct iwl_tfd_tb *tb = &tfd->tbs[idx]; | ||
102 | u16 hi_n_len = len << 4; | ||
103 | |||
104 | put_unaligned_le32(addr, &tb->lo); | ||
105 | if (sizeof(dma_addr_t) > sizeof(u32)) | ||
106 | hi_n_len |= ((addr >> 16) >> 16) & 0xF; | ||
107 | |||
108 | tb->hi_n_len = cpu_to_le16(hi_n_len); | ||
109 | |||
110 | tfd->num_tbs = idx + 1; | ||
111 | } | ||
112 | |||
113 | static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) | ||
114 | { | ||
115 | return tfd->num_tbs & 0x1f; | ||
116 | } | ||
59 | 117 | ||
60 | /** | 118 | /** |
61 | * iwl_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] | 119 | * iwl_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] |
120 | * @priv - driver private data | ||
121 | * @txq - tx queue | ||
62 | * | 122 | * |
63 | * Does NOT advance any TFD circular buffer read/write indexes | 123 | * Does NOT advance any TFD circular buffer read/write indexes |
64 | * Does NOT free the TFD itself (which is within circular buffer) | 124 | * Does NOT free the TFD itself (which is within circular buffer) |
65 | */ | 125 | */ |
66 | static int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | 126 | static void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) |
67 | { | 127 | { |
68 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; | 128 | struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)&txq->tfds[0]; |
69 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; | 129 | struct iwl_tfd *tfd; |
70 | struct pci_dev *dev = priv->pci_dev; | 130 | struct pci_dev *dev = priv->pci_dev; |
131 | int index = txq->q.read_ptr; | ||
71 | int i; | 132 | int i; |
72 | int counter = 0; | 133 | int num_tbs; |
73 | int index, is_odd; | ||
74 | 134 | ||
75 | /* Host command buffers stay mapped in memory, nothing to clean */ | 135 | tfd = &tfd_tmp[index]; |
76 | if (txq->q.id == IWL_CMD_QUEUE_NUM) | ||
77 | return 0; | ||
78 | 136 | ||
79 | /* Sanity check on number of chunks */ | 137 | /* Sanity check on number of chunks */ |
80 | counter = IWL_GET_BITS(*bd, num_tbs); | 138 | num_tbs = iwl_tfd_get_num_tbs(tfd); |
81 | if (counter > MAX_NUM_OF_TBS) { | 139 | |
82 | IWL_ERROR("Too many chunks: %i\n", counter); | 140 | if (num_tbs >= IWL_NUM_OF_TBS) { |
141 | IWL_ERROR("Too many chunks: %i\n", num_tbs); | ||
83 | /* @todo issue fatal error, it is quite serious situation */ | 142 | /* @todo issue fatal error, it is quite serious situation */ |
84 | return 0; | 143 | return; |
85 | } | 144 | } |
86 | 145 | ||
87 | /* Unmap chunks, if any. | 146 | /* Unmap tx_cmd */ |
88 | * TFD info for odd chunks is different format than for even chunks. */ | 147 | if (num_tbs) |
89 | for (i = 0; i < counter; i++) { | 148 | pci_unmap_single(dev, |
90 | index = i / 2; | 149 | pci_unmap_addr(&txq->cmd[index]->meta, mapping), |
91 | is_odd = i & 0x1; | 150 | pci_unmap_len(&txq->cmd[index]->meta, len), |
92 | |||
93 | if (is_odd) | ||
94 | pci_unmap_single( | ||
95 | dev, | ||
96 | IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) | | ||
97 | (IWL_GET_BITS(bd->pa[index], | ||
98 | tb2_addr_hi20) << 16), | ||
99 | IWL_GET_BITS(bd->pa[index], tb2_len), | ||
100 | PCI_DMA_TODEVICE); | 151 | PCI_DMA_TODEVICE); |
101 | 152 | ||
102 | else if (i > 0) | 153 | /* Unmap chunks, if any. */ |
103 | pci_unmap_single(dev, | 154 | for (i = 1; i < num_tbs; i++) { |
104 | le32_to_cpu(bd->pa[index].tb1_addr), | 155 | pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), |
105 | IWL_GET_BITS(bd->pa[index], tb1_len), | 156 | iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); |
106 | PCI_DMA_TODEVICE); | ||
107 | 157 | ||
108 | /* Free SKB, if any, for this chunk */ | 158 | if (txq->txb) { |
109 | if (txq->txb[txq->q.read_ptr].skb[i]) { | 159 | dev_kfree_skb(txq->txb[txq->q.read_ptr].skb[i - 1]); |
110 | struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[i]; | 160 | txq->txb[txq->q.read_ptr].skb[i - 1] = NULL; |
111 | |||
112 | dev_kfree_skb(skb); | ||
113 | txq->txb[txq->q.read_ptr].skb[i] = NULL; | ||
114 | } | 161 | } |
115 | } | 162 | } |
116 | return 0; | ||
117 | } | 163 | } |
118 | 164 | ||
119 | static int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | 165 | static int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, |
120 | dma_addr_t addr, u16 len) | 166 | struct iwl_tfd *tfd, |
167 | dma_addr_t addr, u16 len) | ||
121 | { | 168 | { |
122 | int index, is_odd; | 169 | |
123 | struct iwl_tfd_frame *tfd = ptr; | 170 | u32 num_tbs = iwl_tfd_get_num_tbs(tfd); |
124 | u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); | ||
125 | 171 | ||
126 | /* Each TFD can point to a maximum 20 Tx buffers */ | 172 | /* Each TFD can point to a maximum 20 Tx buffers */ |
127 | if (num_tbs >= MAX_NUM_OF_TBS) { | 173 | if (num_tbs >= IWL_NUM_OF_TBS) { |
128 | IWL_ERROR("Error can not send more than %d chunks\n", | 174 | IWL_ERROR("Error can not send more than %d chunks\n", |
129 | MAX_NUM_OF_TBS); | 175 | IWL_NUM_OF_TBS); |
130 | return -EINVAL; | 176 | return -EINVAL; |
131 | } | 177 | } |
132 | 178 | ||
133 | index = num_tbs / 2; | 179 | BUG_ON(addr & ~DMA_BIT_MASK(36)); |
134 | is_odd = num_tbs & 0x1; | 180 | if (unlikely(addr & ~IWL_TX_DMA_MASK)) |
135 | 181 | IWL_ERROR("Unaligned address = %llx\n", | |
136 | if (!is_odd) { | 182 | (unsigned long long)addr); |
137 | tfd->pa[index].tb1_addr = cpu_to_le32(addr); | ||
138 | IWL_SET_BITS(tfd->pa[index], tb1_addr_hi, | ||
139 | iwl_get_dma_hi_address(addr)); | ||
140 | IWL_SET_BITS(tfd->pa[index], tb1_len, len); | ||
141 | } else { | ||
142 | IWL_SET_BITS(tfd->pa[index], tb2_addr_lo16, | ||
143 | (u32) (addr & 0xffff)); | ||
144 | IWL_SET_BITS(tfd->pa[index], tb2_addr_hi20, addr >> 16); | ||
145 | IWL_SET_BITS(tfd->pa[index], tb2_len, len); | ||
146 | } | ||
147 | 183 | ||
148 | IWL_SET_BITS(*tfd, num_tbs, num_tbs + 1); | 184 | iwl_tfd_set_tb(tfd, num_tbs, addr, len); |
149 | 185 | ||
150 | return 0; | 186 | return 0; |
151 | } | 187 | } |
@@ -210,7 +246,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | |||
210 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; | 246 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; |
211 | struct iwl_queue *q = &txq->q; | 247 | struct iwl_queue *q = &txq->q; |
212 | struct pci_dev *dev = priv->pci_dev; | 248 | struct pci_dev *dev = priv->pci_dev; |
213 | int i, slots_num, len; | 249 | int i, len; |
214 | 250 | ||
215 | if (q->n_bd == 0) | 251 | if (q->n_bd == 0) |
216 | return; | 252 | return; |
@@ -221,21 +257,15 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | |||
221 | iwl_hw_txq_free_tfd(priv, txq); | 257 | iwl_hw_txq_free_tfd(priv, txq); |
222 | 258 | ||
223 | len = sizeof(struct iwl_cmd) * q->n_window; | 259 | len = sizeof(struct iwl_cmd) * q->n_window; |
224 | if (q->id == IWL_CMD_QUEUE_NUM) | ||
225 | len += IWL_MAX_SCAN_SIZE; | ||
226 | 260 | ||
227 | /* De-alloc array of command/tx buffers */ | 261 | /* De-alloc array of command/tx buffers */ |
228 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? | 262 | for (i = 0; i < TFD_TX_CMD_SLOTS; i++) |
229 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | ||
230 | for (i = 0; i < slots_num; i++) | ||
231 | kfree(txq->cmd[i]); | 263 | kfree(txq->cmd[i]); |
232 | if (txq_id == IWL_CMD_QUEUE_NUM) | ||
233 | kfree(txq->cmd[slots_num]); | ||
234 | 264 | ||
235 | /* De-alloc circular buffer of TFDs */ | 265 | /* De-alloc circular buffer of TFDs */ |
236 | if (txq->q.n_bd) | 266 | if (txq->q.n_bd) |
237 | pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * | 267 | pci_free_consistent(dev, sizeof(struct iwl_tfd) * |
238 | txq->q.n_bd, txq->bd, txq->q.dma_addr); | 268 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); |
239 | 269 | ||
240 | /* De-alloc array of per-TFD driver data */ | 270 | /* De-alloc array of per-TFD driver data */ |
241 | kfree(txq->txb); | 271 | kfree(txq->txb); |
@@ -245,6 +275,40 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | |||
245 | memset(txq, 0, sizeof(*txq)); | 275 | memset(txq, 0, sizeof(*txq)); |
246 | } | 276 | } |
247 | 277 | ||
278 | |||
279 | /** | ||
280 | * iwl_cmd_queue_free - Deallocate DMA queue. | ||
281 | * @txq: Transmit queue to deallocate. | ||
282 | * | ||
283 | * Empty queue by removing and destroying all BD's. | ||
284 | * Free all buffers. | ||
285 | * 0-fill, but do not free "txq" descriptor structure. | ||
286 | */ | ||
287 | static void iwl_cmd_queue_free(struct iwl_priv *priv) | ||
288 | { | ||
289 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | ||
290 | struct iwl_queue *q = &txq->q; | ||
291 | struct pci_dev *dev = priv->pci_dev; | ||
292 | int i, len; | ||
293 | |||
294 | if (q->n_bd == 0) | ||
295 | return; | ||
296 | |||
297 | len = sizeof(struct iwl_cmd) * q->n_window; | ||
298 | len += IWL_MAX_SCAN_SIZE; | ||
299 | |||
300 | /* De-alloc array of command/tx buffers */ | ||
301 | for (i = 0; i <= TFD_CMD_SLOTS; i++) | ||
302 | kfree(txq->cmd[i]); | ||
303 | |||
304 | /* De-alloc circular buffer of TFDs */ | ||
305 | if (txq->q.n_bd) | ||
306 | pci_free_consistent(dev, sizeof(struct iwl_tfd) * | ||
307 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); | ||
308 | |||
309 | /* 0-fill queue descriptor structure */ | ||
310 | memset(txq, 0, sizeof(*txq)); | ||
311 | } | ||
248 | /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** | 312 | /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** |
249 | * DMA services | 313 | * DMA services |
250 | * | 314 | * |
@@ -340,13 +404,13 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, | |||
340 | 404 | ||
341 | /* Circular buffer of transmit frame descriptors (TFDs), | 405 | /* Circular buffer of transmit frame descriptors (TFDs), |
342 | * shared with device */ | 406 | * shared with device */ |
343 | txq->bd = pci_alloc_consistent(dev, | 407 | txq->tfds = pci_alloc_consistent(dev, |
344 | sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX, | 408 | sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX, |
345 | &txq->q.dma_addr); | 409 | &txq->q.dma_addr); |
346 | 410 | ||
347 | if (!txq->bd) { | 411 | if (!txq->tfds) { |
348 | IWL_ERROR("pci_alloc_consistent(%zd) failed\n", | 412 | IWL_ERROR("pci_alloc_consistent(%zd) failed\n", |
349 | sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX); | 413 | sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX); |
350 | goto error; | 414 | goto error; |
351 | } | 415 | } |
352 | txq->q.id = id; | 416 | txq->q.id = id; |
@@ -370,26 +434,21 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, | |||
370 | static int iwl_hw_tx_queue_init(struct iwl_priv *priv, | 434 | static int iwl_hw_tx_queue_init(struct iwl_priv *priv, |
371 | struct iwl_tx_queue *txq) | 435 | struct iwl_tx_queue *txq) |
372 | { | 436 | { |
373 | int rc; | 437 | int ret; |
374 | unsigned long flags; | 438 | unsigned long flags; |
375 | int txq_id = txq->q.id; | 439 | int txq_id = txq->q.id; |
376 | 440 | ||
377 | spin_lock_irqsave(&priv->lock, flags); | 441 | spin_lock_irqsave(&priv->lock, flags); |
378 | rc = iwl_grab_nic_access(priv); | 442 | ret = iwl_grab_nic_access(priv); |
379 | if (rc) { | 443 | if (ret) { |
380 | spin_unlock_irqrestore(&priv->lock, flags); | 444 | spin_unlock_irqrestore(&priv->lock, flags); |
381 | return rc; | 445 | return ret; |
382 | } | 446 | } |
383 | 447 | ||
384 | /* Circular buffer (TFD queue in DRAM) physical base address */ | 448 | /* Circular buffer (TFD queue in DRAM) physical base address */ |
385 | iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), | 449 | iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), |
386 | txq->q.dma_addr >> 8); | 450 | txq->q.dma_addr >> 8); |
387 | 451 | ||
388 | /* Enable DMA channel, using same id as for TFD queue */ | ||
389 | iwl_write_direct32( | ||
390 | priv, FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), | ||
391 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | ||
392 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL); | ||
393 | iwl_release_nic_access(priv); | 452 | iwl_release_nic_access(priv); |
394 | spin_unlock_irqrestore(&priv->lock, flags); | 453 | spin_unlock_irqrestore(&priv->lock, flags); |
395 | 454 | ||
@@ -468,16 +527,20 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
468 | 527 | ||
469 | /* Tx queues */ | 528 | /* Tx queues */ |
470 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) | 529 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) |
471 | iwl_tx_queue_free(priv, txq_id); | 530 | if (txq_id == IWL_CMD_QUEUE_NUM) |
531 | iwl_cmd_queue_free(priv); | ||
532 | else | ||
533 | iwl_tx_queue_free(priv, txq_id); | ||
472 | 534 | ||
473 | /* Keep-warm buffer */ | 535 | iwl_free_dma_ptr(priv, &priv->kw); |
474 | iwl_kw_free(priv); | 536 | |
537 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | ||
475 | } | 538 | } |
476 | EXPORT_SYMBOL(iwl_hw_txq_ctx_free); | 539 | EXPORT_SYMBOL(iwl_hw_txq_ctx_free); |
477 | 540 | ||
478 | /** | 541 | /** |
479 | * iwl_txq_ctx_reset - Reset TX queue context | 542 | * iwl_txq_ctx_reset - Reset TX queue context |
480 | * Destroys all DMA structures and initialise them again | 543 | * Destroys all DMA structures and initialize them again |
481 | * | 544 | * |
482 | * @param priv | 545 | * @param priv |
483 | * @return error code | 546 | * @return error code |
@@ -488,13 +551,17 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
488 | int txq_id, slots_num; | 551 | int txq_id, slots_num; |
489 | unsigned long flags; | 552 | unsigned long flags; |
490 | 553 | ||
491 | iwl_kw_free(priv); | ||
492 | |||
493 | /* Free all tx/cmd queues and keep-warm buffer */ | 554 | /* Free all tx/cmd queues and keep-warm buffer */ |
494 | iwl_hw_txq_ctx_free(priv); | 555 | iwl_hw_txq_ctx_free(priv); |
495 | 556 | ||
557 | ret = iwl_alloc_dma_ptr(priv, &priv->scd_bc_tbls, | ||
558 | priv->hw_params.scd_bc_tbls_size); | ||
559 | if (ret) { | ||
560 | IWL_ERROR("Scheduler BC Table allocation failed\n"); | ||
561 | goto error_bc_tbls; | ||
562 | } | ||
496 | /* Alloc keep-warm buffer */ | 563 | /* Alloc keep-warm buffer */ |
497 | ret = iwl_kw_alloc(priv); | 564 | ret = iwl_alloc_dma_ptr(priv, &priv->kw, IWL_KW_SIZE); |
498 | if (ret) { | 565 | if (ret) { |
499 | IWL_ERROR("Keep Warm allocation failed\n"); | 566 | IWL_ERROR("Keep Warm allocation failed\n"); |
500 | goto error_kw; | 567 | goto error_kw; |
@@ -509,17 +576,12 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
509 | /* Turn off all Tx DMA fifos */ | 576 | /* Turn off all Tx DMA fifos */ |
510 | priv->cfg->ops->lib->txq_set_sched(priv, 0); | 577 | priv->cfg->ops->lib->txq_set_sched(priv, 0); |
511 | 578 | ||
579 | /* Tell NIC where to find the "keep warm" buffer */ | ||
580 | iwl_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); | ||
581 | |||
512 | iwl_release_nic_access(priv); | 582 | iwl_release_nic_access(priv); |
513 | spin_unlock_irqrestore(&priv->lock, flags); | 583 | spin_unlock_irqrestore(&priv->lock, flags); |
514 | 584 | ||
515 | |||
516 | /* Tell nic where to find the keep-warm buffer */ | ||
517 | ret = iwl_kw_init(priv); | ||
518 | if (ret) { | ||
519 | IWL_ERROR("kw_init failed\n"); | ||
520 | goto error_reset; | ||
521 | } | ||
522 | |||
523 | /* Alloc and init all Tx queues, including the command queue (#4) */ | 585 | /* Alloc and init all Tx queues, including the command queue (#4) */ |
524 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 586 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { |
525 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? | 587 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? |
@@ -537,8 +599,10 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
537 | error: | 599 | error: |
538 | iwl_hw_txq_ctx_free(priv); | 600 | iwl_hw_txq_ctx_free(priv); |
539 | error_reset: | 601 | error_reset: |
540 | iwl_kw_free(priv); | 602 | iwl_free_dma_ptr(priv, &priv->kw); |
541 | error_kw: | 603 | error_kw: |
604 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | ||
605 | error_bc_tbls: | ||
542 | return ret; | 606 | return ret; |
543 | } | 607 | } |
544 | 608 | ||
@@ -547,11 +611,9 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
547 | */ | 611 | */ |
548 | void iwl_txq_ctx_stop(struct iwl_priv *priv) | 612 | void iwl_txq_ctx_stop(struct iwl_priv *priv) |
549 | { | 613 | { |
550 | 614 | int ch; | |
551 | int txq_id; | ||
552 | unsigned long flags; | 615 | unsigned long flags; |
553 | 616 | ||
554 | |||
555 | /* Turn off all Tx DMA fifos */ | 617 | /* Turn off all Tx DMA fifos */ |
556 | spin_lock_irqsave(&priv->lock, flags); | 618 | spin_lock_irqsave(&priv->lock, flags); |
557 | if (iwl_grab_nic_access(priv)) { | 619 | if (iwl_grab_nic_access(priv)) { |
@@ -562,12 +624,11 @@ void iwl_txq_ctx_stop(struct iwl_priv *priv) | |||
562 | priv->cfg->ops->lib->txq_set_sched(priv, 0); | 624 | priv->cfg->ops->lib->txq_set_sched(priv, 0); |
563 | 625 | ||
564 | /* Stop each Tx DMA channel, and wait for it to be idle */ | 626 | /* Stop each Tx DMA channel, and wait for it to be idle */ |
565 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 627 | for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { |
566 | iwl_write_direct32(priv, | 628 | iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); |
567 | FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 0x0); | ||
568 | iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, | 629 | iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, |
569 | FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE | 630 | FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), |
570 | (txq_id), 200); | 631 | 1000); |
571 | } | 632 | } |
572 | iwl_release_nic_access(priv); | 633 | iwl_release_nic_access(priv); |
573 | spin_unlock_irqrestore(&priv->lock, flags); | 634 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -584,7 +645,7 @@ static void iwl_tx_cmd_build_basic(struct iwl_priv *priv, | |||
584 | struct iwl_tx_cmd *tx_cmd, | 645 | struct iwl_tx_cmd *tx_cmd, |
585 | struct ieee80211_tx_info *info, | 646 | struct ieee80211_tx_info *info, |
586 | struct ieee80211_hdr *hdr, | 647 | struct ieee80211_hdr *hdr, |
587 | int is_unicast, u8 std_id) | 648 | u8 std_id) |
588 | { | 649 | { |
589 | __le16 fc = hdr->frame_control; | 650 | __le16 fc = hdr->frame_control; |
590 | __le32 tx_flags = tx_cmd->tx_flags; | 651 | __le32 tx_flags = tx_cmd->tx_flags; |
@@ -647,11 +708,11 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv, | |||
647 | __le16 fc, int sta_id, | 708 | __le16 fc, int sta_id, |
648 | int is_hcca) | 709 | int is_hcca) |
649 | { | 710 | { |
711 | u32 rate_flags = 0; | ||
712 | int rate_idx; | ||
650 | u8 rts_retry_limit = 0; | 713 | u8 rts_retry_limit = 0; |
651 | u8 data_retry_limit = 0; | 714 | u8 data_retry_limit = 0; |
652 | u8 rate_plcp; | 715 | u8 rate_plcp; |
653 | u16 rate_flags = 0; | ||
654 | int rate_idx; | ||
655 | 716 | ||
656 | rate_idx = min(ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xffff, | 717 | rate_idx = min(ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xffff, |
657 | IWL_RATE_COUNT - 1); | 718 | IWL_RATE_COUNT - 1); |
@@ -694,14 +755,8 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv, | |||
694 | break; | 755 | break; |
695 | } | 756 | } |
696 | 757 | ||
697 | /* Alternate between antenna A and B for successive frames */ | 758 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant); |
698 | if (priv->use_ant_b_for_management_frame) { | 759 | rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); |
699 | priv->use_ant_b_for_management_frame = 0; | ||
700 | rate_flags |= RATE_MCS_ANT_B_MSK; | ||
701 | } else { | ||
702 | priv->use_ant_b_for_management_frame = 1; | ||
703 | rate_flags |= RATE_MCS_ANT_A_MSK; | ||
704 | } | ||
705 | } | 760 | } |
706 | 761 | ||
707 | tx_cmd->rts_retry_limit = rts_retry_limit; | 762 | tx_cmd->rts_retry_limit = rts_retry_limit; |
@@ -723,7 +778,7 @@ static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv, | |||
723 | memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); | 778 | memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); |
724 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | 779 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
725 | tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; | 780 | tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; |
726 | IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n"); | 781 | IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n"); |
727 | break; | 782 | break; |
728 | 783 | ||
729 | case ALG_TKIP: | 784 | case ALG_TKIP: |
@@ -767,7 +822,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
767 | { | 822 | { |
768 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 823 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
769 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 824 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
770 | struct iwl_tfd_frame *tfd; | 825 | struct iwl_tfd *tfd; |
771 | struct iwl_tx_queue *txq; | 826 | struct iwl_tx_queue *txq; |
772 | struct iwl_queue *q; | 827 | struct iwl_queue *q; |
773 | struct iwl_cmd *out_cmd; | 828 | struct iwl_cmd *out_cmd; |
@@ -776,10 +831,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
776 | dma_addr_t phys_addr; | 831 | dma_addr_t phys_addr; |
777 | dma_addr_t txcmd_phys; | 832 | dma_addr_t txcmd_phys; |
778 | dma_addr_t scratch_phys; | 833 | dma_addr_t scratch_phys; |
779 | u16 len, idx, len_org; | 834 | u16 len, len_org; |
780 | u16 seq_number = 0; | 835 | u16 seq_number = 0; |
781 | __le16 fc; | 836 | __le16 fc; |
782 | u8 hdr_len, unicast; | 837 | u8 hdr_len; |
783 | u8 sta_id; | 838 | u8 sta_id; |
784 | u8 wait_write_ptr = 0; | 839 | u8 wait_write_ptr = 0; |
785 | u8 tid = 0; | 840 | u8 tid = 0; |
@@ -799,8 +854,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
799 | goto drop_unlock; | 854 | goto drop_unlock; |
800 | } | 855 | } |
801 | 856 | ||
802 | unicast = !is_multicast_ether_addr(hdr->addr1); | ||
803 | |||
804 | fc = hdr->frame_control; | 857 | fc = hdr->frame_control; |
805 | 858 | ||
806 | #ifdef CONFIG_IWLWIFI_DEBUG | 859 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -830,10 +883,8 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
830 | /* Find (or create) index into station table for destination station */ | 883 | /* Find (or create) index into station table for destination station */ |
831 | sta_id = iwl_get_sta_id(priv, hdr); | 884 | sta_id = iwl_get_sta_id(priv, hdr); |
832 | if (sta_id == IWL_INVALID_STATION) { | 885 | if (sta_id == IWL_INVALID_STATION) { |
833 | DECLARE_MAC_BUF(mac); | 886 | IWL_DEBUG_DROP("Dropping - INVALID STATION: %pM\n", |
834 | 887 | hdr->addr1); | |
835 | IWL_DEBUG_DROP("Dropping - INVALID STATION: %s\n", | ||
836 | print_mac(mac, hdr->addr1)); | ||
837 | goto drop; | 888 | goto drop; |
838 | } | 889 | } |
839 | 890 | ||
@@ -856,23 +907,22 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
856 | priv->stations[sta_id].tid[tid].tfds_in_queue++; | 907 | priv->stations[sta_id].tid[tid].tfds_in_queue++; |
857 | } | 908 | } |
858 | 909 | ||
859 | /* Descriptor for chosen Tx queue */ | ||
860 | txq = &priv->txq[txq_id]; | 910 | txq = &priv->txq[txq_id]; |
861 | q = &txq->q; | 911 | q = &txq->q; |
912 | txq->swq_id = swq_id; | ||
862 | 913 | ||
863 | spin_lock_irqsave(&priv->lock, flags); | 914 | spin_lock_irqsave(&priv->lock, flags); |
864 | 915 | ||
865 | /* Set up first empty TFD within this queue's circular TFD buffer */ | 916 | /* Set up first empty TFD within this queue's circular TFD buffer */ |
866 | tfd = &txq->bd[q->write_ptr]; | 917 | tfd = &txq->tfds[q->write_ptr]; |
867 | memset(tfd, 0, sizeof(*tfd)); | 918 | memset(tfd, 0, sizeof(*tfd)); |
868 | idx = get_cmd_index(q, q->write_ptr, 0); | ||
869 | 919 | ||
870 | /* Set up driver data for this TFD */ | 920 | /* Set up driver data for this TFD */ |
871 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); | 921 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); |
872 | txq->txb[q->write_ptr].skb[0] = skb; | 922 | txq->txb[q->write_ptr].skb[0] = skb; |
873 | 923 | ||
874 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ | 924 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ |
875 | out_cmd = txq->cmd[idx]; | 925 | out_cmd = txq->cmd[q->write_ptr]; |
876 | tx_cmd = &out_cmd->cmd.tx; | 926 | tx_cmd = &out_cmd->cmd.tx; |
877 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); | 927 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); |
878 | memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); | 928 | memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd)); |
@@ -912,12 +962,14 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
912 | 962 | ||
913 | /* Physical address of this Tx command's header (not MAC header!), | 963 | /* Physical address of this Tx command's header (not MAC header!), |
914 | * within command buffer array. */ | 964 | * within command buffer array. */ |
915 | txcmd_phys = pci_map_single(priv->pci_dev, out_cmd, | 965 | txcmd_phys = pci_map_single(priv->pci_dev, |
916 | sizeof(struct iwl_cmd), PCI_DMA_TODEVICE); | 966 | out_cmd, sizeof(struct iwl_cmd), |
917 | txcmd_phys += offsetof(struct iwl_cmd, hdr); | 967 | PCI_DMA_TODEVICE); |
918 | 968 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); | |
969 | pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); | ||
919 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 970 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
920 | * first entry */ | 971 | * first entry */ |
972 | txcmd_phys += offsetof(struct iwl_cmd, hdr); | ||
921 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); | 973 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); |
922 | 974 | ||
923 | if (info->control.hw_key) | 975 | if (info->control.hw_key) |
@@ -940,7 +992,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
940 | len = (u16)skb->len; | 992 | len = (u16)skb->len; |
941 | tx_cmd->len = cpu_to_le16(len); | 993 | tx_cmd->len = cpu_to_le16(len); |
942 | /* TODO need this for burst mode later on */ | 994 | /* TODO need this for burst mode later on */ |
943 | iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, unicast, sta_id); | 995 | iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id); |
944 | 996 | ||
945 | /* set is_hcca to 0; it probably will never be implemented */ | 997 | /* set is_hcca to 0; it probably will never be implemented */ |
946 | iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0); | 998 | iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0); |
@@ -950,7 +1002,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
950 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + | 1002 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + |
951 | offsetof(struct iwl_tx_cmd, scratch); | 1003 | offsetof(struct iwl_tx_cmd, scratch); |
952 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | 1004 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); |
953 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); | 1005 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); |
954 | 1006 | ||
955 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 1007 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
956 | txq->need_update = 1; | 1008 | txq->need_update = 1; |
@@ -983,7 +1035,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
983 | iwl_txq_update_write_ptr(priv, txq); | 1035 | iwl_txq_update_write_ptr(priv, txq); |
984 | spin_unlock_irqrestore(&priv->lock, flags); | 1036 | spin_unlock_irqrestore(&priv->lock, flags); |
985 | } else { | 1037 | } else { |
986 | ieee80211_stop_queue(priv->hw, swq_id); | 1038 | ieee80211_stop_queue(priv->hw, txq->swq_id); |
987 | } | 1039 | } |
988 | } | 1040 | } |
989 | 1041 | ||
@@ -1011,7 +1063,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1011 | { | 1063 | { |
1012 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 1064 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; |
1013 | struct iwl_queue *q = &txq->q; | 1065 | struct iwl_queue *q = &txq->q; |
1014 | struct iwl_tfd_frame *tfd; | 1066 | struct iwl_tfd *tfd; |
1015 | struct iwl_cmd *out_cmd; | 1067 | struct iwl_cmd *out_cmd; |
1016 | dma_addr_t phys_addr; | 1068 | dma_addr_t phys_addr; |
1017 | unsigned long flags; | 1069 | unsigned long flags; |
@@ -1040,7 +1092,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1040 | 1092 | ||
1041 | spin_lock_irqsave(&priv->hcmd_lock, flags); | 1093 | spin_lock_irqsave(&priv->hcmd_lock, flags); |
1042 | 1094 | ||
1043 | tfd = &txq->bd[q->write_ptr]; | 1095 | tfd = &txq->tfds[q->write_ptr]; |
1044 | memset(tfd, 0, sizeof(*tfd)); | 1096 | memset(tfd, 0, sizeof(*tfd)); |
1045 | 1097 | ||
1046 | 1098 | ||
@@ -1061,9 +1113,13 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1061 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; | 1113 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
1062 | len = (idx == TFD_CMD_SLOTS) ? | 1114 | len = (idx == TFD_CMD_SLOTS) ? |
1063 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); | 1115 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); |
1064 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, | 1116 | |
1065 | PCI_DMA_TODEVICE); | 1117 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, |
1118 | len, PCI_DMA_TODEVICE); | ||
1119 | pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr); | ||
1120 | pci_unmap_len_set(&out_cmd->meta, len, len); | ||
1066 | phys_addr += offsetof(struct iwl_cmd, hdr); | 1121 | phys_addr += offsetof(struct iwl_cmd, hdr); |
1122 | |||
1067 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); | 1123 | iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); |
1068 | 1124 | ||
1069 | #ifdef CONFIG_IWLWIFI_DEBUG | 1125 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -1113,8 +1169,9 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
1113 | return 0; | 1169 | return 0; |
1114 | } | 1170 | } |
1115 | 1171 | ||
1116 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; | 1172 | for (index = iwl_queue_inc_wrap(index, q->n_bd); |
1117 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 1173 | q->read_ptr != index; |
1174 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | ||
1118 | 1175 | ||
1119 | tx_info = &txq->txb[txq->q.read_ptr]; | 1176 | tx_info = &txq->txb[txq->q.read_ptr]; |
1120 | ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]); | 1177 | ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]); |
@@ -1138,44 +1195,34 @@ EXPORT_SYMBOL(iwl_tx_queue_reclaim); | |||
1138 | * need to be reclaimed. As result, some free space forms. If there is | 1195 | * need to be reclaimed. As result, some free space forms. If there is |
1139 | * enough free space (> low mark), wake the stack that feeds us. | 1196 | * enough free space (> low mark), wake the stack that feeds us. |
1140 | */ | 1197 | */ |
1141 | static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | 1198 | static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, |
1199 | int idx, int cmd_idx) | ||
1142 | { | 1200 | { |
1143 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; | 1201 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; |
1144 | struct iwl_queue *q = &txq->q; | 1202 | struct iwl_queue *q = &txq->q; |
1145 | struct iwl_tfd_frame *bd = &txq->bd[index]; | ||
1146 | dma_addr_t dma_addr; | ||
1147 | int is_odd, buf_len; | ||
1148 | int nfreed = 0; | 1203 | int nfreed = 0; |
1149 | 1204 | ||
1150 | if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { | 1205 | if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) { |
1151 | IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " | 1206 | IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " |
1152 | "is out of range [0-%d] %d %d.\n", txq_id, | 1207 | "is out of range [0-%d] %d %d.\n", txq_id, |
1153 | index, q->n_bd, q->write_ptr, q->read_ptr); | 1208 | idx, q->n_bd, q->write_ptr, q->read_ptr); |
1154 | return; | 1209 | return; |
1155 | } | 1210 | } |
1156 | 1211 | ||
1157 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; | 1212 | pci_unmap_single(priv->pci_dev, |
1158 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 1213 | pci_unmap_addr(&txq->cmd[cmd_idx]->meta, mapping), |
1214 | pci_unmap_len(&txq->cmd[cmd_idx]->meta, len), | ||
1215 | PCI_DMA_TODEVICE); | ||
1216 | |||
1217 | for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; | ||
1218 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | ||
1159 | 1219 | ||
1160 | if (nfreed > 1) { | 1220 | if (nfreed++ > 0) { |
1161 | IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, | 1221 | IWL_ERROR("HCMD skipped: index (%d) %d %d\n", idx, |
1162 | q->write_ptr, q->read_ptr); | 1222 | q->write_ptr, q->read_ptr); |
1163 | queue_work(priv->workqueue, &priv->restart); | 1223 | queue_work(priv->workqueue, &priv->restart); |
1164 | } | 1224 | } |
1165 | is_odd = (index/2) & 0x1; | ||
1166 | if (is_odd) { | ||
1167 | dma_addr = IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) | | ||
1168 | (IWL_GET_BITS(bd->pa[index], | ||
1169 | tb2_addr_hi20) << 16); | ||
1170 | buf_len = IWL_GET_BITS(bd->pa[index], tb2_len); | ||
1171 | } else { | ||
1172 | dma_addr = le32_to_cpu(bd->pa[index].tb1_addr); | ||
1173 | buf_len = IWL_GET_BITS(bd->pa[index], tb1_len); | ||
1174 | } | ||
1175 | 1225 | ||
1176 | pci_unmap_single(priv->pci_dev, dma_addr, buf_len, | ||
1177 | PCI_DMA_TODEVICE); | ||
1178 | nfreed++; | ||
1179 | } | 1226 | } |
1180 | } | 1227 | } |
1181 | 1228 | ||
@@ -1201,8 +1248,13 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
1201 | * command queue then there a command routing bug has been introduced | 1248 | * command queue then there a command routing bug has been introduced |
1202 | * in the queue management code. */ | 1249 | * in the queue management code. */ |
1203 | if (WARN(txq_id != IWL_CMD_QUEUE_NUM, | 1250 | if (WARN(txq_id != IWL_CMD_QUEUE_NUM, |
1204 | "wrong command queue %d, command id 0x%X\n", txq_id, pkt->hdr.cmd)) | 1251 | "wrong command queue %d, sequence 0x%X readp=%d writep=%d\n", |
1252 | txq_id, sequence, | ||
1253 | priv->txq[IWL_CMD_QUEUE_NUM].q.read_ptr, | ||
1254 | priv->txq[IWL_CMD_QUEUE_NUM].q.write_ptr)) { | ||
1255 | iwl_print_hex_dump(priv, IWL_DL_INFO , rxb, 32); | ||
1205 | return; | 1256 | return; |
1257 | } | ||
1206 | 1258 | ||
1207 | cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); | 1259 | cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge); |
1208 | cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; | 1260 | cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index]; |
@@ -1215,7 +1267,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
1215 | !cmd->meta.u.callback(priv, cmd, rxb->skb)) | 1267 | !cmd->meta.u.callback(priv, cmd, rxb->skb)) |
1216 | rxb->skb = NULL; | 1268 | rxb->skb = NULL; |
1217 | 1269 | ||
1218 | iwl_hcmd_queue_reclaim(priv, txq_id, index); | 1270 | iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); |
1219 | 1271 | ||
1220 | if (!(cmd->meta.flags & CMD_ASYNC)) { | 1272 | if (!(cmd->meta.flags & CMD_ASYNC)) { |
1221 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 1273 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
@@ -1248,15 +1300,14 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1248 | int ret; | 1300 | int ret; |
1249 | unsigned long flags; | 1301 | unsigned long flags; |
1250 | struct iwl_tid_data *tid_data; | 1302 | struct iwl_tid_data *tid_data; |
1251 | DECLARE_MAC_BUF(mac); | ||
1252 | 1303 | ||
1253 | if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo))) | 1304 | if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo))) |
1254 | tx_fifo = default_tid_to_tx_fifo[tid]; | 1305 | tx_fifo = default_tid_to_tx_fifo[tid]; |
1255 | else | 1306 | else |
1256 | return -EINVAL; | 1307 | return -EINVAL; |
1257 | 1308 | ||
1258 | IWL_WARNING("%s on ra = %s tid = %d\n", | 1309 | IWL_WARNING("%s on ra = %pM tid = %d\n", |
1259 | __func__, print_mac(mac, ra), tid); | 1310 | __func__, ra, tid); |
1260 | 1311 | ||
1261 | sta_id = iwl_find_station(priv, ra); | 1312 | sta_id = iwl_find_station(priv, ra); |
1262 | if (sta_id == IWL_INVALID_STATION) | 1313 | if (sta_id == IWL_INVALID_STATION) |
@@ -1301,7 +1352,6 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1301 | struct iwl_tid_data *tid_data; | 1352 | struct iwl_tid_data *tid_data; |
1302 | int ret, write_ptr, read_ptr; | 1353 | int ret, write_ptr, read_ptr; |
1303 | unsigned long flags; | 1354 | unsigned long flags; |
1304 | DECLARE_MAC_BUF(mac); | ||
1305 | 1355 | ||
1306 | if (!ra) { | 1356 | if (!ra) { |
1307 | IWL_ERROR("ra = NULL\n"); | 1357 | IWL_ERROR("ra = NULL\n"); |
@@ -1362,8 +1412,8 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id) | |||
1362 | case IWL_EMPTYING_HW_QUEUE_DELBA: | 1412 | case IWL_EMPTYING_HW_QUEUE_DELBA: |
1363 | /* We are reclaiming the last packet of the */ | 1413 | /* We are reclaiming the last packet of the */ |
1364 | /* aggregated HW queue */ | 1414 | /* aggregated HW queue */ |
1365 | if (txq_id == tid_data->agg.txq_id && | 1415 | if ((txq_id == tid_data->agg.txq_id) && |
1366 | q->read_ptr == q->write_ptr) { | 1416 | (q->read_ptr == q->write_ptr)) { |
1367 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); | 1417 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); |
1368 | int tx_fifo = default_tid_to_tx_fifo[tid]; | 1418 | int tx_fifo = default_tid_to_tx_fifo[tid]; |
1369 | IWL_DEBUG_HT("HW queue empty: continue DELBA flow\n"); | 1419 | IWL_DEBUG_HT("HW queue empty: continue DELBA flow\n"); |
@@ -1414,7 +1464,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv, | |||
1414 | IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->seq_ctl); | 1464 | IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->seq_ctl); |
1415 | 1465 | ||
1416 | /* Calculate shift to align block-ack bits with our Tx window bits */ | 1466 | /* Calculate shift to align block-ack bits with our Tx window bits */ |
1417 | sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl>>4); | 1467 | sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl >> 4); |
1418 | if (sh < 0) /* tbw something is wrong with indices */ | 1468 | if (sh < 0) /* tbw something is wrong with indices */ |
1419 | sh += 0x100; | 1469 | sh += 0x100; |
1420 | 1470 | ||
@@ -1436,7 +1486,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv, | |||
1436 | ack = bitmap & (1ULL << i); | 1486 | ack = bitmap & (1ULL << i); |
1437 | successes += !!ack; | 1487 | successes += !!ack; |
1438 | IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n", | 1488 | IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n", |
1439 | ack? "ACK":"NACK", i, (agg->start_idx + i) & 0xff, | 1489 | ack ? "ACK" : "NACK", i, (agg->start_idx + i) & 0xff, |
1440 | agg->start_idx + i); | 1490 | agg->start_idx + i); |
1441 | } | 1491 | } |
1442 | 1492 | ||
@@ -1464,10 +1514,11 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1464 | { | 1514 | { |
1465 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 1515 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
1466 | struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; | 1516 | struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; |
1467 | int index; | ||
1468 | struct iwl_tx_queue *txq = NULL; | 1517 | struct iwl_tx_queue *txq = NULL; |
1469 | struct iwl_ht_agg *agg; | 1518 | struct iwl_ht_agg *agg; |
1470 | DECLARE_MAC_BUF(mac); | 1519 | int index; |
1520 | int sta_id; | ||
1521 | int tid; | ||
1471 | 1522 | ||
1472 | /* "flow" corresponds to Tx queue */ | 1523 | /* "flow" corresponds to Tx queue */ |
1473 | u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); | 1524 | u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); |
@@ -1482,17 +1533,19 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1482 | } | 1533 | } |
1483 | 1534 | ||
1484 | txq = &priv->txq[scd_flow]; | 1535 | txq = &priv->txq[scd_flow]; |
1485 | agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg; | 1536 | sta_id = ba_resp->sta_id; |
1537 | tid = ba_resp->tid; | ||
1538 | agg = &priv->stations[sta_id].tid[tid].agg; | ||
1486 | 1539 | ||
1487 | /* Find index just before block-ack window */ | 1540 | /* Find index just before block-ack window */ |
1488 | index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); | 1541 | index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); |
1489 | 1542 | ||
1490 | /* TODO: Need to get this copy more safely - now good for debug */ | 1543 | /* TODO: Need to get this copy more safely - now good for debug */ |
1491 | 1544 | ||
1492 | IWL_DEBUG_TX_REPLY("REPLY_COMPRESSED_BA [%d]Received from %s, " | 1545 | IWL_DEBUG_TX_REPLY("REPLY_COMPRESSED_BA [%d] Received from %pM, " |
1493 | "sta_id = %d\n", | 1546 | "sta_id = %d\n", |
1494 | agg->wait_for_ba, | 1547 | agg->wait_for_ba, |
1495 | print_mac(mac, (u8 *) &ba_resp->sta_addr_lo32), | 1548 | (u8 *) &ba_resp->sta_addr_lo32, |
1496 | ba_resp->sta_id); | 1549 | ba_resp->sta_id); |
1497 | IWL_DEBUG_TX_REPLY("TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = " | 1550 | IWL_DEBUG_TX_REPLY("TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = " |
1498 | "%d, scd_ssn = %d\n", | 1551 | "%d, scd_ssn = %d\n", |
@@ -1513,18 +1566,15 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1513 | * transmitted ... if not, it's too late anyway). */ | 1566 | * transmitted ... if not, it's too late anyway). */ |
1514 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { | 1567 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { |
1515 | /* calculate mac80211 ampdu sw queue to wake */ | 1568 | /* calculate mac80211 ampdu sw queue to wake */ |
1516 | int ampdu_q = | ||
1517 | scd_flow - priv->hw_params.first_ampdu_q + priv->hw->queues; | ||
1518 | int freed = iwl_tx_queue_reclaim(priv, scd_flow, index); | 1569 | int freed = iwl_tx_queue_reclaim(priv, scd_flow, index); |
1519 | priv->stations[ba_resp->sta_id]. | 1570 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
1520 | tid[ba_resp->tid].tfds_in_queue -= freed; | 1571 | |
1521 | if (iwl_queue_space(&txq->q) > txq->q.low_mark && | 1572 | if ((iwl_queue_space(&txq->q) > txq->q.low_mark) && |
1522 | priv->mac80211_registered && | 1573 | priv->mac80211_registered && |
1523 | agg->state != IWL_EMPTYING_HW_QUEUE_DELBA) | 1574 | (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) |
1524 | ieee80211_wake_queue(priv->hw, ampdu_q); | 1575 | ieee80211_wake_queue(priv->hw, txq->swq_id); |
1525 | 1576 | ||
1526 | iwl_txq_check_empty(priv, ba_resp->sta_id, | 1577 | iwl_txq_check_empty(priv, sta_id, tid, scd_flow); |
1527 | ba_resp->tid, scd_flow); | ||
1528 | } | 1578 | } |
1529 | } | 1579 | } |
1530 | EXPORT_SYMBOL(iwl_rx_reply_compressed_ba); | 1580 | EXPORT_SYMBOL(iwl_rx_reply_compressed_ba); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 45a6b0c35695..d64580805d6e 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * file called LICENSE. | 22 | * file called LICENSE. |
23 | * | 23 | * |
24 | * Contact Information: | 24 | * Contact Information: |
25 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/if_arp.h> | 41 | #include <linux/if_arp.h> |
42 | 42 | ||
43 | #include <net/ieee80211_radiotap.h> | 43 | #include <net/ieee80211_radiotap.h> |
44 | #include <net/lib80211.h> | ||
44 | #include <net/mac80211.h> | 45 | #include <net/mac80211.h> |
45 | 46 | ||
46 | #include <asm/div64.h> | 47 | #include <asm/div64.h> |
@@ -64,11 +65,10 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, | |||
64 | 65 | ||
65 | /* module parameters */ | 66 | /* module parameters */ |
66 | static int iwl3945_param_disable_hw_scan; /* def: 0 = use 3945's h/w scan */ | 67 | static int iwl3945_param_disable_hw_scan; /* def: 0 = use 3945's h/w scan */ |
67 | static int iwl3945_param_debug; /* def: 0 = minimal debug log messages */ | 68 | static u32 iwl3945_param_debug; /* def: 0 = minimal debug log messages */ |
68 | static int iwl3945_param_disable; /* def: 0 = enable radio */ | 69 | static int iwl3945_param_disable; /* def: 0 = enable radio */ |
69 | static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ | 70 | static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ |
70 | int iwl3945_param_hwcrypto; /* def: 0 = use software encryption */ | 71 | int iwl3945_param_hwcrypto; /* def: 0 = use software encryption */ |
71 | static int iwl3945_param_qos_enable = 1; /* def: 1 = use quality of service */ | ||
72 | int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */ | 72 | int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */ |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -93,12 +93,13 @@ int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */ | |||
93 | 93 | ||
94 | #define IWLWIFI_VERSION "1.2.26k" VD VS | 94 | #define IWLWIFI_VERSION "1.2.26k" VD VS |
95 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" | 95 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" |
96 | #define DRV_AUTHOR "<ilw@linux.intel.com>" | ||
96 | #define DRV_VERSION IWLWIFI_VERSION | 97 | #define DRV_VERSION IWLWIFI_VERSION |
97 | 98 | ||
98 | 99 | ||
99 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | 100 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
100 | MODULE_VERSION(DRV_VERSION); | 101 | MODULE_VERSION(DRV_VERSION); |
101 | MODULE_AUTHOR(DRV_COPYRIGHT); | 102 | MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); |
102 | MODULE_LICENSE("GPL"); | 103 | MODULE_LICENSE("GPL"); |
103 | 104 | ||
104 | static const struct ieee80211_supported_band *iwl3945_get_band( | 105 | static const struct ieee80211_supported_band *iwl3945_get_band( |
@@ -107,46 +108,6 @@ static const struct ieee80211_supported_band *iwl3945_get_band( | |||
107 | return priv->hw->wiphy->bands[band]; | 108 | return priv->hw->wiphy->bands[band]; |
108 | } | 109 | } |
109 | 110 | ||
110 | static int iwl3945_is_empty_essid(const char *essid, int essid_len) | ||
111 | { | ||
112 | /* Single white space is for Linksys APs */ | ||
113 | if (essid_len == 1 && essid[0] == ' ') | ||
114 | return 1; | ||
115 | |||
116 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ | ||
117 | while (essid_len) { | ||
118 | essid_len--; | ||
119 | if (essid[essid_len] != '\0') | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | return 1; | ||
124 | } | ||
125 | |||
126 | static const char *iwl3945_escape_essid(const char *essid, u8 essid_len) | ||
127 | { | ||
128 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
129 | const char *s = essid; | ||
130 | char *d = escaped; | ||
131 | |||
132 | if (iwl3945_is_empty_essid(essid, essid_len)) { | ||
133 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
134 | return escaped; | ||
135 | } | ||
136 | |||
137 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
138 | while (essid_len--) { | ||
139 | if (*s == '\0') { | ||
140 | *d++ = '\\'; | ||
141 | *d++ = '0'; | ||
142 | s++; | ||
143 | } else | ||
144 | *d++ = *s++; | ||
145 | } | ||
146 | *d = '\0'; | ||
147 | return escaped; | ||
148 | } | ||
149 | |||
150 | /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** | 111 | /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** |
151 | * DMA services | 112 | * DMA services |
152 | * | 113 | * |
@@ -446,7 +407,6 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 | |||
446 | int index = IWL_INVALID_STATION; | 407 | int index = IWL_INVALID_STATION; |
447 | struct iwl3945_station_entry *station; | 408 | struct iwl3945_station_entry *station; |
448 | unsigned long flags_spin; | 409 | unsigned long flags_spin; |
449 | DECLARE_MAC_BUF(mac); | ||
450 | u8 rate; | 410 | u8 rate; |
451 | 411 | ||
452 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 412 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
@@ -480,7 +440,7 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 | |||
480 | return index; | 440 | return index; |
481 | } | 441 | } |
482 | 442 | ||
483 | IWL_DEBUG_ASSOC("Add STA ID %d: %s\n", index, print_mac(mac, addr)); | 443 | IWL_DEBUG_ASSOC("Add STA ID %d: %pM\n", index, addr); |
484 | station = &priv->stations[index]; | 444 | station = &priv->stations[index]; |
485 | station->used = 1; | 445 | station->used = 1; |
486 | priv->num_stations++; | 446 | priv->num_stations++; |
@@ -559,7 +519,7 @@ static inline int iwl3945_is_ready_rf(struct iwl3945_priv *priv) | |||
559 | 519 | ||
560 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ | 520 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ |
561 | 521 | ||
562 | #define IWL_CMD(x) case x : return #x | 522 | #define IWL_CMD(x) case x: return #x |
563 | 523 | ||
564 | static const char *get_cmd_string(u8 cmd) | 524 | static const char *get_cmd_string(u8 cmd) |
565 | { | 525 | { |
@@ -1063,7 +1023,6 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv) | |||
1063 | /* cast away the const for active_rxon in this function */ | 1023 | /* cast away the const for active_rxon in this function */ |
1064 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 1024 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; |
1065 | int rc = 0; | 1025 | int rc = 0; |
1066 | DECLARE_MAC_BUF(mac); | ||
1067 | 1026 | ||
1068 | if (!iwl3945_is_alive(priv)) | 1027 | if (!iwl3945_is_alive(priv)) |
1069 | return -1; | 1028 | return -1; |
@@ -1124,11 +1083,11 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv) | |||
1124 | IWL_DEBUG_INFO("Sending RXON\n" | 1083 | IWL_DEBUG_INFO("Sending RXON\n" |
1125 | "* with%s RXON_FILTER_ASSOC_MSK\n" | 1084 | "* with%s RXON_FILTER_ASSOC_MSK\n" |
1126 | "* channel = %d\n" | 1085 | "* channel = %d\n" |
1127 | "* bssid = %s\n", | 1086 | "* bssid = %pM\n", |
1128 | ((priv->staging_rxon.filter_flags & | 1087 | ((priv->staging_rxon.filter_flags & |
1129 | RXON_FILTER_ASSOC_MSK) ? "" : "out"), | 1088 | RXON_FILTER_ASSOC_MSK) ? "" : "out"), |
1130 | le16_to_cpu(priv->staging_rxon.channel), | 1089 | le16_to_cpu(priv->staging_rxon.channel), |
1131 | print_mac(mac, priv->staging_rxon.bssid_addr)); | 1090 | priv->staging_rxon.bssid_addr); |
1132 | 1091 | ||
1133 | /* Apply the new configuration */ | 1092 | /* Apply the new configuration */ |
1134 | rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON, | 1093 | rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON, |
@@ -1443,7 +1402,7 @@ static void iwl3945_free_frame(struct iwl3945_priv *priv, struct iwl3945_frame * | |||
1443 | 1402 | ||
1444 | unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, | 1403 | unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, |
1445 | struct ieee80211_hdr *hdr, | 1404 | struct ieee80211_hdr *hdr, |
1446 | const u8 *dest, int left) | 1405 | int left) |
1447 | { | 1406 | { |
1448 | 1407 | ||
1449 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || | 1408 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || |
@@ -1459,9 +1418,16 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, | |||
1459 | return priv->ibss_beacon->len; | 1418 | return priv->ibss_beacon->len; |
1460 | } | 1419 | } |
1461 | 1420 | ||
1462 | static u8 iwl3945_rate_get_lowest_plcp(int rate_mask) | 1421 | static u8 iwl3945_rate_get_lowest_plcp(struct iwl3945_priv *priv) |
1463 | { | 1422 | { |
1464 | u8 i; | 1423 | u8 i; |
1424 | int rate_mask; | ||
1425 | |||
1426 | /* Set rate mask*/ | ||
1427 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) | ||
1428 | rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK; | ||
1429 | else | ||
1430 | rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK; | ||
1465 | 1431 | ||
1466 | for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; | 1432 | for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; |
1467 | i = iwl3945_rates[i].next_ieee) { | 1433 | i = iwl3945_rates[i].next_ieee) { |
@@ -1469,7 +1435,11 @@ static u8 iwl3945_rate_get_lowest_plcp(int rate_mask) | |||
1469 | return iwl3945_rates[i].plcp; | 1435 | return iwl3945_rates[i].plcp; |
1470 | } | 1436 | } |
1471 | 1437 | ||
1472 | return IWL_RATE_INVALID; | 1438 | /* No valid rate was found. Assign the lowest one */ |
1439 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) | ||
1440 | return IWL_RATE_1M_PLCP; | ||
1441 | else | ||
1442 | return IWL_RATE_6M_PLCP; | ||
1473 | } | 1443 | } |
1474 | 1444 | ||
1475 | static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv) | 1445 | static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv) |
@@ -1487,16 +1457,7 @@ static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv) | |||
1487 | return -ENOMEM; | 1457 | return -ENOMEM; |
1488 | } | 1458 | } |
1489 | 1459 | ||
1490 | if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { | 1460 | rate = iwl3945_rate_get_lowest_plcp(priv); |
1491 | rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & | ||
1492 | 0xFF0); | ||
1493 | if (rate == IWL_INVALID_RATE) | ||
1494 | rate = IWL_RATE_6M_PLCP; | ||
1495 | } else { | ||
1496 | rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); | ||
1497 | if (rate == IWL_INVALID_RATE) | ||
1498 | rate = IWL_RATE_1M_PLCP; | ||
1499 | } | ||
1500 | 1461 | ||
1501 | frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); | 1462 | frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); |
1502 | 1463 | ||
@@ -1544,10 +1505,8 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) | |||
1544 | { | 1505 | { |
1545 | u16 *e = (u16 *)&priv->eeprom; | 1506 | u16 *e = (u16 *)&priv->eeprom; |
1546 | u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); | 1507 | u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); |
1547 | u32 r; | ||
1548 | int sz = sizeof(priv->eeprom); | 1508 | int sz = sizeof(priv->eeprom); |
1549 | int rc; | 1509 | int ret; |
1550 | int i; | ||
1551 | u16 addr; | 1510 | u16 addr; |
1552 | 1511 | ||
1553 | /* The EEPROM structure has several padding buffers within it | 1512 | /* The EEPROM structure has several padding buffers within it |
@@ -1562,29 +1521,28 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) | |||
1562 | } | 1521 | } |
1563 | 1522 | ||
1564 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ | 1523 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ |
1565 | rc = iwl3945_eeprom_acquire_semaphore(priv); | 1524 | ret = iwl3945_eeprom_acquire_semaphore(priv); |
1566 | if (rc < 0) { | 1525 | if (ret < 0) { |
1567 | IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); | 1526 | IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); |
1568 | return -ENOENT; | 1527 | return -ENOENT; |
1569 | } | 1528 | } |
1570 | 1529 | ||
1571 | /* eeprom is an array of 16bit values */ | 1530 | /* eeprom is an array of 16bit values */ |
1572 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 1531 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
1573 | _iwl3945_write32(priv, CSR_EEPROM_REG, addr << 1); | 1532 | u32 r; |
1574 | _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); | ||
1575 | |||
1576 | for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; | ||
1577 | i += IWL_EEPROM_ACCESS_DELAY) { | ||
1578 | r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG); | ||
1579 | if (r & CSR_EEPROM_REG_READ_VALID_MSK) | ||
1580 | break; | ||
1581 | udelay(IWL_EEPROM_ACCESS_DELAY); | ||
1582 | } | ||
1583 | 1533 | ||
1584 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { | 1534 | _iwl3945_write32(priv, CSR_EEPROM_REG, |
1535 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); | ||
1536 | _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); | ||
1537 | ret = iwl3945_poll_direct_bit(priv, CSR_EEPROM_REG, | ||
1538 | CSR_EEPROM_REG_READ_VALID_MSK, | ||
1539 | IWL_EEPROM_ACCESS_TIMEOUT); | ||
1540 | if (ret < 0) { | ||
1585 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); | 1541 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); |
1586 | return -ETIMEDOUT; | 1542 | return ret; |
1587 | } | 1543 | } |
1544 | |||
1545 | r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG); | ||
1588 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 1546 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); |
1589 | } | 1547 | } |
1590 | 1548 | ||
@@ -1634,7 +1592,7 @@ static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate, | |||
1634 | */ | 1592 | */ |
1635 | static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv, | 1593 | static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv, |
1636 | struct ieee80211_mgmt *frame, | 1594 | struct ieee80211_mgmt *frame, |
1637 | int left, int is_direct) | 1595 | int left) |
1638 | { | 1596 | { |
1639 | int len = 0; | 1597 | int len = 0; |
1640 | u8 *pos = NULL; | 1598 | u8 *pos = NULL; |
@@ -1664,20 +1622,6 @@ static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv, | |||
1664 | *pos++ = WLAN_EID_SSID; | 1622 | *pos++ = WLAN_EID_SSID; |
1665 | *pos++ = 0; | 1623 | *pos++ = 0; |
1666 | 1624 | ||
1667 | /* fill in our direct SSID IE... */ | ||
1668 | if (is_direct) { | ||
1669 | /* ...next IE... */ | ||
1670 | left -= 2 + priv->essid_len; | ||
1671 | if (left < 0) | ||
1672 | return 0; | ||
1673 | /* ... fill it in... */ | ||
1674 | *pos++ = WLAN_EID_SSID; | ||
1675 | *pos++ = priv->essid_len; | ||
1676 | memcpy(pos, priv->essid, priv->essid_len); | ||
1677 | pos += priv->essid_len; | ||
1678 | len += 2 + priv->essid_len; | ||
1679 | } | ||
1680 | |||
1681 | /* fill in supported rate */ | 1625 | /* fill in supported rate */ |
1682 | /* ...next IE... */ | 1626 | /* ...next IE... */ |
1683 | left -= 2; | 1627 | left -= 2; |
@@ -1746,17 +1690,21 @@ static void iwl3945_reset_qos(struct iwl3945_priv *priv) | |||
1746 | spin_lock_irqsave(&priv->lock, flags); | 1690 | spin_lock_irqsave(&priv->lock, flags); |
1747 | priv->qos_data.qos_active = 0; | 1691 | priv->qos_data.qos_active = 0; |
1748 | 1692 | ||
1749 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { | 1693 | /* QoS always active in AP and ADHOC mode |
1750 | if (priv->qos_data.qos_enable) | 1694 | * In STA mode wait for association |
1751 | priv->qos_data.qos_active = 1; | 1695 | */ |
1752 | if (!(priv->active_rate & 0xfff0)) { | 1696 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC || |
1753 | cw_min = 31; | 1697 | priv->iw_mode == NL80211_IFTYPE_AP) |
1754 | is_legacy = 1; | 1698 | priv->qos_data.qos_active = 1; |
1755 | } | 1699 | else |
1756 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { | 1700 | priv->qos_data.qos_active = 0; |
1757 | if (priv->qos_data.qos_enable) | 1701 | |
1758 | priv->qos_data.qos_active = 1; | 1702 | |
1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | 1703 | /* check for legacy mode */ |
1704 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
1705 | (priv->active_rate & IWL_OFDM_RATES_MASK) == 0) || | ||
1706 | (priv->iw_mode == NL80211_IFTYPE_STATION && | ||
1707 | (priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK) == 0)) { | ||
1760 | cw_min = 31; | 1708 | cw_min = 31; |
1761 | is_legacy = 1; | 1709 | is_legacy = 1; |
1762 | } | 1710 | } |
@@ -1828,9 +1776,6 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) | |||
1828 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1776 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
1829 | return; | 1777 | return; |
1830 | 1778 | ||
1831 | if (!priv->qos_data.qos_enable) | ||
1832 | return; | ||
1833 | |||
1834 | spin_lock_irqsave(&priv->lock, flags); | 1779 | spin_lock_irqsave(&priv->lock, flags); |
1835 | priv->qos_data.def_qos_parm.qos_flags = 0; | 1780 | priv->qos_data.def_qos_parm.qos_flags = 0; |
1836 | 1781 | ||
@@ -1846,7 +1791,7 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) | |||
1846 | spin_unlock_irqrestore(&priv->lock, flags); | 1791 | spin_unlock_irqrestore(&priv->lock, flags); |
1847 | 1792 | ||
1848 | if (force || iwl3945_is_associated(priv)) { | 1793 | if (force || iwl3945_is_associated(priv)) { |
1849 | IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n", | 1794 | IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n", |
1850 | priv->qos_data.qos_active); | 1795 | priv->qos_data.qos_active); |
1851 | 1796 | ||
1852 | iwl3945_send_qos_params_command(priv, | 1797 | iwl3945_send_qos_params_command(priv, |
@@ -1870,7 +1815,7 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) | |||
1870 | 1815 | ||
1871 | 1816 | ||
1872 | /* default power management (not Tx power) table values */ | 1817 | /* default power management (not Tx power) table values */ |
1873 | /* for tim 0-10 */ | 1818 | /* for TIM 0-10 */ |
1874 | static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { | 1819 | static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { |
1875 | {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 1820 | {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
1876 | {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, | 1821 | {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, |
@@ -1880,7 +1825,7 @@ static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { | |||
1880 | {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 10)}, 1} | 1825 | {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 10)}, 1} |
1881 | }; | 1826 | }; |
1882 | 1827 | ||
1883 | /* for tim > 10 */ | 1828 | /* for TIM > 10 */ |
1884 | static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = { | 1829 | static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = { |
1885 | {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 1830 | {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
1886 | {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), | 1831 | {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), |
@@ -2156,11 +2101,6 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) | |||
2156 | 2101 | ||
2157 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) | 2102 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) |
2158 | { | 2103 | { |
2159 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2160 | IWL_ERROR("APs don't scan.\n"); | ||
2161 | return 0; | ||
2162 | } | ||
2163 | |||
2164 | if (!iwl3945_is_ready_rf(priv)) { | 2104 | if (!iwl3945_is_ready_rf(priv)) { |
2165 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); | 2105 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); |
2166 | return -EIO; | 2106 | return -EIO; |
@@ -2230,13 +2170,14 @@ static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, | |||
2230 | /* | 2170 | /* |
2231 | * initialize rxon structure with default values from eeprom | 2171 | * initialize rxon structure with default values from eeprom |
2232 | */ | 2172 | */ |
2233 | static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | 2173 | static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv, |
2174 | int mode) | ||
2234 | { | 2175 | { |
2235 | const struct iwl3945_channel_info *ch_info; | 2176 | const struct iwl3945_channel_info *ch_info; |
2236 | 2177 | ||
2237 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 2178 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
2238 | 2179 | ||
2239 | switch (priv->iw_mode) { | 2180 | switch (mode) { |
2240 | case NL80211_IFTYPE_AP: | 2181 | case NL80211_IFTYPE_AP: |
2241 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 2182 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
2242 | break; | 2183 | break; |
@@ -2259,7 +2200,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2259 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 2200 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
2260 | break; | 2201 | break; |
2261 | default: | 2202 | default: |
2262 | IWL_ERROR("Unsupported interface type %d\n", priv->iw_mode); | 2203 | IWL_ERROR("Unsupported interface type %d\n", mode); |
2263 | break; | 2204 | break; |
2264 | } | 2205 | } |
2265 | 2206 | ||
@@ -2282,8 +2223,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2282 | * in some case A channels are all non IBSS | 2223 | * in some case A channels are all non IBSS |
2283 | * in this case force B/G channel | 2224 | * in this case force B/G channel |
2284 | */ | 2225 | */ |
2285 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 2226 | if ((mode == NL80211_IFTYPE_ADHOC) && !(is_channel_ibss(ch_info))) |
2286 | !(is_channel_ibss(ch_info))) | ||
2287 | ch_info = &priv->channel_info[0]; | 2227 | ch_info = &priv->channel_info[0]; |
2288 | 2228 | ||
2289 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 2229 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); |
@@ -2316,14 +2256,12 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) | |||
2316 | } | 2256 | } |
2317 | } | 2257 | } |
2318 | 2258 | ||
2319 | priv->iw_mode = mode; | 2259 | iwl3945_connection_init_rx_config(priv, mode); |
2320 | |||
2321 | iwl3945_connection_init_rx_config(priv); | ||
2322 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 2260 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
2323 | 2261 | ||
2324 | iwl3945_clear_stations_table(priv); | 2262 | iwl3945_clear_stations_table(priv); |
2325 | 2263 | ||
2326 | /* dont commit rxon if rf-kill is on*/ | 2264 | /* don't commit rxon if rf-kill is on*/ |
2327 | if (!iwl3945_is_ready_rf(priv)) | 2265 | if (!iwl3945_is_ready_rf(priv)) |
2328 | return -EAGAIN; | 2266 | return -EAGAIN; |
2329 | 2267 | ||
@@ -2352,7 +2290,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, | |||
2352 | case ALG_CCMP: | 2290 | case ALG_CCMP: |
2353 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; | 2291 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; |
2354 | memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); | 2292 | memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); |
2355 | IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n"); | 2293 | IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n"); |
2356 | break; | 2294 | break; |
2357 | 2295 | ||
2358 | case ALG_TKIP: | 2296 | case ALG_TKIP: |
@@ -2397,6 +2335,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, | |||
2397 | { | 2335 | { |
2398 | __le16 fc = hdr->frame_control; | 2336 | __le16 fc = hdr->frame_control; |
2399 | __le32 tx_flags = cmd->cmd.tx.tx_flags; | 2337 | __le32 tx_flags = cmd->cmd.tx.tx_flags; |
2338 | u8 rc_flags = info->control.rates[0].flags; | ||
2400 | 2339 | ||
2401 | cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2340 | cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2402 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { | 2341 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { |
@@ -2423,10 +2362,10 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, | |||
2423 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 2362 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
2424 | } | 2363 | } |
2425 | 2364 | ||
2426 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { | 2365 | if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
2427 | tx_flags |= TX_CMD_FLG_RTS_MSK; | 2366 | tx_flags |= TX_CMD_FLG_RTS_MSK; |
2428 | tx_flags &= ~TX_CMD_FLG_CTS_MSK; | 2367 | tx_flags &= ~TX_CMD_FLG_CTS_MSK; |
2429 | } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { | 2368 | } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { |
2430 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; | 2369 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; |
2431 | tx_flags |= TX_CMD_FLG_CTS_MSK; | 2370 | tx_flags |= TX_CMD_FLG_CTS_MSK; |
2432 | } | 2371 | } |
@@ -2482,8 +2421,6 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2482 | /* If this frame is going out to an IBSS network, find the station, | 2421 | /* If this frame is going out to an IBSS network, find the station, |
2483 | * or create a new station table entry */ | 2422 | * or create a new station table entry */ |
2484 | case NL80211_IFTYPE_ADHOC: { | 2423 | case NL80211_IFTYPE_ADHOC: { |
2485 | DECLARE_MAC_BUF(mac); | ||
2486 | |||
2487 | /* Create new station table entry */ | 2424 | /* Create new station table entry */ |
2488 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 2425 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
2489 | if (sta_id != IWL_INVALID_STATION) | 2426 | if (sta_id != IWL_INVALID_STATION) |
@@ -2494,9 +2431,9 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2494 | if (sta_id != IWL_INVALID_STATION) | 2431 | if (sta_id != IWL_INVALID_STATION) |
2495 | return sta_id; | 2432 | return sta_id; |
2496 | 2433 | ||
2497 | IWL_DEBUG_DROP("Station %s not in station map. " | 2434 | IWL_DEBUG_DROP("Station %pM not in station map. " |
2498 | "Defaulting to broadcast...\n", | 2435 | "Defaulting to broadcast...\n", |
2499 | print_mac(mac, hdr->addr1)); | 2436 | hdr->addr1); |
2500 | iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 2437 | iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
2501 | return priv->hw_setting.bcast_sta_id; | 2438 | return priv->hw_setting.bcast_sta_id; |
2502 | } | 2439 | } |
@@ -2579,10 +2516,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2579 | /* Find (or create) index into station table for destination station */ | 2516 | /* Find (or create) index into station table for destination station */ |
2580 | sta_id = iwl3945_get_sta_id(priv, hdr); | 2517 | sta_id = iwl3945_get_sta_id(priv, hdr); |
2581 | if (sta_id == IWL_INVALID_STATION) { | 2518 | if (sta_id == IWL_INVALID_STATION) { |
2582 | DECLARE_MAC_BUF(mac); | 2519 | IWL_DEBUG_DROP("Dropping - INVALID STATION: %pM\n", |
2583 | 2520 | hdr->addr1); | |
2584 | IWL_DEBUG_DROP("Dropping - INVALID STATION: %s\n", | ||
2585 | print_mac(mac, hdr->addr1)); | ||
2586 | goto drop; | 2521 | goto drop; |
2587 | } | 2522 | } |
2588 | 2523 | ||
@@ -4019,8 +3954,6 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, | |||
4019 | #ifdef CONFIG_IWL3945_DEBUG | 3954 | #ifdef CONFIG_IWL3945_DEBUG |
4020 | static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) | 3955 | static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) |
4021 | { | 3956 | { |
4022 | DECLARE_MAC_BUF(mac); | ||
4023 | |||
4024 | IWL_DEBUG_RADIO("RX CONFIG:\n"); | 3957 | IWL_DEBUG_RADIO("RX CONFIG:\n"); |
4025 | iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 3958 | iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
4026 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); | 3959 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); |
@@ -4031,10 +3964,8 @@ static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) | |||
4031 | IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n", | 3964 | IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n", |
4032 | rxon->ofdm_basic_rates); | 3965 | rxon->ofdm_basic_rates); |
4033 | IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); | 3966 | IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); |
4034 | IWL_DEBUG_RADIO("u8[6] node_addr: %s\n", | 3967 | IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr); |
4035 | print_mac(mac, rxon->node_addr)); | 3968 | IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr); |
4036 | IWL_DEBUG_RADIO("u8[6] bssid_addr: %s\n", | ||
4037 | print_mac(mac, rxon->bssid_addr)); | ||
4038 | IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); | 3969 | IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); |
4039 | } | 3970 | } |
4040 | #endif | 3971 | #endif |
@@ -4050,7 +3981,7 @@ static void iwl3945_enable_interrupts(struct iwl3945_priv *priv) | |||
4050 | /* call this function to flush any scheduled tasklet */ | 3981 | /* call this function to flush any scheduled tasklet */ |
4051 | static inline void iwl_synchronize_irq(struct iwl3945_priv *priv) | 3982 | static inline void iwl_synchronize_irq(struct iwl3945_priv *priv) |
4052 | { | 3983 | { |
4053 | /* wait to make sure we flush pedding tasklet*/ | 3984 | /* wait to make sure we flush pending tasklet*/ |
4054 | synchronize_irq(priv->pci_dev->irq); | 3985 | synchronize_irq(priv->pci_dev->irq); |
4055 | tasklet_kill(&priv->irq_tasklet); | 3986 | tasklet_kill(&priv->irq_tasklet); |
4056 | } | 3987 | } |
@@ -4373,35 +4304,6 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) | |||
4373 | /* Safely ignore these bits for debug checks below */ | 4304 | /* Safely ignore these bits for debug checks below */ |
4374 | inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); | 4305 | inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); |
4375 | 4306 | ||
4376 | /* HW RF KILL switch toggled (4965 only) */ | ||
4377 | if (inta & CSR_INT_BIT_RF_KILL) { | ||
4378 | int hw_rf_kill = 0; | ||
4379 | if (!(iwl3945_read32(priv, CSR_GP_CNTRL) & | ||
4380 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) | ||
4381 | hw_rf_kill = 1; | ||
4382 | |||
4383 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL | IWL_DL_ISR, | ||
4384 | "RF_KILL bit toggled to %s.\n", | ||
4385 | hw_rf_kill ? "disable radio":"enable radio"); | ||
4386 | |||
4387 | /* Queue restart only if RF_KILL switch was set to "kill" | ||
4388 | * when we loaded driver, and is now set to "enable". | ||
4389 | * After we're Alive, RF_KILL gets handled by | ||
4390 | * iwl3945_rx_card_state_notif() */ | ||
4391 | if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) { | ||
4392 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | ||
4393 | queue_work(priv->workqueue, &priv->restart); | ||
4394 | } | ||
4395 | |||
4396 | handled |= CSR_INT_BIT_RF_KILL; | ||
4397 | } | ||
4398 | |||
4399 | /* Chip got too hot and stopped itself (4965 only) */ | ||
4400 | if (inta & CSR_INT_BIT_CT_KILL) { | ||
4401 | IWL_ERROR("Microcode CT kill error detected.\n"); | ||
4402 | handled |= CSR_INT_BIT_CT_KILL; | ||
4403 | } | ||
4404 | |||
4405 | /* Error detected by uCode */ | 4307 | /* Error detected by uCode */ |
4406 | if (inta & CSR_INT_BIT_SW_ERR) { | 4308 | if (inta & CSR_INT_BIT_SW_ERR) { |
4407 | IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", | 4309 | IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", |
@@ -4502,7 +4404,7 @@ static irqreturn_t iwl3945_isr(int irq, void *data) | |||
4502 | 4404 | ||
4503 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 4405 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
4504 | /* Hardware disappeared */ | 4406 | /* Hardware disappeared */ |
4505 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); | 4407 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%08x\n", inta); |
4506 | goto unplugged; | 4408 | goto unplugged; |
4507 | } | 4409 | } |
4508 | 4410 | ||
@@ -4805,7 +4707,7 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4805 | #define IWL_PASSIVE_DWELL_BASE (100) | 4707 | #define IWL_PASSIVE_DWELL_BASE (100) |
4806 | #define IWL_CHANNEL_TUNE_TIME 5 | 4708 | #define IWL_CHANNEL_TUNE_TIME 5 |
4807 | 4709 | ||
4808 | #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) | 4710 | #define IWL_SCAN_PROBE_MASK(n) (BIT(n) | (BIT(n) - BIT(1))) |
4809 | 4711 | ||
4810 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, | 4712 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, |
4811 | enum ieee80211_band band, | 4713 | enum ieee80211_band band, |
@@ -4876,17 +4778,33 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4876 | continue; | 4778 | continue; |
4877 | } | 4779 | } |
4878 | 4780 | ||
4781 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
4782 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
4783 | /* If passive , set up for auto-switch | ||
4784 | * and use long active_dwell time. | ||
4785 | */ | ||
4879 | if (!is_active || is_channel_passive(ch_info) || | 4786 | if (!is_active || is_channel_passive(ch_info) || |
4880 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) | 4787 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) { |
4881 | scan_ch->type = 0; /* passive */ | 4788 | scan_ch->type = 0; /* passive */ |
4882 | else | 4789 | if (IWL_UCODE_API(priv->ucode_ver) == 1) |
4790 | scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); | ||
4791 | } else { | ||
4883 | scan_ch->type = 1; /* active */ | 4792 | scan_ch->type = 1; /* active */ |
4793 | } | ||
4884 | 4794 | ||
4885 | if ((scan_ch->type & 1) && n_probes) | 4795 | /* Set direct probe bits. These may be used both for active |
4886 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); | 4796 | * scan channels (probes gets sent right away), |
4887 | 4797 | * or for passive channels (probes get se sent only after | |
4888 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 4798 | * hearing clear Rx packet).*/ |
4889 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | 4799 | if (IWL_UCODE_API(priv->ucode_ver) >= 2) { |
4800 | if (n_probes) | ||
4801 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); | ||
4802 | } else { | ||
4803 | /* uCode v1 does not allow setting direct probe bits on | ||
4804 | * passive channel. */ | ||
4805 | if ((scan_ch->type & 1) && n_probes) | ||
4806 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); | ||
4807 | } | ||
4890 | 4808 | ||
4891 | /* Set txpower levels to defaults */ | 4809 | /* Set txpower levels to defaults */ |
4892 | scan_ch->tpc.dsp_atten = 110; | 4810 | scan_ch->tpc.dsp_atten = 110; |
@@ -5387,25 +5305,41 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv) | |||
5387 | static int iwl3945_read_ucode(struct iwl3945_priv *priv) | 5305 | static int iwl3945_read_ucode(struct iwl3945_priv *priv) |
5388 | { | 5306 | { |
5389 | struct iwl3945_ucode *ucode; | 5307 | struct iwl3945_ucode *ucode; |
5390 | int ret = 0; | 5308 | int ret = -EINVAL, index; |
5391 | const struct firmware *ucode_raw; | 5309 | const struct firmware *ucode_raw; |
5392 | /* firmware file name contains uCode/driver compatibility version */ | 5310 | /* firmware file name contains uCode/driver compatibility version */ |
5393 | const char *name = priv->cfg->fw_name; | 5311 | const char *name_pre = priv->cfg->fw_name_pre; |
5312 | const unsigned int api_max = priv->cfg->ucode_api_max; | ||
5313 | const unsigned int api_min = priv->cfg->ucode_api_min; | ||
5314 | char buf[25]; | ||
5394 | u8 *src; | 5315 | u8 *src; |
5395 | size_t len; | 5316 | size_t len; |
5396 | u32 ver, inst_size, data_size, init_size, init_data_size, boot_size; | 5317 | u32 api_ver, inst_size, data_size, init_size, init_data_size, boot_size; |
5397 | 5318 | ||
5398 | /* Ask kernel firmware_class module to get the boot firmware off disk. | 5319 | /* Ask kernel firmware_class module to get the boot firmware off disk. |
5399 | * request_firmware() is synchronous, file is in memory on return. */ | 5320 | * request_firmware() is synchronous, file is in memory on return. */ |
5400 | ret = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); | 5321 | for (index = api_max; index >= api_min; index--) { |
5401 | if (ret < 0) { | 5322 | sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); |
5402 | IWL_ERROR("%s firmware file req failed: Reason %d\n", | 5323 | ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); |
5403 | name, ret); | 5324 | if (ret < 0) { |
5404 | goto error; | 5325 | IWL_ERROR("%s firmware file req failed: Reason %d\n", |
5326 | buf, ret); | ||
5327 | if (ret == -ENOENT) | ||
5328 | continue; | ||
5329 | else | ||
5330 | goto error; | ||
5331 | } else { | ||
5332 | if (index < api_max) | ||
5333 | IWL_ERROR("Loaded firmware %s, which is deprecated. Please use API v%u instead.\n", | ||
5334 | buf, api_max); | ||
5335 | IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n", | ||
5336 | buf, ucode_raw->size); | ||
5337 | break; | ||
5338 | } | ||
5405 | } | 5339 | } |
5406 | 5340 | ||
5407 | IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n", | 5341 | if (ret < 0) |
5408 | name, ucode_raw->size); | 5342 | goto error; |
5409 | 5343 | ||
5410 | /* Make sure that we got at least our header! */ | 5344 | /* Make sure that we got at least our header! */ |
5411 | if (ucode_raw->size < sizeof(*ucode)) { | 5345 | if (ucode_raw->size < sizeof(*ucode)) { |
@@ -5417,20 +5351,46 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) | |||
5417 | /* Data from ucode file: header followed by uCode images */ | 5351 | /* Data from ucode file: header followed by uCode images */ |
5418 | ucode = (void *)ucode_raw->data; | 5352 | ucode = (void *)ucode_raw->data; |
5419 | 5353 | ||
5420 | ver = le32_to_cpu(ucode->ver); | 5354 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
5355 | api_ver = IWL_UCODE_API(priv->ucode_ver); | ||
5421 | inst_size = le32_to_cpu(ucode->inst_size); | 5356 | inst_size = le32_to_cpu(ucode->inst_size); |
5422 | data_size = le32_to_cpu(ucode->data_size); | 5357 | data_size = le32_to_cpu(ucode->data_size); |
5423 | init_size = le32_to_cpu(ucode->init_size); | 5358 | init_size = le32_to_cpu(ucode->init_size); |
5424 | init_data_size = le32_to_cpu(ucode->init_data_size); | 5359 | init_data_size = le32_to_cpu(ucode->init_data_size); |
5425 | boot_size = le32_to_cpu(ucode->boot_size); | 5360 | boot_size = le32_to_cpu(ucode->boot_size); |
5426 | 5361 | ||
5427 | IWL_DEBUG_INFO("f/w package hdr ucode version = 0x%x\n", ver); | 5362 | /* api_ver should match the api version forming part of the |
5363 | * firmware filename ... but we don't check for that and only rely | ||
5364 | * on the API version read from firware header from here on forward */ | ||
5365 | |||
5366 | if (api_ver < api_min || api_ver > api_max) { | ||
5367 | IWL_ERROR("Driver unable to support your firmware API. " | ||
5368 | "Driver supports v%u, firmware is v%u.\n", | ||
5369 | api_max, api_ver); | ||
5370 | priv->ucode_ver = 0; | ||
5371 | ret = -EINVAL; | ||
5372 | goto err_release; | ||
5373 | } | ||
5374 | if (api_ver != api_max) | ||
5375 | IWL_ERROR("Firmware has old API version. Expected %u, " | ||
5376 | "got %u. New firmware can be obtained " | ||
5377 | "from http://www.intellinuxwireless.org.\n", | ||
5378 | api_max, api_ver); | ||
5379 | |||
5380 | printk(KERN_INFO DRV_NAME " loaded firmware version %u.%u.%u.%u\n", | ||
5381 | IWL_UCODE_MAJOR(priv->ucode_ver), | ||
5382 | IWL_UCODE_MINOR(priv->ucode_ver), | ||
5383 | IWL_UCODE_API(priv->ucode_ver), | ||
5384 | IWL_UCODE_SERIAL(priv->ucode_ver)); | ||
5385 | IWL_DEBUG_INFO("f/w package hdr ucode version raw = 0x%x\n", | ||
5386 | priv->ucode_ver); | ||
5428 | IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", inst_size); | 5387 | IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", inst_size); |
5429 | IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", data_size); | 5388 | IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", data_size); |
5430 | IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n", init_size); | 5389 | IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n", init_size); |
5431 | IWL_DEBUG_INFO("f/w package hdr init data size = %u\n", init_data_size); | 5390 | IWL_DEBUG_INFO("f/w package hdr init data size = %u\n", init_data_size); |
5432 | IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n", boot_size); | 5391 | IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n", boot_size); |
5433 | 5392 | ||
5393 | |||
5434 | /* Verify size of file vs. image size info in file's header */ | 5394 | /* Verify size of file vs. image size info in file's header */ |
5435 | if (ucode_raw->size < sizeof(*ucode) + | 5395 | if (ucode_raw->size < sizeof(*ucode) + |
5436 | inst_size + data_size + init_size + | 5396 | inst_size + data_size + init_size + |
@@ -5607,7 +5567,7 @@ static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv) | |||
5607 | iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | 5567 | iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, |
5608 | priv->ucode_data.len); | 5568 | priv->ucode_data.len); |
5609 | 5569 | ||
5610 | /* Inst bytecount must be last to set up, bit 31 signals uCode | 5570 | /* Inst byte count must be last to set up, bit 31 signals uCode |
5611 | * that all new ptr/size info is in place */ | 5571 | * that all new ptr/size info is in place */ |
5612 | iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | 5572 | iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, |
5613 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | 5573 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); |
@@ -5665,6 +5625,10 @@ static void iwl3945_init_alive_start(struct iwl3945_priv *priv) | |||
5665 | } | 5625 | } |
5666 | 5626 | ||
5667 | 5627 | ||
5628 | /* temporary */ | ||
5629 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, | ||
5630 | struct sk_buff *skb); | ||
5631 | |||
5668 | /** | 5632 | /** |
5669 | * iwl3945_alive_start - called after REPLY_ALIVE notification received | 5633 | * iwl3945_alive_start - called after REPLY_ALIVE notification received |
5670 | * from protocol/runtime uCode (initialization uCode's | 5634 | * from protocol/runtime uCode (initialization uCode's |
@@ -5699,7 +5663,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
5699 | 5663 | ||
5700 | rc = iwl3945_grab_nic_access(priv); | 5664 | rc = iwl3945_grab_nic_access(priv); |
5701 | if (rc) { | 5665 | if (rc) { |
5702 | IWL_WARNING("Can not read rfkill status from adapter\n"); | 5666 | IWL_WARNING("Can not read RFKILL status from adapter\n"); |
5703 | return; | 5667 | return; |
5704 | } | 5668 | } |
5705 | 5669 | ||
@@ -5709,7 +5673,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
5709 | 5673 | ||
5710 | if (rfkill & 0x1) { | 5674 | if (rfkill & 0x1) { |
5711 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 5675 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
5712 | /* if rfkill is not on, then wait for thermal | 5676 | /* if RFKILL is not on, then wait for thermal |
5713 | * sensor in adapter to kick in */ | 5677 | * sensor in adapter to kick in */ |
5714 | while (iwl3945_hw_get_temperature(priv) == 0) { | 5678 | while (iwl3945_hw_get_temperature(priv) == 0) { |
5715 | thermal_spin++; | 5679 | thermal_spin++; |
@@ -5747,7 +5711,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
5747 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 5711 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
5748 | } else { | 5712 | } else { |
5749 | /* Initialize our rx_config data */ | 5713 | /* Initialize our rx_config data */ |
5750 | iwl3945_connection_init_rx_config(priv); | 5714 | iwl3945_connection_init_rx_config(priv, priv->iw_mode); |
5751 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 5715 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
5752 | } | 5716 | } |
5753 | 5717 | ||
@@ -5768,6 +5732,14 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
5768 | if (priv->error_recovering) | 5732 | if (priv->error_recovering) |
5769 | iwl3945_error_recovery(priv); | 5733 | iwl3945_error_recovery(priv); |
5770 | 5734 | ||
5735 | /* reassociate for ADHOC mode */ | ||
5736 | if (priv->vif && (priv->iw_mode == NL80211_IFTYPE_ADHOC)) { | ||
5737 | struct sk_buff *beacon = ieee80211_beacon_get(priv->hw, | ||
5738 | priv->vif); | ||
5739 | if (beacon) | ||
5740 | iwl3945_mac_beacon_update(priv->hw, beacon); | ||
5741 | } | ||
5742 | |||
5771 | return; | 5743 | return; |
5772 | 5744 | ||
5773 | restart: | 5745 | restart: |
@@ -5902,7 +5874,7 @@ static int __iwl3945_up(struct iwl3945_priv *priv) | |||
5902 | } | 5874 | } |
5903 | 5875 | ||
5904 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | 5876 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { |
5905 | IWL_ERROR("ucode not available for device bringup\n"); | 5877 | IWL_ERROR("ucode not available for device bring up\n"); |
5906 | return -EIO; | 5878 | return -EIO; |
5907 | } | 5879 | } |
5908 | 5880 | ||
@@ -6046,24 +6018,6 @@ static void iwl3945_bg_rf_kill(struct work_struct *work) | |||
6046 | iwl3945_rfkill_set_hw_state(priv); | 6018 | iwl3945_rfkill_set_hw_state(priv); |
6047 | } | 6019 | } |
6048 | 6020 | ||
6049 | static void iwl3945_bg_set_monitor(struct work_struct *work) | ||
6050 | { | ||
6051 | struct iwl3945_priv *priv = container_of(work, | ||
6052 | struct iwl3945_priv, set_monitor); | ||
6053 | |||
6054 | IWL_DEBUG(IWL_DL_STATE, "setting monitor mode\n"); | ||
6055 | |||
6056 | mutex_lock(&priv->mutex); | ||
6057 | |||
6058 | if (!iwl3945_is_ready(priv)) | ||
6059 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); | ||
6060 | else | ||
6061 | if (iwl3945_set_mode(priv, NL80211_IFTYPE_MONITOR) != 0) | ||
6062 | IWL_ERROR("iwl3945_set_mode() failed\n"); | ||
6063 | |||
6064 | mutex_unlock(&priv->mutex); | ||
6065 | } | ||
6066 | |||
6067 | #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) | 6021 | #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) |
6068 | 6022 | ||
6069 | static void iwl3945_bg_scan_check(struct work_struct *data) | 6023 | static void iwl3945_bg_scan_check(struct work_struct *data) |
@@ -6101,6 +6055,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6101 | struct ieee80211_conf *conf = NULL; | 6055 | struct ieee80211_conf *conf = NULL; |
6102 | u8 n_probes = 2; | 6056 | u8 n_probes = 2; |
6103 | enum ieee80211_band band; | 6057 | enum ieee80211_band band; |
6058 | DECLARE_SSID_BUF(ssid); | ||
6104 | 6059 | ||
6105 | conf = ieee80211_get_hw_conf(priv->hw); | 6060 | conf = ieee80211_get_hw_conf(priv->hw); |
6106 | 6061 | ||
@@ -6111,7 +6066,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6111 | goto done; | 6066 | goto done; |
6112 | } | 6067 | } |
6113 | 6068 | ||
6114 | /* Make sure the scan wasn't cancelled before this queued work | 6069 | /* Make sure the scan wasn't canceled before this queued work |
6115 | * was given the chance to run... */ | 6070 | * was given the chance to run... */ |
6116 | if (!test_bit(STATUS_SCANNING, &priv->status)) | 6071 | if (!test_bit(STATUS_SCANNING, &priv->status)) |
6117 | goto done; | 6072 | goto done; |
@@ -6201,21 +6156,13 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6201 | if (priv->one_direct_scan) { | 6156 | if (priv->one_direct_scan) { |
6202 | IWL_DEBUG_SCAN | 6157 | IWL_DEBUG_SCAN |
6203 | ("Kicking off one direct scan for '%s'\n", | 6158 | ("Kicking off one direct scan for '%s'\n", |
6204 | iwl3945_escape_essid(priv->direct_ssid, | 6159 | print_ssid(ssid, priv->direct_ssid, |
6205 | priv->direct_ssid_len)); | 6160 | priv->direct_ssid_len)); |
6206 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6161 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6207 | scan->direct_scan[0].len = priv->direct_ssid_len; | 6162 | scan->direct_scan[0].len = priv->direct_ssid_len; |
6208 | memcpy(scan->direct_scan[0].ssid, | 6163 | memcpy(scan->direct_scan[0].ssid, |
6209 | priv->direct_ssid, priv->direct_ssid_len); | 6164 | priv->direct_ssid, priv->direct_ssid_len); |
6210 | n_probes++; | 6165 | n_probes++; |
6211 | } else if (!iwl3945_is_associated(priv) && priv->essid_len) { | ||
6212 | IWL_DEBUG_SCAN | ||
6213 | ("Kicking off one direct scan for '%s' when not associated\n", | ||
6214 | iwl3945_escape_essid(priv->essid, priv->essid_len)); | ||
6215 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
6216 | scan->direct_scan[0].len = priv->essid_len; | ||
6217 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | ||
6218 | n_probes++; | ||
6219 | } else | 6166 | } else |
6220 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); | 6167 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); |
6221 | 6168 | ||
@@ -6223,7 +6170,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6223 | * that based on the direct_mask added to each channel entry */ | 6170 | * that based on the direct_mask added to each channel entry */ |
6224 | scan->tx_cmd.len = cpu_to_le16( | 6171 | scan->tx_cmd.len = cpu_to_le16( |
6225 | iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, | 6172 | iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, |
6226 | IWL_MAX_SCAN_SIZE - sizeof(*scan), 0)); | 6173 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); |
6227 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 6174 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
6228 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; | 6175 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; |
6229 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 6176 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
@@ -6333,7 +6280,6 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6333 | { | 6280 | { |
6334 | int rc = 0; | 6281 | int rc = 0; |
6335 | struct ieee80211_conf *conf = NULL; | 6282 | struct ieee80211_conf *conf = NULL; |
6336 | DECLARE_MAC_BUF(mac); | ||
6337 | 6283 | ||
6338 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 6284 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
6339 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); | 6285 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); |
@@ -6341,9 +6287,8 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6341 | } | 6287 | } |
6342 | 6288 | ||
6343 | 6289 | ||
6344 | IWL_DEBUG_ASSOC("Associated as %d to: %s\n", | 6290 | IWL_DEBUG_ASSOC("Associated as %d to: %pM\n", |
6345 | priv->assoc_id, | 6291 | priv->assoc_id, priv->active_rxon.bssid_addr); |
6346 | print_mac(mac, priv->active_rxon.bssid_addr)); | ||
6347 | 6292 | ||
6348 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6293 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6349 | return; | 6294 | return; |
@@ -6398,10 +6343,7 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6398 | 6343 | ||
6399 | case NL80211_IFTYPE_ADHOC: | 6344 | case NL80211_IFTYPE_ADHOC: |
6400 | 6345 | ||
6401 | /* clear out the station table */ | 6346 | priv->assoc_id = 1; |
6402 | iwl3945_clear_stations_table(priv); | ||
6403 | |||
6404 | iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0); | ||
6405 | iwl3945_add_station(priv, priv->bssid, 0, 0); | 6347 | iwl3945_add_station(priv, priv->bssid, 0, 0); |
6406 | iwl3945_sync_sta(priv, IWL_STA_ID, | 6348 | iwl3945_sync_sta(priv, IWL_STA_ID, |
6407 | (priv->band == IEEE80211_BAND_5GHZ) ? | 6349 | (priv->band == IEEE80211_BAND_5GHZ) ? |
@@ -6439,7 +6381,7 @@ static void iwl3945_bg_abort_scan(struct work_struct *work) | |||
6439 | mutex_unlock(&priv->mutex); | 6381 | mutex_unlock(&priv->mutex); |
6440 | } | 6382 | } |
6441 | 6383 | ||
6442 | static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 6384 | static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed); |
6443 | 6385 | ||
6444 | static void iwl3945_bg_scan_completed(struct work_struct *work) | 6386 | static void iwl3945_bg_scan_completed(struct work_struct *work) |
6445 | { | 6387 | { |
@@ -6452,7 +6394,7 @@ static void iwl3945_bg_scan_completed(struct work_struct *work) | |||
6452 | return; | 6394 | return; |
6453 | 6395 | ||
6454 | if (test_bit(STATUS_CONF_PENDING, &priv->status)) | 6396 | if (test_bit(STATUS_CONF_PENDING, &priv->status)) |
6455 | iwl3945_mac_config(priv->hw, ieee80211_get_hw_conf(priv->hw)); | 6397 | iwl3945_mac_config(priv->hw, 0); |
6456 | 6398 | ||
6457 | ieee80211_scan_completed(priv->hw); | 6399 | ieee80211_scan_completed(priv->hw); |
6458 | 6400 | ||
@@ -6604,7 +6546,6 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | |||
6604 | { | 6546 | { |
6605 | struct iwl3945_priv *priv = hw->priv; | 6547 | struct iwl3945_priv *priv = hw->priv; |
6606 | unsigned long flags; | 6548 | unsigned long flags; |
6607 | DECLARE_MAC_BUF(mac); | ||
6608 | 6549 | ||
6609 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); | 6550 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
6610 | 6551 | ||
@@ -6615,13 +6556,14 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | |||
6615 | 6556 | ||
6616 | spin_lock_irqsave(&priv->lock, flags); | 6557 | spin_lock_irqsave(&priv->lock, flags); |
6617 | priv->vif = conf->vif; | 6558 | priv->vif = conf->vif; |
6559 | priv->iw_mode = conf->type; | ||
6618 | 6560 | ||
6619 | spin_unlock_irqrestore(&priv->lock, flags); | 6561 | spin_unlock_irqrestore(&priv->lock, flags); |
6620 | 6562 | ||
6621 | mutex_lock(&priv->mutex); | 6563 | mutex_lock(&priv->mutex); |
6622 | 6564 | ||
6623 | if (conf->mac_addr) { | 6565 | if (conf->mac_addr) { |
6624 | IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr)); | 6566 | IWL_DEBUG_MAC80211("Set: %pM\n", conf->mac_addr); |
6625 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | 6567 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); |
6626 | } | 6568 | } |
6627 | 6569 | ||
@@ -6641,10 +6583,11 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | |||
6641 | * be set inappropriately and the driver currently sets the hardware up to | 6583 | * be set inappropriately and the driver currently sets the hardware up to |
6642 | * use it whenever needed. | 6584 | * use it whenever needed. |
6643 | */ | 6585 | */ |
6644 | static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | 6586 | static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed) |
6645 | { | 6587 | { |
6646 | struct iwl3945_priv *priv = hw->priv; | 6588 | struct iwl3945_priv *priv = hw->priv; |
6647 | const struct iwl3945_channel_info *ch_info; | 6589 | const struct iwl3945_channel_info *ch_info; |
6590 | struct ieee80211_conf *conf = &hw->conf; | ||
6648 | unsigned long flags; | 6591 | unsigned long flags; |
6649 | int ret = 0; | 6592 | int ret = 0; |
6650 | 6593 | ||
@@ -6782,16 +6725,11 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) | |||
6782 | * clear sta table, add BCAST sta... */ | 6725 | * clear sta table, add BCAST sta... */ |
6783 | } | 6726 | } |
6784 | 6727 | ||
6785 | /* temporary */ | ||
6786 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); | ||
6787 | |||
6788 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | 6728 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, |
6789 | struct ieee80211_vif *vif, | 6729 | struct ieee80211_vif *vif, |
6790 | struct ieee80211_if_conf *conf) | 6730 | struct ieee80211_if_conf *conf) |
6791 | { | 6731 | { |
6792 | struct iwl3945_priv *priv = hw->priv; | 6732 | struct iwl3945_priv *priv = hw->priv; |
6793 | DECLARE_MAC_BUF(mac); | ||
6794 | unsigned long flags; | ||
6795 | int rc; | 6733 | int rc; |
6796 | 6734 | ||
6797 | if (conf == NULL) | 6735 | if (conf == NULL) |
@@ -6808,28 +6746,20 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6808 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 6746 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
6809 | if (!beacon) | 6747 | if (!beacon) |
6810 | return -ENOMEM; | 6748 | return -ENOMEM; |
6749 | mutex_lock(&priv->mutex); | ||
6811 | rc = iwl3945_mac_beacon_update(hw, beacon); | 6750 | rc = iwl3945_mac_beacon_update(hw, beacon); |
6751 | mutex_unlock(&priv->mutex); | ||
6812 | if (rc) | 6752 | if (rc) |
6813 | return rc; | 6753 | return rc; |
6814 | } | 6754 | } |
6815 | 6755 | ||
6816 | /* XXX: this MUST use conf->mac_addr */ | ||
6817 | |||
6818 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && | ||
6819 | (!conf->ssid_len)) { | ||
6820 | IWL_DEBUG_MAC80211 | ||
6821 | ("Leaving in AP mode because HostAPD is not ready.\n"); | ||
6822 | return 0; | ||
6823 | } | ||
6824 | |||
6825 | if (!iwl3945_is_alive(priv)) | 6756 | if (!iwl3945_is_alive(priv)) |
6826 | return -EAGAIN; | 6757 | return -EAGAIN; |
6827 | 6758 | ||
6828 | mutex_lock(&priv->mutex); | 6759 | mutex_lock(&priv->mutex); |
6829 | 6760 | ||
6830 | if (conf->bssid) | 6761 | if (conf->bssid) |
6831 | IWL_DEBUG_MAC80211("bssid: %s\n", | 6762 | IWL_DEBUG_MAC80211("bssid: %pM\n", conf->bssid); |
6832 | print_mac(mac, conf->bssid)); | ||
6833 | 6763 | ||
6834 | /* | 6764 | /* |
6835 | * very dubious code was here; the probe filtering flag is never set: | 6765 | * very dubious code was here; the probe filtering flag is never set: |
@@ -6842,8 +6772,8 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6842 | if (!conf->bssid) { | 6772 | if (!conf->bssid) { |
6843 | conf->bssid = priv->mac_addr; | 6773 | conf->bssid = priv->mac_addr; |
6844 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 6774 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
6845 | IWL_DEBUG_MAC80211("bssid was set to: %s\n", | 6775 | IWL_DEBUG_MAC80211("bssid was set to: %pM\n", |
6846 | print_mac(mac, conf->bssid)); | 6776 | conf->bssid); |
6847 | } | 6777 | } |
6848 | if (priv->ibss_beacon) | 6778 | if (priv->ibss_beacon) |
6849 | dev_kfree_skb(priv->ibss_beacon); | 6779 | dev_kfree_skb(priv->ibss_beacon); |
@@ -6889,15 +6819,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6889 | } | 6819 | } |
6890 | 6820 | ||
6891 | done: | 6821 | done: |
6892 | spin_lock_irqsave(&priv->lock, flags); | ||
6893 | if (!conf->ssid_len) | ||
6894 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | ||
6895 | else | ||
6896 | memcpy(priv->essid, conf->ssid, conf->ssid_len); | ||
6897 | |||
6898 | priv->essid_len = conf->ssid_len; | ||
6899 | spin_unlock_irqrestore(&priv->lock, flags); | ||
6900 | |||
6901 | IWL_DEBUG_MAC80211("leave\n"); | 6822 | IWL_DEBUG_MAC80211("leave\n"); |
6902 | mutex_unlock(&priv->mutex); | 6823 | mutex_unlock(&priv->mutex); |
6903 | 6824 | ||
@@ -6910,16 +6831,43 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, | |||
6910 | int mc_count, struct dev_addr_list *mc_list) | 6831 | int mc_count, struct dev_addr_list *mc_list) |
6911 | { | 6832 | { |
6912 | struct iwl3945_priv *priv = hw->priv; | 6833 | struct iwl3945_priv *priv = hw->priv; |
6834 | __le32 *filter_flags = &priv->staging_rxon.filter_flags; | ||
6913 | 6835 | ||
6914 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 6836 | IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n", |
6915 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 6837 | changed_flags, *total_flags); |
6916 | NL80211_IFTYPE_MONITOR, | 6838 | |
6917 | changed_flags, *total_flags); | 6839 | if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { |
6918 | /* queue work 'cuz mac80211 is holding a lock which | 6840 | if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) |
6919 | * prevents us from issuing (synchronous) f/w cmds */ | 6841 | *filter_flags |= RXON_FILTER_PROMISC_MSK; |
6920 | queue_work(priv->workqueue, &priv->set_monitor); | 6842 | else |
6843 | *filter_flags &= ~RXON_FILTER_PROMISC_MSK; | ||
6921 | } | 6844 | } |
6922 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | | 6845 | if (changed_flags & FIF_ALLMULTI) { |
6846 | if (*total_flags & FIF_ALLMULTI) | ||
6847 | *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK; | ||
6848 | else | ||
6849 | *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK; | ||
6850 | } | ||
6851 | if (changed_flags & FIF_CONTROL) { | ||
6852 | if (*total_flags & FIF_CONTROL) | ||
6853 | *filter_flags |= RXON_FILTER_CTL2HOST_MSK; | ||
6854 | else | ||
6855 | *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK; | ||
6856 | } | ||
6857 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | ||
6858 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | ||
6859 | *filter_flags |= RXON_FILTER_BCON_AWARE_MSK; | ||
6860 | else | ||
6861 | *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK; | ||
6862 | } | ||
6863 | |||
6864 | /* We avoid iwl_commit_rxon here to commit the new filter flags | ||
6865 | * since mac80211 will call ieee80211_hw_config immediately. | ||
6866 | * (mc_list is not supported at this time). Otherwise, we need to | ||
6867 | * queue a background iwl_commit_rxon work. | ||
6868 | */ | ||
6869 | |||
6870 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | ||
6923 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 6871 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
6924 | } | 6872 | } |
6925 | 6873 | ||
@@ -6940,8 +6888,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | |||
6940 | if (priv->vif == conf->vif) { | 6888 | if (priv->vif == conf->vif) { |
6941 | priv->vif = NULL; | 6889 | priv->vif = NULL; |
6942 | memset(priv->bssid, 0, ETH_ALEN); | 6890 | memset(priv->bssid, 0, ETH_ALEN); |
6943 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | ||
6944 | priv->essid_len = 0; | ||
6945 | } | 6891 | } |
6946 | mutex_unlock(&priv->mutex); | 6892 | mutex_unlock(&priv->mutex); |
6947 | 6893 | ||
@@ -7010,6 +6956,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7010 | int rc = 0; | 6956 | int rc = 0; |
7011 | unsigned long flags; | 6957 | unsigned long flags; |
7012 | struct iwl3945_priv *priv = hw->priv; | 6958 | struct iwl3945_priv *priv = hw->priv; |
6959 | DECLARE_SSID_BUF(ssid_buf); | ||
7013 | 6960 | ||
7014 | IWL_DEBUG_MAC80211("enter\n"); | 6961 | IWL_DEBUG_MAC80211("enter\n"); |
7015 | 6962 | ||
@@ -7022,12 +6969,6 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7022 | goto out_unlock; | 6969 | goto out_unlock; |
7023 | } | 6970 | } |
7024 | 6971 | ||
7025 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ | ||
7026 | rc = -EIO; | ||
7027 | IWL_ERROR("ERROR: APs don't scan\n"); | ||
7028 | goto out_unlock; | ||
7029 | } | ||
7030 | |||
7031 | /* we don't schedule scan within next_scan_jiffies period */ | 6972 | /* we don't schedule scan within next_scan_jiffies period */ |
7032 | if (priv->next_scan_jiffies && | 6973 | if (priv->next_scan_jiffies && |
7033 | time_after(priv->next_scan_jiffies, jiffies)) { | 6974 | time_after(priv->next_scan_jiffies, jiffies)) { |
@@ -7043,7 +6984,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7043 | } | 6984 | } |
7044 | if (len) { | 6985 | if (len) { |
7045 | IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", | 6986 | IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", |
7046 | iwl3945_escape_essid(ssid, len), (int)len); | 6987 | print_ssid(ssid_buf, ssid, len), (int)len); |
7047 | 6988 | ||
7048 | priv->one_direct_scan = 1; | 6989 | priv->one_direct_scan = 1; |
7049 | priv->direct_ssid_len = (u8) | 6990 | priv->direct_ssid_len = (u8) |
@@ -7084,10 +7025,8 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7084 | 7025 | ||
7085 | sta_id = iwl3945_hw_find_station(priv, addr); | 7026 | sta_id = iwl3945_hw_find_station(priv, addr); |
7086 | if (sta_id == IWL_INVALID_STATION) { | 7027 | if (sta_id == IWL_INVALID_STATION) { |
7087 | DECLARE_MAC_BUF(mac); | 7028 | IWL_DEBUG_MAC80211("leave - %pM not in station map.\n", |
7088 | 7029 | addr); | |
7089 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | ||
7090 | print_mac(mac, addr)); | ||
7091 | return -EINVAL; | 7030 | return -EINVAL; |
7092 | } | 7031 | } |
7093 | 7032 | ||
@@ -7143,11 +7082,6 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
7143 | return 0; | 7082 | return 0; |
7144 | } | 7083 | } |
7145 | 7084 | ||
7146 | if (!priv->qos_data.qos_enable) { | ||
7147 | priv->qos_data.qos_active = 0; | ||
7148 | IWL_DEBUG_MAC80211("leave - qos not enabled\n"); | ||
7149 | return 0; | ||
7150 | } | ||
7151 | q = AC_NUM - 1 - queue; | 7085 | q = AC_NUM - 1 - queue; |
7152 | 7086 | ||
7153 | spin_lock_irqsave(&priv->lock, flags); | 7087 | spin_lock_irqsave(&priv->lock, flags); |
@@ -7219,14 +7153,6 @@ static int iwl3945_mac_get_stats(struct ieee80211_hw *hw, | |||
7219 | return 0; | 7153 | return 0; |
7220 | } | 7154 | } |
7221 | 7155 | ||
7222 | static u64 iwl3945_mac_get_tsf(struct ieee80211_hw *hw) | ||
7223 | { | ||
7224 | IWL_DEBUG_MAC80211("enter\n"); | ||
7225 | IWL_DEBUG_MAC80211("leave\n"); | ||
7226 | |||
7227 | return 0; | ||
7228 | } | ||
7229 | |||
7230 | static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | 7156 | static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) |
7231 | { | 7157 | { |
7232 | struct iwl3945_priv *priv = hw->priv; | 7158 | struct iwl3945_priv *priv = hw->priv; |
@@ -7292,18 +7218,15 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7292 | struct iwl3945_priv *priv = hw->priv; | 7218 | struct iwl3945_priv *priv = hw->priv; |
7293 | unsigned long flags; | 7219 | unsigned long flags; |
7294 | 7220 | ||
7295 | mutex_lock(&priv->mutex); | ||
7296 | IWL_DEBUG_MAC80211("enter\n"); | 7221 | IWL_DEBUG_MAC80211("enter\n"); |
7297 | 7222 | ||
7298 | if (!iwl3945_is_ready_rf(priv)) { | 7223 | if (!iwl3945_is_ready_rf(priv)) { |
7299 | IWL_DEBUG_MAC80211("leave - RF not ready\n"); | 7224 | IWL_DEBUG_MAC80211("leave - RF not ready\n"); |
7300 | mutex_unlock(&priv->mutex); | ||
7301 | return -EIO; | 7225 | return -EIO; |
7302 | } | 7226 | } |
7303 | 7227 | ||
7304 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | 7228 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
7305 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 7229 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
7306 | mutex_unlock(&priv->mutex); | ||
7307 | return -EIO; | 7230 | return -EIO; |
7308 | } | 7231 | } |
7309 | 7232 | ||
@@ -7323,7 +7246,6 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7323 | 7246 | ||
7324 | iwl3945_post_associate(priv); | 7247 | iwl3945_post_associate(priv); |
7325 | 7248 | ||
7326 | mutex_unlock(&priv->mutex); | ||
7327 | 7249 | ||
7328 | return 0; | 7250 | return 0; |
7329 | } | 7251 | } |
@@ -7792,7 +7714,7 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); | |||
7792 | 7714 | ||
7793 | /***************************************************************************** | 7715 | /***************************************************************************** |
7794 | * | 7716 | * |
7795 | * driver setup and teardown | 7717 | * driver setup and tear down |
7796 | * | 7718 | * |
7797 | *****************************************************************************/ | 7719 | *****************************************************************************/ |
7798 | 7720 | ||
@@ -7810,7 +7732,6 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv) | |||
7810 | INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan); | 7732 | INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan); |
7811 | INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); | 7733 | INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); |
7812 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); | 7734 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); |
7813 | INIT_WORK(&priv->set_monitor, iwl3945_bg_set_monitor); | ||
7814 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); | 7735 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); |
7815 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); | 7736 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); |
7816 | INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); | 7737 | INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); |
@@ -7869,7 +7790,6 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
7869 | .get_stats = iwl3945_mac_get_stats, | 7790 | .get_stats = iwl3945_mac_get_stats, |
7870 | .get_tx_stats = iwl3945_mac_get_tx_stats, | 7791 | .get_tx_stats = iwl3945_mac_get_tx_stats, |
7871 | .conf_tx = iwl3945_mac_conf_tx, | 7792 | .conf_tx = iwl3945_mac_conf_tx, |
7872 | .get_tsf = iwl3945_mac_get_tsf, | ||
7873 | .reset_tsf = iwl3945_mac_reset_tsf, | 7793 | .reset_tsf = iwl3945_mac_reset_tsf, |
7874 | .bss_info_changed = iwl3945_bss_info_changed, | 7794 | .bss_info_changed = iwl3945_bss_info_changed, |
7875 | .hw_scan = iwl3945_mac_hw_scan | 7795 | .hw_scan = iwl3945_mac_hw_scan |
@@ -7882,7 +7802,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7882 | struct ieee80211_hw *hw; | 7802 | struct ieee80211_hw *hw; |
7883 | struct iwl_3945_cfg *cfg = (struct iwl_3945_cfg *)(ent->driver_data); | 7803 | struct iwl_3945_cfg *cfg = (struct iwl_3945_cfg *)(ent->driver_data); |
7884 | unsigned long flags; | 7804 | unsigned long flags; |
7885 | DECLARE_MAC_BUF(mac); | 7805 | |
7806 | /*********************** | ||
7807 | * 1. Allocating HW data | ||
7808 | * ********************/ | ||
7886 | 7809 | ||
7887 | /* Disabling hardware scan means that mac80211 will perform scans | 7810 | /* Disabling hardware scan means that mac80211 will perform scans |
7888 | * "the hard way", rather than using device's scan. */ | 7811 | * "the hard way", rather than using device's scan. */ |
@@ -7907,48 +7830,41 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7907 | err = -ENOMEM; | 7830 | err = -ENOMEM; |
7908 | goto out; | 7831 | goto out; |
7909 | } | 7832 | } |
7910 | SET_IEEE80211_DEV(hw, &pdev->dev); | ||
7911 | 7833 | ||
7912 | hw->rate_control_algorithm = "iwl-3945-rs"; | 7834 | SET_IEEE80211_DEV(hw, &pdev->dev); |
7913 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | ||
7914 | 7835 | ||
7915 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | ||
7916 | priv = hw->priv; | 7836 | priv = hw->priv; |
7917 | priv->hw = hw; | 7837 | priv->hw = hw; |
7918 | |||
7919 | priv->pci_dev = pdev; | 7838 | priv->pci_dev = pdev; |
7920 | priv->cfg = cfg; | 7839 | priv->cfg = cfg; |
7921 | 7840 | ||
7841 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | ||
7842 | hw->rate_control_algorithm = "iwl-3945-rs"; | ||
7843 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | ||
7844 | |||
7922 | /* Select antenna (may be helpful if only one antenna is connected) */ | 7845 | /* Select antenna (may be helpful if only one antenna is connected) */ |
7923 | priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; | 7846 | priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; |
7924 | #ifdef CONFIG_IWL3945_DEBUG | 7847 | #ifdef CONFIG_IWL3945_DEBUG |
7925 | iwl3945_debug_level = iwl3945_param_debug; | 7848 | iwl3945_debug_level = iwl3945_param_debug; |
7926 | atomic_set(&priv->restrict_refcnt, 0); | 7849 | atomic_set(&priv->restrict_refcnt, 0); |
7927 | #endif | 7850 | #endif |
7928 | priv->retry_rate = 1; | ||
7929 | |||
7930 | priv->ibss_beacon = NULL; | ||
7931 | 7851 | ||
7932 | /* Tell mac80211 our characteristics */ | 7852 | /* Tell mac80211 our characteristics */ |
7933 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 7853 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
7934 | IEEE80211_HW_NOISE_DBM; | 7854 | IEEE80211_HW_NOISE_DBM; |
7935 | 7855 | ||
7936 | hw->wiphy->interface_modes = | 7856 | hw->wiphy->interface_modes = |
7937 | BIT(NL80211_IFTYPE_AP) | | ||
7938 | BIT(NL80211_IFTYPE_STATION) | | 7857 | BIT(NL80211_IFTYPE_STATION) | |
7939 | BIT(NL80211_IFTYPE_ADHOC); | 7858 | BIT(NL80211_IFTYPE_ADHOC); |
7940 | 7859 | ||
7860 | hw->wiphy->fw_handles_regulatory = true; | ||
7861 | |||
7941 | /* 4 EDCA QOS priorities */ | 7862 | /* 4 EDCA QOS priorities */ |
7942 | hw->queues = 4; | 7863 | hw->queues = 4; |
7943 | 7864 | ||
7944 | spin_lock_init(&priv->lock); | 7865 | /*************************** |
7945 | spin_lock_init(&priv->power_data.lock); | 7866 | * 2. Initializing PCI bus |
7946 | spin_lock_init(&priv->sta_lock); | 7867 | * *************************/ |
7947 | spin_lock_init(&priv->hcmd_lock); | ||
7948 | |||
7949 | INIT_LIST_HEAD(&priv->free_frames); | ||
7950 | |||
7951 | mutex_init(&priv->mutex); | ||
7952 | if (pci_enable_device(pdev)) { | 7868 | if (pci_enable_device(pdev)) { |
7953 | err = -ENODEV; | 7869 | err = -ENODEV; |
7954 | goto out_ieee80211_free_hw; | 7870 | goto out_ieee80211_free_hw; |
@@ -7956,14 +7872,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7956 | 7872 | ||
7957 | pci_set_master(pdev); | 7873 | pci_set_master(pdev); |
7958 | 7874 | ||
7959 | /* Clear the driver's (not device's) station table */ | ||
7960 | iwl3945_clear_stations_table(priv); | ||
7961 | |||
7962 | priv->data_retry_limit = -1; | ||
7963 | priv->ieee_channels = NULL; | ||
7964 | priv->ieee_rates = NULL; | ||
7965 | priv->band = IEEE80211_BAND_2GHZ; | ||
7966 | |||
7967 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 7875 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
7968 | if (!err) | 7876 | if (!err) |
7969 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 7877 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
@@ -7977,10 +7885,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7977 | if (err) | 7885 | if (err) |
7978 | goto out_pci_disable_device; | 7886 | goto out_pci_disable_device; |
7979 | 7887 | ||
7980 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 7888 | /*********************** |
7981 | * PCI Tx retries from interfering with C3 CPU state */ | 7889 | * 3. Read REV Register |
7982 | pci_write_config_byte(pdev, 0x41, 0x00); | 7890 | * ********************/ |
7983 | |||
7984 | priv->hw_base = pci_iomap(pdev, 0, 0); | 7891 | priv->hw_base = pci_iomap(pdev, 0, 0); |
7985 | if (!priv->hw_base) { | 7892 | if (!priv->hw_base) { |
7986 | err = -ENODEV; | 7893 | err = -ENODEV; |
@@ -7991,97 +7898,144 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7991 | (unsigned long long) pci_resource_len(pdev, 0)); | 7898 | (unsigned long long) pci_resource_len(pdev, 0)); |
7992 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); | 7899 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); |
7993 | 7900 | ||
7994 | /* Initialize module parameter values here */ | 7901 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
7902 | * PCI Tx retries from interfering with C3 CPU state */ | ||
7903 | pci_write_config_byte(pdev, 0x41, 0x00); | ||
7995 | 7904 | ||
7996 | /* Disable radio (SW RF KILL) via parameter when loading driver */ | 7905 | /* nic init */ |
7997 | if (iwl3945_param_disable) { | 7906 | iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, |
7998 | set_bit(STATUS_RF_KILL_SW, &priv->status); | 7907 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); |
7999 | IWL_DEBUG_INFO("Radio disabled.\n"); | ||
8000 | } | ||
8001 | 7908 | ||
8002 | priv->iw_mode = NL80211_IFTYPE_STATION; | 7909 | iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
7910 | err = iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL, | ||
7911 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
7912 | if (err < 0) { | ||
7913 | IWL_DEBUG_INFO("Failed to init the card\n"); | ||
7914 | goto out_remove_sysfs; | ||
7915 | } | ||
8003 | 7916 | ||
8004 | printk(KERN_INFO DRV_NAME | 7917 | /*********************** |
8005 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); | 7918 | * 4. Read EEPROM |
7919 | * ********************/ | ||
7920 | /* Read the EEPROM */ | ||
7921 | err = iwl3945_eeprom_init(priv); | ||
7922 | if (err) { | ||
7923 | IWL_ERROR("Unable to init EEPROM\n"); | ||
7924 | goto out_remove_sysfs; | ||
7925 | } | ||
7926 | /* MAC Address location in EEPROM same for 3945/4965 */ | ||
7927 | get_eeprom_mac(priv, priv->mac_addr); | ||
7928 | IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr); | ||
7929 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | ||
8006 | 7930 | ||
7931 | /*********************** | ||
7932 | * 5. Setup HW Constants | ||
7933 | * ********************/ | ||
8007 | /* Device-specific setup */ | 7934 | /* Device-specific setup */ |
8008 | if (iwl3945_hw_set_hw_setting(priv)) { | 7935 | if (iwl3945_hw_set_hw_setting(priv)) { |
8009 | IWL_ERROR("failed to set hw settings\n"); | 7936 | IWL_ERROR("failed to set hw settings\n"); |
8010 | goto out_iounmap; | 7937 | goto out_iounmap; |
8011 | } | 7938 | } |
8012 | 7939 | ||
8013 | if (iwl3945_param_qos_enable) | 7940 | /*********************** |
8014 | priv->qos_data.qos_enable = 1; | 7941 | * 6. Setup priv |
7942 | * ********************/ | ||
7943 | priv->retry_rate = 1; | ||
7944 | priv->ibss_beacon = NULL; | ||
7945 | |||
7946 | spin_lock_init(&priv->lock); | ||
7947 | spin_lock_init(&priv->power_data.lock); | ||
7948 | spin_lock_init(&priv->sta_lock); | ||
7949 | spin_lock_init(&priv->hcmd_lock); | ||
7950 | |||
7951 | INIT_LIST_HEAD(&priv->free_frames); | ||
7952 | mutex_init(&priv->mutex); | ||
7953 | |||
7954 | /* Clear the driver's (not device's) station table */ | ||
7955 | iwl3945_clear_stations_table(priv); | ||
7956 | |||
7957 | priv->data_retry_limit = -1; | ||
7958 | priv->ieee_channels = NULL; | ||
7959 | priv->ieee_rates = NULL; | ||
7960 | priv->band = IEEE80211_BAND_2GHZ; | ||
7961 | |||
7962 | priv->iw_mode = NL80211_IFTYPE_STATION; | ||
8015 | 7963 | ||
8016 | iwl3945_reset_qos(priv); | 7964 | iwl3945_reset_qos(priv); |
8017 | 7965 | ||
8018 | priv->qos_data.qos_active = 0; | 7966 | priv->qos_data.qos_active = 0; |
8019 | priv->qos_data.qos_cap.val = 0; | 7967 | priv->qos_data.qos_cap.val = 0; |
8020 | 7968 | ||
8021 | iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | ||
8022 | iwl3945_setup_deferred_work(priv); | ||
8023 | iwl3945_setup_rx_handlers(priv); | ||
8024 | 7969 | ||
8025 | priv->rates_mask = IWL_RATES_MASK; | 7970 | priv->rates_mask = IWL_RATES_MASK; |
8026 | /* If power management is turned on, default to AC mode */ | 7971 | /* If power management is turned on, default to AC mode */ |
8027 | priv->power_mode = IWL_POWER_AC; | 7972 | priv->power_mode = IWL_POWER_AC; |
8028 | priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; | 7973 | priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; |
8029 | 7974 | ||
8030 | spin_lock_irqsave(&priv->lock, flags); | 7975 | err = iwl3945_init_channel_map(priv); |
8031 | iwl3945_disable_interrupts(priv); | ||
8032 | spin_unlock_irqrestore(&priv->lock, flags); | ||
8033 | |||
8034 | err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); | ||
8035 | if (err) { | 7976 | if (err) { |
8036 | IWL_ERROR("failed to create sysfs device attributes\n"); | 7977 | IWL_ERROR("initializing regulatory failed: %d\n", err); |
8037 | goto out_release_irq; | 7978 | goto out_release_irq; |
8038 | } | 7979 | } |
8039 | 7980 | ||
8040 | /* nic init */ | 7981 | err = iwl3945_init_geos(priv); |
8041 | iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, | ||
8042 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); | ||
8043 | |||
8044 | iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
8045 | err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, | ||
8046 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | ||
8047 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
8048 | if (err < 0) { | ||
8049 | IWL_DEBUG_INFO("Failed to init the card\n"); | ||
8050 | goto out_remove_sysfs; | ||
8051 | } | ||
8052 | /* Read the EEPROM */ | ||
8053 | err = iwl3945_eeprom_init(priv); | ||
8054 | if (err) { | 7982 | if (err) { |
8055 | IWL_ERROR("Unable to init EEPROM\n"); | 7983 | IWL_ERROR("initializing geos failed: %d\n", err); |
8056 | goto out_remove_sysfs; | 7984 | goto out_free_channel_map; |
8057 | } | 7985 | } |
8058 | /* MAC Address location in EEPROM same for 3945/4965 */ | ||
8059 | get_eeprom_mac(priv, priv->mac_addr); | ||
8060 | IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); | ||
8061 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | ||
8062 | 7986 | ||
8063 | err = iwl3945_init_channel_map(priv); | 7987 | printk(KERN_INFO DRV_NAME |
8064 | if (err) { | 7988 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); |
8065 | IWL_ERROR("initializing regulatory failed: %d\n", err); | 7989 | |
8066 | goto out_remove_sysfs; | 7990 | /*********************************** |
7991 | * 7. Initialize Module Parameters | ||
7992 | * **********************************/ | ||
7993 | |||
7994 | /* Initialize module parameter values here */ | ||
7995 | /* Disable radio (SW RF KILL) via parameter when loading driver */ | ||
7996 | if (iwl3945_param_disable) { | ||
7997 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
7998 | IWL_DEBUG_INFO("Radio disabled.\n"); | ||
8067 | } | 7999 | } |
8068 | 8000 | ||
8069 | err = iwl3945_init_geos(priv); | 8001 | |
8002 | /*********************** | ||
8003 | * 8. Setup Services | ||
8004 | * ********************/ | ||
8005 | |||
8006 | spin_lock_irqsave(&priv->lock, flags); | ||
8007 | iwl3945_disable_interrupts(priv); | ||
8008 | spin_unlock_irqrestore(&priv->lock, flags); | ||
8009 | |||
8010 | err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); | ||
8070 | if (err) { | 8011 | if (err) { |
8071 | IWL_ERROR("initializing geos failed: %d\n", err); | 8012 | IWL_ERROR("failed to create sysfs device attributes\n"); |
8072 | goto out_free_channel_map; | 8013 | goto out_free_geos; |
8073 | } | 8014 | } |
8074 | 8015 | ||
8016 | iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | ||
8017 | iwl3945_setup_deferred_work(priv); | ||
8018 | iwl3945_setup_rx_handlers(priv); | ||
8019 | |||
8020 | /*********************** | ||
8021 | * 9. Conclude | ||
8022 | * ********************/ | ||
8023 | pci_save_state(pdev); | ||
8024 | pci_disable_device(pdev); | ||
8025 | |||
8026 | /********************************* | ||
8027 | * 10. Setup and Register mac80211 | ||
8028 | * *******************************/ | ||
8029 | |||
8075 | err = ieee80211_register_hw(priv->hw); | 8030 | err = ieee80211_register_hw(priv->hw); |
8076 | if (err) { | 8031 | if (err) { |
8077 | IWL_ERROR("Failed to register network device (error %d)\n", err); | 8032 | IWL_ERROR("Failed to register network device (error %d)\n", err); |
8078 | goto out_free_geos; | 8033 | goto out_remove_sysfs; |
8079 | } | 8034 | } |
8080 | 8035 | ||
8081 | priv->hw->conf.beacon_int = 100; | 8036 | priv->hw->conf.beacon_int = 100; |
8082 | priv->mac80211_registered = 1; | 8037 | priv->mac80211_registered = 1; |
8083 | pci_save_state(pdev); | 8038 | |
8084 | pci_disable_device(pdev); | ||
8085 | 8039 | ||
8086 | err = iwl3945_rfkill_init(priv); | 8040 | err = iwl3945_rfkill_init(priv); |
8087 | if (err) | 8041 | if (err) |
@@ -8090,12 +8044,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8090 | 8044 | ||
8091 | return 0; | 8045 | return 0; |
8092 | 8046 | ||
8047 | out_remove_sysfs: | ||
8048 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | ||
8093 | out_free_geos: | 8049 | out_free_geos: |
8094 | iwl3945_free_geos(priv); | 8050 | iwl3945_free_geos(priv); |
8095 | out_free_channel_map: | 8051 | out_free_channel_map: |
8096 | iwl3945_free_channel_map(priv); | 8052 | iwl3945_free_channel_map(priv); |
8097 | out_remove_sysfs: | 8053 | |
8098 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | ||
8099 | 8054 | ||
8100 | out_release_irq: | 8055 | out_release_irq: |
8101 | destroy_workqueue(priv->workqueue); | 8056 | destroy_workqueue(priv->workqueue); |
@@ -8222,7 +8177,7 @@ static int iwl3945_rfkill_soft_rf_kill(void *data, enum rfkill_state state) | |||
8222 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 8177 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
8223 | return 0; | 8178 | return 0; |
8224 | 8179 | ||
8225 | IWL_DEBUG_RF_KILL("we recieved soft RFKILL set to state %d\n", state); | 8180 | IWL_DEBUG_RF_KILL("we received soft RFKILL set to state %d\n", state); |
8226 | mutex_lock(&priv->mutex); | 8181 | mutex_lock(&priv->mutex); |
8227 | 8182 | ||
8228 | switch (state) { | 8183 | switch (state) { |
@@ -8237,7 +8192,7 @@ static int iwl3945_rfkill_soft_rf_kill(void *data, enum rfkill_state state) | |||
8237 | iwl3945_radio_kill_sw(priv, 1); | 8192 | iwl3945_radio_kill_sw(priv, 1); |
8238 | break; | 8193 | break; |
8239 | default: | 8194 | default: |
8240 | IWL_WARNING("we recieved unexpected RFKILL state %d\n", state); | 8195 | IWL_WARNING("we received unexpected RFKILL state %d\n", state); |
8241 | break; | 8196 | break; |
8242 | } | 8197 | } |
8243 | out_unlock: | 8198 | out_unlock: |
@@ -8379,7 +8334,7 @@ static void __exit iwl3945_exit(void) | |||
8379 | iwl3945_rate_control_unregister(); | 8334 | iwl3945_rate_control_unregister(); |
8380 | } | 8335 | } |
8381 | 8336 | ||
8382 | MODULE_FIRMWARE("iwlwifi-3945" IWL3945_UCODE_API ".ucode"); | 8337 | MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX)); |
8383 | 8338 | ||
8384 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); | 8339 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); |
8385 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 8340 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
@@ -8388,7 +8343,7 @@ MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); | |||
8388 | module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444); | 8343 | module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444); |
8389 | MODULE_PARM_DESC(hwcrypto, | 8344 | MODULE_PARM_DESC(hwcrypto, |
8390 | "using hardware crypto engine (default 0 [software])\n"); | 8345 | "using hardware crypto engine (default 0 [software])\n"); |
8391 | module_param_named(debug, iwl3945_param_debug, int, 0444); | 8346 | module_param_named(debug, iwl3945_param_debug, uint, 0444); |
8392 | MODULE_PARM_DESC(debug, "debug output mask"); | 8347 | MODULE_PARM_DESC(debug, "debug output mask"); |
8393 | module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444); | 8348 | module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444); |
8394 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | 8349 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); |
@@ -8396,9 +8351,5 @@ MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | |||
8396 | module_param_named(queues_num, iwl3945_param_queues_num, int, 0444); | 8351 | module_param_named(queues_num, iwl3945_param_queues_num, int, 0444); |
8397 | MODULE_PARM_DESC(queues_num, "number of hw queues."); | 8352 | MODULE_PARM_DESC(queues_num, "number of hw queues."); |
8398 | 8353 | ||
8399 | /* QoS */ | ||
8400 | module_param_named(qos_enable, iwl3945_param_qos_enable, int, 0444); | ||
8401 | MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); | ||
8402 | |||
8403 | module_exit(iwl3945_exit); | 8354 | module_exit(iwl3945_exit); |
8404 | module_init(iwl3945_init); | 8355 | module_init(iwl3945_init); |