iwl-commands.h revision 470356b891f1d18e87d5fdc393976fab6d0a978d
1b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This file is provided under a dual BSD/GPLv2 license.  When using or
4b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * redistributing this file, you may do so under either license.
5b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
6b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * GPL LICENSE SUMMARY
7b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
81f44780827c6bbbcd1f12d5c6b6ce84f49a96bc0Reinette Chatre * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
9b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
10b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This program is free software; you can redistribute it and/or modify
1101ebd063e11bdcf1ddc605d968ea89aef48e34e0Ian Schram * it under the terms of version 2 of the GNU General Public License as
12b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * published by the Free Software Foundation.
13b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
14b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This program is distributed in the hope that it will be useful, but
15b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * WITHOUT ANY WARRANTY; without even the implied warranty of
16b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * General Public License for more details.
18b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
19b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * You should have received a copy of the GNU General Public License
20b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * along with this program; if not, write to the Free Software
21b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * USA
23b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
24b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * The full GNU General Public License is included in this distribution
25b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * in the file called LICENSE.GPL.
26b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
27b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Contact Information:
28759ef89fb096c4a6ef078d3cfd5682ac037bd789Winkler, Tomas *  Intel Linux Wireless <ilw@linux.intel.com>
29b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
31b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * BSD LICENSE
32b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
331f44780827c6bbbcd1f12d5c6b6ce84f49a96bc0Reinette Chatre * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
34b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * All rights reserved.
35b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
36b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Redistribution and use in source and binary forms, with or without
37b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * modification, are permitted provided that the following conditions
38b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * are met:
39b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
40b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *  * Redistributions of source code must retain the above copyright
41b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    notice, this list of conditions and the following disclaimer.
42b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *  * Redistributions in binary form must reproduce the above copyright
43b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    notice, this list of conditions and the following disclaimer in
44b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    the documentation and/or other materials provided with the
45b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    distribution.
46b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *  * Neither the name Intel Corporation nor the names of its
47b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    contributors may be used to endorse or promote products derived
48b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *    from this software without specific prior written permission.
49b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
50b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
62b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
63fcd427bbba10fc315d1c958b85bba74448db4eb4Ben M Cahill/*
645a36ba0e412a0e12a8bf2648a075226c1dd7870dTomas Winkler * Please use this file (iwl-commands.h) only for uCode API definitions.
65fcd427bbba10fc315d1c958b85bba74448db4eb4Ben M Cahill * Please use iwl-4965-hw.h for hardware-related definitions.
663e0d4cb12f6fd97193a455b49125398b2231c87cTomas Winkler * Please use iwl-dev.h for driver implementation definitions.
67fcd427bbba10fc315d1c958b85bba74448db4eb4Ben M Cahill */
68b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
696a63578ddf6148927a80c07a73b40ccc8f3ac8e2Emmanuel Grumbach#ifndef __iwl_commands_h__
706a63578ddf6148927a80c07a73b40ccc8f3ac8e2Emmanuel Grumbach#define __iwl_commands_h__
71b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
72a3139c5956702c9ff957ac9fe2d902de355b063eSamuel Ortizstruct iwl_priv;
73a3139c5956702c9ff957ac9fe2d902de355b063eSamuel Ortiz
74c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette/* uCode version contains 4 values: Major/Minor/API/Serial */
75c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_MAJOR(ver)	(((ver) & 0xFF000000) >> 24)
76c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_MINOR(ver)	(((ver) & 0x00FF0000) >> 16)
77c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_API(ver)	(((ver) & 0x0000FF00) >> 8)
78c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_SERIAL(ver)	((ver) & 0x000000FF)
79c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette
804c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler
814c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler/* Tx rates */
824c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_CCK_RATES	4
834c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_OFDM_RATES	8
844c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_MAX_RATES	(IWL_CCK_RATES + IWL_OFDM_RATES)
854c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler
86b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
87b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_ALIVE = 0x1,
88b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_ERROR = 0x2,
89b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
90b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* RXON and QOS commands */
91b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RXON = 0x10,
92b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RXON_ASSOC = 0x11,
93b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_QOS_PARAM = 0x13,
94b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RXON_TIMING = 0x14,
95b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
96b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* Multi-Station support */
97b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_ADD_STA = 0x18,
98b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_REMOVE_STA = 0x19,	/* not used */
99b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_REMOVE_ALL_STA = 0x1a,	/* not used */
100b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1010a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	/* Security */
1020a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	REPLY_WEPKEY = 0x20,
1030a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach
104b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* RX, TX, LEDs */
1052aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	REPLY_3945_RX = 0x1b,           /* 3945 only */
106b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_TX = 0x1c,
107b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RATE_SCALE = 0x47,	/* 3945 only */
108b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_LEDS_CMD = 0x48,
1094c8d1913ac1baab64080c1030cb94e24cbd9a0f8Wey-Yi Guy	REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */
110b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1119636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	/* WiMAX coexistence */
112d23000cd8992823e06ca0745564f2c25fe923ce4Wey-Yi Guy	COEX_PRIORITY_TABLE_CMD = 0x5a,	/* for 5000 series and up */
1139636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_MEDIUM_NOTIFICATION = 0x5b,
1149636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_EVENT_CMD = 0x5c,
1159636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
116be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler	/* Calibration */
1171a5c3d61993f56daf15c35bea8d3943f4e835638Jay Sternberg	TEMPERATURE_NOTIFICATION = 0x62,
118be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler	CALIBRATION_CFG_CMD = 0x65,
119be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler	CALIBRATION_RES_NOTIFICATION = 0x66,
120be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler	CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
121be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler
122b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* 802.11h related */
123b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_QUIET_CMD = 0x71,		/* not used */
124b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_CHANNEL_SWITCH = 0x72,
125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	CHANNEL_SWITCH_NOTIFICATION = 0x73,
126b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
127b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	SPECTRUM_MEASURE_NOTIFICATION = 0x75,
128b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* Power Management */
130b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	POWER_TABLE_CMD = 0x77,
131b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	PM_SLEEP_NOTIFICATION = 0x7A,
132b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
133b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
134b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* Scan commands and notifications */
135b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_SCAN_CMD = 0x80,
136b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_SCAN_ABORT_CMD = 0x81,
137b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	SCAN_START_NOTIFICATION = 0x82,
138b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	SCAN_RESULTS_NOTIFICATION = 0x83,
139b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	SCAN_COMPLETE_NOTIFICATION = 0x84,
140b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
141b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* IBSS/AP commands */
142b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	BEACON_NOTIFICATION = 0x90,
143b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_TX_BEACON = 0x91,
144b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	WHO_IS_AWAKE_NOTIFICATION = 0x94,	/* not used */
145b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
146b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* Miscellaneous commands */
14776a2407a5b043d0950d5657184118e89860d545cJay Sternberg	REPLY_TX_POWER_DBM_CMD = 0x95,
148b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	QUIET_NOTIFICATION = 0x96,		/* not used */
149b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_TX_PWR_TABLE_CMD = 0x97,
15076a2407a5b043d0950d5657184118e89860d545cJay Sternberg	REPLY_TX_POWER_DBM_CMD_V1 = 0x98,	/* old version of API */
1512f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy	TX_ANT_CONFIGURATION_CMD = 0x98,
152b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	MEASURE_ABORT_NOTIFICATION = 0x99,	/* not used */
153b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
154a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler	/* Bluetooth device coexistence config command */
155b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_BT_CONFIG = 0x9b,
156b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
15780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	/* Statistics */
158b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_STATISTICS_CMD = 0x9c,
159b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	STATISTICS_NOTIFICATION = 0x9d,
160b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
161b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* RF-KILL commands and notifications */
162b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_CARD_STATE_CMD = 0xa0,
163b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	CARD_STATE_NOTIFICATION = 0xa1,
164b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
165b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* Missed beacons notification */
166b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	MISSED_BEACONS_NOTIFICATION = 0xa2,
167b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
168b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_CT_KILL_CONFIG_CMD = 0xa4,
169b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	SENSITIVITY_CMD = 0xa8,
170b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_PHY_CALIBRATION_CMD = 0xb0,
171b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RX_PHY_CMD = 0xc0,
172b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_RX_MPDU_CMD = 0xc1,
173857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler	REPLY_RX = 0xc3,
174b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_COMPRESSED_BA = 0xc5,
175b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	REPLY_MAX = 0xff
176b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
177b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
178b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
179b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (0)
180abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Commonly used structures and definitions:
18180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Command header, rate_n_flags, txpower
182b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
183b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
184b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
185857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler/* iwl_cmd_header flags value */
186b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_CMD_FAILED_MSK 0x40
187b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1889734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define SEQ_TO_QUEUE(s)	(((s) >> 8) & 0x1f)
1899734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define QUEUE_TO_SEQ(q)	(((q) & 0x1f) << 8)
1909734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define SEQ_TO_INDEX(s)	((s) & 0xff)
1919734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define INDEX_TO_SEQ(i)	((i) & 0xff)
19251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SEQ_HUGE_FRAME	cpu_to_le16(0x4000)
19351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SEQ_RX_FRAME	cpu_to_le16(0x8000)
1949734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler
195075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/**
196857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler * struct iwl_cmd_header
197075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
198075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * This header format appears in the beginning of each command sent from the
199075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * driver, and each response/notification received from uCode.
200075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill */
201857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winklerstruct iwl_cmd_header {
202075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	u8 cmd;		/* Command ID:  REPLY_RXON, etc. */
2039734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	u8 flags;	/* 0:5 reserved, 6 abort, 7 internal */
204075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	/*
205a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler	 * The driver sets up the sequence number to values of its choosing.
206075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * uCode does not use this value, but passes it back to the driver
207075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * when sending the response to each driver-originated command, so
208075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * the driver can match the response to the command.  Since the values
209075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * don't get used by uCode, the driver may set up an arbitrary format.
210b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 *
211075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * There is one exception:  uCode sets bit 15 when it originates
212075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * the response/notification, i.e. when the response/notification
213075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * is not a direct response to a command sent by the driver.  For
214075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * example, uCode issues REPLY_3945_RX when it sends a received frame
215075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * to the driver; it is not a direct response to any driver command.
216b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 *
217075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 * The Linux driver uses the following format:
218075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	 *
2199734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  0:7		tfd index - position within TX queue
2209734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  8:12	TX queue id
2219734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  13		reserved
2229734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  14		huge - driver sets this to indicate command is in the
2239734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  		'huge' storage at the end of the command buffers
2249734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler	 *  15		unsolicited RX or uCode-originated notification
225b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 */
226b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 sequence;
227b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
228075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	/* command or response/notification data follows immediately */
229b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 data[0];
230b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
231b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2323d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
2333d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/**
2343d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * struct iwl3945_tx_power
2353d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
2363d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
2373d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
2383d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * Each entry contains two values:
2393d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained
2403d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *     linear value that multiplies the output of the digital signal processor,
2413d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *     before being sent to the analog radio.
2423d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * 2)  Radio gain.  This sets the analog gain of the radio Tx path.
2433d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *     It is a coarser setting, and behaves in a logarithmic (dB) fashion.
2443d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
2453d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
2463d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
2473d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_tx_power {
2483d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 tx_gain;		/* gain for analog radio */
2493d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 dsp_atten;		/* gain for DSP */
2503d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
2513d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
2523d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/**
2533d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * struct iwl3945_power_per_rate
2543d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
2553d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
2563d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
2573d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_power_per_rate {
2583d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rate;		/* plcp */
2593d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_tx_power tpc;
2603d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved;
2613d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
2623d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
263abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill/**
2645c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * iwlagn rate_n_flags bit fields
265abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
2665c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * rate_n_flags format is used in following iwlagn commands:
267857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler *  REPLY_RX (response only)
2685c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C *  REPLY_RX_MPDU (response only)
269abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *  REPLY_TX (both command and response)
270abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *  REPLY_TX_LINK_QUALITY_CMD
271abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
272abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
273abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *  2-0:  0)   6 Mbps
274abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        1)  12 Mbps
275abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        2)  18 Mbps
276abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        3)  24 Mbps
277abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        4)  36 Mbps
278abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        5)  48 Mbps
279abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        6)  54 Mbps
280abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        7)  60 Mbps
281abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
2825c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C *  4-3:  0)  Single stream (SISO)
283abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        1)  Dual stream (MIMO)
2845c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C *        2)  Triple stream (MIMO)
285abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
2867aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy *    5:  Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
287abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
288abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
289abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *  3-0:  0xD)   6 Mbps
290abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0xF)   9 Mbps
291abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0x5)  12 Mbps
292abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0x7)  18 Mbps
293abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0x9)  24 Mbps
294abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0xB)  36 Mbps
295abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0x1)  48 Mbps
296abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        0x3)  54 Mbps
297abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *
298abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
2991061787967db03975dc02030d6815811f4eb9231Daniel Wu *  6-0:   10)  1 Mbps
300abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *         20)  2 Mbps
301abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *         55)  5.5 Mbps
302abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill *        110)  11 Mbps
303abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill */
304abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CODE_MSK 0x7
3055c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C#define RATE_MCS_SPATIAL_POS 3
3065c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C#define RATE_MCS_SPATIAL_MSK 0x18
307abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_DUP_POS 5
308abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_DUP_MSK 0x20
309abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
310075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
311abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_FLAGS_POS 8
312abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_POS 8
313abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_MSK 0x100
314abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
315075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 9: (1) CCK, (0) OFDM.  HT (bit 8) must be "0" for this bit to be valid */
316abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CCK_POS 9
317abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CCK_MSK 0x200
318abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
319075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 10: (1) Use Green Field preamble */
320abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_GF_POS 10
321abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_GF_MSK 0x400
322abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
3237aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
3247aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy#define RATE_MCS_HT40_POS 11
3257aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy#define RATE_MCS_HT40_MSK 0x800
326abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
3277aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
328abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_DUP_POS 12
329abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_DUP_MSK 0x1000
330abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
331075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
332abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_SGI_POS 13
333abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_SGI_MSK 0x2000
334abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill
335abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill/**
33676eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * rate_n_flags Tx antenna masks
33776eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 4965 has 2 transmitters
33876eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5100 has 1 transmitter B
33976eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5150 has 1 transmitter A
34076eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5300 has 3 transmitters
34176eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5350 has 3 transmitters
34276eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * bit14:16
343abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill */
344600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_POS	14
345600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_A_MSK	0x04000
346600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_B_MSK	0x08000
347600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_C_MSK	0x10000
348600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_AB_MSK	(RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
349600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_ABC_MSK	(RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
35076eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler#define RATE_ANT_NUM 3
35180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
35280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_NUM_ENTRIES			33
35380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_NUM_HT_OFDM_ENTRIES		32
35480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_CCK_ENTRY			32
35580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
356e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy#define IWL_PWR_NUM_HT_OFDM_ENTRIES		24
357e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy#define IWL_PWR_CCK_ENTRIES			2
358e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy
35980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/**
36080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * union iwl4965_tx_power_dual_stream
36180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
36280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
36380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Use __le32 version (struct tx_power_dual_stream) when building command.
36480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
36580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Driver provides radio gain and DSP attenuation settings to device in pairs,
36680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * one value for each transmitter chain.  The first value is for transmitter A,
36780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * second for transmitter B.
36880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
36980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * For SISO bit rates, both values in a pair should be identical.
37080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * For MIMO rates, one value may be different from the other,
37180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * in order to balance the Tx output between the two transmitters.
37280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
37380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * See more details in doc for TXPOWER in iwl-4965-hw.h.
37480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */
37580cc0c382db318de88577eff027d5c4097abef81Ben M Cahillunion iwl4965_tx_power_dual_stream {
37680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	struct {
37780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill		u8 radio_tx_gain[2];
37880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill		u8 dsp_predis_atten[2];
37980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	} s;
38080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	u32 dw;
38180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill};
38280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
38380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/**
38480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * struct tx_power_dual_stream
38580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
38680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
38780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
38880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Same format as iwl_tx_power_dual_stream, but __le32
38980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */
39080cc0c382db318de88577eff027d5c4097abef81Ben M Cahillstruct tx_power_dual_stream {
39180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	__le32 dw;
39280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill} __attribute__ ((packed));
39380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
39480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/**
39580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * struct iwl4965_tx_power_db
39680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
39780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
39880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */
39980cc0c382db318de88577eff027d5c4097abef81Ben M Cahillstruct iwl4965_tx_power_db {
40080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill	struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
40180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill} __attribute__ ((packed));
40280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
403630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler/**
404a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * Command REPLY_TX_POWER_DBM_CMD = 0x98
405630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler * struct iwl5000_tx_power_dbm_cmd
406630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler */
407630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler#define IWL50_TX_POWER_AUTO 0x7f
408853554accce19d16b03476676bdcb1ccdd44caaeGregory Greenman#define IWL50_TX_POWER_NO_CLOSED (0x1 << 6)
409853554accce19d16b03476676bdcb1ccdd44caaeGregory Greenman
410630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winklerstruct iwl5000_tx_power_dbm_cmd {
411630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler	s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
412630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler	u8 flags;
413630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler	s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
414630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler	u8 reserved;
415630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler} __attribute__ ((packed));
41680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill
4172f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy/**
4182f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy * Command TX_ANT_CONFIGURATION_CMD = 0x98
4192f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy * This command is used to configure valid Tx antenna.
4202f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy * By default uCode concludes the valid antenna according to the radio flavor.
4212f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy * This command enables the driver to override/modify this conclusion.
4222f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy */
4232f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guystruct iwl_tx_ant_config_cmd {
4242f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy	__le32 valid;
4252f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy} __attribute__ ((packed));
4262f748deceee10bac563df0e859830cc628d1a841Wey-Yi Guy
427b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
428b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (0a)
429b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Alive and Error Commands & Responses:
430b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
431b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
432b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
43351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define UCODE_VALID_OK	cpu_to_le32(0x1)
434b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define INITIALIZE_SUBTYPE    (9)
435b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
436b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
437075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
438075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
439075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode issues this "initialize alive" notification once the initialization
440075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode image has completed its work, and is ready to load the runtime image.
441075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * This is the *first* "alive" notification that the driver will receive after
442075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
443075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
444075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * See comments documenting "BSM" (bootstrap state machine).
445075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
446075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * For 4965, this notification contains important calibration data for
447075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * calculating txpower settings:
448075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
449075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 1)  Power supply voltage indication.  The voltage sensor outputs higher
450a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler *     values for lower voltage, and vice verse.
451075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
452075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2)  Temperature measurement parameters, for each of two channel widths
453075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     (20 MHz and 40 MHz) supported by the radios.  Temperature sensing
454075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     is done via one of the receiver chains, and channel width influences
455075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     the results.
456075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
457075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 3)  Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
458075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     for each of 5 frequency ranges.
459b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
460885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_init_alive_resp {
461b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ucode_minor;
462b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ucode_major;
463b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved1;
464b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sw_rev[8];
465b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ver_type;
466075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	u8 ver_subtype;		/* "9" for initialize alive */
467b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved2;
468b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 log_event_table_ptr;
469b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 error_event_table_ptr;
470b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 timestamp;
471b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 is_valid;
472075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill
473075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	/* calibration values from "initialize" uCode */
474075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 voltage;		/* signed, higher value is lower voltage */
4757aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy	__le32 therm_r1[2];	/* signed, 1st for normal, 2nd for HT40 */
476075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 therm_r2[2];	/* signed */
477075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 therm_r3[2];	/* signed */
478075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 therm_r4[2];	/* signed */
479075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 tx_atten[5][2];	/* signed MIMO gain comp, 5 freq groups,
480075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill				 * 2 Tx chains */
481b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
482b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
483075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill
484075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/**
485075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * REPLY_ALIVE = 0x1 (response only, not a command)
486075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
487075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode issues this "alive" notification once the runtime image is ready
488075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * to receive commands from the driver.  This is the *second* "alive"
489075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * notification that the driver will receive after rebooting uCode;
490075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * this "alive" is indicated by subtype field != 9.
491075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
492075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * See comments documenting "BSM" (bootstrap state machine).
493075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
494075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * This response includes two pointers to structures within the device's
495075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
496075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
497075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 1)  log_event_table_ptr indicates base of the event log.  This traces
498075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     a 256-entry history of uCode execution within a circular buffer.
499075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     Its header format is:
500075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
501075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 log_size;     log capacity (in number of entries)
502075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 type;         (1) timestamp with each entry, (0) no timestamp
503075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 wraps;        # times uCode has wrapped to top of circular buffer
504075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *      __le32 write_index;  next circular buffer entry that uCode would fill
505075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
506075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     The header is followed by the circular buffer of log entries.  Entries
507075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     with timestamps have the following format:
508075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
509075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 event_id;     range 0 - 1500
510075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 timestamp;    low 32 bits of TSF (of network, if associated)
511075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 data;         event_id-specific data value
512075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
513075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     Entries without timestamps contain only event_id and data.
514075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
515461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *
516075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2)  error_event_table_ptr indicates base of the error log.  This contains
517461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *     information about any uCode error that occurs.  For agn, the format
518075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *     of the error log is:
519075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
520075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 valid;        (nonzero) valid, (0) log is empty
521075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 error_id;     type of error
522075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 pc;           program counter
523075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 blink1;       branch link
524075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 blink2;       branch link
525075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 ilink1;       interrupt link
526075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 ilink2;       interrupt link
527075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 data1;        error-specific data
528075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 data2;        error-specific data
529075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 line;         source code line of error
530075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 bcon_time;    beacon timer
531075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 tsf_low;      network timestamp function timer
532075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *	__le32 tsf_hi;       network timestamp function timer
533461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 gp1;          GP1 timer register
534461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 gp2;          GP2 timer register
535461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 gp3;          GP3 timer register
536461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 ucode_ver;    uCode version
537461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 hw_ver;       HW Silicon version
538461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 brd_ver;      HW board version
539461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 log_pc;       log program counter
540461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 frame_ptr;    frame pointer
541461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 stack_ptr;    stack pointer
542461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 hcmd;         last host command
543461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr0;         isr status register LMPM_NIC_ISR0: rxtx_flag
544461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr1;         isr status register LMPM_NIC_ISR1: host_flag
545461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr2;         isr status register LMPM_NIC_ISR2: enc_flag
546461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr3;         isr status register LMPM_NIC_ISR3: time_flag
547461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr4;         isr status register LMPM_NIC_ISR4: wico interrupt
548461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 isr_pref;     isr status register LMPM_NIC_PREF_STAT
549461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 wait_event;   wait event() caller address
550461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 l2p_control;  L2pControlField
551461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 l2p_duration; L2pDurationField
552461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 l2p_mhvalid;  L2pMhValidBits
553461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 l2p_addr_match; L2pAddrMatchStat
554461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
555461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 u_timestamp;  indicate when the date and time of the compilation
556461ef382fd68f02b7bac8f94f7f2b85162bad896Wey-Yi Guy *	__le32 reserved;
557075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill *
558075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * The Linux driver can print both logs to the system log when a uCode error
559075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * occurs.
560075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill */
561885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_alive_resp {
562b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ucode_minor;
563b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ucode_major;
564b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved1;
565b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sw_rev[8];
566b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ver_type;
567075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	u8 ver_subtype;			/* not "9" for runtime alive */
568b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved2;
569075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 log_event_table_ptr;	/* SRAM address for event log */
570075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill	__le32 error_event_table_ptr;	/* SRAM address for error log */
571b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 timestamp;
572b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 is_valid;
573b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
574b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
575b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
576b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ERROR = 0x2 (response only, not a command)
577b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
578885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_error_resp {
579b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 error_type;
580b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 cmd_id;
581b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
582b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 bad_cmd_seq_num;
583b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 error_info;
5843195c1f3499912b207ae600968488759b16037fcTomas Winkler	__le64 timestamp;
585b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
586b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
587b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
588b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (1)
589b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * RXON Commands & Responses:
590b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
591b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
592b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
593b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
594b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx config defines & structure
595b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
596b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config device types  */
597b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
598b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	RXON_DEV_TYPE_AP = 1,
599b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	RXON_DEV_TYPE_ESS = 3,
600b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	RXON_DEV_TYPE_IBSS = 4,
601b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	RXON_DEV_TYPE_SNIFFER = 6,
602b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
603b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
60414519a0b46085db68e610147098d03386c34801fBen M Cahill
60551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_DRIVER_FORCE_MSK		cpu_to_le16(0x1 << 0)
6067b841727d2715d97592f46164804b34d6241644fRick Farrington#define RXON_RX_CHAIN_DRIVER_FORCE_POS		(0)
60751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_VALID_MSK			cpu_to_le16(0x7 << 1)
60814519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_VALID_POS			(1)
60951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_FORCE_SEL_MSK		cpu_to_le16(0x7 << 4)
61014519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_FORCE_SEL_POS		(4)
61151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK	cpu_to_le16(0x7 << 7)
61214519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
61351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_CNT_MSK			cpu_to_le16(0x3 << 10)
61414519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_CNT_POS			(10)
61551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_MIMO_CNT_MSK		cpu_to_le16(0x3 << 12)
61614519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_MIMO_CNT_POS		(12)
61751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_MIMO_FORCE_MSK		cpu_to_le16(0x1 << 14)
61814519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_MIMO_FORCE_POS		(14)
61914519a0b46085db68e610147098d03386c34801fBen M Cahill
620b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config flags */
621b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* band & modulation selection */
62251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_BAND_24G_MSK           cpu_to_le32(1 << 0)
62351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CCK_MSK                cpu_to_le32(1 << 1)
624b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* auto detection enable */
62551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_AUTO_DETECT_MSK        cpu_to_le32(1 << 2)
626b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* TGg protection when tx */
62751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TGG_PROTECT_MSK        cpu_to_le32(1 << 3)
628b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* cck short slot & preamble */
62951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SHORT_SLOT_MSK          cpu_to_le32(1 << 4)
63051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SHORT_PREAMBLE_MSK     cpu_to_le32(1 << 5)
631b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* antenna selection */
63251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_DIS_DIV_MSK            cpu_to_le32(1 << 7)
63351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_SEL_MSK            cpu_to_le32(0x0f00)
63451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_A_MSK              cpu_to_le32(1 << 8)
63551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_B_MSK              cpu_to_le32(1 << 9)
636b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* radar detection enable */
63751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_RADAR_DETECT_MSK       cpu_to_le32(1 << 12)
63851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TGJ_NARROW_BAND_MSK    cpu_to_le32(1 << 13)
639b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx response to host with 8-byte TSF
640b481de9ca074528fe8c429604e2777db8b89806aZhu Yi* (according to ON_AIR deassertion) */
64151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TSF2HOST_MSK           cpu_to_le32(1 << 15)
642b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
64314519a0b46085db68e610147098d03386c34801fBen M Cahill
64414519a0b46085db68e610147098d03386c34801fBen M Cahill/* HT flags */
64514519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_CTRL_CHANNEL_LOC_POS		(22)
64651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK	cpu_to_le32(0x1 << 22)
64714519a0b46085db68e610147098d03386c34801fBen M Cahill
64814519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_HT_OPERATING_MODE_POS		(23)
64914519a0b46085db68e610147098d03386c34801fBen M Cahill
65051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_HT_PROT_MSK			cpu_to_le32(0x1 << 23)
6517aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy#define RXON_FLG_HT40_PROT_MSK			cpu_to_le32(0x2 << 23)
65214519a0b46085db68e610147098d03386c34801fBen M Cahill
65314519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_CHANNEL_MODE_POS		(25)
65451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CHANNEL_MODE_MSK		cpu_to_le32(0x3 << 25)
655a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy
656a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy/* channel mode */
657a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guyenum {
658a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy	CHANNEL_MODE_LEGACY = 0,
659a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy	CHANNEL_MODE_PURE_40 = 1,
660a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy	CHANNEL_MODE_MIXED = 2,
661a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy	CHANNEL_MODE_RESERVED = 3,
662a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy};
663a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy#define RXON_FLG_CHANNEL_MODE_LEGACY	cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
664a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy#define RXON_FLG_CHANNEL_MODE_PURE_40	cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
665a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy#define RXON_FLG_CHANNEL_MODE_MIXED	cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
666a2b0f02e4795bfde5f11720a10af8923cb98b654Wey-Yi Guy
667a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach/* CTS to self (if spec allows) flag */
66851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SELF_CTS_EN			cpu_to_le32(0x1<<30)
66914519a0b46085db68e610147098d03386c34801fBen M Cahill
670b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config filter flags */
671b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* accept all data frames */
67251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_PROMISC_MSK         cpu_to_le32(1 << 0)
673b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* pass control & management to host */
67451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_CTL2HOST_MSK        cpu_to_le32(1 << 1)
675b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* accept multi-cast */
67651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_ACCEPT_GRP_MSK      cpu_to_le32(1 << 2)
677b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* don't decrypt uni-cast frames */
67851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_DIS_DECRYPT_MSK     cpu_to_le32(1 << 3)
679b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* don't decrypt multi-cast frames */
68051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
681b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* STA is associated */
68251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_ASSOC_MSK           cpu_to_le32(1 << 5)
683b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* transfer to host non bssid beacons in associated state */
68451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_BCON_AWARE_MSK      cpu_to_le32(1 << 6)
685b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
68680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/**
687b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_RXON = 0x10 (command, has simple generic response)
68880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
68980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * RXON tunes the radio tuner to a service channel, and sets up a number
69080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * of parameters that are used primarily for Rx, but also for Tx operations.
69180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
69280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * NOTE:  When tuning to a new channel, driver must set the
69380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent
69480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        info within the device, including the station tables, tx retry
69580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        rate tables, and txpower tables.  Driver must build a new station
69680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        table and txpower table before transmitting anything on the RXON
69780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        channel.
69880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *
69980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must
70080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
70180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
702b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
7033d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
7043d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rxon_cmd {
7053d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 node_addr[6];
7063d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved1;
7073d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 bssid_addr[6];
7083d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved2;
7093d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 wlap_bssid_addr[6];
7103d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved3;
7113d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 dev_type;
7123d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 air_propagation;
7133d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved4;
7143d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 ofdm_basic_rates;
7153d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 cck_basic_rates;
7163d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 assoc_id;
7173d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 flags;
7183d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 filter_flags;
7193d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 channel;
7203d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved5;
7213d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
7223d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
723bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_rxon_cmd {
724b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 node_addr[6];
725b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved1;
726b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 bssid_addr[6];
727b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved2;
728b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 wlap_bssid_addr[6];
729b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved3;
730b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 dev_type;
731b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 air_propagation;
732b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 rx_chain;
733b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_basic_rates;
734b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 cck_basic_rates;
735b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 assoc_id;
736b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 flags;
737b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 filter_flags;
738b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel;
739b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_ht_single_stream_basic_rates;
740b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_ht_dual_stream_basic_rates;
741b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
742b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
743a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* 5000 HW just extend this command */
744c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenmanstruct iwl_rxon_cmd {
745c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 node_addr[6];
746c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 reserved1;
747c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 bssid_addr[6];
748c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 reserved2;
749c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 wlap_bssid_addr[6];
750c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 reserved3;
751c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 dev_type;
752c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 air_propagation;
753c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 rx_chain;
754c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 ofdm_basic_rates;
755c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 cck_basic_rates;
756c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 assoc_id;
757c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le32 flags;
758c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le32 filter_flags;
759c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 channel;
760c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 ofdm_ht_single_stream_basic_rates;
761c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 ofdm_ht_dual_stream_basic_rates;
762c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 ofdm_ht_triple_stream_basic_rates;
763c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	u8 reserved5;
764c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 acquisition_data;
765c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman	__le16 reserved6;
766c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman} __attribute__ ((packed));
767c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman
7683d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/*
7693d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
7703d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
7713d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rxon_assoc_cmd {
7723d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 flags;
7733d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 filter_flags;
7743d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 ofdm_basic_rates;
7753d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 cck_basic_rates;
7763d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved;
7773d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
7783d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
7793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl4965_rxon_assoc_cmd {
780fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	__le32 flags;
781fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	__le32 filter_flags;
782fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	u8 ofdm_basic_rates;
783fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	u8 cck_basic_rates;
784fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	u8 ofdm_ht_single_stream_basic_rates;
785fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	u8 ofdm_ht_dual_stream_basic_rates;
786fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky	__le16 rx_chain_select_flags;
7873d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved;
788fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky} __attribute__ ((packed));
789c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman
7903d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl5000_rxon_assoc_cmd {
791b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 flags;
792b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 filter_flags;
793b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_basic_rates;
794b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 cck_basic_rates;
7953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved1;
796b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_ht_single_stream_basic_rates;
797b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ofdm_ht_dual_stream_basic_rates;
7983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 ofdm_ht_triple_stream_basic_rates;
7993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved2;
800b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 rx_chain_select_flags;
8013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 acquisition_data;
8023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 reserved3;
803b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
804b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
805b5d7be5e665f29274cfe6645b661acb38cb1d19bTomas Winkler#define IWL_CONN_MAX_LISTEN_INTERVAL	10
8062c2f3b33888419fb9e7d015b9dc67b9db4437efaTomas Winkler#define IWL_MAX_UCODE_BEACON_INTERVAL	4 /* 4096 */
8072c2f3b33888419fb9e7d015b9dc67b9db4437efaTomas Winkler#define IWL39_MAX_UCODE_BEACON_INTERVAL	1 /* 1024 */
808fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky
809b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
810b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
811b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
8123195c1f3499912b207ae600968488759b16037fcTomas Winklerstruct iwl_rxon_time_cmd {
8133195c1f3499912b207ae600968488759b16037fcTomas Winkler	__le64 timestamp;
814b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 beacon_interval;
815b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 atim_window;
816b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_init_val;
817b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 listen_interval;
818b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
819b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
820b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
821b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
822b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
823b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
8243d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_channel_switch_cmd {
8253d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 band;
8263d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 expect_beacon;
8273d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 channel;
8283d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 rxon_flags;
8293d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 rxon_filter_flags;
8303d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 switch_time;
8313d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_power_per_rate power[IWL_MAX_RATES];
8323d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
8333d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
834e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guystruct iwl4965_channel_switch_cmd {
835b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 band;
836b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 expect_beacon;
837b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel;
838b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rxon_flags;
839b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rxon_filter_flags;
840b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 switch_time;
841bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig	struct iwl4965_tx_power_db tx_power;
842b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
843b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
844e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy/**
845e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * struct iwl5000_channel_switch_cmd
846e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @band: 0- 5.2GHz, 1- 2.4GHz
847e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @expect_beacon: 0- resume transmits after channel switch
848e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy *		   1- wait for beacon to resume transmits
849e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @channel: new channel number
850e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @rxon_flags: Rx on flags
851e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @rxon_filter_flags: filtering parameters
852e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @switch_time: switch time in extended beacon format
853e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @reserved: reserved bytes
854e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy */
855e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guystruct iwl5000_channel_switch_cmd {
856e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	u8 band;
857e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	u8 expect_beacon;
858e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le16 channel;
859e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 rxon_flags;
860e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 rxon_filter_flags;
861e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 switch_time;
862e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
863e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy} __attribute__ ((packed));
864e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy
865e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy/**
866e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * struct iwl6000_channel_switch_cmd
867e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @band: 0- 5.2GHz, 1- 2.4GHz
868e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @expect_beacon: 0- resume transmits after channel switch
869e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy *		   1- wait for beacon to resume transmits
870e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @channel: new channel number
871e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @rxon_flags: Rx on flags
872e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @rxon_filter_flags: filtering parameters
873e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @switch_time: switch time in extended beacon format
874e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy * @reserved: reserved bytes
875e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy */
876e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guystruct iwl6000_channel_switch_cmd {
877e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	u8 band;
878e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	u8 expect_beacon;
879e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le16 channel;
880e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 rxon_flags;
881e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 rxon_filter_flags;
882e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 switch_time;
883e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy	__le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
884e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy} __attribute__ ((packed));
885e57f14895bf6bc7f16df760963427ac6ee6ff7e1Wey-Yi Guy
886b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
887b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
888b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
8892aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_csa_notification {
890b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 band;
891b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel;
892b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 status;		/* 0 - OK, 1 - fail */
893b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
894b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
895b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
896b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (2)
897b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Quality-of-Service (QOS) Commands & Responses:
898b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
899b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
9002054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
9012054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/**
9022054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
9032054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
9042054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
9052054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @cw_min: Contention window, start value in numbers of slots.
9062054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *          Should be a power-of-2, minus 1.  Device's default is 0x0f.
9072054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @cw_max: Contention window, max value in numbers of slots.
9082054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *          Should be a power-of-2, minus 1.  Device's default is 0x3f.
9092054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @aifsn:  Number of slots in Arbitration Interframe Space (before
9102054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *          performing random backoff timing prior to Tx).  Device default 1.
9112054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0.
9122054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
9132054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Device will automatically increase contention window by (2*CW) + 1 for each
9142054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
9152054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * value, to cap the CW value.
9162054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill */
9171ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbachstruct iwl_ac_qos {
918b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 cw_min;
919b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 cw_max;
920b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 aifsn;
921b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
922b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 edca_txop;
923b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
924b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
925b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* QoS flags defines */
92651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_UPDATE_EDCA_MSK	cpu_to_le32(0x01)
92751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_TGN_MSK		cpu_to_le32(0x02)
92851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_TXOP_TYPE_MSK	cpu_to_le32(0x10)
929b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
9302054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Number of Access Categories (AC) (EDCA), queues 0..3 */
931b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AC_NUM                4
932b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
933b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
934b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
9352054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
9362054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
9372054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
938b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
9391ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbachstruct iwl_qosparam_cmd {
940b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 qos_flags;
9411ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbach	struct iwl_ac_qos ac[AC_NUM];
942b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
943b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
944b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
945b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (3)
946b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Add/Modify Stations Commands & Responses:
947b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
948b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
949b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
950b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Multi station support
951b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
9522054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
9532054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Special, dedicated locations within device's station table */
954b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	IWL_AP_ID		0
955b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_MULTICAST_ID	1
956b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	IWL_STA_ID		2
9574c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define	IWL3945_BROADCAST_ID	24
9584c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL3945_STATION_COUNT	25
959b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL4965_BROADCAST_ID	31
960b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	IWL4965_STATION_COUNT	32
961fdd3e8a4ff96d03121b21946bfa684f3b5d783c6Tomas Winkler#define IWL5000_BROADCAST_ID	15
962fdd3e8a4ff96d03121b21946bfa684f3b5d783c6Tomas Winkler#define	IWL5000_STATION_COUNT	16
963b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
964b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	IWL_STATION_COUNT	32 	/* MAX(3945,4965)*/
965b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	IWL_INVALID_STATION 	255
966b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
9674c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define STA_FLG_TX_RATE_MSK		cpu_to_le32(1 << 2);
9684c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define STA_FLG_PWR_SAVE_MSK		cpu_to_le32(1 << 8);
96951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_RTS_MIMO_PROT_MSK	cpu_to_le32(1 << 17)
97051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_AGG_MPDU_8US_MSK	cpu_to_le32(1 << 18)
97174093ddf4c42da74922b63fb6844989e21164d9eBen M Cahill#define STA_FLG_MAX_AGG_SIZE_POS	(19)
97251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_MAX_AGG_SIZE_MSK	cpu_to_le32(3 << 19)
9737aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy#define STA_FLG_HT40_EN_MSK		cpu_to_le32(1 << 21)
97451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_MIMO_DIS_MSK		cpu_to_le32(1 << 22)
97574093ddf4c42da74922b63fb6844989e21164d9eBen M Cahill#define STA_FLG_AGG_MPDU_DENSITY_POS	(23)
97651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_AGG_MPDU_DENSITY_MSK	cpu_to_le32(7 << 23)
977b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
9782054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Use in mode field.  1: modify existing entry, 0: add new station entry */
979b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_CONTROL_MODIFY_MSK		0x01
980b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
981b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* key flags __le16*/
98251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_ENCRYPT_MSK	cpu_to_le16(0x0007)
98351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_NO_ENC	cpu_to_le16(0x0000)
98451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_WEP		cpu_to_le16(0x0001)
98551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_CCMP	cpu_to_le16(0x0002)
98651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_TKIP	cpu_to_le16(0x0003)
987b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
988b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_KEY_FLG_KEYID_POS	8
98951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_INVALID 	cpu_to_le16(0x0800)
990eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach/* wep key is either from global key (0) or from station info array (1) */
99151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_MAP_KEY_MSK	cpu_to_le16(0x0008)
992eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach
993eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
99451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_KEY_SIZE_MSK     cpu_to_le16(0x1000)
99551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_MULTICAST_MSK        cpu_to_le16(0x4000)
996deb09c435e3f947f8b2c9d5df6a9c0a5b472b125Emmanuel Grumbach#define STA_KEY_MAX_NUM		8
997b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
9982054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Flags indicate whether to modify vs. don't change various station params */
999b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	STA_MODIFY_KEY_MASK		0x01
1000b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	STA_MODIFY_TID_DISABLE_TX	0x02
1001b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	STA_MODIFY_TX_RATE_MSK		0x04
1002b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_ADDBA_TID_MSK	0x08
1003b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_DELBA_TID_MSK	0x10
10046ab10ff8738dfb098fd32132b7ebcf5cdb43ebdeJohannes Berg#define STA_MODIFY_SLEEP_TX_COUNT_MSK	0x20
10052054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
10062054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Receiver address (actually, Rx station's index into station table),
10072054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
1008b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define BUILD_RAxTID(sta_id, tid)	(((sta_id) << 4) + (tid))
1009b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1010bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_keyinfo {
1011b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 key_flags;
1012b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 tkip_rx_tsc_byte2;	/* TSC[2] for key mix ph1 detection */
1013b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
1014b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 tkip_rx_ttak[5];	/* 10-byte unicast TKIP TTAK */
1015eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach	u8 key_offset;
1016eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach	u8 reserved2;
1017b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 key[16];		/* 16-byte unicast decryption key */
1018b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1019b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1020133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler/* 5000 */
1021133636deffc86809f59a0c8b768408d13237a9a2Tomas Winklerstruct iwl_keyinfo {
1022133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le16 key_flags;
1023133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 tkip_rx_tsc_byte2;	/* TSC[2] for key mix ph1 detection */
1024133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 reserved1;
1025133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le16 tkip_rx_ttak[5];	/* 10-byte unicast TKIP TTAK */
1026133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 key_offset;
1027133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 reserved2;
1028133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 key[16];		/* 16-byte unicast decryption key */
1029133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le64 tx_secur_seq_cnt;
1030133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le64 hw_tkip_mic_rx_key;
1031133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le64 hw_tkip_mic_tx_key;
1032133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler} __attribute__ ((packed));
1033133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
10342054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/**
10352054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * struct sta_id_modify
10362054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @addr[ETH_ALEN]: station's MAC address
10372054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @sta_id: index of station in uCode's station table
10382054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
10392054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10402054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Driver selects unused table index when adding new station,
10412054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * or the index to a pre-existing station entry when modifying that station.
10422054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
10432054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10442054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * modify_mask flags select which parameters to modify vs. leave alone.
10452054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill */
1046b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct sta_id_modify {
1047b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 addr[ETH_ALEN];
1048b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved1;
1049b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sta_id;
1050b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 modify_mask;
1051b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved2;
1052b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1053b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1054b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1055b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ADD_STA = 0x18 (command)
10562054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10572054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * The device contains an internal table of per-station information,
10582054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * with info on security keys, aggregation parameters, and Tx rates for
10592054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
10602054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 3945 uses REPLY_RATE_SCALE to set up rate tables).
10612054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10622054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * REPLY_ADD_STA sets up the table entry for one station, either creating
10632054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * a new entry, or modifying a pre-existing one.
10642054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10652054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * NOTE:  RXON command (without "associated" bit set) wipes the station table
10662054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        clean.  Moving into RF_KILL state does this also.  Driver must set up
10672054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        new station table before transmitting anything on the RXON channel
10682054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        (except active scans or active measurements; those commands carry
10692054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        their own txpower/rate setup data).
10702054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *
10712054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        When getting started on a new channel, driver must set up the
10722054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        IWL_BROADCAST_ID entry (last entry in the table).  For a client
10732054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        station in a BSS, once an AP is selected, driver sets up the AP STA
10742054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        in the IWL_AP_ID entry (1st entry in the table).  BROADCAST and AP
10752054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        are all that are needed for a BSS client station.  If the device is
10762054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        used as AP, or in an IBSS network, driver must set up station table
10772054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill *        entries for all STAs in network, starting with index IWL_STA_ID.
1078b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
10793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
10803d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_addsta_cmd {
10813d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 mode;		/* 1: modify existing, 0: add new station */
10823d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved[3];
10833d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct sta_id_modify sta;
10843d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl4965_keyinfo key;
10853d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 station_flags;		/* STA_FLG_* */
10863d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 station_flags_msk;	/* STA_FLG_* */
10873d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
10883d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
10893d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * corresponding to bit (e.g. bit 5 controls TID 5).
10903d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
10913d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 tid_disable_tx;
10923d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
10933d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 rate_n_flags;
10943d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
10953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* TID for which to add block-ack support.
10963d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
10973d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 add_immediate_ba_tid;
10983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
10993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* TID for which to remove block-ack support.
11003d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
11013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 remove_immediate_ba_tid;
11023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
11033d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* Starting Sequence Number for added block-ack support.
11043d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
11053d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 add_immediate_ba_ssn;
11063d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
11073d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
1108bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_addsta_cmd {
11092054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	u8 mode;		/* 1: modify existing, 0: add new station */
1110b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved[3];
1111b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct sta_id_modify sta;
1112bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig	struct iwl4965_keyinfo key;
11132054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	__le32 station_flags;		/* STA_FLG_* */
11142054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	__le32 station_flags_msk;	/* STA_FLG_* */
11152054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
11162054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
11172054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	 * corresponding to bit (e.g. bit 5 controls TID 5).
11182054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1119b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 tid_disable_tx;
11202054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
1121b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16	reserved1;
11222054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
11232054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	/* TID for which to add block-ack support.
11242054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 add_immediate_ba_tid;
11262054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
11272054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	/* TID for which to remove block-ack support.
11282054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 remove_immediate_ba_tid;
11302054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
11312054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	/* Starting Sequence Number for added block-ack support.
11322054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1133b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 add_immediate_ba_ssn;
11342054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill
11359bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	/*
11369bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * Number of packets OK to transmit to station even though
11379bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * it is asleep -- used to synchronise PS-poll and u-APSD
11389bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * responses while ucode keeps track of STA sleep state.
11399bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 */
11409bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	__le16 sleep_tx_count;
11419bb487b406692e172b15eba58de7d69358ac2005Johannes Berg
11429bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	__le16 reserved2;
1143b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1144b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1145133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler/* 5000 */
1146133636deffc86809f59a0c8b768408d13237a9a2Tomas Winklerstruct iwl_addsta_cmd {
1147133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 mode;		/* 1: modify existing, 0: add new station */
1148133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 reserved[3];
1149133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	struct sta_id_modify sta;
1150133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	struct iwl_keyinfo key;
1151133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le32 station_flags;		/* STA_FLG_* */
1152133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le32 station_flags_msk;	/* STA_FLG_* */
1153133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1154133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	/* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1155133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	 * corresponding to bit (e.g. bit 5 controls TID 5).
1156133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1157133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le16 tid_disable_tx;
1158133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1159c587de0b8d6e194f7a1719fc6af8a81b4e8916d2Tomas Winkler	__le16	rate_n_flags;		/* 3945 only */
1160133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1161133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	/* TID for which to add block-ack support.
1162133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1163133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 add_immediate_ba_tid;
1164133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1165133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	/* TID for which to remove block-ack support.
1166133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1167133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	u8 remove_immediate_ba_tid;
1168133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1169133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	/* Starting Sequence Number for added block-ack support.
1170133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1171133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler	__le16 add_immediate_ba_ssn;
1172133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
11739bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	/*
11749bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * Number of packets OK to transmit to station even though
11759bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * it is asleep -- used to synchronise PS-poll and u-APSD
11769bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 * responses while ucode keeps track of STA sleep state.
11779bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	 */
11789bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	__le16 sleep_tx_count;
11799bb487b406692e172b15eba58de7d69358ac2005Johannes Berg
11809bb487b406692e172b15eba58de7d69358ac2005Johannes Berg	__le16 reserved2;
1181133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler} __attribute__ ((packed));
1182133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
1183133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler
11842054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_SUCCESS_MSK		0x1
11852054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_NO_ROOM_IN_TABLE	0x2
11862054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_NO_BLOCK_ACK_RESOURCE	0x4
11872054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_MODIFY_NON_EXIST_STA	0x8
1188b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1189b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ADD_STA = 0x18 (response)
1190b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
11917a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_add_sta_resp {
11922054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill	u8 status;	/* ADD_STA_* */
1193b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1194b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
11957a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler#define REM_STA_SUCCESS_MSK              0x1
11967a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler/*
11977a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler *  REPLY_REM_STA = 0x19 (response)
11987a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler */
11997a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_rem_sta_resp {
12007a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler	u8 status;
12017a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler} __attribute__ ((packed));
12027a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler
12037a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler/*
12047a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler *  REPLY_REM_STA = 0x19 (command)
12057a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler */
12067a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_rem_sta_cmd {
12077a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler	u8 num_sta;     /* number of removed stations */
12087a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler	u8 reserved[3];
12097a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler	u8 addr[ETH_ALEN]; /* MAC addr of the first station */
12107a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler	u8 reserved2[2];
12117a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler} __attribute__ ((packed));
12127a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler
12130a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach/*
12140a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach * REPLY_WEP_KEY = 0x20
12150a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach */
12160a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbachstruct iwl_wep_key {
12170a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 key_index;
12180a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 key_offset;
12190a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 reserved1[2];
12200a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 key_size;
12210a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 reserved2[3];
12220a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 key[16];
12230a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach} __attribute__ ((packed));
12240a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach
12250a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbachstruct iwl_wep_cmd {
12260a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 num_keys;
12270a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 global_key_type;
12280a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 flags;
12290a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	u8 reserved;
12300a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach	struct iwl_wep_key key[0];
12310a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach} __attribute__ ((packed));
12320a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach
12330a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEY_WEP_TYPE 1
12340a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEYS_MAX 4
12350a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_INVALID_OFFSET 0xff
12364564ce8b0e17d91d047aa875843deb2cccf3f268Emmanuel Grumbach#define WEP_KEY_LEN_64 5
12370a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEY_LEN_128 13
1238b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1239b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
1240b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (4)
1241b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx Responses:
1242b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1243b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
1244b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
124551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_STATUS_NO_CRC32_ERROR	cpu_to_le32(1 << 0)
124651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_STATUS_NO_RXE_OVERFLOW	cpu_to_le32(1 << 1)
12478211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler
124851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_BAND_24_MSK	cpu_to_le16(1 << 0)
124951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_MOD_CCK_MSK		cpu_to_le16(1 << 1)
125051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK	cpu_to_le16(1 << 2)
125151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK	cpu_to_le16(1 << 3)
12529024adf5c81c94f7b5c6fd26942b075e2a26e085Reinette Chatre#define RX_RES_PHY_FLAGS_ANTENNA_MSK		0xf0
12539f30e04e041cf9943940f71fd76094dd5a237018Daniel C Halperin#define RX_RES_PHY_FLAGS_ANTENNA_POS		4
12548211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler
12558211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_MSK	(0x7 << 8)
12568211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_NONE	(0x0 << 8)
12578211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_WEP	(0x1 << 8)
12588211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_CCMP	(0x2 << 8)
12598211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_TKIP	(0x3 << 8)
126017e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define	RX_RES_STATUS_SEC_TYPE_ERR	(0x7 << 8)
126117e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach
126217e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_RES_STATUS_STATION_FOUND	(1<<6)
126317e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH	(1<<7)
12648211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler
12658211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_DECRYPT_TYPE_MSK	(0x3 << 11)
12668211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_NOT_DECRYPT	(0x0 << 11)
12678211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_DECRYPT_OK	(0x3 << 11)
12688211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_BAD_ICV_MIC	(0x1 << 11)
12698211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_BAD_KEY_TTAK	(0x2 << 11)
1270b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
127117e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_ICV_OK	(0x20)
127217e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_MIC_OK	(0x40)
127317e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_TTAK_OK	(1 << 7)
127417e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_DEC_DONE_MSK	(0x800)
127517e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach
12763d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
12773d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rx_frame_stats {
12783d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 phy_count;
12793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 id;
12803d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rssi;
12813d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 agc;
12823d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 sig_avg;
12833d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 noise_diff;
12843d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 payload[0];
12853d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
12863d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
12873d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rx_frame_hdr {
12883d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 channel;
12893d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 phy_flags;
12903d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved1;
12913d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rate;
12923d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 len;
12933d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 payload[0];
12943d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
12953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
12963d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rx_frame_end {
12973d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 status;
12983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le64 timestamp;
12993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 beacon_timestamp;
13003d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
13013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
13023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/*
13033d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * REPLY_3945_RX = 0x1b (response only, not a command)
13043d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
13053d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * NOTE:  DO NOT dereference from casts to this structure
13063d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * It is provided only for calculating minimum data set size.
13073d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * The actual offsets of the hdr and end are dynamic based on
13083d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * stats.phy_count
13093d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
13103d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rx_frame {
13113d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_rx_frame_stats stats;
13123d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_rx_frame_hdr hdr;
13133d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_rx_frame_end end;
13143d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
13153d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
13163d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler#define IWL39_RX_FRAME_SIZE	(4 + sizeof(struct iwl3945_rx_frame))
13173d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
1318b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Fixed (non-configurable) rx data from phy */
1319caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler
1320caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_RES_PHY_CNT 14
1321caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET	(4)
1322caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK	(0x70)
1323caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_AGC_DB_MASK			(0x3f80)	/* MASK(7,13) */
1324caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_AGC_DB_POS			(7)
1325b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct iwl4965_rx_non_cfg_phy {
1326b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 ant_selection;	/* ant A bit 4, ant B bit 5, ant C bit 6 */
1327b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 agc_info;	/* agc code 0:6, agc dB 7:13, reserved 14:15 */
1328b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 rssi_info[6];	/* we use even entries, 0/2/4 for A/B/C rssi */
1329b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 pad[0];
1330b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1331b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1332caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler
1333caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_PHY_CNT 8
1334caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_AGC_IDX     1
1335caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_RSSI_AB_IDX 2
1336caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_RSSI_C_IDX  3
1337caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_AGC_MSK 0xfe00
1338caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_AGC_BIT_POS 9
1339caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_A_MSK 0x00ff
1340caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_A_BIT_POS 0
1341caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_B_MSK 0xff0000
1342caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_B_BIT_POS 16
1343caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_C_MSK 0x00ff
1344caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_C_BIT_POS 0
1345caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler
1346caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winklerstruct iwl5000_non_cfg_phy {
1347a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler	__le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT];  /* up to 8 phy entries */
1348caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler} __attribute__ ((packed));
1349caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler
1350caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler
1351b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1352857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler * REPLY_RX = 0xc3 (response only, not a command)
1353b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Used only for legacy (non 11n) frames.
1354b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
1355caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winklerstruct iwl_rx_phy_res {
1356b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 non_cfg_phy_cnt;     /* non configurable DSP phy data byte count */
1357b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 cfg_phy_cnt;		/* configurable DSP phy data byte count */
1358b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 stat_id;		/* configurable DSP phy data set ID */
1359b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
1360b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le64 timestamp;	/* TSF at on air rise */
1361b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_time_stamp; /* beacon at on-air rise */
1362b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 phy_flags;	/* general phy flags: band, modulation, ... */
1363b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel;		/* channel number */
1364caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler	u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
1365529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le32 rate_n_flags;	/* RATE_MCS_* */
1366529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le16 byte_count;	/* frame's byte-count */
1367b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved3;
1368b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1369b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1370b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct iwl4965_rx_mpdu_res_start {
1371b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 byte_count;
1372b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
1373b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1374b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1375b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1376b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
1377b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (5)
1378b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Tx Commands & Responses:
1379b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1380529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver must place each REPLY_TX command into one of the prioritized Tx
1381529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * queues in host DRAM, shared between driver and device (see comments for
1382529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * SCD registers and Tx/Rx Queues).  When the device's Tx scheduler and uCode
1383529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * are preparing to transmit, the device pulls the Tx command over the PCI
1384529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1385529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * from which data will be transmitted.
1386529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1387529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * uCode handles all timing and protocol related to control frames
1388529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * (RTS/CTS/ACK), based on flags in the Tx command.  uCode and Tx scheduler
1389529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * handle reception of block-acks; uCode updates the host driver via
1390529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * REPLY_COMPRESSED_BA (4965).
1391529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1392529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * uCode handles retrying Tx when an ACK is expected but not received.
1393529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This includes trying lower data rates than the one requested in the Tx
1394529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * command, as set up by the REPLY_RATE_SCALE (for 3945) or
1395529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * REPLY_TX_LINK_QUALITY_CMD (4965).
1396529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1397529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
1398529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This command must be executed after every RXON command, before Tx can occur.
1399b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
1400b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1401529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* REPLY_TX Tx flags field */
1402529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1403a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
1404a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach * before this frame. if CTS-to-self required check
1405a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach * RXON_FLG_SELF_CTS_EN status. */
140651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_RTS_CTS_MSK cpu_to_le32(1 << 0)
1407a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach
1408529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Use Request-To-Send protocol before this frame.
1409529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
141051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
1411529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1412529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Transmit Clear-To-Send to self before this frame.
1413529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
1414529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
141551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
1416529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1417529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Expect ACK from receiving station
1418529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Don't expect ACK (MAC header's duration field s/b 0)
1419529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for unicast frames, but not broadcast/multicast. */
142051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
1421529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1422529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* For 4965:
1423529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
1424529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *    Tx command's initial_rate_index indicates first rate to try;
1425529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *    uCode walks through table for additional Tx attempts.
1426529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1427529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *    This rate will be used for all Tx attempts; it will not be scaled. */
142851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
1429529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1430529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Expect immediate block-ack.
1431529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set when Txing a block-ack request frame.  Also set TX_CMD_FLG_ACK_MSK. */
143251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_IMM_BA_RSP_MASK  cpu_to_le32(1 << 6)
1433529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1434529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Frame requires full Tx-Op protection.
1435529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this if either RTS or CTS Tx Flag gets set. */
143651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
1437529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1438529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
1439529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
144051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
144151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
144251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
1443b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1444529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Ignore Bluetooth priority for this frame.
1445529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Delay Tx until Bluetooth device is done (normal usage). */
1446b2e8690d5a4d1868ee12f50aa00c138bec985b3cJohannes Berg#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12)
1447b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1448529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: uCode overrides sequence control field in MAC header.
1449529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Driver provides sequence control field in MAC header.
1450529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for management frames, non-QOS data frames, non-unicast frames,
1451529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
145251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
1453b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1454529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: This frame is non-last MPDU; more fragments are coming.
1455529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Last fragment, or not using fragmentation. */
145651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
1457b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1458529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1459529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: No TSF required in outgoing frame.
1460529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for transmitting beacons and probe responses. */
146151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
1462b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1463529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1464529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *    alignment of frame's payload data field.
1465529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: No pad
1466529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1467529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * field (but not both).  Driver must align frame data (i.e. data following
1468529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MAC header) to DWORD boundary. */
146951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
1470b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
14718236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov/* accelerate aggregation support
14728236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov * 0 - no CCMP encryption; 1 - CCMP encryption */
147351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
14748236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov
1475b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* HCCA-AP - disable duration overwriting. */
147651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
1477b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1478529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1479b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1480b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX command security control
1481b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
1482b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_WEP  	0x01
1483b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_CCM  	0x02
1484b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_TKIP		0x03
1485b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_MSK		0x03
1486b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_SHIFT	6
1487b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_KEY128	0x08
1488b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1489b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
14903195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler * security overhead sizes
14913195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler */
14923195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define WEP_IV_LEN 4
14933195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define WEP_ICV_LEN 4
14943195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define CCMP_MIC_LEN 8
14953195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define TKIP_ICV_LEN 4
14963195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler
14973195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler/*
14983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * REPLY_TX = 0x1c (command)
14993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
15003d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_tx_cmd {
15023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
15033d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * MPDU byte count:
15043d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
15053d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * + 8 byte IV for CCM or TKIP (not used for WEP)
15063d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * + Data payload
15073d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * + 8-byte MIC (not used for CCM/WEP)
15083d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * NOTE:  Does not include Tx command bytes, post-MAC pad bytes,
15093d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
15103d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Range: 14-2342 bytes.
15113d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
15123d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 len;
15133d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15143d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
15153d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * MPDU or MSDU byte count for next frame.
15163d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Used for fragmentation and bursting, but not 11n aggregation.
15173d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Same as "len", but for next frame.  Set to 0 if not applicable.
15183d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
15193d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 next_frame_len;
15203d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15213d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 tx_flags;	/* TX_CMD_FLG_* */
15223d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15233d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rate;
15243d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15253d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* Index of recipient station in uCode's station table */
15263d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 sta_id;
15273d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 tid_tspec;
15283d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 sec_ctl;
15293d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 key[16];
15303d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	union {
15313d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		u8 byte[8];
15323d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le16 word[4];
15333d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le32 dw[2];
15343d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	} tkip_mic;
15353d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 next_frame_info;
15363d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	union {
15373d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le32 life_time;
15383d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le32 attempt;
15393d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	} stop_time;
15403d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 supp_rates[2];
15413d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rts_retry_limit;	/*byte 50 */
15423d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 data_retry_limit;	/*byte 51 */
15433d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	union {
15443d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le16 pm_frame_timeout;
15453d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		__le16 attempt_duration;
15463d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	} timeout;
15473d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15483d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
15493d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
15503d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
15513d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
15523d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 driver_txop;
15533d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15543d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
15553d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * MAC header goes here, followed by 2 bytes padding if MAC header
15563d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * length is 26 or 30 bytes, followed by payload data
15573d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
15583d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 payload[0];
15593d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct ieee80211_hdr hdr[0];
15603d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
15613d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15623d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/*
15633d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * REPLY_TX = 0x1c (response)
15643d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
15653d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_tx_resp {
15663d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 failure_rts;
15673d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 failure_frame;
15683d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 bt_kill_count;
15693d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 rate;
15703d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 wireless_media_time;
15713d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 status;		/* TX status */
15723d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
15733d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15743d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
15753d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/*
1576529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 4965 uCode updates these Tx attempt count values in host DRAM.
1577529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Used for managing Tx retries when expecting block-acks.
1578529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver should set these fields to 0.
1579b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
15802aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_dram_scratch {
1581529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 try_cnt;		/* Tx attempts */
1582529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 bt_kill_cnt;		/* Tx attempts blocked by Bluetooth device */
1583b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
1584b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1585b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
158683d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winklerstruct iwl_tx_cmd {
1587529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1588529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * MPDU byte count:
1589529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1590529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * + 8 byte IV for CCM or TKIP (not used for WEP)
1591529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * + Data payload
1592529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * + 8-byte MIC (not used for CCM/WEP)
1593529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * NOTE:  Does not include Tx command bytes, post-MAC pad bytes,
1594529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1595529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Range: 14-2342 bytes.
1596529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
1597b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 len;
1598529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1599529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1600529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * MPDU or MSDU byte count for next frame.
1601529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Used for fragmentation and bursting, but not 11n aggregation.
1602529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Same as "len", but for next frame.  Set to 0 if not applicable.
1603529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
1604b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 next_frame_len;
1605529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1606529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le32 tx_flags;	/* TX_CMD_FLG_* */
1607529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
16082aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	/* uCode may modify this field of the Tx command (in host DRAM!).
1609529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
16102aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	struct iwl_dram_scratch scratch;
1611529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1612529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1613529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le32 rate_n_flags;	/* RATE_MCS_* */
1614529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1615529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* Index of destination station in uCode's station table */
1616b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sta_id;
1617529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1618529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* Type of security encryption:  CCM or TKIP */
1619529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 sec_ctl;		/* TX_CMD_SEC_* */
1620529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1621529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1622529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial
1623529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set.  Normally "0" for
1624529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * data frames, this field may be used to selectively reduce initial
1625529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * rate (via non-0 value) for special frames (e.g. management), while
1626529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * still supporting rate scaling for all frames.
1627529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
1628b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 initial_rate_index;
1629b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved;
1630b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 key[16];
1631b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 next_frame_flags;
1632b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved2;
1633b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	union {
1634b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 life_time;
1635b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 attempt;
1636b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} stop_time;
1637529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1638529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* Host DRAM physical address pointer to "scratch" in this command.
1639529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Must be dword aligned.  "0" in dram_lsb_ptr disables usage. */
1640b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 dram_lsb_ptr;
1641b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 dram_msb_ptr;
1642529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1643b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 rts_retry_limit;	/*byte 50 */
1644b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 data_retry_limit;	/*byte 51 */
1645b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 tid_tspec;
1646b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	union {
1647b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le16 pm_frame_timeout;
1648b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le16 attempt_duration;
1649b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} timeout;
1650529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1651529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1652529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1653529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1654529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
1655b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 driver_txop;
1656529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1657529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1658529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * MAC header goes here, followed by 2 bytes padding if MAC header
1659529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * length is 26 or 30 bytes, followed by payload data
1660529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
1661b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 payload[0];
1662b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct ieee80211_hdr hdr[0];
1663b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1664b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
166504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy/* TX command response is sent after *3945* transmission attempts.
1666b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1667b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * NOTES:
1668b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1669b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FAIL_NEXT_FRAG
1670b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1671b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the fragment flag in the MAC header for the frame being transmitted
1672b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * is set and there is insufficient time to transmit the next frame, the
1673b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1674b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1675b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FIFO_UNDERRUN
1676b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1677b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Indicates the host did not provide bytes to the FIFO fast enough while
1678b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * a TX was in progress.
1679b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1680b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FAIL_MGMNT_ABORT
1681b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1682b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This status is only possible if the ABORT ON MGMT RX parameter was
1683b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * set to true with the TX command.
1684b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
1685b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the MSB of the status parameter is set then an abort sequence is
1686b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * required.  This sequence consists of the host activating the TX Abort
1687b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * control line, and then waiting for the TX Abort command response.  This
1688b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * indicates that a the device is no longer in a transmit state, and that the
1689b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * command FIFO has been cleared.  The host must then deactivate the TX Abort
1690b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * control line.  Receiving is still allowed in this case.
1691b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
1692b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
169304569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_SUCCESS = 0x01,
169404569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_DIRECT_DONE = 0x02,
169504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
169604569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
169704569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
169804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
169904569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
170004569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
170104569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_DEST_PS = 0x88,
170204569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_ABORTED = 0x89,
170304569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
170404569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
170504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
170604569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
170704569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
170804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
170904569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
171004569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
171104569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy};
171204569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy
171304569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy/*
171404569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy * TX command response is sent after *agn* transmission attempts.
171504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy *
171604569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy * both postpone and abort status are expected behavior from uCode. there is
171704569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy * no special operation required from driver; except for RFKILL_FLUSH,
171804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy * which required tx flush host command to flush all the tx frames in queues
171904569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy */
172004569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guyenum {
1721b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_SUCCESS = 0x01,
1722b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_DIRECT_DONE = 0x02,
172304569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	/* postpone TX */
172404569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_POSTPONE_DELAY = 0x40,
172504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
172604569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_POSTPONE_BT_PRIO = 0x42,
172704569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
172804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
172904569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	/* abort TX */
173004569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
1731b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
1732b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_LONG_LIMIT = 0x83,
1733b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
173404569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
173504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
1736b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1737b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_DEST_PS = 0x88,
173804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_HOST_ABORTED = 0x89,
1739b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_BT_RETRY = 0x8a,
1740b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_STA_INVALID = 0x8b,
1741b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1742b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_TID_DISABLE = 0x8d,
174304569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
1744b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
174504569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	/* uCode drop due to FW drop request */
174604569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_FW_DROP = 0x90,
174704569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	/*
174804569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	 * uCode drop due to station color mismatch
174904569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	 * between tx command and station table
175004569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	 */
175104569cbe7653fe0057acc46afc07f2c2fd2508b3Wey-Yi Guy	TX_STATUS_FAIL_STA_COLOR_MISMATCH_DROP = 0x91,
1752b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
1753b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1754b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	TX_PACKET_MODE_REGULAR		0x0000
1755b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	TX_PACKET_MODE_BURST_SEQ	0x0100
1756b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define	TX_PACKET_MODE_BURST_FIRST	0x0200
1757b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1758b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
1759b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_POWER_PA_NOT_ACTIVE = 0x0,
1760b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
1761b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1762b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
17633fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	TX_STATUS_MSK = 0x000000ff,		/* bits 0:7 */
1764b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_DELAY_MSK = 0x00000040,
1765b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_STATUS_ABORT_MSK = 0x00000080,
1766b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_PACKET_MODE_MSK = 0x0000ff00,	/* bits 8:15 */
1767b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_FIFO_NUMBER_MSK = 0x00070000,	/* bits 16:18 */
17683fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	TX_RESERVED = 0x00780000,		/* bits 19:22 */
1769b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_POWER_PA_DETECT_MSK = 0x7f800000,	/* bits 23:30 */
1770b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	TX_ABORT_REQUIRED_MSK = 0x80000000,	/* bits 31:31 */
1771b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
1772b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1773b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* *******************************
1774529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * TX aggregation status
1775b481de9ca074528fe8c429604e2777db8b89806aZhu Yi ******************************* */
1776b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1777b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
1778b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_TRANSMITTED = 0x00,
1779b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_UNDERRUN_MSK = 0x01,
1780b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_BT_PRIO_MSK = 0x02,
1781b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
1782b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_ABORT_MSK = 0x08,
1783b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
1784b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
1785b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
1786b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
1787b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
1788b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
1789b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_DUMP_TX_MSK = 0x200,
1790b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	AGG_TX_STATE_DELAY_TX_MSK = 0x400
1791b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
1792b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
17933fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define AGG_TX_STATE_LAST_SENT_MSK  (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
17943fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler				     AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
17953fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler				     AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
1796b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1797529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* # tx attempts for first frame in aggregation */
1798b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_TRY_CNT_POS 12
1799b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1800b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1801529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* Command ID and sequence number of Tx command for this frame */
1802b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_SEQ_NUM_POS 16
1803b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1804b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1805b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1806b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX = 0x1c (response)
1807529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1808529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This response may be in one of two slightly different formats, indicated
1809529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * by the frame_count field:
1810529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1811529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1)  No aggregation (frame_count == 1).  This reports Tx results for
1812529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     a single frame.  Multiple attempts, at various bit rates, may have
1813529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     been made for this frame.
1814529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1815529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 2)  Aggregation (frame_count > 1).  This reports Tx results for
1816529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     2 or more frames that used block-acknowledge.  All frames were
1817529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     transmitted at same rate.  Rate scaling may have been used if first
1818529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     frame in this new agg block failed in previous agg block(s).
1819529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1820529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     Note that, for aggregation, ACK (block-ack) status is not delivered here;
1821529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     block-ack has not been received by the time the 4965 records this status.
1822529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     This status relates to reasons the tx might have been blocked or aborted
1823529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     within the sending station (this 4965), rather than whether it was
1824529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *     received successfully by the destination station.
1825b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
1826001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunskystruct agg_tx_status {
1827001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le16 status;
1828001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le16 sequence;
1829001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky} __attribute__ ((packed));
1830001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky
1831bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_tx_resp {
1832b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 frame_count;		/* 1 no aggregation, >1 aggregation */
1833529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 bt_kill_count;	/* # blocked by bluetooth (unused for agg) */
1834529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 failure_rts;		/* # failures due to unsuccessful RTS */
1835529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	u8 failure_frame;	/* # failures due to no ACK (unused for agg) */
1836529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1837529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* For non-agg:  Rate at which frame was successful.
1838529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * For agg:  Rate at which all frames were transmitted. */
1839529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le32 rate_n_flags;	/* RATE_MCS_*  */
1840529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1841529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* For non-agg:  RTS + CTS + frame tx attempts time + ACK.
1842529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * For agg:  RTS + CTS + aggregation tx time + block-ack time. */
1843529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le16 wireless_media_time;	/* uSecs */
1844529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1845b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
1846529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	__le32 pa_power1;	/* RF power amplifier measurement (not used) */
1847b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 pa_power2;
1848529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1849529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/*
1850529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * For non-agg:  frame status TX_STATUS_*
1851529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 * For agg:  status of 1st frame, AGG_TX_STATE_*; other frame status
1852529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *           fields follow this one, up to frame_count.
1853529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *           Bit fields:
1854529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *           11- 0:  AGG_TX_STATE_* status code
1855529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *           15-12:  Retry count for 1st frame in aggregation (retries
1856529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *                   occur if tx failed for this frame when it was a
1857529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *                   member of a previous aggregation block).  If rate
1858529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *                   scaling is used, retry count indicates the rate
1859529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *                   table entry used for all frames in the new agg.
1860529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 *           31-16:  Sequence # for this frame's Tx cmd (not SSN!)
1861529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	 */
186225a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler	union {
186325a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler		__le32 status;
186425a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler		struct agg_tx_status agg_status[0]; /* for each agg frame */
186525a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler	} u;
1866fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky} __attribute__ ((packed));
1867fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky
18683fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler/*
18693fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * definitions for initial rate index field
1870a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * bits [3:0] initial rate index
18713fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * bits [6:4] rate table color, used for the initial rate
18723fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * bit-7 invalid rate indication
18733fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler *   i.e. rate was not chosen from rate table
18743fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler *   or rate table color was changed during frame retries
18753fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * refer tlc rate info
18763fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler */
18773fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler
18783fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INIT_RATE_INDEX_POS	0
18793fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INIT_RATE_INDEX_MSK	0x0f
18803fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RATE_TABLE_COLOR_POS	4
18813fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RATE_TABLE_COLOR_MSK	0x70
18823fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INV_RATE_INDEX_MSK	0x80
18833fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler
18843fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler/* refer to ra_tid */
18853fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_TID_POS	0
18863fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_TID_MSK	0x0f
18873fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RA_POS	4
18883fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RA_MSK	0xf0
18893fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler
1890001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunskystruct iwl5000_tx_resp {
1891001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	u8 frame_count;		/* 1 no aggregation, >1 aggregation */
1892001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	u8 bt_kill_count;	/* # blocked by bluetooth (unused for agg) */
1893001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	u8 failure_rts;		/* # failures due to unsuccessful RTS */
1894001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	u8 failure_frame;	/* # failures due to no ACK (unused for agg) */
1895001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky
1896001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	/* For non-agg:  Rate at which frame was successful.
1897001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 * For agg:  Rate at which all frames were transmitted. */
1898001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le32 rate_n_flags;	/* RATE_MCS_*  */
1899001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky
1900001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	/* For non-agg:  RTS + CTS + frame tx attempts time + ACK.
1901001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 * For agg:  RTS + CTS + aggregation tx time + block-ack time. */
1902001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le16 wireless_media_time;	/* uSecs */
1903001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky
19043fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 pa_status;		/* RF power amplifier measurement (not used) */
19053fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 pa_integ_res_a[3];
19063fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 pa_integ_res_b[3];
19073fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 pa_integ_res_C[3];
1908001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky
1909001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le32 tfd_info;
1910001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le16 seq_ctl;
1911001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	__le16 byte_cnt;
19123fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 tlc_info;
19133fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	u8 ra_tid;		/* tid (0:3), sta_id (4:7) */
19143fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler	__le16 frame_ctrl;
1915001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	/*
1916001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 * For non-agg:  frame status TX_STATUS_*
1917001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 * For agg:  status of 1st frame, AGG_TX_STATE_*; other frame status
1918001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *           fields follow this one, up to frame_count.
1919001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *           Bit fields:
1920001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *           11- 0:  AGG_TX_STATE_* status code
1921001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *           15-12:  Retry count for 1st frame in aggregation (retries
1922001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *                   occur if tx failed for this frame when it was a
1923001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *                   member of a previous aggregation block).  If rate
1924001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *                   scaling is used, retry count indicates the rate
1925001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *                   table entry used for all frames in the new agg.
1926001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 *           31-16:  Sequence # for this frame's Tx cmd (not SSN!)
1927001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	 */
1928001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky	struct agg_tx_status status;	/* TX status (in aggregation -
1929001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky					 * status of 1st frame) */
1930001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky} __attribute__ ((packed));
1931b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1932b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
1933529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill *
1934529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Reports Block-Acknowledge from recipient station
1935b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
1936653fa4a07525e4cd9e7b90e6fc1f792119910636Emmanuel Grumbachstruct iwl_compressed_ba_resp {
1937b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sta_addr_lo32;
1938b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 sta_addr_hi16;
1939b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
1940529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill
1941529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill	/* Index of recipient (BA-sending) station in uCode's station table */
1942b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sta_id;
1943b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 tid;
1944fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky	__le16 seq_ctl;
1945fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky	__le64 bitmap;
1946b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 scd_flow;
1947b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 scd_ssn;
1948b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1949b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
1950b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
1951b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
19522bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
19532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * See details under "TXPOWER" in iwl-4965-hw.h.
1954b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
19553d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
19563d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_txpowertable_cmd {
19573d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 band;		/* 0: 5 GHz, 1: 2.4 GHz */
19583d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved;
19593d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 channel;
19603d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_power_per_rate power[IWL_MAX_RATES];
19613d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
19623d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
1963bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_txpowertable_cmd {
1964b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 band;		/* 0: 5 GHz, 1: 2.4 GHz */
1965b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved;
1966b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel;
1967bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig	struct iwl4965_tx_power_db tx_power;
1968b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
1969b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
19703d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
19713d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/**
19723d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
19733d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
19743d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
19753d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
19763d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * NOTE: The table of rates passed to the uCode via the
19773d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * RATE_SCALE command sets up the corresponding order of
19783d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * rates used for all related commands, including rate
19793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * masks, etc.
19803d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler *
19813d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * For example, if you set 9MB (PLCP 0x0f) as the first
19823d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * rate in the rate table, the bit mask for that rate
19833d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * when passed through ofdm_basic_rates on the REPLY_RXON
19843d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler * command would be bit 0 (1 << 0)
19853d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler */
19863d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rate_scaling_info {
19873d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 rate_n_flags;
19883d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 try_cnt;
19893d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 next_rate_index;
19903d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
19913d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
19923d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_rate_scaling_cmd {
19933d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 table_id;
19943d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved[3];
19953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
19963d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
19973d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
19983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
1999b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
20008a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define  LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK	(1 << 0)
2001b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
20022bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* # of EDCA prioritized tx fifos */
2003b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define  LINK_QUAL_AC_NUM AC_NUM
20042bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20052bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* # entries in rate scale table to support Tx retries */
2006b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define  LINK_QUAL_MAX_RETRY_NUM 16
2007b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
20082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* Tx antenna selection values */
20098a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define  LINK_QUAL_ANT_A_MSK (1 << 0)
20108a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define  LINK_QUAL_ANT_B_MSK (1 << 1)
2011b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define  LINK_QUAL_ANT_MSK   (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
2012b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
20132bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20142bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/**
201566c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler * struct iwl_link_qual_general_params
20162bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20172bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Used in REPLY_TX_LINK_QUALITY_CMD
20182bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */
201966c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_qual_general_params {
2020b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 flags;
20212bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/* No entries at or above this (driver chosen) index contain MIMO */
2023b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 mimo_delimiter;
20242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20252bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/* Best single antenna to use for single stream (legacy, SISO). */
20262bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	u8 single_stream_ant_msk;	/* LINK_QUAL_ANT_* */
20272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/* Best antennas to use for MIMO (unused for 4965, assumes both). */
20292bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	u8 dual_stream_ant_msk;		/* LINK_QUAL_ANT_* */
20302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/*
20322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * If driver needs to use different initial rates for different
20332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * EDCA QOS access categories (as implemented by tx fifos 0-3),
20342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * this table will set that up, by indicating the indexes in the
20352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
20362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Otherwise, driver should set all entries to 0.
20372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 *
20382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Entry usage:
20392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
20402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
20412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 */
2042b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 start_rate_index[LINK_QUAL_AC_NUM];
2043b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2044b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
204513c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_TIME_LIMIT_DEF	(4000) /* 4 milliseconds */
204613c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_TIME_LIMIT_MAX	(65535)
204713c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_TIME_LIMIT_MIN	(0)
204813c33a09b3703c2956345482017600434c853889Wey-Yi Guy
204913c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_DISABLE_START_DEF	(3)
205013c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_DISABLE_START_MAX	(255)
205113c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_DISABLE_START_MIN	(0)
205213c33a09b3703c2956345482017600434c853889Wey-Yi Guy
205313c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_FRAME_LIMIT_DEF	(31)
2054b623a9f7c488e51dbe4320d8b5cdd0ba242d0067Johannes Berg#define LINK_QUAL_AGG_FRAME_LIMIT_MAX	(63)
205513c33a09b3703c2956345482017600434c853889Wey-Yi Guy#define LINK_QUAL_AGG_FRAME_LIMIT_MIN	(0)
205613c33a09b3703c2956345482017600434c853889Wey-Yi Guy
20572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/**
205866c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler * struct iwl_link_qual_agg_params
20592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20602bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Used in REPLY_TX_LINK_QUALITY_CMD
20612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */
206266c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_qual_agg_params {
20632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/* Maximum number of uSec in aggregation.
20652bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Driver should set this to 4000 (4 milliseconds). */
2066b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 agg_time_limit;
20672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20682bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/*
20692bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Number of Tx retries allowed for a frame, before that frame will
20702bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * no longer be considered for the start of an aggregation sequence
20712bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * (scheduler will then try to tx it as single frame).
20722bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Driver should set this to 3.
20732bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 */
2074b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 agg_dis_start_th;
20752bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
20762bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/*
20772bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Maximum number of frames in aggregation.
20782bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * 0 = no limit (default).  1 = no aggregation.
20792bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Other values = max # frames in aggregation.
20802bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 */
2081b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 agg_frame_cnt_limit;
20822bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
2083b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved;
2084b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2085b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2086b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2087b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
20882bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20892bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For 4965 only; 3945 uses REPLY_RATE_SCALE.
20902bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20912bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Each station in the 4965's internal station table has its own table of 16
20922bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
20932bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * an ACK is not received.  This command replaces the entire table for
20942bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * one station.
20952bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20962bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * NOTE:  Station must already be in 4965's station table.  Use REPLY_ADD_STA.
20972bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
20982bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The rate scaling procedures described below work well.  Of course, other
20992bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * procedures are possible, and may work better for particular environments.
21002bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21012bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21022bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FILLING THE RATE TABLE
21032bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21042bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Given a particular initial rate and mode, as determined by the rate
21052bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * scaling algorithm described below, the Linux driver uses the following
21062bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
21072bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Link Quality command:
21082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21092bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21102bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 1)  If using High-throughput (HT) (SISO or MIMO) initial rate:
21112bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a) Use this same initial rate for first 3 entries.
21122bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b) Find next lower available rate using same mode (SISO or MIMO),
21132bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        use for next 3 entries.  If no lower rate available, switch to
21147aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy *        legacy mode (no HT40 channel, no MIMO, no short guard interval).
21152bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c) If using MIMO, set command's mimo_delimiter to number of entries
21162bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        using MIMO (3 or 6).
21177aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy *     d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
21182bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        no MIMO, no short guard interval), at the next lower bit rate
21192bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        (e.g. if second HT bit rate was 54, try 48 legacy), and follow
21202bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        legacy procedure for remaining table entries.
21212bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 2)  If using legacy initial rate:
21232bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a) Use the initial rate for only one entry.
21242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b) For each following entry, reduce the rate to next lower available
21252bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        rate, until reaching the lowest available rate.
21262bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c) When reducing rate, also switch antenna selection.
21272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     d) Once lowest available rate is reached, repeat this rate until
21282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *        rate table is filled (16 entries), switching antenna each entry.
21292bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * ACCUMULATING HISTORY
21322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The rate scaling algorithm for 4965, as implemented in Linux driver, uses
21342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * two sets of frame Tx success history:  One for the current/active modulation
21352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode, and one for a speculative/search mode that is being attempted.  If the
21362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * speculative mode turns out to be more effective (i.e. actual transfer
21372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate is better), then the driver continues to use the speculative mode
21382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * as the new current active mode.
21392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Each history set contains, separately for each possible rate, data for a
21412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * sliding window of the 62 most recent tx attempts at that rate.  The data
21422bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * includes a shifting bitmap of success(1)/failure(0), and sums of successful
21432bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * and attempted frames, from which the driver can additionally calculate a
21442bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * success ratio (success / attempted) and number of failures
21452bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (attempted - success), and control the size of the window (attempted).
21462bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The driver uses the bit map to remove successes from the success sum, as
21472bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the oldest tx attempts fall out of the window.
21482bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21492bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When the 4965 makes multiple tx attempts for a given frame, each attempt
21502bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * might be at a different rate, and have different modulation characteristics
21512bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (e.g. antenna, fat channel, short guard interval), as set up in the rate
21522bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * scaling table in the Link Quality command.  The driver must determine
21532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * which rate table entry was used for each tx attempt, to determine which
21542bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate-specific history to update, and record only those attempts that
21552bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * match the modulation characteristics of the history set.
21562bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When using block-ack (aggregation), all frames are transmitted at the same
2158a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * rate, since there is no per-attempt acknowledgment from the destination
21592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * station.  The Tx response struct iwl_tx_resp indicates the Tx rate in
21602bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate_n_flags field.  After receiving a block-ack, the driver can update
21612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * history for the entire block all at once.
21622bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FINDING BEST STARTING RATE:
21652bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21662bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When working with a selected initial modulation mode (see below), the
21672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * driver attempts to find a best initial rate.  The initial rate is the
21682bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * first entry in the Link Quality command's rate table.
21692bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21702bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 1)  Calculate actual throughput (success ratio * expected throughput, see
21712bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     table below) for current initial rate.  Do this only if enough frames
21722bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     have been attempted to make the value meaningful:  at least 6 failed
21732bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     tx attempts, or at least 8 successes.  If not enough, don't try rate
21742bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     scaling yet.
21752bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21762bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 2)  Find available rates adjacent to current initial rate.  Available means:
21772bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a)  supported by hardware &&
21782bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b)  supported by association &&
21792bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c)  within any constraints selected by user
21802bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21812bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 3)  Gather measured throughputs for adjacent rates.  These might not have
21822bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     enough history to calculate a throughput.  That's okay, we might try
21832bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     using one of them anyway!
21842bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21852bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 4)  Try decreasing rate if, for current rate:
21862bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a)  success ratio is < 15% ||
21872bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b)  lower adjacent rate has better measured throughput ||
21882bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c)  higher adjacent rate has worse throughput, and lower is unmeasured
21892bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21902bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     As a sanity check, if decrease was determined above, leave rate
21912bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     unchanged if:
21922bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a)  lower rate unavailable
21932bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b)  success ratio at current rate > 85% (very good)
21942bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c)  current measured throughput is better than expected throughput
21952bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *         of lower rate (under perfect 100% tx conditions, see table below)
21962bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
21972bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 5)  Try increasing rate if, for current rate:
21982bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a)  success ratio is < 15% ||
21992bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b)  both adjacent rates' throughputs are unmeasured (try it!) ||
22002bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     b)  higher adjacent rate has better measured throughput ||
22012bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     c)  lower adjacent rate has worse throughput, and higher is unmeasured
22022bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22032bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     As a sanity check, if increase was determined above, leave rate
22042bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     unchanged if:
22052bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     a)  success ratio at current rate < 70%.  This is not particularly
22062bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *         good performance; higher rate is sure to have poorer success.
22072bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 6)  Re-evaluate the rate after each tx frame.  If working with block-
22092bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     acknowledge, history and statistics may be calculated for the entire
22102bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     block (including prior history that fits within the history windows),
22112bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     before re-evaluation.
22122bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22132bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FINDING BEST STARTING MODULATION MODE:
22142bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22152bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * After working with a modulation mode for a "while" (and doing rate scaling),
22162bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the driver searches for a new initial mode in an attempt to improve
22172bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * throughput.  The "while" is measured by numbers of attempted frames:
22182bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22192bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For legacy mode, search for new mode after:
22202bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *   480 successful frames, or 160 failed frames
22212bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For high-throughput modes (SISO or MIMO), search for new mode after:
22222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *   4500 successful frames, or 400 failed frames
22232bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Mode switch possibilities are (3 for each mode):
22252bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22262bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For legacy:
22272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *   Change antenna, try SISO (if HT association), try MIMO (if HT association)
22282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For SISO:
22292bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *   Change antenna, try MIMO, try shortened guard interval (SGI)
22302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For MIMO:
22312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *   Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
22322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When trying a new mode, use the same bit rate as the old/current mode when
22342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * trying antenna switches and shortened guard interval.  When switching to
22352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
22362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * for which the expected throughput (under perfect conditions) is about the
22372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * same or slightly better than the actual measured throughput delivered by
22382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the old/current mode.
22392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Actual throughput can be estimated by multiplying the expected throughput
22412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * by the success ratio (successful / attempted tx frames).  Frame size is
22422bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * not considered in this calculation; it assumes that frame size will average
22432bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * out to be fairly consistent over several samples.  The following are
22442bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * metric values for expected throughput assuming 100% success ratio.
22452bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Only G band has support for CCK rates:
22462bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22472bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *           RATE:  1    2    5   11    6   9   12   18   24   36   48   54   60
22482bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22492bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *              G:  7   13   35   58   40  57   72   98  121  154  177  186  186
22502bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *              A:  0    0    0    0   40  57   72   98  121  154  177  186  186
22512bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     SISO 20MHz:  0    0    0    0   42  42   76  102  124  159  183  193  202
22522bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI SISO 20MHz:  0    0    0    0   46  46   82  110  132  168  192  202  211
22532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     MIMO 20MHz:  0    0    0    0   74  74  123  155  179  214  236  244  251
22542bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI MIMO 20MHz:  0    0    0    0   81  81  131  164  188  222  243  251  257
22552bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     SISO 40MHz:  0    0    0    0   77  77  127  160  184  220  242  250  257
22562bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI SISO 40MHz:  0    0    0    0   83  83  135  169  193  229  250  257  264
22572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *     MIMO 40MHz:  0    0    0    0  123 123  182  214  235  264  279  285  289
22582bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI MIMO 40MHz:  0    0    0    0  131 131  191  222  242  270  284  289  293
22592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22602bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * After the new mode has been tried for a short while (minimum of 6 failed
22612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * frames or 8 successful frames), compare success ratio and actual throughput
22622bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * estimate of the new mode with the old.  If either is better with the new
22632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode, continue to use the new mode.
22642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
22652bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Continue comparing modes until all 3 possibilities have been tried.
22662bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * If moving from legacy to HT, try all 3 possibilities from the new HT
22672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode.  After trying all 3, a best mode is found.  Continue to use this mode
22682bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * for the longer "while" described above (e.g. 480 successful frames for
22692bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * legacy), and then repeat the search process.
22702bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill *
2271b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
227266c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_quality_cmd {
22732bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
22742bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/* Index of destination/recipient station in uCode's station table */
2275b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 sta_id;
2276b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
22772bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	__le16 control;		/* not used */
227866c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler	struct iwl_link_qual_general_params general_params;
227966c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler	struct iwl_link_qual_agg_params agg_params;
22802bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill
22812bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	/*
22822bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * Rate info; when using rate-scaling, Tx command's initial_rate_index
22832bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * specifies 1st Tx rate attempted, via index into this table.
22842bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 * 4965 works its way through table when retrying Tx.
22852bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill	 */
2286b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct {
22872bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill		__le32 rate_n_flags;	/* RATE_MCS_*, IWL_RATE_* */
2288b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} rs_table[LINK_QUAL_MAX_RETRY_NUM];
2289b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved2;
2290b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2291b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2292dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy/*
2293dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy * BT configuration enable flags:
2294dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *   bit 0 - 1: BT channel announcement enabled
2295dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *           0: disable
2296dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *   bit 1 - 1: priority of BT device enabled
2297dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *           0: disable
2298dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *   bit 2 - 1: BT 2 wire support enabled
2299dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy *           0: disable
2300dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy */
2301456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_COEX_DISABLE (0x0)
2302dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2303dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy#define BT_ENABLE_PRIORITY	   BIT(1)
2304dab1c161fed18eb6b3472bdbfd827264caae097fWey-Yi Guy#define BT_ENABLE_2_WIRE	   BIT(2)
2305456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy
230606702a735eacf8679e9ff0d49eb3c989bc6b96ceWey-Yi Guy#define BT_COEX_DISABLE (0x0)
230706702a735eacf8679e9ff0d49eb3c989bc6b96ceWey-Yi Guy#define BT_COEX_ENABLE  (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
230806702a735eacf8679e9ff0d49eb3c989bc6b96ceWey-Yi Guy
2309456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_LEAD_TIME_MIN (0x0)
2310456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_LEAD_TIME_DEF (0x1E)
2311456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_LEAD_TIME_MAX (0xFF)
2312456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy
2313456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_MAX_KILL_MIN (0x1)
2314456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_MAX_KILL_DEF (0x5)
2315456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy#define BT_MAX_KILL_MAX (0xFF)
2316456d0f76727ba6f97aa1cee63f1bae84642768c4Wey-Yi Guy
2317b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2318b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
23193058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
23203058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3945 and 4965 support hardware handshake with Bluetooth device on
23213058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * same platform.  Bluetooth device alerts wireless device when it will Tx;
2322a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * wireless device can delay or kill its own Tx to accommodate.
2323b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
23242aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_bt_cmd {
2325b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 flags;
2326b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 lead_time;
2327b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 max_kill;
2328b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved;
2329b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 kill_ack_mask;
2330b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 kill_cts_mask;
2331b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2332b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2333b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2334b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (6)
2335b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Spectrum Management (802.11h) Commands, Responses, Notifications:
2336b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2337b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
2338b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2339b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2340b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Spectrum Management
2341b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
2342b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK         | \
2343b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_CTL2HOST_MSK        | \
2344b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_ACCEPT_GRP_MSK      | \
2345b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_DIS_DECRYPT_MSK     | \
2346b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2347b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_ASSOC_MSK           | \
2348b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 RXON_FILTER_BCON_AWARE_MSK)
2349b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
23502aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measure_channel {
2351b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 duration;	/* measurement duration in extended beacon
2352b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * format */
2353b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 channel;		/* channel to measure */
23542aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	u8 type;		/* see enum iwl_measure_type */
2355b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
2356b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2357b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2358b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2359b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
2360b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
23612aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_cmd {
2362b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 len;		/* number of bytes starting from token */
2363b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 token;		/* token id */
2364b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 id;			/* measurement id -- 0 or 1 */
2365b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 origin;		/* 0 = TGh, 1 = other, 2 = TGk */
2366b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 periodic;		/* 1 = periodic */
2367b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 path_loss_timeout;
2368b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 start_time;	/* start time in extended beacon format */
2369b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved2;
2370b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 flags;		/* rxon flags */
2371b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 filter_flags;	/* rxon filter flags */
2372b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 channel_count;	/* minimum 1, maximum 10 */
2373b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved3;
23742aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	struct iwl_measure_channel channels[10];
2375b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2376b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2377b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2378b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
2379b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
23802aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_resp {
2381b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 token;
2382b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 id;			/* id of the prior command replaced, or 0xff */
2383b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 status;		/* 0 - command will be handled
2384b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * 1 - cannot handle (conflicts with another
2385b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 *     measurement) */
2386b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2387b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
23882aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measurement_state {
2389b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_START = 0,
2390b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_STOP = 1,
2391b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
2392b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
23932aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measurement_status {
2394b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_OK = 0,
2395b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_CONCURRENT = 1,
2396b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_CSA_CONFLICT = 2,
2397b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_TGH_CONFLICT = 3,
2398b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* 4-5 reserved */
2399b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_STOPPED = 6,
2400b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_TIMEOUT = 7,
2401b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASUREMENT_PERIODIC_FAILED = 8,
2402b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
2403b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2404b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define NUM_ELEMENTS_IN_HISTOGRAM 8
2405b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
24062aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measurement_histogram {
2407b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM];	/* in 0.8usec counts */
2408b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cck[NUM_ELEMENTS_IN_HISTOGRAM];	/* in 1usec counts */
2409b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2410b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2411b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* clear channel availability counters */
24122aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measurement_cca_counters {
2413b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ofdm;
2414b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cck;
2415b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2416b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
24172aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measure_type {
2418b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_BASIC = (1 << 0),
2419b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
2420b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2421b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2422b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_FRAME = (1 << 4),
2423b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* bits 5:6 are reserved */
2424b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_MEASURE_IDLE = (1 << 7),
2425b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
2426b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2427b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2428b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
2429b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
24302aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_notification {
2431b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 id;			/* measurement id -- 0 or 1 */
2432b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 token;
2433b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 channel_index;	/* index in measurement channel list */
2434b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 state;		/* 0 - start, 1 - stop */
2435b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 start_time;	/* lower 32-bits of TSF */
2436b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 band;		/* 0 - 5.2GHz, 1 - 2.4GHz */
2437b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 channel;
24382aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	u8 type;		/* see enum iwl_measurement_type */
2439b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
2440b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* NOTE:  cca_ofdm, cca_cck, basic_type, and histogram are only only
2441b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 * valid if applicable for measurement type requested. */
2442b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cca_ofdm;	/* cca fraction time in 40Mhz clock periods */
2443b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cca_cck;		/* cca fraction time in 44Mhz clock periods */
2444b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cca_time;	/* channel load time in usecs */
2445b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 basic_type;		/* 0 - bss, 1 - ofdm preamble, 2 -
2446b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * unidentified */
2447b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved2[3];
24482aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	struct iwl_measurement_histogram histogram;
2449b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 stop_time;	/* lower 32-bits of TSF */
24502aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	__le32 status;		/* see iwl_measurement_status */
2451b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2452b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2453b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2454b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (7)
2455b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Power Management Commands, Responses, Notifications:
2456b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2457b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
2458b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2459b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/**
2460ca579617d81baf5865498eb5fae58e453ee77c2cMohamed Abbas * struct iwl_powertable_cmd - Power Table Command
2461b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * @flags: See below:
2462b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2463b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
2464b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2465b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PM allow:
2466b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *   bit 0 - '0' Driver not allow power management
2467b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *           '1' Driver allow PM (use rest of parameters)
2468e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *
2469b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * uCode send sleep notifications:
2470b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *   bit 1 - '0' Don't send sleep notification
2471b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *           '1' send sleep notification (SEND_PM_NOTIFICATION)
2472e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *
2473b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Sleep over DTIM
2474b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *   bit 2 - '0' PM have to walk up every DTIM
2475b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *           '1' PM could sleep over DTIM till listen Interval.
2476e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *
2477b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PCI power managed
2478e7b635814b640c6fd9dca1c254dc22fac6fb9a1aTomas Winkler *   bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2479e7b635814b640c6fd9dca1c254dc22fac6fb9a1aTomas Winkler *           '1' !(PCI_CFG_LINK_CTRL & 0x1)
2480e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *
2481e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg * Fast PD
2482e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *   bit 4 - '1' Put radio to sleep when receiving frame for others
2483e312c24cf8229f9b6e76dbfd5d99eefe21f4ac0aJohannes Berg *
2484b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Force sleep Modes
2485b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *   bit 31/30- '00' use both mac/xtal sleeps
2486b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *              '01' force Mac sleep
2487b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *              '10' force xtal sleep
2488b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *              '11' Illegal set
2489b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2490b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
2491a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * ucode assume sleep over DTIM is allowed and we don't need to wake up
2492b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * for every DTIM.
2493b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
2494b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_POWER_VEC_SIZE 5
2495b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2496600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK	cpu_to_le16(BIT(0))
2497600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_SLEEP_OVER_DTIM_MSK		cpu_to_le16(BIT(2))
2498600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_PCI_PM_MSK			cpu_to_le16(BIT(3))
2499600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_FAST_PD			cpu_to_le16(BIT(4))
2500600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler
2501600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winklerstruct iwl3945_powertable_cmd {
2502600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	__le16 flags;
2503600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	u8 reserved[2];
2504600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	__le32 rx_data_timeout;
2505600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	__le32 tx_data_timeout;
2506600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
2507600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler} __attribute__ ((packed));
2508b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2509ca579617d81baf5865498eb5fae58e453ee77c2cMohamed Abbasstruct iwl_powertable_cmd {
2510b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 flags;
2511600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	u8 keep_alive_seconds;		/* 3945 reserved */
2512600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler	u8 debug_flags;			/* 3945 reserved */
2513b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rx_data_timeout;
2514b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tx_data_timeout;
2515b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
2516b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 keep_alive_beacons;
2517b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2518b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2519b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2520b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
2521b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 3945 and 4965 identical.
2522b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
25232aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_sleep_notification {
2524b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 pm_sleep_mode;
2525b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 pm_wakeup_src;
2526b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 reserved;
2527b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sleep_time;
2528b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_low;
2529b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bcon_timer;
2530b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2531b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2532b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Sleep states.  3945 and 4965 identical. */
2533b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum {
2534b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_NO_SLEEP = 0,
2535b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_SLP_MAC = 1,
2536b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2537b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2538b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_SLP_PHY = 4,
2539b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_SLP_REPENT = 5,
2540b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_WAKEUP_BY_TIMER = 6,
2541b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_WAKEUP_BY_DRIVER = 7,
2542b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_WAKEUP_BY_RFKILL = 8,
2543b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/* 3 reserved */
2544b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	IWL_PM_NUM_OF_MODES = 12,
2545b481de9ca074528fe8c429604e2777db8b89806aZhu Yi};
2546b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2547b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2548b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
2549b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
2550b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_DISABLE 0x00	/* Put card to sleep */
2551b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_ENABLE  0x01	/* Wake up card */
2552b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_HALT    0x02	/* Power down permanently */
25532aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_card_state_cmd {
2554b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 status;		/* CARD_STATE_CMD_* request new power state */
2555b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2556b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2557b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2558b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
2559b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
25602aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_card_state_notif {
2561b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 flags;
2562b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2563b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2564b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define HW_CARD_DISABLED   0x01
2565b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SW_CARD_DISABLED   0x02
25663a41bbd515d449604f3488c5f8dd62802f09d19bWey-Yi Guy#define CT_CARD_DISABLED   0x04
2567b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define RXON_CARD_DISABLED 0x10
2568b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
256947f4a5871614756627d7209e0569b58faf99b0d9Emmanuel Grumbachstruct iwl_ct_kill_config {
2570b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32   reserved;
2571b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32   critical_temperature_M;
2572b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32   critical_temperature_R;
2573b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}  __attribute__ ((packed));
2574b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2575672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy/* 1000, and 6x00 */
2576672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guystruct iwl_ct_kill_throttling_config {
2577672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy	__le32   critical_temperature_exit;
2578672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy	__le32   reserved;
2579672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy	__le32   critical_temperature_enter;
2580672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy}  __attribute__ ((packed));
2581672639de13c4db92ed6a47e68043a4317e219902Wey-Yi Guy
2582b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2583b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (8)
2584b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Scan Commands, Responses, Notifications:
2585b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2586b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
2587b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
258851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
258951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SCAN_CHANNEL_TYPE_ACTIVE  cpu_to_le32(1)
2590d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler
25913058f02137359efb412975cf94a9fa7c25413387Ben M Cahill/**
25922a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
25933058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
25943058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * One for each channel in the scan list.
25953058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Each channel can independently select:
25963058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1)  SSID for directed active scans
25973058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2)  Txpower setting (for rate specified within Tx command)
25983058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3)  How long to stay on-channel (behavior may be modified by quiet_time,
25993058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     quiet_plcp_th, good_CRC_th)
26003058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26013058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * To avoid uCode errors, make sure the following are true (see comments
26022a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * under struct iwl_scan_cmd about max_out_time and quiet_time):
26033058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1)  If using passive_dwell (i.e. passive_dwell != 0):
26043058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
26053058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2)  quiet_time <= active_dwell
26063058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3)  If restricting off-channel time (i.e. max_out_time !=0):
26073058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     passive_dwell < max_out_time
26083058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     active_dwell < max_out_time
26093058f02137359efb412975cf94a9fa7c25413387Ben M Cahill */
26103d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
26113d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler/* FIXME: rename to AP1, remove tpc */
26123d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_scan_channel {
26133d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
26143d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * type is defined as:
26153d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * 0:0 1 = active, 0 = passive
26163d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * 1:4 SSID direct bit map; if a bit is set, then corresponding
26173d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 *     SSID IE is transmitted in probe request.
26183d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * 5:7 reserved
26193d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
26203d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 type;
26213d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 channel;	/* band is selected by iwl3945_scan_cmd "flags" field */
26223d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_tx_power tpc;
26233d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 active_dwell;	/* in 1024-uSec TU (time units), typ 5-50 */
26243d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 passive_dwell;	/* in 1024-uSec TU (time units), typ 20-500 */
26253d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
26263d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
26270d21044effa10044930419c6f837f75191229c3aWinkler, Tomas/* set number of direct probes u8 type */
26280d21044effa10044930419c6f837f75191229c3aWinkler, Tomas#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
26290d21044effa10044930419c6f837f75191229c3aWinkler, Tomas
26302a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scan_channel {
26313058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	/*
26323058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * type is defined as:
26333058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * 0:0 1 = active, 0 = passive
2634d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler	 * 1:20 SSID direct bit map; if a bit is set, then corresponding
26353058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 *     SSID IE is transmitted in probe request.
2636d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler	 * 21:31 reserved
2637b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 */
2638d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler	__le32 type;
2639d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler	__le16 channel;	/* band is selected by iwl_scan_cmd "flags" field */
2640f53696de6722a4aac00b76e25a5321c01e88a55fTomas Winkler	u8 tx_gain;		/* gain for analog radio */
2641f53696de6722a4aac00b76e25a5321c01e88a55fTomas Winkler	u8 dsp_atten;		/* gain for DSP */
26423058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 active_dwell;	/* in 1024-uSec TU (time units), typ 5-50 */
26433058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 passive_dwell;	/* in 1024-uSec TU (time units), typ 20-500 */
2644b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2645b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
26460d21044effa10044930419c6f837f75191229c3aWinkler, Tomas/* set number of direct probes __le32 type */
26470d21044effa10044930419c6f837f75191229c3aWinkler, Tomas#define IWL_SCAN_PROBE_MASK(n) 	cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
26480d21044effa10044930419c6f837f75191229c3aWinkler, Tomas
26493058f02137359efb412975cf94a9fa7c25413387Ben M Cahill/**
26502a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_ssid_ie - directed scan network information element
26513058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26522a3b793d6a0ff30ad4a541230a6dba2ecb6fff1bBen M Cahill * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
26532a3b793d6a0ff30ad4a541230a6dba2ecb6fff1bBen M Cahill * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel;
26542a3b793d6a0ff30ad4a541230a6dba2ecb6fff1bBen M Cahill * each channel may select different ssids from among the 20 (4) entries.
26552a3b793d6a0ff30ad4a541230a6dba2ecb6fff1bBen M Cahill * SSID IEs get transmitted in reverse order of entry.
26563058f02137359efb412975cf94a9fa7c25413387Ben M Cahill */
26572a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_ssid_ie {
2658b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 id;
2659b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 len;
2660b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 ssid[32];
2661b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2662b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
26639b3bf06abad70db820c74c90118ea49358549d22Johannes Berg#define PROBE_OPTION_MAX_3945		4
26649b3bf06abad70db820c74c90118ea49358549d22Johannes Berg#define PROBE_OPTION_MAX		20
266551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_LIFE_TIME_INFINITE	cpu_to_le32(0xFFFFFFFF)
266696ff56419504ac6a610ff1af42330e0423242e16Johannes Berg#define IWL_GOOD_CRC_TH_DISABLED	0
266796ff56419504ac6a610ff1af42330e0423242e16Johannes Berg#define IWL_GOOD_CRC_TH_DEFAULT		cpu_to_le16(1)
266896ff56419504ac6a610ff1af42330e0423242e16Johannes Berg#define IWL_GOOD_CRC_TH_NEVER		cpu_to_le16(0xffff)
2669b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_MAX_SCAN_SIZE 1024
267089612124d6d62230043ebd827a2b54ea5ea5280cAbhijeet Kolekar#define IWL_MAX_CMD_SIZE 4096
2671b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2672b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2673b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SCAN_CMD = 0x80 (command)
26743058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26753058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * The hardware scan command is very powerful; the driver can set it up to
26763058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * maintain (relatively) normal network traffic while doing a scan in the
26773058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * background.  The max_out_time and suspend_time control the ratio of how
26783058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * long the device stays on an associated network channel ("service channel")
26793058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * vs. how long it's away from the service channel, i.e. tuned to other channels
26803058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * for scanning.
26813058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26823058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * max_out_time is the max time off-channel (in usec), and suspend_time
26833058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * is how long (in "extended beacon" format) that the scan is "suspended"
26843058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * after returning to the service channel.  That is, suspend_time is the
26853058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * time that we stay on the service channel, doing normal work, between
26863058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * scan segments.  The driver may set these parameters differently to support
26873058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * scanning when associated vs. not associated, and light vs. heavy traffic
26883058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * loads when associated.
26893058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26903058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * After receiving this command, the device's scan engine does the following;
26913058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
26923058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1)  Sends SCAN_START notification to driver
26933058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2)  Checks to see if it has time to do scan for one channel
26943058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3)  Sends NULL packet, with power-save (PS) bit set to 1,
26953058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     to tell AP that we're going off-channel
26963058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 4)  Tunes to first channel in scan list, does active or passive scan
26973058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 5)  Sends SCAN_RESULT notification to driver
26983058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 6)  Checks to see if it has time to do scan on *next* channel in list
26993058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 7)  Repeats 4-6 until it no longer has time to scan the next channel
27003058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *     before max_out_time expires
27013058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 8)  Returns to service channel
27023058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 9)  Sends NULL packet with PS=0 to tell AP that we're back
27033058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 10) Stays on service channel until suspend_time expires
27043058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 11) Repeats entire process 2-10 until list is complete
27053058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 12) Sends SCAN_COMPLETE notification
27063058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
27073058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * For fast, efficient scans, the scan command also has support for staying on
27083058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * a channel for just a short time, if doing active scanning and getting no
27093058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * responses to the transmitted probe request.  This time is controlled by
27103058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * quiet_time, and the number of received packets below which a channel is
27113058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * considered "quiet" is controlled by quiet_plcp_threshold.
27123058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
27133058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * For active scanning on channels that have regulatory restrictions against
27143058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * blindly transmitting, the scan can listen before transmitting, to make sure
27153058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * that there is already legitimate activity on the channel.  If enough
27163058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * packets are cleanly received on the channel (controlled by good_CRC_th,
27173058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * typical value 1), the scan engine starts transmitting probe requests.
27183058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
27193058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
27203058f02137359efb412975cf94a9fa7c25413387Ben M Cahill *
27213058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * To avoid uCode errors, see timing restrictions described under
27222a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_scan_channel.
2723b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
27243d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
27253d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_scan_cmd {
27263d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 len;
27273d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved0;
27283d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 channel_count;	/* # channels in channel list */
27293d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 quiet_time;	/* dwell only this # millisecs on quiet channel
27303d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * (only for active scan) */
27313d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 quiet_plcp_th;	/* quiet chnl is < this # pkts (typ. 1) */
27323d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 good_CRC_th;	/* passive -> active promotion threshold */
27333d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 reserved1;
27343d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 max_out_time;	/* max usec to be away from associated (service)
27353d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * channel */
27363d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 suspend_time;	/* pause scan this long (in "extended beacon
27373d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * format") when returning to service channel:
27383d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * 3945; 31:24 # beacons, 19:0 additional usec,
27393d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * 4965; 31:22 # beacons, 21:0 additional usec.
27403d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 */
27413d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 flags;		/* RXON_FLG_* */
27423d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 filter_flags;	/* RXON_FILTER_* */
27433d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
27443d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* For active scans (set to all-0s for passive scans).
27453d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Does not include payload.  Must specify Tx rate; no rate scaling. */
27463d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_tx_cmd tx_cmd;
27473d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
27483d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/* For directed active scans (set to all-0s otherwise) */
27499b3bf06abad70db820c74c90118ea49358549d22Johannes Berg	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
27503d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
27513d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	/*
27523d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Probe request frame, followed by channel list.
27533d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 *
27543d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Size of probe request frame is specified by byte count in tx_cmd.
27553d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Channel list follows immediately after probe request frame.
27563d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Number of channels in list is specified by channel_count.
27573d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * Each channel in list is of type:
27583d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 *
27593d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * struct iwl3945_scan_channel channels[0];
27603d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 *
27613d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * NOTE:  Only one band of channels can be scanned per pass.  You
27623d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
27633d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
27643d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 * before requesting another scan.
27653d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	 */
27663d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 data[0];
27673d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
27683d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
27692a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scan_cmd {
2770b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 len;
2771b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved0;
27723058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	u8 channel_count;	/* # channels in channel list */
27733058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 quiet_time;	/* dwell only this # millisecs on quiet channel
27743058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 * (only for active scan) */
27753058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 quiet_plcp_th;	/* quiet chnl is < this # pkts (typ. 1) */
27763058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 good_CRC_th;	/* passive -> active promotion threshold */
27773058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le16 rx_chain;	/* RXON_RX_CHAIN_* */
27783058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le32 max_out_time;	/* max usec to be away from associated (service)
27793058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 * channel */
27803058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le32 suspend_time;	/* pause scan this long (in "extended beacon
27813058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 * format") when returning to service chnl:
27823058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 * 3945; 31:24 # beacons, 19:0 additional usec,
27833058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 * 4965; 31:22 # beacons, 21:0 additional usec.
27843058f02137359efb412975cf94a9fa7c25413387Ben M Cahill				 */
27853058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le32 flags;		/* RXON_FLG_* */
27863058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le32 filter_flags;	/* RXON_FILTER_* */
27873058f02137359efb412975cf94a9fa7c25413387Ben M Cahill
27883058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	/* For active scans (set to all-0s for passive scans).
27893058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Does not include payload.  Must specify Tx rate; no rate scaling. */
279083d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winkler	struct iwl_tx_cmd tx_cmd;
27913058f02137359efb412975cf94a9fa7c25413387Ben M Cahill
27923058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	/* For directed active scans (set to all-0s otherwise) */
27932a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
2794b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2795b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	/*
27963058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Probe request frame, followed by channel list.
27973058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 *
27983058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Size of probe request frame is specified by byte count in tx_cmd.
27993058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Channel list follows immediately after probe request frame.
28003058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Number of channels in list is specified by channel_count.
28013058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * Each channel in list is of type:
2802b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 *
28032aa6ab86bc475a115f56645591d2413981846509Tomas Winkler	 * struct iwl_scan_channel channels[0];
2804b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 *
2805b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 * NOTE:  Only one band of channels can be scanned per pass.  You
28063058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
28073058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
28083058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	 * before requesting another scan.
2809b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	 */
28103058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	u8 data[0];
2811b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2812b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2813b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Can abort will notify by complete notification with abort status. */
281451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define CAN_ABORT_STATUS	cpu_to_le32(0x1)
2815b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* complete notification statuses */
2816b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define ABORT_STATUS            0x2
2817b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2818b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2819b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SCAN_CMD = 0x80 (response)
2820b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28212a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanreq_notification {
2822b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 status;		/* 1: okay, 2: cannot fulfill request */
2823b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2824b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2825b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2826b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
2827b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28282a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanstart_notification {
2829b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_low;
2830b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_high;
2831b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_timer;
2832b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 channel;
2833b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 band;
2834b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved[2];
2835b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 status;
2836b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2837b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2838b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define  SCAN_OWNER_STATUS 0x1;
2839b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define  MEASURE_OWNER_STATUS 0x2;
2840b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2841b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define NUMBER_OF_STATISTICS 1	/* first __le32 is good CRC */
2842b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2843b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
2844b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28452a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanresults_notification {
2846b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 channel;
2847b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 band;
2848b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved[2];
2849b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_low;
2850b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_high;
2851b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 statistics[NUMBER_OF_STATISTICS];
2852b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2853b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2854b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2855b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
2856b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28572a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scancomplete_notification {
2858b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 scanned_channels;
2859b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 status;
2860b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved;
2861b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 last_channel;
2862b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_low;
2863b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tsf_high;
2864b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2865b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2866b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2867b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2868b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (9)
2869b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * IBSS/AP Commands and Notifications:
2870b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2871b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
2872b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2873b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2874b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
2875b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28763d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
28773d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_beacon_notif {
28783d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_tx_resp beacon_notify_hdr;
28793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 low_tsf;
28803d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 high_tsf;
28813d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 ibss_mgr_status;
28823d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
28833d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
2884bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_beacon_notif {
2885bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig	struct iwl4965_tx_resp beacon_notify_hdr;
2886b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 low_tsf;
2887b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 high_tsf;
2888b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ibss_mgr_status;
2889b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2890b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2891b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
2892b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
2893b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
28943d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
28953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_tx_beacon_cmd {
28963d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl3945_tx_cmd tx;
28973d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le16 tim_idx;
28983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 tim_size;
28993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	u8 reserved1;
29003d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct ieee80211_hdr frame[0];	/* beacon frame */
29013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29034bf64efd26f5610cde4fb7846e2f37bd1f62d3a9Tomas Winklerstruct iwl_tx_beacon_cmd {
290483d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winkler	struct iwl_tx_cmd tx;
2905b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le16 tim_idx;
2906b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 tim_size;
2907b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved1;
2908b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct ieee80211_hdr frame[0];	/* beacon frame */
2909b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2910b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2911b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
2912b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (10)
2913b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Statistics Commands and Notifications:
2914b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
2915b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
2916b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2917b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_TEMP_CONVERT 260
2918b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2919b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11A_MAX_NUM_CHANNELS  8
2920b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11B_MAX_NUM_CHANNELS  4
2921b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11G_MAX_NUM_CHANNELS  12
2922b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2923b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Used for passing to driver number of successes and failures per rate */
2924b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct rate_histogram {
2925b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	union {
2926b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2927b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2928b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2929b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} success;
2930b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	union {
2931b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2932b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2933b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2934b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} failed;
2935b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
2936b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
2937b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* statistics command response */
2938b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
29393d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_rx_phy {
29403d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 ina_cnt;
29413d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 fina_cnt;
29423d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 plcp_err;
29433d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 crc32_err;
29443d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 overrun_err;
29453d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 early_overrun_err;
29463d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 crc32_good;
29473d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 false_alarm_cnt;
29483d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 fina_sync_err_cnt;
29493d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 sfd_timeout;
29503d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 fina_timeout;
29513d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 unresponded_rts;
29523d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 rxe_frame_limit_overrun;
29533d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 sent_ack_cnt;
29543d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 sent_cts_cnt;
29553d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29563d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29573d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_rx_non_phy {
29583d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 bogus_cts;	/* CTS received when not expecting CTS */
29593d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 bogus_ack;	/* ACK received when not expecting ACK */
29603d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 non_bssid_frames;	/* number of frames with BSSID that
29613d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler					 * doesn't belong to the STA BSSID */
29623d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 filtered_frames;	/* count frames that were dumped in the
29633d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler				 * filtering process */
29643d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 non_channel_beacons;	/* beacons with our bss id but not on
29653d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler					 * our serving channel */
29663d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29673d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29683d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_rx {
29693d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_rx_phy ofdm;
29703d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_rx_phy cck;
29713d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_rx_non_phy general;
29723d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29733d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29743d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_tx {
29753d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 preamble_cnt;
29763d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 rx_detected_cnt;
29773d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 bt_prio_defer_cnt;
29783d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 bt_prio_kill_cnt;
29793d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 few_bytes_cnt;
29803d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 cts_timeout;
29813d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 ack_timeout;
29823d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 expected_ack_cnt;
29833d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 actual_ack_cnt;
29843d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29853d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29863d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct statistics_dbg {
29873d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 burst_check;
29883d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 burst_count;
29893d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 reserved[4];
29903d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29913d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29923d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_div {
29933d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 tx_on_a;
29943d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 tx_on_b;
29953d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 exec_time;
29963d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 probe_time;
29973d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
29983d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
29993d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl39_statistics_general {
30003d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 temperature;
30013d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct statistics_dbg dbg;
30023d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 sleep_time;
30033d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 slots_out;
30043d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 slots_idle;
30053d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 ttl_timestamp;
30063d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_div div;
30073d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
30083d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
3009b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_phy {
3010b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ina_cnt;
3011b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 fina_cnt;
3012b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 plcp_err;
3013b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 crc32_err;
3014b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 overrun_err;
3015b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 early_overrun_err;
3016b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 crc32_good;
3017b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 false_alarm_cnt;
3018b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 fina_sync_err_cnt;
3019b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sfd_timeout;
3020b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 fina_timeout;
3021b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 unresponded_rts;
3022b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rxe_frame_limit_overrun;
3023b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sent_ack_cnt;
3024b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sent_cts_cnt;
3025b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sent_ba_rsp_cnt;
3026b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 dsp_self_kill;
3027b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 mh_format_err;
3028b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 re_acq_main_rssi_sum;
3029b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved3;
3030b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3031b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3032b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_ht_phy {
3033b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 plcp_err;
3034b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 overrun_err;
3035b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 early_overrun_err;
3036b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 crc32_good;
3037b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 crc32_err;
3038b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 mh_format_err;
3039b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 agg_crc32_good;
3040b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 agg_mpdu_cnt;
3041b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 agg_cnt;
3042f0118a4575d45ce3074c830660de938bc6e17bdaWey-Yi Guy	__le32 unsupport_mcs;
3043b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3044b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3045c1b4aa3fb619782213af2af6652663c8f9cef373Harvey Harrison#define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1)
304634c22cf93d1446791c966c878cc691e07c39d8d3Winkler, Tomas
3047b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_non_phy {
3048b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bogus_cts;	/* CTS received when not expecting CTS */
3049b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bogus_ack;	/* ACK received when not expecting ACK */
3050b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 non_bssid_frames;	/* number of frames with BSSID that
3051b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * doesn't belong to the STA BSSID */
3052b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 filtered_frames;	/* count frames that were dumped in the
3053b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * filtering process */
3054b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 non_channel_beacons;	/* beacons with our bss id but not on
3055b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * our serving channel */
3056b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 channel_beacons;	/* beacons with our bss id and in our
3057b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * serving channel */
3058b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 num_missed_bcon;	/* number of missed beacons */
3059b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 adc_rx_saturation_time;	/* count in 0.8us units the time the
3060b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * ADC was in saturation */
3061b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ina_detection_search_time;/* total time (in 0.8us) searched
3062b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					  * for INA */
3063b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_silence_rssi_a;	/* RSSI silence after beacon frame */
3064b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_silence_rssi_b;	/* RSSI silence after beacon frame */
3065b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_silence_rssi_c;	/* RSSI silence after beacon frame */
3066b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 interference_data_flag;	/* flag for interference data
3067b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * availability. 1 when data is
3068b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * available. */
30693058f02137359efb412975cf94a9fa7c25413387Ben M Cahill	__le32 channel_load;		/* counts RX Enable time in uSec */
3070b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 dsp_false_alarms;	/* DSP false alarm (both OFDM
3071b481de9ca074528fe8c429604e2777db8b89806aZhu Yi					 * and CCK) counter */
3072b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_rssi_a;
3073b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_rssi_b;
3074b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_rssi_c;
3075b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_energy_a;
3076b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_energy_b;
3077b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 beacon_energy_c;
3078b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3079b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3080b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx {
3081b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_rx_phy ofdm;
3082b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_rx_phy cck;
3083b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_rx_non_phy general;
3084b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_rx_ht_phy ofdm_ht;
3085b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3086b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3087fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy/**
3088fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy * struct statistics_tx_power - current tx power
3089fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy *
3090fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy * @ant_a: current tx power on chain a in 1/2 dB step
3091fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy * @ant_b: current tx power on chain b in 1/2 dB step
3092fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy * @ant_c: current tx power on chain c in 1/2 dB step
3093fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy */
3094fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guystruct statistics_tx_power {
3095fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	u8 ant_a;
3096fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	u8 ant_b;
3097fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	u8 ant_c;
3098fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	u8 reserved;
3099fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy} __attribute__ ((packed));
3100fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy
3101b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_tx_non_phy_agg {
3102b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ba_timeout;
3103b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ba_reschedule_frames;
3104b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 scd_query_agg_frame_cnt;
3105b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 scd_query_no_agg;
3106b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 scd_query_agg;
3107b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 scd_query_mismatch;
3108b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 frame_not_ready;
3109b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 underrun;
3110b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bt_prio_kill;
3111b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rx_ba_rsp_cnt;
3112b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3113b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3114b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_tx {
3115b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 preamble_cnt;
3116b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rx_detected_cnt;
3117b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bt_prio_defer_cnt;
3118b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 bt_prio_kill_cnt;
3119b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 few_bytes_cnt;
3120b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cts_timeout;
3121b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ack_timeout;
3122b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 expected_ack_cnt;
3123b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 actual_ack_cnt;
3124b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 dump_msdu_cnt;
3125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 burst_abort_next_frame_mismatch_cnt;
3126b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 burst_abort_missing_next_frame_cnt;
3127b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 cts_timeout_collision;
3128b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ack_or_ba_timeout_collision;
3129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_tx_non_phy_agg agg;
3130470356b891f1d18e87d5fdc393976fab6d0a978dWey-Yi Guy	/*
3131470356b891f1d18e87d5fdc393976fab6d0a978dWey-Yi Guy	 * "tx_power" are optional parameters provided by uCode,
3132470356b891f1d18e87d5fdc393976fab6d0a978dWey-Yi Guy	 * 6000 series is the only device provide the information,
3133470356b891f1d18e87d5fdc393976fab6d0a978dWey-Yi Guy	 * Those are reserved fields for all the other devices
3134470356b891f1d18e87d5fdc393976fab6d0a978dWey-Yi Guy	 */
3135fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	struct statistics_tx_power tx_power;
3136fcbaf8b06da385c73cb6218f079e9ddba9ee9f7cWey-Yi Guy	__le32 reserved1;
3137b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3138b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3139b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3140b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_div {
3141b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tx_on_a;
3142b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 tx_on_b;
3143b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 exec_time;
3144b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 probe_time;
3145b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved1;
3146b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved2;
3147b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3148b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3149b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_general {
3150f0118a4575d45ce3074c830660de938bc6e17bdaWey-Yi Guy	__le32 temperature;   /* radio temperature */
3151f0118a4575d45ce3074c830660de938bc6e17bdaWey-Yi Guy	__le32 temperature_m; /* for 5000 and up, this is radio voltage */
3152b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_dbg dbg;
3153b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 sleep_time;
3154b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 slots_out;
3155b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 slots_idle;
3156b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 ttl_timestamp;
3157b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_div div;
3158b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 rx_enable_counter;
315911fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	/*
316011fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	 * num_of_sos_states:
316111fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	 *  count the number of times we have to re-tune
316211fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	 *  in order to get out of bad PHY status
316311fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	 */
316411fc524941248dc717f1af5dfa844eceb7c0217fWey-Yi Guy	__le32 num_of_sos_states;
3165b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved2;
3166b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 reserved3;
3167b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3168b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3169ef8d5529b015d4c5db7fad1adfc91edfd5abad56Wey-Yi Guy#define UCODE_STATISTICS_CLEAR_MSK		(0x1 << 0)
3170ef8d5529b015d4c5db7fad1adfc91edfd5abad56Wey-Yi Guy#define UCODE_STATISTICS_FREQUENCY_MSK		(0x1 << 1)
3171ef8d5529b015d4c5db7fad1adfc91edfd5abad56Wey-Yi Guy#define UCODE_STATISTICS_NARROW_BAND_MSK	(0x1 << 2)
3172ef8d5529b015d4c5db7fad1adfc91edfd5abad56Wey-Yi Guy
3173b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
3174b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_STATISTICS_CMD = 0x9c,
3175b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 3945 and 4965 identical.
3176b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3177b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This command triggers an immediate response containing uCode statistics.
3178b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
3179b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3180b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the CLEAR_STATS configuration flag is set, uCode will clear its
3181b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * internal copy of the statistics (counters) after issuing the response.
3182b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
3183b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3184b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
3185b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * STATISTICS_NOTIFICATIONs after received beacons (see below).  This flag
3186b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
3187b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
318851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1)	/* see above */
318951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
31908f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbachstruct iwl_statistics_cmd {
3191b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 configuration_flags;	/* IWL_STATS_CONF_* */
3192b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3193b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3194b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
3195b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
3196b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3197b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * By default, uCode issues this notification after receiving a beacon
3198b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the
3199b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_STATISTICS_CMD 0x9c, above.
3200b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3201b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Statistics counters continue to increment beacon after beacon, but are
3202b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
3203b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 0x9c with CLEAR_STATS bit set (see above).
3204b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3205b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * uCode also issues this notification during scans.  uCode clears statistics
3206b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * appropriately so that each notification contains statistics for only the
3207b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * one channel that has just been scanned.
3208b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
320951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STATISTICS_REPLY_FLG_BAND_24G_MSK         cpu_to_le32(0x2)
32107aafef1c6e2e24f9a10dc2972bf0ee70624ccc47Wey-Yi Guy#define STATISTICS_REPLY_FLG_HT40_MODE_MSK        cpu_to_le32(0x8)
32113d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
32123d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winklerstruct iwl3945_notif_statistics {
32133d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	__le32 flag;
32143d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_rx rx;
32153d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_tx tx;
32163d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler	struct iwl39_statistics_general general;
32173d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler} __attribute__ ((packed));
32183d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
32198f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbachstruct iwl_notif_statistics {
3220b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 flag;
3221b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_rx rx;
3222b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_tx tx;
3223b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	struct statistics_general general;
3224b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3225b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3226b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3227b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
3228b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
3229a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy *
3230a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed
3231a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * in regardless of how many missed beacons, which mean when driver receive the
3232a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * notification, inside the command, it can find all the beacons information
3233a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * which include number of total missed beacons, number of consecutive missed
3234a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * beacons, number of beacons received and number of beacons expected to
3235a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * receive.
3236a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy *
3237a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3238a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * in order to bring the radio/PHY back to working state; which has no relation
3239a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * to when driver will perform sensitivity calibration.
3240a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy *
3241a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * Driver should set it own missed_beacon_threshold to decide when to perform
3242a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * sensitivity calibration based on number of consecutive missed beacons in
3243a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy * order to improve overall performance, especially in noisy environment.
3244a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy *
3245b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
3246a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy
3247a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy#define IWL_MISSED_BEACON_THRESHOLD_MIN	(1)
3248a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy#define IWL_MISSED_BEACON_THRESHOLD_DEF	(5)
3249a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy#define IWL_MISSED_BEACON_THRESHOLD_MAX	IWL_MISSED_BEACON_THRESHOLD_DEF
3250b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
32512aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_missed_beacon_notif {
3252a13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4Wey-Yi Guy	__le32 consecutive_missed_beacons;
3253b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 total_missed_becons;
3254b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 num_expected_beacons;
3255b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 num_recvd_beacons;
3256b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3257b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3258f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill
3259b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
3260b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (11)
3261b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx Calibration Commands:
3262b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3263f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * With the uCode used for open source drivers, most Tx calibration (except
3264f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * for Tx Power) and most Rx calibration is done by uCode during the
3265f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * "initialize" phase of uCode boot.  Driver must calibrate only:
3266f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3267f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1)  Tx power (depends on temperature), described elsewhere
3268f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2)  Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3269f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3)  Receiver sensitivity (to optimize signal detection)
3270f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3271b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
3272b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3273f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/**
3274f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * SENSITIVITY_CMD = 0xa8 (command, has simple generic response)
3275f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3276f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * This command sets up the Rx signal detector for a sensitivity level that
3277f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * is high enough to lock onto all signals within the associated network,
3278f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * but low enough to ignore signals that are below a certain threshold, so as
3279f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * not to have too many "false alarms".  False alarms are signals that the
3280f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Rx DSP tries to lock onto, but then discards after determining that they
3281f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * are noise.
3282f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3283f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * The optimum number of false alarms is between 5 and 50 per 200 TUs
3284f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3285f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * time listening, not transmitting).  Driver must adjust sensitivity so that
3286f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * the ratio of actual false alarms to actual Rx time falls within this range.
3287f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3288f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
3289f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * received beacon.  These provide information to the driver to analyze the
3290f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity.  Don't analyze statistics that come in from scanning, or any
3291f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * other non-associated-network source.  Pertinent statistics include:
3292f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3293f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * From "general" statistics (struct statistics_rx_non_phy):
3294f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3295f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3296f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Measure of energy of desired signal.  Used for establishing a level
3297f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   below which the device does not detect signals.
3298f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3299f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3300f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Measure of background noise in silent period after beacon.
3301f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3302f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * channel_load
3303f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   uSecs of actual Rx time during beacon period (varies according to
3304f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   how much time was spent transmitting).
3305f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3306f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
3307f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3308f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * false_alarm_cnt
3309f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Signal locks abandoned early (before phy-level header).
3310f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3311f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * plcp_err
3312f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Signal locks abandoned late (during phy-level header).
3313f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3314f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * NOTE:  Both false_alarm_cnt and plcp_err increment monotonically from
3315f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        beacon to beacon, i.e. each value is an accumulation of all errors
3316f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        before and including the latest beacon.  Values will wrap around to 0
3317f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        after counting up to 2^32 - 1.  Driver must differentiate vs.
3318f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        previous beacon's values to determine # false alarms in the current
3319f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        beacon period.
3320f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3321f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Total number of false alarms = false_alarms + plcp_errs
3322f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3323f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd
3324f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (notice that the start points for OFDM are at or close to settings for
3325f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * maximum sensitivity):
3326f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3327f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *                                             START  /  MIN  /  MAX
3328f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX          90   /   85  /  120
3329f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX     170   /  170  /  210
3330f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX         105   /  105  /  140
3331f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX     220   /  220  /  270
3332f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3333f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   If actual rate of OFDM false alarms (+ plcp_errors) is too high
3334f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3335f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   by *adding* 1 to all 4 of the table entries above, up to the max for
3336f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   each entry.  Conversely, if false alarm rate is too low (less than 5
3337f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   for each 204.8 msecs listening), *subtract* 1 from each entry to
3338f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   increase sensitivity.
3339f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3340f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For CCK sensitivity, keep track of the following:
3341f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3342f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1).  20-beacon history of maximum background noise, indicated by
3343f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3344f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        3 receivers.  For any given beacon, the "silence reference" is
3345f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        the maximum of last 60 samples (20 beacons * 3 receivers).
3346f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3347f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   2).  10-beacon history of strongest signal level, as indicated
3348f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3349f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        i.e. the strength of the signal through the best receiver at the
3350f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        moment.  These measurements are "upside down", with lower values
3351f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        for stronger signals, so max energy will be *minimum* value.
3352f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3353f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        Then for any given beacon, the driver must determine the *weakest*
3354f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        of the strongest signals; this is the minimum level that needs to be
3355f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        successfully detected, when using the best receiver at the moment.
3356f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        "Max cck energy" is the maximum (higher value means lower energy!)
3357f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        of the last 10 minima.  Once this is determined, driver must add
3358f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        a little margin by adding "6" to it.
3359f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3360f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   3).  Number of consecutive beacon periods with too few false alarms.
3361f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        Reset this to 0 at the first beacon period that falls within the
3362f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3363f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3364f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd
3365f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (notice that the start points for CCK are at maximum sensitivity):
3366f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3367f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *                                             START  /  MIN  /  MAX
3368f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX         125   /  125  /  200
3369f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX     200   /  200  /  400
3370f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   HD_MIN_ENERGY_CCK_DET_INDEX                100   /    0  /  100
3371f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3372f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   If actual rate of CCK false alarms (+ plcp_errors) is too high
3373f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   (greater than 50 for each 204.8 msecs listening), method for reducing
3374f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   sensitivity is:
3375f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3376f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1)  *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3377f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       up to max 400.
3378f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3379f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   2)  If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
3380f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       sensitivity has been reduced a significant amount; bring it up to
3381f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       a moderate 161.  Otherwise, *add* 3, up to max 200.
3382f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3383f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   3)  a)  If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
3384f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       sensitivity has been reduced only a moderate or small amount;
3385f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
3386f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       down to min 0.  Otherwise (if gain has been significantly reduced),
3387f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
3388f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3389f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       b)  Save a snapshot of the "silence reference".
3390f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3391f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   If actual rate of CCK false alarms (+ plcp_errors) is too low
3392f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   (less than 5 for each 204.8 msecs listening), method for increasing
3393f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   sensitivity is used only if:
3394f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3395f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1a)  Previous beacon did not have too many false alarms
3396f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1b)  AND difference between previous "silence reference" and current
3397f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *        "silence reference" (prev - current) is 2 or more,
3398f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   OR 2)  100 or more consecutive beacon periods have had rate of
3399f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *          less than 5 false alarms per 204.8 milliseconds rx time.
3400f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3401f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Method for increasing sensitivity:
3402f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3403f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1)  *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
3404f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       down to min 125.
3405f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3406f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   2)  *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3407f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       down to min 200.
3408f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3409f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   3)  *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
3410f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3411f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   If actual rate of CCK false alarms (+ plcp_errors) is within good range
3412f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   (between 5 and 50 for each 204.8 msecs listening):
3413f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3414f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   1)  Save a snapshot of the silence reference.
3415f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3416f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   2)  If previous beacon had too many CCK false alarms (+ plcp_errors),
3417f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       give some extra margin to energy threshold by *subtracting* 8
3418f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *       from value in HD_MIN_ENERGY_CCK_DET_INDEX.
3419f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3420f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   For all cases (too few, too many, good range), make sure that the CCK
3421f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   detection threshold (energy) is below the energy level for robust
3422f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   detection over the past 10 beacon periods, the "Max cck energy".
3423f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   Lower values mean higher energy; this means making sure that the value
3424f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
3425f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3426f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */
3427f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill
3428f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/*
3429f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd)
3430f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */
3431f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_TABLE_SIZE  (11)	/* number of entries */
3432f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_MIN_ENERGY_CCK_DET_INDEX                 (0)	/* table indexes */
3433f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_MIN_ENERGY_OFDM_DET_INDEX                (1)
3434f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX          (2)
3435f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX      (3)
3436f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX      (4)
3437f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX          (5)
3438f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX      (6)
3439f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_BARKER_CORR_TH_ADD_MIN_INDEX             (7)
3440f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX         (8)
3441f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX          (9)
3442f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_OFDM_ENERGY_TH_IN_INDEX                  (10)
3443f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill
3444f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach/* Control field in struct iwl_sensitivity_cmd */
344551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE	cpu_to_le16(0)
344651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SENSITIVITY_CMD_CONTROL_WORK_TABLE	cpu_to_le16(1)
3447b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3448f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/**
3449f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach * struct iwl_sensitivity_cmd
3450f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * @control:  (1) updates working table, (0) updates default table
3451f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * @table:  energy threshold values, use HD_* as index into table
3452f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3453f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Always use "1" in "control" to update uCode's working table and DSP.
3454f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */
3455f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbachstruct iwl_sensitivity_cmd {
3456f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill	__le16 control;			/* always use "1" */
3457f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill	__le16 table[HD_TABLE_SIZE];	/* use HD_* as index */
3458b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3459b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3460f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill
3461f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/**
3462f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
3463f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3464f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * This command sets the relative gains of 4965's 3 radio receiver chains.
3465f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3466f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * After the first association, driver should accumulate signal and noise
3467f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
3468f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacons from the associated network (don't collect statistics that come
3469f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * in from scanning, or any other non-network source).
3470f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3471f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * DISCONNECTED ANTENNA:
3472f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3473f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Driver should determine which antennas are actually connected, by comparing
3474f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * average beacon signal levels for the 3 Rx chains.  Accumulate (add) the
3475f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * following values over 20 beacons, one accumulator for each of the chains
3476f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * a/b/c, from struct statistics_rx_non_phy:
3477f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3478f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3479f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3480f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Find the strongest signal from among a/b/c.  Compare the other two to the
3481f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * strongest.  If any signal is more than 15 dB (times 20, unless you
3482f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * divide the accumulated values by 20) below the strongest, the driver
3483f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * considers that antenna to be disconnected, and should not try to use that
3484f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * antenna/chain for Rx or Tx.  If both A and B seem to be disconnected,
3485f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * driver should declare the stronger one as connected, and attempt to use it
3486f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (A and B are the only 2 Tx chains!).
3487f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3488f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3489f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * RX BALANCE:
3490f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3491f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Driver should balance the 3 receivers (but just the ones that are connected
3492f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * to antennas, see above) for gain, by comparing the average signal levels
3493f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * detected during the silence after each beacon (background noise).
3494f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Accumulate (add) the following values over 20 beacons, one accumulator for
3495f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * each of the chains a/b/c, from struct statistics_rx_non_phy:
3496f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3497f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3498f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3499f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Find the weakest background noise level from among a/b/c.  This Rx chain
3500f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * will be the reference, with 0 gain adjustment.  Attenuate other channels by
3501f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * finding noise difference:
3502f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3503f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (accum_noise[i] - accum_noise[reference]) / 30
3504f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3505f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3506f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the
3507f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3508f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * and set bit 2 to indicate "reduce gain".  The value for the reference
3509f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (weakest) chain should be "0".
3510f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *
3511f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * diff_gain_[abc] bit fields:
3512f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill *   2: (1) reduce gain, (0) increase gain
3513f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1-0: amount of gain, units of 1.5 dB
3514f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */
3515f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill
3516f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler/* Phy calibration command for series */
351733fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach
351833fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbachenum {
3519f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_DIFF_GAIN_CMD		= 7,
3520f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_DC_CMD		= 8,
3521f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_LO_CMD		= 9,
3522f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_TX_IQ_CMD		= 11,
3523f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD	= 15,
3524f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_BASE_BAND_CMD		= 16,
3525f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD	= 17,
3526f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD	= 18,
3527f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD	= 19,
352833fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach};
352933fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach
3530f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler
353151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_CALIB_INIT_CFG_ALL	cpu_to_le32(0xffffffff)
35327c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler
35337c616cba240cd0d579c996be3f3603456acfb0adTomas Winklerstruct iwl_calib_cfg_elmnt_s {
35347c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 is_enable;
35357c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 start;
35367c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 send_res;
35377c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 apply_res;
35387c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 reserved;
35397c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed));
35407c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler
35417c616cba240cd0d579c996be3f3603456acfb0adTomas Winklerstruct iwl_calib_cfg_status_s {
35427c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	struct iwl_calib_cfg_elmnt_s once;
35437c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	struct iwl_calib_cfg_elmnt_s perd;
35447c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 flags;
35457c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed));
35467c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler
3547f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_cfg_cmd {
35487c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	struct iwl_calib_cfg_status_s ucd_calib_cfg;
35497c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	struct iwl_calib_cfg_status_s drv_calib_cfg;
35507c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	__le32 reserved1;
35517c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed));
35527c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler
3553f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_hdr {
35547c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	u8 op_code;
35557c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	u8 first_group;
35567c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	u8 groups_num;
35577c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler	u8 data_valid;
35587c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed));
35597c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler
3560f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_cmd {
3561f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	struct iwl_calib_hdr hdr;
3562be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler	u8 data[0];
3563be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler} __attribute__ ((packed));
3564be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler
35650d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3566f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_diff_gain_cmd {
35670d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	struct iwl_calib_hdr hdr;
3568f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	s8 diff_gain_a;		/* see above */
3569f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	s8 diff_gain_b;
3570f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	s8 diff_gain_c;
3571f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler	u8 reserved1;
3572f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler} __attribute__ ((packed));
3573f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler
35740d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winklerstruct iwl_calib_xtal_freq_cmd {
35750d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	struct iwl_calib_hdr hdr;
35760d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	u8 cap_pin1;
35770d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	u8 cap_pin2;
35780d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	u8 pad[2];
357933fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach} __attribute__ ((packed));
358033fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach
35810d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
35820d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winklerstruct iwl_calib_chain_noise_reset_cmd {
35830d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	struct iwl_calib_hdr hdr;
35840d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	u8 data[0];
35850d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler};
35860d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler
35870d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */
3588f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_chain_noise_gain_cmd {
35890d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	struct iwl_calib_hdr hdr;
359033fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach	u8 delta_gain_1;
359133fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach	u8 delta_gain_2;
35920d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler	u8 pad[2];
359333fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach} __attribute__ ((packed));
359433fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach
3595b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
3596b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (12)
3597b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Miscellaneous Commands:
3598b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3599b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
3600b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3601b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*
3602b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * LEDs Command & Response
3603b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
3604b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3605b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3606b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * this command turns it on or off, or sets up a periodic blinking cycle.
3607b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */
3608ec1a746042ea4c1c93065185897d6e8d3e7de894Tomas Winklerstruct iwl_led_cmd {
3609b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	__le32 interval;	/* "interval" in uSec */
3610b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 id;			/* 1: Activity, 2: Link, 3: Tech */
3611b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 off;			/* # intervals off while blinking;
3612b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * "0", with >0 "on" value, turns LED on */
3613b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 on;			/* # intervals on while blinking;
3614b481de9ca074528fe8c429604e2777db8b89806aZhu Yi				 * "0", regardless of "off", turns LED off */
3615b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	u8 reserved;
3616b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3617b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
36189636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/*
3619fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * station priority table entries
3620fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * also used as potential "events" value for both
3621fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD
36229636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky */
36231933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
36241933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy/*
36251933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * COEX events entry flag masks
36261933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * RP - Requested Priority
36271933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * WP - Win Medium Priority: priority assigned when the contention has been won
36281933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy */
36291933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG        (0x1)
36301933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG        (0x2)
36311933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG  (0x4)
36321933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
36331933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_IDLE_RP               4
36341933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_MANUAL_SCAN_RP        4
36351933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_AUTO_SCAN_RP          4
36361933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_CALIBRATION_RP                4
36371933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_PERIODIC_CALIBRATION_RP       4
36381933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_CONNECTION_ESTAB_RP           4
36391933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOCIATED_IDLE_RP            4
36401933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_MANUAL_SCAN_RP          4
36411933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_AUTO_SCAN_RP            4
36421933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP         4
36431933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RF_ON_RP                      6
36441933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RF_OFF_RP                     4
36451933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_STAND_ALONE_DEBUG_RP          6
36461933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_IPAN_ASSOC_LEVEL_RP           4
36471933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RSRVD1_RP                     4
36481933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RSRVD2_RP                     4
36491933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
36501933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_IDLE_WP               3
36511933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_MANUAL_SCAN_WP        3
36521933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_UNASSOC_AUTO_SCAN_WP          3
36531933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_CALIBRATION_WP                3
36541933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_PERIODIC_CALIBRATION_WP       3
36551933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_CONNECTION_ESTAB_WP           3
36561933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOCIATED_IDLE_WP            3
36571933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_MANUAL_SCAN_WP          3
36581933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_AUTO_SCAN_WP            3
36591933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP         3
36601933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RF_ON_WP                      3
36611933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RF_OFF_WP                     3
36621933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_STAND_ALONE_DEBUG_WP          6
36631933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_IPAN_ASSOC_LEVEL_WP           3
36641933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RSRVD1_WP                     3
36651933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RSRVD2_WP                     3
36661933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
36671933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_UNASSOC_IDLE_FLAGS                     0
36681933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_UNASSOC_MANUAL_SCAN_FLAGS		\
36691933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36701933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36711933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_UNASSOC_AUTO_SCAN_FLAGS		\
36721933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36731933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36741933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CALIBRATION_FLAGS			\
36751933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36761933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36771933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_PERIODIC_CALIBRATION_FLAGS             0
36781933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy/*
36791933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * COEX_CONNECTION_ESTAB:
36801933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
36811933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy */
36821933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CONNECTION_ESTAB_FLAGS		\
36831933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36841933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\
36851933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
36861933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_ASSOCIATED_IDLE_FLAGS                  0
36871933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_ASSOC_MANUAL_SCAN_FLAGS		\
36881933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36891933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36901933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_ASSOC_AUTO_SCAN_FLAGS		\
36911933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36921933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36931933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS               0
36941933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_RF_ON_FLAGS                            0
36951933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_RF_OFF_FLAGS                           0
36961933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_STAND_ALONE_DEBUG_FLAGS		\
36971933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
36981933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG)
36991933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_IPAN_ASSOC_LEVEL_FLAGS		\
37001933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
37011933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\
37021933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
37031933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_RSRVD1_FLAGS                           0
37041933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_RSRVD2_FLAGS                           0
37051933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy/*
37061933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * COEX_CU_RF_ON is the event wrapping all radio ownership.
37071933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network.
37081933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy */
37091933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy#define COEX_CU_RF_ON_FLAGS			\
37101933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	(COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG |	\
37111933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG |	\
37121933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy	 COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG)
37131933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
37141933ac4d9377ed44caba45abe1531ec1bc14bb63Wey-Yi Guy
37159636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskyenum {
3716fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* un-association part */
37179636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_UNASSOC_IDLE		= 0,
37189636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_UNASSOC_MANUAL_SCAN	= 1,
37199636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_UNASSOC_AUTO_SCAN		= 2,
3720fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* calibration */
37219636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_CALIBRATION		= 3,
37229636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_PERIODIC_CALIBRATION	= 4,
3723fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* connection */
37249636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_CONNECTION_ESTAB		= 5,
3725fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* association part */
37269636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_ASSOCIATED_IDLE		= 6,
37279636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_ASSOC_MANUAL_SCAN		= 7,
37289636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_ASSOC_AUTO_SCAN		= 8,
37299636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_ASSOC_ACTIVE_LEVEL		= 9,
3730fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* RF ON/OFF */
37319636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_RF_ON			= 10,
37329636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_RF_OFF			= 11,
37339636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_STAND_ALONE_DEBUG		= 12,
3734fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* IPAN */
37359636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_IPAN_ASSOC_LEVEL		= 13,
3736fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	/* reserved */
37379636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_RSRVD1			= 14,
37389636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_RSRVD2			= 15,
37399636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	COEX_NUM_OF_EVENTS		= 16
37409636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky};
37419636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
3742fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/*
3743fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * Coexistence WIFI/WIMAX  Command
3744fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * COEX_PRIORITY_TABLE_CMD = 0x5a
3745fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy *
3746fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy */
37479636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskystruct iwl_wimax_coex_event_entry {
37489636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 request_prio;
37499636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 win_medium_prio;
37509636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 reserved;
37519636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 flags;
37529636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky} __attribute__ ((packed));
37539636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
37549636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/* COEX flag masks */
37559636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
3756a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* Station table is valid */
37579636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_STA_TABLE_VALID_MSK      (0x1)
3758a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* UnMask wake up src at unassociated sleep */
37599636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK    (0x4)
3760a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* UnMask wake up src at associated sleep */
37619636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK      (0x8)
37629636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/* Enable CoEx feature. */
37639636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_COEX_ENABLE_MSK          (0x80)
37649636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
37659636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskystruct iwl_wimax_coex_cmd {
37669636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 flags;
37679636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	u8 reserved[3];
37689636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky	struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
37699636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky} __attribute__ ((packed));
37709636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky
3771fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/*
3772fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * Coexistence MEDIUM NOTIFICATION
3773fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * COEX_MEDIUM_NOTIFICATION = 0x5b
3774fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy *
3775fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * notification from uCode to host to indicate medium changes
3776fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy *
3777fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy */
3778fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/*
3779fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * status field
3780fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * bit 0 - 2: medium status
3781fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * bit 3: medium change indication
3782fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * bit 4 - 31: reserved
3783fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy */
3784fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/* status option values, (0 - 2 bits) */
3785fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_BUSY	(0x0) /* radio belongs to WiMAX */
3786fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_ACTIVE	(0x1) /* radio belongs to WiFi */
3787fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_PRE_RELEASE	(0x2) /* received radio release */
3788fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_MSK		(0x7)
3789fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3790fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/* send notification status (1 bit) */
3791fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_CHANGED	(0x8)
3792fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_CHANGED_MSK	(0x8)
3793fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_MEDIUM_SHIFT	(3)
3794fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3795fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guystruct iwl_coex_medium_notification {
3796fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	__le32 status;
3797fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	__le32 events;
3798fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy} __attribute__ ((packed));
3799fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3800fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/*
3801fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * Coexistence EVENT  Command
3802fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * COEX_EVENT_CMD = 0x5c
3803fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy *
3804fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy * send from host to uCode for coex event request.
3805fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy */
3806fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy/* flags options */
3807fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy#define COEX_EVENT_REQUEST_MSK	(0x1)
3808fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3809fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guystruct iwl_coex_event_cmd {
3810fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	u8 flags;
3811fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	u8 event;
3812fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	__le16 reserved;
3813fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy} __attribute__ ((packed));
3814fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3815fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guystruct iwl_coex_event_resp {
3816fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy	__le32 status;
3817fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy} __attribute__ ((packed));
3818fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3819fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy
3820b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/******************************************************************************
3821b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (13)
3822b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Union of all expected notifications/responses:
3823b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *
3824b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/
3825b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3826db11d6343aa14ab61258bfad9178042d4be49333Tomas Winklerstruct iwl_rx_packet {
38272f301227a1ede57504694e1f64839839f5737cacZhu Yi	/*
38282f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * The first 4 bytes of the RX frame header contain both the RX frame
38292f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * size and some flags.
38302f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * Bit fields:
38312f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * 31:    flag flush RB request
38322f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * 30:    flag ignore TC (terminal counter) request
38332f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * 29:    flag fast IRQ request
38342f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * 28-14: Reserved
38352f301227a1ede57504694e1f64839839f5737cacZhu Yi	 * 13-00: RX frame size
38362f301227a1ede57504694e1f64839839f5737cacZhu Yi	 */
3837396887a2b2ad1ef5e5526fec34dec582baf39b81Daniel C Halperin	__le32 len_n_flags;
3838857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler	struct iwl_cmd_header hdr;
3839b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	union {
38403d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		struct iwl3945_rx_frame rx_frame;
38413d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		struct iwl3945_tx_resp tx_resp;
38423d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler		struct iwl3945_beacon_notif beacon_status;
38433d24a9f790c0e39cfdef1446c7100e89c542805cTomas Winkler
3844885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winkler		struct iwl_alive_resp alive_frame;
38452aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_spectrum_notification spectrum_notif;
38462aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_csa_notification csa_notif;
3847885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winkler		struct iwl_error_resp err_resp;
38482aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_card_state_notif card_state_notif;
38497a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler		struct iwl_add_sta_resp add_sta;
38507a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler		struct iwl_rem_sta_resp rem_sta;
38512aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_sleep_notification sleep_notif;
38522aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_spectrum_resp spectrum;
38538f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbach		struct iwl_notif_statistics stats;
3854653fa4a07525e4cd9e7b90e6fc1f792119910636Emmanuel Grumbach		struct iwl_compressed_ba_resp compressed_ba;
38552aa6ab86bc475a115f56645591d2413981846509Tomas Winkler		struct iwl_missed_beacon_notif missed_beacon;
3856fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy		struct iwl_coex_medium_notification coex_medium_notif;
3857fe1bcbfda77bf6fa3bbad8bf26b9e9ab23fbe345Wey-Yi Guy		struct iwl_coex_event_resp coex_event;
3858b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		__le32 status;
3859b481de9ca074528fe8c429604e2777db8b89806aZhu Yi		u8 raw[0];
3860b481de9ca074528fe8c429604e2777db8b89806aZhu Yi	} u;
3861b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed));
3862b481de9ca074528fe8c429604e2777db8b89806aZhu Yi
3863a3139c5956702c9ff957ac9fe2d902de355b063eSamuel Ortizint iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
38648f5c87dcf6d1a5e6d7ffe642cfd4debb5ccbec49Winkler, Tomas
38656a63578ddf6148927a80c07a73b40ccc8f3ac8e2Emmanuel Grumbach#endif				/* __iwl_commands_h__ */
3866