iwl-commands.h revision 4c897253cc9ae1c6a2798b27b5fe8e6d94ab6185
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 * 8eb7ae89cb0b03e6e6e39737b1c8bcc1912281a00Reinette Chatre * Copyright(c) 2005 - 2008 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 * 33eb7ae89cb0b03e6e6e39737b1c8bcc1912281a00Reinette Chatre * Copyright(c) 2005 - 2008 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 72c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette/* uCode version contains 4 values: Major/Minor/API/Serial */ 73c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) 74c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) 75c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) 76c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) 77c02b3acd29766c6f79c2411cb5b85e1ee72c4c8fChatre, Reinette 784c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler 794c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler/* Tx rates */ 804c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_CCK_RATES 4 814c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_OFDM_RATES 8 824c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES) 834c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler 84b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 85b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_ALIVE = 0x1, 86b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_ERROR = 0x2, 87b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 88b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* RXON and QOS commands */ 89b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RXON = 0x10, 90b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RXON_ASSOC = 0x11, 91b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_QOS_PARAM = 0x13, 92b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RXON_TIMING = 0x14, 93b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 94b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* Multi-Station support */ 95b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_ADD_STA = 0x18, 96b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_REMOVE_STA = 0x19, /* not used */ 97b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ 98b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 990a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach /* Security */ 1000a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach REPLY_WEPKEY = 0x20, 1010a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach 102b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* RX, TX, LEDs */ 1032aa6ab86bc475a115f56645591d2413981846509Tomas Winkler REPLY_3945_RX = 0x1b, /* 3945 only */ 104b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_TX = 0x1c, 105b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RATE_SCALE = 0x47, /* 3945 only */ 106b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_LEDS_CMD = 0x48, 107b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ 108b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1099636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky /* WiMAX coexistence */ 1109636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_PRIORITY_TABLE_CMD = 0x5a, /*5000 only */ 1119636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_MEDIUM_NOTIFICATION = 0x5b, 1129636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_EVENT_CMD = 0x5c, 1139636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 114be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler /* Calibration */ 115be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler CALIBRATION_CFG_CMD = 0x65, 116be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler CALIBRATION_RES_NOTIFICATION = 0x66, 117be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler CALIBRATION_COMPLETE_NOTIFICATION = 0x67, 118be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler 119b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* 802.11h related */ 120b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RADAR_NOTIFICATION = 0x70, /* not used */ 121b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_QUIET_CMD = 0x71, /* not used */ 122b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_CHANNEL_SWITCH = 0x72, 123b481de9ca074528fe8c429604e2777db8b89806aZhu Yi CHANNEL_SWITCH_NOTIFICATION = 0x73, 124b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, 125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi SPECTRUM_MEASURE_NOTIFICATION = 0x75, 126b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 127b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* Power Management */ 128b481de9ca074528fe8c429604e2777db8b89806aZhu Yi POWER_TABLE_CMD = 0x77, 129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi PM_SLEEP_NOTIFICATION = 0x7A, 130b481de9ca074528fe8c429604e2777db8b89806aZhu Yi PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, 131b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 132b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* Scan commands and notifications */ 133b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_SCAN_CMD = 0x80, 134b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_SCAN_ABORT_CMD = 0x81, 135b481de9ca074528fe8c429604e2777db8b89806aZhu Yi SCAN_START_NOTIFICATION = 0x82, 136b481de9ca074528fe8c429604e2777db8b89806aZhu Yi SCAN_RESULTS_NOTIFICATION = 0x83, 137b481de9ca074528fe8c429604e2777db8b89806aZhu Yi SCAN_COMPLETE_NOTIFICATION = 0x84, 138b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 139b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* IBSS/AP commands */ 140b481de9ca074528fe8c429604e2777db8b89806aZhu Yi BEACON_NOTIFICATION = 0x90, 141b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_TX_BEACON = 0x91, 142b481de9ca074528fe8c429604e2777db8b89806aZhu Yi WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ 143b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 144b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* Miscellaneous commands */ 145b481de9ca074528fe8c429604e2777db8b89806aZhu Yi QUIET_NOTIFICATION = 0x96, /* not used */ 146b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_TX_PWR_TABLE_CMD = 0x97, 147630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler REPLY_TX_POWER_DBM_CMD = 0x98, 148b481de9ca074528fe8c429604e2777db8b89806aZhu Yi MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ 149b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 150a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler /* Bluetooth device coexistence config command */ 151b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_BT_CONFIG = 0x9b, 152b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 15380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill /* Statistics */ 154b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_STATISTICS_CMD = 0x9c, 155b481de9ca074528fe8c429604e2777db8b89806aZhu Yi STATISTICS_NOTIFICATION = 0x9d, 156b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 157b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* RF-KILL commands and notifications */ 158b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_CARD_STATE_CMD = 0xa0, 159b481de9ca074528fe8c429604e2777db8b89806aZhu Yi CARD_STATE_NOTIFICATION = 0xa1, 160b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 161b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* Missed beacons notification */ 162b481de9ca074528fe8c429604e2777db8b89806aZhu Yi MISSED_BEACONS_NOTIFICATION = 0xa2, 163b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 164b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_CT_KILL_CONFIG_CMD = 0xa4, 165b481de9ca074528fe8c429604e2777db8b89806aZhu Yi SENSITIVITY_CMD = 0xa8, 166b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_PHY_CALIBRATION_CMD = 0xb0, 167b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RX_PHY_CMD = 0xc0, 168b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_RX_MPDU_CMD = 0xc1, 169857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler REPLY_RX = 0xc3, 170b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_COMPRESSED_BA = 0xc5, 171b481de9ca074528fe8c429604e2777db8b89806aZhu Yi REPLY_MAX = 0xff 172b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 173b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 174b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 175b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (0) 176abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Commonly used structures and definitions: 17780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Command header, rate_n_flags, txpower 178b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 179b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 180b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 181857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler/* iwl_cmd_header flags value */ 182b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_CMD_FAILED_MSK 0x40 183b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1849734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) 1859734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 1869734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define SEQ_TO_INDEX(s) ((s) & 0xff) 1879734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler#define INDEX_TO_SEQ(i) ((i) & 0xff) 18851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SEQ_HUGE_FRAME cpu_to_le16(0x4000) 18951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SEQ_RX_FRAME cpu_to_le16(0x8000) 1909734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler 191075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/** 192857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler * struct iwl_cmd_header 193075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 194075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * This header format appears in the beginning of each command sent from the 195075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * driver, and each response/notification received from uCode. 196075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill */ 197857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winklerstruct iwl_cmd_header { 198075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill u8 cmd; /* Command ID: REPLY_RXON, etc. */ 1999734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ 200075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill /* 201a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * The driver sets up the sequence number to values of its choosing. 202075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode does not use this value, but passes it back to the driver 203075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * when sending the response to each driver-originated command, so 204075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * the driver can match the response to the command. Since the values 205075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * don't get used by uCode, the driver may set up an arbitrary format. 206b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 207075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * There is one exception: uCode sets bit 15 when it originates 208075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * the response/notification, i.e. when the response/notification 209075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * is not a direct response to a command sent by the driver. For 210075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * example, uCode issues REPLY_3945_RX when it sends a received frame 211075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * to the driver; it is not a direct response to any driver command. 212b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 213075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * The Linux driver uses the following format: 214075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2159734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 0:7 tfd index - position within TX queue 2169734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 8:12 TX queue id 2179734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 13 reserved 2189734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 14 huge - driver sets this to indicate command is in the 2199734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 'huge' storage at the end of the command buffers 2209734cb23a02f8de5fa99225ca61c7019ca9f232fTomas Winkler * 15 unsolicited RX or uCode-originated notification 221b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 222b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 sequence; 223b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 224075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill /* command or response/notification data follows immediately */ 225b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 data[0]; 226b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 227b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 228abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill/** 2295c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * iwlagn rate_n_flags bit fields 230abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 2315c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * rate_n_flags format is used in following iwlagn commands: 232857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler * REPLY_RX (response only) 2335c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * REPLY_RX_MPDU (response only) 234abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * REPLY_TX (both command and response) 235abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * REPLY_TX_LINK_QUALITY_CMD 236abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 237abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): 238abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 2-0: 0) 6 Mbps 239abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 1) 12 Mbps 240abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 2) 18 Mbps 241abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 3) 24 Mbps 242abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 4) 36 Mbps 243abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 5) 48 Mbps 244abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 6) 54 Mbps 245abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 7) 60 Mbps 246abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 2475c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * 4-3: 0) Single stream (SISO) 248abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 1) Dual stream (MIMO) 2495c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C * 2) Triple stream (MIMO) 250abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 251abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data 252abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 253abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): 254abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 3-0: 0xD) 6 Mbps 255abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0xF) 9 Mbps 256abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0x5) 12 Mbps 257abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0x7) 18 Mbps 258abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0x9) 24 Mbps 259abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0xB) 36 Mbps 260abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0x1) 48 Mbps 261abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 0x3) 54 Mbps 262abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 263abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 2641061787967db03975dc02030d6815811f4eb9231Daniel Wu * 6-0: 10) 1 Mbps 265abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 20) 2 Mbps 266abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 55) 5.5 Mbps 267abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill * 110) 11 Mbps 268abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill */ 269abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CODE_MSK 0x7 2705c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C#define RATE_MCS_SPATIAL_POS 3 2715c5aa3f13a50881b8f6e529e321bbefb5faec37bHalperin, Daniel C#define RATE_MCS_SPATIAL_MSK 0x18 272abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_DUP_POS 5 273abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_DUP_MSK 0x20 274abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 275075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ 276abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_FLAGS_POS 8 277abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_POS 8 278abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_HT_MSK 0x100 279abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 280075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 281abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CCK_POS 9 282abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_CCK_MSK 0x200 283abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 284075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 10: (1) Use Green Field preamble */ 285abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_GF_POS 10 286abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_GF_MSK 0x400 287abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 288075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 11: (1) Use 40Mhz FAT chnl width, (0) use 20 MHz legacy chnl width */ 289abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_FAT_POS 11 290abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_FAT_MSK 0x800 291abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 292075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 12: (1) Duplicate data on both 20MHz chnls. FAT (bit 11) must be set. */ 293abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_DUP_POS 12 294abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_DUP_MSK 0x1000 295abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 296075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 297abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_SGI_POS 13 298abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill#define RATE_MCS_SGI_MSK 0x2000 299abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill 300abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill/** 30176eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * rate_n_flags Tx antenna masks 30276eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 4965 has 2 transmitters 30376eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5100 has 1 transmitter B 30476eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5150 has 1 transmitter A 30576eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5300 has 3 transmitters 30676eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * 5350 has 3 transmitters 30776eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler * bit14:16 308abceddb40728397fcfd0b295d7530920a606ab88Ben M Cahill */ 309600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_POS 14 310600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_A_MSK 0x04000 311600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_B_MSK 0x08000 312600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_C_MSK 0x10000 313600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) 314600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) 31576eff18bdc5feaa53f1be33709b67df02f1d55e9Tomas Winkler#define RATE_ANT_NUM 3 31680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 31780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_NUM_ENTRIES 33 31880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 31980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill#define POWER_TABLE_CCK_ENTRY 32 32080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 32180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/** 32280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * union iwl4965_tx_power_dual_stream 32380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 32480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 32580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Use __le32 version (struct tx_power_dual_stream) when building command. 32680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 32780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Driver provides radio gain and DSP attenuation settings to device in pairs, 32880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * one value for each transmitter chain. The first value is for transmitter A, 32980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * second for transmitter B. 33080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 33180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * For SISO bit rates, both values in a pair should be identical. 33280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * For MIMO rates, one value may be different from the other, 33380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * in order to balance the Tx output between the two transmitters. 33480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 33580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * See more details in doc for TXPOWER in iwl-4965-hw.h. 33680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */ 33780cc0c382db318de88577eff027d5c4097abef81Ben M Cahillunion iwl4965_tx_power_dual_stream { 33880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill struct { 33980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill u8 radio_tx_gain[2]; 34080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill u8 dsp_predis_atten[2]; 34180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill } s; 34280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill u32 dw; 34380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill}; 34480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 34580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/** 34680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * struct tx_power_dual_stream 34780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 34880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 34980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 35080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Same format as iwl_tx_power_dual_stream, but __le32 35180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */ 35280cc0c382db318de88577eff027d5c4097abef81Ben M Cahillstruct tx_power_dual_stream { 35380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill __le32 dw; 35480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill} __attribute__ ((packed)); 35580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 35680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/** 35780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * struct iwl4965_tx_power_db 35880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 35980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH 36080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill */ 36180cc0c382db318de88577eff027d5c4097abef81Ben M Cahillstruct iwl4965_tx_power_db { 36280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; 36380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill} __attribute__ ((packed)); 36480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 365630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler/** 366a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * Command REPLY_TX_POWER_DBM_CMD = 0x98 367630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler * struct iwl5000_tx_power_dbm_cmd 368630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler */ 369630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler#define IWL50_TX_POWER_AUTO 0x7f 370853554accce19d16b03476676bdcb1ccdd44caaeGregory Greenman#define IWL50_TX_POWER_NO_CLOSED (0x1 << 6) 371853554accce19d16b03476676bdcb1ccdd44caaeGregory Greenman 372630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winklerstruct iwl5000_tx_power_dbm_cmd { 373630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 374630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler u8 flags; 375630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ 376630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler u8 reserved; 377630fe9b6f774dd55b71fe94392101eb00df58762Tomas Winkler} __attribute__ ((packed)); 37880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill 379b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 380b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (0a) 381b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Alive and Error Commands & Responses: 382b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 383b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 384b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 38551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define UCODE_VALID_OK cpu_to_le32(0x1) 386b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define INITIALIZE_SUBTYPE (9) 387b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 388b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 389075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) 390075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 391075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode issues this "initialize alive" notification once the initialization 392075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode image has completed its work, and is ready to load the runtime image. 393075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * This is the *first* "alive" notification that the driver will receive after 394075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. 395075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 396075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * See comments documenting "BSM" (bootstrap state machine). 397075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 398075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * For 4965, this notification contains important calibration data for 399075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * calculating txpower settings: 400075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 401075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 1) Power supply voltage indication. The voltage sensor outputs higher 402a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * values for lower voltage, and vice verse. 403075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 404075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2) Temperature measurement parameters, for each of two channel widths 405075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * (20 MHz and 40 MHz) supported by the radios. Temperature sensing 406075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * is done via one of the receiver chains, and channel width influences 407075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * the results. 408075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 409075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, 410075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * for each of 5 frequency ranges. 411b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 412885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_init_alive_resp { 413b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ucode_minor; 414b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ucode_major; 415b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved1; 416b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sw_rev[8]; 417b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ver_type; 418075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill u8 ver_subtype; /* "9" for initialize alive */ 419b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved2; 420b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 log_event_table_ptr; 421b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 error_event_table_ptr; 422b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 timestamp; 423b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 is_valid; 424075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill 425075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill /* calibration values from "initialize" uCode */ 426075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 voltage; /* signed, higher value is lower voltage */ 427075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for FAT channel*/ 428075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 therm_r2[2]; /* signed */ 429075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 therm_r3[2]; /* signed */ 430075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 therm_r4[2]; /* signed */ 431075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, 432075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2 Tx chains */ 433b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 434b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 435075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill 436075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill/** 437075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * REPLY_ALIVE = 0x1 (response only, not a command) 438075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 439075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * uCode issues this "alive" notification once the runtime image is ready 440075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * to receive commands from the driver. This is the *second* "alive" 441075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * notification that the driver will receive after rebooting uCode; 442075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * this "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 * This response includes two pointers to structures within the device's 447075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: 448075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 449075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 1) log_event_table_ptr indicates base of the event log. This traces 450075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * a 256-entry history of uCode execution within a circular buffer. 451075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * Its header format is: 452075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 453075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 log_size; log capacity (in number of entries) 454075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 type; (1) timestamp with each entry, (0) no timestamp 455075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 wraps; # times uCode has wrapped to top of circular buffer 456075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 write_index; next circular buffer entry that uCode would fill 457075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 458075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * The header is followed by the circular buffer of log entries. Entries 459075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * with timestamps have the following format: 460075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 461075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 event_id; range 0 - 1500 462075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 timestamp; low 32 bits of TSF (of network, if associated) 463075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 data; event_id-specific data value 464075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 465075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * Entries without timestamps contain only event_id and data. 466075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 467075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 2) error_event_table_ptr indicates base of the error log. This contains 468075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * information about any uCode error that occurs. For 4965, the format 469075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * of the error log is: 470075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 471075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 valid; (nonzero) valid, (0) log is empty 472075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 error_id; type of error 473075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 pc; program counter 474075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 blink1; branch link 475075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 blink2; branch link 476075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 ilink1; interrupt link 477075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 ilink2; interrupt link 478075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 data1; error-specific data 479075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 data2; error-specific data 480075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 line; source code line of error 481075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 bcon_time; beacon timer 482075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 tsf_low; network timestamp function timer 483075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * __le32 tsf_hi; network timestamp function timer 484075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * 485075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * The Linux driver can print both logs to the system log when a uCode error 486075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill * occurs. 487075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill */ 488885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_alive_resp { 489b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ucode_minor; 490b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ucode_major; 491b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved1; 492b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sw_rev[8]; 493b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ver_type; 494075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill u8 ver_subtype; /* not "9" for runtime alive */ 495b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved2; 496075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 log_event_table_ptr; /* SRAM address for event log */ 497075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill __le32 error_event_table_ptr; /* SRAM address for error log */ 498b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 timestamp; 499b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 is_valid; 500b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 501b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 502075416cd18cb4a7ed057d9a96b388bc23b43c4b1Ben M Cahill 503b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 504b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 505b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ERROR = 0x2 (response only, not a command) 506b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 507885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winklerstruct iwl_error_resp { 508b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 error_type; 509b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 cmd_id; 510b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 511b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 bad_cmd_seq_num; 512b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 error_info; 5133195c1f3499912b207ae600968488759b16037fcTomas Winkler __le64 timestamp; 514b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 515b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 516b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 517b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (1) 518b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * RXON Commands & Responses: 519b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 520b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 521b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 522b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 523b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx config defines & structure 524b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 525b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config device types */ 526b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 527b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_DEV_TYPE_AP = 1, 528b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_DEV_TYPE_ESS = 3, 529b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_DEV_TYPE_IBSS = 4, 530b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_DEV_TYPE_SNIFFER = 6, 531b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 532b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 53314519a0b46085db68e610147098d03386c34801fBen M Cahill 53451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) 53551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) 53614519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_VALID_POS (1) 53751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) 53814519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_FORCE_SEL_POS (4) 53951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) 54014519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 54151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) 54214519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_CNT_POS (10) 54351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) 54414519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_MIMO_CNT_POS (12) 54551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) 54614519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 54714519a0b46085db68e610147098d03386c34801fBen M Cahill 548b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config flags */ 549b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* band & modulation selection */ 55051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) 55151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) 552b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* auto detection enable */ 55351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) 554b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* TGg protection when tx */ 55551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) 556b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* cck short slot & preamble */ 55751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) 55851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) 559b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* antenna selection */ 56051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) 56151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) 56251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 56351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 564b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* radar detection enable */ 56551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) 56651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) 567b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx response to host with 8-byte TSF 568b481de9ca074528fe8c429604e2777db8b89806aZhu Yi* (according to ON_AIR deassertion) */ 56951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) 570b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 57114519a0b46085db68e610147098d03386c34801fBen M Cahill 57214519a0b46085db68e610147098d03386c34801fBen M Cahill/* HT flags */ 57314519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) 57451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) 57514519a0b46085db68e610147098d03386c34801fBen M Cahill 57614519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_HT_OPERATING_MODE_POS (23) 57714519a0b46085db68e610147098d03386c34801fBen M Cahill 57851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) 57951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_FAT_PROT_MSK cpu_to_le32(0x2 << 23) 58014519a0b46085db68e610147098d03386c34801fBen M Cahill 58114519a0b46085db68e610147098d03386c34801fBen M Cahill#define RXON_FLG_CHANNEL_MODE_POS (25) 58251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) 58351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK cpu_to_le32(0x1 << 25) 58451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_CHANNEL_MODE_MIXED_MSK cpu_to_le32(0x2 << 25) 585a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach/* CTS to self (if spec allows) flag */ 58651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) 58714519a0b46085db68e610147098d03386c34801fBen M Cahill 588b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* rx_config filter flags */ 589b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* accept all data frames */ 59051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) 591b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* pass control & management to host */ 59251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) 593b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* accept multi-cast */ 59451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) 595b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* don't decrypt uni-cast frames */ 59651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) 597b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* don't decrypt multi-cast frames */ 59851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) 599b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* STA is associated */ 60051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) 601b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* transfer to host non bssid beacons in associated state */ 60251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) 603b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 60480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill/** 605b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_RXON = 0x10 (command, has simple generic response) 60680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 60780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * RXON tunes the radio tuner to a service channel, and sets up a number 60880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * of parameters that are used primarily for Rx, but also for Tx operations. 60980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 61080cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * NOTE: When tuning to a new channel, driver must set the 61180cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent 61280cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * info within the device, including the station tables, tx retry 61380cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * rate tables, and txpower tables. Driver must build a new station 61480cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * table and txpower table before transmitting anything on the RXON 61580cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * channel. 61680cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * 61780cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * NOTE: All RXONs wipe clean the internal txpower table. Driver must 61880cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), 61980cc0c382db318de88577eff027d5c4097abef81Ben M Cahill * regardless of whether RXON_FILTER_ASSOC_MSK is set. 620b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 621bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_rxon_cmd { 622b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 node_addr[6]; 623b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved1; 624b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 bssid_addr[6]; 625b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved2; 626b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 wlap_bssid_addr[6]; 627b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved3; 628b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 dev_type; 629b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 air_propagation; 630b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 rx_chain; 631b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_basic_rates; 632b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 cck_basic_rates; 633b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 assoc_id; 634b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 flags; 635b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 filter_flags; 636b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel; 637b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_ht_single_stream_basic_rates; 638b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_ht_dual_stream_basic_rates; 639b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 640b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 641a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* 5000 HW just extend this command */ 642c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenmanstruct iwl_rxon_cmd { 643c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 node_addr[6]; 644c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 reserved1; 645c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 bssid_addr[6]; 646c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 reserved2; 647c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 wlap_bssid_addr[6]; 648c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 reserved3; 649c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 dev_type; 650c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 air_propagation; 651c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 rx_chain; 652c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 ofdm_basic_rates; 653c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 cck_basic_rates; 654c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 assoc_id; 655c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le32 flags; 656c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le32 filter_flags; 657c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 channel; 658c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 ofdm_ht_single_stream_basic_rates; 659c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 ofdm_ht_dual_stream_basic_rates; 660c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 ofdm_ht_triple_stream_basic_rates; 661c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman u8 reserved5; 662c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 acquisition_data; 663c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman __le16 reserved6; 664c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman} __attribute__ ((packed)); 665c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman 666fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunskystruct iwl5000_rxon_assoc_cmd { 667fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le32 flags; 668fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le32 filter_flags; 669fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 ofdm_basic_rates; 670fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 cck_basic_rates; 671fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le16 reserved1; 672fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 ofdm_ht_single_stream_basic_rates; 673fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 ofdm_ht_dual_stream_basic_rates; 674fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 ofdm_ht_triple_stream_basic_rates; 675fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky u8 reserved2; 676fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le16 rx_chain_select_flags; 677fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le16 acquisition_data; 678fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky __le32 reserved3; 679fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky} __attribute__ ((packed)); 680c1adf9fb31e31ee753d613bd5bc6aef9b762b747Gregory Greenman 681b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 682b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) 683b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 684bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_rxon_assoc_cmd { 685b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 flags; 686b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 filter_flags; 687b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_basic_rates; 688b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 cck_basic_rates; 689b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_ht_single_stream_basic_rates; 690b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ofdm_ht_dual_stream_basic_rates; 691b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 rx_chain_select_flags; 692b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 693b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 694b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 695b5d7be5e665f29274cfe6645b661acb38cb1d19bTomas Winkler#define IWL_CONN_MAX_LISTEN_INTERVAL 10 696fe7a90c2b73f0c1da0882861cd015c835ed28781Ron Rindjunsky 697b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 698b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) 699b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 7003195c1f3499912b207ae600968488759b16037fcTomas Winklerstruct iwl_rxon_time_cmd { 7013195c1f3499912b207ae600968488759b16037fcTomas Winkler __le64 timestamp; 702b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 beacon_interval; 703b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 atim_window; 704b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_init_val; 705b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 listen_interval; 706b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 707b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 708b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 709b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 710b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 711b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 7122aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_channel_switch_cmd { 713b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 band; 714b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 expect_beacon; 715b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel; 716b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rxon_flags; 717b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rxon_filter_flags; 718b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 switch_time; 719bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig struct iwl4965_tx_power_db tx_power; 720b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 721b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 722b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 723b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) 724b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 7252aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_csa_notification { 726b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 band; 727b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel; 728b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 status; /* 0 - OK, 1 - fail */ 729b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 730b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 731b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 732b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (2) 733b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Quality-of-Service (QOS) Commands & Responses: 734b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 735b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 7362054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 7372054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/** 7382054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM 7392054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd 7402054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 7412054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @cw_min: Contention window, start value in numbers of slots. 7422054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Should be a power-of-2, minus 1. Device's default is 0x0f. 7432054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @cw_max: Contention window, max value in numbers of slots. 7442054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Should be a power-of-2, minus 1. Device's default is 0x3f. 7452054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @aifsn: Number of slots in Arbitration Interframe Space (before 7462054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * performing random backoff timing prior to Tx). Device default 1. 7472054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 7482054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 7492054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Device will automatically increase contention window by (2*CW) + 1 for each 7502054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 7512054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * value, to cap the CW value. 7522054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill */ 7531ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbachstruct iwl_ac_qos { 754b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 cw_min; 755b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 cw_max; 756b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 aifsn; 757b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 758b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 edca_txop; 759b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 760b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 761b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* QoS flags defines */ 76251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) 76351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) 76451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) 765b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 7662054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Number of Access Categories (AC) (EDCA), queues 0..3 */ 767b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AC_NUM 4 768b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 769b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 770b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) 7712054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 7722054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 7732054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 774b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 7751ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbachstruct iwl_qosparam_cmd { 776b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 qos_flags; 7771ff50bda6eef4466366e197541508fc69af0f0c0Emmanuel Grumbach struct iwl_ac_qos ac[AC_NUM]; 778b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 779b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 780b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 781b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (3) 782b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Add/Modify Stations Commands & Responses: 783b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 784b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 785b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 786b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Multi station support 787b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 7882054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 7892054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Special, dedicated locations within device's station table */ 790b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_AP_ID 0 791b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_MULTICAST_ID 1 792b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_STA_ID 2 7934c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL3945_BROADCAST_ID 24 7944c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define IWL3945_STATION_COUNT 25 795b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL4965_BROADCAST_ID 31 796b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL4965_STATION_COUNT 32 797fdd3e8a4ff96d03121b21946bfa684f3b5d783c6Tomas Winkler#define IWL5000_BROADCAST_ID 15 798fdd3e8a4ff96d03121b21946bfa684f3b5d783c6Tomas Winkler#define IWL5000_STATION_COUNT 16 799b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 800b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ 801b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_INVALID_STATION 255 802b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 8034c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2); 8044c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); 80551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8); 80651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) 80751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) 80874093ddf4c42da74922b63fb6844989e21164d9eBen M Cahill#define STA_FLG_MAX_AGG_SIZE_POS (19) 80951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) 81051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_FAT_EN_MSK cpu_to_le32(1 << 21) 81151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) 81274093ddf4c42da74922b63fb6844989e21164d9eBen M Cahill#define STA_FLG_AGG_MPDU_DENSITY_POS (23) 81351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) 814b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 8152054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Use in mode field. 1: modify existing entry, 0: add new station entry */ 816b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_CONTROL_MODIFY_MSK 0x01 817b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 818b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* key flags __le16*/ 81951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) 82051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) 82151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) 82251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) 82351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) 824b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 825b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_KEY_FLG_KEYID_POS 8 82651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) 827eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach/* wep key is either from global key (0) or from station info array (1) */ 82851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) 829eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach 830eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ 83151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) 83251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) 833deb09c435e3f947f8b2c9d5df6a9c0a5b472b125Emmanuel Grumbach#define STA_KEY_MAX_NUM 8 834b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 8352054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Flags indicate whether to modify vs. don't change various station params */ 836b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_KEY_MASK 0x01 837b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_TID_DISABLE_TX 0x02 838b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_TX_RATE_MSK 0x04 839b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_ADDBA_TID_MSK 0x08 840b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define STA_MODIFY_DELBA_TID_MSK 0x10 8412054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 8422054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/* Receiver address (actually, Rx station's index into station table), 8432054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 844b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 845b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 846bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_keyinfo { 847b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 key_flags; 848b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 849b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 850b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 851eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach u8 key_offset; 852eaaf7894959d413d1e01443a622c507e1b4f61dbEmmanuel Grumbach u8 reserved2; 853b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 key[16]; /* 16-byte unicast decryption key */ 854b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 855b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 856133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler/* 5000 */ 857133636deffc86809f59a0c8b768408d13237a9a2Tomas Winklerstruct iwl_keyinfo { 858133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le16 key_flags; 859133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 860133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 reserved1; 861133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 862133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 key_offset; 863133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 reserved2; 864133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 key[16]; /* 16-byte unicast decryption key */ 865133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le64 tx_secur_seq_cnt; 866133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le64 hw_tkip_mic_rx_key; 867133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le64 hw_tkip_mic_tx_key; 868133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler} __attribute__ ((packed)); 869133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 8702054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill/** 8712054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * struct sta_id_modify 8722054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @addr[ETH_ALEN]: station's MAC address 8732054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @sta_id: index of station in uCode's station table 8742054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 8752054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 8762054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Driver selects unused table index when adding new station, 8772054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * or the index to a pre-existing station entry when modifying that station. 8782054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). 8792054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 8802054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * modify_mask flags select which parameters to modify vs. leave alone. 8812054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill */ 882b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct sta_id_modify { 883b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 addr[ETH_ALEN]; 884b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved1; 885b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sta_id; 886b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 modify_mask; 887b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved2; 888b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 889b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 890b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 891b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ADD_STA = 0x18 (command) 8922054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 8932054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * The device contains an internal table of per-station information, 8942054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * with info on security keys, aggregation parameters, and Tx rates for 8952054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD, 8962054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 3945 uses REPLY_RATE_SCALE to set up rate tables). 8972054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 8982054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * REPLY_ADD_STA sets up the table entry for one station, either creating 8992054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * a new entry, or modifying a pre-existing one. 9002054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 9012054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * NOTE: RXON command (without "associated" bit set) wipes the station table 9022054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * clean. Moving into RF_KILL state does this also. Driver must set up 9032054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * new station table before transmitting anything on the RXON channel 9042054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * (except active scans or active measurements; those commands carry 9052054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * their own txpower/rate setup data). 9062054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * 9072054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * When getting started on a new channel, driver must set up the 9082054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * IWL_BROADCAST_ID entry (last entry in the table). For a client 9092054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * station in a BSS, once an AP is selected, driver sets up the AP STA 9102054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP 9112054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * are all that are needed for a BSS client station. If the device is 9122054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * used as AP, or in an IBSS network, driver must set up station table 9132054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * entries for all STAs in network, starting with index IWL_STA_ID. 914b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 915bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_addsta_cmd { 9162054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill u8 mode; /* 1: modify existing, 0: add new station */ 917b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved[3]; 918b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct sta_id_modify sta; 919bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig struct iwl4965_keyinfo key; 9202054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill __le32 station_flags; /* STA_FLG_* */ 9212054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill __le32 station_flags_msk; /* STA_FLG_* */ 9222054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 9232054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 9242054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * corresponding to bit (e.g. bit 5 controls TID 5). 9252054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 926b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 tid_disable_tx; 9272054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 928b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved1; 9292054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 9302054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill /* TID for which to add block-ack support. 9312054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 932b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 add_immediate_ba_tid; 9332054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 9342054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill /* TID for which to remove block-ack support. 9352054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 936b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 remove_immediate_ba_tid; 9372054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 9382054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill /* Starting Sequence Number for added block-ack support. 9392054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 940b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 add_immediate_ba_ssn; 9412054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill 942b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 943b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 944b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 945133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler/* 5000 */ 946133636deffc86809f59a0c8b768408d13237a9a2Tomas Winklerstruct iwl_addsta_cmd { 947133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 mode; /* 1: modify existing, 0: add new station */ 948133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 reserved[3]; 949133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler struct sta_id_modify sta; 950133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler struct iwl_keyinfo key; 951133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le32 station_flags; /* STA_FLG_* */ 952133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le32 station_flags_msk; /* STA_FLG_* */ 953133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 954133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 955133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler * corresponding to bit (e.g. bit 5 controls TID 5). 956133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 957133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le16 tid_disable_tx; 958133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 959133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le16 reserved1; 960133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 961133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler /* TID for which to add block-ack support. 962133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 963133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 add_immediate_ba_tid; 964133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 965133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler /* TID for which to remove block-ack support. 966133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 967133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler u8 remove_immediate_ba_tid; 968133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 969133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler /* Starting Sequence Number for added block-ack support. 970133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 971133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le16 add_immediate_ba_ssn; 972133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 973133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler __le32 reserved2; 974133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler} __attribute__ ((packed)); 975133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 976133636deffc86809f59a0c8b768408d13237a9a2Tomas Winkler 9772054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_SUCCESS_MSK 0x1 9782054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_NO_ROOM_IN_TABLE 0x2 9792054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 9802054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 981b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 982b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_ADD_STA = 0x18 (response) 983b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 9847a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_add_sta_resp { 9852054a00bb83409345d14a944e25c15e6ea317651Ben M Cahill u8 status; /* ADD_STA_* */ 986b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 987b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 9887a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler#define REM_STA_SUCCESS_MSK 0x1 9897a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler/* 9907a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler * REPLY_REM_STA = 0x19 (response) 9917a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler */ 9927a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_rem_sta_resp { 9937a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler u8 status; 9947a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler} __attribute__ ((packed)); 9957a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler 9967a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler/* 9977a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler * REPLY_REM_STA = 0x19 (command) 9987a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler */ 9997a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winklerstruct iwl_rem_sta_cmd { 10007a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler u8 num_sta; /* number of removed stations */ 10017a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler u8 reserved[3]; 10027a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 10037a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler u8 reserved2[2]; 10047a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler} __attribute__ ((packed)); 10057a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler 10060a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach/* 10070a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach * REPLY_WEP_KEY = 0x20 10080a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach */ 10090a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbachstruct iwl_wep_key { 10100a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 key_index; 10110a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 key_offset; 10120a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 reserved1[2]; 10130a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 key_size; 10140a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 reserved2[3]; 10150a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 key[16]; 10160a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach} __attribute__ ((packed)); 10170a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach 10180a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbachstruct iwl_wep_cmd { 10190a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 num_keys; 10200a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 global_key_type; 10210a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 flags; 10220a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach u8 reserved; 10230a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach struct iwl_wep_key key[0]; 10240a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach} __attribute__ ((packed)); 10250a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach 10260a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEY_WEP_TYPE 1 10270a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEYS_MAX 4 10280a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_INVALID_OFFSET 0xff 10294564ce8b0e17d91d047aa875843deb2cccf3f268Emmanuel Grumbach#define WEP_KEY_LEN_64 5 10300a0bed1d10105a9f58cd14ebe216e8479dd31fdaEmmanuel Grumbach#define WEP_KEY_LEN_128 13 1031b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1032b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 1033b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (4) 1034b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx Responses: 1035b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1036b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 1037b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 103851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) 103951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) 10408211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler 104151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) 104251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 104351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 104451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 104551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) 10468211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler 10478211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 10488211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) 10498211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) 10508211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) 10518211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) 105217e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) 105317e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach 105417e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_RES_STATUS_STATION_FOUND (1<<6) 105517e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) 10568211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler 10578211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) 10588211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) 10598211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) 10608211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 10618211ef78d9023a8772e5acf6b7934598156b2fc8Tomas Winkler#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 1062b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 106317e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_ICV_OK (0x20) 106417e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_MIC_OK (0x40) 106517e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 106617e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 106717e476b8db13790c03e2c46d93abc71468fca47eEmmanuel Grumbach 1068b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Fixed (non-configurable) rx data from phy */ 1069caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler 1070caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_RES_PHY_CNT 14 1071caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1072caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1073caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 1074caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL49_AGC_DB_POS (7) 1075b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct iwl4965_rx_non_cfg_phy { 1076b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 1077b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 1078b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 1079b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 pad[0]; 1080b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1081b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1082caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler 1083caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_PHY_CNT 8 1084caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_AGC_IDX 1 1085caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_RSSI_AB_IDX 2 1086caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_RX_RES_RSSI_C_IDX 3 1087caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_AGC_MSK 0xfe00 1088caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_AGC_BIT_POS 9 1089caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_A_MSK 0x00ff 1090caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_A_BIT_POS 0 1091caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_B_MSK 0xff0000 1092caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_B_BIT_POS 16 1093caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_C_MSK 0x00ff 1094caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler#define IWL50_OFDM_RSSI_C_BIT_POS 0 1095caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler 1096caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winklerstruct iwl5000_non_cfg_phy { 1097a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* up to 8 phy entries */ 1098caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler} __attribute__ ((packed)); 1099caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler 1100caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler 1101b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1102857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler * REPLY_RX = 0xc3 (response only, not a command) 1103b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Used only for legacy (non 11n) frames. 1104b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1105caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winklerstruct iwl_rx_phy_res { 1106b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 1107b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 1108b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 stat_id; /* configurable DSP phy data set ID */ 1109b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 1110b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le64 timestamp; /* TSF at on air rise */ 1111b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_time_stamp; /* beacon at on-air rise */ 1112b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 phy_flags; /* general phy flags: band, modulation, ... */ 1113b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel; /* channel number */ 1114caab8f1a5d0da583b6ffe41afea2774c676444caTomas Winkler u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 1115529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le32 rate_n_flags; /* RATE_MCS_* */ 1116529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le16 byte_count; /* frame's byte-count */ 1117b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved3; 1118b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1119b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1120b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct iwl4965_rx_mpdu_res_start { 1121b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 byte_count; 1122b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 1123b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1124b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1126b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 1127b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (5) 1128b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Tx Commands & Responses: 1129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1130529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver must place each REPLY_TX command into one of the prioritized Tx 1131529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * queues in host DRAM, shared between driver and device (see comments for 1132529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode 1133529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * are preparing to transmit, the device pulls the Tx command over the PCI 1134529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * bus via one of the device's Tx DMA channels, to fill an internal FIFO 1135529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * from which data will be transmitted. 1136529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1137529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * uCode handles all timing and protocol related to control frames 1138529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler 1139529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * handle reception of block-acks; uCode updates the host driver via 1140529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * REPLY_COMPRESSED_BA (4965). 1141529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1142529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * uCode handles retrying Tx when an ACK is expected but not received. 1143529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This includes trying lower data rates than the one requested in the Tx 1144529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * command, as set up by the REPLY_RATE_SCALE (for 3945) or 1145529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * REPLY_TX_LINK_QUALITY_CMD (4965). 1146529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1147529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. 1148529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This command must be executed after every RXON command, before Tx can occur. 1149b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 1150b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1151529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* REPLY_TX Tx flags field */ 1152529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1153a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it 1154a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach * before this frame. if CTS-to-self required check 1155a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach * RXON_FLG_SELF_CTS_EN status. */ 115651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_RTS_CTS_MSK cpu_to_le32(1 << 0) 1157a326a5d096f031af46c0073dd78eb80dea1f311aEmmanuel Grumbach 1158529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Use Request-To-Send protocol before this frame. 1159529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ 116051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) 1161529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1162529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Transmit Clear-To-Send to self before this frame. 1163529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. 1164529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ 116551e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) 1166529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1167529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Expect ACK from receiving station 1168529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Don't expect ACK (MAC header's duration field s/b 0) 1169529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for unicast frames, but not broadcast/multicast. */ 117051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) 1171529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1172529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* For 4965: 1173529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). 1174529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Tx command's initial_rate_index indicates first rate to try; 1175529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * uCode walks through table for additional Tx attempts. 1176529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 1177529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This rate will be used for all Tx attempts; it will not be scaled. */ 117851e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) 1179529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1180529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Expect immediate block-ack. 1181529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ 118251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) 1183529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1184529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Frame requires full Tx-Op protection. 1185529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this if either RTS or CTS Tx Flag gets set. */ 118651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) 1187529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1188529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* Tx antenna selection field; used only for 3945, reserved (0) for 4965. 1189529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ 119051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) 119151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 119251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 1193b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1194529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Ignore Bluetooth priority for this frame. 1195529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Delay Tx until Bluetooth device is done (normal usage). */ 119651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) 1197b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1198529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: uCode overrides sequence control field in MAC header. 1199529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Driver provides sequence control field in MAC header. 1200529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for management frames, non-QOS data frames, non-unicast frames, 1201529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ 120251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) 1203b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1204529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: This frame is non-last MPDU; more fragments are coming. 1205529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: Last fragment, or not using fragmentation. */ 120651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) 1207b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1208529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. 1209529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: No TSF required in outgoing frame. 1210529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for transmitting beacons and probe responses. */ 121151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) 1212b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1213529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword 1214529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * alignment of frame's payload data field. 1215529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 0: No pad 1216529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 1217529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * field (but not both). Driver must align frame data (i.e. data following 1218529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MAC header) to DWORD boundary. */ 121951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) 1220b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 12218236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov/* accelerate aggregation support 12228236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov * 0 - no CCMP encryption; 1 - CCMP encryption */ 122351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) 12248236e183fc53be2b5d81a4f547f9c5b645e10fe0Max Stepanov 1225b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* HCCA-AP - disable duration overwriting. */ 122651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) 1227b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1228529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1229b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1230b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX command security control 1231b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1232b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_WEP 0x01 1233b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_CCM 0x02 1234b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_TKIP 0x03 1235b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_MSK 0x03 1236b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_SHIFT 6 1237b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_CMD_SEC_KEY128 0x08 1238b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1239b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 12403195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler * security overhead sizes 12413195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler */ 12423195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define WEP_IV_LEN 4 12433195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define WEP_ICV_LEN 4 12443195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define CCMP_MIC_LEN 8 12453195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler#define TKIP_ICV_LEN 4 12463195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler 12473195cdb7424b4207f6903f1f3ddadcab49fa22f2Tomas Winkler/* 1248529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 4965 uCode updates these Tx attempt count values in host DRAM. 1249529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Used for managing Tx retries when expecting block-acks. 1250529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver should set these fields to 0. 1251b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 12522aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_dram_scratch { 1253529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 try_cnt; /* Tx attempts */ 1254529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 1255b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 1256b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1257b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1258b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1259b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX = 0x1c (command) 1260b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 126183d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winklerstruct iwl_tx_cmd { 1262529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1263529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MPDU byte count: 1264529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 1265529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * + 8 byte IV for CCM or TKIP (not used for WEP) 1266529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * + Data payload 1267529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * + 8-byte MIC (not used for CCM/WEP) 1268529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 1269529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 1270529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Range: 14-2342 bytes. 1271529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 1272b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 len; 1273529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1274529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1275529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MPDU or MSDU byte count for next frame. 1276529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Used for fragmentation and bursting, but not 11n aggregation. 1277529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Same as "len", but for next frame. Set to 0 if not applicable. 1278529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 1279b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 next_frame_len; 1280529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1281529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le32 tx_flags; /* TX_CMD_FLG_* */ 1282529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 12832aa6ab86bc475a115f56645591d2413981846509Tomas Winkler /* uCode may modify this field of the Tx command (in host DRAM!). 1284529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 12852aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_dram_scratch scratch; 1286529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1287529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 1288529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le32 rate_n_flags; /* RATE_MCS_* */ 1289529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1290529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* Index of destination station in uCode's station table */ 1291b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sta_id; 1292529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1293529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* Type of security encryption: CCM or TKIP */ 1294529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 sec_ctl; /* TX_CMD_SEC_* */ 1295529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1296529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1297529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial 1298529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for 1299529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * data frames, this field may be used to selectively reduce initial 1300529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * rate (via non-0 value) for special frames (e.g. management), while 1301529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * still supporting rate scaling for all frames. 1302529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 1303b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 initial_rate_index; 1304b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved; 1305b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 key[16]; 1306b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 next_frame_flags; 1307b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved2; 1308b481de9ca074528fe8c429604e2777db8b89806aZhu Yi union { 1309b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 life_time; 1310b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 attempt; 1311b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } stop_time; 1312529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1313529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* Host DRAM physical address pointer to "scratch" in this command. 1314529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ 1315b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 dram_lsb_ptr; 1316b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 dram_msb_ptr; 1317529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1318b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 rts_retry_limit; /*byte 50 */ 1319b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 data_retry_limit; /*byte 51 */ 1320b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 tid_tspec; 1321b481de9ca074528fe8c429604e2777db8b89806aZhu Yi union { 1322b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 pm_frame_timeout; 1323b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 attempt_duration; 1324b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } timeout; 1325529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1326529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1327529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Duration of EDCA burst Tx Opportunity, in 32-usec units. 1328529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 1329529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 1330b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 driver_txop; 1331529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1332529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1333529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * MAC header goes here, followed by 2 bytes padding if MAC header 1334529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * length is 26 or 30 bytes, followed by payload data 1335529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 1336b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 payload[0]; 1337b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct ieee80211_hdr hdr[0]; 1338b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1339b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1340b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* TX command response is sent after *all* transmission attempts. 1341b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1342b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * NOTES: 1343b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1344b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FAIL_NEXT_FRAG 1345b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1346b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the fragment flag in the MAC header for the frame being transmitted 1347b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * is set and there is insufficient time to transmit the next frame, the 1348b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. 1349b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1350b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FIFO_UNDERRUN 1351b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1352b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Indicates the host did not provide bytes to the FIFO fast enough while 1353b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * a TX was in progress. 1354b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1355b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * TX_STATUS_FAIL_MGMNT_ABORT 1356b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1357b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This status is only possible if the ABORT ON MGMT RX parameter was 1358b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * set to true with the TX command. 1359b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1360b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the MSB of the status parameter is set then an abort sequence is 1361b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * required. This sequence consists of the host activating the TX Abort 1362b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * control line, and then waiting for the TX Abort command response. This 1363b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * indicates that a the device is no longer in a transmit state, and that the 1364b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * command FIFO has been cleared. The host must then deactivate the TX Abort 1365b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * control line. Receiving is still allowed in this case. 1366b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1367b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 1368b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_SUCCESS = 0x01, 1369b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_DIRECT_DONE = 0x02, 1370b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 1371b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_LONG_LIMIT = 0x83, 1372b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 1373b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_MGMNT_ABORT = 0x85, 1374b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_NEXT_FRAG = 0x86, 1375b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 1376b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_DEST_PS = 0x88, 1377b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_ABORTED = 0x89, 1378b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_BT_RETRY = 0x8a, 1379b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_STA_INVALID = 0x8b, 1380b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 1381b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_TID_DISABLE = 0x8d, 1382b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, 1383b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 1384b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_TX_LOCKED = 0x90, 1385b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 1386b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1387b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1388b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_PACKET_MODE_REGULAR 0x0000 1389b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_PACKET_MODE_BURST_SEQ 0x0100 1390b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define TX_PACKET_MODE_BURST_FIRST 0x0200 1391b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1392b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 1393b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_POWER_PA_NOT_ACTIVE = 0x0, 1394b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1395b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1396b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 13973fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ 1398b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_DELAY_MSK = 0x00000040, 1399b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_STATUS_ABORT_MSK = 0x00000080, 1400b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ 1401b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ 14023fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler TX_RESERVED = 0x00780000, /* bits 19:22 */ 1403b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ 1404b481de9ca074528fe8c429604e2777db8b89806aZhu Yi TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 1405b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1406b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 14073fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winklerstatic inline bool iwl_is_tx_success(u32 status) 1408a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler{ 1409a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler status &= TX_STATUS_MSK; 14103fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler return (status == TX_STATUS_SUCCESS) || 14113fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler (status == TX_STATUS_DIRECT_DONE); 1412a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler} 1413a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler 1414a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler 1415a332f8d618a7bdb0096c7b21555120a1822cedecTomas Winkler 1416b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* ******************************* 1417529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * TX aggregation status 1418b481de9ca074528fe8c429604e2777db8b89806aZhu Yi ******************************* */ 1419b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1420b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 1421b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_TRANSMITTED = 0x00, 1422b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_UNDERRUN_MSK = 0x01, 1423b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_BT_PRIO_MSK = 0x02, 1424b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_FEW_BYTES_MSK = 0x04, 1425b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_ABORT_MSK = 0x08, 1426b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, 1427b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, 1428b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, 1429b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_SCD_QUERY_MSK = 0x80, 1430b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, 1431b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_RESPONSE_MSK = 0x1ff, 1432b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_DUMP_TX_MSK = 0x200, 1433b481de9ca074528fe8c429604e2777db8b89806aZhu Yi AGG_TX_STATE_DELAY_TX_MSK = 0x400 1434b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1435b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 14363fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ 14373fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ 14383fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) 1439b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1440529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* # tx attempts for first frame in aggregation */ 1441b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_TRY_CNT_POS 12 1442b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 1443b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1444529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill/* Command ID and sequence number of Tx command for this frame */ 1445b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_SEQ_NUM_POS 16 1446b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 1447b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1448b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1449b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX = 0x1c (response) 1450529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1451529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This response may be in one of two slightly different formats, indicated 1452529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * by the frame_count field: 1453529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1454529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1) No aggregation (frame_count == 1). This reports Tx results for 1455529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * a single frame. Multiple attempts, at various bit rates, may have 1456529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * been made for this frame. 1457529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1458529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 2) Aggregation (frame_count > 1). This reports Tx results for 1459529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 2 or more frames that used block-acknowledge. All frames were 1460529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * transmitted at same rate. Rate scaling may have been used if first 1461529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * frame in this new agg block failed in previous agg block(s). 1462529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1463529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Note that, for aggregation, ACK (block-ack) status is not delivered here; 1464529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * block-ack has not been received by the time the 4965 records this status. 1465529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * This status relates to reasons the tx might have been blocked or aborted 1466529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * within the sending station (this 4965), rather than whether it was 1467529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * received successfully by the destination station. 1468b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1469001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunskystruct agg_tx_status { 1470001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le16 status; 1471001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le16 sequence; 1472001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky} __attribute__ ((packed)); 1473001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky 1474bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_tx_resp { 1475b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 frame_count; /* 1 no aggregation, >1 aggregation */ 1476529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 1477529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 failure_rts; /* # failures due to unsuccessful RTS */ 1478529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 1479529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1480529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* For non-agg: Rate at which frame was successful. 1481529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * For agg: Rate at which all frames were transmitted. */ 1482529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le32 rate_n_flags; /* RATE_MCS_* */ 1483529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1484529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 1485529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 1486529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le16 wireless_media_time; /* uSecs */ 1487529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1488b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 1489529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill __le32 pa_power1; /* RF power amplifier measurement (not used) */ 1490b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 pa_power2; 1491529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1492529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* 1493529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * For non-agg: frame status TX_STATUS_* 1494529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 1495529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * fields follow this one, up to frame_count. 1496529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Bit fields: 1497529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 11- 0: AGG_TX_STATE_* status code 1498529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 15-12: Retry count for 1st frame in aggregation (retries 1499529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * occur if tx failed for this frame when it was a 1500529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * member of a previous aggregation block). If rate 1501529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * scaling is used, retry count indicates the rate 1502529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * table entry used for all frames in the new agg. 1503529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 1504529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill */ 150525a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler union { 150625a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler __le32 status; 150725a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler struct agg_tx_status agg_status[0]; /* for each agg frame */ 150825a6572cc13ba2a3fefc02a63a077ff3664a1ca9Tomas Winkler } u; 1509fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky} __attribute__ ((packed)); 1510fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky 15113fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler/* 15123fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * definitions for initial rate index field 1513a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * bits [3:0] initial rate index 15143fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * bits [6:4] rate table color, used for the initial rate 15153fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * bit-7 invalid rate indication 15163fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * i.e. rate was not chosen from rate table 15173fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * or rate table color was changed during frame retries 15183fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler * refer tlc rate info 15193fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler */ 15203fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler 15213fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INIT_RATE_INDEX_POS 0 15223fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INIT_RATE_INDEX_MSK 0x0f 15233fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RATE_TABLE_COLOR_POS 4 15243fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RATE_TABLE_COLOR_MSK 0x70 15253fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_INV_RATE_INDEX_MSK 0x80 15263fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler 15273fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler/* refer to ra_tid */ 15283fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_TID_POS 0 15293fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_TID_MSK 0x0f 15303fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RA_POS 4 15313fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler#define IWL50_TX_RES_RA_MSK 0xf0 15323fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler 1533001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunskystruct iwl5000_tx_resp { 1534001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky u8 frame_count; /* 1 no aggregation, >1 aggregation */ 1535001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 1536001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky u8 failure_rts; /* # failures due to unsuccessful RTS */ 1537001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 1538001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky 1539001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky /* For non-agg: Rate at which frame was successful. 1540001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * For agg: Rate at which all frames were transmitted. */ 1541001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le32 rate_n_flags; /* RATE_MCS_* */ 1542001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky 1543001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 1544001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 1545001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le16 wireless_media_time; /* uSecs */ 1546001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky 15473fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 pa_status; /* RF power amplifier measurement (not used) */ 15483fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 pa_integ_res_a[3]; 15493fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 pa_integ_res_b[3]; 15503fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 pa_integ_res_C[3]; 1551001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky 1552001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le32 tfd_info; 1553001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le16 seq_ctl; 1554001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky __le16 byte_cnt; 15553fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 tlc_info; 15563fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler u8 ra_tid; /* tid (0:3), sta_id (4:7) */ 15573fd07a1e5aba89d4be3696c46cb7297f1873195aTomas Winkler __le16 frame_ctrl; 1558001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky /* 1559001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * For non-agg: frame status TX_STATUS_* 1560001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 1561001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * fields follow this one, up to frame_count. 1562001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * Bit fields: 1563001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * 11- 0: AGG_TX_STATE_* status code 1564001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * 15-12: Retry count for 1st frame in aggregation (retries 1565001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * occur if tx failed for this frame when it was a 1566001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * member of a previous aggregation block). If rate 1567001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * scaling is used, retry count indicates the rate 1568001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * table entry used for all frames in the new agg. 1569001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 1570001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky */ 1571001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky struct agg_tx_status status; /* TX status (in aggregation - 1572001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky * status of 1st frame) */ 1573001caff0da8784989ef208af0f39d55ea07dfef5Ron Rindjunsky} __attribute__ ((packed)); 1574b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1575b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 1576529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * 1577529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill * Reports Block-Acknowledge from recipient station 1578b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1579653fa4a07525e4cd9e7b90e6fc1f792119910636Emmanuel Grumbachstruct iwl_compressed_ba_resp { 1580b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sta_addr_lo32; 1581b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 sta_addr_hi16; 1582b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 1583529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill 1584529699815b79f15a6644786dc4d6e9dd5153a447Ben M Cahill /* Index of recipient (BA-sending) station in uCode's station table */ 1585b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sta_id; 1586b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 tid; 1587fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky __le16 seq_ctl; 1588fe01b477bbd23e69c3bdc6bce5be510ddad8297dRon Rindjunsky __le64 bitmap; 1589b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 scd_flow; 1590b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 scd_ssn; 1591b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1592b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1593b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1594b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) 15952bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 15962bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * See details under "TXPOWER" in iwl-4965-hw.h. 1597b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1598bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_txpowertable_cmd { 1599b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 1600b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved; 1601b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel; 1602bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig struct iwl4965_tx_power_db tx_power; 1603b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1604b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1605b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 16068a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 1607b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 16082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* # of EDCA prioritized tx fifos */ 1609b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define LINK_QUAL_AC_NUM AC_NUM 16102bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16112bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* # entries in rate scale table to support Tx retries */ 1612b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define LINK_QUAL_MAX_RETRY_NUM 16 1613b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 16142bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/* Tx antenna selection values */ 16158a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define LINK_QUAL_ANT_A_MSK (1 << 0) 16168a1b02452862dd30980ad0ef493eed687bc81474Reinette Chatre#define LINK_QUAL_ANT_B_MSK (1 << 1) 1617b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 1618b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 16192bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16202bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/** 162166c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler * struct iwl_link_qual_general_params 16222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16232bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Used in REPLY_TX_LINK_QUALITY_CMD 16242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 162566c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_qual_general_params { 1626b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 flags; 16272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* No entries at or above this (driver chosen) index contain MIMO */ 1629b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 mimo_delimiter; 16302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* Best single antenna to use for single stream (legacy, SISO). */ 16322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ 16332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* Best antennas to use for MIMO (unused for 4965, assumes both). */ 16352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ 16362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* 16382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * If driver needs to use different initial rates for different 16392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * EDCA QOS access categories (as implemented by tx fifos 0-3), 16402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * this table will set that up, by indicating the indexes in the 16412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 16422bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Otherwise, driver should set all entries to 0. 16432bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16442bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Entry usage: 16452bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 16462bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 16472bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 1648b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 start_rate_index[LINK_QUAL_AC_NUM]; 1649b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1650b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 16512bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill/** 165266c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler * struct iwl_link_qual_agg_params 16532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16542bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Used in REPLY_TX_LINK_QUALITY_CMD 16552bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 165666c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_qual_agg_params { 16572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16582bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* Maximum number of uSec in aggregation. 16592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Driver should set this to 4000 (4 milliseconds). */ 1660b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 agg_time_limit; 16612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16622bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* 16632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Number of Tx retries allowed for a frame, before that frame will 16642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * no longer be considered for the start of an aggregation sequence 16652bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (scheduler will then try to tx it as single frame). 16662bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Driver should set this to 3. 16672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 1668b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 agg_dis_start_th; 16692bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 16702bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* 16712bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Maximum number of frames in aggregation. 16722bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 0 = no limit (default). 1 = no aggregation. 16732bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Other values = max # frames in aggregation. 16742bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 1675b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 agg_frame_cnt_limit; 16762bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 1677b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved; 1678b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1679b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1680b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1681b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 16822bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16832bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For 4965 only; 3945 uses REPLY_RATE_SCALE. 16842bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16852bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Each station in the 4965's internal station table has its own table of 16 16862bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when 16872bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * an ACK is not received. This command replaces the entire table for 16882bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * one station. 16892bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16902bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * NOTE: Station must already be in 4965's station table. Use REPLY_ADD_STA. 16912bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16922bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The rate scaling procedures described below work well. Of course, other 16932bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * procedures are possible, and may work better for particular environments. 16942bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16952bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16962bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FILLING THE RATE TABLE 16972bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 16982bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Given a particular initial rate and mode, as determined by the rate 16992bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * scaling algorithm described below, the Linux driver uses the following 17002bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the 17012bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Link Quality command: 17022bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17032bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17042bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: 17052bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) Use this same initial rate for first 3 entries. 17062bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) Find next lower available rate using same mode (SISO or MIMO), 17072bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * use for next 3 entries. If no lower rate available, switch to 17082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * legacy mode (no FAT channel, no MIMO, no short guard interval). 17092bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) If using MIMO, set command's mimo_delimiter to number of entries 17102bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * using MIMO (3 or 6). 17112bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * d) After trying 2 HT rates, switch to legacy mode (no FAT channel, 17122bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * no MIMO, no short guard interval), at the next lower bit rate 17132bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (e.g. if second HT bit rate was 54, try 48 legacy), and follow 17142bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * legacy procedure for remaining table entries. 17152bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17162bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 2) If using legacy initial rate: 17172bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) Use the initial rate for only one entry. 17182bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) For each following entry, reduce the rate to next lower available 17192bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate, until reaching the lowest available rate. 17202bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) When reducing rate, also switch antenna selection. 17212bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * d) Once lowest available rate is reached, repeat this rate until 17222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate table is filled (16 entries), switching antenna each entry. 17232bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17252bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * ACCUMULATING HISTORY 17262bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The rate scaling algorithm for 4965, as implemented in Linux driver, uses 17282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * two sets of frame Tx success history: One for the current/active modulation 17292bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode, and one for a speculative/search mode that is being attempted. If the 17302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * speculative mode turns out to be more effective (i.e. actual transfer 17312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate is better), then the driver continues to use the speculative mode 17322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * as the new current active mode. 17332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Each history set contains, separately for each possible rate, data for a 17352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * sliding window of the 62 most recent tx attempts at that rate. The data 17362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * includes a shifting bitmap of success(1)/failure(0), and sums of successful 17372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * and attempted frames, from which the driver can additionally calculate a 17382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * success ratio (success / attempted) and number of failures 17392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (attempted - success), and control the size of the window (attempted). 17402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * The driver uses the bit map to remove successes from the success sum, as 17412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the oldest tx attempts fall out of the window. 17422bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17432bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When the 4965 makes multiple tx attempts for a given frame, each attempt 17442bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * might be at a different rate, and have different modulation characteristics 17452bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * (e.g. antenna, fat channel, short guard interval), as set up in the rate 17462bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * scaling table in the Link Quality command. The driver must determine 17472bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * which rate table entry was used for each tx attempt, to determine which 17482bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate-specific history to update, and record only those attempts that 17492bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * match the modulation characteristics of the history set. 17502bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17512bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When using block-ack (aggregation), all frames are transmitted at the same 1752a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * rate, since there is no per-attempt acknowledgment from the destination 17532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * station. The Tx response struct iwl_tx_resp indicates the Tx rate in 17542bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * rate_n_flags field. After receiving a block-ack, the driver can update 17552bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * history for the entire block all at once. 17562bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17582bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FINDING BEST STARTING RATE: 17592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17602bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When working with a selected initial modulation mode (see below), the 17612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * driver attempts to find a best initial rate. The initial rate is the 17622bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * first entry in the Link Quality command's rate table. 17632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 1) Calculate actual throughput (success ratio * expected throughput, see 17652bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * table below) for current initial rate. Do this only if enough frames 17662bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * have been attempted to make the value meaningful: at least 6 failed 17672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * tx attempts, or at least 8 successes. If not enough, don't try rate 17682bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * scaling yet. 17692bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17702bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 2) Find available rates adjacent to current initial rate. Available means: 17712bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) supported by hardware && 17722bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) supported by association && 17732bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) within any constraints selected by user 17742bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17752bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 3) Gather measured throughputs for adjacent rates. These might not have 17762bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * enough history to calculate a throughput. That's okay, we might try 17772bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * using one of them anyway! 17782bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17792bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 4) Try decreasing rate if, for current rate: 17802bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) success ratio is < 15% || 17812bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) lower adjacent rate has better measured throughput || 17822bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) higher adjacent rate has worse throughput, and lower is unmeasured 17832bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17842bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * As a sanity check, if decrease was determined above, leave rate 17852bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * unchanged if: 17862bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) lower rate unavailable 17872bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) success ratio at current rate > 85% (very good) 17882bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) current measured throughput is better than expected throughput 17892bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * of lower rate (under perfect 100% tx conditions, see table below) 17902bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17912bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 5) Try increasing rate if, for current rate: 17922bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) success ratio is < 15% || 17932bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) both adjacent rates' throughputs are unmeasured (try it!) || 17942bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * b) higher adjacent rate has better measured throughput || 17952bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * c) lower adjacent rate has worse throughput, and higher is unmeasured 17962bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 17972bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * As a sanity check, if increase was determined above, leave rate 17982bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * unchanged if: 17992bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * a) success ratio at current rate < 70%. This is not particularly 18002bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * good performance; higher rate is sure to have poorer success. 18012bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18022bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 6) Re-evaluate the rate after each tx frame. If working with block- 18032bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * acknowledge, history and statistics may be calculated for the entire 18042bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * block (including prior history that fits within the history windows), 18052bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * before re-evaluation. 18062bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18072bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * FINDING BEST STARTING MODULATION MODE: 18082bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18092bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * After working with a modulation mode for a "while" (and doing rate scaling), 18102bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the driver searches for a new initial mode in an attempt to improve 18112bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * throughput. The "while" is measured by numbers of attempted frames: 18122bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18132bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For legacy mode, search for new mode after: 18142bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 480 successful frames, or 160 failed frames 18152bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For high-throughput modes (SISO or MIMO), search for new mode after: 18162bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 4500 successful frames, or 400 failed frames 18172bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18182bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Mode switch possibilities are (3 for each mode): 18192bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18202bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For legacy: 18212bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Change antenna, try SISO (if HT association), try MIMO (if HT association) 18222bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For SISO: 18232bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Change antenna, try MIMO, try shortened guard interval (SGI) 18242bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * For MIMO: 18252bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) 18262bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18272bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * When trying a new mode, use the same bit rate as the old/current mode when 18282bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * trying antenna switches and shortened guard interval. When switching to 18292bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate 18302bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * for which the expected throughput (under perfect conditions) is about the 18312bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * same or slightly better than the actual measured throughput delivered by 18322bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * the old/current mode. 18332bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18342bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Actual throughput can be estimated by multiplying the expected throughput 18352bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * by the success ratio (successful / attempted tx frames). Frame size is 18362bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * not considered in this calculation; it assumes that frame size will average 18372bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * out to be fairly consistent over several samples. The following are 18382bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * metric values for expected throughput assuming 100% success ratio. 18392bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Only G band has support for CCK rates: 18402bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18412bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 18422bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18432bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 18442bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 18452bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 18462bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 18472bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 18482bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 18492bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 18502bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 18512bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 18522bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 18532bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18542bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * After the new mode has been tried for a short while (minimum of 6 failed 18552bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * frames or 8 successful frames), compare success ratio and actual throughput 18562bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * estimate of the new mode with the old. If either is better with the new 18572bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode, continue to use the new mode. 18582bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 18592bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Continue comparing modes until all 3 possibilities have been tried. 18602bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * If moving from legacy to HT, try all 3 possibilities from the new HT 18612bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * mode. After trying all 3, a best mode is found. Continue to use this mode 18622bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * for the longer "while" described above (e.g. 480 successful frames for 18632bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * legacy), and then repeat the search process. 18642bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 1865b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 186666c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winklerstruct iwl_link_quality_cmd { 18672bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 18682bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* Index of destination/recipient station in uCode's station table */ 1869b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 sta_id; 1870b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 18712bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill __le16 control; /* not used */ 187266c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler struct iwl_link_qual_general_params general_params; 187366c73db7c6f7672e40c0bb1d2689f2d0d0922aadTomas Winkler struct iwl_link_qual_agg_params agg_params; 18742bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill 18752bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill /* 18762bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * Rate info; when using rate-scaling, Tx command's initial_rate_index 18772bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * specifies 1st Tx rate attempted, via index into this table. 18782bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill * 4965 works its way through table when retrying Tx. 18792bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill */ 1880b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct { 18812bdc7031f9ea1826e16bffc3540d05de891c98bcBen M Cahill __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ 1882b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 1883b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 1884b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1885b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1886b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1887b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) 18883058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 18893058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3945 and 4965 support hardware handshake with Bluetooth device on 18903058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * same platform. Bluetooth device alerts wireless device when it will Tx; 1891a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * wireless device can delay or kill its own Tx to accommodate. 1892b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 18932aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_bt_cmd { 1894b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 flags; 1895b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 lead_time; 1896b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 max_kill; 1897b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved; 1898b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 kill_ack_mask; 1899b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 kill_cts_mask; 1900b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1901b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1902b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 1903b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (6) 1904b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Spectrum Management (802.11h) Commands, Responses, Notifications: 1905b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1906b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 1907b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1908b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1909b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Spectrum Management 1910b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 1911b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ 1912b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_CTL2HOST_MSK | \ 1913b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_ACCEPT_GRP_MSK | \ 1914b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_DIS_DECRYPT_MSK | \ 1915b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ 1916b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_ASSOC_MSK | \ 1917b481de9ca074528fe8c429604e2777db8b89806aZhu Yi RXON_FILTER_BCON_AWARE_MSK) 1918b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 19192aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measure_channel { 1920b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 duration; /* measurement duration in extended beacon 1921b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * format */ 1922b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 channel; /* channel to measure */ 19232aa6ab86bc475a115f56645591d2413981846509Tomas Winkler u8 type; /* see enum iwl_measure_type */ 1924b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 1925b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1926b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1927b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1928b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) 1929b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 19302aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_cmd { 1931b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 len; /* number of bytes starting from token */ 1932b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 token; /* token id */ 1933b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 id; /* measurement id -- 0 or 1 */ 1934b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ 1935b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 periodic; /* 1 = periodic */ 1936b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 path_loss_timeout; 1937b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 start_time; /* start time in extended beacon format */ 1938b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 1939b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 flags; /* rxon flags */ 1940b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 filter_flags; /* rxon filter flags */ 1941b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 channel_count; /* minimum 1, maximum 10 */ 1942b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved3; 19432aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_measure_channel channels[10]; 1944b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1945b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1946b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1947b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) 1948b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 19492aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_resp { 1950b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 token; 1951b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 id; /* id of the prior command replaced, or 0xff */ 1952b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 status; /* 0 - command will be handled 1953b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 1 - cannot handle (conflicts with another 1954b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * measurement) */ 1955b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1956b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 19572aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measurement_state { 1958b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_START = 0, 1959b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_STOP = 1, 1960b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1961b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 19622aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measurement_status { 1963b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_OK = 0, 1964b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_CONCURRENT = 1, 1965b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_CSA_CONFLICT = 2, 1966b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_TGH_CONFLICT = 3, 1967b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* 4-5 reserved */ 1968b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_STOPPED = 6, 1969b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_TIMEOUT = 7, 1970b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASUREMENT_PERIODIC_FAILED = 8, 1971b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1972b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1973b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define NUM_ELEMENTS_IN_HISTOGRAM 8 1974b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 19752aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measurement_histogram { 1976b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 1977b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 1978b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1979b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1980b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* clear channel availability counters */ 19812aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_measurement_cca_counters { 1982b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ofdm; 1983b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cck; 1984b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 1985b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 19862aa6ab86bc475a115f56645591d2413981846509Tomas Winklerenum iwl_measure_type { 1987b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_BASIC = (1 << 0), 1988b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_CHANNEL_LOAD = (1 << 1), 1989b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), 1990b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 1991b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_FRAME = (1 << 4), 1992b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* bits 5:6 are reserved */ 1993b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_MEASURE_IDLE = (1 << 7), 1994b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 1995b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 1996b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 1997b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) 1998b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 19992aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_spectrum_notification { 2000b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 id; /* measurement id -- 0 or 1 */ 2001b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 token; 2002b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 channel_index; /* index in measurement channel list */ 2003b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 state; /* 0 - start, 1 - stop */ 2004b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 start_time; /* lower 32-bits of TSF */ 2005b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 2006b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 channel; 20072aa6ab86bc475a115f56645591d2413981846509Tomas Winkler u8 type; /* see enum iwl_measurement_type */ 2008b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 2009b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 2010b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * valid if applicable for measurement type requested. */ 2011b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ 2012b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ 2013b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cca_time; /* channel load time in usecs */ 2014b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 2015b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * unidentified */ 2016b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved2[3]; 20172aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_measurement_histogram histogram; 2018b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 stop_time; /* lower 32-bits of TSF */ 20192aa6ab86bc475a115f56645591d2413981846509Tomas Winkler __le32 status; /* see iwl_measurement_status */ 2020b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2021b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2022b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2023b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (7) 2024b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Power Management Commands, Responses, Notifications: 2025b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2026b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2027b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2028b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/** 2029ca579617d81baf5865498eb5fae58e453ee77c2cMohamed Abbas * struct iwl_powertable_cmd - Power Table Command 2030b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * @flags: See below: 2031b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2032b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * POWER_TABLE_CMD = 0x77 (command, has simple generic response) 2033b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2034b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PM allow: 2035b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * bit 0 - '0' Driver not allow power management 2036b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '1' Driver allow PM (use rest of parameters) 2037b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * uCode send sleep notifications: 2038b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * bit 1 - '0' Don't send sleep notification 2039b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '1' send sleep notification (SEND_PM_NOTIFICATION) 2040b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Sleep over DTIM 2041b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * bit 2 - '0' PM have to walk up every DTIM 2042b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '1' PM could sleep over DTIM till listen Interval. 2043b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PCI power managed 2044e7b635814b640c6fd9dca1c254dc22fac6fb9a1aTomas Winkler * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) 2045e7b635814b640c6fd9dca1c254dc22fac6fb9a1aTomas Winkler * '1' !(PCI_CFG_LINK_CTRL & 0x1) 2046b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Force sleep Modes 2047b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * bit 31/30- '00' use both mac/xtal sleeps 2048b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '01' force Mac sleep 2049b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '10' force xtal sleep 2050b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * '11' Illegal set 2051b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2052b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then 2053a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler * ucode assume sleep over DTIM is allowed and we don't need to wake up 2054b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * for every DTIM. 2055b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2056b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_POWER_VEC_SIZE 5 2057b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2058600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 2059600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) 2060600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 2061600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler#define IWL_POWER_FAST_PD cpu_to_le16(BIT(4)) 2062600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler 2063600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winklerstruct iwl3945_powertable_cmd { 2064600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler __le16 flags; 2065600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler u8 reserved[2]; 2066600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler __le32 rx_data_timeout; 2067600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler __le32 tx_data_timeout; 2068600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 2069600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler} __attribute__ ((packed)); 2070b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2071ca579617d81baf5865498eb5fae58e453ee77c2cMohamed Abbasstruct iwl_powertable_cmd { 2072b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 flags; 2073600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler u8 keep_alive_seconds; /* 3945 reserved */ 2074600c0e11ea6161e00e8cb4b4dda39a64ce988c60Tomas Winkler u8 debug_flags; /* 3945 reserved */ 2075b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rx_data_timeout; 2076b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tx_data_timeout; 2077b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sleep_interval[IWL_POWER_VEC_SIZE]; 2078b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 keep_alive_beacons; 2079b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2080b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2081b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2082b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) 2083b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 3945 and 4965 identical. 2084b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 20852aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_sleep_notification { 2086b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 pm_sleep_mode; 2087b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 pm_wakeup_src; 2088b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 reserved; 2089b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sleep_time; 2090b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_low; 2091b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bcon_timer; 2092b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2093b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2094b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Sleep states. 3945 and 4965 identical. */ 2095b481de9ca074528fe8c429604e2777db8b89806aZhu Yienum { 2096b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_NO_SLEEP = 0, 2097b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_SLP_MAC = 1, 2098b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 2099b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, 2100b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_SLP_PHY = 4, 2101b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_SLP_REPENT = 5, 2102b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_WAKEUP_BY_TIMER = 6, 2103b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_WAKEUP_BY_DRIVER = 7, 2104b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_WAKEUP_BY_RFKILL = 8, 2105b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* 3 reserved */ 2106b481de9ca074528fe8c429604e2777db8b89806aZhu Yi IWL_PM_NUM_OF_MODES = 12, 2107b481de9ca074528fe8c429604e2777db8b89806aZhu Yi}; 2108b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2109b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2110b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) 2111b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2112b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ 2113b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ 2114b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ 21152aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_card_state_cmd { 2116b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 status; /* CARD_STATE_CMD_* request new power state */ 2117b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2118b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2119b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2120b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) 2121b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 21222aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_card_state_notif { 2123b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 flags; 2124b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2125b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2126b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define HW_CARD_DISABLED 0x01 2127b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SW_CARD_DISABLED 0x02 2128b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define RF_CARD_DISABLED 0x04 2129b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define RXON_CARD_DISABLED 0x10 2130b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 213147f4a5871614756627d7209e0569b58faf99b0d9Emmanuel Grumbachstruct iwl_ct_kill_config { 2132b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved; 2133b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 critical_temperature_M; 2134b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 critical_temperature_R; 2135b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2136b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2137b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2138b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (8) 2139b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Scan Commands, Responses, Notifications: 2140b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2141b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2142b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 214351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) 214451e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 2145d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler 21463058f02137359efb412975cf94a9fa7c25413387Ben M Cahill/** 21472a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table 21483058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 21493058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * One for each channel in the scan list. 21503058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Each channel can independently select: 21513058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1) SSID for directed active scans 21523058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2) Txpower setting (for rate specified within Tx command) 21533058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3) How long to stay on-channel (behavior may be modified by quiet_time, 21543058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * quiet_plcp_th, good_CRC_th) 21553058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 21563058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * To avoid uCode errors, make sure the following are true (see comments 21572a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * under struct iwl_scan_cmd about max_out_time and quiet_time): 21583058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1) If using passive_dwell (i.e. passive_dwell != 0): 21593058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 21603058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2) quiet_time <= active_dwell 21613058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3) If restricting off-channel time (i.e. max_out_time !=0): 21623058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * passive_dwell < max_out_time 21633058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * active_dwell < max_out_time 21643058f02137359efb412975cf94a9fa7c25413387Ben M Cahill */ 21652a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scan_channel { 21663058f02137359efb412975cf94a9fa7c25413387Ben M Cahill /* 21673058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * type is defined as: 21683058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 0:0 1 = active, 0 = passive 2169d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler * 1:20 SSID direct bit map; if a bit is set, then corresponding 21703058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * SSID IE is transmitted in probe request. 2171d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler * 21:31 reserved 2172b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2173d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler __le32 type; 2174d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ 2175f53696de6722a4aac00b76e25a5321c01e88a55fTomas Winkler u8 tx_gain; /* gain for analog radio */ 2176f53696de6722a4aac00b76e25a5321c01e88a55fTomas Winkler u8 dsp_atten; /* gain for DSP */ 21773058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 21783058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 2179b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2180b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 21813058f02137359efb412975cf94a9fa7c25413387Ben M Cahill/** 21822a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_ssid_ie - directed scan network information element 21833058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 21843058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field 21852aa6ab86bc475a115f56645591d2413981846509Tomas Winkler * in struct iwl_scan_channel; each channel may select different ssids from 21863058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * among the 4 entries. SSID IEs get transmitted in reverse order of entry. 21873058f02137359efb412975cf94a9fa7c25413387Ben M Cahill */ 21882a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_ssid_ie { 2189b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 id; 2190b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 len; 2191b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 ssid[32]; 2192b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2193b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 21944c897253cc9ae1c6a2798b27b5fe8e6d94ab6185Tomas Winkler#define PROBE_OPTION_MAX_API1 0x4 2195d16dc48a2ea14af9980d0ea79d041f4b53e47b62Tomas Winkler#define PROBE_OPTION_MAX 0x14 219651e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 219751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_GOOD_CRC_TH cpu_to_le16(1) 2198b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_MAX_SCAN_SIZE 1024 2199b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2200b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2201b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SCAN_CMD = 0x80 (command) 22023058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22033058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * The hardware scan command is very powerful; the driver can set it up to 22043058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * maintain (relatively) normal network traffic while doing a scan in the 22053058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * background. The max_out_time and suspend_time control the ratio of how 22063058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * long the device stays on an associated network channel ("service channel") 22073058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * vs. how long it's away from the service channel, i.e. tuned to other channels 22083058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * for scanning. 22093058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22103058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * max_out_time is the max time off-channel (in usec), and suspend_time 22113058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * is how long (in "extended beacon" format) that the scan is "suspended" 22123058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * after returning to the service channel. That is, suspend_time is the 22133058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * time that we stay on the service channel, doing normal work, between 22143058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * scan segments. The driver may set these parameters differently to support 22153058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * scanning when associated vs. not associated, and light vs. heavy traffic 22163058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * loads when associated. 22173058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22183058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * After receiving this command, the device's scan engine does the following; 22193058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22203058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 1) Sends SCAN_START notification to driver 22213058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 2) Checks to see if it has time to do scan for one channel 22223058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3) Sends NULL packet, with power-save (PS) bit set to 1, 22233058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * to tell AP that we're going off-channel 22243058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 4) Tunes to first channel in scan list, does active or passive scan 22253058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 5) Sends SCAN_RESULT notification to driver 22263058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 6) Checks to see if it has time to do scan on *next* channel in list 22273058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 7) Repeats 4-6 until it no longer has time to scan the next channel 22283058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * before max_out_time expires 22293058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 8) Returns to service channel 22303058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 9) Sends NULL packet with PS=0 to tell AP that we're back 22313058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 10) Stays on service channel until suspend_time expires 22323058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 11) Repeats entire process 2-10 until list is complete 22333058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 12) Sends SCAN_COMPLETE notification 22343058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22353058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * For fast, efficient scans, the scan command also has support for staying on 22363058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * a channel for just a short time, if doing active scanning and getting no 22373058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * responses to the transmitted probe request. This time is controlled by 22383058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * quiet_time, and the number of received packets below which a channel is 22393058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * considered "quiet" is controlled by quiet_plcp_threshold. 22403058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22413058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * For active scanning on channels that have regulatory restrictions against 22423058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * blindly transmitting, the scan can listen before transmitting, to make sure 22433058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * that there is already legitimate activity on the channel. If enough 22443058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * packets are cleanly received on the channel (controlled by good_CRC_th, 22453058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * typical value 1), the scan engine starts transmitting probe requests. 22463058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22473058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 22483058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22493058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * To avoid uCode errors, see timing restrictions described under 22502a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler * struct iwl_scan_channel. 2251b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 22522a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scan_cmd { 2253b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 len; 2254b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved0; 22553058f02137359efb412975cf94a9fa7c25413387Ben M Cahill u8 channel_count; /* # channels in channel list */ 22563058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 quiet_time; /* dwell only this # millisecs on quiet channel 22573058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * (only for active scan) */ 22583058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 22593058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 good_CRC_th; /* passive -> active promotion threshold */ 22603058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le16 rx_chain; /* RXON_RX_CHAIN_* */ 22613058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le32 max_out_time; /* max usec to be away from associated (service) 22623058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * channel */ 22633058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le32 suspend_time; /* pause scan this long (in "extended beacon 22643058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * format") when returning to service chnl: 22653058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 3945; 31:24 # beacons, 19:0 additional usec, 22663058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 4965; 31:22 # beacons, 21:0 additional usec. 22673058f02137359efb412975cf94a9fa7c25413387Ben M Cahill */ 22683058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le32 flags; /* RXON_FLG_* */ 22693058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le32 filter_flags; /* RXON_FILTER_* */ 22703058f02137359efb412975cf94a9fa7c25413387Ben M Cahill 22713058f02137359efb412975cf94a9fa7c25413387Ben M Cahill /* For active scans (set to all-0s for passive scans). 22723058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Does not include payload. Must specify Tx rate; no rate scaling. */ 227383d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winkler struct iwl_tx_cmd tx_cmd; 22743058f02137359efb412975cf94a9fa7c25413387Ben M Cahill 22753058f02137359efb412975cf94a9fa7c25413387Ben M Cahill /* For directed active scans (set to all-0s otherwise) */ 22762a421b91d6fe89e27ded7544a25449c0b050098fTomas Winkler struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 2277b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2278b481de9ca074528fe8c429604e2777db8b89806aZhu Yi /* 22793058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Probe request frame, followed by channel list. 22803058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * 22813058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Size of probe request frame is specified by byte count in tx_cmd. 22823058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Channel list follows immediately after probe request frame. 22833058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Number of channels in list is specified by channel_count. 22843058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * Each channel in list is of type: 2285b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 22862aa6ab86bc475a115f56645591d2413981846509Tomas Winkler * struct iwl_scan_channel channels[0]; 2287b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2288b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * NOTE: Only one band of channels can be scanned per pass. You 22893058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 22903058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) 22913058f02137359efb412975cf94a9fa7c25413387Ben M Cahill * before requesting another scan. 2292b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 22933058f02137359efb412975cf94a9fa7c25413387Ben M Cahill u8 data[0]; 2294b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2295b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2296b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Can abort will notify by complete notification with abort status. */ 229751e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define CAN_ABORT_STATUS cpu_to_le32(0x1) 2298b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* complete notification statuses */ 2299b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define ABORT_STATUS 0x2 2300b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2301b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2302b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_SCAN_CMD = 0x80 (response) 2303b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 23042a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanreq_notification { 2305b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 status; /* 1: okay, 2: cannot fulfill request */ 2306b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2307b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2308b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2309b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) 2310b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 23112a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanstart_notification { 2312b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_low; 2313b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_high; 2314b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_timer; 2315b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 channel; 2316b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 band; 2317b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved[2]; 2318b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 status; 2319b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2320b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2321b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SCAN_OWNER_STATUS 0x1; 2322b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define MEASURE_OWNER_STATUS 0x2; 2323b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2324b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ 2325b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2326b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) 2327b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 23282a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scanresults_notification { 2329b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 channel; 2330b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 band; 2331b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved[2]; 2332b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_low; 2333b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_high; 2334b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 statistics[NUMBER_OF_STATISTICS]; 2335b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2336b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2337b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2338b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) 2339b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 23402a421b91d6fe89e27ded7544a25449c0b050098fTomas Winklerstruct iwl_scancomplete_notification { 2341b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 scanned_channels; 2342b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 status; 2343b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved; 2344b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 last_channel; 2345b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_low; 2346b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tsf_high; 2347b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2348b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2349b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2350b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2351b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (9) 2352b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * IBSS/AP Commands and Notifications: 2353b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2354b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2355b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2356b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2357b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 2358b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2359bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwigstruct iwl4965_beacon_notif { 2360bb8c093bdea62f2ae371b98ebff81b0407852fafChristoph Hellwig struct iwl4965_tx_resp beacon_notify_hdr; 2361b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 low_tsf; 2362b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 high_tsf; 2363b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ibss_mgr_status; 2364b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2365b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2366b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2367b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 2368b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 23694bf64efd26f5610cde4fb7846e2f37bd1f62d3a9Tomas Winklerstruct iwl_tx_beacon_cmd { 237083d527d9e8f9aff92cbd33f208f77c055dabb499Tomas Winkler struct iwl_tx_cmd tx; 2371b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le16 tim_idx; 2372b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 tim_size; 2373b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved1; 2374b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct ieee80211_hdr frame[0]; /* beacon frame */ 2375b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2376b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2377b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2378b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (10) 2379b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Statistics Commands and Notifications: 2380b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2381b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2382b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2383b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define IWL_TEMP_CONVERT 260 2384b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2385b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 2386b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 2387b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 2388b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2389b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* Used for passing to driver number of successes and failures per rate */ 2390b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct rate_histogram { 2391b481de9ca074528fe8c429604e2777db8b89806aZhu Yi union { 2392b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 2393b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 2394b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 2395b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } success; 2396b481de9ca074528fe8c429604e2777db8b89806aZhu Yi union { 2397b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 2398b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 2399b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 2400b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } failed; 2401b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2402b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2403b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* statistics command response */ 2404b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2405b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_phy { 2406b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ina_cnt; 2407b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 fina_cnt; 2408b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 plcp_err; 2409b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 crc32_err; 2410b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 overrun_err; 2411b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 early_overrun_err; 2412b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 crc32_good; 2413b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 false_alarm_cnt; 2414b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 fina_sync_err_cnt; 2415b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sfd_timeout; 2416b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 fina_timeout; 2417b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 unresponded_rts; 2418b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rxe_frame_limit_overrun; 2419b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sent_ack_cnt; 2420b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sent_cts_cnt; 2421b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sent_ba_rsp_cnt; 2422b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 dsp_self_kill; 2423b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 mh_format_err; 2424b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 re_acq_main_rssi_sum; 2425b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved3; 2426b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2427b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2428b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_ht_phy { 2429b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 plcp_err; 2430b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 overrun_err; 2431b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 early_overrun_err; 2432b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 crc32_good; 2433b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 crc32_err; 2434b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 mh_format_err; 2435b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 agg_crc32_good; 2436b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 agg_mpdu_cnt; 2437b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 agg_cnt; 2438b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 2439b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2440b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 244134c22cf93d1446791c966c878cc691e07c39d8d3Winkler, Tomas#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) 244234c22cf93d1446791c966c878cc691e07c39d8d3Winkler, Tomas 2443b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx_non_phy { 2444b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bogus_cts; /* CTS received when not expecting CTS */ 2445b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bogus_ack; /* ACK received when not expecting ACK */ 2446b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 non_bssid_frames; /* number of frames with BSSID that 2447b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * doesn't belong to the STA BSSID */ 2448b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 filtered_frames; /* count frames that were dumped in the 2449b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * filtering process */ 2450b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 non_channel_beacons; /* beacons with our bss id but not on 2451b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * our serving channel */ 2452b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 channel_beacons; /* beacons with our bss id and in our 2453b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * serving channel */ 2454b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 num_missed_bcon; /* number of missed beacons */ 2455b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 adc_rx_saturation_time; /* count in 0.8us units the time the 2456b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * ADC was in saturation */ 2457b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ina_detection_search_time;/* total time (in 0.8us) searched 2458b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * for INA */ 2459b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ 2460b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ 2461b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ 2462b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 interference_data_flag; /* flag for interference data 2463b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * availability. 1 when data is 2464b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * available. */ 24653058f02137359efb412975cf94a9fa7c25413387Ben M Cahill __le32 channel_load; /* counts RX Enable time in uSec */ 2466b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 dsp_false_alarms; /* DSP false alarm (both OFDM 2467b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * and CCK) counter */ 2468b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_rssi_a; 2469b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_rssi_b; 2470b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_rssi_c; 2471b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_energy_a; 2472b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_energy_b; 2473b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 beacon_energy_c; 2474b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2475b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2476b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_rx { 2477b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_rx_phy ofdm; 2478b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_rx_phy cck; 2479b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_rx_non_phy general; 2480b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_rx_ht_phy ofdm_ht; 2481b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2482b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2483b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_tx_non_phy_agg { 2484b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ba_timeout; 2485b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ba_reschedule_frames; 2486b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 scd_query_agg_frame_cnt; 2487b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 scd_query_no_agg; 2488b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 scd_query_agg; 2489b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 scd_query_mismatch; 2490b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 frame_not_ready; 2491b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 underrun; 2492b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bt_prio_kill; 2493b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rx_ba_rsp_cnt; 2494b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 2495b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved3; 2496b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2497b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2498b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_tx { 2499b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 preamble_cnt; 2500b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rx_detected_cnt; 2501b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bt_prio_defer_cnt; 2502b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 bt_prio_kill_cnt; 2503b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 few_bytes_cnt; 2504b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cts_timeout; 2505b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ack_timeout; 2506b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 expected_ack_cnt; 2507b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 actual_ack_cnt; 2508b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 dump_msdu_cnt; 2509b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 burst_abort_next_frame_mismatch_cnt; 2510b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 burst_abort_missing_next_frame_cnt; 2511b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 cts_timeout_collision; 2512b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ack_or_ba_timeout_collision; 2513b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_tx_non_phy_agg agg; 2514b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2515b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2516b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_dbg { 2517b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 burst_check; 2518b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 burst_count; 2519b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved[4]; 2520b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2521b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2522b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_div { 2523b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tx_on_a; 2524b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 tx_on_b; 2525b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 exec_time; 2526b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 probe_time; 2527b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved1; 2528b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 2529b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2530b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2531b481de9ca074528fe8c429604e2777db8b89806aZhu Yistruct statistics_general { 2532b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 temperature; 2533b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 temperature_m; 2534b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_dbg dbg; 2535b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 sleep_time; 2536b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 slots_out; 2537b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 slots_idle; 2538b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 ttl_timestamp; 2539b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_div div; 2540b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 rx_enable_counter; 2541b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved1; 2542b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved2; 2543b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 reserved3; 2544b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2545b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2546b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2547b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_STATISTICS_CMD = 0x9c, 2548b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 3945 and 4965 identical. 2549b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2550b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This command triggers an immediate response containing uCode statistics. 2551b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. 2552b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2553b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the CLEAR_STATS configuration flag is set, uCode will clear its 2554b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * internal copy of the statistics (counters) after issuing the response. 2555b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). 2556b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2557b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * If the DISABLE_NOTIF configuration flag is set, uCode will not issue 2558b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag 2559b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. 2560b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 256151e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 256251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ 25638f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbachstruct iwl_statistics_cmd { 2564b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 configuration_flags; /* IWL_STATS_CONF_* */ 2565b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2566b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2567b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2568b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) 2569b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2570b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * By default, uCode issues this notification after receiving a beacon 2571b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * while associated. To disable this behavior, set DISABLE_NOTIF flag in the 2572b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_STATISTICS_CMD 0x9c, above. 2573b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2574b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Statistics counters continue to increment beacon after beacon, but are 2575b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD 2576b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 0x9c with CLEAR_STATS bit set (see above). 2577b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2578b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * uCode also issues this notification during scans. uCode clears statistics 2579b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * appropriately so that each notification contains statistics for only the 2580b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * one channel that has just been scanned. 2581b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 258251e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 258351e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) 25848f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbachstruct iwl_notif_statistics { 2585b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 flag; 2586b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_rx rx; 2587b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_tx tx; 2588b481de9ca074528fe8c429604e2777db8b89806aZhu Yi struct statistics_general general; 2589b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2590b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2591b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2592b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2593b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) 2594b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2595b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, 2596b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * then this notification will be sent. */ 2597b481de9ca074528fe8c429604e2777db8b89806aZhu Yi#define CONSECUTIVE_MISSED_BCONS_TH 20 2598b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 25992aa6ab86bc475a115f56645591d2413981846509Tomas Winklerstruct iwl_missed_beacon_notif { 2600b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 consequtive_missed_beacons; 2601b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 total_missed_becons; 2602b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 num_expected_beacons; 2603b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 num_recvd_beacons; 2604b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2605b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2606f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill 2607b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2608b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (11) 2609b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Rx Calibration Commands: 2610b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2611f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * With the uCode used for open source drivers, most Tx calibration (except 2612f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * for Tx Power) and most Rx calibration is done by uCode during the 2613f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * "initialize" phase of uCode boot. Driver must calibrate only: 2614f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2615f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1) Tx power (depends on temperature), described elsewhere 2616f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) 2617f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3) Receiver sensitivity (to optimize signal detection) 2618f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2619b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2620b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2621f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/** 2622f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) 2623f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2624f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * This command sets up the Rx signal detector for a sensitivity level that 2625f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * is high enough to lock onto all signals within the associated network, 2626f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * but low enough to ignore signals that are below a certain threshold, so as 2627f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * not to have too many "false alarms". False alarms are signals that the 2628f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Rx DSP tries to lock onto, but then discards after determining that they 2629f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * are noise. 2630f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2631f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * The optimum number of false alarms is between 5 and 50 per 200 TUs 2632f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. 2633f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * time listening, not transmitting). Driver must adjust sensitivity so that 2634f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * the ratio of actual false alarms to actual Rx time falls within this range. 2635f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2636f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each 2637f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * received beacon. These provide information to the driver to analyze the 2638f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity. Don't analyze statistics that come in from scanning, or any 2639f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * other non-associated-network source. Pertinent statistics include: 2640f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2641f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * From "general" statistics (struct statistics_rx_non_phy): 2642f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2643f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) 2644f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Measure of energy of desired signal. Used for establishing a level 2645f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * below which the device does not detect signals. 2646f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2647f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) 2648f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Measure of background noise in silent period after beacon. 2649f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2650f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * channel_load 2651f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * uSecs of actual Rx time during beacon period (varies according to 2652f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * how much time was spent transmitting). 2653f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2654f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: 2655f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2656f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * false_alarm_cnt 2657f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Signal locks abandoned early (before phy-level header). 2658f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2659f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * plcp_err 2660f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Signal locks abandoned late (during phy-level header). 2661f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2662f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from 2663f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon to beacon, i.e. each value is an accumulation of all errors 2664f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * before and including the latest beacon. Values will wrap around to 0 2665f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * after counting up to 2^32 - 1. Driver must differentiate vs. 2666f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * previous beacon's values to determine # false alarms in the current 2667f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon period. 2668f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2669f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Total number of false alarms = false_alarms + plcp_errs 2670f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2671f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd 2672f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (notice that the start points for OFDM are at or close to settings for 2673f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * maximum sensitivity): 2674f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2675f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * START / MIN / MAX 2676f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120 2677f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210 2678f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140 2679f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270 2680f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2681f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * If actual rate of OFDM false alarms (+ plcp_errors) is too high 2682f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (greater than 50 for each 204.8 msecs listening), reduce sensitivity 2683f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * by *adding* 1 to all 4 of the table entries above, up to the max for 2684f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * each entry. Conversely, if false alarm rate is too low (less than 5 2685f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * for each 204.8 msecs listening), *subtract* 1 from each entry to 2686f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * increase sensitivity. 2687f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2688f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For CCK sensitivity, keep track of the following: 2689f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2690f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1). 20-beacon history of maximum background noise, indicated by 2691f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the 2692f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3 receivers. For any given beacon, the "silence reference" is 2693f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * the maximum of last 60 samples (20 beacons * 3 receivers). 2694f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2695f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2). 10-beacon history of strongest signal level, as indicated 2696f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, 2697f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * i.e. the strength of the signal through the best receiver at the 2698f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * moment. These measurements are "upside down", with lower values 2699f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * for stronger signals, so max energy will be *minimum* value. 2700f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2701f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Then for any given beacon, the driver must determine the *weakest* 2702f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * of the strongest signals; this is the minimum level that needs to be 2703f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * successfully detected, when using the best receiver at the moment. 2704f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * "Max cck energy" is the maximum (higher value means lower energy!) 2705f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * of the last 10 minima. Once this is determined, driver must add 2706f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * a little margin by adding "6" to it. 2707f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2708f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3). Number of consecutive beacon periods with too few false alarms. 2709f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Reset this to 0 at the first beacon period that falls within the 2710f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 2711f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2712f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd 2713f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (notice that the start points for CCK are at maximum sensitivity): 2714f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2715f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * START / MIN / MAX 2716f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200 2717f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400 2718f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100 2719f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2720f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * If actual rate of CCK false alarms (+ plcp_errors) is too high 2721f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (greater than 50 for each 204.8 msecs listening), method for reducing 2722f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity is: 2723f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2724f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 2725f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * up to max 400. 2726f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2727f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, 2728f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity has been reduced a significant amount; bring it up to 2729f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * a moderate 161. Otherwise, *add* 3, up to max 200. 2730f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2731f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, 2732f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity has been reduced only a moderate or small amount; 2733f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, 2734f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * down to min 0. Otherwise (if gain has been significantly reduced), 2735f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. 2736f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2737f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * b) Save a snapshot of the "silence reference". 2738f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2739f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * If actual rate of CCK false alarms (+ plcp_errors) is too low 2740f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (less than 5 for each 204.8 msecs listening), method for increasing 2741f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * sensitivity is used only if: 2742f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2743f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1a) Previous beacon did not have too many false alarms 2744f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1b) AND difference between previous "silence reference" and current 2745f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * "silence reference" (prev - current) is 2 or more, 2746f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * OR 2) 100 or more consecutive beacon periods have had rate of 2747f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * less than 5 false alarms per 204.8 milliseconds rx time. 2748f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2749f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Method for increasing sensitivity: 2750f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2751f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, 2752f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * down to min 125. 2753f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2754f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, 2755f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * down to min 200. 2756f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2757f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. 2758f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2759f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * If actual rate of CCK false alarms (+ plcp_errors) is within good range 2760f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (between 5 and 50 for each 204.8 msecs listening): 2761f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2762f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1) Save a snapshot of the silence reference. 2763f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2764f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), 2765f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * give some extra margin to energy threshold by *subtracting* 8 2766f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * from value in HD_MIN_ENERGY_CCK_DET_INDEX. 2767f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2768f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For all cases (too few, too many, good range), make sure that the CCK 2769f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * detection threshold (energy) is below the energy level for robust 2770f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * detection over the past 10 beacon periods, the "Max cck energy". 2771f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Lower values mean higher energy; this means making sure that the value 2772f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". 2773f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2774f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Driver should set the following entries to fixed values: 2775f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2776f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_MIN_ENERGY_OFDM_DET_INDEX 100 2777f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_BARKER_CORR_TH_ADD_MIN_INDEX 190 2778f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX 390 2779f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * HD_OFDM_ENERGY_TH_IN_INDEX 62 2780f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */ 2781f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill 2782f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/* 2783f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) 2784f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */ 2785f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_TABLE_SIZE (11) /* number of entries */ 2786f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ 2787f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_MIN_ENERGY_OFDM_DET_INDEX (1) 2788f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) 2789f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) 2790f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) 2791f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) 2792f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) 2793f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) 2794f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) 2795f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 2796f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill#define HD_OFDM_ENERGY_TH_IN_INDEX (10) 2797f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill 2798f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach/* Control field in struct iwl_sensitivity_cmd */ 279951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) 280051e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) 2801b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2802f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/** 2803f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbach * struct iwl_sensitivity_cmd 2804f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * @control: (1) updates working table, (0) updates default table 2805f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * @table: energy threshold values, use HD_* as index into table 2806f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2807f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Always use "1" in "control" to update uCode's working table and DSP. 2808f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */ 2809f0832f137c21d130998a0f97f97ac01a2d97210bEmmanuel Grumbachstruct iwl_sensitivity_cmd { 2810f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill __le16 control; /* always use "1" */ 2811f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ 2812b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2813b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2814f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill 2815f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill/** 2816f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) 2817f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2818f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * This command sets the relative gains of 4965's 3 radio receiver chains. 2819f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2820f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * After the first association, driver should accumulate signal and noise 2821f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 2822f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacons from the associated network (don't collect statistics that come 2823f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * in from scanning, or any other non-network source). 2824f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2825f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * DISCONNECTED ANTENNA: 2826f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2827f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Driver should determine which antennas are actually connected, by comparing 2828f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * average beacon signal levels for the 3 Rx chains. Accumulate (add) the 2829f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * following values over 20 beacons, one accumulator for each of the chains 2830f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * a/b/c, from struct statistics_rx_non_phy: 2831f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2832f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) 2833f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2834f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Find the strongest signal from among a/b/c. Compare the other two to the 2835f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * strongest. If any signal is more than 15 dB (times 20, unless you 2836f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * divide the accumulated values by 20) below the strongest, the driver 2837f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * considers that antenna to be disconnected, and should not try to use that 2838f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, 2839f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * driver should declare the stronger one as connected, and attempt to use it 2840f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (A and B are the only 2 Tx chains!). 2841f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2842f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2843f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * RX BALANCE: 2844f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2845f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Driver should balance the 3 receivers (but just the ones that are connected 2846f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * to antennas, see above) for gain, by comparing the average signal levels 2847f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * detected during the silence after each beacon (background noise). 2848f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Accumulate (add) the following values over 20 beacons, one accumulator for 2849f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * each of the chains a/b/c, from struct statistics_rx_non_phy: 2850f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2851f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) 2852f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2853f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * Find the weakest background noise level from among a/b/c. This Rx chain 2854f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * will be the reference, with 0 gain adjustment. Attenuate other channels by 2855f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * finding noise difference: 2856f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2857f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (accum_noise[i] - accum_noise[reference]) / 30 2858f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2859f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 2860f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the 2861f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 2862f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * and set bit 2 to indicate "reduce gain". The value for the reference 2863f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * (weakest) chain should be "0". 2864f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2865f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * diff_gain_[abc] bit fields: 2866f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 2: (1) reduce gain, (0) increase gain 2867f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill * 1-0: amount of gain, units of 1.5 dB 2868f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill */ 2869f7d09d7c453f197d802c50172b27170a43e1a816Ben M Cahill 2870f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler/* Phy calibration command for series */ 287133fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach 287233fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbachenum { 2873f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, 2874f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_DC_CMD = 8, 2875f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_LO_CMD = 9, 2876f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_RX_BB_CMD = 10, 2877f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, 2878f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_RX_IQ_CMD = 12, 2879f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATION_NOISE_CMD = 13, 2880f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_AGC_TABLE_CMD = 14, 2881f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 2882f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 2883f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 2884f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, 2885f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, 288633fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach}; 288733fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach 2888f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler 288951e9bf5d795b8e01e54391f1790974c7b166d286Harvey Harrison#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff) 28907c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler 28917c616cba240cd0d579c996be3f3603456acfb0adTomas Winklerstruct iwl_calib_cfg_elmnt_s { 28927c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 is_enable; 28937c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 start; 28947c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 send_res; 28957c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 apply_res; 28967c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 reserved; 28977c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed)); 28987c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler 28997c616cba240cd0d579c996be3f3603456acfb0adTomas Winklerstruct iwl_calib_cfg_status_s { 29007c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler struct iwl_calib_cfg_elmnt_s once; 29017c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler struct iwl_calib_cfg_elmnt_s perd; 29027c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 flags; 29037c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed)); 29047c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler 2905f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_cfg_cmd { 29067c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler struct iwl_calib_cfg_status_s ucd_calib_cfg; 29077c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler struct iwl_calib_cfg_status_s drv_calib_cfg; 29087c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler __le32 reserved1; 29097c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed)); 29107c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler 2911f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_hdr { 29127c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler u8 op_code; 29137c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler u8 first_group; 29147c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler u8 groups_num; 29157c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler u8 data_valid; 29167c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler} __attribute__ ((packed)); 29177c616cba240cd0d579c996be3f3603456acfb0adTomas Winkler 2918f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_cmd { 2919f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler struct iwl_calib_hdr hdr; 2920be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler u8 data[0]; 2921be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler} __attribute__ ((packed)); 2922be5d56ed885a2897ec813eab4a8055d495816e9aTomas Winkler 29230d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ 2924f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_diff_gain_cmd { 29250d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler struct iwl_calib_hdr hdr; 2926f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler s8 diff_gain_a; /* see above */ 2927f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler s8 diff_gain_b; 2928f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler s8 diff_gain_c; 2929f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler u8 reserved1; 2930f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler} __attribute__ ((packed)); 2931f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winkler 29320d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winklerstruct iwl_calib_xtal_freq_cmd { 29330d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler struct iwl_calib_hdr hdr; 29340d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler u8 cap_pin1; 29350d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler u8 cap_pin2; 29360d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler u8 pad[2]; 293733fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach} __attribute__ ((packed)); 293833fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach 29390d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ 29400d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winklerstruct iwl_calib_chain_noise_reset_cmd { 29410d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler struct iwl_calib_hdr hdr; 29420d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler u8 data[0]; 29430d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler}; 29440d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler 29450d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ 2946f69f42a6bbefb311ccb1626fdb61f723160afbfdTomas Winklerstruct iwl_calib_chain_noise_gain_cmd { 29470d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler struct iwl_calib_hdr hdr; 294833fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach u8 delta_gain_1; 294933fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach u8 delta_gain_2; 29500d950d84d9d16f7d4edf380a238c5b534ff00d11Tomas Winkler u8 pad[2]; 295133fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach} __attribute__ ((packed)); 295233fd503346ad86bd7470a0f8c4c3080393d14233Emmanuel Grumbach 2953b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 2954b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (12) 2955b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Miscellaneous Commands: 2956b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2957b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 2958b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 2959b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/* 2960b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * LEDs Command & Response 2961b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) 2962b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 2963b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 2964b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * this command turns it on or off, or sets up a periodic blinking cycle. 2965b481de9ca074528fe8c429604e2777db8b89806aZhu Yi */ 2966ec1a746042ea4c1c93065185897d6e8d3e7de894Tomas Winklerstruct iwl_led_cmd { 2967b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 interval; /* "interval" in uSec */ 2968b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 id; /* 1: Activity, 2: Link, 3: Tech */ 2969b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 off; /* # intervals off while blinking; 2970b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * "0", with >0 "on" value, turns LED on */ 2971b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 on; /* # intervals on while blinking; 2972b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * "0", regardless of "off", turns LED off */ 2973b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 reserved; 2974b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 2975b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 29769636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/* 29779636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky * Coexistence WIFI/WIMAX Command 29789636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky * COEX_PRIORITY_TABLE_CMD = 0x5a 29799636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky * 29809636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky */ 29819636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskyenum { 29829636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_UNASSOC_IDLE = 0, 29839636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_UNASSOC_MANUAL_SCAN = 1, 29849636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_UNASSOC_AUTO_SCAN = 2, 29859636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_CALIBRATION = 3, 29869636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_PERIODIC_CALIBRATION = 4, 29879636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_CONNECTION_ESTAB = 5, 29889636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_ASSOCIATED_IDLE = 6, 29899636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_ASSOC_MANUAL_SCAN = 7, 29909636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_ASSOC_AUTO_SCAN = 8, 29919636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_ASSOC_ACTIVE_LEVEL = 9, 29929636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_RF_ON = 10, 29939636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_RF_OFF = 11, 29949636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_STAND_ALONE_DEBUG = 12, 29959636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_IPAN_ASSOC_LEVEL = 13, 29969636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_RSRVD1 = 14, 29979636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_RSRVD2 = 15, 29989636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky COEX_NUM_OF_EVENTS = 16 29999636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky}; 30009636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 30019636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskystruct iwl_wimax_coex_event_entry { 30029636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 request_prio; 30039636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 win_medium_prio; 30049636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 reserved; 30059636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 flags; 30069636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky} __attribute__ ((packed)); 30079636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 30089636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/* COEX flag masks */ 30099636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 3010a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* Station table is valid */ 30119636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) 3012a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* UnMask wake up src at unassociated sleep */ 30139636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) 3014a96a27f97f2bbfc1fca54bc3c0b0d41484152740Tomas Winkler/* UnMask wake up src at associated sleep */ 30159636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) 30169636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky/* Enable CoEx feature. */ 30179636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky#define COEX_FLAGS_COEX_ENABLE_MSK (0x80) 30189636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 30199636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunskystruct iwl_wimax_coex_cmd { 30209636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 flags; 30219636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky u8 reserved[3]; 30229636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; 30239636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky} __attribute__ ((packed)); 30249636e583d2c641f8cb32d0681f5052b2885edd79Ron Rindjunsky 3025b481de9ca074528fe8c429604e2777db8b89806aZhu Yi/****************************************************************************** 3026b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * (13) 3027b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * Union of all expected notifications/responses: 3028b481de9ca074528fe8c429604e2777db8b89806aZhu Yi * 3029b481de9ca074528fe8c429604e2777db8b89806aZhu Yi *****************************************************************************/ 3030b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 3031db11d6343aa14ab61258bfad9178042d4be49333Tomas Winklerstruct iwl_rx_packet { 3032b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 len; 3033857485c0c46ceee5c658c1761bba4d9a5ddf433fTomas Winkler struct iwl_cmd_header hdr; 3034b481de9ca074528fe8c429604e2777db8b89806aZhu Yi union { 3035885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winkler struct iwl_alive_resp alive_frame; 30362aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_spectrum_notification spectrum_notif; 30372aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_csa_notification csa_notif; 3038885ba202cabd90b8ade1fe59185dc96ed4d69e02Tomas Winkler struct iwl_error_resp err_resp; 30392aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_card_state_notif card_state_notif; 30407a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler struct iwl_add_sta_resp add_sta; 30417a999bf0c5eb19b20ac6ab0f21f6e5013400fa51Tomas Winkler struct iwl_rem_sta_resp rem_sta; 30422aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_sleep_notification sleep_notif; 30432aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_spectrum_resp spectrum; 30448f91aecb4cdc2d786df8941e827b9dff3c10a4e4Emmanuel Grumbach struct iwl_notif_statistics stats; 3045653fa4a07525e4cd9e7b90e6fc1f792119910636Emmanuel Grumbach struct iwl_compressed_ba_resp compressed_ba; 30462aa6ab86bc475a115f56645591d2413981846509Tomas Winkler struct iwl_missed_beacon_notif missed_beacon; 3047b481de9ca074528fe8c429604e2777db8b89806aZhu Yi __le32 status; 3048b481de9ca074528fe8c429604e2777db8b89806aZhu Yi u8 raw[0]; 3049b481de9ca074528fe8c429604e2777db8b89806aZhu Yi } u; 3050b481de9ca074528fe8c429604e2777db8b89806aZhu Yi} __attribute__ ((packed)); 3051b481de9ca074528fe8c429604e2777db8b89806aZhu Yi 30528f5c87dcf6d1a5e6d7ffe642cfd4debb5ccbec49Winkler, Tomasint iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon); 30538f5c87dcf6d1a5e6d7ffe642cfd4debb5ccbec49Winkler, Tomas 30546a63578ddf6148927a80c07a73b40ccc8f3ac8e2Emmanuel Grumbach#endif /* __iwl_commands_h__ */ 3055