| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1 | /****************************************************************************** | 
 | 2 |  * | 
 | 3 |  * This file is provided under a dual BSD/GPLv2 license.  When using or | 
 | 4 |  * redistributing this file, you may do so under either license. | 
 | 5 |  * | 
 | 6 |  * GPL LICENSE SUMMARY | 
 | 7 |  * | 
| Reinette Chatre | 1f44780 | 2010-01-15 13:43:41 -0800 | [diff] [blame] | 8 |  * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 9 |  * | 
 | 10 |  * This program is free software; you can redistribute it and/or modify | 
| Ian Schram | 01ebd06 | 2007-10-25 17:15:22 +0800 | [diff] [blame] | 11 |  * it under the terms of version 2 of the GNU General Public License as | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 12 |  * published by the Free Software Foundation. | 
 | 13 |  * | 
 | 14 |  * This program is distributed in the hope that it will be useful, but | 
 | 15 |  * WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 16 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
 | 17 |  * General Public License for more details. | 
 | 18 |  * | 
 | 19 |  * You should have received a copy of the GNU General Public License | 
 | 20 |  * along with this program; if not, write to the Free Software | 
 | 21 |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | 
 | 22 |  * USA | 
 | 23 |  * | 
 | 24 |  * The full GNU General Public License is included in this distribution | 
 | 25 |  * in the file called LICENSE.GPL. | 
 | 26 |  * | 
 | 27 |  * Contact Information: | 
| Winkler, Tomas | 759ef89 | 2008-12-09 11:28:58 -0800 | [diff] [blame] | 28 |  *  Intel Linux Wireless <ilw@linux.intel.com> | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 29 |  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 
 | 30 |  * | 
 | 31 |  * BSD LICENSE | 
 | 32 |  * | 
| Reinette Chatre | 1f44780 | 2010-01-15 13:43:41 -0800 | [diff] [blame] | 33 |  * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 34 |  * All rights reserved. | 
 | 35 |  * | 
 | 36 |  * Redistribution and use in source and binary forms, with or without | 
 | 37 |  * modification, are permitted provided that the following conditions | 
 | 38 |  * are met: | 
 | 39 |  * | 
 | 40 |  *  * Redistributions of source code must retain the above copyright | 
 | 41 |  *    notice, this list of conditions and the following disclaimer. | 
 | 42 |  *  * Redistributions in binary form must reproduce the above copyright | 
 | 43 |  *    notice, this list of conditions and the following disclaimer in | 
 | 44 |  *    the documentation and/or other materials provided with the | 
 | 45 |  *    distribution. | 
 | 46 |  *  * Neither the name Intel Corporation nor the names of its | 
 | 47 |  *    contributors may be used to endorse or promote products derived | 
 | 48 |  *    from this software without specific prior written permission. | 
 | 49 |  * | 
 | 50 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
 | 51 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
 | 52 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
 | 53 |  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
 | 54 |  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
 | 55 |  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
 | 56 |  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
 | 57 |  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
 | 58 |  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
 | 59 |  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
 | 60 |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
 | 61 |  * | 
 | 62 |  *****************************************************************************/ | 
| Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 63 | /* | 
| Tomas Winkler | 5a36ba0 | 2008-04-24 11:55:37 -0700 | [diff] [blame] | 64 |  * Please use this file (iwl-commands.h) only for uCode API definitions. | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 65 |  * Please use iwl-xxxx-hw.h for hardware-related definitions. | 
| Tomas Winkler | 3e0d4cb | 2008-04-24 11:55:38 -0700 | [diff] [blame] | 66 |  * Please use iwl-dev.h for driver implementation definitions. | 
| Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 67 |  */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 68 |  | 
| Emmanuel Grumbach | 6a63578 | 2008-10-29 14:05:47 -0700 | [diff] [blame] | 69 | #ifndef __iwl_commands_h__ | 
 | 70 | #define __iwl_commands_h__ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 71 |  | 
| Samuel Ortiz | a3139c5 | 2008-12-19 10:37:09 +0800 | [diff] [blame] | 72 | struct iwl_priv; | 
 | 73 |  | 
| Chatre, Reinette | c02b3ac | 2008-12-02 12:14:05 -0800 | [diff] [blame] | 74 | /* uCode version contains 4 values: Major/Minor/API/Serial */ | 
 | 75 | #define IWL_UCODE_MAJOR(ver)	(((ver) & 0xFF000000) >> 24) | 
 | 76 | #define IWL_UCODE_MINOR(ver)	(((ver) & 0x00FF0000) >> 16) | 
 | 77 | #define IWL_UCODE_API(ver)	(((ver) & 0x0000FF00) >> 8) | 
 | 78 | #define IWL_UCODE_SERIAL(ver)	((ver) & 0x000000FF) | 
 | 79 |  | 
| Tomas Winkler | 4c89725 | 2008-12-19 10:37:05 +0800 | [diff] [blame] | 80 |  | 
 | 81 | /* Tx rates */ | 
 | 82 | #define IWL_CCK_RATES	4 | 
 | 83 | #define IWL_OFDM_RATES	8 | 
 | 84 | #define IWL_MAX_RATES	(IWL_CCK_RATES + IWL_OFDM_RATES) | 
 | 85 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 86 | enum { | 
 | 87 | 	REPLY_ALIVE = 0x1, | 
 | 88 | 	REPLY_ERROR = 0x2, | 
 | 89 |  | 
 | 90 | 	/* RXON and QOS commands */ | 
 | 91 | 	REPLY_RXON = 0x10, | 
 | 92 | 	REPLY_RXON_ASSOC = 0x11, | 
 | 93 | 	REPLY_QOS_PARAM = 0x13, | 
 | 94 | 	REPLY_RXON_TIMING = 0x14, | 
 | 95 |  | 
 | 96 | 	/* Multi-Station support */ | 
 | 97 | 	REPLY_ADD_STA = 0x18, | 
| Wey-Yi Guy | fc66be2 | 2010-05-14 16:21:55 -0700 | [diff] [blame] | 98 | 	REPLY_REMOVE_STA = 0x19, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 99 | 	REPLY_REMOVE_ALL_STA = 0x1a,	/* not used */ | 
| Wey-Yi Guy | 947279e | 2010-06-24 13:18:33 -0700 | [diff] [blame] | 100 | 	REPLY_TXFIFO_FLUSH = 0x1e, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 101 |  | 
| Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 102 | 	/* Security */ | 
 | 103 | 	REPLY_WEPKEY = 0x20, | 
 | 104 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 105 | 	/* RX, TX, LEDs */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 106 | 	REPLY_3945_RX = 0x1b,           /* 3945 only */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 107 | 	REPLY_TX = 0x1c, | 
 | 108 | 	REPLY_RATE_SCALE = 0x47,	/* 3945 only */ | 
 | 109 | 	REPLY_LEDS_CMD = 0x48, | 
| Wey-Yi Guy | 4c8d191 | 2010-03-31 18:16:52 -0700 | [diff] [blame] | 110 | 	REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 111 |  | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 112 | 	/* WiMAX coexistence */ | 
| Wey-Yi Guy | d23000c | 2009-10-23 13:42:36 -0700 | [diff] [blame] | 113 | 	COEX_PRIORITY_TABLE_CMD = 0x5a,	/* for 5000 series and up */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 114 | 	COEX_MEDIUM_NOTIFICATION = 0x5b, | 
 | 115 | 	COEX_EVENT_CMD = 0x5c, | 
 | 116 |  | 
| Tomas Winkler | be5d56e | 2008-10-08 09:37:27 +0800 | [diff] [blame] | 117 | 	/* Calibration */ | 
| Jay Sternberg | 1a5c3d6 | 2009-10-23 13:42:19 -0700 | [diff] [blame] | 118 | 	TEMPERATURE_NOTIFICATION = 0x62, | 
| Tomas Winkler | be5d56e | 2008-10-08 09:37:27 +0800 | [diff] [blame] | 119 | 	CALIBRATION_CFG_CMD = 0x65, | 
 | 120 | 	CALIBRATION_RES_NOTIFICATION = 0x66, | 
 | 121 | 	CALIBRATION_COMPLETE_NOTIFICATION = 0x67, | 
 | 122 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 123 | 	/* 802.11h related */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 124 | 	REPLY_QUIET_CMD = 0x71,		/* not used */ | 
 | 125 | 	REPLY_CHANNEL_SWITCH = 0x72, | 
 | 126 | 	CHANNEL_SWITCH_NOTIFICATION = 0x73, | 
 | 127 | 	REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, | 
 | 128 | 	SPECTRUM_MEASURE_NOTIFICATION = 0x75, | 
 | 129 |  | 
 | 130 | 	/* Power Management */ | 
 | 131 | 	POWER_TABLE_CMD = 0x77, | 
 | 132 | 	PM_SLEEP_NOTIFICATION = 0x7A, | 
 | 133 | 	PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, | 
 | 134 |  | 
 | 135 | 	/* Scan commands and notifications */ | 
 | 136 | 	REPLY_SCAN_CMD = 0x80, | 
 | 137 | 	REPLY_SCAN_ABORT_CMD = 0x81, | 
 | 138 | 	SCAN_START_NOTIFICATION = 0x82, | 
 | 139 | 	SCAN_RESULTS_NOTIFICATION = 0x83, | 
 | 140 | 	SCAN_COMPLETE_NOTIFICATION = 0x84, | 
 | 141 |  | 
 | 142 | 	/* IBSS/AP commands */ | 
 | 143 | 	BEACON_NOTIFICATION = 0x90, | 
 | 144 | 	REPLY_TX_BEACON = 0x91, | 
 | 145 | 	WHO_IS_AWAKE_NOTIFICATION = 0x94,	/* not used */ | 
 | 146 |  | 
 | 147 | 	/* Miscellaneous commands */ | 
| Jay Sternberg | 76a2407 | 2009-01-29 11:09:14 -0800 | [diff] [blame] | 148 | 	REPLY_TX_POWER_DBM_CMD = 0x95, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 149 | 	QUIET_NOTIFICATION = 0x96,		/* not used */ | 
 | 150 | 	REPLY_TX_PWR_TABLE_CMD = 0x97, | 
| Jay Sternberg | 76a2407 | 2009-01-29 11:09:14 -0800 | [diff] [blame] | 151 | 	REPLY_TX_POWER_DBM_CMD_V1 = 0x98,	/* old version of API */ | 
| Wey-Yi Guy | 2f748de | 2009-09-17 10:43:51 -0700 | [diff] [blame] | 152 | 	TX_ANT_CONFIGURATION_CMD = 0x98, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 153 | 	MEASURE_ABORT_NOTIFICATION = 0x99,	/* not used */ | 
 | 154 |  | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 155 | 	/* Bluetooth device coexistence config command */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 156 | 	REPLY_BT_CONFIG = 0x9b, | 
 | 157 |  | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 158 | 	/* Statistics */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 159 | 	REPLY_STATISTICS_CMD = 0x9c, | 
 | 160 | 	STATISTICS_NOTIFICATION = 0x9d, | 
 | 161 |  | 
 | 162 | 	/* RF-KILL commands and notifications */ | 
 | 163 | 	REPLY_CARD_STATE_CMD = 0xa0, | 
 | 164 | 	CARD_STATE_NOTIFICATION = 0xa1, | 
 | 165 |  | 
 | 166 | 	/* Missed beacons notification */ | 
 | 167 | 	MISSED_BEACONS_NOTIFICATION = 0xa2, | 
 | 168 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 169 | 	REPLY_CT_KILL_CONFIG_CMD = 0xa4, | 
 | 170 | 	SENSITIVITY_CMD = 0xa8, | 
 | 171 | 	REPLY_PHY_CALIBRATION_CMD = 0xb0, | 
 | 172 | 	REPLY_RX_PHY_CMD = 0xc0, | 
 | 173 | 	REPLY_RX_MPDU_CMD = 0xc1, | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 174 | 	REPLY_RX = 0xc3, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 175 | 	REPLY_COMPRESSED_BA = 0xc5, | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 176 |  | 
 | 177 | 	/* BT Coex */ | 
 | 178 | 	REPLY_BT_COEX_PRIO_TABLE = 0xcc, | 
 | 179 | 	REPLY_BT_COEX_PROT_ENV = 0xcd, | 
 | 180 | 	REPLY_BT_COEX_PROFILE_NOTIF = 0xce, | 
 | 181 |  | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 182 | 	/* PAN commands */ | 
 | 183 | 	REPLY_WIPAN_PARAMS = 0xb2, | 
 | 184 | 	REPLY_WIPAN_RXON = 0xb3,	/* use REPLY_RXON structure */ | 
 | 185 | 	REPLY_WIPAN_RXON_TIMING = 0xb4,	/* use REPLY_RXON_TIMING structure */ | 
 | 186 | 	REPLY_WIPAN_RXON_ASSOC = 0xb6,	/* use REPLY_RXON_ASSOC structure */ | 
 | 187 | 	REPLY_WIPAN_QOS_PARAM = 0xb7,	/* use REPLY_QOS_PARAM structure */ | 
 | 188 | 	REPLY_WIPAN_WEPKEY = 0xb8,	/* use REPLY_WEPKEY structure */ | 
 | 189 | 	REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9, | 
 | 190 | 	REPLY_WIPAN_NOA_NOTIFICATION = 0xbc, | 
| Johannes Berg | 311dce7 | 2011-01-04 16:22:01 -0800 | [diff] [blame] | 191 | 	REPLY_WIPAN_DEACTIVATION_COMPLETE = 0xbd, | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 192 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 193 | 	REPLY_MAX = 0xff | 
 | 194 | }; | 
 | 195 |  | 
 | 196 | /****************************************************************************** | 
 | 197 |  * (0) | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 198 |  * Commonly used structures and definitions: | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 199 |  * Command header, rate_n_flags, txpower | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 200 |  * | 
 | 201 |  *****************************************************************************/ | 
 | 202 |  | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 203 | /* iwl_cmd_header flags value */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 204 | #define IWL_CMD_FAILED_MSK 0x40 | 
 | 205 |  | 
| Tomas Winkler | 9734cb2 | 2008-09-03 11:26:52 +0800 | [diff] [blame] | 206 | #define SEQ_TO_QUEUE(s)	(((s) >> 8) & 0x1f) | 
 | 207 | #define QUEUE_TO_SEQ(q)	(((q) & 0x1f) << 8) | 
 | 208 | #define SEQ_TO_INDEX(s)	((s) & 0xff) | 
 | 209 | #define INDEX_TO_SEQ(i)	((i) & 0xff) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 210 | #define SEQ_HUGE_FRAME	cpu_to_le16(0x4000) | 
 | 211 | #define SEQ_RX_FRAME	cpu_to_le16(0x8000) | 
| Tomas Winkler | 9734cb2 | 2008-09-03 11:26:52 +0800 | [diff] [blame] | 212 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 213 | /** | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 214 |  * struct iwl_cmd_header | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 215 |  * | 
 | 216 |  * This header format appears in the beginning of each command sent from the | 
 | 217 |  * driver, and each response/notification received from uCode. | 
 | 218 |  */ | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 219 | struct iwl_cmd_header { | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 220 | 	u8 cmd;		/* Command ID:  REPLY_RXON, etc. */ | 
| Tomas Winkler | 9734cb2 | 2008-09-03 11:26:52 +0800 | [diff] [blame] | 221 | 	u8 flags;	/* 0:5 reserved, 6 abort, 7 internal */ | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 222 | 	/* | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 223 | 	 * The driver sets up the sequence number to values of its choosing. | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 224 | 	 * uCode does not use this value, but passes it back to the driver | 
 | 225 | 	 * when sending the response to each driver-originated command, so | 
 | 226 | 	 * the driver can match the response to the command.  Since the values | 
 | 227 | 	 * don't get used by uCode, the driver may set up an arbitrary format. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 228 | 	 * | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 229 | 	 * There is one exception:  uCode sets bit 15 when it originates | 
 | 230 | 	 * the response/notification, i.e. when the response/notification | 
 | 231 | 	 * is not a direct response to a command sent by the driver.  For | 
 | 232 | 	 * example, uCode issues REPLY_3945_RX when it sends a received frame | 
 | 233 | 	 * to the driver; it is not a direct response to any driver command. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 234 | 	 * | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 235 | 	 * The Linux driver uses the following format: | 
 | 236 | 	 * | 
| Tomas Winkler | 9734cb2 | 2008-09-03 11:26:52 +0800 | [diff] [blame] | 237 | 	 *  0:7		tfd index - position within TX queue | 
 | 238 | 	 *  8:12	TX queue id | 
 | 239 | 	 *  13		reserved | 
 | 240 | 	 *  14		huge - driver sets this to indicate command is in the | 
 | 241 | 	 *  		'huge' storage at the end of the command buffers | 
 | 242 | 	 *  15		unsolicited RX or uCode-originated notification | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 243 | 	 */ | 
 | 244 | 	__le16 sequence; | 
 | 245 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 246 | 	/* command or response/notification data follows immediately */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 247 | 	u8 data[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 248 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 249 |  | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 250 |  | 
 | 251 | /** | 
 | 252 |  * struct iwl3945_tx_power | 
 | 253 |  * | 
 | 254 |  * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH | 
 | 255 |  * | 
 | 256 |  * Each entry contains two values: | 
 | 257 |  * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained | 
 | 258 |  *     linear value that multiplies the output of the digital signal processor, | 
 | 259 |  *     before being sent to the analog radio. | 
 | 260 |  * 2)  Radio gain.  This sets the analog gain of the radio Tx path. | 
 | 261 |  *     It is a coarser setting, and behaves in a logarithmic (dB) fashion. | 
 | 262 |  * | 
 | 263 |  * Driver obtains values from struct iwl3945_tx_power power_gain_table[][]. | 
 | 264 |  */ | 
 | 265 | struct iwl3945_tx_power { | 
 | 266 | 	u8 tx_gain;		/* gain for analog radio */ | 
 | 267 | 	u8 dsp_atten;		/* gain for DSP */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 268 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 269 |  | 
 | 270 | /** | 
 | 271 |  * struct iwl3945_power_per_rate | 
 | 272 |  * | 
 | 273 |  * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH | 
 | 274 |  */ | 
 | 275 | struct iwl3945_power_per_rate { | 
 | 276 | 	u8 rate;		/* plcp */ | 
 | 277 | 	struct iwl3945_tx_power tpc; | 
 | 278 | 	u8 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 279 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 280 |  | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 281 | /** | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 282 |  * iwlagn rate_n_flags bit fields | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 283 |  * | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 284 |  * rate_n_flags format is used in following iwlagn commands: | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 285 |  *  REPLY_RX (response only) | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 286 |  *  REPLY_RX_MPDU (response only) | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 287 |  *  REPLY_TX (both command and response) | 
 | 288 |  *  REPLY_TX_LINK_QUALITY_CMD | 
 | 289 |  * | 
 | 290 |  * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): | 
 | 291 |  *  2-0:  0)   6 Mbps | 
 | 292 |  *        1)  12 Mbps | 
 | 293 |  *        2)  18 Mbps | 
 | 294 |  *        3)  24 Mbps | 
 | 295 |  *        4)  36 Mbps | 
 | 296 |  *        5)  48 Mbps | 
 | 297 |  *        6)  54 Mbps | 
 | 298 |  *        7)  60 Mbps | 
 | 299 |  * | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 300 |  *  4-3:  0)  Single stream (SISO) | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 301 |  *        1)  Dual stream (MIMO) | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 302 |  *        2)  Triple stream (MIMO) | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 303 |  * | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 304 |  *    5:  Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 305 |  * | 
 | 306 |  * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): | 
 | 307 |  *  3-0:  0xD)   6 Mbps | 
 | 308 |  *        0xF)   9 Mbps | 
 | 309 |  *        0x5)  12 Mbps | 
 | 310 |  *        0x7)  18 Mbps | 
 | 311 |  *        0x9)  24 Mbps | 
 | 312 |  *        0xB)  36 Mbps | 
 | 313 |  *        0x1)  48 Mbps | 
 | 314 |  *        0x3)  54 Mbps | 
 | 315 |  * | 
 | 316 |  * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): | 
| Daniel Wu | 1061787 | 2008-12-20 10:53:29 -0800 | [diff] [blame] | 317 |  *  6-0:   10)  1 Mbps | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 318 |  *         20)  2 Mbps | 
 | 319 |  *         55)  5.5 Mbps | 
 | 320 |  *        110)  11 Mbps | 
 | 321 |  */ | 
 | 322 | #define RATE_MCS_CODE_MSK 0x7 | 
| Halperin, Daniel C | 5c5aa3f | 2008-11-07 09:58:38 -0800 | [diff] [blame] | 323 | #define RATE_MCS_SPATIAL_POS 3 | 
 | 324 | #define RATE_MCS_SPATIAL_MSK 0x18 | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 325 | #define RATE_MCS_HT_DUP_POS 5 | 
 | 326 | #define RATE_MCS_HT_DUP_MSK 0x20 | 
 | 327 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 328 | /* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 329 | #define RATE_MCS_FLAGS_POS 8 | 
 | 330 | #define RATE_MCS_HT_POS 8 | 
 | 331 | #define RATE_MCS_HT_MSK 0x100 | 
 | 332 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 333 | /* Bit 9: (1) CCK, (0) OFDM.  HT (bit 8) must be "0" for this bit to be valid */ | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 334 | #define RATE_MCS_CCK_POS 9 | 
 | 335 | #define RATE_MCS_CCK_MSK 0x200 | 
 | 336 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 337 | /* Bit 10: (1) Use Green Field preamble */ | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 338 | #define RATE_MCS_GF_POS 10 | 
 | 339 | #define RATE_MCS_GF_MSK 0x400 | 
 | 340 |  | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 341 | /* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ | 
 | 342 | #define RATE_MCS_HT40_POS 11 | 
 | 343 | #define RATE_MCS_HT40_MSK 0x800 | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 344 |  | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 345 | /* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 346 | #define RATE_MCS_DUP_POS 12 | 
 | 347 | #define RATE_MCS_DUP_MSK 0x1000 | 
 | 348 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 349 | /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 350 | #define RATE_MCS_SGI_POS 13 | 
 | 351 | #define RATE_MCS_SGI_MSK 0x2000 | 
 | 352 |  | 
 | 353 | /** | 
| Tomas Winkler | 76eff18 | 2008-10-14 12:32:45 -0700 | [diff] [blame] | 354 |  * rate_n_flags Tx antenna masks | 
 | 355 |  * 4965 has 2 transmitters | 
 | 356 |  * 5100 has 1 transmitter B | 
 | 357 |  * 5150 has 1 transmitter A | 
 | 358 |  * 5300 has 3 transmitters | 
 | 359 |  * 5350 has 3 transmitters | 
 | 360 |  * bit14:16 | 
| Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 361 |  */ | 
| Tomas Winkler | 600c0e1 | 2008-12-19 10:37:04 +0800 | [diff] [blame] | 362 | #define RATE_MCS_ANT_POS	14 | 
 | 363 | #define RATE_MCS_ANT_A_MSK	0x04000 | 
 | 364 | #define RATE_MCS_ANT_B_MSK	0x08000 | 
 | 365 | #define RATE_MCS_ANT_C_MSK	0x10000 | 
 | 366 | #define RATE_MCS_ANT_AB_MSK	(RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) | 
 | 367 | #define RATE_MCS_ANT_ABC_MSK	(RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) | 
| Tomas Winkler | 76eff18 | 2008-10-14 12:32:45 -0700 | [diff] [blame] | 368 | #define RATE_ANT_NUM 3 | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 369 |  | 
 | 370 | #define POWER_TABLE_NUM_ENTRIES			33 | 
 | 371 | #define POWER_TABLE_NUM_HT_OFDM_ENTRIES		32 | 
 | 372 | #define POWER_TABLE_CCK_ENTRY			32 | 
 | 373 |  | 
| Wey-Yi Guy | e57f148 | 2009-10-09 13:20:34 -0700 | [diff] [blame] | 374 | #define IWL_PWR_NUM_HT_OFDM_ENTRIES		24 | 
 | 375 | #define IWL_PWR_CCK_ENTRIES			2 | 
 | 376 |  | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 377 | /** | 
 | 378 |  * union iwl4965_tx_power_dual_stream | 
 | 379 |  * | 
 | 380 |  * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH | 
 | 381 |  * Use __le32 version (struct tx_power_dual_stream) when building command. | 
 | 382 |  * | 
 | 383 |  * Driver provides radio gain and DSP attenuation settings to device in pairs, | 
 | 384 |  * one value for each transmitter chain.  The first value is for transmitter A, | 
 | 385 |  * second for transmitter B. | 
 | 386 |  * | 
 | 387 |  * For SISO bit rates, both values in a pair should be identical. | 
 | 388 |  * For MIMO rates, one value may be different from the other, | 
 | 389 |  * in order to balance the Tx output between the two transmitters. | 
 | 390 |  * | 
 | 391 |  * See more details in doc for TXPOWER in iwl-4965-hw.h. | 
 | 392 |  */ | 
 | 393 | union iwl4965_tx_power_dual_stream { | 
 | 394 | 	struct { | 
 | 395 | 		u8 radio_tx_gain[2]; | 
 | 396 | 		u8 dsp_predis_atten[2]; | 
 | 397 | 	} s; | 
 | 398 | 	u32 dw; | 
 | 399 | }; | 
 | 400 |  | 
 | 401 | /** | 
 | 402 |  * struct tx_power_dual_stream | 
 | 403 |  * | 
 | 404 |  * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH | 
 | 405 |  * | 
 | 406 |  * Same format as iwl_tx_power_dual_stream, but __le32 | 
 | 407 |  */ | 
 | 408 | struct tx_power_dual_stream { | 
 | 409 | 	__le32 dw; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 410 | } __packed; | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 411 |  | 
 | 412 | /** | 
 | 413 |  * struct iwl4965_tx_power_db | 
 | 414 |  * | 
 | 415 |  * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH | 
 | 416 |  */ | 
 | 417 | struct iwl4965_tx_power_db { | 
 | 418 | 	struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 419 | } __packed; | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 420 |  | 
| Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 421 | /** | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 422 |  * Command REPLY_TX_POWER_DBM_CMD = 0x98 | 
| Wey-Yi Guy | ab63c68 | 2010-09-20 09:12:31 -0700 | [diff] [blame] | 423 |  * struct iwlagn_tx_power_dbm_cmd | 
| Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 424 |  */ | 
| Wey-Yi Guy | ab63c68 | 2010-09-20 09:12:31 -0700 | [diff] [blame] | 425 | #define IWLAGN_TX_POWER_AUTO 0x7f | 
 | 426 | #define IWLAGN_TX_POWER_NO_CLOSED (0x1 << 6) | 
| Gregory Greenman | 853554a | 2008-06-30 17:23:01 +0800 | [diff] [blame] | 427 |  | 
| Wey-Yi Guy | ab63c68 | 2010-09-20 09:12:31 -0700 | [diff] [blame] | 428 | struct iwlagn_tx_power_dbm_cmd { | 
| Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 429 | 	s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ | 
 | 430 | 	u8 flags; | 
 | 431 | 	s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ | 
 | 432 | 	u8 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 433 | } __packed; | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 434 |  | 
| Wey-Yi Guy | 2f748de | 2009-09-17 10:43:51 -0700 | [diff] [blame] | 435 | /** | 
 | 436 |  * Command TX_ANT_CONFIGURATION_CMD = 0x98 | 
 | 437 |  * This command is used to configure valid Tx antenna. | 
 | 438 |  * By default uCode concludes the valid antenna according to the radio flavor. | 
 | 439 |  * This command enables the driver to override/modify this conclusion. | 
 | 440 |  */ | 
 | 441 | struct iwl_tx_ant_config_cmd { | 
 | 442 | 	__le32 valid; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 443 | } __packed; | 
| Wey-Yi Guy | 2f748de | 2009-09-17 10:43:51 -0700 | [diff] [blame] | 444 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 445 | /****************************************************************************** | 
 | 446 |  * (0a) | 
 | 447 |  * Alive and Error Commands & Responses: | 
 | 448 |  * | 
 | 449 |  *****************************************************************************/ | 
 | 450 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 451 | #define UCODE_VALID_OK	cpu_to_le32(0x1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 452 | #define INITIALIZE_SUBTYPE    (9) | 
 | 453 |  | 
 | 454 | /* | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 455 |  * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) | 
 | 456 |  * | 
 | 457 |  * uCode issues this "initialize alive" notification once the initialization | 
 | 458 |  * uCode image has completed its work, and is ready to load the runtime image. | 
 | 459 |  * This is the *first* "alive" notification that the driver will receive after | 
 | 460 |  * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. | 
 | 461 |  * | 
 | 462 |  * See comments documenting "BSM" (bootstrap state machine). | 
 | 463 |  * | 
 | 464 |  * For 4965, this notification contains important calibration data for | 
 | 465 |  * calculating txpower settings: | 
 | 466 |  * | 
 | 467 |  * 1)  Power supply voltage indication.  The voltage sensor outputs higher | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 468 |  *     values for lower voltage, and vice verse. | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 469 |  * | 
 | 470 |  * 2)  Temperature measurement parameters, for each of two channel widths | 
 | 471 |  *     (20 MHz and 40 MHz) supported by the radios.  Temperature sensing | 
 | 472 |  *     is done via one of the receiver chains, and channel width influences | 
 | 473 |  *     the results. | 
 | 474 |  * | 
 | 475 |  * 3)  Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, | 
 | 476 |  *     for each of 5 frequency ranges. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 477 |  */ | 
| Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 478 | struct iwl_init_alive_resp { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 479 | 	u8 ucode_minor; | 
 | 480 | 	u8 ucode_major; | 
 | 481 | 	__le16 reserved1; | 
 | 482 | 	u8 sw_rev[8]; | 
 | 483 | 	u8 ver_type; | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 484 | 	u8 ver_subtype;		/* "9" for initialize alive */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 485 | 	__le16 reserved2; | 
 | 486 | 	__le32 log_event_table_ptr; | 
 | 487 | 	__le32 error_event_table_ptr; | 
 | 488 | 	__le32 timestamp; | 
 | 489 | 	__le32 is_valid; | 
 | 490 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 491 | 	/* calibration values from "initialize" uCode */ | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 492 | 	__le32 voltage;		/* signed, higher value is lower voltage */ | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 493 | 	__le32 therm_r1[2];	/* signed, 1st for normal, 2nd for HT40 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 494 | 	__le32 therm_r2[2];	/* signed */ | 
 | 495 | 	__le32 therm_r3[2];	/* signed */ | 
 | 496 | 	__le32 therm_r4[2];	/* signed */ | 
 | 497 | 	__le32 tx_atten[5][2];	/* signed MIMO gain comp, 5 freq groups, | 
 | 498 | 				 * 2 Tx chains */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 499 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 500 |  | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 501 |  | 
 | 502 | /** | 
 | 503 |  * REPLY_ALIVE = 0x1 (response only, not a command) | 
 | 504 |  * | 
 | 505 |  * uCode issues this "alive" notification once the runtime image is ready | 
 | 506 |  * to receive commands from the driver.  This is the *second* "alive" | 
 | 507 |  * notification that the driver will receive after rebooting uCode; | 
 | 508 |  * this "alive" is indicated by subtype field != 9. | 
 | 509 |  * | 
 | 510 |  * See comments documenting "BSM" (bootstrap state machine). | 
 | 511 |  * | 
 | 512 |  * This response includes two pointers to structures within the device's | 
 | 513 |  * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: | 
 | 514 |  * | 
 | 515 |  * 1)  log_event_table_ptr indicates base of the event log.  This traces | 
 | 516 |  *     a 256-entry history of uCode execution within a circular buffer. | 
 | 517 |  *     Its header format is: | 
 | 518 |  * | 
 | 519 |  *	__le32 log_size;     log capacity (in number of entries) | 
 | 520 |  *	__le32 type;         (1) timestamp with each entry, (0) no timestamp | 
 | 521 |  *	__le32 wraps;        # times uCode has wrapped to top of circular buffer | 
 | 522 |  *      __le32 write_index;  next circular buffer entry that uCode would fill | 
 | 523 |  * | 
 | 524 |  *     The header is followed by the circular buffer of log entries.  Entries | 
 | 525 |  *     with timestamps have the following format: | 
 | 526 |  * | 
 | 527 |  *	__le32 event_id;     range 0 - 1500 | 
 | 528 |  *	__le32 timestamp;    low 32 bits of TSF (of network, if associated) | 
 | 529 |  *	__le32 data;         event_id-specific data value | 
 | 530 |  * | 
 | 531 |  *     Entries without timestamps contain only event_id and data. | 
 | 532 |  * | 
| Wey-Yi Guy | 461ef38 | 2010-03-30 17:57:53 -0700 | [diff] [blame] | 533 |  * | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 534 |  * 2)  error_event_table_ptr indicates base of the error log.  This contains | 
| Wey-Yi Guy | 461ef38 | 2010-03-30 17:57:53 -0700 | [diff] [blame] | 535 |  *     information about any uCode error that occurs.  For agn, the format | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 536 |  *     of the error log is: | 
 | 537 |  * | 
 | 538 |  *	__le32 valid;        (nonzero) valid, (0) log is empty | 
 | 539 |  *	__le32 error_id;     type of error | 
 | 540 |  *	__le32 pc;           program counter | 
 | 541 |  *	__le32 blink1;       branch link | 
 | 542 |  *	__le32 blink2;       branch link | 
 | 543 |  *	__le32 ilink1;       interrupt link | 
 | 544 |  *	__le32 ilink2;       interrupt link | 
 | 545 |  *	__le32 data1;        error-specific data | 
 | 546 |  *	__le32 data2;        error-specific data | 
 | 547 |  *	__le32 line;         source code line of error | 
 | 548 |  *	__le32 bcon_time;    beacon timer | 
 | 549 |  *	__le32 tsf_low;      network timestamp function timer | 
 | 550 |  *	__le32 tsf_hi;       network timestamp function timer | 
| Wey-Yi Guy | 461ef38 | 2010-03-30 17:57:53 -0700 | [diff] [blame] | 551 |  *	__le32 gp1;          GP1 timer register | 
 | 552 |  *	__le32 gp2;          GP2 timer register | 
 | 553 |  *	__le32 gp3;          GP3 timer register | 
 | 554 |  *	__le32 ucode_ver;    uCode version | 
 | 555 |  *	__le32 hw_ver;       HW Silicon version | 
 | 556 |  *	__le32 brd_ver;      HW board version | 
 | 557 |  *	__le32 log_pc;       log program counter | 
 | 558 |  *	__le32 frame_ptr;    frame pointer | 
 | 559 |  *	__le32 stack_ptr;    stack pointer | 
 | 560 |  *	__le32 hcmd;         last host command | 
 | 561 |  *	__le32 isr0;         isr status register LMPM_NIC_ISR0: rxtx_flag | 
 | 562 |  *	__le32 isr1;         isr status register LMPM_NIC_ISR1: host_flag | 
 | 563 |  *	__le32 isr2;         isr status register LMPM_NIC_ISR2: enc_flag | 
 | 564 |  *	__le32 isr3;         isr status register LMPM_NIC_ISR3: time_flag | 
 | 565 |  *	__le32 isr4;         isr status register LMPM_NIC_ISR4: wico interrupt | 
 | 566 |  *	__le32 isr_pref;     isr status register LMPM_NIC_PREF_STAT | 
 | 567 |  *	__le32 wait_event;   wait event() caller address | 
 | 568 |  *	__le32 l2p_control;  L2pControlField | 
 | 569 |  *	__le32 l2p_duration; L2pDurationField | 
 | 570 |  *	__le32 l2p_mhvalid;  L2pMhValidBits | 
 | 571 |  *	__le32 l2p_addr_match; L2pAddrMatchStat | 
 | 572 |  *	__le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL) | 
 | 573 |  *	__le32 u_timestamp;  indicate when the date and time of the compilation | 
 | 574 |  *	__le32 reserved; | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 575 |  * | 
 | 576 |  * The Linux driver can print both logs to the system log when a uCode error | 
 | 577 |  * occurs. | 
 | 578 |  */ | 
| Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 579 | struct iwl_alive_resp { | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 580 | 	u8 ucode_minor; | 
 | 581 | 	u8 ucode_major; | 
 | 582 | 	__le16 reserved1; | 
 | 583 | 	u8 sw_rev[8]; | 
 | 584 | 	u8 ver_type; | 
 | 585 | 	u8 ver_subtype;			/* not "9" for runtime alive */ | 
 | 586 | 	__le16 reserved2; | 
 | 587 | 	__le32 log_event_table_ptr;	/* SRAM address for event log */ | 
 | 588 | 	__le32 error_event_table_ptr;	/* SRAM address for error log */ | 
 | 589 | 	__le32 timestamp; | 
 | 590 | 	__le32 is_valid; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 591 | } __packed; | 
| Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 592 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 593 | /* | 
 | 594 |  * REPLY_ERROR = 0x2 (response only, not a command) | 
 | 595 |  */ | 
| Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 596 | struct iwl_error_resp { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 597 | 	__le32 error_type; | 
 | 598 | 	u8 cmd_id; | 
 | 599 | 	u8 reserved1; | 
 | 600 | 	__le16 bad_cmd_seq_num; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 601 | 	__le32 error_info; | 
| Tomas Winkler | 3195c1f | 2008-10-08 09:37:30 +0800 | [diff] [blame] | 602 | 	__le64 timestamp; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 603 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 604 |  | 
 | 605 | /****************************************************************************** | 
 | 606 |  * (1) | 
 | 607 |  * RXON Commands & Responses: | 
 | 608 |  * | 
 | 609 |  *****************************************************************************/ | 
 | 610 |  | 
 | 611 | /* | 
 | 612 |  * Rx config defines & structure | 
 | 613 |  */ | 
 | 614 | /* rx_config device types  */ | 
 | 615 | enum { | 
 | 616 | 	RXON_DEV_TYPE_AP = 1, | 
 | 617 | 	RXON_DEV_TYPE_ESS = 3, | 
 | 618 | 	RXON_DEV_TYPE_IBSS = 4, | 
 | 619 | 	RXON_DEV_TYPE_SNIFFER = 6, | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 620 | 	RXON_DEV_TYPE_CP = 7, | 
 | 621 | 	RXON_DEV_TYPE_2STA = 8, | 
 | 622 | 	RXON_DEV_TYPE_P2P = 9, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 623 | }; | 
 | 624 |  | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 625 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 626 | #define RXON_RX_CHAIN_DRIVER_FORCE_MSK		cpu_to_le16(0x1 << 0) | 
| Rick Farrington | 7b84172 | 2009-01-23 13:45:10 -0800 | [diff] [blame] | 627 | #define RXON_RX_CHAIN_DRIVER_FORCE_POS		(0) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 628 | #define RXON_RX_CHAIN_VALID_MSK			cpu_to_le16(0x7 << 1) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 629 | #define RXON_RX_CHAIN_VALID_POS			(1) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 630 | #define RXON_RX_CHAIN_FORCE_SEL_MSK		cpu_to_le16(0x7 << 4) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 631 | #define RXON_RX_CHAIN_FORCE_SEL_POS		(4) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 632 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK	cpu_to_le16(0x7 << 7) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 633 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS	(7) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 634 | #define RXON_RX_CHAIN_CNT_MSK			cpu_to_le16(0x3 << 10) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 635 | #define RXON_RX_CHAIN_CNT_POS			(10) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 636 | #define RXON_RX_CHAIN_MIMO_CNT_MSK		cpu_to_le16(0x3 << 12) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 637 | #define RXON_RX_CHAIN_MIMO_CNT_POS		(12) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 638 | #define RXON_RX_CHAIN_MIMO_FORCE_MSK		cpu_to_le16(0x1 << 14) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 639 | #define RXON_RX_CHAIN_MIMO_FORCE_POS		(14) | 
 | 640 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 641 | /* rx_config flags */ | 
 | 642 | /* band & modulation selection */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 643 | #define RXON_FLG_BAND_24G_MSK           cpu_to_le32(1 << 0) | 
 | 644 | #define RXON_FLG_CCK_MSK                cpu_to_le32(1 << 1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 645 | /* auto detection enable */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 646 | #define RXON_FLG_AUTO_DETECT_MSK        cpu_to_le32(1 << 2) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 647 | /* TGg protection when tx */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 648 | #define RXON_FLG_TGG_PROTECT_MSK        cpu_to_le32(1 << 3) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 649 | /* cck short slot & preamble */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 650 | #define RXON_FLG_SHORT_SLOT_MSK          cpu_to_le32(1 << 4) | 
 | 651 | #define RXON_FLG_SHORT_PREAMBLE_MSK     cpu_to_le32(1 << 5) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 652 | /* antenna selection */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 653 | #define RXON_FLG_DIS_DIV_MSK            cpu_to_le32(1 << 7) | 
 | 654 | #define RXON_FLG_ANT_SEL_MSK            cpu_to_le32(0x0f00) | 
 | 655 | #define RXON_FLG_ANT_A_MSK              cpu_to_le32(1 << 8) | 
 | 656 | #define RXON_FLG_ANT_B_MSK              cpu_to_le32(1 << 9) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 657 | /* radar detection enable */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 658 | #define RXON_FLG_RADAR_DETECT_MSK       cpu_to_le32(1 << 12) | 
 | 659 | #define RXON_FLG_TGJ_NARROW_BAND_MSK    cpu_to_le32(1 << 13) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 660 | /* rx response to host with 8-byte TSF | 
 | 661 | * (according to ON_AIR deassertion) */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 662 | #define RXON_FLG_TSF2HOST_MSK           cpu_to_le32(1 << 15) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 663 |  | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 664 |  | 
 | 665 | /* HT flags */ | 
 | 666 | #define RXON_FLG_CTRL_CHANNEL_LOC_POS		(22) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 667 | #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK	cpu_to_le32(0x1 << 22) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 668 |  | 
 | 669 | #define RXON_FLG_HT_OPERATING_MODE_POS		(23) | 
 | 670 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 671 | #define RXON_FLG_HT_PROT_MSK			cpu_to_le32(0x1 << 23) | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 672 | #define RXON_FLG_HT40_PROT_MSK			cpu_to_le32(0x2 << 23) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 673 |  | 
 | 674 | #define RXON_FLG_CHANNEL_MODE_POS		(25) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 675 | #define RXON_FLG_CHANNEL_MODE_MSK		cpu_to_le32(0x3 << 25) | 
| Wey-Yi Guy | a2b0f02 | 2009-05-22 11:01:49 -0700 | [diff] [blame] | 676 |  | 
 | 677 | /* channel mode */ | 
 | 678 | enum { | 
 | 679 | 	CHANNEL_MODE_LEGACY = 0, | 
 | 680 | 	CHANNEL_MODE_PURE_40 = 1, | 
 | 681 | 	CHANNEL_MODE_MIXED = 2, | 
 | 682 | 	CHANNEL_MODE_RESERVED = 3, | 
 | 683 | }; | 
 | 684 | #define RXON_FLG_CHANNEL_MODE_LEGACY	cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) | 
 | 685 | #define RXON_FLG_CHANNEL_MODE_PURE_40	cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) | 
 | 686 | #define RXON_FLG_CHANNEL_MODE_MIXED	cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) | 
 | 687 |  | 
| Emmanuel Grumbach | a326a5d | 2008-07-11 11:53:31 +0800 | [diff] [blame] | 688 | /* CTS to self (if spec allows) flag */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 689 | #define RXON_FLG_SELF_CTS_EN			cpu_to_le32(0x1<<30) | 
| Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 690 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 691 | /* rx_config filter flags */ | 
 | 692 | /* accept all data frames */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 693 | #define RXON_FILTER_PROMISC_MSK         cpu_to_le32(1 << 0) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 694 | /* pass control & management to host */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 695 | #define RXON_FILTER_CTL2HOST_MSK        cpu_to_le32(1 << 1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 696 | /* accept multi-cast */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 697 | #define RXON_FILTER_ACCEPT_GRP_MSK      cpu_to_le32(1 << 2) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 698 | /* don't decrypt uni-cast frames */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 699 | #define RXON_FILTER_DIS_DECRYPT_MSK     cpu_to_le32(1 << 3) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 700 | /* don't decrypt multi-cast frames */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 701 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 702 | /* STA is associated */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 703 | #define RXON_FILTER_ASSOC_MSK           cpu_to_le32(1 << 5) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 704 | /* transfer to host non bssid beacons in associated state */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 705 | #define RXON_FILTER_BCON_AWARE_MSK      cpu_to_le32(1 << 6) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 706 |  | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 707 | /** | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 708 |  * REPLY_RXON = 0x10 (command, has simple generic response) | 
| Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 709 |  * | 
 | 710 |  * RXON tunes the radio tuner to a service channel, and sets up a number | 
 | 711 |  * of parameters that are used primarily for Rx, but also for Tx operations. | 
 | 712 |  * | 
 | 713 |  * NOTE:  When tuning to a new channel, driver must set the | 
 | 714 |  *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent | 
 | 715 |  *        info within the device, including the station tables, tx retry | 
 | 716 |  *        rate tables, and txpower tables.  Driver must build a new station | 
 | 717 |  *        table and txpower table before transmitting anything on the RXON | 
 | 718 |  *        channel. | 
 | 719 |  * | 
 | 720 |  * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must | 
 | 721 |  *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), | 
 | 722 |  *        regardless of whether RXON_FILTER_ASSOC_MSK is set. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 723 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 724 |  | 
 | 725 | struct iwl3945_rxon_cmd { | 
 | 726 | 	u8 node_addr[6]; | 
 | 727 | 	__le16 reserved1; | 
 | 728 | 	u8 bssid_addr[6]; | 
 | 729 | 	__le16 reserved2; | 
 | 730 | 	u8 wlap_bssid_addr[6]; | 
 | 731 | 	__le16 reserved3; | 
 | 732 | 	u8 dev_type; | 
 | 733 | 	u8 air_propagation; | 
 | 734 | 	__le16 reserved4; | 
 | 735 | 	u8 ofdm_basic_rates; | 
 | 736 | 	u8 cck_basic_rates; | 
 | 737 | 	__le16 assoc_id; | 
 | 738 | 	__le32 flags; | 
 | 739 | 	__le32 filter_flags; | 
 | 740 | 	__le16 channel; | 
 | 741 | 	__le16 reserved5; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 742 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 743 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 744 | struct iwl4965_rxon_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 745 | 	u8 node_addr[6]; | 
 | 746 | 	__le16 reserved1; | 
 | 747 | 	u8 bssid_addr[6]; | 
 | 748 | 	__le16 reserved2; | 
 | 749 | 	u8 wlap_bssid_addr[6]; | 
 | 750 | 	__le16 reserved3; | 
 | 751 | 	u8 dev_type; | 
 | 752 | 	u8 air_propagation; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 753 | 	__le16 rx_chain; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 754 | 	u8 ofdm_basic_rates; | 
 | 755 | 	u8 cck_basic_rates; | 
 | 756 | 	__le16 assoc_id; | 
 | 757 | 	__le32 flags; | 
 | 758 | 	__le32 filter_flags; | 
 | 759 | 	__le16 channel; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 760 | 	u8 ofdm_ht_single_stream_basic_rates; | 
 | 761 | 	u8 ofdm_ht_dual_stream_basic_rates; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 762 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 763 |  | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 764 | /* 5000 HW just extend this command */ | 
| Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 765 | struct iwl_rxon_cmd { | 
 | 766 | 	u8 node_addr[6]; | 
 | 767 | 	__le16 reserved1; | 
 | 768 | 	u8 bssid_addr[6]; | 
 | 769 | 	__le16 reserved2; | 
 | 770 | 	u8 wlap_bssid_addr[6]; | 
 | 771 | 	__le16 reserved3; | 
 | 772 | 	u8 dev_type; | 
 | 773 | 	u8 air_propagation; | 
 | 774 | 	__le16 rx_chain; | 
 | 775 | 	u8 ofdm_basic_rates; | 
 | 776 | 	u8 cck_basic_rates; | 
 | 777 | 	__le16 assoc_id; | 
 | 778 | 	__le32 flags; | 
 | 779 | 	__le32 filter_flags; | 
 | 780 | 	__le16 channel; | 
 | 781 | 	u8 ofdm_ht_single_stream_basic_rates; | 
 | 782 | 	u8 ofdm_ht_dual_stream_basic_rates; | 
 | 783 | 	u8 ofdm_ht_triple_stream_basic_rates; | 
 | 784 | 	u8 reserved5; | 
 | 785 | 	__le16 acquisition_data; | 
 | 786 | 	__le16 reserved6; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 787 | } __packed; | 
| Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 788 |  | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 789 | /* | 
 | 790 |  * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) | 
 | 791 |  */ | 
 | 792 | struct iwl3945_rxon_assoc_cmd { | 
 | 793 | 	__le32 flags; | 
 | 794 | 	__le32 filter_flags; | 
 | 795 | 	u8 ofdm_basic_rates; | 
 | 796 | 	u8 cck_basic_rates; | 
 | 797 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 798 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 799 |  | 
 | 800 | struct iwl4965_rxon_assoc_cmd { | 
 | 801 | 	__le32 flags; | 
 | 802 | 	__le32 filter_flags; | 
 | 803 | 	u8 ofdm_basic_rates; | 
 | 804 | 	u8 cck_basic_rates; | 
 | 805 | 	u8 ofdm_ht_single_stream_basic_rates; | 
 | 806 | 	u8 ofdm_ht_dual_stream_basic_rates; | 
 | 807 | 	__le16 rx_chain_select_flags; | 
 | 808 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 809 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 810 |  | 
| Ron Rindjunsky | fe7a90c | 2008-05-29 16:35:14 +0800 | [diff] [blame] | 811 | struct iwl5000_rxon_assoc_cmd { | 
 | 812 | 	__le32 flags; | 
 | 813 | 	__le32 filter_flags; | 
 | 814 | 	u8 ofdm_basic_rates; | 
 | 815 | 	u8 cck_basic_rates; | 
 | 816 | 	__le16 reserved1; | 
 | 817 | 	u8 ofdm_ht_single_stream_basic_rates; | 
 | 818 | 	u8 ofdm_ht_dual_stream_basic_rates; | 
 | 819 | 	u8 ofdm_ht_triple_stream_basic_rates; | 
 | 820 | 	u8 reserved2; | 
 | 821 | 	__le16 rx_chain_select_flags; | 
 | 822 | 	__le16 acquisition_data; | 
 | 823 | 	__le32 reserved3; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 824 | } __packed; | 
| Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 825 |  | 
| Tomas Winkler | b5d7be5 | 2008-07-19 04:41:24 +0300 | [diff] [blame] | 826 | #define IWL_CONN_MAX_LISTEN_INTERVAL	10 | 
| Tomas Winkler | 2c2f3b3 | 2009-06-19 13:52:45 -0700 | [diff] [blame] | 827 | #define IWL_MAX_UCODE_BEACON_INTERVAL	4 /* 4096 */ | 
 | 828 | #define IWL39_MAX_UCODE_BEACON_INTERVAL	1 /* 1024 */ | 
| Ron Rindjunsky | fe7a90c | 2008-05-29 16:35:14 +0800 | [diff] [blame] | 829 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 830 | /* | 
 | 831 |  * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) | 
 | 832 |  */ | 
| Tomas Winkler | 3195c1f | 2008-10-08 09:37:30 +0800 | [diff] [blame] | 833 | struct iwl_rxon_time_cmd { | 
 | 834 | 	__le64 timestamp; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 835 | 	__le16 beacon_interval; | 
 | 836 | 	__le16 atim_window; | 
 | 837 | 	__le32 beacon_init_val; | 
 | 838 | 	__le16 listen_interval; | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 839 | 	u8 dtim_period; | 
 | 840 | 	u8 delta_cp_bss_tbtts; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 841 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 842 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 843 | /* | 
 | 844 |  * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) | 
 | 845 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 846 | struct iwl3945_channel_switch_cmd { | 
 | 847 | 	u8 band; | 
 | 848 | 	u8 expect_beacon; | 
 | 849 | 	__le16 channel; | 
 | 850 | 	__le32 rxon_flags; | 
 | 851 | 	__le32 rxon_filter_flags; | 
 | 852 | 	__le32 switch_time; | 
 | 853 | 	struct iwl3945_power_per_rate power[IWL_MAX_RATES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 854 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 855 |  | 
| Wey-Yi Guy | e57f148 | 2009-10-09 13:20:34 -0700 | [diff] [blame] | 856 | struct iwl4965_channel_switch_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 857 | 	u8 band; | 
 | 858 | 	u8 expect_beacon; | 
 | 859 | 	__le16 channel; | 
 | 860 | 	__le32 rxon_flags; | 
 | 861 | 	__le32 rxon_filter_flags; | 
 | 862 | 	__le32 switch_time; | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 863 | 	struct iwl4965_tx_power_db tx_power; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 864 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 865 |  | 
| Wey-Yi Guy | e57f148 | 2009-10-09 13:20:34 -0700 | [diff] [blame] | 866 | /** | 
 | 867 |  * struct iwl5000_channel_switch_cmd | 
 | 868 |  * @band: 0- 5.2GHz, 1- 2.4GHz | 
 | 869 |  * @expect_beacon: 0- resume transmits after channel switch | 
 | 870 |  *		   1- wait for beacon to resume transmits | 
 | 871 |  * @channel: new channel number | 
 | 872 |  * @rxon_flags: Rx on flags | 
 | 873 |  * @rxon_filter_flags: filtering parameters | 
 | 874 |  * @switch_time: switch time in extended beacon format | 
 | 875 |  * @reserved: reserved bytes | 
 | 876 |  */ | 
 | 877 | struct iwl5000_channel_switch_cmd { | 
 | 878 | 	u8 band; | 
 | 879 | 	u8 expect_beacon; | 
 | 880 | 	__le16 channel; | 
 | 881 | 	__le32 rxon_flags; | 
 | 882 | 	__le32 rxon_filter_flags; | 
 | 883 | 	__le32 switch_time; | 
 | 884 | 	__le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 885 | } __packed; | 
| Wey-Yi Guy | e57f148 | 2009-10-09 13:20:34 -0700 | [diff] [blame] | 886 |  | 
 | 887 | /** | 
 | 888 |  * struct iwl6000_channel_switch_cmd | 
 | 889 |  * @band: 0- 5.2GHz, 1- 2.4GHz | 
 | 890 |  * @expect_beacon: 0- resume transmits after channel switch | 
 | 891 |  *		   1- wait for beacon to resume transmits | 
 | 892 |  * @channel: new channel number | 
 | 893 |  * @rxon_flags: Rx on flags | 
 | 894 |  * @rxon_filter_flags: filtering parameters | 
 | 895 |  * @switch_time: switch time in extended beacon format | 
 | 896 |  * @reserved: reserved bytes | 
 | 897 |  */ | 
 | 898 | struct iwl6000_channel_switch_cmd { | 
 | 899 | 	u8 band; | 
 | 900 | 	u8 expect_beacon; | 
 | 901 | 	__le16 channel; | 
 | 902 | 	__le32 rxon_flags; | 
 | 903 | 	__le32 rxon_filter_flags; | 
 | 904 | 	__le32 switch_time; | 
 | 905 | 	__le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 906 | } __packed; | 
| Wey-Yi Guy | e57f148 | 2009-10-09 13:20:34 -0700 | [diff] [blame] | 907 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 908 | /* | 
 | 909 |  * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) | 
 | 910 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 911 | struct iwl_csa_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 912 | 	__le16 band; | 
 | 913 | 	__le16 channel; | 
 | 914 | 	__le32 status;		/* 0 - OK, 1 - fail */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 915 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 916 |  | 
 | 917 | /****************************************************************************** | 
 | 918 |  * (2) | 
 | 919 |  * Quality-of-Service (QOS) Commands & Responses: | 
 | 920 |  * | 
 | 921 |  *****************************************************************************/ | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 922 |  | 
 | 923 | /** | 
 | 924 |  * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM | 
 | 925 |  * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd | 
 | 926 |  * | 
 | 927 |  * @cw_min: Contention window, start value in numbers of slots. | 
 | 928 |  *          Should be a power-of-2, minus 1.  Device's default is 0x0f. | 
 | 929 |  * @cw_max: Contention window, max value in numbers of slots. | 
 | 930 |  *          Should be a power-of-2, minus 1.  Device's default is 0x3f. | 
 | 931 |  * @aifsn:  Number of slots in Arbitration Interframe Space (before | 
 | 932 |  *          performing random backoff timing prior to Tx).  Device default 1. | 
 | 933 |  * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0. | 
 | 934 |  * | 
 | 935 |  * Device will automatically increase contention window by (2*CW) + 1 for each | 
 | 936 |  * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW | 
 | 937 |  * value, to cap the CW value. | 
 | 938 |  */ | 
| Emmanuel Grumbach | 1ff50bd | 2008-07-11 11:53:34 +0800 | [diff] [blame] | 939 | struct iwl_ac_qos { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 940 | 	__le16 cw_min; | 
 | 941 | 	__le16 cw_max; | 
 | 942 | 	u8 aifsn; | 
 | 943 | 	u8 reserved1; | 
 | 944 | 	__le16 edca_txop; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 945 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 946 |  | 
 | 947 | /* QoS flags defines */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 948 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK	cpu_to_le32(0x01) | 
 | 949 | #define QOS_PARAM_FLG_TGN_MSK		cpu_to_le32(0x02) | 
 | 950 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK	cpu_to_le32(0x10) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 951 |  | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 952 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 953 | #define AC_NUM                4 | 
 | 954 |  | 
 | 955 | /* | 
 | 956 |  * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 957 |  * | 
 | 958 |  * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs | 
 | 959 |  * 0: Background, 1: Best Effort, 2: Video, 3: Voice. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 960 |  */ | 
| Emmanuel Grumbach | 1ff50bd | 2008-07-11 11:53:34 +0800 | [diff] [blame] | 961 | struct iwl_qosparam_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 962 | 	__le32 qos_flags; | 
| Emmanuel Grumbach | 1ff50bd | 2008-07-11 11:53:34 +0800 | [diff] [blame] | 963 | 	struct iwl_ac_qos ac[AC_NUM]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 964 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 965 |  | 
 | 966 | /****************************************************************************** | 
 | 967 |  * (3) | 
 | 968 |  * Add/Modify Stations Commands & Responses: | 
 | 969 |  * | 
 | 970 |  *****************************************************************************/ | 
 | 971 | /* | 
 | 972 |  * Multi station support | 
 | 973 |  */ | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 974 |  | 
 | 975 | /* Special, dedicated locations within device's station table */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 976 | #define	IWL_AP_ID		0 | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 977 | #define	IWL_AP_ID_PAN		1 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 978 | #define	IWL_STA_ID		2 | 
| Tomas Winkler | 4c89725 | 2008-12-19 10:37:05 +0800 | [diff] [blame] | 979 | #define	IWL3945_BROADCAST_ID	24 | 
 | 980 | #define IWL3945_STATION_COUNT	25 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 981 | #define IWL4965_BROADCAST_ID	31 | 
 | 982 | #define	IWL4965_STATION_COUNT	32 | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 983 | #define IWLAGN_PAN_BCAST_ID	14 | 
| Wey-Yi Guy | bf3c7fd | 2010-06-24 14:08:05 -0700 | [diff] [blame] | 984 | #define IWLAGN_BROADCAST_ID	15 | 
 | 985 | #define	IWLAGN_STATION_COUNT	16 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 986 |  | 
 | 987 | #define	IWL_STATION_COUNT	32 	/* MAX(3945,4965)*/ | 
 | 988 | #define	IWL_INVALID_STATION 	255 | 
 | 989 |  | 
| Johannes Berg | 1bd14ea | 2010-07-15 11:48:21 -0700 | [diff] [blame] | 990 | #define STA_FLG_TX_RATE_MSK		cpu_to_le32(1 << 2) | 
 | 991 | #define STA_FLG_PWR_SAVE_MSK		cpu_to_le32(1 << 8) | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 992 | #define STA_FLG_PAN_STATION		cpu_to_le32(1 << 13) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 993 | #define STA_FLG_RTS_MIMO_PROT_MSK	cpu_to_le32(1 << 17) | 
 | 994 | #define STA_FLG_AGG_MPDU_8US_MSK	cpu_to_le32(1 << 18) | 
| Ben Cahill | 74093dd | 2007-11-29 11:09:53 +0800 | [diff] [blame] | 995 | #define STA_FLG_MAX_AGG_SIZE_POS	(19) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 996 | #define STA_FLG_MAX_AGG_SIZE_MSK	cpu_to_le32(3 << 19) | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 997 | #define STA_FLG_HT40_EN_MSK		cpu_to_le32(1 << 21) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 998 | #define STA_FLG_MIMO_DIS_MSK		cpu_to_le32(1 << 22) | 
| Ben Cahill | 74093dd | 2007-11-29 11:09:53 +0800 | [diff] [blame] | 999 | #define STA_FLG_AGG_MPDU_DENSITY_POS	(23) | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1000 | #define STA_FLG_AGG_MPDU_DENSITY_MSK	cpu_to_le32(7 << 23) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1001 |  | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1002 | /* Use in mode field.  1: modify existing entry, 0: add new station entry */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1003 | #define STA_CONTROL_MODIFY_MSK		0x01 | 
 | 1004 |  | 
 | 1005 | /* key flags __le16*/ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1006 | #define STA_KEY_FLG_ENCRYPT_MSK	cpu_to_le16(0x0007) | 
 | 1007 | #define STA_KEY_FLG_NO_ENC	cpu_to_le16(0x0000) | 
 | 1008 | #define STA_KEY_FLG_WEP		cpu_to_le16(0x0001) | 
 | 1009 | #define STA_KEY_FLG_CCMP	cpu_to_le16(0x0002) | 
 | 1010 | #define STA_KEY_FLG_TKIP	cpu_to_le16(0x0003) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1011 |  | 
 | 1012 | #define STA_KEY_FLG_KEYID_POS	8 | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1013 | #define STA_KEY_FLG_INVALID 	cpu_to_le16(0x0800) | 
| Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 1014 | /* wep key is either from global key (0) or from station info array (1) */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1015 | #define STA_KEY_FLG_MAP_KEY_MSK	cpu_to_le16(0x0008) | 
| Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 1016 |  | 
 | 1017 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1018 | #define STA_KEY_FLG_KEY_SIZE_MSK     cpu_to_le16(0x1000) | 
 | 1019 | #define STA_KEY_MULTICAST_MSK        cpu_to_le16(0x4000) | 
| Emmanuel Grumbach | deb09c4 | 2008-03-19 16:41:41 -0700 | [diff] [blame] | 1020 | #define STA_KEY_MAX_NUM		8 | 
| Johannes Berg | c10afb6 | 2010-08-23 10:46:43 +0200 | [diff] [blame] | 1021 | #define STA_KEY_MAX_NUM_PAN	16 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1022 |  | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1023 | /* Flags indicate whether to modify vs. don't change various station params */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1024 | #define	STA_MODIFY_KEY_MASK		0x01 | 
 | 1025 | #define	STA_MODIFY_TID_DISABLE_TX	0x02 | 
 | 1026 | #define	STA_MODIFY_TX_RATE_MSK		0x04 | 
 | 1027 | #define STA_MODIFY_ADDBA_TID_MSK	0x08 | 
 | 1028 | #define STA_MODIFY_DELBA_TID_MSK	0x10 | 
| Johannes Berg | 6ab10ff | 2009-11-13 11:56:37 -0800 | [diff] [blame] | 1029 | #define STA_MODIFY_SLEEP_TX_COUNT_MSK	0x20 | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1030 |  | 
 | 1031 | /* Receiver address (actually, Rx station's index into station table), | 
 | 1032 |  * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1033 | #define BUILD_RAxTID(sta_id, tid)	(((sta_id) << 4) + (tid)) | 
 | 1034 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1035 | struct iwl4965_keyinfo { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1036 | 	__le16 key_flags; | 
 | 1037 | 	u8 tkip_rx_tsc_byte2;	/* TSC[2] for key mix ph1 detection */ | 
 | 1038 | 	u8 reserved1; | 
 | 1039 | 	__le16 tkip_rx_ttak[5];	/* 10-byte unicast TKIP TTAK */ | 
| Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 1040 | 	u8 key_offset; | 
 | 1041 | 	u8 reserved2; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1042 | 	u8 key[16];		/* 16-byte unicast decryption key */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1043 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1044 |  | 
| Wey-Yi Guy | a8029bb | 2010-09-20 09:12:32 -0700 | [diff] [blame] | 1045 | /* agn */ | 
| Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 1046 | struct iwl_keyinfo { | 
 | 1047 | 	__le16 key_flags; | 
 | 1048 | 	u8 tkip_rx_tsc_byte2;	/* TSC[2] for key mix ph1 detection */ | 
 | 1049 | 	u8 reserved1; | 
 | 1050 | 	__le16 tkip_rx_ttak[5];	/* 10-byte unicast TKIP TTAK */ | 
 | 1051 | 	u8 key_offset; | 
 | 1052 | 	u8 reserved2; | 
 | 1053 | 	u8 key[16];		/* 16-byte unicast decryption key */ | 
 | 1054 | 	__le64 tx_secur_seq_cnt; | 
 | 1055 | 	__le64 hw_tkip_mic_rx_key; | 
 | 1056 | 	__le64 hw_tkip_mic_tx_key; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1057 | } __packed; | 
| Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 1058 |  | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1059 | /** | 
 | 1060 |  * struct sta_id_modify | 
 | 1061 |  * @addr[ETH_ALEN]: station's MAC address | 
 | 1062 |  * @sta_id: index of station in uCode's station table | 
 | 1063 |  * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change | 
 | 1064 |  * | 
 | 1065 |  * Driver selects unused table index when adding new station, | 
 | 1066 |  * or the index to a pre-existing station entry when modifying that station. | 
 | 1067 |  * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). | 
 | 1068 |  * | 
 | 1069 |  * modify_mask flags select which parameters to modify vs. leave alone. | 
 | 1070 |  */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1071 | struct sta_id_modify { | 
 | 1072 | 	u8 addr[ETH_ALEN]; | 
 | 1073 | 	__le16 reserved1; | 
 | 1074 | 	u8 sta_id; | 
 | 1075 | 	u8 modify_mask; | 
 | 1076 | 	__le16 reserved2; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1077 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1078 |  | 
 | 1079 | /* | 
 | 1080 |  * REPLY_ADD_STA = 0x18 (command) | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1081 |  * | 
 | 1082 |  * The device contains an internal table of per-station information, | 
 | 1083 |  * with info on security keys, aggregation parameters, and Tx rates for | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1084 |  * initial Tx attempt and any retries (agn devices uses | 
 | 1085 |  * REPLY_TX_LINK_QUALITY_CMD, | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1086 |  * 3945 uses REPLY_RATE_SCALE to set up rate tables). | 
 | 1087 |  * | 
 | 1088 |  * REPLY_ADD_STA sets up the table entry for one station, either creating | 
 | 1089 |  * a new entry, or modifying a pre-existing one. | 
 | 1090 |  * | 
 | 1091 |  * NOTE:  RXON command (without "associated" bit set) wipes the station table | 
 | 1092 |  *        clean.  Moving into RF_KILL state does this also.  Driver must set up | 
 | 1093 |  *        new station table before transmitting anything on the RXON channel | 
 | 1094 |  *        (except active scans or active measurements; those commands carry | 
 | 1095 |  *        their own txpower/rate setup data). | 
 | 1096 |  * | 
 | 1097 |  *        When getting started on a new channel, driver must set up the | 
 | 1098 |  *        IWL_BROADCAST_ID entry (last entry in the table).  For a client | 
 | 1099 |  *        station in a BSS, once an AP is selected, driver sets up the AP STA | 
 | 1100 |  *        in the IWL_AP_ID entry (1st entry in the table).  BROADCAST and AP | 
 | 1101 |  *        are all that are needed for a BSS client station.  If the device is | 
 | 1102 |  *        used as AP, or in an IBSS network, driver must set up station table | 
 | 1103 |  *        entries for all STAs in network, starting with index IWL_STA_ID. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1104 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1105 |  | 
 | 1106 | struct iwl3945_addsta_cmd { | 
 | 1107 | 	u8 mode;		/* 1: modify existing, 0: add new station */ | 
 | 1108 | 	u8 reserved[3]; | 
 | 1109 | 	struct sta_id_modify sta; | 
 | 1110 | 	struct iwl4965_keyinfo key; | 
 | 1111 | 	__le32 station_flags;		/* STA_FLG_* */ | 
 | 1112 | 	__le32 station_flags_msk;	/* STA_FLG_* */ | 
 | 1113 |  | 
 | 1114 | 	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) | 
 | 1115 | 	 * corresponding to bit (e.g. bit 5 controls TID 5). | 
 | 1116 | 	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ | 
 | 1117 | 	__le16 tid_disable_tx; | 
 | 1118 |  | 
 | 1119 | 	__le16 rate_n_flags; | 
 | 1120 |  | 
 | 1121 | 	/* TID for which to add block-ack support. | 
 | 1122 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
 | 1123 | 	u8 add_immediate_ba_tid; | 
 | 1124 |  | 
 | 1125 | 	/* TID for which to remove block-ack support. | 
 | 1126 | 	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ | 
 | 1127 | 	u8 remove_immediate_ba_tid; | 
 | 1128 |  | 
 | 1129 | 	/* Starting Sequence Number for added block-ack support. | 
 | 1130 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
 | 1131 | 	__le16 add_immediate_ba_ssn; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1132 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1133 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1134 | struct iwl4965_addsta_cmd { | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1135 | 	u8 mode;		/* 1: modify existing, 0: add new station */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1136 | 	u8 reserved[3]; | 
 | 1137 | 	struct sta_id_modify sta; | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1138 | 	struct iwl4965_keyinfo key; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1139 | 	__le32 station_flags;		/* STA_FLG_* */ | 
 | 1140 | 	__le32 station_flags_msk;	/* STA_FLG_* */ | 
 | 1141 |  | 
 | 1142 | 	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) | 
 | 1143 | 	 * corresponding to bit (e.g. bit 5 controls TID 5). | 
 | 1144 | 	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1145 | 	__le16 tid_disable_tx; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1146 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1147 | 	__le16	reserved1; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1148 |  | 
 | 1149 | 	/* TID for which to add block-ack support. | 
 | 1150 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1151 | 	u8 add_immediate_ba_tid; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1152 |  | 
 | 1153 | 	/* TID for which to remove block-ack support. | 
 | 1154 | 	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1155 | 	u8 remove_immediate_ba_tid; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1156 |  | 
 | 1157 | 	/* Starting Sequence Number for added block-ack support. | 
 | 1158 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1159 | 	__le16 add_immediate_ba_ssn; | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1160 |  | 
| Johannes Berg | 9bb487b | 2009-11-13 11:56:36 -0800 | [diff] [blame] | 1161 | 	/* | 
 | 1162 | 	 * Number of packets OK to transmit to station even though | 
 | 1163 | 	 * it is asleep -- used to synchronise PS-poll and u-APSD | 
 | 1164 | 	 * responses while ucode keeps track of STA sleep state. | 
 | 1165 | 	 */ | 
 | 1166 | 	__le16 sleep_tx_count; | 
 | 1167 |  | 
 | 1168 | 	__le16 reserved2; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1169 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1170 |  | 
| Wey-Yi Guy | a8029bb | 2010-09-20 09:12:32 -0700 | [diff] [blame] | 1171 | /* agn */ | 
| Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 1172 | struct iwl_addsta_cmd { | 
 | 1173 | 	u8 mode;		/* 1: modify existing, 0: add new station */ | 
 | 1174 | 	u8 reserved[3]; | 
 | 1175 | 	struct sta_id_modify sta; | 
 | 1176 | 	struct iwl_keyinfo key; | 
 | 1177 | 	__le32 station_flags;		/* STA_FLG_* */ | 
 | 1178 | 	__le32 station_flags_msk;	/* STA_FLG_* */ | 
 | 1179 |  | 
 | 1180 | 	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) | 
 | 1181 | 	 * corresponding to bit (e.g. bit 5 controls TID 5). | 
 | 1182 | 	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ | 
 | 1183 | 	__le16 tid_disable_tx; | 
 | 1184 |  | 
| Tomas Winkler | c587de0 | 2009-06-03 11:44:07 -0700 | [diff] [blame] | 1185 | 	__le16	rate_n_flags;		/* 3945 only */ | 
| Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 1186 |  | 
 | 1187 | 	/* TID for which to add block-ack support. | 
 | 1188 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
 | 1189 | 	u8 add_immediate_ba_tid; | 
 | 1190 |  | 
 | 1191 | 	/* TID for which to remove block-ack support. | 
 | 1192 | 	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ | 
 | 1193 | 	u8 remove_immediate_ba_tid; | 
 | 1194 |  | 
 | 1195 | 	/* Starting Sequence Number for added block-ack support. | 
 | 1196 | 	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ | 
 | 1197 | 	__le16 add_immediate_ba_ssn; | 
 | 1198 |  | 
| Johannes Berg | 9bb487b | 2009-11-13 11:56:36 -0800 | [diff] [blame] | 1199 | 	/* | 
 | 1200 | 	 * Number of packets OK to transmit to station even though | 
 | 1201 | 	 * it is asleep -- used to synchronise PS-poll and u-APSD | 
 | 1202 | 	 * responses while ucode keeps track of STA sleep state. | 
 | 1203 | 	 */ | 
 | 1204 | 	__le16 sleep_tx_count; | 
 | 1205 |  | 
 | 1206 | 	__le16 reserved2; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1207 | } __packed; | 
| Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 1208 |  | 
 | 1209 |  | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1210 | #define ADD_STA_SUCCESS_MSK		0x1 | 
 | 1211 | #define ADD_STA_NO_ROOM_IN_TABLE	0x2 | 
 | 1212 | #define ADD_STA_NO_BLOCK_ACK_RESOURCE	0x4 | 
 | 1213 | #define ADD_STA_MODIFY_NON_EXIST_STA	0x8 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1214 | /* | 
 | 1215 |  * REPLY_ADD_STA = 0x18 (response) | 
 | 1216 |  */ | 
| Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 1217 | struct iwl_add_sta_resp { | 
| Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 1218 | 	u8 status;	/* ADD_STA_* */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1219 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1220 |  | 
| Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 1221 | #define REM_STA_SUCCESS_MSK              0x1 | 
 | 1222 | /* | 
 | 1223 |  *  REPLY_REM_STA = 0x19 (response) | 
 | 1224 |  */ | 
 | 1225 | struct iwl_rem_sta_resp { | 
 | 1226 | 	u8 status; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1227 | } __packed; | 
| Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 1228 |  | 
 | 1229 | /* | 
 | 1230 |  *  REPLY_REM_STA = 0x19 (command) | 
 | 1231 |  */ | 
 | 1232 | struct iwl_rem_sta_cmd { | 
 | 1233 | 	u8 num_sta;     /* number of removed stations */ | 
 | 1234 | 	u8 reserved[3]; | 
 | 1235 | 	u8 addr[ETH_ALEN]; /* MAC addr of the first station */ | 
 | 1236 | 	u8 reserved2[2]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1237 | } __packed; | 
| Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 1238 |  | 
| Wey-Yi Guy | 947279e | 2010-06-24 13:18:33 -0700 | [diff] [blame] | 1239 | #define IWL_TX_FIFO_BK_MSK		cpu_to_le32(BIT(0)) | 
 | 1240 | #define IWL_TX_FIFO_BE_MSK		cpu_to_le32(BIT(1)) | 
 | 1241 | #define IWL_TX_FIFO_VI_MSK		cpu_to_le32(BIT(2)) | 
 | 1242 | #define IWL_TX_FIFO_VO_MSK		cpu_to_le32(BIT(3)) | 
 | 1243 | #define IWL_AGG_TX_QUEUE_MSK		cpu_to_le32(0xffc00) | 
 | 1244 |  | 
| Wey-Yi Guy | 716c74b | 2010-06-24 13:22:36 -0700 | [diff] [blame] | 1245 | #define IWL_DROP_SINGLE		0 | 
 | 1246 | #define IWL_DROP_SELECTED	1 | 
 | 1247 | #define IWL_DROP_ALL		2 | 
 | 1248 |  | 
| Wey-Yi Guy | 947279e | 2010-06-24 13:18:33 -0700 | [diff] [blame] | 1249 | /* | 
 | 1250 |  * REPLY_TXFIFO_FLUSH = 0x1e(command and response) | 
 | 1251 |  * | 
 | 1252 |  * When using full FIFO flush this command checks the scheduler HW block WR/RD | 
 | 1253 |  * pointers to check if all the frames were transferred by DMA into the | 
 | 1254 |  * relevant TX FIFO queue. Only when the DMA is finished and the queue is | 
 | 1255 |  * empty the command can finish. | 
 | 1256 |  * This command is used to flush the TXFIFO from transmit commands, it may | 
 | 1257 |  * operate on single or multiple queues, the command queue can't be flushed by | 
 | 1258 |  * this command. The command response is returned when all the queue flush | 
 | 1259 |  * operations are done. Each TX command flushed return response with the FLUSH | 
 | 1260 |  * status set in the TX response status. When FIFO flush operation is used, | 
 | 1261 |  * the flush operation ends when both the scheduler DMA done and TXFIFO empty | 
 | 1262 |  * are set. | 
 | 1263 |  * | 
 | 1264 |  * @fifo_control: bit mask for which queues to flush | 
 | 1265 |  * @flush_control: flush controls | 
 | 1266 |  *	0: Dump single MSDU | 
 | 1267 |  *	1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable. | 
 | 1268 |  *	2: Dump all FIFO | 
 | 1269 |  */ | 
 | 1270 | struct iwl_txfifo_flush_cmd { | 
 | 1271 | 	__le32 fifo_control; | 
 | 1272 | 	__le16 flush_control; | 
 | 1273 | 	__le16 reserved; | 
| John W. Linville | 0e95409 | 2010-07-14 10:37:32 -0400 | [diff] [blame] | 1274 | } __packed; | 
| Wey-Yi Guy | 947279e | 2010-06-24 13:18:33 -0700 | [diff] [blame] | 1275 |  | 
| Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 1276 | /* | 
 | 1277 |  * REPLY_WEP_KEY = 0x20 | 
 | 1278 |  */ | 
 | 1279 | struct iwl_wep_key { | 
 | 1280 | 	u8 key_index; | 
 | 1281 | 	u8 key_offset; | 
 | 1282 | 	u8 reserved1[2]; | 
 | 1283 | 	u8 key_size; | 
 | 1284 | 	u8 reserved2[3]; | 
 | 1285 | 	u8 key[16]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1286 | } __packed; | 
| Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 1287 |  | 
 | 1288 | struct iwl_wep_cmd { | 
 | 1289 | 	u8 num_keys; | 
 | 1290 | 	u8 global_key_type; | 
 | 1291 | 	u8 flags; | 
 | 1292 | 	u8 reserved; | 
 | 1293 | 	struct iwl_wep_key key[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1294 | } __packed; | 
| Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 1295 |  | 
 | 1296 | #define WEP_KEY_WEP_TYPE 1 | 
 | 1297 | #define WEP_KEYS_MAX 4 | 
 | 1298 | #define WEP_INVALID_OFFSET 0xff | 
| Emmanuel Grumbach | 4564ce8 | 2008-06-12 09:47:09 +0800 | [diff] [blame] | 1299 | #define WEP_KEY_LEN_64 5 | 
| Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 1300 | #define WEP_KEY_LEN_128 13 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1301 |  | 
 | 1302 | /****************************************************************************** | 
 | 1303 |  * (4) | 
 | 1304 |  * Rx Responses: | 
 | 1305 |  * | 
 | 1306 |  *****************************************************************************/ | 
 | 1307 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1308 | #define RX_RES_STATUS_NO_CRC32_ERROR	cpu_to_le32(1 << 0) | 
 | 1309 | #define RX_RES_STATUS_NO_RXE_OVERFLOW	cpu_to_le32(1 << 1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1310 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1311 | #define RX_RES_PHY_FLAGS_BAND_24_MSK	cpu_to_le16(1 << 0) | 
 | 1312 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK		cpu_to_le16(1 << 1) | 
 | 1313 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK	cpu_to_le16(1 << 2) | 
 | 1314 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK	cpu_to_le16(1 << 3) | 
| Reinette Chatre | 9024adf | 2009-10-02 13:43:57 -0700 | [diff] [blame] | 1315 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK		0xf0 | 
| Daniel C Halperin | 9f30e04 | 2009-08-13 13:30:56 -0700 | [diff] [blame] | 1316 | #define RX_RES_PHY_FLAGS_ANTENNA_POS		4 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1317 |  | 
| Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1318 | #define RX_RES_STATUS_SEC_TYPE_MSK	(0x7 << 8) | 
 | 1319 | #define RX_RES_STATUS_SEC_TYPE_NONE	(0x0 << 8) | 
 | 1320 | #define RX_RES_STATUS_SEC_TYPE_WEP	(0x1 << 8) | 
 | 1321 | #define RX_RES_STATUS_SEC_TYPE_CCMP	(0x2 << 8) | 
 | 1322 | #define RX_RES_STATUS_SEC_TYPE_TKIP	(0x3 << 8) | 
| Emmanuel Grumbach | 17e476b | 2008-03-19 16:41:42 -0700 | [diff] [blame] | 1323 | #define	RX_RES_STATUS_SEC_TYPE_ERR	(0x7 << 8) | 
 | 1324 |  | 
 | 1325 | #define RX_RES_STATUS_STATION_FOUND	(1<<6) | 
 | 1326 | #define RX_RES_STATUS_NO_STATION_INFO_MISMATCH	(1<<7) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1327 |  | 
| Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1328 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK	(0x3 << 11) | 
 | 1329 | #define RX_RES_STATUS_NOT_DECRYPT	(0x0 << 11) | 
 | 1330 | #define RX_RES_STATUS_DECRYPT_OK	(0x3 << 11) | 
 | 1331 | #define RX_RES_STATUS_BAD_ICV_MIC	(0x1 << 11) | 
 | 1332 | #define RX_RES_STATUS_BAD_KEY_TTAK	(0x2 << 11) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1333 |  | 
| Emmanuel Grumbach | 17e476b | 2008-03-19 16:41:42 -0700 | [diff] [blame] | 1334 | #define RX_MPDU_RES_STATUS_ICV_OK	(0x20) | 
 | 1335 | #define RX_MPDU_RES_STATUS_MIC_OK	(0x40) | 
 | 1336 | #define RX_MPDU_RES_STATUS_TTAK_OK	(1 << 7) | 
 | 1337 | #define RX_MPDU_RES_STATUS_DEC_DONE_MSK	(0x800) | 
 | 1338 |  | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1339 |  | 
 | 1340 | struct iwl3945_rx_frame_stats { | 
 | 1341 | 	u8 phy_count; | 
 | 1342 | 	u8 id; | 
 | 1343 | 	u8 rssi; | 
 | 1344 | 	u8 agc; | 
 | 1345 | 	__le16 sig_avg; | 
 | 1346 | 	__le16 noise_diff; | 
 | 1347 | 	u8 payload[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1348 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1349 |  | 
 | 1350 | struct iwl3945_rx_frame_hdr { | 
 | 1351 | 	__le16 channel; | 
 | 1352 | 	__le16 phy_flags; | 
 | 1353 | 	u8 reserved1; | 
 | 1354 | 	u8 rate; | 
 | 1355 | 	__le16 len; | 
 | 1356 | 	u8 payload[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1357 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1358 |  | 
 | 1359 | struct iwl3945_rx_frame_end { | 
 | 1360 | 	__le32 status; | 
 | 1361 | 	__le64 timestamp; | 
 | 1362 | 	__le32 beacon_timestamp; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1363 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1364 |  | 
 | 1365 | /* | 
 | 1366 |  * REPLY_3945_RX = 0x1b (response only, not a command) | 
 | 1367 |  * | 
 | 1368 |  * NOTE:  DO NOT dereference from casts to this structure | 
 | 1369 |  * It is provided only for calculating minimum data set size. | 
 | 1370 |  * The actual offsets of the hdr and end are dynamic based on | 
 | 1371 |  * stats.phy_count | 
 | 1372 |  */ | 
 | 1373 | struct iwl3945_rx_frame { | 
 | 1374 | 	struct iwl3945_rx_frame_stats stats; | 
 | 1375 | 	struct iwl3945_rx_frame_hdr hdr; | 
 | 1376 | 	struct iwl3945_rx_frame_end end; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1377 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1378 |  | 
 | 1379 | #define IWL39_RX_FRAME_SIZE	(4 + sizeof(struct iwl3945_rx_frame)) | 
 | 1380 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1381 | /* Fixed (non-configurable) rx data from phy */ | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1382 |  | 
 | 1383 | #define IWL49_RX_RES_PHY_CNT 14 | 
 | 1384 | #define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET	(4) | 
 | 1385 | #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK	(0x70) | 
 | 1386 | #define IWL49_AGC_DB_MASK			(0x3f80)	/* MASK(7,13) */ | 
 | 1387 | #define IWL49_AGC_DB_POS			(7) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1388 | struct iwl4965_rx_non_cfg_phy { | 
 | 1389 | 	__le16 ant_selection;	/* ant A bit 4, ant B bit 5, ant C bit 6 */ | 
 | 1390 | 	__le16 agc_info;	/* agc code 0:6, agc dB 7:13, reserved 14:15 */ | 
 | 1391 | 	u8 rssi_info[6];	/* we use even entries, 0/2/4 for A/B/C rssi */ | 
 | 1392 | 	u8 pad[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1393 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1394 |  | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1395 |  | 
| Wey-Yi Guy | 7ccc896 | 2010-08-04 08:42:17 -0700 | [diff] [blame] | 1396 | #define IWLAGN_RX_RES_PHY_CNT 8 | 
 | 1397 | #define IWLAGN_RX_RES_AGC_IDX     1 | 
 | 1398 | #define IWLAGN_RX_RES_RSSI_AB_IDX 2 | 
 | 1399 | #define IWLAGN_RX_RES_RSSI_C_IDX  3 | 
 | 1400 | #define IWLAGN_OFDM_AGC_MSK 0xfe00 | 
 | 1401 | #define IWLAGN_OFDM_AGC_BIT_POS 9 | 
 | 1402 | #define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff | 
 | 1403 | #define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00 | 
 | 1404 | #define IWLAGN_OFDM_RSSI_A_BIT_POS 0 | 
 | 1405 | #define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000 | 
 | 1406 | #define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000 | 
 | 1407 | #define IWLAGN_OFDM_RSSI_B_BIT_POS 16 | 
 | 1408 | #define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff | 
 | 1409 | #define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00 | 
 | 1410 | #define IWLAGN_OFDM_RSSI_C_BIT_POS 0 | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1411 |  | 
| Wey-Yi Guy | 7ccc896 | 2010-08-04 08:42:17 -0700 | [diff] [blame] | 1412 | struct iwlagn_non_cfg_phy { | 
 | 1413 | 	__le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT];  /* up to 8 phy entries */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1414 | } __packed; | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1415 |  | 
 | 1416 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1417 | /* | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 1418 |  * REPLY_RX = 0xc3 (response only, not a command) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1419 |  * Used only for legacy (non 11n) frames. | 
 | 1420 |  */ | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1421 | struct iwl_rx_phy_res { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1422 | 	u8 non_cfg_phy_cnt;     /* non configurable DSP phy data byte count */ | 
 | 1423 | 	u8 cfg_phy_cnt;		/* configurable DSP phy data byte count */ | 
 | 1424 | 	u8 stat_id;		/* configurable DSP phy data set ID */ | 
 | 1425 | 	u8 reserved1; | 
 | 1426 | 	__le64 timestamp;	/* TSF at on air rise */ | 
 | 1427 | 	__le32 beacon_time_stamp; /* beacon at on-air rise */ | 
 | 1428 | 	__le16 phy_flags;	/* general phy flags: band, modulation, ... */ | 
 | 1429 | 	__le16 channel;		/* channel number */ | 
| Tomas Winkler | caab8f1 | 2008-08-04 16:00:42 +0800 | [diff] [blame] | 1430 | 	u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1431 | 	__le32 rate_n_flags;	/* RATE_MCS_* */ | 
 | 1432 | 	__le16 byte_count;	/* frame's byte-count */ | 
| Wey-Yi Guy | 30c1b0f | 2010-08-04 08:05:33 -0700 | [diff] [blame] | 1433 | 	__le16 frame_time;	/* frame's time on the air */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1434 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1435 |  | 
| Emmanuel Grumbach | 2fb291e | 2010-06-07 13:21:47 -0700 | [diff] [blame] | 1436 | struct iwl_rx_mpdu_res_start { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1437 | 	__le16 byte_count; | 
 | 1438 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1439 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1440 |  | 
 | 1441 |  | 
 | 1442 | /****************************************************************************** | 
 | 1443 |  * (5) | 
 | 1444 |  * Tx Commands & Responses: | 
 | 1445 |  * | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1446 |  * Driver must place each REPLY_TX command into one of the prioritized Tx | 
 | 1447 |  * queues in host DRAM, shared between driver and device (see comments for | 
 | 1448 |  * SCD registers and Tx/Rx Queues).  When the device's Tx scheduler and uCode | 
 | 1449 |  * are preparing to transmit, the device pulls the Tx command over the PCI | 
 | 1450 |  * bus via one of the device's Tx DMA channels, to fill an internal FIFO | 
 | 1451 |  * from which data will be transmitted. | 
 | 1452 |  * | 
 | 1453 |  * uCode handles all timing and protocol related to control frames | 
 | 1454 |  * (RTS/CTS/ACK), based on flags in the Tx command.  uCode and Tx scheduler | 
 | 1455 |  * handle reception of block-acks; uCode updates the host driver via | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1456 |  * REPLY_COMPRESSED_BA. | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1457 |  * | 
 | 1458 |  * uCode handles retrying Tx when an ACK is expected but not received. | 
 | 1459 |  * This includes trying lower data rates than the one requested in the Tx | 
 | 1460 |  * command, as set up by the REPLY_RATE_SCALE (for 3945) or | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1461 |  * REPLY_TX_LINK_QUALITY_CMD (agn). | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1462 |  * | 
 | 1463 |  * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. | 
 | 1464 |  * This command must be executed after every RXON command, before Tx can occur. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1465 |  *****************************************************************************/ | 
 | 1466 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1467 | /* REPLY_TX Tx flags field */ | 
 | 1468 |  | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1469 | /* | 
 | 1470 |  * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it | 
| Emmanuel Grumbach | a326a5d | 2008-07-11 11:53:31 +0800 | [diff] [blame] | 1471 |  * before this frame. if CTS-to-self required check | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1472 |  * RXON_FLG_SELF_CTS_EN status. | 
 | 1473 |  * unused in 3945/4965, used in 5000 series and after | 
 | 1474 |  */ | 
 | 1475 | #define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0) | 
| Emmanuel Grumbach | a326a5d | 2008-07-11 11:53:31 +0800 | [diff] [blame] | 1476 |  | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1477 | /* | 
 | 1478 |  * 1: Use Request-To-Send protocol before this frame. | 
 | 1479 |  * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. | 
 | 1480 |  * used in 3945/4965, unused in 5000 series and after | 
 | 1481 |  */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1482 | #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1483 |  | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1484 | /* | 
 | 1485 |  * 1: Transmit Clear-To-Send to self before this frame. | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1486 |  * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1487 |  * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. | 
 | 1488 |  * used in 3945/4965, unused in 5000 series and after | 
 | 1489 |  */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1490 | #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1491 |  | 
 | 1492 | /* 1: Expect ACK from receiving station | 
 | 1493 |  * 0: Don't expect ACK (MAC header's duration field s/b 0) | 
 | 1494 |  * Set this for unicast frames, but not broadcast/multicast. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1495 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1496 |  | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1497 | /* For agn devices: | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1498 |  * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). | 
 | 1499 |  *    Tx command's initial_rate_index indicates first rate to try; | 
 | 1500 |  *    uCode walks through table for additional Tx attempts. | 
 | 1501 |  * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. | 
 | 1502 |  *    This rate will be used for all Tx attempts; it will not be scaled. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1503 | #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1504 |  | 
 | 1505 | /* 1: Expect immediate block-ack. | 
 | 1506 |  * Set when Txing a block-ack request frame.  Also set TX_CMD_FLG_ACK_MSK. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1507 | #define TX_CMD_FLG_IMM_BA_RSP_MASK  cpu_to_le32(1 << 6) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1508 |  | 
| Wey-Yi Guy | 4e3243f | 2010-06-18 11:33:16 -0700 | [diff] [blame] | 1509 | /* | 
 | 1510 |  * 1: Frame requires full Tx-Op protection. | 
 | 1511 |  * Set this if either RTS or CTS Tx Flag gets set. | 
 | 1512 |  * used in 3945/4965, unused in 5000 series and after | 
 | 1513 |  */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1514 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1515 |  | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1516 | /* Tx antenna selection field; used only for 3945, reserved (0) for agn devices. | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1517 |  * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1518 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) | 
 | 1519 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) | 
 | 1520 | #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1521 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1522 | /* 1: Ignore Bluetooth priority for this frame. | 
 | 1523 |  * 0: Delay Tx until Bluetooth device is done (normal usage). */ | 
| Johannes Berg | b2e8690 | 2010-04-13 01:04:32 -0700 | [diff] [blame] | 1524 | #define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1525 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1526 | /* 1: uCode overrides sequence control field in MAC header. | 
 | 1527 |  * 0: Driver provides sequence control field in MAC header. | 
 | 1528 |  * Set this for management frames, non-QOS data frames, non-unicast frames, | 
 | 1529 |  * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1530 | #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1531 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1532 | /* 1: This frame is non-last MPDU; more fragments are coming. | 
 | 1533 |  * 0: Last fragment, or not using fragmentation. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1534 | #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1535 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1536 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. | 
 | 1537 |  * 0: No TSF required in outgoing frame. | 
 | 1538 |  * Set this for transmitting beacons and probe responses. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1539 | #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1540 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1541 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword | 
 | 1542 |  *    alignment of frame's payload data field. | 
 | 1543 |  * 0: No pad | 
 | 1544 |  * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 | 
 | 1545 |  * field (but not both).  Driver must align frame data (i.e. data following | 
 | 1546 |  * MAC header) to DWORD boundary. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1547 | #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1548 |  | 
| Max Stepanov | 8236e18 | 2008-03-12 16:58:48 -0700 | [diff] [blame] | 1549 | /* accelerate aggregation support | 
 | 1550 |  * 0 - no CCMP encryption; 1 - CCMP encryption */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1551 | #define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) | 
| Max Stepanov | 8236e18 | 2008-03-12 16:58:48 -0700 | [diff] [blame] | 1552 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1553 | /* HCCA-AP - disable duration overwriting. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 1554 | #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1555 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1556 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1557 | /* | 
 | 1558 |  * TX command security control | 
 | 1559 |  */ | 
 | 1560 | #define TX_CMD_SEC_WEP  	0x01 | 
 | 1561 | #define TX_CMD_SEC_CCM  	0x02 | 
 | 1562 | #define TX_CMD_SEC_TKIP		0x03 | 
 | 1563 | #define TX_CMD_SEC_MSK		0x03 | 
 | 1564 | #define TX_CMD_SEC_SHIFT	6 | 
 | 1565 | #define TX_CMD_SEC_KEY128	0x08 | 
 | 1566 |  | 
 | 1567 | /* | 
| Tomas Winkler | 3195cdb | 2008-04-23 17:15:00 -0700 | [diff] [blame] | 1568 |  * security overhead sizes | 
 | 1569 |  */ | 
 | 1570 | #define WEP_IV_LEN 4 | 
 | 1571 | #define WEP_ICV_LEN 4 | 
 | 1572 | #define CCMP_MIC_LEN 8 | 
 | 1573 | #define TKIP_ICV_LEN 4 | 
 | 1574 |  | 
 | 1575 | /* | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1576 |  * REPLY_TX = 0x1c (command) | 
 | 1577 |  */ | 
 | 1578 |  | 
 | 1579 | struct iwl3945_tx_cmd { | 
 | 1580 | 	/* | 
 | 1581 | 	 * MPDU byte count: | 
 | 1582 | 	 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, | 
 | 1583 | 	 * + 8 byte IV for CCM or TKIP (not used for WEP) | 
 | 1584 | 	 * + Data payload | 
 | 1585 | 	 * + 8-byte MIC (not used for CCM/WEP) | 
 | 1586 | 	 * NOTE:  Does not include Tx command bytes, post-MAC pad bytes, | 
 | 1587 | 	 *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i | 
 | 1588 | 	 * Range: 14-2342 bytes. | 
 | 1589 | 	 */ | 
 | 1590 | 	__le16 len; | 
 | 1591 |  | 
 | 1592 | 	/* | 
 | 1593 | 	 * MPDU or MSDU byte count for next frame. | 
 | 1594 | 	 * Used for fragmentation and bursting, but not 11n aggregation. | 
 | 1595 | 	 * Same as "len", but for next frame.  Set to 0 if not applicable. | 
 | 1596 | 	 */ | 
 | 1597 | 	__le16 next_frame_len; | 
 | 1598 |  | 
 | 1599 | 	__le32 tx_flags;	/* TX_CMD_FLG_* */ | 
 | 1600 |  | 
 | 1601 | 	u8 rate; | 
 | 1602 |  | 
 | 1603 | 	/* Index of recipient station in uCode's station table */ | 
 | 1604 | 	u8 sta_id; | 
 | 1605 | 	u8 tid_tspec; | 
 | 1606 | 	u8 sec_ctl; | 
 | 1607 | 	u8 key[16]; | 
 | 1608 | 	union { | 
 | 1609 | 		u8 byte[8]; | 
 | 1610 | 		__le16 word[4]; | 
 | 1611 | 		__le32 dw[2]; | 
 | 1612 | 	} tkip_mic; | 
 | 1613 | 	__le32 next_frame_info; | 
 | 1614 | 	union { | 
 | 1615 | 		__le32 life_time; | 
 | 1616 | 		__le32 attempt; | 
 | 1617 | 	} stop_time; | 
 | 1618 | 	u8 supp_rates[2]; | 
 | 1619 | 	u8 rts_retry_limit;	/*byte 50 */ | 
 | 1620 | 	u8 data_retry_limit;	/*byte 51 */ | 
 | 1621 | 	union { | 
 | 1622 | 		__le16 pm_frame_timeout; | 
 | 1623 | 		__le16 attempt_duration; | 
 | 1624 | 	} timeout; | 
 | 1625 |  | 
 | 1626 | 	/* | 
 | 1627 | 	 * Duration of EDCA burst Tx Opportunity, in 32-usec units. | 
 | 1628 | 	 * Set this if txop time is not specified by HCCA protocol (e.g. by AP). | 
 | 1629 | 	 */ | 
 | 1630 | 	__le16 driver_txop; | 
 | 1631 |  | 
 | 1632 | 	/* | 
 | 1633 | 	 * MAC header goes here, followed by 2 bytes padding if MAC header | 
 | 1634 | 	 * length is 26 or 30 bytes, followed by payload data | 
 | 1635 | 	 */ | 
 | 1636 | 	u8 payload[0]; | 
 | 1637 | 	struct ieee80211_hdr hdr[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1638 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1639 |  | 
 | 1640 | /* | 
 | 1641 |  * REPLY_TX = 0x1c (response) | 
 | 1642 |  */ | 
 | 1643 | struct iwl3945_tx_resp { | 
 | 1644 | 	u8 failure_rts; | 
 | 1645 | 	u8 failure_frame; | 
 | 1646 | 	u8 bt_kill_count; | 
 | 1647 | 	u8 rate; | 
 | 1648 | 	__le32 wireless_media_time; | 
 | 1649 | 	__le32 status;		/* TX status */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1650 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 1651 |  | 
 | 1652 |  | 
 | 1653 | /* | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1654 |  * 4965 uCode updates these Tx attempt count values in host DRAM. | 
 | 1655 |  * Used for managing Tx retries when expecting block-acks. | 
 | 1656 |  * Driver should set these fields to 0. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1657 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 1658 | struct iwl_dram_scratch { | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1659 | 	u8 try_cnt;		/* Tx attempts */ | 
 | 1660 | 	u8 bt_kill_cnt;		/* Tx attempts blocked by Bluetooth device */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1661 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1662 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1663 |  | 
| Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 1664 | struct iwl_tx_cmd { | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1665 | 	/* | 
 | 1666 | 	 * MPDU byte count: | 
 | 1667 | 	 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, | 
 | 1668 | 	 * + 8 byte IV for CCM or TKIP (not used for WEP) | 
 | 1669 | 	 * + Data payload | 
 | 1670 | 	 * + 8-byte MIC (not used for CCM/WEP) | 
 | 1671 | 	 * NOTE:  Does not include Tx command bytes, post-MAC pad bytes, | 
 | 1672 | 	 *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i | 
 | 1673 | 	 * Range: 14-2342 bytes. | 
 | 1674 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1675 | 	__le16 len; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1676 |  | 
 | 1677 | 	/* | 
 | 1678 | 	 * MPDU or MSDU byte count for next frame. | 
 | 1679 | 	 * Used for fragmentation and bursting, but not 11n aggregation. | 
 | 1680 | 	 * Same as "len", but for next frame.  Set to 0 if not applicable. | 
 | 1681 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1682 | 	__le16 next_frame_len; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1683 |  | 
 | 1684 | 	__le32 tx_flags;	/* TX_CMD_FLG_* */ | 
 | 1685 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 1686 | 	/* uCode may modify this field of the Tx command (in host DRAM!). | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1687 | 	 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 1688 | 	struct iwl_dram_scratch scratch; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1689 |  | 
 | 1690 | 	/* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ | 
 | 1691 | 	__le32 rate_n_flags;	/* RATE_MCS_* */ | 
 | 1692 |  | 
 | 1693 | 	/* Index of destination station in uCode's station table */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1694 | 	u8 sta_id; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1695 |  | 
 | 1696 | 	/* Type of security encryption:  CCM or TKIP */ | 
 | 1697 | 	u8 sec_ctl;		/* TX_CMD_SEC_* */ | 
 | 1698 |  | 
 | 1699 | 	/* | 
 | 1700 | 	 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial | 
 | 1701 | 	 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set.  Normally "0" for | 
 | 1702 | 	 * data frames, this field may be used to selectively reduce initial | 
 | 1703 | 	 * rate (via non-0 value) for special frames (e.g. management), while | 
 | 1704 | 	 * still supporting rate scaling for all frames. | 
 | 1705 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1706 | 	u8 initial_rate_index; | 
 | 1707 | 	u8 reserved; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1708 | 	u8 key[16]; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1709 | 	__le16 next_frame_flags; | 
 | 1710 | 	__le16 reserved2; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1711 | 	union { | 
 | 1712 | 		__le32 life_time; | 
 | 1713 | 		__le32 attempt; | 
 | 1714 | 	} stop_time; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1715 |  | 
 | 1716 | 	/* Host DRAM physical address pointer to "scratch" in this command. | 
 | 1717 | 	 * Must be dword aligned.  "0" in dram_lsb_ptr disables usage. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1718 | 	__le32 dram_lsb_ptr; | 
 | 1719 | 	u8 dram_msb_ptr; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1720 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1721 | 	u8 rts_retry_limit;	/*byte 50 */ | 
 | 1722 | 	u8 data_retry_limit;	/*byte 51 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1723 | 	u8 tid_tspec; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1724 | 	union { | 
 | 1725 | 		__le16 pm_frame_timeout; | 
 | 1726 | 		__le16 attempt_duration; | 
 | 1727 | 	} timeout; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1728 |  | 
 | 1729 | 	/* | 
 | 1730 | 	 * Duration of EDCA burst Tx Opportunity, in 32-usec units. | 
 | 1731 | 	 * Set this if txop time is not specified by HCCA protocol (e.g. by AP). | 
 | 1732 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1733 | 	__le16 driver_txop; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1734 |  | 
 | 1735 | 	/* | 
 | 1736 | 	 * MAC header goes here, followed by 2 bytes padding if MAC header | 
 | 1737 | 	 * length is 26 or 30 bytes, followed by payload data | 
 | 1738 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1739 | 	u8 payload[0]; | 
 | 1740 | 	struct ieee80211_hdr hdr[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1741 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1742 |  | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1743 | /* TX command response is sent after *3945* transmission attempts. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1744 |  * | 
 | 1745 |  * NOTES: | 
 | 1746 |  * | 
 | 1747 |  * TX_STATUS_FAIL_NEXT_FRAG | 
 | 1748 |  * | 
 | 1749 |  * If the fragment flag in the MAC header for the frame being transmitted | 
 | 1750 |  * is set and there is insufficient time to transmit the next frame, the | 
 | 1751 |  * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. | 
 | 1752 |  * | 
 | 1753 |  * TX_STATUS_FIFO_UNDERRUN | 
 | 1754 |  * | 
 | 1755 |  * Indicates the host did not provide bytes to the FIFO fast enough while | 
 | 1756 |  * a TX was in progress. | 
 | 1757 |  * | 
 | 1758 |  * TX_STATUS_FAIL_MGMNT_ABORT | 
 | 1759 |  * | 
 | 1760 |  * This status is only possible if the ABORT ON MGMT RX parameter was | 
 | 1761 |  * set to true with the TX command. | 
 | 1762 |  * | 
 | 1763 |  * If the MSB of the status parameter is set then an abort sequence is | 
 | 1764 |  * required.  This sequence consists of the host activating the TX Abort | 
 | 1765 |  * control line, and then waiting for the TX Abort command response.  This | 
 | 1766 |  * indicates that a the device is no longer in a transmit state, and that the | 
 | 1767 |  * command FIFO has been cleared.  The host must then deactivate the TX Abort | 
 | 1768 |  * control line.  Receiving is still allowed in this case. | 
 | 1769 |  */ | 
 | 1770 | enum { | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1771 | 	TX_3945_STATUS_SUCCESS = 0x01, | 
 | 1772 | 	TX_3945_STATUS_DIRECT_DONE = 0x02, | 
 | 1773 | 	TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82, | 
 | 1774 | 	TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83, | 
 | 1775 | 	TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84, | 
 | 1776 | 	TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85, | 
 | 1777 | 	TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86, | 
 | 1778 | 	TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87, | 
 | 1779 | 	TX_3945_STATUS_FAIL_DEST_PS = 0x88, | 
 | 1780 | 	TX_3945_STATUS_FAIL_ABORTED = 0x89, | 
 | 1781 | 	TX_3945_STATUS_FAIL_BT_RETRY = 0x8a, | 
 | 1782 | 	TX_3945_STATUS_FAIL_STA_INVALID = 0x8b, | 
 | 1783 | 	TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c, | 
 | 1784 | 	TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d, | 
 | 1785 | 	TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e, | 
 | 1786 | 	TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, | 
 | 1787 | 	TX_3945_STATUS_FAIL_TX_LOCKED = 0x90, | 
 | 1788 | 	TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, | 
 | 1789 | }; | 
 | 1790 |  | 
 | 1791 | /* | 
 | 1792 |  * TX command response is sent after *agn* transmission attempts. | 
 | 1793 |  * | 
 | 1794 |  * both postpone and abort status are expected behavior from uCode. there is | 
 | 1795 |  * no special operation required from driver; except for RFKILL_FLUSH, | 
 | 1796 |  * which required tx flush host command to flush all the tx frames in queues | 
 | 1797 |  */ | 
 | 1798 | enum { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1799 | 	TX_STATUS_SUCCESS = 0x01, | 
 | 1800 | 	TX_STATUS_DIRECT_DONE = 0x02, | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1801 | 	/* postpone TX */ | 
 | 1802 | 	TX_STATUS_POSTPONE_DELAY = 0x40, | 
 | 1803 | 	TX_STATUS_POSTPONE_FEW_BYTES = 0x41, | 
 | 1804 | 	TX_STATUS_POSTPONE_BT_PRIO = 0x42, | 
 | 1805 | 	TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, | 
 | 1806 | 	TX_STATUS_POSTPONE_CALC_TTAK = 0x44, | 
 | 1807 | 	/* abort TX */ | 
 | 1808 | 	TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1809 | 	TX_STATUS_FAIL_SHORT_LIMIT = 0x82, | 
 | 1810 | 	TX_STATUS_FAIL_LONG_LIMIT = 0x83, | 
 | 1811 | 	TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1812 | 	TX_STATUS_FAIL_DRAIN_FLOW = 0x85, | 
 | 1813 | 	TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1814 | 	TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, | 
 | 1815 | 	TX_STATUS_FAIL_DEST_PS = 0x88, | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1816 | 	TX_STATUS_FAIL_HOST_ABORTED = 0x89, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1817 | 	TX_STATUS_FAIL_BT_RETRY = 0x8a, | 
 | 1818 | 	TX_STATUS_FAIL_STA_INVALID = 0x8b, | 
 | 1819 | 	TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, | 
 | 1820 | 	TX_STATUS_FAIL_TID_DISABLE = 0x8d, | 
| Wey-Yi Guy | 04569cb | 2010-03-31 17:57:28 -0700 | [diff] [blame] | 1821 | 	TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1822 | 	TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, | 
| Wey-Yi Guy | 1d27007 | 2010-09-07 12:42:20 -0700 | [diff] [blame] | 1823 | 	TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, | 
 | 1824 | 	TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1825 | }; | 
 | 1826 |  | 
 | 1827 | #define	TX_PACKET_MODE_REGULAR		0x0000 | 
 | 1828 | #define	TX_PACKET_MODE_BURST_SEQ	0x0100 | 
 | 1829 | #define	TX_PACKET_MODE_BURST_FIRST	0x0200 | 
 | 1830 |  | 
 | 1831 | enum { | 
 | 1832 | 	TX_POWER_PA_NOT_ACTIVE = 0x0, | 
 | 1833 | }; | 
 | 1834 |  | 
 | 1835 | enum { | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1836 | 	TX_STATUS_MSK = 0x000000ff,		/* bits 0:7 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1837 | 	TX_STATUS_DELAY_MSK = 0x00000040, | 
 | 1838 | 	TX_STATUS_ABORT_MSK = 0x00000080, | 
 | 1839 | 	TX_PACKET_MODE_MSK = 0x0000ff00,	/* bits 8:15 */ | 
 | 1840 | 	TX_FIFO_NUMBER_MSK = 0x00070000,	/* bits 16:18 */ | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1841 | 	TX_RESERVED = 0x00780000,		/* bits 19:22 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1842 | 	TX_POWER_PA_DETECT_MSK = 0x7f800000,	/* bits 23:30 */ | 
 | 1843 | 	TX_ABORT_REQUIRED_MSK = 0x80000000,	/* bits 31:31 */ | 
 | 1844 | }; | 
 | 1845 |  | 
 | 1846 | /* ******************************* | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1847 |  * TX aggregation status | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1848 |  ******************************* */ | 
 | 1849 |  | 
 | 1850 | enum { | 
 | 1851 | 	AGG_TX_STATE_TRANSMITTED = 0x00, | 
 | 1852 | 	AGG_TX_STATE_UNDERRUN_MSK = 0x01, | 
 | 1853 | 	AGG_TX_STATE_BT_PRIO_MSK = 0x02, | 
 | 1854 | 	AGG_TX_STATE_FEW_BYTES_MSK = 0x04, | 
 | 1855 | 	AGG_TX_STATE_ABORT_MSK = 0x08, | 
 | 1856 | 	AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, | 
 | 1857 | 	AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, | 
 | 1858 | 	AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, | 
 | 1859 | 	AGG_TX_STATE_SCD_QUERY_MSK = 0x80, | 
 | 1860 | 	AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, | 
 | 1861 | 	AGG_TX_STATE_RESPONSE_MSK = 0x1ff, | 
 | 1862 | 	AGG_TX_STATE_DUMP_TX_MSK = 0x200, | 
 | 1863 | 	AGG_TX_STATE_DELAY_TX_MSK = 0x400 | 
 | 1864 | }; | 
 | 1865 |  | 
| Wey-Yi Guy | e1b3fa0 | 2010-09-05 10:49:43 -0700 | [diff] [blame] | 1866 | #define AGG_TX_STATUS_MSK	0x00000fff	/* bits 0:11 */ | 
 | 1867 | #define AGG_TX_TRY_MSK		0x0000f000	/* bits 12:15 */ | 
 | 1868 |  | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1869 | #define AGG_TX_STATE_LAST_SENT_MSK  (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ | 
 | 1870 | 				     AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ | 
 | 1871 | 				     AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1872 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1873 | /* # tx attempts for first frame in aggregation */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1874 | #define AGG_TX_STATE_TRY_CNT_POS 12 | 
 | 1875 | #define AGG_TX_STATE_TRY_CNT_MSK 0xf000 | 
 | 1876 |  | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1877 | /* Command ID and sequence number of Tx command for this frame */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1878 | #define AGG_TX_STATE_SEQ_NUM_POS 16 | 
 | 1879 | #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 | 
 | 1880 |  | 
 | 1881 | /* | 
 | 1882 |  * REPLY_TX = 0x1c (response) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1883 |  * | 
 | 1884 |  * This response may be in one of two slightly different formats, indicated | 
 | 1885 |  * by the frame_count field: | 
 | 1886 |  * | 
 | 1887 |  * 1)  No aggregation (frame_count == 1).  This reports Tx results for | 
 | 1888 |  *     a single frame.  Multiple attempts, at various bit rates, may have | 
 | 1889 |  *     been made for this frame. | 
 | 1890 |  * | 
 | 1891 |  * 2)  Aggregation (frame_count > 1).  This reports Tx results for | 
 | 1892 |  *     2 or more frames that used block-acknowledge.  All frames were | 
 | 1893 |  *     transmitted at same rate.  Rate scaling may have been used if first | 
 | 1894 |  *     frame in this new agg block failed in previous agg block(s). | 
 | 1895 |  * | 
 | 1896 |  *     Note that, for aggregation, ACK (block-ack) status is not delivered here; | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1897 |  *     block-ack has not been received by the time the agn device records | 
 | 1898 |  *     this status. | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1899 |  *     This status relates to reasons the tx might have been blocked or aborted | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 1900 |  *     within the sending station (this agn device), rather than whether it was | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1901 |  *     received successfully by the destination station. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1902 |  */ | 
| Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1903 | struct agg_tx_status { | 
 | 1904 | 	__le16 status; | 
 | 1905 | 	__le16 sequence; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1906 | } __packed; | 
| Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1907 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1908 | struct iwl4965_tx_resp { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1909 | 	u8 frame_count;		/* 1 no aggregation, >1 aggregation */ | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1910 | 	u8 bt_kill_count;	/* # blocked by bluetooth (unused for agg) */ | 
 | 1911 | 	u8 failure_rts;		/* # failures due to unsuccessful RTS */ | 
 | 1912 | 	u8 failure_frame;	/* # failures due to no ACK (unused for agg) */ | 
 | 1913 |  | 
 | 1914 | 	/* For non-agg:  Rate at which frame was successful. | 
 | 1915 | 	 * For agg:  Rate at which all frames were transmitted. */ | 
 | 1916 | 	__le32 rate_n_flags;	/* RATE_MCS_*  */ | 
 | 1917 |  | 
 | 1918 | 	/* For non-agg:  RTS + CTS + frame tx attempts time + ACK. | 
 | 1919 | 	 * For agg:  RTS + CTS + aggregation tx time + block-ack time. */ | 
 | 1920 | 	__le16 wireless_media_time;	/* uSecs */ | 
 | 1921 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1922 | 	__le16 reserved; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1923 | 	__le32 pa_power1;	/* RF power amplifier measurement (not used) */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1924 | 	__le32 pa_power2; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1925 |  | 
 | 1926 | 	/* | 
 | 1927 | 	 * For non-agg:  frame status TX_STATUS_* | 
 | 1928 | 	 * For agg:  status of 1st frame, AGG_TX_STATE_*; other frame status | 
 | 1929 | 	 *           fields follow this one, up to frame_count. | 
 | 1930 | 	 *           Bit fields: | 
 | 1931 | 	 *           11- 0:  AGG_TX_STATE_* status code | 
 | 1932 | 	 *           15-12:  Retry count for 1st frame in aggregation (retries | 
 | 1933 | 	 *                   occur if tx failed for this frame when it was a | 
 | 1934 | 	 *                   member of a previous aggregation block).  If rate | 
 | 1935 | 	 *                   scaling is used, retry count indicates the rate | 
 | 1936 | 	 *                   table entry used for all frames in the new agg. | 
 | 1937 | 	 *           31-16:  Sequence # for this frame's Tx cmd (not SSN!) | 
 | 1938 | 	 */ | 
| Tomas Winkler | 25a6572 | 2008-06-12 09:47:07 +0800 | [diff] [blame] | 1939 | 	union { | 
 | 1940 | 		__le32 status; | 
 | 1941 | 		struct agg_tx_status agg_status[0]; /* for each agg frame */ | 
 | 1942 | 	} u; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 1943 | } __packed; | 
| Ron Rindjunsky | fe01b47 | 2008-01-28 14:07:24 +0200 | [diff] [blame] | 1944 |  | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1945 | /* | 
 | 1946 |  * definitions for initial rate index field | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 1947 |  * bits [3:0] initial rate index | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1948 |  * bits [6:4] rate table color, used for the initial rate | 
 | 1949 |  * bit-7 invalid rate indication | 
 | 1950 |  *   i.e. rate was not chosen from rate table | 
 | 1951 |  *   or rate table color was changed during frame retries | 
 | 1952 |  * refer tlc rate info | 
 | 1953 |  */ | 
 | 1954 |  | 
 | 1955 | #define IWL50_TX_RES_INIT_RATE_INDEX_POS	0 | 
 | 1956 | #define IWL50_TX_RES_INIT_RATE_INDEX_MSK	0x0f | 
 | 1957 | #define IWL50_TX_RES_RATE_TABLE_COLOR_POS	4 | 
 | 1958 | #define IWL50_TX_RES_RATE_TABLE_COLOR_MSK	0x70 | 
 | 1959 | #define IWL50_TX_RES_INV_RATE_INDEX_MSK	0x80 | 
 | 1960 |  | 
 | 1961 | /* refer to ra_tid */ | 
| Wey-Yi Guy | 898dade | 2010-09-20 09:12:33 -0700 | [diff] [blame] | 1962 | #define IWLAGN_TX_RES_TID_POS	0 | 
 | 1963 | #define IWLAGN_TX_RES_TID_MSK	0x0f | 
 | 1964 | #define IWLAGN_TX_RES_RA_POS	4 | 
 | 1965 | #define IWLAGN_TX_RES_RA_MSK	0xf0 | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1966 |  | 
| Wey-Yi Guy | 898dade | 2010-09-20 09:12:33 -0700 | [diff] [blame] | 1967 | struct iwlagn_tx_resp { | 
| Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1968 | 	u8 frame_count;		/* 1 no aggregation, >1 aggregation */ | 
 | 1969 | 	u8 bt_kill_count;	/* # blocked by bluetooth (unused for agg) */ | 
 | 1970 | 	u8 failure_rts;		/* # failures due to unsuccessful RTS */ | 
 | 1971 | 	u8 failure_frame;	/* # failures due to no ACK (unused for agg) */ | 
 | 1972 |  | 
 | 1973 | 	/* For non-agg:  Rate at which frame was successful. | 
 | 1974 | 	 * For agg:  Rate at which all frames were transmitted. */ | 
 | 1975 | 	__le32 rate_n_flags;	/* RATE_MCS_*  */ | 
 | 1976 |  | 
 | 1977 | 	/* For non-agg:  RTS + CTS + frame tx attempts time + ACK. | 
 | 1978 | 	 * For agg:  RTS + CTS + aggregation tx time + block-ack time. */ | 
 | 1979 | 	__le16 wireless_media_time;	/* uSecs */ | 
 | 1980 |  | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1981 | 	u8 pa_status;		/* RF power amplifier measurement (not used) */ | 
 | 1982 | 	u8 pa_integ_res_a[3]; | 
 | 1983 | 	u8 pa_integ_res_b[3]; | 
 | 1984 | 	u8 pa_integ_res_C[3]; | 
| Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1985 |  | 
 | 1986 | 	__le32 tfd_info; | 
 | 1987 | 	__le16 seq_ctl; | 
 | 1988 | 	__le16 byte_cnt; | 
| Tomas Winkler | 3fd07a1 | 2008-10-23 23:48:49 -0700 | [diff] [blame] | 1989 | 	u8 tlc_info; | 
 | 1990 | 	u8 ra_tid;		/* tid (0:3), sta_id (4:7) */ | 
 | 1991 | 	__le16 frame_ctrl; | 
| Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1992 | 	/* | 
 | 1993 | 	 * For non-agg:  frame status TX_STATUS_* | 
 | 1994 | 	 * For agg:  status of 1st frame, AGG_TX_STATE_*; other frame status | 
 | 1995 | 	 *           fields follow this one, up to frame_count. | 
 | 1996 | 	 *           Bit fields: | 
 | 1997 | 	 *           11- 0:  AGG_TX_STATE_* status code | 
 | 1998 | 	 *           15-12:  Retry count for 1st frame in aggregation (retries | 
 | 1999 | 	 *                   occur if tx failed for this frame when it was a | 
 | 2000 | 	 *                   member of a previous aggregation block).  If rate | 
 | 2001 | 	 *                   scaling is used, retry count indicates the rate | 
 | 2002 | 	 *                   table entry used for all frames in the new agg. | 
 | 2003 | 	 *           31-16:  Sequence # for this frame's Tx cmd (not SSN!) | 
 | 2004 | 	 */ | 
 | 2005 | 	struct agg_tx_status status;	/* TX status (in aggregation - | 
 | 2006 | 					 * status of 1st frame) */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2007 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2008 | /* | 
 | 2009 |  * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 2010 |  * | 
 | 2011 |  * Reports Block-Acknowledge from recipient station | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2012 |  */ | 
| Emmanuel Grumbach | 653fa4a | 2008-06-30 17:23:11 +0800 | [diff] [blame] | 2013 | struct iwl_compressed_ba_resp { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2014 | 	__le32 sta_addr_lo32; | 
 | 2015 | 	__le16 sta_addr_hi16; | 
 | 2016 | 	__le16 reserved; | 
| Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 2017 |  | 
 | 2018 | 	/* Index of recipient (BA-sending) station in uCode's station table */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2019 | 	u8 sta_id; | 
 | 2020 | 	u8 tid; | 
| Ron Rindjunsky | fe01b47 | 2008-01-28 14:07:24 +0200 | [diff] [blame] | 2021 | 	__le16 seq_ctl; | 
 | 2022 | 	__le64 bitmap; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2023 | 	__le16 scd_flow; | 
 | 2024 | 	__le16 scd_ssn; | 
| Wey-Yi Guy | 8829c9e | 2010-11-10 11:05:38 -0800 | [diff] [blame] | 2025 | 	/* following only for 5000 series and up */ | 
 | 2026 | 	u8 txed;	/* number of frames sent */ | 
 | 2027 | 	u8 txed_2_done; /* number of frames acked */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2028 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2029 |  | 
 | 2030 | /* | 
 | 2031 |  * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2032 |  * | 
 | 2033 |  * See details under "TXPOWER" in iwl-4965-hw.h. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2034 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2035 |  | 
 | 2036 | struct iwl3945_txpowertable_cmd { | 
 | 2037 | 	u8 band;		/* 0: 5 GHz, 1: 2.4 GHz */ | 
 | 2038 | 	u8 reserved; | 
 | 2039 | 	__le16 channel; | 
 | 2040 | 	struct iwl3945_power_per_rate power[IWL_MAX_RATES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2041 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2042 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2043 | struct iwl4965_txpowertable_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2044 | 	u8 band;		/* 0: 5 GHz, 1: 2.4 GHz */ | 
 | 2045 | 	u8 reserved; | 
 | 2046 | 	__le16 channel; | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2047 | 	struct iwl4965_tx_power_db tx_power; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2048 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2049 |  | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2050 |  | 
 | 2051 | /** | 
 | 2052 |  * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response | 
 | 2053 |  * | 
 | 2054 |  * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) | 
 | 2055 |  * | 
 | 2056 |  * NOTE: The table of rates passed to the uCode via the | 
 | 2057 |  * RATE_SCALE command sets up the corresponding order of | 
 | 2058 |  * rates used for all related commands, including rate | 
 | 2059 |  * masks, etc. | 
 | 2060 |  * | 
 | 2061 |  * For example, if you set 9MB (PLCP 0x0f) as the first | 
 | 2062 |  * rate in the rate table, the bit mask for that rate | 
 | 2063 |  * when passed through ofdm_basic_rates on the REPLY_RXON | 
 | 2064 |  * command would be bit 0 (1 << 0) | 
 | 2065 |  */ | 
 | 2066 | struct iwl3945_rate_scaling_info { | 
 | 2067 | 	__le16 rate_n_flags; | 
 | 2068 | 	u8 try_cnt; | 
 | 2069 | 	u8 next_rate_index; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2070 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2071 |  | 
 | 2072 | struct iwl3945_rate_scaling_cmd { | 
 | 2073 | 	u8 table_id; | 
 | 2074 | 	u8 reserved[3]; | 
 | 2075 | 	struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2076 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2077 |  | 
 | 2078 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2079 | /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ | 
| Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 2080 | #define  LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK	(1 << 0) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2081 |  | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2082 | /* # of EDCA prioritized tx fifos */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2083 | #define  LINK_QUAL_AC_NUM AC_NUM | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2084 |  | 
 | 2085 | /* # entries in rate scale table to support Tx retries */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2086 | #define  LINK_QUAL_MAX_RETRY_NUM 16 | 
 | 2087 |  | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2088 | /* Tx antenna selection values */ | 
| Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 2089 | #define  LINK_QUAL_ANT_A_MSK (1 << 0) | 
 | 2090 | #define  LINK_QUAL_ANT_B_MSK (1 << 1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2091 | #define  LINK_QUAL_ANT_MSK   (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) | 
 | 2092 |  | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2093 |  | 
 | 2094 | /** | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2095 |  * struct iwl_link_qual_general_params | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2096 |  * | 
 | 2097 |  * Used in REPLY_TX_LINK_QUALITY_CMD | 
 | 2098 |  */ | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2099 | struct iwl_link_qual_general_params { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2100 | 	u8 flags; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2101 |  | 
 | 2102 | 	/* No entries at or above this (driver chosen) index contain MIMO */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2103 | 	u8 mimo_delimiter; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2104 |  | 
 | 2105 | 	/* Best single antenna to use for single stream (legacy, SISO). */ | 
 | 2106 | 	u8 single_stream_ant_msk;	/* LINK_QUAL_ANT_* */ | 
 | 2107 |  | 
 | 2108 | 	/* Best antennas to use for MIMO (unused for 4965, assumes both). */ | 
 | 2109 | 	u8 dual_stream_ant_msk;		/* LINK_QUAL_ANT_* */ | 
 | 2110 |  | 
 | 2111 | 	/* | 
 | 2112 | 	 * If driver needs to use different initial rates for different | 
 | 2113 | 	 * EDCA QOS access categories (as implemented by tx fifos 0-3), | 
 | 2114 | 	 * this table will set that up, by indicating the indexes in the | 
 | 2115 | 	 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. | 
 | 2116 | 	 * Otherwise, driver should set all entries to 0. | 
 | 2117 | 	 * | 
 | 2118 | 	 * Entry usage: | 
 | 2119 | 	 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice | 
 | 2120 | 	 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. | 
 | 2121 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2122 | 	u8 start_rate_index[LINK_QUAL_AC_NUM]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2123 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2124 |  | 
| Wey-Yi Guy | 13c33a0 | 2009-06-03 11:44:11 -0700 | [diff] [blame] | 2125 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF	(4000) /* 4 milliseconds */ | 
| Wey-Yi Guy | b15826a | 2010-07-28 09:18:53 -0700 | [diff] [blame] | 2126 | #define LINK_QUAL_AGG_TIME_LIMIT_MAX	(8000) | 
 | 2127 | #define LINK_QUAL_AGG_TIME_LIMIT_MIN	(100) | 
| Wey-Yi Guy | 13c33a0 | 2009-06-03 11:44:11 -0700 | [diff] [blame] | 2128 |  | 
 | 2129 | #define LINK_QUAL_AGG_DISABLE_START_DEF	(3) | 
 | 2130 | #define LINK_QUAL_AGG_DISABLE_START_MAX	(255) | 
 | 2131 | #define LINK_QUAL_AGG_DISABLE_START_MIN	(0) | 
 | 2132 |  | 
 | 2133 | #define LINK_QUAL_AGG_FRAME_LIMIT_DEF	(31) | 
| Johannes Berg | b623a9f | 2009-07-01 14:57:59 +0200 | [diff] [blame] | 2134 | #define LINK_QUAL_AGG_FRAME_LIMIT_MAX	(63) | 
| Wey-Yi Guy | 13c33a0 | 2009-06-03 11:44:11 -0700 | [diff] [blame] | 2135 | #define LINK_QUAL_AGG_FRAME_LIMIT_MIN	(0) | 
 | 2136 |  | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2137 | /** | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2138 |  * struct iwl_link_qual_agg_params | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2139 |  * | 
 | 2140 |  * Used in REPLY_TX_LINK_QUALITY_CMD | 
 | 2141 |  */ | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2142 | struct iwl_link_qual_agg_params { | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2143 |  | 
| Wey-Yi Guy | 7469701 | 2010-07-28 09:18:54 -0700 | [diff] [blame] | 2144 | 	/* | 
 | 2145 | 	 *Maximum number of uSec in aggregation. | 
 | 2146 | 	 * default set to 4000 (4 milliseconds) if not configured in .cfg | 
 | 2147 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2148 | 	__le16 agg_time_limit; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2149 |  | 
 | 2150 | 	/* | 
 | 2151 | 	 * Number of Tx retries allowed for a frame, before that frame will | 
 | 2152 | 	 * no longer be considered for the start of an aggregation sequence | 
 | 2153 | 	 * (scheduler will then try to tx it as single frame). | 
 | 2154 | 	 * Driver should set this to 3. | 
 | 2155 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2156 | 	u8 agg_dis_start_th; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2157 |  | 
 | 2158 | 	/* | 
 | 2159 | 	 * Maximum number of frames in aggregation. | 
 | 2160 | 	 * 0 = no limit (default).  1 = no aggregation. | 
 | 2161 | 	 * Other values = max # frames in aggregation. | 
 | 2162 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2163 | 	u8 agg_frame_cnt_limit; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2164 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2165 | 	__le32 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2166 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2167 |  | 
 | 2168 | /* | 
 | 2169 |  * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2170 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2171 |  * For agn devices only; 3945 uses REPLY_RATE_SCALE. | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2172 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2173 |  * Each station in the agn device's internal station table has its own table | 
 | 2174 |  * of 16 | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2175 |  * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when | 
 | 2176 |  * an ACK is not received.  This command replaces the entire table for | 
 | 2177 |  * one station. | 
 | 2178 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2179 |  * NOTE:  Station must already be in agn device's station table. | 
 | 2180 |  *	  Use REPLY_ADD_STA. | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2181 |  * | 
 | 2182 |  * The rate scaling procedures described below work well.  Of course, other | 
 | 2183 |  * procedures are possible, and may work better for particular environments. | 
 | 2184 |  * | 
 | 2185 |  * | 
 | 2186 |  * FILLING THE RATE TABLE | 
 | 2187 |  * | 
 | 2188 |  * Given a particular initial rate and mode, as determined by the rate | 
 | 2189 |  * scaling algorithm described below, the Linux driver uses the following | 
 | 2190 |  * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the | 
 | 2191 |  * Link Quality command: | 
 | 2192 |  * | 
 | 2193 |  * | 
 | 2194 |  * 1)  If using High-throughput (HT) (SISO or MIMO) initial rate: | 
 | 2195 |  *     a) Use this same initial rate for first 3 entries. | 
 | 2196 |  *     b) Find next lower available rate using same mode (SISO or MIMO), | 
 | 2197 |  *        use for next 3 entries.  If no lower rate available, switch to | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 2198 |  *        legacy mode (no HT40 channel, no MIMO, no short guard interval). | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2199 |  *     c) If using MIMO, set command's mimo_delimiter to number of entries | 
 | 2200 |  *        using MIMO (3 or 6). | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 2201 |  *     d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2202 |  *        no MIMO, no short guard interval), at the next lower bit rate | 
 | 2203 |  *        (e.g. if second HT bit rate was 54, try 48 legacy), and follow | 
 | 2204 |  *        legacy procedure for remaining table entries. | 
 | 2205 |  * | 
 | 2206 |  * 2)  If using legacy initial rate: | 
 | 2207 |  *     a) Use the initial rate for only one entry. | 
 | 2208 |  *     b) For each following entry, reduce the rate to next lower available | 
 | 2209 |  *        rate, until reaching the lowest available rate. | 
 | 2210 |  *     c) When reducing rate, also switch antenna selection. | 
 | 2211 |  *     d) Once lowest available rate is reached, repeat this rate until | 
 | 2212 |  *        rate table is filled (16 entries), switching antenna each entry. | 
 | 2213 |  * | 
 | 2214 |  * | 
 | 2215 |  * ACCUMULATING HISTORY | 
 | 2216 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2217 |  * The rate scaling algorithm for agn devices, as implemented in Linux driver, | 
 | 2218 |  * uses two sets of frame Tx success history:  One for the current/active | 
 | 2219 |  * modulation mode, and one for a speculative/search mode that is being | 
 | 2220 |  * attempted. If the speculative mode turns out to be more effective (i.e. | 
 | 2221 |  * actual transfer rate is better), then the driver continues to use the | 
 | 2222 |  * speculative mode as the new current active mode. | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2223 |  * | 
 | 2224 |  * Each history set contains, separately for each possible rate, data for a | 
 | 2225 |  * sliding window of the 62 most recent tx attempts at that rate.  The data | 
 | 2226 |  * includes a shifting bitmap of success(1)/failure(0), and sums of successful | 
 | 2227 |  * and attempted frames, from which the driver can additionally calculate a | 
 | 2228 |  * success ratio (success / attempted) and number of failures | 
 | 2229 |  * (attempted - success), and control the size of the window (attempted). | 
 | 2230 |  * The driver uses the bit map to remove successes from the success sum, as | 
 | 2231 |  * the oldest tx attempts fall out of the window. | 
 | 2232 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2233 |  * When the agn device makes multiple tx attempts for a given frame, each | 
 | 2234 |  * attempt might be at a different rate, and have different modulation | 
 | 2235 |  * characteristics (e.g. antenna, fat channel, short guard interval), as set | 
 | 2236 |  * up in the rate scaling table in the Link Quality command.  The driver must | 
 | 2237 |  * determine which rate table entry was used for each tx attempt, to determine | 
 | 2238 |  * which rate-specific history to update, and record only those attempts that | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2239 |  * match the modulation characteristics of the history set. | 
 | 2240 |  * | 
 | 2241 |  * When using block-ack (aggregation), all frames are transmitted at the same | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 2242 |  * rate, since there is no per-attempt acknowledgment from the destination | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2243 |  * station.  The Tx response struct iwl_tx_resp indicates the Tx rate in | 
 | 2244 |  * rate_n_flags field.  After receiving a block-ack, the driver can update | 
 | 2245 |  * history for the entire block all at once. | 
 | 2246 |  * | 
 | 2247 |  * | 
 | 2248 |  * FINDING BEST STARTING RATE: | 
 | 2249 |  * | 
 | 2250 |  * When working with a selected initial modulation mode (see below), the | 
 | 2251 |  * driver attempts to find a best initial rate.  The initial rate is the | 
 | 2252 |  * first entry in the Link Quality command's rate table. | 
 | 2253 |  * | 
 | 2254 |  * 1)  Calculate actual throughput (success ratio * expected throughput, see | 
 | 2255 |  *     table below) for current initial rate.  Do this only if enough frames | 
 | 2256 |  *     have been attempted to make the value meaningful:  at least 6 failed | 
 | 2257 |  *     tx attempts, or at least 8 successes.  If not enough, don't try rate | 
 | 2258 |  *     scaling yet. | 
 | 2259 |  * | 
 | 2260 |  * 2)  Find available rates adjacent to current initial rate.  Available means: | 
 | 2261 |  *     a)  supported by hardware && | 
 | 2262 |  *     b)  supported by association && | 
 | 2263 |  *     c)  within any constraints selected by user | 
 | 2264 |  * | 
 | 2265 |  * 3)  Gather measured throughputs for adjacent rates.  These might not have | 
 | 2266 |  *     enough history to calculate a throughput.  That's okay, we might try | 
 | 2267 |  *     using one of them anyway! | 
 | 2268 |  * | 
 | 2269 |  * 4)  Try decreasing rate if, for current rate: | 
 | 2270 |  *     a)  success ratio is < 15% || | 
 | 2271 |  *     b)  lower adjacent rate has better measured throughput || | 
 | 2272 |  *     c)  higher adjacent rate has worse throughput, and lower is unmeasured | 
 | 2273 |  * | 
 | 2274 |  *     As a sanity check, if decrease was determined above, leave rate | 
 | 2275 |  *     unchanged if: | 
 | 2276 |  *     a)  lower rate unavailable | 
 | 2277 |  *     b)  success ratio at current rate > 85% (very good) | 
 | 2278 |  *     c)  current measured throughput is better than expected throughput | 
 | 2279 |  *         of lower rate (under perfect 100% tx conditions, see table below) | 
 | 2280 |  * | 
 | 2281 |  * 5)  Try increasing rate if, for current rate: | 
 | 2282 |  *     a)  success ratio is < 15% || | 
 | 2283 |  *     b)  both adjacent rates' throughputs are unmeasured (try it!) || | 
 | 2284 |  *     b)  higher adjacent rate has better measured throughput || | 
 | 2285 |  *     c)  lower adjacent rate has worse throughput, and higher is unmeasured | 
 | 2286 |  * | 
 | 2287 |  *     As a sanity check, if increase was determined above, leave rate | 
 | 2288 |  *     unchanged if: | 
 | 2289 |  *     a)  success ratio at current rate < 70%.  This is not particularly | 
 | 2290 |  *         good performance; higher rate is sure to have poorer success. | 
 | 2291 |  * | 
 | 2292 |  * 6)  Re-evaluate the rate after each tx frame.  If working with block- | 
 | 2293 |  *     acknowledge, history and statistics may be calculated for the entire | 
 | 2294 |  *     block (including prior history that fits within the history windows), | 
 | 2295 |  *     before re-evaluation. | 
 | 2296 |  * | 
 | 2297 |  * FINDING BEST STARTING MODULATION MODE: | 
 | 2298 |  * | 
 | 2299 |  * After working with a modulation mode for a "while" (and doing rate scaling), | 
 | 2300 |  * the driver searches for a new initial mode in an attempt to improve | 
 | 2301 |  * throughput.  The "while" is measured by numbers of attempted frames: | 
 | 2302 |  * | 
 | 2303 |  * For legacy mode, search for new mode after: | 
 | 2304 |  *   480 successful frames, or 160 failed frames | 
 | 2305 |  * For high-throughput modes (SISO or MIMO), search for new mode after: | 
 | 2306 |  *   4500 successful frames, or 400 failed frames | 
 | 2307 |  * | 
 | 2308 |  * Mode switch possibilities are (3 for each mode): | 
 | 2309 |  * | 
 | 2310 |  * For legacy: | 
 | 2311 |  *   Change antenna, try SISO (if HT association), try MIMO (if HT association) | 
 | 2312 |  * For SISO: | 
 | 2313 |  *   Change antenna, try MIMO, try shortened guard interval (SGI) | 
 | 2314 |  * For MIMO: | 
 | 2315 |  *   Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) | 
 | 2316 |  * | 
 | 2317 |  * When trying a new mode, use the same bit rate as the old/current mode when | 
 | 2318 |  * trying antenna switches and shortened guard interval.  When switching to | 
 | 2319 |  * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate | 
 | 2320 |  * for which the expected throughput (under perfect conditions) is about the | 
 | 2321 |  * same or slightly better than the actual measured throughput delivered by | 
 | 2322 |  * the old/current mode. | 
 | 2323 |  * | 
 | 2324 |  * Actual throughput can be estimated by multiplying the expected throughput | 
 | 2325 |  * by the success ratio (successful / attempted tx frames).  Frame size is | 
 | 2326 |  * not considered in this calculation; it assumes that frame size will average | 
 | 2327 |  * out to be fairly consistent over several samples.  The following are | 
 | 2328 |  * metric values for expected throughput assuming 100% success ratio. | 
 | 2329 |  * Only G band has support for CCK rates: | 
 | 2330 |  * | 
 | 2331 |  *           RATE:  1    2    5   11    6   9   12   18   24   36   48   54   60 | 
 | 2332 |  * | 
 | 2333 |  *              G:  7   13   35   58   40  57   72   98  121  154  177  186  186 | 
 | 2334 |  *              A:  0    0    0    0   40  57   72   98  121  154  177  186  186 | 
 | 2335 |  *     SISO 20MHz:  0    0    0    0   42  42   76  102  124  159  183  193  202 | 
 | 2336 |  * SGI SISO 20MHz:  0    0    0    0   46  46   82  110  132  168  192  202  211 | 
 | 2337 |  *     MIMO 20MHz:  0    0    0    0   74  74  123  155  179  214  236  244  251 | 
 | 2338 |  * SGI MIMO 20MHz:  0    0    0    0   81  81  131  164  188  222  243  251  257 | 
 | 2339 |  *     SISO 40MHz:  0    0    0    0   77  77  127  160  184  220  242  250  257 | 
 | 2340 |  * SGI SISO 40MHz:  0    0    0    0   83  83  135  169  193  229  250  257  264 | 
 | 2341 |  *     MIMO 40MHz:  0    0    0    0  123 123  182  214  235  264  279  285  289 | 
 | 2342 |  * SGI MIMO 40MHz:  0    0    0    0  131 131  191  222  242  270  284  289  293 | 
 | 2343 |  * | 
 | 2344 |  * After the new mode has been tried for a short while (minimum of 6 failed | 
 | 2345 |  * frames or 8 successful frames), compare success ratio and actual throughput | 
 | 2346 |  * estimate of the new mode with the old.  If either is better with the new | 
 | 2347 |  * mode, continue to use the new mode. | 
 | 2348 |  * | 
 | 2349 |  * Continue comparing modes until all 3 possibilities have been tried. | 
 | 2350 |  * If moving from legacy to HT, try all 3 possibilities from the new HT | 
 | 2351 |  * mode.  After trying all 3, a best mode is found.  Continue to use this mode | 
 | 2352 |  * for the longer "while" described above (e.g. 480 successful frames for | 
 | 2353 |  * legacy), and then repeat the search process. | 
 | 2354 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2355 |  */ | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2356 | struct iwl_link_quality_cmd { | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2357 |  | 
 | 2358 | 	/* Index of destination/recipient station in uCode's station table */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2359 | 	u8 sta_id; | 
 | 2360 | 	u8 reserved1; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2361 | 	__le16 control;		/* not used */ | 
| Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 2362 | 	struct iwl_link_qual_general_params general_params; | 
 | 2363 | 	struct iwl_link_qual_agg_params agg_params; | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2364 |  | 
 | 2365 | 	/* | 
 | 2366 | 	 * Rate info; when using rate-scaling, Tx command's initial_rate_index | 
 | 2367 | 	 * specifies 1st Tx rate attempted, via index into this table. | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2368 | 	 * agn devices works its way through table when retrying Tx. | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2369 | 	 */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2370 | 	struct { | 
| Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 2371 | 		__le32 rate_n_flags;	/* RATE_MCS_*, IWL_RATE_* */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2372 | 	} rs_table[LINK_QUAL_MAX_RETRY_NUM]; | 
 | 2373 | 	__le32 reserved2; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2374 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2375 |  | 
| Wey-Yi Guy | dab1c16 | 2010-01-22 14:22:50 -0800 | [diff] [blame] | 2376 | /* | 
 | 2377 |  * BT configuration enable flags: | 
 | 2378 |  *   bit 0 - 1: BT channel announcement enabled | 
 | 2379 |  *           0: disable | 
 | 2380 |  *   bit 1 - 1: priority of BT device enabled | 
 | 2381 |  *           0: disable | 
 | 2382 |  *   bit 2 - 1: BT 2 wire support enabled | 
 | 2383 |  *           0: disable | 
 | 2384 |  */ | 
| Wey-Yi Guy | 456d0f7 | 2009-10-23 13:42:23 -0700 | [diff] [blame] | 2385 | #define BT_COEX_DISABLE (0x0) | 
| Wey-Yi Guy | dab1c16 | 2010-01-22 14:22:50 -0800 | [diff] [blame] | 2386 | #define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) | 
 | 2387 | #define BT_ENABLE_PRIORITY	   BIT(1) | 
 | 2388 | #define BT_ENABLE_2_WIRE	   BIT(2) | 
| Wey-Yi Guy | 456d0f7 | 2009-10-23 13:42:23 -0700 | [diff] [blame] | 2389 |  | 
| Wey-Yi Guy | 06702a7 | 2010-01-22 14:22:51 -0800 | [diff] [blame] | 2390 | #define BT_COEX_DISABLE (0x0) | 
 | 2391 | #define BT_COEX_ENABLE  (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) | 
 | 2392 |  | 
| Wey-Yi Guy | 456d0f7 | 2009-10-23 13:42:23 -0700 | [diff] [blame] | 2393 | #define BT_LEAD_TIME_MIN (0x0) | 
 | 2394 | #define BT_LEAD_TIME_DEF (0x1E) | 
 | 2395 | #define BT_LEAD_TIME_MAX (0xFF) | 
 | 2396 |  | 
 | 2397 | #define BT_MAX_KILL_MIN (0x1) | 
 | 2398 | #define BT_MAX_KILL_DEF (0x5) | 
 | 2399 | #define BT_MAX_KILL_MAX (0xFF) | 
 | 2400 |  | 
| Wey-Yi Guy | 22bf59a | 2010-08-23 07:57:11 -0700 | [diff] [blame] | 2401 | #define BT_DURATION_LIMIT_DEF	625 | 
 | 2402 | #define BT_DURATION_LIMIT_MAX	1250 | 
 | 2403 | #define BT_DURATION_LIMIT_MIN	625 | 
 | 2404 |  | 
 | 2405 | #define BT_ON_THRESHOLD_DEF	4 | 
 | 2406 | #define BT_ON_THRESHOLD_MAX	1000 | 
 | 2407 | #define BT_ON_THRESHOLD_MIN	1 | 
 | 2408 |  | 
 | 2409 | #define BT_FRAG_THRESHOLD_DEF	0 | 
 | 2410 | #define BT_FRAG_THRESHOLD_MAX	0 | 
 | 2411 | #define BT_FRAG_THRESHOLD_MIN	0 | 
 | 2412 |  | 
| Wey-Yi Guy | 95a5ede | 2010-11-08 14:55:43 -0800 | [diff] [blame] | 2413 | #define BT_AGG_THRESHOLD_DEF	1200 | 
 | 2414 | #define BT_AGG_THRESHOLD_MAX	8000 | 
 | 2415 | #define BT_AGG_THRESHOLD_MIN	400 | 
| Wey-Yi Guy | 22bf59a | 2010-08-23 07:57:11 -0700 | [diff] [blame] | 2416 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2417 | /* | 
 | 2418 |  * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2419 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2420 |  * 3945 and agn devices support hardware handshake with Bluetooth device on | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2421 |  * same platform.  Bluetooth device alerts wireless device when it will Tx; | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 2422 |  * wireless device can delay or kill its own Tx to accommodate. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2423 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2424 | struct iwl_bt_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2425 | 	u8 flags; | 
 | 2426 | 	u8 lead_time; | 
 | 2427 | 	u8 max_kill; | 
 | 2428 | 	u8 reserved; | 
 | 2429 | 	__le32 kill_ack_mask; | 
 | 2430 | 	__le32 kill_cts_mask; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2431 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2432 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2433 | #define IWLAGN_BT_FLAG_CHANNEL_INHIBITION	BIT(0) | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2434 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2435 | #define IWLAGN_BT_FLAG_COEX_MODE_MASK		(BIT(3)|BIT(4)|BIT(5)) | 
 | 2436 | #define IWLAGN_BT_FLAG_COEX_MODE_SHIFT		3 | 
 | 2437 | #define IWLAGN_BT_FLAG_COEX_MODE_DISABLED	0 | 
 | 2438 | #define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W	1 | 
 | 2439 | #define IWLAGN_BT_FLAG_COEX_MODE_3W		2 | 
 | 2440 | #define IWLAGN_BT_FLAG_COEX_MODE_4W		3 | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2441 |  | 
| Wey-Yi Guy | eeb1f83 | 2010-11-23 10:58:52 -0800 | [diff] [blame] | 2442 | #define IWLAGN_BT_FLAG_UCODE_DEFAULT		BIT(6) | 
 | 2443 | /* Disable Sync PSPoll on SCO/eSCO */ | 
 | 2444 | #define IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE	BIT(7) | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2445 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2446 | #define IWLAGN_BT_PRIO_BOOST_MAX	0xFF | 
 | 2447 | #define IWLAGN_BT_PRIO_BOOST_MIN	0x00 | 
 | 2448 | #define IWLAGN_BT_PRIO_BOOST_DEFAULT	0xF0 | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2449 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2450 | #define IWLAGN_BT_MAX_KILL_DEFAULT	5 | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2451 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2452 | #define IWLAGN_BT3_T7_DEFAULT		1 | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2453 |  | 
| Wey-Yi Guy | 05433df | 2010-11-08 12:37:20 -0800 | [diff] [blame] | 2454 | #define IWLAGN_BT_KILL_ACK_MASK_DEFAULT	cpu_to_le32(0xffff0000) | 
 | 2455 | #define IWLAGN_BT_KILL_CTS_MASK_DEFAULT	cpu_to_le32(0xffff0000) | 
| Wey-Yi Guy | 506aa15 | 2010-11-24 17:25:03 -0800 | [diff] [blame] | 2456 | #define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO	cpu_to_le32(0xffffffff) | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2457 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2458 | #define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT	2 | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2459 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2460 | #define IWLAGN_BT3_T2_DEFAULT		0xc | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2461 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2462 | #define IWLAGN_BT_VALID_ENABLE_FLAGS	cpu_to_le16(BIT(0)) | 
 | 2463 | #define IWLAGN_BT_VALID_BOOST		cpu_to_le16(BIT(1)) | 
 | 2464 | #define IWLAGN_BT_VALID_MAX_KILL	cpu_to_le16(BIT(2)) | 
 | 2465 | #define IWLAGN_BT_VALID_3W_TIMERS	cpu_to_le16(BIT(3)) | 
 | 2466 | #define IWLAGN_BT_VALID_KILL_ACK_MASK	cpu_to_le16(BIT(4)) | 
 | 2467 | #define IWLAGN_BT_VALID_KILL_CTS_MASK	cpu_to_le16(BIT(5)) | 
 | 2468 | #define IWLAGN_BT_VALID_BT4_TIMES	cpu_to_le16(BIT(6)) | 
 | 2469 | #define IWLAGN_BT_VALID_3W_LUT		cpu_to_le16(BIT(7)) | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2470 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2471 | #define IWLAGN_BT_ALL_VALID_MSK		(IWLAGN_BT_VALID_ENABLE_FLAGS | \ | 
 | 2472 | 					IWLAGN_BT_VALID_BOOST | \ | 
 | 2473 | 					IWLAGN_BT_VALID_MAX_KILL | \ | 
 | 2474 | 					IWLAGN_BT_VALID_3W_TIMERS | \ | 
 | 2475 | 					IWLAGN_BT_VALID_KILL_ACK_MASK | \ | 
 | 2476 | 					IWLAGN_BT_VALID_KILL_CTS_MASK | \ | 
 | 2477 | 					IWLAGN_BT_VALID_BT4_TIMES | \ | 
 | 2478 | 					IWLAGN_BT_VALID_3W_LUT) | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2479 |  | 
| Wey-Yi Guy | 6013270 | 2011-02-18 17:23:54 -0800 | [diff] [blame] | 2480 | struct iwl_basic_bt_cmd { | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2481 | 	u8 flags; | 
 | 2482 | 	u8 ledtime; /* unused */ | 
 | 2483 | 	u8 max_kill; | 
 | 2484 | 	u8 bt3_timer_t7_value; | 
 | 2485 | 	__le32 kill_ack_mask; | 
 | 2486 | 	__le32 kill_cts_mask; | 
 | 2487 | 	u8 bt3_prio_sample_time; | 
 | 2488 | 	u8 bt3_timer_t2_value; | 
 | 2489 | 	__le16 bt4_reaction_time; /* unused */ | 
 | 2490 | 	__le32 bt3_lookup_table[12]; | 
 | 2491 | 	__le16 bt4_decision_time; /* unused */ | 
 | 2492 | 	__le16 valid; | 
| Wey-Yi Guy | 6013270 | 2011-02-18 17:23:54 -0800 | [diff] [blame] | 2493 | }; | 
 | 2494 |  | 
 | 2495 | struct iwl6000_bt_cmd { | 
 | 2496 | 	struct iwl_basic_bt_cmd basic; | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2497 | 	u8 prio_boost; | 
| Wey-Yi Guy | b345f4d | 2010-09-13 07:51:03 -0700 | [diff] [blame] | 2498 | 	/* | 
 | 2499 | 	 * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask | 
 | 2500 | 	 * if configure the following patterns | 
 | 2501 | 	 */ | 
 | 2502 | 	u8 tx_prio_boost;	/* SW boost of WiFi tx priority */ | 
 | 2503 | 	__le16 rx_prio_boost;	/* SW boost of WiFi rx priority */ | 
| Johannes Berg | 670245e | 2010-08-23 07:56:55 -0700 | [diff] [blame] | 2504 | }; | 
 | 2505 |  | 
| Wey-Yi Guy | d6f6265 | 2011-02-18 17:23:51 -0800 | [diff] [blame] | 2506 | struct iwl2000_bt_cmd { | 
| Wey-Yi Guy | 6013270 | 2011-02-18 17:23:54 -0800 | [diff] [blame] | 2507 | 	struct iwl_basic_bt_cmd basic; | 
| Wey-Yi Guy | d6f6265 | 2011-02-18 17:23:51 -0800 | [diff] [blame] | 2508 | 	__le32 prio_boost; | 
 | 2509 | 	/* | 
 | 2510 | 	 * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask | 
 | 2511 | 	 * if configure the following patterns | 
 | 2512 | 	 */ | 
 | 2513 | 	u8 reserved; | 
 | 2514 | 	u8 tx_prio_boost;	/* SW boost of WiFi tx priority */ | 
 | 2515 | 	__le16 rx_prio_boost;	/* SW boost of WiFi rx priority */ | 
 | 2516 | }; | 
 | 2517 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2518 | #define IWLAGN_BT_SCO_ACTIVE	cpu_to_le32(BIT(0)) | 
| Johannes Berg | 9e4afc2 | 2010-08-23 07:56:57 -0700 | [diff] [blame] | 2519 |  | 
| Wey-Yi Guy | b6e116e | 2010-08-23 07:57:14 -0700 | [diff] [blame] | 2520 | struct iwlagn_bt_sco_cmd { | 
| Johannes Berg | 9e4afc2 | 2010-08-23 07:56:57 -0700 | [diff] [blame] | 2521 | 	__le32 flags; | 
 | 2522 | }; | 
 | 2523 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2524 | /****************************************************************************** | 
 | 2525 |  * (6) | 
 | 2526 |  * Spectrum Management (802.11h) Commands, Responses, Notifications: | 
 | 2527 |  * | 
 | 2528 |  *****************************************************************************/ | 
 | 2529 |  | 
 | 2530 | /* | 
 | 2531 |  * Spectrum Management | 
 | 2532 |  */ | 
 | 2533 | #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK         | \ | 
 | 2534 | 				 RXON_FILTER_CTL2HOST_MSK        | \ | 
 | 2535 | 				 RXON_FILTER_ACCEPT_GRP_MSK      | \ | 
 | 2536 | 				 RXON_FILTER_DIS_DECRYPT_MSK     | \ | 
 | 2537 | 				 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ | 
 | 2538 | 				 RXON_FILTER_ASSOC_MSK           | \ | 
 | 2539 | 				 RXON_FILTER_BCON_AWARE_MSK) | 
 | 2540 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2541 | struct iwl_measure_channel { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2542 | 	__le32 duration;	/* measurement duration in extended beacon | 
 | 2543 | 				 * format */ | 
 | 2544 | 	u8 channel;		/* channel to measure */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2545 | 	u8 type;		/* see enum iwl_measure_type */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2546 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2547 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2548 |  | 
 | 2549 | /* | 
 | 2550 |  * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) | 
 | 2551 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2552 | struct iwl_spectrum_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2553 | 	__le16 len;		/* number of bytes starting from token */ | 
 | 2554 | 	u8 token;		/* token id */ | 
 | 2555 | 	u8 id;			/* measurement id -- 0 or 1 */ | 
 | 2556 | 	u8 origin;		/* 0 = TGh, 1 = other, 2 = TGk */ | 
 | 2557 | 	u8 periodic;		/* 1 = periodic */ | 
 | 2558 | 	__le16 path_loss_timeout; | 
 | 2559 | 	__le32 start_time;	/* start time in extended beacon format */ | 
 | 2560 | 	__le32 reserved2; | 
 | 2561 | 	__le32 flags;		/* rxon flags */ | 
 | 2562 | 	__le32 filter_flags;	/* rxon filter flags */ | 
 | 2563 | 	__le16 channel_count;	/* minimum 1, maximum 10 */ | 
 | 2564 | 	__le16 reserved3; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2565 | 	struct iwl_measure_channel channels[10]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2566 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2567 |  | 
 | 2568 | /* | 
 | 2569 |  * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) | 
 | 2570 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2571 | struct iwl_spectrum_resp { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2572 | 	u8 token; | 
 | 2573 | 	u8 id;			/* id of the prior command replaced, or 0xff */ | 
 | 2574 | 	__le16 status;		/* 0 - command will be handled | 
 | 2575 | 				 * 1 - cannot handle (conflicts with another | 
 | 2576 | 				 *     measurement) */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2577 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2578 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2579 | enum iwl_measurement_state { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2580 | 	IWL_MEASUREMENT_START = 0, | 
 | 2581 | 	IWL_MEASUREMENT_STOP = 1, | 
 | 2582 | }; | 
 | 2583 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2584 | enum iwl_measurement_status { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2585 | 	IWL_MEASUREMENT_OK = 0, | 
 | 2586 | 	IWL_MEASUREMENT_CONCURRENT = 1, | 
 | 2587 | 	IWL_MEASUREMENT_CSA_CONFLICT = 2, | 
 | 2588 | 	IWL_MEASUREMENT_TGH_CONFLICT = 3, | 
 | 2589 | 	/* 4-5 reserved */ | 
 | 2590 | 	IWL_MEASUREMENT_STOPPED = 6, | 
 | 2591 | 	IWL_MEASUREMENT_TIMEOUT = 7, | 
 | 2592 | 	IWL_MEASUREMENT_PERIODIC_FAILED = 8, | 
 | 2593 | }; | 
 | 2594 |  | 
 | 2595 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 | 
 | 2596 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2597 | struct iwl_measurement_histogram { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2598 | 	__le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM];	/* in 0.8usec counts */ | 
 | 2599 | 	__le32 cck[NUM_ELEMENTS_IN_HISTOGRAM];	/* in 1usec counts */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2600 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2601 |  | 
 | 2602 | /* clear channel availability counters */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2603 | struct iwl_measurement_cca_counters { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2604 | 	__le32 ofdm; | 
 | 2605 | 	__le32 cck; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2606 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2607 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2608 | enum iwl_measure_type { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2609 | 	IWL_MEASURE_BASIC = (1 << 0), | 
 | 2610 | 	IWL_MEASURE_CHANNEL_LOAD = (1 << 1), | 
 | 2611 | 	IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), | 
 | 2612 | 	IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), | 
 | 2613 | 	IWL_MEASURE_FRAME = (1 << 4), | 
 | 2614 | 	/* bits 5:6 are reserved */ | 
 | 2615 | 	IWL_MEASURE_IDLE = (1 << 7), | 
 | 2616 | }; | 
 | 2617 |  | 
 | 2618 | /* | 
 | 2619 |  * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) | 
 | 2620 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2621 | struct iwl_spectrum_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2622 | 	u8 id;			/* measurement id -- 0 or 1 */ | 
 | 2623 | 	u8 token; | 
 | 2624 | 	u8 channel_index;	/* index in measurement channel list */ | 
 | 2625 | 	u8 state;		/* 0 - start, 1 - stop */ | 
 | 2626 | 	__le32 start_time;	/* lower 32-bits of TSF */ | 
 | 2627 | 	u8 band;		/* 0 - 5.2GHz, 1 - 2.4GHz */ | 
 | 2628 | 	u8 channel; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2629 | 	u8 type;		/* see enum iwl_measurement_type */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2630 | 	u8 reserved1; | 
 | 2631 | 	/* NOTE:  cca_ofdm, cca_cck, basic_type, and histogram are only only | 
 | 2632 | 	 * valid if applicable for measurement type requested. */ | 
 | 2633 | 	__le32 cca_ofdm;	/* cca fraction time in 40Mhz clock periods */ | 
 | 2634 | 	__le32 cca_cck;		/* cca fraction time in 44Mhz clock periods */ | 
 | 2635 | 	__le32 cca_time;	/* channel load time in usecs */ | 
 | 2636 | 	u8 basic_type;		/* 0 - bss, 1 - ofdm preamble, 2 - | 
 | 2637 | 				 * unidentified */ | 
 | 2638 | 	u8 reserved2[3]; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2639 | 	struct iwl_measurement_histogram histogram; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2640 | 	__le32 stop_time;	/* lower 32-bits of TSF */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2641 | 	__le32 status;		/* see iwl_measurement_status */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2642 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2643 |  | 
 | 2644 | /****************************************************************************** | 
 | 2645 |  * (7) | 
 | 2646 |  * Power Management Commands, Responses, Notifications: | 
 | 2647 |  * | 
 | 2648 |  *****************************************************************************/ | 
 | 2649 |  | 
 | 2650 | /** | 
| Mohamed Abbas | ca57961 | 2008-07-18 13:52:57 +0800 | [diff] [blame] | 2651 |  * struct iwl_powertable_cmd - Power Table Command | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2652 |  * @flags: See below: | 
 | 2653 |  * | 
 | 2654 |  * POWER_TABLE_CMD = 0x77 (command, has simple generic response) | 
 | 2655 |  * | 
 | 2656 |  * PM allow: | 
 | 2657 |  *   bit 0 - '0' Driver not allow power management | 
 | 2658 |  *           '1' Driver allow PM (use rest of parameters) | 
| Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 2659 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2660 |  * uCode send sleep notifications: | 
 | 2661 |  *   bit 1 - '0' Don't send sleep notification | 
 | 2662 |  *           '1' send sleep notification (SEND_PM_NOTIFICATION) | 
| Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 2663 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2664 |  * Sleep over DTIM | 
 | 2665 |  *   bit 2 - '0' PM have to walk up every DTIM | 
 | 2666 |  *           '1' PM could sleep over DTIM till listen Interval. | 
| Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 2667 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2668 |  * PCI power managed | 
| Tomas Winkler | e7b6358 | 2008-09-03 11:26:49 +0800 | [diff] [blame] | 2669 |  *   bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) | 
 | 2670 |  *           '1' !(PCI_CFG_LINK_CTRL & 0x1) | 
| Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 2671 |  * | 
 | 2672 |  * Fast PD | 
 | 2673 |  *   bit 4 - '1' Put radio to sleep when receiving frame for others | 
 | 2674 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2675 |  * Force sleep Modes | 
 | 2676 |  *   bit 31/30- '00' use both mac/xtal sleeps | 
 | 2677 |  *              '01' force Mac sleep | 
 | 2678 |  *              '10' force xtal sleep | 
 | 2679 |  *              '11' Illegal set | 
 | 2680 |  * | 
 | 2681 |  * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 2682 |  * ucode assume sleep over DTIM is allowed and we don't need to wake up | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2683 |  * for every DTIM. | 
 | 2684 |  */ | 
 | 2685 | #define IWL_POWER_VEC_SIZE 5 | 
 | 2686 |  | 
| Tomas Winkler | 600c0e1 | 2008-12-19 10:37:04 +0800 | [diff] [blame] | 2687 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK	cpu_to_le16(BIT(0)) | 
| Wey-Yi Guy | 35162ba | 2010-11-23 10:58:56 -0800 | [diff] [blame] | 2688 | #define IWL_POWER_POWER_SAVE_ENA_MSK		cpu_to_le16(BIT(0)) | 
 | 2689 | #define IWL_POWER_POWER_MANAGEMENT_ENA_MSK	cpu_to_le16(BIT(1)) | 
| Tomas Winkler | 600c0e1 | 2008-12-19 10:37:04 +0800 | [diff] [blame] | 2690 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK		cpu_to_le16(BIT(2)) | 
 | 2691 | #define IWL_POWER_PCI_PM_MSK			cpu_to_le16(BIT(3)) | 
 | 2692 | #define IWL_POWER_FAST_PD			cpu_to_le16(BIT(4)) | 
| Wey-Yi Guy | 97badb0 | 2010-11-23 10:58:53 -0800 | [diff] [blame] | 2693 | #define IWL_POWER_BEACON_FILTERING		cpu_to_le16(BIT(5)) | 
 | 2694 | #define IWL_POWER_SHADOW_REG_ENA		cpu_to_le16(BIT(6)) | 
 | 2695 | #define IWL_POWER_CT_KILL_SET			cpu_to_le16(BIT(7)) | 
 | 2696 | #define IWL_POWER_BT_SCO_ENA			cpu_to_le16(BIT(8)) | 
| Wey-Yi Guy | 35162ba | 2010-11-23 10:58:56 -0800 | [diff] [blame] | 2697 | #define IWL_POWER_ADVANCE_PM_ENA_MSK		cpu_to_le16(BIT(9)) | 
| Tomas Winkler | 600c0e1 | 2008-12-19 10:37:04 +0800 | [diff] [blame] | 2698 |  | 
 | 2699 | struct iwl3945_powertable_cmd { | 
 | 2700 | 	__le16 flags; | 
 | 2701 | 	u8 reserved[2]; | 
 | 2702 | 	__le32 rx_data_timeout; | 
 | 2703 | 	__le32 tx_data_timeout; | 
 | 2704 | 	__le32 sleep_interval[IWL_POWER_VEC_SIZE]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2705 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2706 |  | 
| Mohamed Abbas | ca57961 | 2008-07-18 13:52:57 +0800 | [diff] [blame] | 2707 | struct iwl_powertable_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2708 | 	__le16 flags; | 
| Tomas Winkler | 600c0e1 | 2008-12-19 10:37:04 +0800 | [diff] [blame] | 2709 | 	u8 keep_alive_seconds;		/* 3945 reserved */ | 
 | 2710 | 	u8 debug_flags;			/* 3945 reserved */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2711 | 	__le32 rx_data_timeout; | 
 | 2712 | 	__le32 tx_data_timeout; | 
 | 2713 | 	__le32 sleep_interval[IWL_POWER_VEC_SIZE]; | 
 | 2714 | 	__le32 keep_alive_beacons; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2715 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2716 |  | 
 | 2717 | /* | 
 | 2718 |  * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2719 |  * all devices identical. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2720 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2721 | struct iwl_sleep_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2722 | 	u8 pm_sleep_mode; | 
 | 2723 | 	u8 pm_wakeup_src; | 
 | 2724 | 	__le16 reserved; | 
 | 2725 | 	__le32 sleep_time; | 
 | 2726 | 	__le32 tsf_low; | 
 | 2727 | 	__le32 bcon_timer; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2728 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2729 |  | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 2730 | /* Sleep states.  all devices identical. */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2731 | enum { | 
 | 2732 | 	IWL_PM_NO_SLEEP = 0, | 
 | 2733 | 	IWL_PM_SLP_MAC = 1, | 
 | 2734 | 	IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, | 
 | 2735 | 	IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, | 
 | 2736 | 	IWL_PM_SLP_PHY = 4, | 
 | 2737 | 	IWL_PM_SLP_REPENT = 5, | 
 | 2738 | 	IWL_PM_WAKEUP_BY_TIMER = 6, | 
 | 2739 | 	IWL_PM_WAKEUP_BY_DRIVER = 7, | 
 | 2740 | 	IWL_PM_WAKEUP_BY_RFKILL = 8, | 
 | 2741 | 	/* 3 reserved */ | 
 | 2742 | 	IWL_PM_NUM_OF_MODES = 12, | 
 | 2743 | }; | 
 | 2744 |  | 
 | 2745 | /* | 
 | 2746 |  * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) | 
 | 2747 |  */ | 
 | 2748 | #define CARD_STATE_CMD_DISABLE 0x00	/* Put card to sleep */ | 
 | 2749 | #define CARD_STATE_CMD_ENABLE  0x01	/* Wake up card */ | 
 | 2750 | #define CARD_STATE_CMD_HALT    0x02	/* Power down permanently */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2751 | struct iwl_card_state_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2752 | 	__le32 status;		/* CARD_STATE_CMD_* request new power state */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2753 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2754 |  | 
 | 2755 | /* | 
 | 2756 |  * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) | 
 | 2757 |  */ | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 2758 | struct iwl_card_state_notif { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2759 | 	__le32 flags; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2760 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2761 |  | 
 | 2762 | #define HW_CARD_DISABLED   0x01 | 
 | 2763 | #define SW_CARD_DISABLED   0x02 | 
| Wey-Yi Guy | 3a41bbd | 2009-12-10 14:37:24 -0800 | [diff] [blame] | 2764 | #define CT_CARD_DISABLED   0x04 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2765 | #define RXON_CARD_DISABLED 0x10 | 
 | 2766 |  | 
| Emmanuel Grumbach | 47f4a58 | 2008-06-12 09:47:13 +0800 | [diff] [blame] | 2767 | struct iwl_ct_kill_config { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2768 | 	__le32   reserved; | 
 | 2769 | 	__le32   critical_temperature_M; | 
 | 2770 | 	__le32   critical_temperature_R; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2771 | }  __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2772 |  | 
| Wey-Yi Guy | 672639d | 2009-07-24 11:13:01 -0700 | [diff] [blame] | 2773 | /* 1000, and 6x00 */ | 
 | 2774 | struct iwl_ct_kill_throttling_config { | 
 | 2775 | 	__le32   critical_temperature_exit; | 
 | 2776 | 	__le32   reserved; | 
 | 2777 | 	__le32   critical_temperature_enter; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2778 | }  __packed; | 
| Wey-Yi Guy | 672639d | 2009-07-24 11:13:01 -0700 | [diff] [blame] | 2779 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2780 | /****************************************************************************** | 
 | 2781 |  * (8) | 
 | 2782 |  * Scan Commands, Responses, Notifications: | 
 | 2783 |  * | 
 | 2784 |  *****************************************************************************/ | 
 | 2785 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 2786 | #define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) | 
 | 2787 | #define SCAN_CHANNEL_TYPE_ACTIVE  cpu_to_le32(1) | 
| Tomas Winkler | d16dc48 | 2008-07-11 11:53:38 +0800 | [diff] [blame] | 2788 |  | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2789 | /** | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2790 |  * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2791 |  * | 
 | 2792 |  * One for each channel in the scan list. | 
 | 2793 |  * Each channel can independently select: | 
 | 2794 |  * 1)  SSID for directed active scans | 
 | 2795 |  * 2)  Txpower setting (for rate specified within Tx command) | 
 | 2796 |  * 3)  How long to stay on-channel (behavior may be modified by quiet_time, | 
 | 2797 |  *     quiet_plcp_th, good_CRC_th) | 
 | 2798 |  * | 
 | 2799 |  * To avoid uCode errors, make sure the following are true (see comments | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2800 |  * under struct iwl_scan_cmd about max_out_time and quiet_time): | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2801 |  * 1)  If using passive_dwell (i.e. passive_dwell != 0): | 
 | 2802 |  *     active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) | 
 | 2803 |  * 2)  quiet_time <= active_dwell | 
 | 2804 |  * 3)  If restricting off-channel time (i.e. max_out_time !=0): | 
 | 2805 |  *     passive_dwell < max_out_time | 
 | 2806 |  *     active_dwell < max_out_time | 
 | 2807 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2808 |  | 
 | 2809 | /* FIXME: rename to AP1, remove tpc */ | 
 | 2810 | struct iwl3945_scan_channel { | 
 | 2811 | 	/* | 
 | 2812 | 	 * type is defined as: | 
 | 2813 | 	 * 0:0 1 = active, 0 = passive | 
 | 2814 | 	 * 1:4 SSID direct bit map; if a bit is set, then corresponding | 
 | 2815 | 	 *     SSID IE is transmitted in probe request. | 
 | 2816 | 	 * 5:7 reserved | 
 | 2817 | 	 */ | 
 | 2818 | 	u8 type; | 
 | 2819 | 	u8 channel;	/* band is selected by iwl3945_scan_cmd "flags" field */ | 
 | 2820 | 	struct iwl3945_tx_power tpc; | 
 | 2821 | 	__le16 active_dwell;	/* in 1024-uSec TU (time units), typ 5-50 */ | 
 | 2822 | 	__le16 passive_dwell;	/* in 1024-uSec TU (time units), typ 20-500 */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2823 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2824 |  | 
| Winkler, Tomas | 0d21044 | 2009-01-23 13:45:21 -0800 | [diff] [blame] | 2825 | /* set number of direct probes u8 type */ | 
 | 2826 | #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) | 
 | 2827 |  | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2828 | struct iwl_scan_channel { | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2829 | 	/* | 
 | 2830 | 	 * type is defined as: | 
 | 2831 | 	 * 0:0 1 = active, 0 = passive | 
| Tomas Winkler | d16dc48 | 2008-07-11 11:53:38 +0800 | [diff] [blame] | 2832 | 	 * 1:20 SSID direct bit map; if a bit is set, then corresponding | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2833 | 	 *     SSID IE is transmitted in probe request. | 
| Tomas Winkler | d16dc48 | 2008-07-11 11:53:38 +0800 | [diff] [blame] | 2834 | 	 * 21:31 reserved | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2835 | 	 */ | 
| Tomas Winkler | d16dc48 | 2008-07-11 11:53:38 +0800 | [diff] [blame] | 2836 | 	__le32 type; | 
 | 2837 | 	__le16 channel;	/* band is selected by iwl_scan_cmd "flags" field */ | 
| Tomas Winkler | f53696d | 2008-06-12 09:47:12 +0800 | [diff] [blame] | 2838 | 	u8 tx_gain;		/* gain for analog radio */ | 
 | 2839 | 	u8 dsp_atten;		/* gain for DSP */ | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2840 | 	__le16 active_dwell;	/* in 1024-uSec TU (time units), typ 5-50 */ | 
 | 2841 | 	__le16 passive_dwell;	/* in 1024-uSec TU (time units), typ 20-500 */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2842 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2843 |  | 
| Winkler, Tomas | 0d21044 | 2009-01-23 13:45:21 -0800 | [diff] [blame] | 2844 | /* set number of direct probes __le32 type */ | 
 | 2845 | #define IWL_SCAN_PROBE_MASK(n) 	cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) | 
 | 2846 |  | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2847 | /** | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2848 |  * struct iwl_ssid_ie - directed scan network information element | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2849 |  * | 
| Ben Cahill | 2a3b793 | 2009-11-06 14:52:59 -0800 | [diff] [blame] | 2850 |  * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in | 
 | 2851 |  * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel; | 
 | 2852 |  * each channel may select different ssids from among the 20 (4) entries. | 
 | 2853 |  * SSID IEs get transmitted in reverse order of entry. | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2854 |  */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2855 | struct iwl_ssid_ie { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2856 | 	u8 id; | 
 | 2857 | 	u8 len; | 
 | 2858 | 	u8 ssid[32]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2859 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2860 |  | 
| Johannes Berg | 9b3bf06 | 2009-04-20 14:36:55 -0700 | [diff] [blame] | 2861 | #define PROBE_OPTION_MAX_3945		4 | 
 | 2862 | #define PROBE_OPTION_MAX		20 | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 2863 | #define TX_CMD_LIFE_TIME_INFINITE	cpu_to_le32(0xFFFFFFFF) | 
| Johannes Berg | 96ff564 | 2010-04-30 14:42:15 -0700 | [diff] [blame] | 2864 | #define IWL_GOOD_CRC_TH_DISABLED	0 | 
 | 2865 | #define IWL_GOOD_CRC_TH_DEFAULT		cpu_to_le16(1) | 
 | 2866 | #define IWL_GOOD_CRC_TH_NEVER		cpu_to_le16(0xffff) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2867 | #define IWL_MAX_SCAN_SIZE 1024 | 
| Abhijeet Kolekar | 8961212 | 2010-02-19 11:49:49 -0800 | [diff] [blame] | 2868 | #define IWL_MAX_CMD_SIZE 4096 | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2869 |  | 
 | 2870 | /* | 
 | 2871 |  * REPLY_SCAN_CMD = 0x80 (command) | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2872 |  * | 
 | 2873 |  * The hardware scan command is very powerful; the driver can set it up to | 
 | 2874 |  * maintain (relatively) normal network traffic while doing a scan in the | 
 | 2875 |  * background.  The max_out_time and suspend_time control the ratio of how | 
 | 2876 |  * long the device stays on an associated network channel ("service channel") | 
 | 2877 |  * vs. how long it's away from the service channel, i.e. tuned to other channels | 
 | 2878 |  * for scanning. | 
 | 2879 |  * | 
 | 2880 |  * max_out_time is the max time off-channel (in usec), and suspend_time | 
 | 2881 |  * is how long (in "extended beacon" format) that the scan is "suspended" | 
 | 2882 |  * after returning to the service channel.  That is, suspend_time is the | 
 | 2883 |  * time that we stay on the service channel, doing normal work, between | 
 | 2884 |  * scan segments.  The driver may set these parameters differently to support | 
 | 2885 |  * scanning when associated vs. not associated, and light vs. heavy traffic | 
 | 2886 |  * loads when associated. | 
 | 2887 |  * | 
 | 2888 |  * After receiving this command, the device's scan engine does the following; | 
 | 2889 |  * | 
 | 2890 |  * 1)  Sends SCAN_START notification to driver | 
 | 2891 |  * 2)  Checks to see if it has time to do scan for one channel | 
 | 2892 |  * 3)  Sends NULL packet, with power-save (PS) bit set to 1, | 
 | 2893 |  *     to tell AP that we're going off-channel | 
 | 2894 |  * 4)  Tunes to first channel in scan list, does active or passive scan | 
 | 2895 |  * 5)  Sends SCAN_RESULT notification to driver | 
 | 2896 |  * 6)  Checks to see if it has time to do scan on *next* channel in list | 
 | 2897 |  * 7)  Repeats 4-6 until it no longer has time to scan the next channel | 
 | 2898 |  *     before max_out_time expires | 
 | 2899 |  * 8)  Returns to service channel | 
 | 2900 |  * 9)  Sends NULL packet with PS=0 to tell AP that we're back | 
 | 2901 |  * 10) Stays on service channel until suspend_time expires | 
 | 2902 |  * 11) Repeats entire process 2-10 until list is complete | 
 | 2903 |  * 12) Sends SCAN_COMPLETE notification | 
 | 2904 |  * | 
 | 2905 |  * For fast, efficient scans, the scan command also has support for staying on | 
 | 2906 |  * a channel for just a short time, if doing active scanning and getting no | 
 | 2907 |  * responses to the transmitted probe request.  This time is controlled by | 
 | 2908 |  * quiet_time, and the number of received packets below which a channel is | 
 | 2909 |  * considered "quiet" is controlled by quiet_plcp_threshold. | 
 | 2910 |  * | 
 | 2911 |  * For active scanning on channels that have regulatory restrictions against | 
 | 2912 |  * blindly transmitting, the scan can listen before transmitting, to make sure | 
 | 2913 |  * that there is already legitimate activity on the channel.  If enough | 
 | 2914 |  * packets are cleanly received on the channel (controlled by good_CRC_th, | 
 | 2915 |  * typical value 1), the scan engine starts transmitting probe requests. | 
 | 2916 |  * | 
 | 2917 |  * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. | 
 | 2918 |  * | 
 | 2919 |  * To avoid uCode errors, see timing restrictions described under | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2920 |  * struct iwl_scan_channel. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2921 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2922 |  | 
 | 2923 | struct iwl3945_scan_cmd { | 
 | 2924 | 	__le16 len; | 
 | 2925 | 	u8 reserved0; | 
 | 2926 | 	u8 channel_count;	/* # channels in channel list */ | 
 | 2927 | 	__le16 quiet_time;	/* dwell only this # millisecs on quiet channel | 
 | 2928 | 				 * (only for active scan) */ | 
 | 2929 | 	__le16 quiet_plcp_th;	/* quiet chnl is < this # pkts (typ. 1) */ | 
 | 2930 | 	__le16 good_CRC_th;	/* passive -> active promotion threshold */ | 
 | 2931 | 	__le16 reserved1; | 
 | 2932 | 	__le32 max_out_time;	/* max usec to be away from associated (service) | 
 | 2933 | 				 * channel */ | 
 | 2934 | 	__le32 suspend_time;	/* pause scan this long (in "extended beacon | 
 | 2935 | 				 * format") when returning to service channel: | 
 | 2936 | 				 * 3945; 31:24 # beacons, 19:0 additional usec, | 
 | 2937 | 				 * 4965; 31:22 # beacons, 21:0 additional usec. | 
 | 2938 | 				 */ | 
 | 2939 | 	__le32 flags;		/* RXON_FLG_* */ | 
 | 2940 | 	__le32 filter_flags;	/* RXON_FILTER_* */ | 
 | 2941 |  | 
 | 2942 | 	/* For active scans (set to all-0s for passive scans). | 
 | 2943 | 	 * Does not include payload.  Must specify Tx rate; no rate scaling. */ | 
 | 2944 | 	struct iwl3945_tx_cmd tx_cmd; | 
 | 2945 |  | 
 | 2946 | 	/* For directed active scans (set to all-0s otherwise) */ | 
| Johannes Berg | 9b3bf06 | 2009-04-20 14:36:55 -0700 | [diff] [blame] | 2947 | 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2948 |  | 
 | 2949 | 	/* | 
 | 2950 | 	 * Probe request frame, followed by channel list. | 
 | 2951 | 	 * | 
 | 2952 | 	 * Size of probe request frame is specified by byte count in tx_cmd. | 
 | 2953 | 	 * Channel list follows immediately after probe request frame. | 
 | 2954 | 	 * Number of channels in list is specified by channel_count. | 
 | 2955 | 	 * Each channel in list is of type: | 
 | 2956 | 	 * | 
 | 2957 | 	 * struct iwl3945_scan_channel channels[0]; | 
 | 2958 | 	 * | 
 | 2959 | 	 * NOTE:  Only one band of channels can be scanned per pass.  You | 
 | 2960 | 	 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait | 
 | 2961 | 	 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) | 
 | 2962 | 	 * before requesting another scan. | 
 | 2963 | 	 */ | 
 | 2964 | 	u8 data[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 2965 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 2966 |  | 
| Johannes Berg | 266af4c7 | 2011-03-10 20:13:26 -0800 | [diff] [blame] | 2967 | enum iwl_scan_flags { | 
 | 2968 | 	/* BIT(0) currently unused */ | 
 | 2969 | 	IWL_SCAN_FLAGS_ACTION_FRAME_TX	= BIT(1), | 
 | 2970 | 	/* bits 2-7 reserved */ | 
 | 2971 | }; | 
 | 2972 |  | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2973 | struct iwl_scan_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2974 | 	__le16 len; | 
| Johannes Berg | 266af4c7 | 2011-03-10 20:13:26 -0800 | [diff] [blame] | 2975 | 	u8 scan_flags;		/* scan flags: see enum iwl_scan_flags */ | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2976 | 	u8 channel_count;	/* # channels in channel list */ | 
 | 2977 | 	__le16 quiet_time;	/* dwell only this # millisecs on quiet channel | 
 | 2978 | 				 * (only for active scan) */ | 
 | 2979 | 	__le16 quiet_plcp_th;	/* quiet chnl is < this # pkts (typ. 1) */ | 
 | 2980 | 	__le16 good_CRC_th;	/* passive -> active promotion threshold */ | 
 | 2981 | 	__le16 rx_chain;	/* RXON_RX_CHAIN_* */ | 
 | 2982 | 	__le32 max_out_time;	/* max usec to be away from associated (service) | 
 | 2983 | 				 * channel */ | 
 | 2984 | 	__le32 suspend_time;	/* pause scan this long (in "extended beacon | 
 | 2985 | 				 * format") when returning to service chnl: | 
 | 2986 | 				 * 3945; 31:24 # beacons, 19:0 additional usec, | 
 | 2987 | 				 * 4965; 31:22 # beacons, 21:0 additional usec. | 
 | 2988 | 				 */ | 
 | 2989 | 	__le32 flags;		/* RXON_FLG_* */ | 
 | 2990 | 	__le32 filter_flags;	/* RXON_FILTER_* */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2991 |  | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2992 | 	/* For active scans (set to all-0s for passive scans). | 
 | 2993 | 	 * Does not include payload.  Must specify Tx rate; no rate scaling. */ | 
| Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 2994 | 	struct iwl_tx_cmd tx_cmd; | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2995 |  | 
 | 2996 | 	/* For directed active scans (set to all-0s otherwise) */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2997 | 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2998 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2999 | 	/* | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 3000 | 	 * Probe request frame, followed by channel list. | 
 | 3001 | 	 * | 
 | 3002 | 	 * Size of probe request frame is specified by byte count in tx_cmd. | 
 | 3003 | 	 * Channel list follows immediately after probe request frame. | 
 | 3004 | 	 * Number of channels in list is specified by channel_count. | 
 | 3005 | 	 * Each channel in list is of type: | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3006 | 	 * | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 3007 | 	 * struct iwl_scan_channel channels[0]; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3008 | 	 * | 
 | 3009 | 	 * NOTE:  Only one band of channels can be scanned per pass.  You | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 3010 | 	 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait | 
 | 3011 | 	 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) | 
 | 3012 | 	 * before requesting another scan. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3013 | 	 */ | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 3014 | 	u8 data[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3015 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3016 |  | 
 | 3017 | /* Can abort will notify by complete notification with abort status. */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 3018 | #define CAN_ABORT_STATUS	cpu_to_le32(0x1) | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3019 | /* complete notification statuses */ | 
 | 3020 | #define ABORT_STATUS            0x2 | 
 | 3021 |  | 
 | 3022 | /* | 
 | 3023 |  * REPLY_SCAN_CMD = 0x80 (response) | 
 | 3024 |  */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 3025 | struct iwl_scanreq_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3026 | 	__le32 status;		/* 1: okay, 2: cannot fulfill request */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3027 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3028 |  | 
 | 3029 | /* | 
 | 3030 |  * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) | 
 | 3031 |  */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 3032 | struct iwl_scanstart_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3033 | 	__le32 tsf_low; | 
 | 3034 | 	__le32 tsf_high; | 
 | 3035 | 	__le32 beacon_timer; | 
 | 3036 | 	u8 channel; | 
 | 3037 | 	u8 band; | 
 | 3038 | 	u8 reserved[2]; | 
 | 3039 | 	__le32 status; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3040 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3041 |  | 
 | 3042 | #define  SCAN_OWNER_STATUS 0x1; | 
 | 3043 | #define  MEASURE_OWNER_STATUS 0x2; | 
 | 3044 |  | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 3045 | #define IWL_PROBE_STATUS_OK		0 | 
 | 3046 | #define IWL_PROBE_STATUS_TX_FAILED	BIT(0) | 
 | 3047 | /* error statuses combined with TX_FAILED */ | 
 | 3048 | #define IWL_PROBE_STATUS_FAIL_TTL	BIT(1) | 
 | 3049 | #define IWL_PROBE_STATUS_FAIL_BT	BIT(2) | 
 | 3050 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3051 | #define NUMBER_OF_STATISTICS 1	/* first __le32 is good CRC */ | 
 | 3052 | /* | 
 | 3053 |  * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) | 
 | 3054 |  */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 3055 | struct iwl_scanresults_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3056 | 	u8 channel; | 
 | 3057 | 	u8 band; | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 3058 | 	u8 probe_status; | 
 | 3059 | 	u8 num_probe_not_sent; /* not enough time to send */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3060 | 	__le32 tsf_low; | 
 | 3061 | 	__le32 tsf_high; | 
 | 3062 | 	__le32 statistics[NUMBER_OF_STATISTICS]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3063 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3064 |  | 
 | 3065 | /* | 
 | 3066 |  * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) | 
 | 3067 |  */ | 
| Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 3068 | struct iwl_scancomplete_notification { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3069 | 	u8 scanned_channels; | 
 | 3070 | 	u8 status; | 
| Wey-Yi Guy | f78e545 | 2010-08-23 07:57:15 -0700 | [diff] [blame] | 3071 | 	u8 bt_status;	/* BT On/Off status */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3072 | 	u8 last_channel; | 
 | 3073 | 	__le32 tsf_low; | 
 | 3074 | 	__le32 tsf_high; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3075 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3076 |  | 
 | 3077 |  | 
 | 3078 | /****************************************************************************** | 
 | 3079 |  * (9) | 
 | 3080 |  * IBSS/AP Commands and Notifications: | 
 | 3081 |  * | 
 | 3082 |  *****************************************************************************/ | 
 | 3083 |  | 
| Johannes Berg | a85d7cc | 2010-07-31 08:34:10 -0700 | [diff] [blame] | 3084 | enum iwl_ibss_manager { | 
 | 3085 | 	IWL_NOT_IBSS_MANAGER = 0, | 
 | 3086 | 	IWL_IBSS_MANAGER = 1, | 
 | 3087 | }; | 
 | 3088 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3089 | /* | 
 | 3090 |  * BEACON_NOTIFICATION = 0x90 (notification only, not a command) | 
 | 3091 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3092 |  | 
 | 3093 | struct iwl3945_beacon_notif { | 
 | 3094 | 	struct iwl3945_tx_resp beacon_notify_hdr; | 
 | 3095 | 	__le32 low_tsf; | 
 | 3096 | 	__le32 high_tsf; | 
 | 3097 | 	__le32 ibss_mgr_status; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3098 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3099 |  | 
| Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 3100 | struct iwl4965_beacon_notif { | 
 | 3101 | 	struct iwl4965_tx_resp beacon_notify_hdr; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3102 | 	__le32 low_tsf; | 
 | 3103 | 	__le32 high_tsf; | 
 | 3104 | 	__le32 ibss_mgr_status; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3105 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3106 |  | 
| Johannes Berg | 241887a | 2011-01-19 11:11:22 -0800 | [diff] [blame] | 3107 | struct iwlagn_beacon_notif { | 
 | 3108 | 	struct iwlagn_tx_resp beacon_notify_hdr; | 
 | 3109 | 	__le32 low_tsf; | 
 | 3110 | 	__le32 high_tsf; | 
 | 3111 | 	__le32 ibss_mgr_status; | 
 | 3112 | } __packed; | 
 | 3113 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3114 | /* | 
 | 3115 |  * REPLY_TX_BEACON = 0x91 (command, has simple generic response) | 
 | 3116 |  */ | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3117 |  | 
 | 3118 | struct iwl3945_tx_beacon_cmd { | 
 | 3119 | 	struct iwl3945_tx_cmd tx; | 
 | 3120 | 	__le16 tim_idx; | 
 | 3121 | 	u8 tim_size; | 
 | 3122 | 	u8 reserved1; | 
 | 3123 | 	struct ieee80211_hdr frame[0];	/* beacon frame */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3124 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3125 |  | 
| Tomas Winkler | 4bf64ef | 2008-07-18 13:53:03 +0800 | [diff] [blame] | 3126 | struct iwl_tx_beacon_cmd { | 
| Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 3127 | 	struct iwl_tx_cmd tx; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3128 | 	__le16 tim_idx; | 
 | 3129 | 	u8 tim_size; | 
 | 3130 | 	u8 reserved1; | 
 | 3131 | 	struct ieee80211_hdr frame[0];	/* beacon frame */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3132 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3133 |  | 
 | 3134 | /****************************************************************************** | 
 | 3135 |  * (10) | 
 | 3136 |  * Statistics Commands and Notifications: | 
 | 3137 |  * | 
 | 3138 |  *****************************************************************************/ | 
 | 3139 |  | 
 | 3140 | #define IWL_TEMP_CONVERT 260 | 
 | 3141 |  | 
 | 3142 | #define SUP_RATE_11A_MAX_NUM_CHANNELS  8 | 
 | 3143 | #define SUP_RATE_11B_MAX_NUM_CHANNELS  4 | 
 | 3144 | #define SUP_RATE_11G_MAX_NUM_CHANNELS  12 | 
 | 3145 |  | 
 | 3146 | /* Used for passing to driver number of successes and failures per rate */ | 
 | 3147 | struct rate_histogram { | 
 | 3148 | 	union { | 
 | 3149 | 		__le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; | 
 | 3150 | 		__le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; | 
 | 3151 | 		__le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; | 
 | 3152 | 	} success; | 
 | 3153 | 	union { | 
 | 3154 | 		__le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; | 
 | 3155 | 		__le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; | 
 | 3156 | 		__le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; | 
 | 3157 | 	} failed; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3158 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3159 |  | 
 | 3160 | /* statistics command response */ | 
 | 3161 |  | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3162 | struct iwl39_statistics_rx_phy { | 
 | 3163 | 	__le32 ina_cnt; | 
 | 3164 | 	__le32 fina_cnt; | 
 | 3165 | 	__le32 plcp_err; | 
 | 3166 | 	__le32 crc32_err; | 
 | 3167 | 	__le32 overrun_err; | 
 | 3168 | 	__le32 early_overrun_err; | 
 | 3169 | 	__le32 crc32_good; | 
 | 3170 | 	__le32 false_alarm_cnt; | 
 | 3171 | 	__le32 fina_sync_err_cnt; | 
 | 3172 | 	__le32 sfd_timeout; | 
 | 3173 | 	__le32 fina_timeout; | 
 | 3174 | 	__le32 unresponded_rts; | 
 | 3175 | 	__le32 rxe_frame_limit_overrun; | 
 | 3176 | 	__le32 sent_ack_cnt; | 
 | 3177 | 	__le32 sent_cts_cnt; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3178 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3179 |  | 
 | 3180 | struct iwl39_statistics_rx_non_phy { | 
 | 3181 | 	__le32 bogus_cts;	/* CTS received when not expecting CTS */ | 
 | 3182 | 	__le32 bogus_ack;	/* ACK received when not expecting ACK */ | 
 | 3183 | 	__le32 non_bssid_frames;	/* number of frames with BSSID that | 
 | 3184 | 					 * doesn't belong to the STA BSSID */ | 
 | 3185 | 	__le32 filtered_frames;	/* count frames that were dumped in the | 
 | 3186 | 				 * filtering process */ | 
 | 3187 | 	__le32 non_channel_beacons;	/* beacons with our bss id but not on | 
 | 3188 | 					 * our serving channel */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3189 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3190 |  | 
 | 3191 | struct iwl39_statistics_rx { | 
 | 3192 | 	struct iwl39_statistics_rx_phy ofdm; | 
 | 3193 | 	struct iwl39_statistics_rx_phy cck; | 
 | 3194 | 	struct iwl39_statistics_rx_non_phy general; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3195 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3196 |  | 
 | 3197 | struct iwl39_statistics_tx { | 
 | 3198 | 	__le32 preamble_cnt; | 
 | 3199 | 	__le32 rx_detected_cnt; | 
 | 3200 | 	__le32 bt_prio_defer_cnt; | 
 | 3201 | 	__le32 bt_prio_kill_cnt; | 
 | 3202 | 	__le32 few_bytes_cnt; | 
 | 3203 | 	__le32 cts_timeout; | 
 | 3204 | 	__le32 ack_timeout; | 
 | 3205 | 	__le32 expected_ack_cnt; | 
 | 3206 | 	__le32 actual_ack_cnt; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3207 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3208 |  | 
 | 3209 | struct statistics_dbg { | 
 | 3210 | 	__le32 burst_check; | 
 | 3211 | 	__le32 burst_count; | 
| Wey-Yi Guy | 7c094c5 | 2010-07-06 10:39:32 -0700 | [diff] [blame] | 3212 | 	__le32 wait_for_silence_timeout_cnt; | 
 | 3213 | 	__le32 reserved[3]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3214 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3215 |  | 
 | 3216 | struct iwl39_statistics_div { | 
 | 3217 | 	__le32 tx_on_a; | 
 | 3218 | 	__le32 tx_on_b; | 
 | 3219 | 	__le32 exec_time; | 
 | 3220 | 	__le32 probe_time; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3221 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3222 |  | 
 | 3223 | struct iwl39_statistics_general { | 
 | 3224 | 	__le32 temperature; | 
 | 3225 | 	struct statistics_dbg dbg; | 
 | 3226 | 	__le32 sleep_time; | 
 | 3227 | 	__le32 slots_out; | 
 | 3228 | 	__le32 slots_idle; | 
 | 3229 | 	__le32 ttl_timestamp; | 
 | 3230 | 	struct iwl39_statistics_div div; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3231 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3232 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3233 | struct statistics_rx_phy { | 
 | 3234 | 	__le32 ina_cnt; | 
 | 3235 | 	__le32 fina_cnt; | 
 | 3236 | 	__le32 plcp_err; | 
 | 3237 | 	__le32 crc32_err; | 
 | 3238 | 	__le32 overrun_err; | 
 | 3239 | 	__le32 early_overrun_err; | 
 | 3240 | 	__le32 crc32_good; | 
 | 3241 | 	__le32 false_alarm_cnt; | 
 | 3242 | 	__le32 fina_sync_err_cnt; | 
 | 3243 | 	__le32 sfd_timeout; | 
 | 3244 | 	__le32 fina_timeout; | 
 | 3245 | 	__le32 unresponded_rts; | 
 | 3246 | 	__le32 rxe_frame_limit_overrun; | 
 | 3247 | 	__le32 sent_ack_cnt; | 
 | 3248 | 	__le32 sent_cts_cnt; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3249 | 	__le32 sent_ba_rsp_cnt; | 
 | 3250 | 	__le32 dsp_self_kill; | 
 | 3251 | 	__le32 mh_format_err; | 
 | 3252 | 	__le32 re_acq_main_rssi_sum; | 
 | 3253 | 	__le32 reserved3; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3254 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3255 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3256 | struct statistics_rx_ht_phy { | 
 | 3257 | 	__le32 plcp_err; | 
 | 3258 | 	__le32 overrun_err; | 
 | 3259 | 	__le32 early_overrun_err; | 
 | 3260 | 	__le32 crc32_good; | 
 | 3261 | 	__le32 crc32_err; | 
 | 3262 | 	__le32 mh_format_err; | 
 | 3263 | 	__le32 agg_crc32_good; | 
 | 3264 | 	__le32 agg_mpdu_cnt; | 
 | 3265 | 	__le32 agg_cnt; | 
| Wey-Yi Guy | f0118a4 | 2010-01-08 10:04:42 -0800 | [diff] [blame] | 3266 | 	__le32 unsupport_mcs; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3267 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3268 |  | 
| Harvey Harrison | c1b4aa3 | 2009-01-29 13:26:44 -0800 | [diff] [blame] | 3269 | #define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1) | 
| Winkler, Tomas | 34c22cf | 2008-12-17 16:52:27 +0800 | [diff] [blame] | 3270 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3271 | struct statistics_rx_non_phy { | 
 | 3272 | 	__le32 bogus_cts;	/* CTS received when not expecting CTS */ | 
 | 3273 | 	__le32 bogus_ack;	/* ACK received when not expecting ACK */ | 
 | 3274 | 	__le32 non_bssid_frames;	/* number of frames with BSSID that | 
 | 3275 | 					 * doesn't belong to the STA BSSID */ | 
 | 3276 | 	__le32 filtered_frames;	/* count frames that were dumped in the | 
 | 3277 | 				 * filtering process */ | 
 | 3278 | 	__le32 non_channel_beacons;	/* beacons with our bss id but not on | 
 | 3279 | 					 * our serving channel */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3280 | 	__le32 channel_beacons;	/* beacons with our bss id and in our | 
 | 3281 | 				 * serving channel */ | 
 | 3282 | 	__le32 num_missed_bcon;	/* number of missed beacons */ | 
 | 3283 | 	__le32 adc_rx_saturation_time;	/* count in 0.8us units the time the | 
 | 3284 | 					 * ADC was in saturation */ | 
 | 3285 | 	__le32 ina_detection_search_time;/* total time (in 0.8us) searched | 
 | 3286 | 					  * for INA */ | 
 | 3287 | 	__le32 beacon_silence_rssi_a;	/* RSSI silence after beacon frame */ | 
 | 3288 | 	__le32 beacon_silence_rssi_b;	/* RSSI silence after beacon frame */ | 
 | 3289 | 	__le32 beacon_silence_rssi_c;	/* RSSI silence after beacon frame */ | 
 | 3290 | 	__le32 interference_data_flag;	/* flag for interference data | 
 | 3291 | 					 * availability. 1 when data is | 
 | 3292 | 					 * available. */ | 
| Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 3293 | 	__le32 channel_load;		/* counts RX Enable time in uSec */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3294 | 	__le32 dsp_false_alarms;	/* DSP false alarm (both OFDM | 
 | 3295 | 					 * and CCK) counter */ | 
 | 3296 | 	__le32 beacon_rssi_a; | 
 | 3297 | 	__le32 beacon_rssi_b; | 
 | 3298 | 	__le32 beacon_rssi_c; | 
 | 3299 | 	__le32 beacon_energy_a; | 
 | 3300 | 	__le32 beacon_energy_b; | 
 | 3301 | 	__le32 beacon_energy_c; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3302 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3303 |  | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3304 | struct statistics_rx_non_phy_bt { | 
 | 3305 | 	struct statistics_rx_non_phy common; | 
 | 3306 | 	/* additional stats for bt */ | 
 | 3307 | 	__le32 num_bt_kills; | 
 | 3308 | 	__le32 reserved[2]; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3309 | } __packed; | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3310 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3311 | struct statistics_rx { | 
 | 3312 | 	struct statistics_rx_phy ofdm; | 
 | 3313 | 	struct statistics_rx_phy cck; | 
 | 3314 | 	struct statistics_rx_non_phy general; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3315 | 	struct statistics_rx_ht_phy ofdm_ht; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3316 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3317 |  | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3318 | struct statistics_rx_bt { | 
 | 3319 | 	struct statistics_rx_phy ofdm; | 
 | 3320 | 	struct statistics_rx_phy cck; | 
 | 3321 | 	struct statistics_rx_non_phy_bt general; | 
 | 3322 | 	struct statistics_rx_ht_phy ofdm_ht; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3323 | } __packed; | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3324 |  | 
| Wey-Yi Guy | fcbaf8b | 2009-08-21 13:34:18 -0700 | [diff] [blame] | 3325 | /** | 
 | 3326 |  * struct statistics_tx_power - current tx power | 
 | 3327 |  * | 
 | 3328 |  * @ant_a: current tx power on chain a in 1/2 dB step | 
 | 3329 |  * @ant_b: current tx power on chain b in 1/2 dB step | 
 | 3330 |  * @ant_c: current tx power on chain c in 1/2 dB step | 
 | 3331 |  */ | 
 | 3332 | struct statistics_tx_power { | 
 | 3333 | 	u8 ant_a; | 
 | 3334 | 	u8 ant_b; | 
 | 3335 | 	u8 ant_c; | 
 | 3336 | 	u8 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3337 | } __packed; | 
| Wey-Yi Guy | fcbaf8b | 2009-08-21 13:34:18 -0700 | [diff] [blame] | 3338 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3339 | struct statistics_tx_non_phy_agg { | 
 | 3340 | 	__le32 ba_timeout; | 
 | 3341 | 	__le32 ba_reschedule_frames; | 
 | 3342 | 	__le32 scd_query_agg_frame_cnt; | 
 | 3343 | 	__le32 scd_query_no_agg; | 
 | 3344 | 	__le32 scd_query_agg; | 
 | 3345 | 	__le32 scd_query_mismatch; | 
 | 3346 | 	__le32 frame_not_ready; | 
 | 3347 | 	__le32 underrun; | 
 | 3348 | 	__le32 bt_prio_kill; | 
 | 3349 | 	__le32 rx_ba_rsp_cnt; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3350 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3351 |  | 
 | 3352 | struct statistics_tx { | 
 | 3353 | 	__le32 preamble_cnt; | 
 | 3354 | 	__le32 rx_detected_cnt; | 
 | 3355 | 	__le32 bt_prio_defer_cnt; | 
 | 3356 | 	__le32 bt_prio_kill_cnt; | 
 | 3357 | 	__le32 few_bytes_cnt; | 
 | 3358 | 	__le32 cts_timeout; | 
 | 3359 | 	__le32 ack_timeout; | 
 | 3360 | 	__le32 expected_ack_cnt; | 
 | 3361 | 	__le32 actual_ack_cnt; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3362 | 	__le32 dump_msdu_cnt; | 
 | 3363 | 	__le32 burst_abort_next_frame_mismatch_cnt; | 
 | 3364 | 	__le32 burst_abort_missing_next_frame_cnt; | 
 | 3365 | 	__le32 cts_timeout_collision; | 
 | 3366 | 	__le32 ack_or_ba_timeout_collision; | 
 | 3367 | 	struct statistics_tx_non_phy_agg agg; | 
| Wey-Yi Guy | 470356b | 2010-04-30 11:35:15 -0700 | [diff] [blame] | 3368 | 	/* | 
 | 3369 | 	 * "tx_power" are optional parameters provided by uCode, | 
 | 3370 | 	 * 6000 series is the only device provide the information, | 
 | 3371 | 	 * Those are reserved fields for all the other devices | 
 | 3372 | 	 */ | 
| Wey-Yi Guy | fcbaf8b | 2009-08-21 13:34:18 -0700 | [diff] [blame] | 3373 | 	struct statistics_tx_power tx_power; | 
 | 3374 | 	__le32 reserved1; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3375 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3376 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3377 |  | 
 | 3378 | struct statistics_div { | 
 | 3379 | 	__le32 tx_on_a; | 
 | 3380 | 	__le32 tx_on_b; | 
 | 3381 | 	__le32 exec_time; | 
 | 3382 | 	__le32 probe_time; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3383 | 	__le32 reserved1; | 
 | 3384 | 	__le32 reserved2; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3385 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3386 |  | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3387 | struct statistics_general_common { | 
| Wey-Yi Guy | f0118a4 | 2010-01-08 10:04:42 -0800 | [diff] [blame] | 3388 | 	__le32 temperature;   /* radio temperature */ | 
 | 3389 | 	__le32 temperature_m; /* for 5000 and up, this is radio voltage */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3390 | 	struct statistics_dbg dbg; | 
 | 3391 | 	__le32 sleep_time; | 
 | 3392 | 	__le32 slots_out; | 
 | 3393 | 	__le32 slots_idle; | 
 | 3394 | 	__le32 ttl_timestamp; | 
 | 3395 | 	struct statistics_div div; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3396 | 	__le32 rx_enable_counter; | 
| Wey-Yi Guy | 11fc524 | 2010-01-15 13:43:35 -0800 | [diff] [blame] | 3397 | 	/* | 
 | 3398 | 	 * num_of_sos_states: | 
 | 3399 | 	 *  count the number of times we have to re-tune | 
 | 3400 | 	 *  in order to get out of bad PHY status | 
 | 3401 | 	 */ | 
 | 3402 | 	__le32 num_of_sos_states; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3403 | } __packed; | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3404 |  | 
 | 3405 | struct statistics_bt_activity { | 
 | 3406 | 	/* Tx statistics */ | 
 | 3407 | 	__le32 hi_priority_tx_req_cnt; | 
 | 3408 | 	__le32 hi_priority_tx_denied_cnt; | 
 | 3409 | 	__le32 lo_priority_tx_req_cnt; | 
 | 3410 | 	__le32 lo_priority_tx_denied_cnt; | 
 | 3411 | 	/* Rx statistics */ | 
 | 3412 | 	__le32 hi_priority_rx_req_cnt; | 
 | 3413 | 	__le32 hi_priority_rx_denied_cnt; | 
 | 3414 | 	__le32 lo_priority_rx_req_cnt; | 
 | 3415 | 	__le32 lo_priority_rx_denied_cnt; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3416 | } __packed; | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3417 |  | 
 | 3418 | struct statistics_general { | 
 | 3419 | 	struct statistics_general_common common; | 
 | 3420 | 	__le32 reserved2; | 
 | 3421 | 	__le32 reserved3; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3422 | } __packed; | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3423 |  | 
 | 3424 | struct statistics_general_bt { | 
 | 3425 | 	struct statistics_general_common common; | 
 | 3426 | 	struct statistics_bt_activity activity; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3427 | 	__le32 reserved2; | 
 | 3428 | 	__le32 reserved3; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3429 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3430 |  | 
| Wey-Yi Guy | ef8d552 | 2009-11-13 11:56:28 -0800 | [diff] [blame] | 3431 | #define UCODE_STATISTICS_CLEAR_MSK		(0x1 << 0) | 
 | 3432 | #define UCODE_STATISTICS_FREQUENCY_MSK		(0x1 << 1) | 
 | 3433 | #define UCODE_STATISTICS_NARROW_BAND_MSK	(0x1 << 2) | 
 | 3434 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3435 | /* | 
 | 3436 |  * REPLY_STATISTICS_CMD = 0x9c, | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 3437 |  * all devices identical. | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3438 |  * | 
 | 3439 |  * This command triggers an immediate response containing uCode statistics. | 
 | 3440 |  * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. | 
 | 3441 |  * | 
 | 3442 |  * If the CLEAR_STATS configuration flag is set, uCode will clear its | 
 | 3443 |  * internal copy of the statistics (counters) after issuing the response. | 
 | 3444 |  * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). | 
 | 3445 |  * | 
 | 3446 |  * If the DISABLE_NOTIF configuration flag is set, uCode will not issue | 
 | 3447 |  * STATISTICS_NOTIFICATIONs after received beacons (see below).  This flag | 
 | 3448 |  * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. | 
 | 3449 |  */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 3450 | #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1)	/* see above */ | 
 | 3451 | #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ | 
| Emmanuel Grumbach | 8f91aec | 2008-06-30 17:23:07 +0800 | [diff] [blame] | 3452 | struct iwl_statistics_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3453 | 	__le32 configuration_flags;	/* IWL_STATS_CONF_* */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3454 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3455 |  | 
 | 3456 | /* | 
 | 3457 |  * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) | 
 | 3458 |  * | 
 | 3459 |  * By default, uCode issues this notification after receiving a beacon | 
 | 3460 |  * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the | 
 | 3461 |  * REPLY_STATISTICS_CMD 0x9c, above. | 
 | 3462 |  * | 
 | 3463 |  * Statistics counters continue to increment beacon after beacon, but are | 
 | 3464 |  * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD | 
 | 3465 |  * 0x9c with CLEAR_STATS bit set (see above). | 
 | 3466 |  * | 
 | 3467 |  * uCode also issues this notification during scans.  uCode clears statistics | 
 | 3468 |  * appropriately so that each notification contains statistics for only the | 
 | 3469 |  * one channel that has just been scanned. | 
 | 3470 |  */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 3471 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK         cpu_to_le32(0x2) | 
| Wey-Yi Guy | 7aafef1 | 2009-08-07 15:41:38 -0700 | [diff] [blame] | 3472 | #define STATISTICS_REPLY_FLG_HT40_MODE_MSK        cpu_to_le32(0x8) | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3473 |  | 
 | 3474 | struct iwl3945_notif_statistics { | 
 | 3475 | 	__le32 flag; | 
 | 3476 | 	struct iwl39_statistics_rx rx; | 
 | 3477 | 	struct iwl39_statistics_tx tx; | 
 | 3478 | 	struct iwl39_statistics_general general; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3479 | } __packed; | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 3480 |  | 
| Emmanuel Grumbach | 8f91aec | 2008-06-30 17:23:07 +0800 | [diff] [blame] | 3481 | struct iwl_notif_statistics { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3482 | 	__le32 flag; | 
 | 3483 | 	struct statistics_rx rx; | 
 | 3484 | 	struct statistics_tx tx; | 
 | 3485 | 	struct statistics_general general; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3486 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3487 |  | 
| Wey-Yi Guy | 325322e | 2010-07-14 08:07:27 -0700 | [diff] [blame] | 3488 | struct iwl_bt_notif_statistics { | 
 | 3489 | 	__le32 flag; | 
 | 3490 | 	struct statistics_rx_bt rx; | 
 | 3491 | 	struct statistics_tx tx; | 
 | 3492 | 	struct statistics_general_bt general; | 
| John W. Linville | da22f79 | 2010-07-26 15:04:12 -0400 | [diff] [blame] | 3493 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3494 |  | 
 | 3495 | /* | 
 | 3496 |  * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) | 
| Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 3497 |  * | 
 | 3498 |  * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed | 
 | 3499 |  * in regardless of how many missed beacons, which mean when driver receive the | 
 | 3500 |  * notification, inside the command, it can find all the beacons information | 
 | 3501 |  * which include number of total missed beacons, number of consecutive missed | 
 | 3502 |  * beacons, number of beacons received and number of beacons expected to | 
 | 3503 |  * receive. | 
 | 3504 |  * | 
 | 3505 |  * If uCode detected consecutive_missed_beacons > 5, it will reset the radio | 
 | 3506 |  * in order to bring the radio/PHY back to working state; which has no relation | 
 | 3507 |  * to when driver will perform sensitivity calibration. | 
 | 3508 |  * | 
 | 3509 |  * Driver should set it own missed_beacon_threshold to decide when to perform | 
 | 3510 |  * sensitivity calibration based on number of consecutive missed beacons in | 
 | 3511 |  * order to improve overall performance, especially in noisy environment. | 
 | 3512 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3513 |  */ | 
| Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 3514 |  | 
 | 3515 | #define IWL_MISSED_BEACON_THRESHOLD_MIN	(1) | 
 | 3516 | #define IWL_MISSED_BEACON_THRESHOLD_DEF	(5) | 
 | 3517 | #define IWL_MISSED_BEACON_THRESHOLD_MAX	IWL_MISSED_BEACON_THRESHOLD_DEF | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3518 |  | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 3519 | struct iwl_missed_beacon_notif { | 
| Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 3520 | 	__le32 consecutive_missed_beacons; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3521 | 	__le32 total_missed_becons; | 
 | 3522 | 	__le32 num_expected_beacons; | 
 | 3523 | 	__le32 num_recvd_beacons; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3524 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3525 |  | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3526 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3527 | /****************************************************************************** | 
 | 3528 |  * (11) | 
 | 3529 |  * Rx Calibration Commands: | 
 | 3530 |  * | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3531 |  * With the uCode used for open source drivers, most Tx calibration (except | 
 | 3532 |  * for Tx Power) and most Rx calibration is done by uCode during the | 
 | 3533 |  * "initialize" phase of uCode boot.  Driver must calibrate only: | 
 | 3534 |  * | 
 | 3535 |  * 1)  Tx power (depends on temperature), described elsewhere | 
 | 3536 |  * 2)  Receiver gain balance (optimize MIMO, and detect disconnected antennas) | 
 | 3537 |  * 3)  Receiver sensitivity (to optimize signal detection) | 
 | 3538 |  * | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3539 |  *****************************************************************************/ | 
 | 3540 |  | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3541 | /** | 
 | 3542 |  * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) | 
 | 3543 |  * | 
 | 3544 |  * This command sets up the Rx signal detector for a sensitivity level that | 
 | 3545 |  * is high enough to lock onto all signals within the associated network, | 
 | 3546 |  * but low enough to ignore signals that are below a certain threshold, so as | 
 | 3547 |  * not to have too many "false alarms".  False alarms are signals that the | 
 | 3548 |  * Rx DSP tries to lock onto, but then discards after determining that they | 
 | 3549 |  * are noise. | 
 | 3550 |  * | 
 | 3551 |  * The optimum number of false alarms is between 5 and 50 per 200 TUs | 
 | 3552 |  * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. | 
 | 3553 |  * time listening, not transmitting).  Driver must adjust sensitivity so that | 
 | 3554 |  * the ratio of actual false alarms to actual Rx time falls within this range. | 
 | 3555 |  * | 
 | 3556 |  * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each | 
 | 3557 |  * received beacon.  These provide information to the driver to analyze the | 
 | 3558 |  * sensitivity.  Don't analyze statistics that come in from scanning, or any | 
 | 3559 |  * other non-associated-network source.  Pertinent statistics include: | 
 | 3560 |  * | 
 | 3561 |  * From "general" statistics (struct statistics_rx_non_phy): | 
 | 3562 |  * | 
 | 3563 |  * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) | 
 | 3564 |  *   Measure of energy of desired signal.  Used for establishing a level | 
 | 3565 |  *   below which the device does not detect signals. | 
 | 3566 |  * | 
 | 3567 |  * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) | 
 | 3568 |  *   Measure of background noise in silent period after beacon. | 
 | 3569 |  * | 
 | 3570 |  * channel_load | 
 | 3571 |  *   uSecs of actual Rx time during beacon period (varies according to | 
 | 3572 |  *   how much time was spent transmitting). | 
 | 3573 |  * | 
 | 3574 |  * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: | 
 | 3575 |  * | 
 | 3576 |  * false_alarm_cnt | 
 | 3577 |  *   Signal locks abandoned early (before phy-level header). | 
 | 3578 |  * | 
 | 3579 |  * plcp_err | 
 | 3580 |  *   Signal locks abandoned late (during phy-level header). | 
 | 3581 |  * | 
 | 3582 |  * NOTE:  Both false_alarm_cnt and plcp_err increment monotonically from | 
 | 3583 |  *        beacon to beacon, i.e. each value is an accumulation of all errors | 
 | 3584 |  *        before and including the latest beacon.  Values will wrap around to 0 | 
 | 3585 |  *        after counting up to 2^32 - 1.  Driver must differentiate vs. | 
 | 3586 |  *        previous beacon's values to determine # false alarms in the current | 
 | 3587 |  *        beacon period. | 
 | 3588 |  * | 
 | 3589 |  * Total number of false alarms = false_alarms + plcp_errs | 
 | 3590 |  * | 
 | 3591 |  * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd | 
 | 3592 |  * (notice that the start points for OFDM are at or close to settings for | 
 | 3593 |  * maximum sensitivity): | 
 | 3594 |  * | 
 | 3595 |  *                                             START  /  MIN  /  MAX | 
 | 3596 |  *   HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX          90   /   85  /  120 | 
 | 3597 |  *   HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX     170   /  170  /  210 | 
 | 3598 |  *   HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX         105   /  105  /  140 | 
 | 3599 |  *   HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX     220   /  220  /  270 | 
 | 3600 |  * | 
 | 3601 |  *   If actual rate of OFDM false alarms (+ plcp_errors) is too high | 
 | 3602 |  *   (greater than 50 for each 204.8 msecs listening), reduce sensitivity | 
 | 3603 |  *   by *adding* 1 to all 4 of the table entries above, up to the max for | 
 | 3604 |  *   each entry.  Conversely, if false alarm rate is too low (less than 5 | 
 | 3605 |  *   for each 204.8 msecs listening), *subtract* 1 from each entry to | 
 | 3606 |  *   increase sensitivity. | 
 | 3607 |  * | 
 | 3608 |  * For CCK sensitivity, keep track of the following: | 
 | 3609 |  * | 
 | 3610 |  *   1).  20-beacon history of maximum background noise, indicated by | 
 | 3611 |  *        (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the | 
 | 3612 |  *        3 receivers.  For any given beacon, the "silence reference" is | 
 | 3613 |  *        the maximum of last 60 samples (20 beacons * 3 receivers). | 
 | 3614 |  * | 
 | 3615 |  *   2).  10-beacon history of strongest signal level, as indicated | 
 | 3616 |  *        by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, | 
 | 3617 |  *        i.e. the strength of the signal through the best receiver at the | 
 | 3618 |  *        moment.  These measurements are "upside down", with lower values | 
 | 3619 |  *        for stronger signals, so max energy will be *minimum* value. | 
 | 3620 |  * | 
 | 3621 |  *        Then for any given beacon, the driver must determine the *weakest* | 
 | 3622 |  *        of the strongest signals; this is the minimum level that needs to be | 
 | 3623 |  *        successfully detected, when using the best receiver at the moment. | 
 | 3624 |  *        "Max cck energy" is the maximum (higher value means lower energy!) | 
 | 3625 |  *        of the last 10 minima.  Once this is determined, driver must add | 
 | 3626 |  *        a little margin by adding "6" to it. | 
 | 3627 |  * | 
 | 3628 |  *   3).  Number of consecutive beacon periods with too few false alarms. | 
 | 3629 |  *        Reset this to 0 at the first beacon period that falls within the | 
 | 3630 |  *        "good" range (5 to 50 false alarms per 204.8 milliseconds rx). | 
 | 3631 |  * | 
 | 3632 |  * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd | 
 | 3633 |  * (notice that the start points for CCK are at maximum sensitivity): | 
 | 3634 |  * | 
 | 3635 |  *                                             START  /  MIN  /  MAX | 
 | 3636 |  *   HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX         125   /  125  /  200 | 
 | 3637 |  *   HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX     200   /  200  /  400 | 
 | 3638 |  *   HD_MIN_ENERGY_CCK_DET_INDEX                100   /    0  /  100 | 
 | 3639 |  * | 
 | 3640 |  *   If actual rate of CCK false alarms (+ plcp_errors) is too high | 
 | 3641 |  *   (greater than 50 for each 204.8 msecs listening), method for reducing | 
 | 3642 |  *   sensitivity is: | 
 | 3643 |  * | 
 | 3644 |  *   1)  *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, | 
 | 3645 |  *       up to max 400. | 
 | 3646 |  * | 
 | 3647 |  *   2)  If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, | 
 | 3648 |  *       sensitivity has been reduced a significant amount; bring it up to | 
 | 3649 |  *       a moderate 161.  Otherwise, *add* 3, up to max 200. | 
 | 3650 |  * | 
 | 3651 |  *   3)  a)  If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, | 
 | 3652 |  *       sensitivity has been reduced only a moderate or small amount; | 
 | 3653 |  *       *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, | 
 | 3654 |  *       down to min 0.  Otherwise (if gain has been significantly reduced), | 
 | 3655 |  *       don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. | 
 | 3656 |  * | 
 | 3657 |  *       b)  Save a snapshot of the "silence reference". | 
 | 3658 |  * | 
 | 3659 |  *   If actual rate of CCK false alarms (+ plcp_errors) is too low | 
 | 3660 |  *   (less than 5 for each 204.8 msecs listening), method for increasing | 
 | 3661 |  *   sensitivity is used only if: | 
 | 3662 |  * | 
 | 3663 |  *   1a)  Previous beacon did not have too many false alarms | 
 | 3664 |  *   1b)  AND difference between previous "silence reference" and current | 
 | 3665 |  *        "silence reference" (prev - current) is 2 or more, | 
 | 3666 |  *   OR 2)  100 or more consecutive beacon periods have had rate of | 
 | 3667 |  *          less than 5 false alarms per 204.8 milliseconds rx time. | 
 | 3668 |  * | 
 | 3669 |  *   Method for increasing sensitivity: | 
 | 3670 |  * | 
 | 3671 |  *   1)  *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, | 
 | 3672 |  *       down to min 125. | 
 | 3673 |  * | 
 | 3674 |  *   2)  *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, | 
 | 3675 |  *       down to min 200. | 
 | 3676 |  * | 
 | 3677 |  *   3)  *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. | 
 | 3678 |  * | 
 | 3679 |  *   If actual rate of CCK false alarms (+ plcp_errors) is within good range | 
 | 3680 |  *   (between 5 and 50 for each 204.8 msecs listening): | 
 | 3681 |  * | 
 | 3682 |  *   1)  Save a snapshot of the silence reference. | 
 | 3683 |  * | 
 | 3684 |  *   2)  If previous beacon had too many CCK false alarms (+ plcp_errors), | 
 | 3685 |  *       give some extra margin to energy threshold by *subtracting* 8 | 
 | 3686 |  *       from value in HD_MIN_ENERGY_CCK_DET_INDEX. | 
 | 3687 |  * | 
 | 3688 |  *   For all cases (too few, too many, good range), make sure that the CCK | 
 | 3689 |  *   detection threshold (energy) is below the energy level for robust | 
 | 3690 |  *   detection over the past 10 beacon periods, the "Max cck energy". | 
 | 3691 |  *   Lower values mean higher energy; this means making sure that the value | 
 | 3692 |  *   in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". | 
 | 3693 |  * | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3694 |  */ | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3695 |  | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3696 | /* | 
| Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 3697 |  * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3698 |  */ | 
 | 3699 | #define HD_TABLE_SIZE  (11)	/* number of entries */ | 
 | 3700 | #define HD_MIN_ENERGY_CCK_DET_INDEX                 (0)	/* table indexes */ | 
 | 3701 | #define HD_MIN_ENERGY_OFDM_DET_INDEX                (1) | 
 | 3702 | #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX          (2) | 
 | 3703 | #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX      (3) | 
 | 3704 | #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX      (4) | 
 | 3705 | #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX          (5) | 
 | 3706 | #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX      (6) | 
 | 3707 | #define HD_BARKER_CORR_TH_ADD_MIN_INDEX             (7) | 
 | 3708 | #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX         (8) | 
 | 3709 | #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX          (9) | 
 | 3710 | #define HD_OFDM_ENERGY_TH_IN_INDEX                  (10) | 
 | 3711 |  | 
| Wey-Yi Guy | c8312fa | 2010-06-28 13:05:17 -0700 | [diff] [blame] | 3712 | /* | 
 | 3713 |  * Additional table entries in enhance SENSITIVITY_CMD | 
 | 3714 |  */ | 
 | 3715 | #define HD_INA_NON_SQUARE_DET_OFDM_INDEX		(11) | 
 | 3716 | #define HD_INA_NON_SQUARE_DET_CCK_INDEX			(12) | 
 | 3717 | #define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX		(13) | 
 | 3718 | #define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX		(14) | 
 | 3719 | #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX	(15) | 
 | 3720 | #define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX		(16) | 
 | 3721 | #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX		(17) | 
 | 3722 | #define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX		(18) | 
 | 3723 | #define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX	(19) | 
 | 3724 | #define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX		(20) | 
 | 3725 | #define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX		(21) | 
 | 3726 | #define HD_RESERVED					(22) | 
 | 3727 |  | 
 | 3728 | /* number of entries for enhanced tbl */ | 
 | 3729 | #define ENHANCE_HD_TABLE_SIZE  (23) | 
 | 3730 |  | 
 | 3731 | /* number of additional entries for enhanced tbl */ | 
 | 3732 | #define ENHANCE_HD_TABLE_ENTRIES  (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE) | 
 | 3733 |  | 
 | 3734 | #define HD_INA_NON_SQUARE_DET_OFDM_DATA			cpu_to_le16(0) | 
 | 3735 | #define HD_INA_NON_SQUARE_DET_CCK_DATA			cpu_to_le16(0) | 
 | 3736 | #define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA		cpu_to_le16(0) | 
 | 3737 | #define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA		cpu_to_le16(668) | 
 | 3738 | #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA	cpu_to_le16(4) | 
 | 3739 | #define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA		cpu_to_le16(486) | 
 | 3740 | #define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA		cpu_to_le16(37) | 
 | 3741 | #define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA		cpu_to_le16(853) | 
 | 3742 | #define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA	cpu_to_le16(4) | 
 | 3743 | #define HD_CCK_NON_SQUARE_DET_SLOPE_DATA		cpu_to_le16(476) | 
 | 3744 | #define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA		cpu_to_le16(99) | 
 | 3745 |  | 
 | 3746 |  | 
| Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 3747 | /* Control field in struct iwl_sensitivity_cmd */ | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 3748 | #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE	cpu_to_le16(0) | 
 | 3749 | #define SENSITIVITY_CMD_CONTROL_WORK_TABLE	cpu_to_le16(1) | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3750 |  | 
 | 3751 | /** | 
| Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 3752 |  * struct iwl_sensitivity_cmd | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3753 |  * @control:  (1) updates working table, (0) updates default table | 
 | 3754 |  * @table:  energy threshold values, use HD_* as index into table | 
 | 3755 |  * | 
 | 3756 |  * Always use "1" in "control" to update uCode's working table and DSP. | 
 | 3757 |  */ | 
| Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 3758 | struct iwl_sensitivity_cmd { | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3759 | 	__le16 control;			/* always use "1" */ | 
 | 3760 | 	__le16 table[HD_TABLE_SIZE];	/* use HD_* as index */ | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3761 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3762 |  | 
| Wey-Yi Guy | c8312fa | 2010-06-28 13:05:17 -0700 | [diff] [blame] | 3763 | /* | 
 | 3764 |  * | 
 | 3765 |  */ | 
 | 3766 | struct iwl_enhance_sensitivity_cmd { | 
 | 3767 | 	__le16 control;			/* always use "1" */ | 
 | 3768 | 	__le16 enhance_table[ENHANCE_HD_TABLE_SIZE];	/* use HD_* as index */ | 
| John W. Linville | 0e95409 | 2010-07-14 10:37:32 -0400 | [diff] [blame] | 3769 | } __packed; | 
| Wey-Yi Guy | c8312fa | 2010-06-28 13:05:17 -0700 | [diff] [blame] | 3770 |  | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3771 |  | 
 | 3772 | /** | 
 | 3773 |  * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) | 
 | 3774 |  * | 
| Wey-Yi Guy | 767d055 | 2010-08-23 07:56:53 -0700 | [diff] [blame] | 3775 |  * This command sets the relative gains of agn device's 3 radio receiver chains. | 
| Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 3776 |  * | 
 | 3777 |  * After the first association, driver should accumulate signal and noise | 
 | 3778 |  * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 | 
 | 3779 |  * beacons from the associated network (don't collect statistics that come | 
 | 3780 |  * in from scanning, or any other non-network source). | 
 | 3781 |  * | 
 | 3782 |  * DISCONNECTED ANTENNA: | 
 | 3783 |  * | 
 | 3784 |  * Driver should determine which antennas are actually connected, by comparing | 
 | 3785 |  * average beacon signal levels for the 3 Rx chains.  Accumulate (add) the | 
 | 3786 |  * following values over 20 beacons, one accumulator for each of the chains | 
 | 3787 |  * a/b/c, from struct statistics_rx_non_phy: | 
 | 3788 |  * | 
 | 3789 |  * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) | 
 | 3790 |  * | 
 | 3791 |  * Find the strongest signal from among a/b/c.  Compare the other two to the | 
 | 3792 |  * strongest.  If any signal is more than 15 dB (times 20, unless you | 
 | 3793 |  * divide the accumulated values by 20) below the strongest, the driver | 
 | 3794 |  * considers that antenna to be disconnected, and should not try to use that | 
 | 3795 |  * antenna/chain for Rx or Tx.  If both A and B seem to be disconnected, | 
 | 3796 |  * driver should declare the stronger one as connected, and attempt to use it | 
 | 3797 |  * (A and B are the only 2 Tx chains!). | 
 | 3798 |  * | 
 | 3799 |  * | 
 | 3800 |  * RX BALANCE: | 
 | 3801 |  * | 
 | 3802 |  * Driver should balance the 3 receivers (but just the ones that are connected | 
 | 3803 |  * to antennas, see above) for gain, by comparing the average signal levels | 
 | 3804 |  * detected during the silence after each beacon (background noise). | 
 | 3805 |  * Accumulate (add) the following values over 20 beacons, one accumulator for | 
 | 3806 |  * each of the chains a/b/c, from struct statistics_rx_non_phy: | 
 | 3807 |  * | 
 | 3808 |  * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) | 
 | 3809 |  * | 
 | 3810 |  * Find the weakest background noise level from among a/b/c.  This Rx chain | 
 | 3811 |  * will be the reference, with 0 gain adjustment.  Attenuate other channels by | 
 | 3812 |  * finding noise difference: | 
 | 3813 |  * | 
 | 3814 |  * (accum_noise[i] - accum_noise[reference]) / 30 | 
 | 3815 |  * | 
 | 3816 |  * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. | 
 | 3817 |  * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the | 
 | 3818 |  * driver should limit the difference results to a range of 0-3 (0-4.5 dB), | 
 | 3819 |  * and set bit 2 to indicate "reduce gain".  The value for the reference | 
 | 3820 |  * (weakest) chain should be "0". | 
 | 3821 |  * | 
 | 3822 |  * diff_gain_[abc] bit fields: | 
 | 3823 |  *   2: (1) reduce gain, (0) increase gain | 
 | 3824 |  * 1-0: amount of gain, units of 1.5 dB | 
 | 3825 |  */ | 
 | 3826 |  | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3827 | /* Phy calibration command for series */ | 
| Shanyu Zhao | 642454c | 2010-09-21 12:06:18 -0700 | [diff] [blame] | 3828 | /* The default calibrate table size if not specified by firmware */ | 
 | 3829 | #define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE	18 | 
| Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 3830 | enum { | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3831 | 	IWL_PHY_CALIBRATE_DIFF_GAIN_CMD		= 7, | 
 | 3832 | 	IWL_PHY_CALIBRATE_DC_CMD		= 8, | 
 | 3833 | 	IWL_PHY_CALIBRATE_LO_CMD		= 9, | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3834 | 	IWL_PHY_CALIBRATE_TX_IQ_CMD		= 11, | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3835 | 	IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD	= 15, | 
 | 3836 | 	IWL_PHY_CALIBRATE_BASE_BAND_CMD		= 16, | 
 | 3837 | 	IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD	= 17, | 
| Shanyu Zhao | bf53f93 | 2010-09-21 16:54:01 -0700 | [diff] [blame] | 3838 | 	IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD	= 18, | 
 | 3839 | 	IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE	= 19, | 
| Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 3840 | }; | 
 | 3841 |  | 
| Wey-Yi Guy | 6a822d0 | 2010-07-13 17:13:15 -0700 | [diff] [blame] | 3842 | #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE		(253) | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3843 |  | 
| Harvey Harrison | 51e9bf5 | 2008-11-26 13:12:52 -0800 | [diff] [blame] | 3844 | #define IWL_CALIB_INIT_CFG_ALL	cpu_to_le32(0xffffffff) | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3845 |  | 
| Shanyu Zhao | 6d6a1af | 2010-09-14 18:13:31 -0700 | [diff] [blame] | 3846 | /* This enum defines the bitmap of various calibrations to enable in both | 
 | 3847 |  * init ucode and runtime ucode through CALIBRATION_CFG_CMD. | 
 | 3848 |  */ | 
 | 3849 | enum iwl_ucode_calib_cfg { | 
 | 3850 | 	IWL_CALIB_CFG_RX_BB_IDX, | 
 | 3851 | 	IWL_CALIB_CFG_DC_IDX, | 
 | 3852 | 	IWL_CALIB_CFG_TX_IQ_IDX, | 
 | 3853 | 	IWL_CALIB_CFG_RX_IQ_IDX, | 
 | 3854 | 	IWL_CALIB_CFG_NOISE_IDX, | 
 | 3855 | 	IWL_CALIB_CFG_CRYSTAL_IDX, | 
 | 3856 | 	IWL_CALIB_CFG_TEMPERATURE_IDX, | 
 | 3857 | 	IWL_CALIB_CFG_PAPD_IDX, | 
 | 3858 | }; | 
 | 3859 |  | 
 | 3860 |  | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3861 | struct iwl_calib_cfg_elmnt_s { | 
 | 3862 | 	__le32 is_enable; | 
 | 3863 | 	__le32 start; | 
 | 3864 | 	__le32 send_res; | 
 | 3865 | 	__le32 apply_res; | 
 | 3866 | 	__le32 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3867 | } __packed; | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3868 |  | 
 | 3869 | struct iwl_calib_cfg_status_s { | 
 | 3870 | 	struct iwl_calib_cfg_elmnt_s once; | 
 | 3871 | 	struct iwl_calib_cfg_elmnt_s perd; | 
 | 3872 | 	__le32 flags; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3873 | } __packed; | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3874 |  | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3875 | struct iwl_calib_cfg_cmd { | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3876 | 	struct iwl_calib_cfg_status_s ucd_calib_cfg; | 
 | 3877 | 	struct iwl_calib_cfg_status_s drv_calib_cfg; | 
 | 3878 | 	__le32 reserved1; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3879 | } __packed; | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3880 |  | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3881 | struct iwl_calib_hdr { | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3882 | 	u8 op_code; | 
 | 3883 | 	u8 first_group; | 
 | 3884 | 	u8 groups_num; | 
 | 3885 | 	u8 data_valid; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3886 | } __packed; | 
| Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3887 |  | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3888 | struct iwl_calib_cmd { | 
 | 3889 | 	struct iwl_calib_hdr hdr; | 
| Tomas Winkler | be5d56e | 2008-10-08 09:37:27 +0800 | [diff] [blame] | 3890 | 	u8 data[0]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3891 | } __packed; | 
| Tomas Winkler | be5d56e | 2008-10-08 09:37:27 +0800 | [diff] [blame] | 3892 |  | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3893 | /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3894 | struct iwl_calib_diff_gain_cmd { | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3895 | 	struct iwl_calib_hdr hdr; | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3896 | 	s8 diff_gain_a;		/* see above */ | 
 | 3897 | 	s8 diff_gain_b; | 
 | 3898 | 	s8 diff_gain_c; | 
 | 3899 | 	u8 reserved1; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3900 | } __packed; | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3901 |  | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3902 | struct iwl_calib_xtal_freq_cmd { | 
 | 3903 | 	struct iwl_calib_hdr hdr; | 
 | 3904 | 	u8 cap_pin1; | 
 | 3905 | 	u8 cap_pin2; | 
 | 3906 | 	u8 pad[2]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3907 | } __packed; | 
| Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 3908 |  | 
| Shanyu Zhao | bf53f93 | 2010-09-21 16:54:01 -0700 | [diff] [blame] | 3909 | #define DEFAULT_RADIO_SENSOR_OFFSET    2700 | 
 | 3910 | struct iwl_calib_temperature_offset_cmd { | 
 | 3911 | 	struct iwl_calib_hdr hdr; | 
 | 3912 | 	s16 radio_sensor_offset; | 
 | 3913 | 	s16 reserved; | 
 | 3914 | } __packed; | 
 | 3915 |  | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3916 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ | 
 | 3917 | struct iwl_calib_chain_noise_reset_cmd { | 
 | 3918 | 	struct iwl_calib_hdr hdr; | 
 | 3919 | 	u8 data[0]; | 
 | 3920 | }; | 
 | 3921 |  | 
 | 3922 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ | 
| Tomas Winkler | f69f42a | 2008-10-23 23:48:52 -0700 | [diff] [blame] | 3923 | struct iwl_calib_chain_noise_gain_cmd { | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3924 | 	struct iwl_calib_hdr hdr; | 
| Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 3925 | 	u8 delta_gain_1; | 
 | 3926 | 	u8 delta_gain_2; | 
| Tomas Winkler | 0d950d8 | 2008-11-25 13:36:01 -0800 | [diff] [blame] | 3927 | 	u8 pad[2]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3928 | } __packed; | 
| Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 3929 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3930 | /****************************************************************************** | 
 | 3931 |  * (12) | 
 | 3932 |  * Miscellaneous Commands: | 
 | 3933 |  * | 
 | 3934 |  *****************************************************************************/ | 
 | 3935 |  | 
 | 3936 | /* | 
 | 3937 |  * LEDs Command & Response | 
 | 3938 |  * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) | 
 | 3939 |  * | 
 | 3940 |  * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), | 
 | 3941 |  * this command turns it on or off, or sets up a periodic blinking cycle. | 
 | 3942 |  */ | 
| Tomas Winkler | ec1a746 | 2008-07-11 11:53:37 +0800 | [diff] [blame] | 3943 | struct iwl_led_cmd { | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3944 | 	__le32 interval;	/* "interval" in uSec */ | 
 | 3945 | 	u8 id;			/* 1: Activity, 2: Link, 3: Tech */ | 
 | 3946 | 	u8 off;			/* # intervals off while blinking; | 
 | 3947 | 				 * "0", with >0 "on" value, turns LED on */ | 
 | 3948 | 	u8 on;			/* # intervals on while blinking; | 
 | 3949 | 				 * "0", regardless of "off", turns LED off */ | 
 | 3950 | 	u8 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 3951 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3952 |  | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 3953 | /* | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 3954 |  * station priority table entries | 
 | 3955 |  * also used as potential "events" value for both | 
 | 3956 |  * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 3957 |  */ | 
| Wey-Yi Guy | 1933ac4 | 2009-10-30 14:36:18 -0700 | [diff] [blame] | 3958 |  | 
 | 3959 | /* | 
 | 3960 |  * COEX events entry flag masks | 
 | 3961 |  * RP - Requested Priority | 
 | 3962 |  * WP - Win Medium Priority: priority assigned when the contention has been won | 
 | 3963 |  */ | 
 | 3964 | #define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG        (0x1) | 
 | 3965 | #define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG        (0x2) | 
 | 3966 | #define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG  (0x4) | 
 | 3967 |  | 
 | 3968 | #define COEX_CU_UNASSOC_IDLE_RP               4 | 
 | 3969 | #define COEX_CU_UNASSOC_MANUAL_SCAN_RP        4 | 
 | 3970 | #define COEX_CU_UNASSOC_AUTO_SCAN_RP          4 | 
 | 3971 | #define COEX_CU_CALIBRATION_RP                4 | 
 | 3972 | #define COEX_CU_PERIODIC_CALIBRATION_RP       4 | 
 | 3973 | #define COEX_CU_CONNECTION_ESTAB_RP           4 | 
 | 3974 | #define COEX_CU_ASSOCIATED_IDLE_RP            4 | 
 | 3975 | #define COEX_CU_ASSOC_MANUAL_SCAN_RP          4 | 
 | 3976 | #define COEX_CU_ASSOC_AUTO_SCAN_RP            4 | 
 | 3977 | #define COEX_CU_ASSOC_ACTIVE_LEVEL_RP         4 | 
 | 3978 | #define COEX_CU_RF_ON_RP                      6 | 
 | 3979 | #define COEX_CU_RF_OFF_RP                     4 | 
 | 3980 | #define COEX_CU_STAND_ALONE_DEBUG_RP          6 | 
 | 3981 | #define COEX_CU_IPAN_ASSOC_LEVEL_RP           4 | 
 | 3982 | #define COEX_CU_RSRVD1_RP                     4 | 
 | 3983 | #define COEX_CU_RSRVD2_RP                     4 | 
 | 3984 |  | 
 | 3985 | #define COEX_CU_UNASSOC_IDLE_WP               3 | 
 | 3986 | #define COEX_CU_UNASSOC_MANUAL_SCAN_WP        3 | 
 | 3987 | #define COEX_CU_UNASSOC_AUTO_SCAN_WP          3 | 
 | 3988 | #define COEX_CU_CALIBRATION_WP                3 | 
 | 3989 | #define COEX_CU_PERIODIC_CALIBRATION_WP       3 | 
 | 3990 | #define COEX_CU_CONNECTION_ESTAB_WP           3 | 
 | 3991 | #define COEX_CU_ASSOCIATED_IDLE_WP            3 | 
 | 3992 | #define COEX_CU_ASSOC_MANUAL_SCAN_WP          3 | 
 | 3993 | #define COEX_CU_ASSOC_AUTO_SCAN_WP            3 | 
 | 3994 | #define COEX_CU_ASSOC_ACTIVE_LEVEL_WP         3 | 
 | 3995 | #define COEX_CU_RF_ON_WP                      3 | 
 | 3996 | #define COEX_CU_RF_OFF_WP                     3 | 
 | 3997 | #define COEX_CU_STAND_ALONE_DEBUG_WP          6 | 
 | 3998 | #define COEX_CU_IPAN_ASSOC_LEVEL_WP           3 | 
 | 3999 | #define COEX_CU_RSRVD1_WP                     3 | 
 | 4000 | #define COEX_CU_RSRVD2_WP                     3 | 
 | 4001 |  | 
 | 4002 | #define COEX_UNASSOC_IDLE_FLAGS                     0 | 
 | 4003 | #define COEX_UNASSOC_MANUAL_SCAN_FLAGS		\ | 
 | 4004 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4005 | 	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4006 | #define COEX_UNASSOC_AUTO_SCAN_FLAGS		\ | 
 | 4007 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4008 | 	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4009 | #define COEX_CALIBRATION_FLAGS			\ | 
 | 4010 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4011 | 	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4012 | #define COEX_PERIODIC_CALIBRATION_FLAGS             0 | 
 | 4013 | /* | 
 | 4014 |  * COEX_CONNECTION_ESTAB: | 
 | 4015 |  * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. | 
 | 4016 |  */ | 
 | 4017 | #define COEX_CONNECTION_ESTAB_FLAGS		\ | 
 | 4018 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4019 | 	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\ | 
 | 4020 | 	COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) | 
 | 4021 | #define COEX_ASSOCIATED_IDLE_FLAGS                  0 | 
 | 4022 | #define COEX_ASSOC_MANUAL_SCAN_FLAGS		\ | 
 | 4023 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4024 | 	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4025 | #define COEX_ASSOC_AUTO_SCAN_FLAGS		\ | 
 | 4026 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4027 | 	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4028 | #define COEX_ASSOC_ACTIVE_LEVEL_FLAGS               0 | 
 | 4029 | #define COEX_RF_ON_FLAGS                            0 | 
 | 4030 | #define COEX_RF_OFF_FLAGS                           0 | 
 | 4031 | #define COEX_STAND_ALONE_DEBUG_FLAGS		\ | 
 | 4032 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4033 | 	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) | 
 | 4034 | #define COEX_IPAN_ASSOC_LEVEL_FLAGS		\ | 
 | 4035 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4036 | 	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\ | 
 | 4037 | 	 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) | 
 | 4038 | #define COEX_RSRVD1_FLAGS                           0 | 
 | 4039 | #define COEX_RSRVD2_FLAGS                           0 | 
 | 4040 | /* | 
 | 4041 |  * COEX_CU_RF_ON is the event wrapping all radio ownership. | 
 | 4042 |  * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. | 
 | 4043 |  */ | 
 | 4044 | #define COEX_CU_RF_ON_FLAGS			\ | 
 | 4045 | 	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\ | 
 | 4046 | 	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\ | 
 | 4047 | 	 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) | 
 | 4048 |  | 
 | 4049 |  | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4050 | enum { | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4051 | 	/* un-association part */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4052 | 	COEX_UNASSOC_IDLE		= 0, | 
 | 4053 | 	COEX_UNASSOC_MANUAL_SCAN	= 1, | 
 | 4054 | 	COEX_UNASSOC_AUTO_SCAN		= 2, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4055 | 	/* calibration */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4056 | 	COEX_CALIBRATION		= 3, | 
 | 4057 | 	COEX_PERIODIC_CALIBRATION	= 4, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4058 | 	/* connection */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4059 | 	COEX_CONNECTION_ESTAB		= 5, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4060 | 	/* association part */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4061 | 	COEX_ASSOCIATED_IDLE		= 6, | 
 | 4062 | 	COEX_ASSOC_MANUAL_SCAN		= 7, | 
 | 4063 | 	COEX_ASSOC_AUTO_SCAN		= 8, | 
 | 4064 | 	COEX_ASSOC_ACTIVE_LEVEL		= 9, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4065 | 	/* RF ON/OFF */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4066 | 	COEX_RF_ON			= 10, | 
 | 4067 | 	COEX_RF_OFF			= 11, | 
 | 4068 | 	COEX_STAND_ALONE_DEBUG		= 12, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4069 | 	/* IPAN */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4070 | 	COEX_IPAN_ASSOC_LEVEL		= 13, | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4071 | 	/* reserved */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4072 | 	COEX_RSRVD1			= 14, | 
 | 4073 | 	COEX_RSRVD2			= 15, | 
 | 4074 | 	COEX_NUM_OF_EVENTS		= 16 | 
 | 4075 | }; | 
 | 4076 |  | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4077 | /* | 
 | 4078 |  * Coexistence WIFI/WIMAX  Command | 
 | 4079 |  * COEX_PRIORITY_TABLE_CMD = 0x5a | 
 | 4080 |  * | 
 | 4081 |  */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4082 | struct iwl_wimax_coex_event_entry { | 
 | 4083 | 	u8 request_prio; | 
 | 4084 | 	u8 win_medium_prio; | 
 | 4085 | 	u8 reserved; | 
 | 4086 | 	u8 flags; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4087 | } __packed; | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4088 |  | 
 | 4089 | /* COEX flag masks */ | 
 | 4090 |  | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 4091 | /* Station table is valid */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4092 | #define COEX_FLAGS_STA_TABLE_VALID_MSK      (0x1) | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 4093 | /* UnMask wake up src at unassociated sleep */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4094 | #define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK    (0x4) | 
| Tomas Winkler | a96a27f | 2008-10-23 23:48:56 -0700 | [diff] [blame] | 4095 | /* UnMask wake up src at associated sleep */ | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4096 | #define COEX_FLAGS_ASSOC_WA_UNMASK_MSK      (0x8) | 
 | 4097 | /* Enable CoEx feature. */ | 
 | 4098 | #define COEX_FLAGS_COEX_ENABLE_MSK          (0x80) | 
 | 4099 |  | 
 | 4100 | struct iwl_wimax_coex_cmd { | 
 | 4101 | 	u8 flags; | 
 | 4102 | 	u8 reserved[3]; | 
 | 4103 | 	struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4104 | } __packed; | 
| Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 4105 |  | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4106 | /* | 
 | 4107 |  * Coexistence MEDIUM NOTIFICATION | 
 | 4108 |  * COEX_MEDIUM_NOTIFICATION = 0x5b | 
 | 4109 |  * | 
 | 4110 |  * notification from uCode to host to indicate medium changes | 
 | 4111 |  * | 
 | 4112 |  */ | 
 | 4113 | /* | 
 | 4114 |  * status field | 
 | 4115 |  * bit 0 - 2: medium status | 
 | 4116 |  * bit 3: medium change indication | 
 | 4117 |  * bit 4 - 31: reserved | 
 | 4118 |  */ | 
 | 4119 | /* status option values, (0 - 2 bits) */ | 
 | 4120 | #define COEX_MEDIUM_BUSY	(0x0) /* radio belongs to WiMAX */ | 
 | 4121 | #define COEX_MEDIUM_ACTIVE	(0x1) /* radio belongs to WiFi */ | 
 | 4122 | #define COEX_MEDIUM_PRE_RELEASE	(0x2) /* received radio release */ | 
 | 4123 | #define COEX_MEDIUM_MSK		(0x7) | 
 | 4124 |  | 
 | 4125 | /* send notification status (1 bit) */ | 
 | 4126 | #define COEX_MEDIUM_CHANGED	(0x8) | 
 | 4127 | #define COEX_MEDIUM_CHANGED_MSK	(0x8) | 
 | 4128 | #define COEX_MEDIUM_SHIFT	(3) | 
 | 4129 |  | 
 | 4130 | struct iwl_coex_medium_notification { | 
 | 4131 | 	__le32 status; | 
 | 4132 | 	__le32 events; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4133 | } __packed; | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4134 |  | 
 | 4135 | /* | 
 | 4136 |  * Coexistence EVENT  Command | 
 | 4137 |  * COEX_EVENT_CMD = 0x5c | 
 | 4138 |  * | 
 | 4139 |  * send from host to uCode for coex event request. | 
 | 4140 |  */ | 
 | 4141 | /* flags options */ | 
 | 4142 | #define COEX_EVENT_REQUEST_MSK	(0x1) | 
 | 4143 |  | 
 | 4144 | struct iwl_coex_event_cmd { | 
 | 4145 | 	u8 flags; | 
 | 4146 | 	u8 event; | 
 | 4147 | 	__le16 reserved; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4148 | } __packed; | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4149 |  | 
 | 4150 | struct iwl_coex_event_resp { | 
 | 4151 | 	__le32 status; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4152 | } __packed; | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4153 |  | 
 | 4154 |  | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 4155 | /****************************************************************************** | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4156 |  * Bluetooth Coexistence commands | 
 | 4157 |  * | 
 | 4158 |  *****************************************************************************/ | 
 | 4159 |  | 
 | 4160 | /* | 
 | 4161 |  * BT Status notification | 
| Wey-Yi Guy | fbba941 | 2010-08-23 07:57:10 -0700 | [diff] [blame] | 4162 |  * REPLY_BT_COEX_PROFILE_NOTIF = 0xce | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4163 |  */ | 
 | 4164 | enum iwl_bt_coex_profile_traffic_load { | 
 | 4165 | 	IWL_BT_COEX_TRAFFIC_LOAD_NONE = 	0, | 
 | 4166 | 	IWL_BT_COEX_TRAFFIC_LOAD_LOW =		1, | 
 | 4167 | 	IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 	2, | 
 | 4168 | 	IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS =	3, | 
 | 4169 | /* | 
 | 4170 |  * There are no more even though below is a u8, the | 
 | 4171 |  * indication from the BT device only has two bits. | 
 | 4172 |  */ | 
 | 4173 | }; | 
 | 4174 |  | 
| Wey-Yi Guy | 6013270 | 2011-02-18 17:23:54 -0800 | [diff] [blame] | 4175 | #define BT_SESSION_ACTIVITY_1_UART_MSG		0x1 | 
 | 4176 | #define BT_SESSION_ACTIVITY_2_UART_MSG		0x2 | 
 | 4177 |  | 
| Wey-Yi Guy | d7220f0 | 2011-02-18 17:23:52 -0800 | [diff] [blame] | 4178 | /* BT UART message - Share Part (BT -> WiFi) */ | 
| Wey-Yi Guy | fbba941 | 2010-08-23 07:57:10 -0700 | [diff] [blame] | 4179 | #define BT_UART_MSG_FRAME1MSGTYPE_POS		(0) | 
 | 4180 | #define BT_UART_MSG_FRAME1MSGTYPE_MSK		\ | 
 | 4181 | 		(0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS) | 
 | 4182 | #define BT_UART_MSG_FRAME1SSN_POS		(3) | 
 | 4183 | #define BT_UART_MSG_FRAME1SSN_MSK		\ | 
 | 4184 | 		(0x3 << BT_UART_MSG_FRAME1SSN_POS) | 
 | 4185 | #define BT_UART_MSG_FRAME1UPDATEREQ_POS		(5) | 
 | 4186 | #define BT_UART_MSG_FRAME1UPDATEREQ_MSK		\ | 
 | 4187 | 		(0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS) | 
 | 4188 | #define BT_UART_MSG_FRAME1RESERVED_POS		(6) | 
 | 4189 | #define BT_UART_MSG_FRAME1RESERVED_MSK		\ | 
 | 4190 | 		(0x3 << BT_UART_MSG_FRAME1RESERVED_POS) | 
 | 4191 |  | 
 | 4192 | #define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS	(0) | 
 | 4193 | #define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK	\ | 
 | 4194 | 		(0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS) | 
 | 4195 | #define BT_UART_MSG_FRAME2TRAFFICLOAD_POS	(2) | 
 | 4196 | #define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK	\ | 
 | 4197 | 		(0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS) | 
 | 4198 | #define BT_UART_MSG_FRAME2CHLSEQN_POS		(4) | 
 | 4199 | #define BT_UART_MSG_FRAME2CHLSEQN_MSK		\ | 
 | 4200 | 		(0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS) | 
 | 4201 | #define BT_UART_MSG_FRAME2INBAND_POS		(5) | 
 | 4202 | #define BT_UART_MSG_FRAME2INBAND_MSK		\ | 
 | 4203 | 		(0x1 << BT_UART_MSG_FRAME2INBAND_POS) | 
 | 4204 | #define BT_UART_MSG_FRAME2RESERVED_POS		(6) | 
 | 4205 | #define BT_UART_MSG_FRAME2RESERVED_MSK		\ | 
 | 4206 | 		(0x3 << BT_UART_MSG_FRAME2RESERVED_POS) | 
 | 4207 |  | 
 | 4208 | #define BT_UART_MSG_FRAME3SCOESCO_POS		(0) | 
 | 4209 | #define BT_UART_MSG_FRAME3SCOESCO_MSK		\ | 
 | 4210 | 		(0x1 << BT_UART_MSG_FRAME3SCOESCO_POS) | 
 | 4211 | #define BT_UART_MSG_FRAME3SNIFF_POS		(1) | 
 | 4212 | #define BT_UART_MSG_FRAME3SNIFF_MSK		\ | 
 | 4213 | 		(0x1 << BT_UART_MSG_FRAME3SNIFF_POS) | 
 | 4214 | #define BT_UART_MSG_FRAME3A2DP_POS		(2) | 
 | 4215 | #define BT_UART_MSG_FRAME3A2DP_MSK		\ | 
 | 4216 | 		(0x1 << BT_UART_MSG_FRAME3A2DP_POS) | 
 | 4217 | #define BT_UART_MSG_FRAME3ACL_POS		(3) | 
 | 4218 | #define BT_UART_MSG_FRAME3ACL_MSK		\ | 
 | 4219 | 		(0x1 << BT_UART_MSG_FRAME3ACL_POS) | 
 | 4220 | #define BT_UART_MSG_FRAME3MASTER_POS		(4) | 
 | 4221 | #define BT_UART_MSG_FRAME3MASTER_MSK		\ | 
 | 4222 | 		(0x1 << BT_UART_MSG_FRAME3MASTER_POS) | 
 | 4223 | #define BT_UART_MSG_FRAME3OBEX_POS		(5) | 
 | 4224 | #define BT_UART_MSG_FRAME3OBEX_MSK		\ | 
 | 4225 | 		(0x1 << BT_UART_MSG_FRAME3OBEX_POS) | 
 | 4226 | #define BT_UART_MSG_FRAME3RESERVED_POS		(6) | 
 | 4227 | #define BT_UART_MSG_FRAME3RESERVED_MSK		\ | 
 | 4228 | 		(0x3 << BT_UART_MSG_FRAME3RESERVED_POS) | 
 | 4229 |  | 
 | 4230 | #define BT_UART_MSG_FRAME4IDLEDURATION_POS	(0) | 
 | 4231 | #define BT_UART_MSG_FRAME4IDLEDURATION_MSK	\ | 
 | 4232 | 		(0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS) | 
 | 4233 | #define BT_UART_MSG_FRAME4RESERVED_POS		(6) | 
 | 4234 | #define BT_UART_MSG_FRAME4RESERVED_MSK		\ | 
 | 4235 | 		(0x3 << BT_UART_MSG_FRAME4RESERVED_POS) | 
 | 4236 |  | 
 | 4237 | #define BT_UART_MSG_FRAME5TXACTIVITY_POS	(0) | 
 | 4238 | #define BT_UART_MSG_FRAME5TXACTIVITY_MSK	\ | 
 | 4239 | 		(0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS) | 
 | 4240 | #define BT_UART_MSG_FRAME5RXACTIVITY_POS	(2) | 
 | 4241 | #define BT_UART_MSG_FRAME5RXACTIVITY_MSK	\ | 
 | 4242 | 		(0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS) | 
 | 4243 | #define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS	(4) | 
 | 4244 | #define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK	\ | 
 | 4245 | 		(0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS) | 
 | 4246 | #define BT_UART_MSG_FRAME5RESERVED_POS		(6) | 
 | 4247 | #define BT_UART_MSG_FRAME5RESERVED_MSK		\ | 
 | 4248 | 		(0x3 << BT_UART_MSG_FRAME5RESERVED_POS) | 
 | 4249 |  | 
 | 4250 | #define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS	(0) | 
 | 4251 | #define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK	\ | 
 | 4252 | 		(0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS) | 
 | 4253 | #define BT_UART_MSG_FRAME6DISCOVERABLE_POS	(5) | 
 | 4254 | #define BT_UART_MSG_FRAME6DISCOVERABLE_MSK	\ | 
 | 4255 | 		(0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS) | 
 | 4256 | #define BT_UART_MSG_FRAME6RESERVED_POS		(6) | 
 | 4257 | #define BT_UART_MSG_FRAME6RESERVED_MSK		\ | 
 | 4258 | 		(0x3 << BT_UART_MSG_FRAME6RESERVED_POS) | 
 | 4259 |  | 
 | 4260 | #define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS	(0) | 
 | 4261 | #define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK	\ | 
 | 4262 | 		(0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS) | 
| Wey-Yi Guy | 399f66f | 2011-02-22 08:24:22 -0800 | [diff] [blame] | 4263 | #define BT_UART_MSG_FRAME7PAGE_POS		(3) | 
 | 4264 | #define BT_UART_MSG_FRAME7PAGE_MSK		\ | 
 | 4265 | 		(0x1 << BT_UART_MSG_FRAME7PAGE_POS) | 
 | 4266 | #define BT_UART_MSG_FRAME7INQUIRY_POS		(4) | 
 | 4267 | #define BT_UART_MSG_FRAME7INQUIRY_MSK		\ | 
 | 4268 | 		(0x1 << BT_UART_MSG_FRAME7INQUIRY_POS) | 
| Wey-Yi Guy | fbba941 | 2010-08-23 07:57:10 -0700 | [diff] [blame] | 4269 | #define BT_UART_MSG_FRAME7CONNECTABLE_POS	(5) | 
 | 4270 | #define BT_UART_MSG_FRAME7CONNECTABLE_MSK	\ | 
 | 4271 | 		(0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS) | 
 | 4272 | #define BT_UART_MSG_FRAME7RESERVED_POS		(6) | 
 | 4273 | #define BT_UART_MSG_FRAME7RESERVED_MSK		\ | 
 | 4274 | 		(0x3 << BT_UART_MSG_FRAME7RESERVED_POS) | 
 | 4275 |  | 
| Wey-Yi Guy | d7220f0 | 2011-02-18 17:23:52 -0800 | [diff] [blame] | 4276 | /* BT Session Activity 2 UART message (BT -> WiFi) */ | 
 | 4277 | #define BT_UART_MSG_2_FRAME1RESERVED1_POS	(5) | 
 | 4278 | #define BT_UART_MSG_2_FRAME1RESERVED1_MSK	\ | 
 | 4279 | 		(0x1<<BT_UART_MSG_2_FRAME1RESERVED1_POS) | 
 | 4280 | #define BT_UART_MSG_2_FRAME1RESERVED2_POS	(6) | 
 | 4281 | #define BT_UART_MSG_2_FRAME1RESERVED2_MSK	\ | 
 | 4282 | 		(0x3<<BT_UART_MSG_2_FRAME1RESERVED2_POS) | 
 | 4283 |  | 
 | 4284 | #define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS	(0) | 
 | 4285 | #define BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_MSK	\ | 
 | 4286 | 		(0x3F<<BT_UART_MSG_2_FRAME2AGGTRAFFICLOAD_POS) | 
 | 4287 | #define BT_UART_MSG_2_FRAME2RESERVED_POS	(6) | 
 | 4288 | #define BT_UART_MSG_2_FRAME2RESERVED_MSK	\ | 
 | 4289 | 		(0x3<<BT_UART_MSG_2_FRAME2RESERVED_POS) | 
 | 4290 |  | 
 | 4291 | #define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS	(0) | 
 | 4292 | #define BT_UART_MSG_2_FRAME3BRLASTTXPOWER_MSK	\ | 
 | 4293 | 		(0xF<<BT_UART_MSG_2_FRAME3BRLASTTXPOWER_POS) | 
 | 4294 | #define BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS	(4) | 
 | 4295 | #define BT_UART_MSG_2_FRAME3INQPAGESRMODE_MSK	\ | 
 | 4296 | 		(0x1<<BT_UART_MSG_2_FRAME3INQPAGESRMODE_POS) | 
 | 4297 | #define BT_UART_MSG_2_FRAME3LEMASTER_POS	(5) | 
 | 4298 | #define BT_UART_MSG_2_FRAME3LEMASTER_MSK	\ | 
 | 4299 | 		(0x1<<BT_UART_MSG_2_FRAME3LEMASTER_POS) | 
 | 4300 | #define BT_UART_MSG_2_FRAME3RESERVED_POS	(6) | 
 | 4301 | #define BT_UART_MSG_2_FRAME3RESERVED_MSK	\ | 
 | 4302 | 		(0x3<<BT_UART_MSG_2_FRAME3RESERVED_POS) | 
 | 4303 |  | 
 | 4304 | #define BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS	(0) | 
 | 4305 | #define BT_UART_MSG_2_FRAME4LELASTTXPOWER_MSK	\ | 
 | 4306 | 		(0xF<<BT_UART_MSG_2_FRAME4LELASTTXPOWER_POS) | 
 | 4307 | #define BT_UART_MSG_2_FRAME4NUMLECONN_POS	(4) | 
 | 4308 | #define BT_UART_MSG_2_FRAME4NUMLECONN_MSK	\ | 
 | 4309 | 		(0x3<<BT_UART_MSG_2_FRAME4NUMLECONN_POS) | 
 | 4310 | #define BT_UART_MSG_2_FRAME4RESERVED_POS	(6) | 
 | 4311 | #define BT_UART_MSG_2_FRAME4RESERVED_MSK	\ | 
 | 4312 | 		(0x3<<BT_UART_MSG_2_FRAME4RESERVED_POS) | 
 | 4313 |  | 
 | 4314 | #define BT_UART_MSG_2_FRAME5BTMINRSSI_POS	(0) | 
 | 4315 | #define BT_UART_MSG_2_FRAME5BTMINRSSI_MSK	\ | 
 | 4316 | 		(0xF<<BT_UART_MSG_2_FRAME5BTMINRSSI_POS) | 
 | 4317 | #define BT_UART_MSG_2_FRAME5LESCANINITMODE_POS	(4) | 
 | 4318 | #define BT_UART_MSG_2_FRAME5LESCANINITMODE_MSK	\ | 
 | 4319 | 		(0x1<<BT_UART_MSG_2_FRAME5LESCANINITMODE_POS) | 
 | 4320 | #define BT_UART_MSG_2_FRAME5LEADVERMODE_POS	(5) | 
 | 4321 | #define BT_UART_MSG_2_FRAME5LEADVERMODE_MSK	\ | 
 | 4322 | 		(0x1<<BT_UART_MSG_2_FRAME5LEADVERMODE_POS) | 
 | 4323 | #define BT_UART_MSG_2_FRAME5RESERVED_POS	(6) | 
 | 4324 | #define BT_UART_MSG_2_FRAME5RESERVED_MSK	\ | 
 | 4325 | 		(0x3<<BT_UART_MSG_2_FRAME5RESERVED_POS) | 
 | 4326 |  | 
 | 4327 | #define BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS	(0) | 
 | 4328 | #define BT_UART_MSG_2_FRAME6LECONNINTERVAL_MSK	\ | 
 | 4329 | 		(0x1F<<BT_UART_MSG_2_FRAME6LECONNINTERVAL_POS) | 
 | 4330 | #define BT_UART_MSG_2_FRAME6RFU_POS		(5) | 
 | 4331 | #define BT_UART_MSG_2_FRAME6RFU_MSK		\ | 
 | 4332 | 		(0x1<<BT_UART_MSG_2_FRAME6RFU_POS) | 
 | 4333 | #define BT_UART_MSG_2_FRAME6RESERVED_POS	(6) | 
 | 4334 | #define BT_UART_MSG_2_FRAME6RESERVED_MSK	\ | 
 | 4335 | 		(0x3<<BT_UART_MSG_2_FRAME6RESERVED_POS) | 
 | 4336 |  | 
 | 4337 | #define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS	(0) | 
 | 4338 | #define BT_UART_MSG_2_FRAME7LECONNSLAVELAT_MSK	\ | 
 | 4339 | 		(0x7<<BT_UART_MSG_2_FRAME7LECONNSLAVELAT_POS) | 
 | 4340 | #define BT_UART_MSG_2_FRAME7LEPROFILE1_POS	(3) | 
 | 4341 | #define BT_UART_MSG_2_FRAME7LEPROFILE1_MSK	\ | 
 | 4342 | 		(0x1<<BT_UART_MSG_2_FRAME7LEPROFILE1_POS) | 
 | 4343 | #define BT_UART_MSG_2_FRAME7LEPROFILE2_POS	(4) | 
 | 4344 | #define BT_UART_MSG_2_FRAME7LEPROFILE2_MSK	\ | 
 | 4345 | 		(0x1<<BT_UART_MSG_2_FRAME7LEPROFILE2_POS) | 
 | 4346 | #define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS	(5) | 
 | 4347 | #define BT_UART_MSG_2_FRAME7LEPROFILEOTHER_MSK	\ | 
 | 4348 | 		(0x1<<BT_UART_MSG_2_FRAME7LEPROFILEOTHER_POS) | 
 | 4349 | #define BT_UART_MSG_2_FRAME7RESERVED_POS	(6) | 
 | 4350 | #define BT_UART_MSG_2_FRAME7RESERVED_MSK	\ | 
 | 4351 | 		(0x3<<BT_UART_MSG_2_FRAME7RESERVED_POS) | 
 | 4352 |  | 
| Wey-Yi Guy | fbba941 | 2010-08-23 07:57:10 -0700 | [diff] [blame] | 4353 |  | 
 | 4354 | struct iwl_bt_uart_msg { | 
 | 4355 | 	u8 header; | 
 | 4356 | 	u8 frame1; | 
 | 4357 | 	u8 frame2; | 
 | 4358 | 	u8 frame3; | 
 | 4359 | 	u8 frame4; | 
 | 4360 | 	u8 frame5; | 
 | 4361 | 	u8 frame6; | 
 | 4362 | 	u8 frame7; | 
 | 4363 | } __attribute__((packed)); | 
 | 4364 |  | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4365 | struct iwl_bt_coex_profile_notif { | 
| Wey-Yi Guy | fbba941 | 2010-08-23 07:57:10 -0700 | [diff] [blame] | 4366 | 	struct iwl_bt_uart_msg last_bt_uart_msg; | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4367 | 	u8 bt_status; /* 0 - off, 1 - on */ | 
 | 4368 | 	u8 bt_traffic_load; /* 0 .. 3? */ | 
 | 4369 | 	u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */ | 
 | 4370 | 	u8 reserved; | 
 | 4371 | } __attribute__((packed)); | 
 | 4372 |  | 
| Wey-Yi Guy | aeb4a2e | 2010-08-23 07:57:05 -0700 | [diff] [blame] | 4373 | #define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS	0 | 
 | 4374 | #define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_MSK	0x1 | 
 | 4375 | #define IWL_BT_COEX_PRIO_TBL_PRIO_POS		1 | 
 | 4376 | #define IWL_BT_COEX_PRIO_TBL_PRIO_MASK		0x0e | 
 | 4377 | #define IWL_BT_COEX_PRIO_TBL_RESERVED_POS	4 | 
 | 4378 | #define IWL_BT_COEX_PRIO_TBL_RESERVED_MASK	0xf0 | 
 | 4379 | #define IWL_BT_COEX_PRIO_TBL_PRIO_SHIFT		1 | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4380 |  | 
 | 4381 | /* | 
 | 4382 |  * BT Coexistence Priority table | 
 | 4383 |  * REPLY_BT_COEX_PRIO_TABLE = 0xcc | 
 | 4384 |  */ | 
| Wey-Yi Guy | aeb4a2e | 2010-08-23 07:57:05 -0700 | [diff] [blame] | 4385 | enum bt_coex_prio_table_events { | 
 | 4386 | 	BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, | 
 | 4387 | 	BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, | 
 | 4388 | 	BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, | 
 | 4389 | 	BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, /* DC calib */ | 
 | 4390 | 	BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, | 
 | 4391 | 	BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, | 
 | 4392 | 	BT_COEX_PRIO_TBL_EVT_DTIM = 6, | 
 | 4393 | 	BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, | 
 | 4394 | 	BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, | 
 | 4395 | 	BT_COEX_PRIO_TBL_EVT_RESERVED0 = 9, | 
 | 4396 | 	BT_COEX_PRIO_TBL_EVT_RESERVED1 = 10, | 
 | 4397 | 	BT_COEX_PRIO_TBL_EVT_RESERVED2 = 11, | 
 | 4398 | 	BT_COEX_PRIO_TBL_EVT_RESERVED3 = 12, | 
 | 4399 | 	BT_COEX_PRIO_TBL_EVT_RESERVED4 = 13, | 
 | 4400 | 	BT_COEX_PRIO_TBL_EVT_RESERVED5 = 14, | 
 | 4401 | 	BT_COEX_PRIO_TBL_EVT_RESERVED6 = 15, | 
 | 4402 | 	/* BT_COEX_PRIO_TBL_EVT_MAX should always be last */ | 
 | 4403 | 	BT_COEX_PRIO_TBL_EVT_MAX, | 
 | 4404 | }; | 
 | 4405 |  | 
 | 4406 | enum bt_coex_prio_table_priorities { | 
 | 4407 | 	BT_COEX_PRIO_TBL_DISABLED = 0, | 
 | 4408 | 	BT_COEX_PRIO_TBL_PRIO_LOW = 1, | 
 | 4409 | 	BT_COEX_PRIO_TBL_PRIO_HIGH = 2, | 
 | 4410 | 	BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, | 
 | 4411 | 	BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, | 
 | 4412 | 	BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, | 
 | 4413 | 	BT_COEX_PRIO_TBL_PRIO_RSRVD1 = 6, | 
 | 4414 | 	BT_COEX_PRIO_TBL_PRIO_RSRVD2 = 7, | 
 | 4415 | 	BT_COEX_PRIO_TBL_MAX, | 
 | 4416 | }; | 
 | 4417 |  | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4418 | struct iwl_bt_coex_prio_table_cmd { | 
| Wey-Yi Guy | aeb4a2e | 2010-08-23 07:57:05 -0700 | [diff] [blame] | 4419 | 	u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4420 | } __attribute__((packed)); | 
 | 4421 |  | 
| Wey-Yi Guy | aeb4a2e | 2010-08-23 07:57:05 -0700 | [diff] [blame] | 4422 | #define IWL_BT_COEX_ENV_CLOSE	0 | 
 | 4423 | #define IWL_BT_COEX_ENV_OPEN	1 | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4424 | /* | 
 | 4425 |  * BT Protection Envelope | 
 | 4426 |  * REPLY_BT_COEX_PROT_ENV = 0xcd | 
 | 4427 |  */ | 
 | 4428 | struct iwl_bt_coex_prot_env_cmd { | 
| Wey-Yi Guy | aeb4a2e | 2010-08-23 07:57:05 -0700 | [diff] [blame] | 4429 | 	u8 action; /* 0 = closed, 1 = open */ | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4430 | 	u8 type; /* 0 .. 15 */ | 
 | 4431 | 	u8 reserved[2]; | 
 | 4432 | } __attribute__((packed)); | 
 | 4433 |  | 
 | 4434 | /****************************************************************************** | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 4435 |  * (13) | 
 | 4436 |  * Union of all expected notifications/responses: | 
 | 4437 |  * | 
 | 4438 |  *****************************************************************************/ | 
 | 4439 |  | 
| Tomas Winkler | db11d63 | 2008-05-05 10:22:33 +0800 | [diff] [blame] | 4440 | struct iwl_rx_packet { | 
| Zhu Yi | 2f30122 | 2009-10-09 17:19:45 +0800 | [diff] [blame] | 4441 | 	/* | 
 | 4442 | 	 * The first 4 bytes of the RX frame header contain both the RX frame | 
 | 4443 | 	 * size and some flags. | 
 | 4444 | 	 * Bit fields: | 
 | 4445 | 	 * 31:    flag flush RB request | 
 | 4446 | 	 * 30:    flag ignore TC (terminal counter) request | 
 | 4447 | 	 * 29:    flag fast IRQ request | 
 | 4448 | 	 * 28-14: Reserved | 
 | 4449 | 	 * 13-00: RX frame size | 
 | 4450 | 	 */ | 
| Daniel C Halperin | 396887a | 2009-08-13 13:31:01 -0700 | [diff] [blame] | 4451 | 	__le32 len_n_flags; | 
| Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 4452 | 	struct iwl_cmd_header hdr; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 4453 | 	union { | 
| Tomas Winkler | 3d24a9f | 2008-12-19 10:37:07 +0800 | [diff] [blame] | 4454 | 		struct iwl3945_rx_frame rx_frame; | 
 | 4455 | 		struct iwl3945_tx_resp tx_resp; | 
 | 4456 | 		struct iwl3945_beacon_notif beacon_status; | 
 | 4457 |  | 
| Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 4458 | 		struct iwl_alive_resp alive_frame; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 4459 | 		struct iwl_spectrum_notification spectrum_notif; | 
 | 4460 | 		struct iwl_csa_notification csa_notif; | 
| Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 4461 | 		struct iwl_error_resp err_resp; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 4462 | 		struct iwl_card_state_notif card_state_notif; | 
| Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 4463 | 		struct iwl_add_sta_resp add_sta; | 
 | 4464 | 		struct iwl_rem_sta_resp rem_sta; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 4465 | 		struct iwl_sleep_notification sleep_notif; | 
 | 4466 | 		struct iwl_spectrum_resp spectrum; | 
| Emmanuel Grumbach | 8f91aec | 2008-06-30 17:23:07 +0800 | [diff] [blame] | 4467 | 		struct iwl_notif_statistics stats; | 
| Wey-Yi Guy | 7980fba | 2010-07-14 08:08:57 -0700 | [diff] [blame] | 4468 | 		struct iwl_bt_notif_statistics stats_bt; | 
| Emmanuel Grumbach | 653fa4a | 2008-06-30 17:23:11 +0800 | [diff] [blame] | 4469 | 		struct iwl_compressed_ba_resp compressed_ba; | 
| Tomas Winkler | 2aa6ab8 | 2008-12-11 10:33:40 -0800 | [diff] [blame] | 4470 | 		struct iwl_missed_beacon_notif missed_beacon; | 
| Wey-Yi Guy | fe1bcbf | 2009-10-30 14:36:16 -0700 | [diff] [blame] | 4471 | 		struct iwl_coex_medium_notification coex_medium_notif; | 
 | 4472 | 		struct iwl_coex_event_resp coex_event; | 
| Johannes Berg | 0288d23 | 2010-08-23 07:56:54 -0700 | [diff] [blame] | 4473 | 		struct iwl_bt_coex_profile_notif bt_coex_profile_notif; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 4474 | 		__le32 status; | 
 | 4475 | 		u8 raw[0]; | 
 | 4476 | 	} u; | 
| Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 4477 | } __packed; | 
| Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 4478 |  | 
| Samuel Ortiz | a3139c5 | 2008-12-19 10:37:09 +0800 | [diff] [blame] | 4479 | int iwl_agn_check_rxon_cmd(struct iwl_priv *priv); | 
| Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 4480 |  | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 4481 | /* | 
 | 4482 |  * REPLY_WIPAN_PARAMS = 0xb2 (Commands and Notification) | 
 | 4483 |  */ | 
 | 4484 |  | 
| Johannes Berg | 9407391 | 2011-01-06 08:07:11 -0800 | [diff] [blame] | 4485 | /* | 
 | 4486 |  * Minimum slot time in TU | 
 | 4487 |  */ | 
 | 4488 | #define IWL_MIN_SLOT_TIME	20 | 
 | 4489 |  | 
| Johannes Berg | 946ba30 | 2010-08-23 10:46:48 +0200 | [diff] [blame] | 4490 | /** | 
 | 4491 |  * struct iwl_wipan_slot | 
 | 4492 |  * @width: Time in TU | 
 | 4493 |  * @type: | 
 | 4494 |  *   0 - BSS | 
 | 4495 |  *   1 - PAN | 
 | 4496 |  */ | 
 | 4497 | struct iwl_wipan_slot { | 
 | 4498 | 	__le16 width; | 
 | 4499 | 	u8 type; | 
 | 4500 | 	u8 reserved; | 
 | 4501 | } __packed; | 
 | 4502 |  | 
 | 4503 | #define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_CTS		BIT(1)	/* reserved */ | 
 | 4504 | #define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_QUIET	BIT(2)	/* reserved */ | 
 | 4505 | #define IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE		BIT(3)	/* reserved */ | 
 | 4506 | #define IWL_WIPAN_PARAMS_FLG_FILTER_BEACON_NOTIF	BIT(4) | 
 | 4507 | #define IWL_WIPAN_PARAMS_FLG_FULL_SLOTTED_MODE		BIT(5) | 
 | 4508 |  | 
 | 4509 | /** | 
 | 4510 |  * struct iwl_wipan_params_cmd | 
 | 4511 |  * @flags: | 
 | 4512 |  *   bit0: reserved | 
 | 4513 |  *   bit1: CP leave channel with CTS | 
 | 4514 |  *   bit2: CP leave channel qith Quiet | 
 | 4515 |  *   bit3: slotted mode | 
 | 4516 |  *     1 - work in slotted mode | 
 | 4517 |  *     0 - work in non slotted mode | 
 | 4518 |  *   bit4: filter beacon notification | 
 | 4519 |  *   bit5: full tx slotted mode. if this flag is set, | 
 | 4520 |  *         uCode will perform leaving channel methods in context switch | 
 | 4521 |  *         also when working in same channel mode | 
 | 4522 |  * @num_slots: 1 - 10 | 
 | 4523 |  */ | 
 | 4524 | struct iwl_wipan_params_cmd { | 
 | 4525 | 	__le16 flags; | 
 | 4526 | 	u8 reserved; | 
 | 4527 | 	u8 num_slots; | 
 | 4528 | 	struct iwl_wipan_slot slots[10]; | 
 | 4529 | } __packed; | 
 | 4530 |  | 
 | 4531 | /* | 
 | 4532 |  * REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9 | 
 | 4533 |  * | 
 | 4534 |  * TODO: Figure out what this is used for, | 
 | 4535 |  *	 it can only switch between 2.4 GHz | 
 | 4536 |  *	 channels!! | 
 | 4537 |  */ | 
 | 4538 |  | 
 | 4539 | struct iwl_wipan_p2p_channel_switch_cmd { | 
 | 4540 | 	__le16 channel; | 
 | 4541 | 	__le16 reserved; | 
 | 4542 | }; | 
 | 4543 |  | 
 | 4544 | /* | 
 | 4545 |  * REPLY_WIPAN_NOA_NOTIFICATION = 0xbc | 
 | 4546 |  * | 
 | 4547 |  * This is used by the device to notify us of the | 
 | 4548 |  * NoA schedule it determined so we can forward it | 
 | 4549 |  * to userspace for inclusion in probe responses. | 
 | 4550 |  * | 
 | 4551 |  * In beacons, the NoA schedule is simply appended | 
 | 4552 |  * to the frame we give the device. | 
 | 4553 |  */ | 
 | 4554 |  | 
 | 4555 | struct iwl_wipan_noa_descriptor { | 
 | 4556 | 	u8 count; | 
 | 4557 | 	__le32 duration; | 
 | 4558 | 	__le32 interval; | 
 | 4559 | 	__le32 starttime; | 
 | 4560 | } __packed; | 
 | 4561 |  | 
 | 4562 | struct iwl_wipan_noa_attribute { | 
 | 4563 | 	u8 id; | 
 | 4564 | 	__le16 length; | 
 | 4565 | 	u8 index; | 
 | 4566 | 	u8 ct_window; | 
 | 4567 | 	struct iwl_wipan_noa_descriptor descr0, descr1; | 
 | 4568 | 	u8 reserved; | 
 | 4569 | } __packed; | 
 | 4570 |  | 
 | 4571 | struct iwl_wipan_noa_notification { | 
 | 4572 | 	u32 noa_active; | 
 | 4573 | 	struct iwl_wipan_noa_attribute noa_attribute; | 
 | 4574 | } __packed; | 
 | 4575 |  | 
| Emmanuel Grumbach | 6a63578 | 2008-10-29 14:05:47 -0700 | [diff] [blame] | 4576 | #endif				/* __iwl_commands_h__ */ |