162306a36Sopenharmony_ci/****************************************************************************** 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 462306a36Sopenharmony_ci * redistributing this file, you may do so under either license. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * GPL LICENSE SUMMARY 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 1162306a36Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 1262306a36Sopenharmony_ci * published by the Free Software Foundation. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 1562306a36Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 1662306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1762306a36Sopenharmony_ci * General Public License for more details. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 2062306a36Sopenharmony_ci * along with this program; if not, write to the Free Software 2162306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 2262306a36Sopenharmony_ci * USA 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * The full GNU General Public License is included in this distribution 2562306a36Sopenharmony_ci * in the file called LICENSE.GPL. 2662306a36Sopenharmony_ci * 2762306a36Sopenharmony_ci * Contact Information: 2862306a36Sopenharmony_ci * Intel Linux Wireless <ilw@linux.intel.com> 2962306a36Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 3062306a36Sopenharmony_ci * 3162306a36Sopenharmony_ci * BSD LICENSE 3262306a36Sopenharmony_ci * 3362306a36Sopenharmony_ci * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 3462306a36Sopenharmony_ci * All rights reserved. 3562306a36Sopenharmony_ci * 3662306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 3762306a36Sopenharmony_ci * modification, are permitted provided that the following conditions 3862306a36Sopenharmony_ci * are met: 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * * Redistributions of source code must retain the above copyright 4162306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 4262306a36Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 4362306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 4462306a36Sopenharmony_ci * the documentation and/or other materials provided with the 4562306a36Sopenharmony_ci * distribution. 4662306a36Sopenharmony_ci * * Neither the name Intel Corporation nor the names of its 4762306a36Sopenharmony_ci * contributors may be used to endorse or promote products derived 4862306a36Sopenharmony_ci * from this software without specific prior written permission. 4962306a36Sopenharmony_ci * 5062306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 5162306a36Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 5262306a36Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 5362306a36Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 5462306a36Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 5562306a36Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 5662306a36Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5762306a36Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5862306a36Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 5962306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 6062306a36Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6162306a36Sopenharmony_ci * 6262306a36Sopenharmony_ci *****************************************************************************/ 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#ifndef __il_commands_h__ 6562306a36Sopenharmony_ci#define __il_commands_h__ 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#include <linux/ieee80211.h> 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_cistruct il_priv; 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* uCode version contains 4 values: Major/Minor/API/Serial */ 7262306a36Sopenharmony_ci#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) 7362306a36Sopenharmony_ci#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) 7462306a36Sopenharmony_ci#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) 7562306a36Sopenharmony_ci#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci/* Tx rates */ 7862306a36Sopenharmony_ci#define IL_CCK_RATES 4 7962306a36Sopenharmony_ci#define IL_OFDM_RATES 8 8062306a36Sopenharmony_ci#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_cienum { 8362306a36Sopenharmony_ci N_ALIVE = 0x1, 8462306a36Sopenharmony_ci N_ERROR = 0x2, 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci /* RXON and QOS commands */ 8762306a36Sopenharmony_ci C_RXON = 0x10, 8862306a36Sopenharmony_ci C_RXON_ASSOC = 0x11, 8962306a36Sopenharmony_ci C_QOS_PARAM = 0x13, 9062306a36Sopenharmony_ci C_RXON_TIMING = 0x14, 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci /* Multi-Station support */ 9362306a36Sopenharmony_ci C_ADD_STA = 0x18, 9462306a36Sopenharmony_ci C_REM_STA = 0x19, 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci /* Security */ 9762306a36Sopenharmony_ci C_WEPKEY = 0x20, 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci /* RX, TX, LEDs */ 10062306a36Sopenharmony_ci N_3945_RX = 0x1b, /* 3945 only */ 10162306a36Sopenharmony_ci C_TX = 0x1c, 10262306a36Sopenharmony_ci C_RATE_SCALE = 0x47, /* 3945 only */ 10362306a36Sopenharmony_ci C_LEDS = 0x48, 10462306a36Sopenharmony_ci C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */ 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci /* 802.11h related */ 10762306a36Sopenharmony_ci C_CHANNEL_SWITCH = 0x72, 10862306a36Sopenharmony_ci N_CHANNEL_SWITCH = 0x73, 10962306a36Sopenharmony_ci C_SPECTRUM_MEASUREMENT = 0x74, 11062306a36Sopenharmony_ci N_SPECTRUM_MEASUREMENT = 0x75, 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci /* Power Management */ 11362306a36Sopenharmony_ci C_POWER_TBL = 0x77, 11462306a36Sopenharmony_ci N_PM_SLEEP = 0x7A, 11562306a36Sopenharmony_ci N_PM_DEBUG_STATS = 0x7B, 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci /* Scan commands and notifications */ 11862306a36Sopenharmony_ci C_SCAN = 0x80, 11962306a36Sopenharmony_ci C_SCAN_ABORT = 0x81, 12062306a36Sopenharmony_ci N_SCAN_START = 0x82, 12162306a36Sopenharmony_ci N_SCAN_RESULTS = 0x83, 12262306a36Sopenharmony_ci N_SCAN_COMPLETE = 0x84, 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci /* IBSS/AP commands */ 12562306a36Sopenharmony_ci N_BEACON = 0x90, 12662306a36Sopenharmony_ci C_TX_BEACON = 0x91, 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci /* Miscellaneous commands */ 12962306a36Sopenharmony_ci C_TX_PWR_TBL = 0x97, 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci /* Bluetooth device coexistence config command */ 13262306a36Sopenharmony_ci C_BT_CONFIG = 0x9b, 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci /* Statistics */ 13562306a36Sopenharmony_ci C_STATS = 0x9c, 13662306a36Sopenharmony_ci N_STATS = 0x9d, 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci /* RF-KILL commands and notifications */ 13962306a36Sopenharmony_ci N_CARD_STATE = 0xa1, 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci /* Missed beacons notification */ 14262306a36Sopenharmony_ci N_MISSED_BEACONS = 0xa2, 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci C_CT_KILL_CONFIG = 0xa4, 14562306a36Sopenharmony_ci C_SENSITIVITY = 0xa8, 14662306a36Sopenharmony_ci C_PHY_CALIBRATION = 0xb0, 14762306a36Sopenharmony_ci N_RX_PHY = 0xc0, 14862306a36Sopenharmony_ci N_RX_MPDU = 0xc1, 14962306a36Sopenharmony_ci N_RX = 0xc3, 15062306a36Sopenharmony_ci N_COMPRESSED_BA = 0xc5, 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci IL_CN_MAX = 0xff 15362306a36Sopenharmony_ci}; 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/****************************************************************************** 15662306a36Sopenharmony_ci * (0) 15762306a36Sopenharmony_ci * Commonly used structures and definitions: 15862306a36Sopenharmony_ci * Command header, rate_n_flags, txpower 15962306a36Sopenharmony_ci * 16062306a36Sopenharmony_ci *****************************************************************************/ 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci/* il_cmd_header flags value */ 16362306a36Sopenharmony_ci#define IL_CMD_FAILED_MSK 0x40 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) 16662306a36Sopenharmony_ci#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 16762306a36Sopenharmony_ci#define SEQ_TO_IDX(s) ((s) & 0xff) 16862306a36Sopenharmony_ci#define IDX_TO_SEQ(i) ((i) & 0xff) 16962306a36Sopenharmony_ci#define SEQ_HUGE_FRAME cpu_to_le16(0x4000) 17062306a36Sopenharmony_ci#define SEQ_RX_FRAME cpu_to_le16(0x8000) 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/** 17362306a36Sopenharmony_ci * struct il_cmd_header 17462306a36Sopenharmony_ci * 17562306a36Sopenharmony_ci * This header format appears in the beginning of each command sent from the 17662306a36Sopenharmony_ci * driver, and each response/notification received from uCode. 17762306a36Sopenharmony_ci */ 17862306a36Sopenharmony_cistruct il_cmd_header { 17962306a36Sopenharmony_ci u8 cmd; /* Command ID: C_RXON, etc. */ 18062306a36Sopenharmony_ci u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ 18162306a36Sopenharmony_ci /* 18262306a36Sopenharmony_ci * The driver sets up the sequence number to values of its choosing. 18362306a36Sopenharmony_ci * uCode does not use this value, but passes it back to the driver 18462306a36Sopenharmony_ci * when sending the response to each driver-originated command, so 18562306a36Sopenharmony_ci * the driver can match the response to the command. Since the values 18662306a36Sopenharmony_ci * don't get used by uCode, the driver may set up an arbitrary format. 18762306a36Sopenharmony_ci * 18862306a36Sopenharmony_ci * There is one exception: uCode sets bit 15 when it originates 18962306a36Sopenharmony_ci * the response/notification, i.e. when the response/notification 19062306a36Sopenharmony_ci * is not a direct response to a command sent by the driver. For 19162306a36Sopenharmony_ci * example, uCode issues N_3945_RX when it sends a received frame 19262306a36Sopenharmony_ci * to the driver; it is not a direct response to any driver command. 19362306a36Sopenharmony_ci * 19462306a36Sopenharmony_ci * The Linux driver uses the following format: 19562306a36Sopenharmony_ci * 19662306a36Sopenharmony_ci * 0:7 tfd idx - position within TX queue 19762306a36Sopenharmony_ci * 8:12 TX queue id 19862306a36Sopenharmony_ci * 13 reserved 19962306a36Sopenharmony_ci * 14 huge - driver sets this to indicate command is in the 20062306a36Sopenharmony_ci * 'huge' storage at the end of the command buffers 20162306a36Sopenharmony_ci * 15 unsolicited RX or uCode-originated notification 20262306a36Sopenharmony_ci */ 20362306a36Sopenharmony_ci __le16 sequence; 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci /* command or response/notification data follows immediately */ 20662306a36Sopenharmony_ci u8 data[]; 20762306a36Sopenharmony_ci} __packed; 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci/** 21062306a36Sopenharmony_ci * struct il3945_tx_power 21162306a36Sopenharmony_ci * 21262306a36Sopenharmony_ci * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH 21362306a36Sopenharmony_ci * 21462306a36Sopenharmony_ci * Each entry contains two values: 21562306a36Sopenharmony_ci * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained 21662306a36Sopenharmony_ci * linear value that multiplies the output of the digital signal processor, 21762306a36Sopenharmony_ci * before being sent to the analog radio. 21862306a36Sopenharmony_ci * 2) Radio gain. This sets the analog gain of the radio Tx path. 21962306a36Sopenharmony_ci * It is a coarser setting, and behaves in a logarithmic (dB) fashion. 22062306a36Sopenharmony_ci * 22162306a36Sopenharmony_ci * Driver obtains values from struct il3945_tx_power power_gain_table[][]. 22262306a36Sopenharmony_ci */ 22362306a36Sopenharmony_cistruct il3945_tx_power { 22462306a36Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 22562306a36Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 22662306a36Sopenharmony_ci} __packed; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci/** 22962306a36Sopenharmony_ci * struct il3945_power_per_rate 23062306a36Sopenharmony_ci * 23162306a36Sopenharmony_ci * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH 23262306a36Sopenharmony_ci */ 23362306a36Sopenharmony_cistruct il3945_power_per_rate { 23462306a36Sopenharmony_ci u8 rate; /* plcp */ 23562306a36Sopenharmony_ci struct il3945_tx_power tpc; 23662306a36Sopenharmony_ci u8 reserved; 23762306a36Sopenharmony_ci} __packed; 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/** 24062306a36Sopenharmony_ci * iwl4965 rate_n_flags bit fields 24162306a36Sopenharmony_ci * 24262306a36Sopenharmony_ci * rate_n_flags format is used in following iwl4965 commands: 24362306a36Sopenharmony_ci * N_RX (response only) 24462306a36Sopenharmony_ci * N_RX_MPDU (response only) 24562306a36Sopenharmony_ci * C_TX (both command and response) 24662306a36Sopenharmony_ci * C_TX_LINK_QUALITY_CMD 24762306a36Sopenharmony_ci * 24862306a36Sopenharmony_ci * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): 24962306a36Sopenharmony_ci * 2-0: 0) 6 Mbps 25062306a36Sopenharmony_ci * 1) 12 Mbps 25162306a36Sopenharmony_ci * 2) 18 Mbps 25262306a36Sopenharmony_ci * 3) 24 Mbps 25362306a36Sopenharmony_ci * 4) 36 Mbps 25462306a36Sopenharmony_ci * 5) 48 Mbps 25562306a36Sopenharmony_ci * 6) 54 Mbps 25662306a36Sopenharmony_ci * 7) 60 Mbps 25762306a36Sopenharmony_ci * 25862306a36Sopenharmony_ci * 4-3: 0) Single stream (SISO) 25962306a36Sopenharmony_ci * 1) Dual stream (MIMO) 26062306a36Sopenharmony_ci * 2) Triple stream (MIMO) 26162306a36Sopenharmony_ci * 26262306a36Sopenharmony_ci * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data 26362306a36Sopenharmony_ci * 26462306a36Sopenharmony_ci * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): 26562306a36Sopenharmony_ci * 3-0: 0xD) 6 Mbps 26662306a36Sopenharmony_ci * 0xF) 9 Mbps 26762306a36Sopenharmony_ci * 0x5) 12 Mbps 26862306a36Sopenharmony_ci * 0x7) 18 Mbps 26962306a36Sopenharmony_ci * 0x9) 24 Mbps 27062306a36Sopenharmony_ci * 0xB) 36 Mbps 27162306a36Sopenharmony_ci * 0x1) 48 Mbps 27262306a36Sopenharmony_ci * 0x3) 54 Mbps 27362306a36Sopenharmony_ci * 27462306a36Sopenharmony_ci * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 27562306a36Sopenharmony_ci * 6-0: 10) 1 Mbps 27662306a36Sopenharmony_ci * 20) 2 Mbps 27762306a36Sopenharmony_ci * 55) 5.5 Mbps 27862306a36Sopenharmony_ci * 110) 11 Mbps 27962306a36Sopenharmony_ci */ 28062306a36Sopenharmony_ci#define RATE_MCS_CODE_MSK 0x7 28162306a36Sopenharmony_ci#define RATE_MCS_SPATIAL_POS 3 28262306a36Sopenharmony_ci#define RATE_MCS_SPATIAL_MSK 0x18 28362306a36Sopenharmony_ci#define RATE_MCS_HT_DUP_POS 5 28462306a36Sopenharmony_ci#define RATE_MCS_HT_DUP_MSK 0x20 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ 28762306a36Sopenharmony_ci#define RATE_MCS_FLAGS_POS 8 28862306a36Sopenharmony_ci#define RATE_MCS_HT_POS 8 28962306a36Sopenharmony_ci#define RATE_MCS_HT_MSK 0x100 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ci/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 29262306a36Sopenharmony_ci#define RATE_MCS_CCK_POS 9 29362306a36Sopenharmony_ci#define RATE_MCS_CCK_MSK 0x200 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci/* Bit 10: (1) Use Green Field preamble */ 29662306a36Sopenharmony_ci#define RATE_MCS_GF_POS 10 29762306a36Sopenharmony_ci#define RATE_MCS_GF_MSK 0x400 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ 30062306a36Sopenharmony_ci#define RATE_MCS_HT40_POS 11 30162306a36Sopenharmony_ci#define RATE_MCS_HT40_MSK 0x800 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ 30462306a36Sopenharmony_ci#define RATE_MCS_DUP_POS 12 30562306a36Sopenharmony_ci#define RATE_MCS_DUP_MSK 0x1000 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 30862306a36Sopenharmony_ci#define RATE_MCS_SGI_POS 13 30962306a36Sopenharmony_ci#define RATE_MCS_SGI_MSK 0x2000 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci/** 31262306a36Sopenharmony_ci * rate_n_flags Tx antenna masks 31362306a36Sopenharmony_ci * 4965 has 2 transmitters 31462306a36Sopenharmony_ci * bit14:16 31562306a36Sopenharmony_ci */ 31662306a36Sopenharmony_ci#define RATE_MCS_ANT_POS 14 31762306a36Sopenharmony_ci#define RATE_MCS_ANT_A_MSK 0x04000 31862306a36Sopenharmony_ci#define RATE_MCS_ANT_B_MSK 0x08000 31962306a36Sopenharmony_ci#define RATE_MCS_ANT_C_MSK 0x10000 32062306a36Sopenharmony_ci#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) 32162306a36Sopenharmony_ci#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) 32262306a36Sopenharmony_ci#define RATE_ANT_NUM 3 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci#define POWER_TBL_NUM_ENTRIES 33 32562306a36Sopenharmony_ci#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32 32662306a36Sopenharmony_ci#define POWER_TBL_CCK_ENTRY 32 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci#define IL_PWR_NUM_HT_OFDM_ENTRIES 24 32962306a36Sopenharmony_ci#define IL_PWR_CCK_ENTRIES 2 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci/** 33262306a36Sopenharmony_ci * union il4965_tx_power_dual_stream 33362306a36Sopenharmony_ci * 33462306a36Sopenharmony_ci * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH 33562306a36Sopenharmony_ci * Use __le32 version (struct tx_power_dual_stream) when building command. 33662306a36Sopenharmony_ci * 33762306a36Sopenharmony_ci * Driver provides radio gain and DSP attenuation settings to device in pairs, 33862306a36Sopenharmony_ci * one value for each transmitter chain. The first value is for transmitter A, 33962306a36Sopenharmony_ci * second for transmitter B. 34062306a36Sopenharmony_ci * 34162306a36Sopenharmony_ci * For SISO bit rates, both values in a pair should be identical. 34262306a36Sopenharmony_ci * For MIMO rates, one value may be different from the other, 34362306a36Sopenharmony_ci * in order to balance the Tx output between the two transmitters. 34462306a36Sopenharmony_ci * 34562306a36Sopenharmony_ci * See more details in doc for TXPOWER in 4965.h. 34662306a36Sopenharmony_ci */ 34762306a36Sopenharmony_ciunion il4965_tx_power_dual_stream { 34862306a36Sopenharmony_ci struct { 34962306a36Sopenharmony_ci u8 radio_tx_gain[2]; 35062306a36Sopenharmony_ci u8 dsp_predis_atten[2]; 35162306a36Sopenharmony_ci } s; 35262306a36Sopenharmony_ci u32 dw; 35362306a36Sopenharmony_ci}; 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci/** 35662306a36Sopenharmony_ci * struct tx_power_dual_stream 35762306a36Sopenharmony_ci * 35862306a36Sopenharmony_ci * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH 35962306a36Sopenharmony_ci * 36062306a36Sopenharmony_ci * Same format as il_tx_power_dual_stream, but __le32 36162306a36Sopenharmony_ci */ 36262306a36Sopenharmony_cistruct tx_power_dual_stream { 36362306a36Sopenharmony_ci __le32 dw; 36462306a36Sopenharmony_ci} __packed; 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ci/** 36762306a36Sopenharmony_ci * struct il4965_tx_power_db 36862306a36Sopenharmony_ci * 36962306a36Sopenharmony_ci * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH 37062306a36Sopenharmony_ci */ 37162306a36Sopenharmony_cistruct il4965_tx_power_db { 37262306a36Sopenharmony_ci struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES]; 37362306a36Sopenharmony_ci} __packed; 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci/****************************************************************************** 37662306a36Sopenharmony_ci * (0a) 37762306a36Sopenharmony_ci * Alive and Error Commands & Responses: 37862306a36Sopenharmony_ci * 37962306a36Sopenharmony_ci *****************************************************************************/ 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_ci#define UCODE_VALID_OK cpu_to_le32(0x1) 38262306a36Sopenharmony_ci#define INITIALIZE_SUBTYPE (9) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci/* 38562306a36Sopenharmony_ci * ("Initialize") N_ALIVE = 0x1 (response only, not a command) 38662306a36Sopenharmony_ci * 38762306a36Sopenharmony_ci * uCode issues this "initialize alive" notification once the initialization 38862306a36Sopenharmony_ci * uCode image has completed its work, and is ready to load the runtime image. 38962306a36Sopenharmony_ci * This is the *first* "alive" notification that the driver will receive after 39062306a36Sopenharmony_ci * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. 39162306a36Sopenharmony_ci * 39262306a36Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 39362306a36Sopenharmony_ci * 39462306a36Sopenharmony_ci * For 4965, this notification contains important calibration data for 39562306a36Sopenharmony_ci * calculating txpower settings: 39662306a36Sopenharmony_ci * 39762306a36Sopenharmony_ci * 1) Power supply voltage indication. The voltage sensor outputs higher 39862306a36Sopenharmony_ci * values for lower voltage, and vice verse. 39962306a36Sopenharmony_ci * 40062306a36Sopenharmony_ci * 2) Temperature measurement parameters, for each of two channel widths 40162306a36Sopenharmony_ci * (20 MHz and 40 MHz) supported by the radios. Temperature sensing 40262306a36Sopenharmony_ci * is done via one of the receiver chains, and channel width influences 40362306a36Sopenharmony_ci * the results. 40462306a36Sopenharmony_ci * 40562306a36Sopenharmony_ci * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, 40662306a36Sopenharmony_ci * for each of 5 frequency ranges. 40762306a36Sopenharmony_ci */ 40862306a36Sopenharmony_cistruct il_init_alive_resp { 40962306a36Sopenharmony_ci u8 ucode_minor; 41062306a36Sopenharmony_ci u8 ucode_major; 41162306a36Sopenharmony_ci __le16 reserved1; 41262306a36Sopenharmony_ci u8 sw_rev[8]; 41362306a36Sopenharmony_ci u8 ver_type; 41462306a36Sopenharmony_ci u8 ver_subtype; /* "9" for initialize alive */ 41562306a36Sopenharmony_ci __le16 reserved2; 41662306a36Sopenharmony_ci __le32 log_event_table_ptr; 41762306a36Sopenharmony_ci __le32 error_event_table_ptr; 41862306a36Sopenharmony_ci __le32 timestamp; 41962306a36Sopenharmony_ci __le32 is_valid; 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci /* calibration values from "initialize" uCode */ 42262306a36Sopenharmony_ci __le32 voltage; /* signed, higher value is lower voltage */ 42362306a36Sopenharmony_ci __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */ 42462306a36Sopenharmony_ci __le32 therm_r2[2]; /* signed */ 42562306a36Sopenharmony_ci __le32 therm_r3[2]; /* signed */ 42662306a36Sopenharmony_ci __le32 therm_r4[2]; /* signed */ 42762306a36Sopenharmony_ci __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, 42862306a36Sopenharmony_ci * 2 Tx chains */ 42962306a36Sopenharmony_ci} __packed; 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci/** 43262306a36Sopenharmony_ci * N_ALIVE = 0x1 (response only, not a command) 43362306a36Sopenharmony_ci * 43462306a36Sopenharmony_ci * uCode issues this "alive" notification once the runtime image is ready 43562306a36Sopenharmony_ci * to receive commands from the driver. This is the *second* "alive" 43662306a36Sopenharmony_ci * notification that the driver will receive after rebooting uCode; 43762306a36Sopenharmony_ci * this "alive" is indicated by subtype field != 9. 43862306a36Sopenharmony_ci * 43962306a36Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 44062306a36Sopenharmony_ci * 44162306a36Sopenharmony_ci * This response includes two pointers to structures within the device's 44262306a36Sopenharmony_ci * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: 44362306a36Sopenharmony_ci * 44462306a36Sopenharmony_ci * 1) log_event_table_ptr indicates base of the event log. This traces 44562306a36Sopenharmony_ci * a 256-entry history of uCode execution within a circular buffer. 44662306a36Sopenharmony_ci * Its header format is: 44762306a36Sopenharmony_ci * 44862306a36Sopenharmony_ci * __le32 log_size; log capacity (in number of entries) 44962306a36Sopenharmony_ci * __le32 type; (1) timestamp with each entry, (0) no timestamp 45062306a36Sopenharmony_ci * __le32 wraps; # times uCode has wrapped to top of circular buffer 45162306a36Sopenharmony_ci * __le32 write_idx; next circular buffer entry that uCode would fill 45262306a36Sopenharmony_ci * 45362306a36Sopenharmony_ci * The header is followed by the circular buffer of log entries. Entries 45462306a36Sopenharmony_ci * with timestamps have the following format: 45562306a36Sopenharmony_ci * 45662306a36Sopenharmony_ci * __le32 event_id; range 0 - 1500 45762306a36Sopenharmony_ci * __le32 timestamp; low 32 bits of TSF (of network, if associated) 45862306a36Sopenharmony_ci * __le32 data; event_id-specific data value 45962306a36Sopenharmony_ci * 46062306a36Sopenharmony_ci * Entries without timestamps contain only event_id and data. 46162306a36Sopenharmony_ci * 46262306a36Sopenharmony_ci * 46362306a36Sopenharmony_ci * 2) error_event_table_ptr indicates base of the error log. This contains 46462306a36Sopenharmony_ci * information about any uCode error that occurs. For 4965, the format 46562306a36Sopenharmony_ci * of the error log is: 46662306a36Sopenharmony_ci * 46762306a36Sopenharmony_ci * __le32 valid; (nonzero) valid, (0) log is empty 46862306a36Sopenharmony_ci * __le32 error_id; type of error 46962306a36Sopenharmony_ci * __le32 pc; program counter 47062306a36Sopenharmony_ci * __le32 blink1; branch link 47162306a36Sopenharmony_ci * __le32 blink2; branch link 47262306a36Sopenharmony_ci * __le32 ilink1; interrupt link 47362306a36Sopenharmony_ci * __le32 ilink2; interrupt link 47462306a36Sopenharmony_ci * __le32 data1; error-specific data 47562306a36Sopenharmony_ci * __le32 data2; error-specific data 47662306a36Sopenharmony_ci * __le32 line; source code line of error 47762306a36Sopenharmony_ci * __le32 bcon_time; beacon timer 47862306a36Sopenharmony_ci * __le32 tsf_low; network timestamp function timer 47962306a36Sopenharmony_ci * __le32 tsf_hi; network timestamp function timer 48062306a36Sopenharmony_ci * __le32 gp1; GP1 timer register 48162306a36Sopenharmony_ci * __le32 gp2; GP2 timer register 48262306a36Sopenharmony_ci * __le32 gp3; GP3 timer register 48362306a36Sopenharmony_ci * __le32 ucode_ver; uCode version 48462306a36Sopenharmony_ci * __le32 hw_ver; HW Silicon version 48562306a36Sopenharmony_ci * __le32 brd_ver; HW board version 48662306a36Sopenharmony_ci * __le32 log_pc; log program counter 48762306a36Sopenharmony_ci * __le32 frame_ptr; frame pointer 48862306a36Sopenharmony_ci * __le32 stack_ptr; stack pointer 48962306a36Sopenharmony_ci * __le32 hcmd; last host command 49062306a36Sopenharmony_ci * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag 49162306a36Sopenharmony_ci * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag 49262306a36Sopenharmony_ci * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag 49362306a36Sopenharmony_ci * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag 49462306a36Sopenharmony_ci * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt 49562306a36Sopenharmony_ci * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT 49662306a36Sopenharmony_ci * __le32 wait_event; wait event() caller address 49762306a36Sopenharmony_ci * __le32 l2p_control; L2pControlField 49862306a36Sopenharmony_ci * __le32 l2p_duration; L2pDurationField 49962306a36Sopenharmony_ci * __le32 l2p_mhvalid; L2pMhValidBits 50062306a36Sopenharmony_ci * __le32 l2p_addr_match; L2pAddrMatchStat 50162306a36Sopenharmony_ci * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL) 50262306a36Sopenharmony_ci * __le32 u_timestamp; indicate when the date and time of the compilation 50362306a36Sopenharmony_ci * __le32 reserved; 50462306a36Sopenharmony_ci * 50562306a36Sopenharmony_ci * The Linux driver can print both logs to the system log when a uCode error 50662306a36Sopenharmony_ci * occurs. 50762306a36Sopenharmony_ci */ 50862306a36Sopenharmony_cistruct il_alive_resp { 50962306a36Sopenharmony_ci u8 ucode_minor; 51062306a36Sopenharmony_ci u8 ucode_major; 51162306a36Sopenharmony_ci __le16 reserved1; 51262306a36Sopenharmony_ci u8 sw_rev[8]; 51362306a36Sopenharmony_ci u8 ver_type; 51462306a36Sopenharmony_ci u8 ver_subtype; /* not "9" for runtime alive */ 51562306a36Sopenharmony_ci __le16 reserved2; 51662306a36Sopenharmony_ci __le32 log_event_table_ptr; /* SRAM address for event log */ 51762306a36Sopenharmony_ci __le32 error_event_table_ptr; /* SRAM address for error log */ 51862306a36Sopenharmony_ci __le32 timestamp; 51962306a36Sopenharmony_ci __le32 is_valid; 52062306a36Sopenharmony_ci} __packed; 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci/* 52362306a36Sopenharmony_ci * N_ERROR = 0x2 (response only, not a command) 52462306a36Sopenharmony_ci */ 52562306a36Sopenharmony_cistruct il_error_resp { 52662306a36Sopenharmony_ci __le32 error_type; 52762306a36Sopenharmony_ci u8 cmd_id; 52862306a36Sopenharmony_ci u8 reserved1; 52962306a36Sopenharmony_ci __le16 bad_cmd_seq_num; 53062306a36Sopenharmony_ci __le32 error_info; 53162306a36Sopenharmony_ci __le64 timestamp; 53262306a36Sopenharmony_ci} __packed; 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci/****************************************************************************** 53562306a36Sopenharmony_ci * (1) 53662306a36Sopenharmony_ci * RXON Commands & Responses: 53762306a36Sopenharmony_ci * 53862306a36Sopenharmony_ci *****************************************************************************/ 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci/* 54162306a36Sopenharmony_ci * Rx config defines & structure 54262306a36Sopenharmony_ci */ 54362306a36Sopenharmony_ci/* rx_config device types */ 54462306a36Sopenharmony_cienum { 54562306a36Sopenharmony_ci RXON_DEV_TYPE_AP = 1, 54662306a36Sopenharmony_ci RXON_DEV_TYPE_ESS = 3, 54762306a36Sopenharmony_ci RXON_DEV_TYPE_IBSS = 4, 54862306a36Sopenharmony_ci RXON_DEV_TYPE_SNIFFER = 6, 54962306a36Sopenharmony_ci}; 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) 55262306a36Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) 55362306a36Sopenharmony_ci#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) 55462306a36Sopenharmony_ci#define RXON_RX_CHAIN_VALID_POS (1) 55562306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) 55662306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_POS (4) 55762306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) 55862306a36Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 55962306a36Sopenharmony_ci#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) 56062306a36Sopenharmony_ci#define RXON_RX_CHAIN_CNT_POS (10) 56162306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) 56262306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_POS (12) 56362306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) 56462306a36Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci/* rx_config flags */ 56762306a36Sopenharmony_ci/* band & modulation selection */ 56862306a36Sopenharmony_ci#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) 56962306a36Sopenharmony_ci#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) 57062306a36Sopenharmony_ci/* auto detection enable */ 57162306a36Sopenharmony_ci#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) 57262306a36Sopenharmony_ci/* TGg protection when tx */ 57362306a36Sopenharmony_ci#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) 57462306a36Sopenharmony_ci/* cck short slot & preamble */ 57562306a36Sopenharmony_ci#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) 57662306a36Sopenharmony_ci#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) 57762306a36Sopenharmony_ci/* antenna selection */ 57862306a36Sopenharmony_ci#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) 57962306a36Sopenharmony_ci#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) 58062306a36Sopenharmony_ci#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 58162306a36Sopenharmony_ci#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 58262306a36Sopenharmony_ci/* radar detection enable */ 58362306a36Sopenharmony_ci#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) 58462306a36Sopenharmony_ci#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) 58562306a36Sopenharmony_ci/* rx response to host with 8-byte TSF 58662306a36Sopenharmony_ci* (according to ON_AIR deassertion) */ 58762306a36Sopenharmony_ci#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ci/* HT flags */ 59062306a36Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) 59162306a36Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_ci#define RXON_FLG_HT_OPERATING_MODE_POS (23) 59462306a36Sopenharmony_ci 59562306a36Sopenharmony_ci#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) 59662306a36Sopenharmony_ci#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_POS (25) 59962306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_ci/* channel mode */ 60262306a36Sopenharmony_cienum { 60362306a36Sopenharmony_ci CHANNEL_MODE_LEGACY = 0, 60462306a36Sopenharmony_ci CHANNEL_MODE_PURE_40 = 1, 60562306a36Sopenharmony_ci CHANNEL_MODE_MIXED = 2, 60662306a36Sopenharmony_ci CHANNEL_MODE_RESERVED = 3, 60762306a36Sopenharmony_ci}; 60862306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_LEGACY \ 60962306a36Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) 61062306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_PURE_40 \ 61162306a36Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) 61262306a36Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MIXED \ 61362306a36Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci/* CTS to self (if spec allows) flag */ 61662306a36Sopenharmony_ci#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_ci/* rx_config filter flags */ 61962306a36Sopenharmony_ci/* accept all data frames */ 62062306a36Sopenharmony_ci#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) 62162306a36Sopenharmony_ci/* pass control & management to host */ 62262306a36Sopenharmony_ci#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) 62362306a36Sopenharmony_ci/* accept multi-cast */ 62462306a36Sopenharmony_ci#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) 62562306a36Sopenharmony_ci/* don't decrypt uni-cast frames */ 62662306a36Sopenharmony_ci#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) 62762306a36Sopenharmony_ci/* don't decrypt multi-cast frames */ 62862306a36Sopenharmony_ci#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) 62962306a36Sopenharmony_ci/* STA is associated */ 63062306a36Sopenharmony_ci#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) 63162306a36Sopenharmony_ci/* transfer to host non bssid beacons in associated state */ 63262306a36Sopenharmony_ci#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci/** 63562306a36Sopenharmony_ci * C_RXON = 0x10 (command, has simple generic response) 63662306a36Sopenharmony_ci * 63762306a36Sopenharmony_ci * RXON tunes the radio tuner to a service channel, and sets up a number 63862306a36Sopenharmony_ci * of parameters that are used primarily for Rx, but also for Tx operations. 63962306a36Sopenharmony_ci * 64062306a36Sopenharmony_ci * NOTE: When tuning to a new channel, driver must set the 64162306a36Sopenharmony_ci * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent 64262306a36Sopenharmony_ci * info within the device, including the station tables, tx retry 64362306a36Sopenharmony_ci * rate tables, and txpower tables. Driver must build a new station 64462306a36Sopenharmony_ci * table and txpower table before transmitting anything on the RXON 64562306a36Sopenharmony_ci * channel. 64662306a36Sopenharmony_ci * 64762306a36Sopenharmony_ci * NOTE: All RXONs wipe clean the internal txpower table. Driver must 64862306a36Sopenharmony_ci * issue a new C_TX_PWR_TBL after each C_RXON (0x10), 64962306a36Sopenharmony_ci * regardless of whether RXON_FILTER_ASSOC_MSK is set. 65062306a36Sopenharmony_ci */ 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_cistruct il3945_rxon_cmd { 65362306a36Sopenharmony_ci u8 node_addr[6]; 65462306a36Sopenharmony_ci __le16 reserved1; 65562306a36Sopenharmony_ci u8 bssid_addr[6]; 65662306a36Sopenharmony_ci __le16 reserved2; 65762306a36Sopenharmony_ci u8 wlap_bssid_addr[6]; 65862306a36Sopenharmony_ci __le16 reserved3; 65962306a36Sopenharmony_ci u8 dev_type; 66062306a36Sopenharmony_ci u8 air_propagation; 66162306a36Sopenharmony_ci __le16 reserved4; 66262306a36Sopenharmony_ci u8 ofdm_basic_rates; 66362306a36Sopenharmony_ci u8 cck_basic_rates; 66462306a36Sopenharmony_ci __le16 assoc_id; 66562306a36Sopenharmony_ci __le32 flags; 66662306a36Sopenharmony_ci __le32 filter_flags; 66762306a36Sopenharmony_ci __le16 channel; 66862306a36Sopenharmony_ci __le16 reserved5; 66962306a36Sopenharmony_ci} __packed; 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_cistruct il4965_rxon_cmd { 67262306a36Sopenharmony_ci u8 node_addr[6]; 67362306a36Sopenharmony_ci __le16 reserved1; 67462306a36Sopenharmony_ci u8 bssid_addr[6]; 67562306a36Sopenharmony_ci __le16 reserved2; 67662306a36Sopenharmony_ci u8 wlap_bssid_addr[6]; 67762306a36Sopenharmony_ci __le16 reserved3; 67862306a36Sopenharmony_ci u8 dev_type; 67962306a36Sopenharmony_ci u8 air_propagation; 68062306a36Sopenharmony_ci __le16 rx_chain; 68162306a36Sopenharmony_ci u8 ofdm_basic_rates; 68262306a36Sopenharmony_ci u8 cck_basic_rates; 68362306a36Sopenharmony_ci __le16 assoc_id; 68462306a36Sopenharmony_ci __le32 flags; 68562306a36Sopenharmony_ci __le32 filter_flags; 68662306a36Sopenharmony_ci __le16 channel; 68762306a36Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 68862306a36Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 68962306a36Sopenharmony_ci} __packed; 69062306a36Sopenharmony_ci 69162306a36Sopenharmony_ci/* Create a common rxon cmd which will be typecast into the 3945 or 4965 69262306a36Sopenharmony_ci * specific rxon cmd, depending on where it is called from. 69362306a36Sopenharmony_ci */ 69462306a36Sopenharmony_cistruct il_rxon_cmd { 69562306a36Sopenharmony_ci u8 node_addr[6]; 69662306a36Sopenharmony_ci __le16 reserved1; 69762306a36Sopenharmony_ci u8 bssid_addr[6]; 69862306a36Sopenharmony_ci __le16 reserved2; 69962306a36Sopenharmony_ci u8 wlap_bssid_addr[6]; 70062306a36Sopenharmony_ci __le16 reserved3; 70162306a36Sopenharmony_ci u8 dev_type; 70262306a36Sopenharmony_ci u8 air_propagation; 70362306a36Sopenharmony_ci __le16 rx_chain; 70462306a36Sopenharmony_ci u8 ofdm_basic_rates; 70562306a36Sopenharmony_ci u8 cck_basic_rates; 70662306a36Sopenharmony_ci __le16 assoc_id; 70762306a36Sopenharmony_ci __le32 flags; 70862306a36Sopenharmony_ci __le32 filter_flags; 70962306a36Sopenharmony_ci __le16 channel; 71062306a36Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 71162306a36Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 71262306a36Sopenharmony_ci u8 reserved4; 71362306a36Sopenharmony_ci u8 reserved5; 71462306a36Sopenharmony_ci} __packed; 71562306a36Sopenharmony_ci 71662306a36Sopenharmony_ci/* 71762306a36Sopenharmony_ci * C_RXON_ASSOC = 0x11 (command, has simple generic response) 71862306a36Sopenharmony_ci */ 71962306a36Sopenharmony_cistruct il3945_rxon_assoc_cmd { 72062306a36Sopenharmony_ci __le32 flags; 72162306a36Sopenharmony_ci __le32 filter_flags; 72262306a36Sopenharmony_ci u8 ofdm_basic_rates; 72362306a36Sopenharmony_ci u8 cck_basic_rates; 72462306a36Sopenharmony_ci __le16 reserved; 72562306a36Sopenharmony_ci} __packed; 72662306a36Sopenharmony_ci 72762306a36Sopenharmony_cistruct il4965_rxon_assoc_cmd { 72862306a36Sopenharmony_ci __le32 flags; 72962306a36Sopenharmony_ci __le32 filter_flags; 73062306a36Sopenharmony_ci u8 ofdm_basic_rates; 73162306a36Sopenharmony_ci u8 cck_basic_rates; 73262306a36Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 73362306a36Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 73462306a36Sopenharmony_ci __le16 rx_chain_select_flags; 73562306a36Sopenharmony_ci __le16 reserved; 73662306a36Sopenharmony_ci} __packed; 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci#define IL_CONN_MAX_LISTEN_INTERVAL 10 73962306a36Sopenharmony_ci#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ 74062306a36Sopenharmony_ci#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */ 74162306a36Sopenharmony_ci 74262306a36Sopenharmony_ci/* 74362306a36Sopenharmony_ci * C_RXON_TIMING = 0x14 (command, has simple generic response) 74462306a36Sopenharmony_ci */ 74562306a36Sopenharmony_cistruct il_rxon_time_cmd { 74662306a36Sopenharmony_ci __le64 timestamp; 74762306a36Sopenharmony_ci __le16 beacon_interval; 74862306a36Sopenharmony_ci __le16 atim_win; 74962306a36Sopenharmony_ci __le32 beacon_init_val; 75062306a36Sopenharmony_ci __le16 listen_interval; 75162306a36Sopenharmony_ci u8 dtim_period; 75262306a36Sopenharmony_ci u8 delta_cp_bss_tbtts; 75362306a36Sopenharmony_ci} __packed; 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci/* 75662306a36Sopenharmony_ci * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 75762306a36Sopenharmony_ci */ 75862306a36Sopenharmony_cistruct il3945_channel_switch_cmd { 75962306a36Sopenharmony_ci u8 band; 76062306a36Sopenharmony_ci u8 expect_beacon; 76162306a36Sopenharmony_ci __le16 channel; 76262306a36Sopenharmony_ci __le32 rxon_flags; 76362306a36Sopenharmony_ci __le32 rxon_filter_flags; 76462306a36Sopenharmony_ci __le32 switch_time; 76562306a36Sopenharmony_ci struct il3945_power_per_rate power[IL_MAX_RATES]; 76662306a36Sopenharmony_ci} __packed; 76762306a36Sopenharmony_ci 76862306a36Sopenharmony_cistruct il4965_channel_switch_cmd { 76962306a36Sopenharmony_ci u8 band; 77062306a36Sopenharmony_ci u8 expect_beacon; 77162306a36Sopenharmony_ci __le16 channel; 77262306a36Sopenharmony_ci __le32 rxon_flags; 77362306a36Sopenharmony_ci __le32 rxon_filter_flags; 77462306a36Sopenharmony_ci __le32 switch_time; 77562306a36Sopenharmony_ci struct il4965_tx_power_db tx_power; 77662306a36Sopenharmony_ci} __packed; 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_ci/* 77962306a36Sopenharmony_ci * N_CHANNEL_SWITCH = 0x73 (notification only, not a command) 78062306a36Sopenharmony_ci */ 78162306a36Sopenharmony_cistruct il_csa_notification { 78262306a36Sopenharmony_ci __le16 band; 78362306a36Sopenharmony_ci __le16 channel; 78462306a36Sopenharmony_ci __le32 status; /* 0 - OK, 1 - fail */ 78562306a36Sopenharmony_ci} __packed; 78662306a36Sopenharmony_ci 78762306a36Sopenharmony_ci/****************************************************************************** 78862306a36Sopenharmony_ci * (2) 78962306a36Sopenharmony_ci * Quality-of-Service (QOS) Commands & Responses: 79062306a36Sopenharmony_ci * 79162306a36Sopenharmony_ci *****************************************************************************/ 79262306a36Sopenharmony_ci 79362306a36Sopenharmony_ci/** 79462306a36Sopenharmony_ci * struct il_ac_qos -- QOS timing params for C_QOS_PARAM 79562306a36Sopenharmony_ci * One for each of 4 EDCA access categories in struct il_qosparam_cmd 79662306a36Sopenharmony_ci * 79762306a36Sopenharmony_ci * @cw_min: Contention win, start value in numbers of slots. 79862306a36Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x0f. 79962306a36Sopenharmony_ci * @cw_max: Contention win, max value in numbers of slots. 80062306a36Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x3f. 80162306a36Sopenharmony_ci * @aifsn: Number of slots in Arbitration Interframe Space (before 80262306a36Sopenharmony_ci * performing random backoff timing prior to Tx). Device default 1. 80362306a36Sopenharmony_ci * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 80462306a36Sopenharmony_ci * 80562306a36Sopenharmony_ci * Device will automatically increase contention win by (2*CW) + 1 for each 80662306a36Sopenharmony_ci * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 80762306a36Sopenharmony_ci * value, to cap the CW value. 80862306a36Sopenharmony_ci */ 80962306a36Sopenharmony_cistruct il_ac_qos { 81062306a36Sopenharmony_ci __le16 cw_min; 81162306a36Sopenharmony_ci __le16 cw_max; 81262306a36Sopenharmony_ci u8 aifsn; 81362306a36Sopenharmony_ci u8 reserved1; 81462306a36Sopenharmony_ci __le16 edca_txop; 81562306a36Sopenharmony_ci} __packed; 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_ci/* QoS flags defines */ 81862306a36Sopenharmony_ci#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) 81962306a36Sopenharmony_ci#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) 82062306a36Sopenharmony_ci#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) 82162306a36Sopenharmony_ci 82262306a36Sopenharmony_ci/* Number of Access Categories (AC) (EDCA), queues 0..3 */ 82362306a36Sopenharmony_ci#define AC_NUM 4 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci/* 82662306a36Sopenharmony_ci * C_QOS_PARAM = 0x13 (command, has simple generic response) 82762306a36Sopenharmony_ci * 82862306a36Sopenharmony_ci * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 82962306a36Sopenharmony_ci * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 83062306a36Sopenharmony_ci */ 83162306a36Sopenharmony_cistruct il_qosparam_cmd { 83262306a36Sopenharmony_ci __le32 qos_flags; 83362306a36Sopenharmony_ci struct il_ac_qos ac[AC_NUM]; 83462306a36Sopenharmony_ci} __packed; 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_ci/****************************************************************************** 83762306a36Sopenharmony_ci * (3) 83862306a36Sopenharmony_ci * Add/Modify Stations Commands & Responses: 83962306a36Sopenharmony_ci * 84062306a36Sopenharmony_ci *****************************************************************************/ 84162306a36Sopenharmony_ci/* 84262306a36Sopenharmony_ci * Multi station support 84362306a36Sopenharmony_ci */ 84462306a36Sopenharmony_ci 84562306a36Sopenharmony_ci/* Special, dedicated locations within device's station table */ 84662306a36Sopenharmony_ci#define IL_AP_ID 0 84762306a36Sopenharmony_ci#define IL_STA_ID 2 84862306a36Sopenharmony_ci#define IL3945_BROADCAST_ID 24 84962306a36Sopenharmony_ci#define IL3945_STATION_COUNT 25 85062306a36Sopenharmony_ci#define IL4965_BROADCAST_ID 31 85162306a36Sopenharmony_ci#define IL4965_STATION_COUNT 32 85262306a36Sopenharmony_ci 85362306a36Sopenharmony_ci#define IL_STATION_COUNT 32 /* MAX(3945,4965) */ 85462306a36Sopenharmony_ci#define IL_INVALID_STATION 255 85562306a36Sopenharmony_ci 85662306a36Sopenharmony_ci#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) 85762306a36Sopenharmony_ci#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) 85862306a36Sopenharmony_ci#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) 85962306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) 86062306a36Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_POS (19) 86162306a36Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) 86262306a36Sopenharmony_ci#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) 86362306a36Sopenharmony_ci#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) 86462306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_POS (23) 86562306a36Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) 86662306a36Sopenharmony_ci 86762306a36Sopenharmony_ci/* Use in mode field. 1: modify existing entry, 0: add new station entry */ 86862306a36Sopenharmony_ci#define STA_CONTROL_MODIFY_MSK 0x01 86962306a36Sopenharmony_ci 87062306a36Sopenharmony_ci/* key flags __le16*/ 87162306a36Sopenharmony_ci#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) 87262306a36Sopenharmony_ci#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) 87362306a36Sopenharmony_ci#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) 87462306a36Sopenharmony_ci#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) 87562306a36Sopenharmony_ci#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) 87662306a36Sopenharmony_ci 87762306a36Sopenharmony_ci#define STA_KEY_FLG_KEYID_POS 8 87862306a36Sopenharmony_ci#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) 87962306a36Sopenharmony_ci/* wep key is either from global key (0) or from station info array (1) */ 88062306a36Sopenharmony_ci#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) 88162306a36Sopenharmony_ci 88262306a36Sopenharmony_ci/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ 88362306a36Sopenharmony_ci#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) 88462306a36Sopenharmony_ci#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) 88562306a36Sopenharmony_ci#define STA_KEY_MAX_NUM 8 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_ci/* Flags indicate whether to modify vs. don't change various station params */ 88862306a36Sopenharmony_ci#define STA_MODIFY_KEY_MASK 0x01 88962306a36Sopenharmony_ci#define STA_MODIFY_TID_DISABLE_TX 0x02 89062306a36Sopenharmony_ci#define STA_MODIFY_TX_RATE_MSK 0x04 89162306a36Sopenharmony_ci#define STA_MODIFY_ADDBA_TID_MSK 0x08 89262306a36Sopenharmony_ci#define STA_MODIFY_DELBA_TID_MSK 0x10 89362306a36Sopenharmony_ci#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 89462306a36Sopenharmony_ci 89562306a36Sopenharmony_ci/* Receiver address (actually, Rx station's idx into station table), 89662306a36Sopenharmony_ci * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 89762306a36Sopenharmony_ci#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_cistruct il4965_keyinfo { 90062306a36Sopenharmony_ci __le16 key_flags; 90162306a36Sopenharmony_ci u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 90262306a36Sopenharmony_ci u8 reserved1; 90362306a36Sopenharmony_ci __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 90462306a36Sopenharmony_ci u8 key_offset; 90562306a36Sopenharmony_ci u8 reserved2; 90662306a36Sopenharmony_ci u8 key[16]; /* 16-byte unicast decryption key */ 90762306a36Sopenharmony_ci} __packed; 90862306a36Sopenharmony_ci 90962306a36Sopenharmony_ci/** 91062306a36Sopenharmony_ci * struct sta_id_modify 91162306a36Sopenharmony_ci * @addr[ETH_ALEN]: station's MAC address 91262306a36Sopenharmony_ci * @sta_id: idx of station in uCode's station table 91362306a36Sopenharmony_ci * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 91462306a36Sopenharmony_ci * 91562306a36Sopenharmony_ci * Driver selects unused table idx when adding new station, 91662306a36Sopenharmony_ci * or the idx to a pre-existing station entry when modifying that station. 91762306a36Sopenharmony_ci * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP). 91862306a36Sopenharmony_ci * 91962306a36Sopenharmony_ci * modify_mask flags select which parameters to modify vs. leave alone. 92062306a36Sopenharmony_ci */ 92162306a36Sopenharmony_cistruct sta_id_modify { 92262306a36Sopenharmony_ci u8 addr[ETH_ALEN]; 92362306a36Sopenharmony_ci __le16 reserved1; 92462306a36Sopenharmony_ci u8 sta_id; 92562306a36Sopenharmony_ci u8 modify_mask; 92662306a36Sopenharmony_ci __le16 reserved2; 92762306a36Sopenharmony_ci} __packed; 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci/* 93062306a36Sopenharmony_ci * C_ADD_STA = 0x18 (command) 93162306a36Sopenharmony_ci * 93262306a36Sopenharmony_ci * The device contains an internal table of per-station information, 93362306a36Sopenharmony_ci * with info on security keys, aggregation parameters, and Tx rates for 93462306a36Sopenharmony_ci * initial Tx attempt and any retries (4965 devices uses 93562306a36Sopenharmony_ci * C_TX_LINK_QUALITY_CMD, 93662306a36Sopenharmony_ci * 3945 uses C_RATE_SCALE to set up rate tables). 93762306a36Sopenharmony_ci * 93862306a36Sopenharmony_ci * C_ADD_STA sets up the table entry for one station, either creating 93962306a36Sopenharmony_ci * a new entry, or modifying a pre-existing one. 94062306a36Sopenharmony_ci * 94162306a36Sopenharmony_ci * NOTE: RXON command (without "associated" bit set) wipes the station table 94262306a36Sopenharmony_ci * clean. Moving into RF_KILL state does this also. Driver must set up 94362306a36Sopenharmony_ci * new station table before transmitting anything on the RXON channel 94462306a36Sopenharmony_ci * (except active scans or active measurements; those commands carry 94562306a36Sopenharmony_ci * their own txpower/rate setup data). 94662306a36Sopenharmony_ci * 94762306a36Sopenharmony_ci * When getting started on a new channel, driver must set up the 94862306a36Sopenharmony_ci * IL_BROADCAST_ID entry (last entry in the table). For a client 94962306a36Sopenharmony_ci * station in a BSS, once an AP is selected, driver sets up the AP STA 95062306a36Sopenharmony_ci * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP 95162306a36Sopenharmony_ci * are all that are needed for a BSS client station. If the device is 95262306a36Sopenharmony_ci * used as AP, or in an IBSS network, driver must set up station table 95362306a36Sopenharmony_ci * entries for all STAs in network, starting with idx IL_STA_ID. 95462306a36Sopenharmony_ci */ 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_cistruct il3945_addsta_cmd { 95762306a36Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 95862306a36Sopenharmony_ci u8 reserved[3]; 95962306a36Sopenharmony_ci struct sta_id_modify sta; 96062306a36Sopenharmony_ci struct il4965_keyinfo key; 96162306a36Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 96262306a36Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 96362306a36Sopenharmony_ci 96462306a36Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 96562306a36Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 96662306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 96762306a36Sopenharmony_ci __le16 tid_disable_tx; 96862306a36Sopenharmony_ci 96962306a36Sopenharmony_ci __le16 rate_n_flags; 97062306a36Sopenharmony_ci 97162306a36Sopenharmony_ci /* TID for which to add block-ack support. 97262306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 97362306a36Sopenharmony_ci u8 add_immediate_ba_tid; 97462306a36Sopenharmony_ci 97562306a36Sopenharmony_ci /* TID for which to remove block-ack support. 97662306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 97762306a36Sopenharmony_ci u8 remove_immediate_ba_tid; 97862306a36Sopenharmony_ci 97962306a36Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 98062306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 98162306a36Sopenharmony_ci __le16 add_immediate_ba_ssn; 98262306a36Sopenharmony_ci} __packed; 98362306a36Sopenharmony_ci 98462306a36Sopenharmony_cistruct il4965_addsta_cmd { 98562306a36Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 98662306a36Sopenharmony_ci u8 reserved[3]; 98762306a36Sopenharmony_ci struct sta_id_modify sta; 98862306a36Sopenharmony_ci struct il4965_keyinfo key; 98962306a36Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 99062306a36Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 99162306a36Sopenharmony_ci 99262306a36Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 99362306a36Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 99462306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 99562306a36Sopenharmony_ci __le16 tid_disable_tx; 99662306a36Sopenharmony_ci 99762306a36Sopenharmony_ci __le16 reserved1; 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_ci /* TID for which to add block-ack support. 100062306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 100162306a36Sopenharmony_ci u8 add_immediate_ba_tid; 100262306a36Sopenharmony_ci 100362306a36Sopenharmony_ci /* TID for which to remove block-ack support. 100462306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 100562306a36Sopenharmony_ci u8 remove_immediate_ba_tid; 100662306a36Sopenharmony_ci 100762306a36Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 100862306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 100962306a36Sopenharmony_ci __le16 add_immediate_ba_ssn; 101062306a36Sopenharmony_ci 101162306a36Sopenharmony_ci /* 101262306a36Sopenharmony_ci * Number of packets OK to transmit to station even though 101362306a36Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 101462306a36Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 101562306a36Sopenharmony_ci */ 101662306a36Sopenharmony_ci __le16 sleep_tx_count; 101762306a36Sopenharmony_ci 101862306a36Sopenharmony_ci __le16 reserved2; 101962306a36Sopenharmony_ci} __packed; 102062306a36Sopenharmony_ci 102162306a36Sopenharmony_ci/* Wrapper struct for 3945 and 4965 addsta_cmd structures */ 102262306a36Sopenharmony_cistruct il_addsta_cmd { 102362306a36Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 102462306a36Sopenharmony_ci u8 reserved[3]; 102562306a36Sopenharmony_ci struct sta_id_modify sta; 102662306a36Sopenharmony_ci struct il4965_keyinfo key; 102762306a36Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 102862306a36Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 102962306a36Sopenharmony_ci 103062306a36Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 103162306a36Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 103262306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 103362306a36Sopenharmony_ci __le16 tid_disable_tx; 103462306a36Sopenharmony_ci 103562306a36Sopenharmony_ci __le16 rate_n_flags; /* 3945 only */ 103662306a36Sopenharmony_ci 103762306a36Sopenharmony_ci /* TID for which to add block-ack support. 103862306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 103962306a36Sopenharmony_ci u8 add_immediate_ba_tid; 104062306a36Sopenharmony_ci 104162306a36Sopenharmony_ci /* TID for which to remove block-ack support. 104262306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 104362306a36Sopenharmony_ci u8 remove_immediate_ba_tid; 104462306a36Sopenharmony_ci 104562306a36Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 104662306a36Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 104762306a36Sopenharmony_ci __le16 add_immediate_ba_ssn; 104862306a36Sopenharmony_ci 104962306a36Sopenharmony_ci /* 105062306a36Sopenharmony_ci * Number of packets OK to transmit to station even though 105162306a36Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 105262306a36Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 105362306a36Sopenharmony_ci */ 105462306a36Sopenharmony_ci __le16 sleep_tx_count; 105562306a36Sopenharmony_ci 105662306a36Sopenharmony_ci __le16 reserved2; 105762306a36Sopenharmony_ci} __packed; 105862306a36Sopenharmony_ci 105962306a36Sopenharmony_ci#define ADD_STA_SUCCESS_MSK 0x1 106062306a36Sopenharmony_ci#define ADD_STA_NO_ROOM_IN_TBL 0x2 106162306a36Sopenharmony_ci#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 106262306a36Sopenharmony_ci#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 106362306a36Sopenharmony_ci/* 106462306a36Sopenharmony_ci * C_ADD_STA = 0x18 (response) 106562306a36Sopenharmony_ci */ 106662306a36Sopenharmony_cistruct il_add_sta_resp { 106762306a36Sopenharmony_ci u8 status; /* ADD_STA_* */ 106862306a36Sopenharmony_ci} __packed; 106962306a36Sopenharmony_ci 107062306a36Sopenharmony_ci#define REM_STA_SUCCESS_MSK 0x1 107162306a36Sopenharmony_ci/* 107262306a36Sopenharmony_ci * C_REM_STA = 0x19 (response) 107362306a36Sopenharmony_ci */ 107462306a36Sopenharmony_cistruct il_rem_sta_resp { 107562306a36Sopenharmony_ci u8 status; 107662306a36Sopenharmony_ci} __packed; 107762306a36Sopenharmony_ci 107862306a36Sopenharmony_ci/* 107962306a36Sopenharmony_ci * C_REM_STA = 0x19 (command) 108062306a36Sopenharmony_ci */ 108162306a36Sopenharmony_cistruct il_rem_sta_cmd { 108262306a36Sopenharmony_ci u8 num_sta; /* number of removed stations */ 108362306a36Sopenharmony_ci u8 reserved[3]; 108462306a36Sopenharmony_ci u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 108562306a36Sopenharmony_ci u8 reserved2[2]; 108662306a36Sopenharmony_ci} __packed; 108762306a36Sopenharmony_ci 108862306a36Sopenharmony_ci#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) 108962306a36Sopenharmony_ci#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) 109062306a36Sopenharmony_ci#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) 109162306a36Sopenharmony_ci#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) 109262306a36Sopenharmony_ci#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) 109362306a36Sopenharmony_ci 109462306a36Sopenharmony_ci#define IL_DROP_SINGLE 0 109562306a36Sopenharmony_ci#define IL_DROP_SELECTED 1 109662306a36Sopenharmony_ci#define IL_DROP_ALL 2 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci/* 109962306a36Sopenharmony_ci * REPLY_WEP_KEY = 0x20 110062306a36Sopenharmony_ci */ 110162306a36Sopenharmony_cistruct il_wep_key { 110262306a36Sopenharmony_ci u8 key_idx; 110362306a36Sopenharmony_ci u8 key_offset; 110462306a36Sopenharmony_ci u8 reserved1[2]; 110562306a36Sopenharmony_ci u8 key_size; 110662306a36Sopenharmony_ci u8 reserved2[3]; 110762306a36Sopenharmony_ci u8 key[16]; 110862306a36Sopenharmony_ci} __packed; 110962306a36Sopenharmony_ci 111062306a36Sopenharmony_cistruct il_wep_cmd { 111162306a36Sopenharmony_ci u8 num_keys; 111262306a36Sopenharmony_ci u8 global_key_type; 111362306a36Sopenharmony_ci u8 flags; 111462306a36Sopenharmony_ci u8 reserved; 111562306a36Sopenharmony_ci struct il_wep_key key[]; 111662306a36Sopenharmony_ci} __packed; 111762306a36Sopenharmony_ci 111862306a36Sopenharmony_ci#define WEP_KEY_WEP_TYPE 1 111962306a36Sopenharmony_ci#define WEP_KEYS_MAX 4 112062306a36Sopenharmony_ci#define WEP_INVALID_OFFSET 0xff 112162306a36Sopenharmony_ci#define WEP_KEY_LEN_64 5 112262306a36Sopenharmony_ci#define WEP_KEY_LEN_128 13 112362306a36Sopenharmony_ci 112462306a36Sopenharmony_ci/****************************************************************************** 112562306a36Sopenharmony_ci * (4) 112662306a36Sopenharmony_ci * Rx Responses: 112762306a36Sopenharmony_ci * 112862306a36Sopenharmony_ci *****************************************************************************/ 112962306a36Sopenharmony_ci 113062306a36Sopenharmony_ci#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) 113162306a36Sopenharmony_ci#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) 113262306a36Sopenharmony_ci 113362306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) 113462306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 113562306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 113662306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 113762306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 113862306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 113962306a36Sopenharmony_ci#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) 114062306a36Sopenharmony_ci 114162306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 114262306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) 114362306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) 114462306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) 114562306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) 114662306a36Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) 114762306a36Sopenharmony_ci 114862306a36Sopenharmony_ci#define RX_RES_STATUS_STATION_FOUND (1<<6) 114962306a36Sopenharmony_ci#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) 115062306a36Sopenharmony_ci 115162306a36Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) 115262306a36Sopenharmony_ci#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) 115362306a36Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) 115462306a36Sopenharmony_ci#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 115562306a36Sopenharmony_ci#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 115662306a36Sopenharmony_ci 115762306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_ICV_OK (0x20) 115862306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_MIC_OK (0x40) 115962306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 116062306a36Sopenharmony_ci#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 116162306a36Sopenharmony_ci 116262306a36Sopenharmony_cistruct il3945_rx_frame_stats { 116362306a36Sopenharmony_ci u8 phy_count; 116462306a36Sopenharmony_ci u8 id; 116562306a36Sopenharmony_ci u8 rssi; 116662306a36Sopenharmony_ci u8 agc; 116762306a36Sopenharmony_ci __le16 sig_avg; 116862306a36Sopenharmony_ci __le16 noise_diff; 116962306a36Sopenharmony_ci u8 payload[]; 117062306a36Sopenharmony_ci} __packed; 117162306a36Sopenharmony_ci 117262306a36Sopenharmony_cistruct il3945_rx_frame_hdr { 117362306a36Sopenharmony_ci __le16 channel; 117462306a36Sopenharmony_ci __le16 phy_flags; 117562306a36Sopenharmony_ci u8 reserved1; 117662306a36Sopenharmony_ci u8 rate; 117762306a36Sopenharmony_ci __le16 len; 117862306a36Sopenharmony_ci u8 payload[]; 117962306a36Sopenharmony_ci} __packed; 118062306a36Sopenharmony_ci 118162306a36Sopenharmony_cistruct il3945_rx_frame_end { 118262306a36Sopenharmony_ci __le32 status; 118362306a36Sopenharmony_ci __le64 timestamp; 118462306a36Sopenharmony_ci __le32 beacon_timestamp; 118562306a36Sopenharmony_ci} __packed; 118662306a36Sopenharmony_ci 118762306a36Sopenharmony_ci/* 118862306a36Sopenharmony_ci * N_3945_RX = 0x1b (response only, not a command) 118962306a36Sopenharmony_ci * 119062306a36Sopenharmony_ci * NOTE: DO NOT dereference from casts to this structure 119162306a36Sopenharmony_ci * It is provided only for calculating minimum data set size. 119262306a36Sopenharmony_ci * The actual offsets of the hdr and end are dynamic based on 119362306a36Sopenharmony_ci * stats.phy_count 119462306a36Sopenharmony_ci */ 119562306a36Sopenharmony_cistruct il3945_rx_frame { 119662306a36Sopenharmony_ci struct il3945_rx_frame_stats stats; 119762306a36Sopenharmony_ci struct il3945_rx_frame_hdr hdr; 119862306a36Sopenharmony_ci struct il3945_rx_frame_end end; 119962306a36Sopenharmony_ci} __packed; 120062306a36Sopenharmony_ci 120162306a36Sopenharmony_ci#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame)) 120262306a36Sopenharmony_ci 120362306a36Sopenharmony_ci/* Fixed (non-configurable) rx data from phy */ 120462306a36Sopenharmony_ci 120562306a36Sopenharmony_ci#define IL49_RX_RES_PHY_CNT 14 120662306a36Sopenharmony_ci#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 120762306a36Sopenharmony_ci#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 120862306a36Sopenharmony_ci#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 120962306a36Sopenharmony_ci#define IL49_AGC_DB_POS (7) 121062306a36Sopenharmony_cistruct il4965_rx_non_cfg_phy { 121162306a36Sopenharmony_ci __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 121262306a36Sopenharmony_ci __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 121362306a36Sopenharmony_ci u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 121462306a36Sopenharmony_ci u8 pad[]; 121562306a36Sopenharmony_ci} __packed; 121662306a36Sopenharmony_ci 121762306a36Sopenharmony_ci/* 121862306a36Sopenharmony_ci * N_RX = 0xc3 (response only, not a command) 121962306a36Sopenharmony_ci * Used only for legacy (non 11n) frames. 122062306a36Sopenharmony_ci */ 122162306a36Sopenharmony_cistruct il_rx_phy_res { 122262306a36Sopenharmony_ci u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 122362306a36Sopenharmony_ci u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 122462306a36Sopenharmony_ci u8 stat_id; /* configurable DSP phy data set ID */ 122562306a36Sopenharmony_ci u8 reserved1; 122662306a36Sopenharmony_ci __le64 timestamp; /* TSF at on air rise */ 122762306a36Sopenharmony_ci __le32 beacon_time_stamp; /* beacon at on-air rise */ 122862306a36Sopenharmony_ci __le16 phy_flags; /* general phy flags: band, modulation, ... */ 122962306a36Sopenharmony_ci __le16 channel; /* channel number */ 123062306a36Sopenharmony_ci u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 123162306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 123262306a36Sopenharmony_ci __le16 byte_count; /* frame's byte-count */ 123362306a36Sopenharmony_ci __le16 frame_time; /* frame's time on the air */ 123462306a36Sopenharmony_ci} __packed; 123562306a36Sopenharmony_ci 123662306a36Sopenharmony_cistruct il_rx_mpdu_res_start { 123762306a36Sopenharmony_ci __le16 byte_count; 123862306a36Sopenharmony_ci __le16 reserved; 123962306a36Sopenharmony_ci} __packed; 124062306a36Sopenharmony_ci 124162306a36Sopenharmony_ci/****************************************************************************** 124262306a36Sopenharmony_ci * (5) 124362306a36Sopenharmony_ci * Tx Commands & Responses: 124462306a36Sopenharmony_ci * 124562306a36Sopenharmony_ci * Driver must place each C_TX command into one of the prioritized Tx 124662306a36Sopenharmony_ci * queues in host DRAM, shared between driver and device (see comments for 124762306a36Sopenharmony_ci * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode 124862306a36Sopenharmony_ci * are preparing to transmit, the device pulls the Tx command over the PCI 124962306a36Sopenharmony_ci * bus via one of the device's Tx DMA channels, to fill an internal FIFO 125062306a36Sopenharmony_ci * from which data will be transmitted. 125162306a36Sopenharmony_ci * 125262306a36Sopenharmony_ci * uCode handles all timing and protocol related to control frames 125362306a36Sopenharmony_ci * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler 125462306a36Sopenharmony_ci * handle reception of block-acks; uCode updates the host driver via 125562306a36Sopenharmony_ci * N_COMPRESSED_BA. 125662306a36Sopenharmony_ci * 125762306a36Sopenharmony_ci * uCode handles retrying Tx when an ACK is expected but not received. 125862306a36Sopenharmony_ci * This includes trying lower data rates than the one requested in the Tx 125962306a36Sopenharmony_ci * command, as set up by the C_RATE_SCALE (for 3945) or 126062306a36Sopenharmony_ci * C_TX_LINK_QUALITY_CMD (4965). 126162306a36Sopenharmony_ci * 126262306a36Sopenharmony_ci * Driver sets up transmit power for various rates via C_TX_PWR_TBL. 126362306a36Sopenharmony_ci * This command must be executed after every RXON command, before Tx can occur. 126462306a36Sopenharmony_ci *****************************************************************************/ 126562306a36Sopenharmony_ci 126662306a36Sopenharmony_ci/* C_TX Tx flags field */ 126762306a36Sopenharmony_ci 126862306a36Sopenharmony_ci/* 126962306a36Sopenharmony_ci * 1: Use Request-To-Send protocol before this frame. 127062306a36Sopenharmony_ci * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. 127162306a36Sopenharmony_ci */ 127262306a36Sopenharmony_ci#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) 127362306a36Sopenharmony_ci 127462306a36Sopenharmony_ci/* 127562306a36Sopenharmony_ci * 1: Transmit Clear-To-Send to self before this frame. 127662306a36Sopenharmony_ci * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. 127762306a36Sopenharmony_ci * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. 127862306a36Sopenharmony_ci */ 127962306a36Sopenharmony_ci#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) 128062306a36Sopenharmony_ci 128162306a36Sopenharmony_ci/* 1: Expect ACK from receiving station 128262306a36Sopenharmony_ci * 0: Don't expect ACK (MAC header's duration field s/b 0) 128362306a36Sopenharmony_ci * Set this for unicast frames, but not broadcast/multicast. */ 128462306a36Sopenharmony_ci#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) 128562306a36Sopenharmony_ci 128662306a36Sopenharmony_ci/* For 4965 devices: 128762306a36Sopenharmony_ci * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD). 128862306a36Sopenharmony_ci * Tx command's initial_rate_idx indicates first rate to try; 128962306a36Sopenharmony_ci * uCode walks through table for additional Tx attempts. 129062306a36Sopenharmony_ci * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 129162306a36Sopenharmony_ci * This rate will be used for all Tx attempts; it will not be scaled. */ 129262306a36Sopenharmony_ci#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) 129362306a36Sopenharmony_ci 129462306a36Sopenharmony_ci/* 1: Expect immediate block-ack. 129562306a36Sopenharmony_ci * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ 129662306a36Sopenharmony_ci#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) 129762306a36Sopenharmony_ci 129862306a36Sopenharmony_ci/* 129962306a36Sopenharmony_ci * 1: Frame requires full Tx-Op protection. 130062306a36Sopenharmony_ci * Set this if either RTS or CTS Tx Flag gets set. 130162306a36Sopenharmony_ci */ 130262306a36Sopenharmony_ci#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) 130362306a36Sopenharmony_ci 130462306a36Sopenharmony_ci/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices. 130562306a36Sopenharmony_ci * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ 130662306a36Sopenharmony_ci#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) 130762306a36Sopenharmony_ci#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 130862306a36Sopenharmony_ci#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 130962306a36Sopenharmony_ci 131062306a36Sopenharmony_ci/* 1: uCode overrides sequence control field in MAC header. 131162306a36Sopenharmony_ci * 0: Driver provides sequence control field in MAC header. 131262306a36Sopenharmony_ci * Set this for management frames, non-QOS data frames, non-unicast frames, 131362306a36Sopenharmony_ci * and also in Tx command embedded in C_SCAN for active scans. */ 131462306a36Sopenharmony_ci#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) 131562306a36Sopenharmony_ci 131662306a36Sopenharmony_ci/* 1: This frame is non-last MPDU; more fragments are coming. 131762306a36Sopenharmony_ci * 0: Last fragment, or not using fragmentation. */ 131862306a36Sopenharmony_ci#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) 131962306a36Sopenharmony_ci 132062306a36Sopenharmony_ci/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. 132162306a36Sopenharmony_ci * 0: No TSF required in outgoing frame. 132262306a36Sopenharmony_ci * Set this for transmitting beacons and probe responses. */ 132362306a36Sopenharmony_ci#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) 132462306a36Sopenharmony_ci 132562306a36Sopenharmony_ci/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword 132662306a36Sopenharmony_ci * alignment of frame's payload data field. 132762306a36Sopenharmony_ci * 0: No pad 132862306a36Sopenharmony_ci * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 132962306a36Sopenharmony_ci * field (but not both). Driver must align frame data (i.e. data following 133062306a36Sopenharmony_ci * MAC header) to DWORD boundary. */ 133162306a36Sopenharmony_ci#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) 133262306a36Sopenharmony_ci 133362306a36Sopenharmony_ci/* accelerate aggregation support 133462306a36Sopenharmony_ci * 0 - no CCMP encryption; 1 - CCMP encryption */ 133562306a36Sopenharmony_ci#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) 133662306a36Sopenharmony_ci 133762306a36Sopenharmony_ci/* HCCA-AP - disable duration overwriting. */ 133862306a36Sopenharmony_ci#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) 133962306a36Sopenharmony_ci 134062306a36Sopenharmony_ci/* 134162306a36Sopenharmony_ci * TX command security control 134262306a36Sopenharmony_ci */ 134362306a36Sopenharmony_ci#define TX_CMD_SEC_WEP 0x01 134462306a36Sopenharmony_ci#define TX_CMD_SEC_CCM 0x02 134562306a36Sopenharmony_ci#define TX_CMD_SEC_TKIP 0x03 134662306a36Sopenharmony_ci#define TX_CMD_SEC_MSK 0x03 134762306a36Sopenharmony_ci#define TX_CMD_SEC_SHIFT 6 134862306a36Sopenharmony_ci#define TX_CMD_SEC_KEY128 0x08 134962306a36Sopenharmony_ci 135062306a36Sopenharmony_ci/* 135162306a36Sopenharmony_ci * C_TX = 0x1c (command) 135262306a36Sopenharmony_ci */ 135362306a36Sopenharmony_ci 135462306a36Sopenharmony_cistruct il3945_tx_cmd { 135562306a36Sopenharmony_ci /* 135662306a36Sopenharmony_ci * MPDU byte count: 135762306a36Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 135862306a36Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 135962306a36Sopenharmony_ci * + Data payload 136062306a36Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 136162306a36Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 136262306a36Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 136362306a36Sopenharmony_ci * Range: 14-2342 bytes. 136462306a36Sopenharmony_ci */ 136562306a36Sopenharmony_ci __le16 len; 136662306a36Sopenharmony_ci 136762306a36Sopenharmony_ci /* 136862306a36Sopenharmony_ci * MPDU or MSDU byte count for next frame. 136962306a36Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 137062306a36Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 137162306a36Sopenharmony_ci */ 137262306a36Sopenharmony_ci __le16 next_frame_len; 137362306a36Sopenharmony_ci 137462306a36Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 137562306a36Sopenharmony_ci 137662306a36Sopenharmony_ci u8 rate; 137762306a36Sopenharmony_ci 137862306a36Sopenharmony_ci /* Index of recipient station in uCode's station table */ 137962306a36Sopenharmony_ci u8 sta_id; 138062306a36Sopenharmony_ci u8 tid_tspec; 138162306a36Sopenharmony_ci u8 sec_ctl; 138262306a36Sopenharmony_ci u8 key[16]; 138362306a36Sopenharmony_ci union { 138462306a36Sopenharmony_ci u8 byte[8]; 138562306a36Sopenharmony_ci __le16 word[4]; 138662306a36Sopenharmony_ci __le32 dw[2]; 138762306a36Sopenharmony_ci } tkip_mic; 138862306a36Sopenharmony_ci __le32 next_frame_info; 138962306a36Sopenharmony_ci union { 139062306a36Sopenharmony_ci __le32 life_time; 139162306a36Sopenharmony_ci __le32 attempt; 139262306a36Sopenharmony_ci } stop_time; 139362306a36Sopenharmony_ci u8 supp_rates[2]; 139462306a36Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 139562306a36Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 139662306a36Sopenharmony_ci union { 139762306a36Sopenharmony_ci __le16 pm_frame_timeout; 139862306a36Sopenharmony_ci __le16 attempt_duration; 139962306a36Sopenharmony_ci } timeout; 140062306a36Sopenharmony_ci 140162306a36Sopenharmony_ci /* 140262306a36Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 140362306a36Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 140462306a36Sopenharmony_ci */ 140562306a36Sopenharmony_ci __le16 driver_txop; 140662306a36Sopenharmony_ci 140762306a36Sopenharmony_ci /* 140862306a36Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 140962306a36Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 141062306a36Sopenharmony_ci */ 141162306a36Sopenharmony_ci union { 141262306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(u8, payload); 141362306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(struct ieee80211_hdr, hdr); 141462306a36Sopenharmony_ci }; 141562306a36Sopenharmony_ci} __packed; 141662306a36Sopenharmony_ci 141762306a36Sopenharmony_ci/* 141862306a36Sopenharmony_ci * C_TX = 0x1c (response) 141962306a36Sopenharmony_ci */ 142062306a36Sopenharmony_cistruct il3945_tx_resp { 142162306a36Sopenharmony_ci u8 failure_rts; 142262306a36Sopenharmony_ci u8 failure_frame; 142362306a36Sopenharmony_ci u8 bt_kill_count; 142462306a36Sopenharmony_ci u8 rate; 142562306a36Sopenharmony_ci __le32 wireless_media_time; 142662306a36Sopenharmony_ci __le32 status; /* TX status */ 142762306a36Sopenharmony_ci} __packed; 142862306a36Sopenharmony_ci 142962306a36Sopenharmony_ci/* 143062306a36Sopenharmony_ci * 4965 uCode updates these Tx attempt count values in host DRAM. 143162306a36Sopenharmony_ci * Used for managing Tx retries when expecting block-acks. 143262306a36Sopenharmony_ci * Driver should set these fields to 0. 143362306a36Sopenharmony_ci */ 143462306a36Sopenharmony_cistruct il_dram_scratch { 143562306a36Sopenharmony_ci u8 try_cnt; /* Tx attempts */ 143662306a36Sopenharmony_ci u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 143762306a36Sopenharmony_ci __le16 reserved; 143862306a36Sopenharmony_ci} __packed; 143962306a36Sopenharmony_ci 144062306a36Sopenharmony_cistruct il_tx_cmd { 144162306a36Sopenharmony_ci /* 144262306a36Sopenharmony_ci * MPDU byte count: 144362306a36Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 144462306a36Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 144562306a36Sopenharmony_ci * + Data payload 144662306a36Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 144762306a36Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 144862306a36Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 144962306a36Sopenharmony_ci * Range: 14-2342 bytes. 145062306a36Sopenharmony_ci */ 145162306a36Sopenharmony_ci __le16 len; 145262306a36Sopenharmony_ci 145362306a36Sopenharmony_ci /* 145462306a36Sopenharmony_ci * MPDU or MSDU byte count for next frame. 145562306a36Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 145662306a36Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 145762306a36Sopenharmony_ci */ 145862306a36Sopenharmony_ci __le16 next_frame_len; 145962306a36Sopenharmony_ci 146062306a36Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 146162306a36Sopenharmony_ci 146262306a36Sopenharmony_ci /* uCode may modify this field of the Tx command (in host DRAM!). 146362306a36Sopenharmony_ci * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 146462306a36Sopenharmony_ci struct il_dram_scratch scratch; 146562306a36Sopenharmony_ci 146662306a36Sopenharmony_ci /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 146762306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 146862306a36Sopenharmony_ci 146962306a36Sopenharmony_ci /* Index of destination station in uCode's station table */ 147062306a36Sopenharmony_ci u8 sta_id; 147162306a36Sopenharmony_ci 147262306a36Sopenharmony_ci /* Type of security encryption: CCM or TKIP */ 147362306a36Sopenharmony_ci u8 sec_ctl; /* TX_CMD_SEC_* */ 147462306a36Sopenharmony_ci 147562306a36Sopenharmony_ci /* 147662306a36Sopenharmony_ci * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial 147762306a36Sopenharmony_ci * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for 147862306a36Sopenharmony_ci * data frames, this field may be used to selectively reduce initial 147962306a36Sopenharmony_ci * rate (via non-0 value) for special frames (e.g. management), while 148062306a36Sopenharmony_ci * still supporting rate scaling for all frames. 148162306a36Sopenharmony_ci */ 148262306a36Sopenharmony_ci u8 initial_rate_idx; 148362306a36Sopenharmony_ci u8 reserved; 148462306a36Sopenharmony_ci u8 key[16]; 148562306a36Sopenharmony_ci __le16 next_frame_flags; 148662306a36Sopenharmony_ci __le16 reserved2; 148762306a36Sopenharmony_ci union { 148862306a36Sopenharmony_ci __le32 life_time; 148962306a36Sopenharmony_ci __le32 attempt; 149062306a36Sopenharmony_ci } stop_time; 149162306a36Sopenharmony_ci 149262306a36Sopenharmony_ci /* Host DRAM physical address pointer to "scratch" in this command. 149362306a36Sopenharmony_ci * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ 149462306a36Sopenharmony_ci __le32 dram_lsb_ptr; 149562306a36Sopenharmony_ci u8 dram_msb_ptr; 149662306a36Sopenharmony_ci 149762306a36Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 149862306a36Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 149962306a36Sopenharmony_ci u8 tid_tspec; 150062306a36Sopenharmony_ci union { 150162306a36Sopenharmony_ci __le16 pm_frame_timeout; 150262306a36Sopenharmony_ci __le16 attempt_duration; 150362306a36Sopenharmony_ci } timeout; 150462306a36Sopenharmony_ci 150562306a36Sopenharmony_ci /* 150662306a36Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 150762306a36Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 150862306a36Sopenharmony_ci */ 150962306a36Sopenharmony_ci __le16 driver_txop; 151062306a36Sopenharmony_ci 151162306a36Sopenharmony_ci /* 151262306a36Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 151362306a36Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 151462306a36Sopenharmony_ci */ 151562306a36Sopenharmony_ci u8 payload[0]; 151662306a36Sopenharmony_ci struct ieee80211_hdr hdr[]; 151762306a36Sopenharmony_ci} __packed; 151862306a36Sopenharmony_ci 151962306a36Sopenharmony_ci/* TX command response is sent after *3945* transmission attempts. 152062306a36Sopenharmony_ci * 152162306a36Sopenharmony_ci * NOTES: 152262306a36Sopenharmony_ci * 152362306a36Sopenharmony_ci * TX_STATUS_FAIL_NEXT_FRAG 152462306a36Sopenharmony_ci * 152562306a36Sopenharmony_ci * If the fragment flag in the MAC header for the frame being transmitted 152662306a36Sopenharmony_ci * is set and there is insufficient time to transmit the next frame, the 152762306a36Sopenharmony_ci * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. 152862306a36Sopenharmony_ci * 152962306a36Sopenharmony_ci * TX_STATUS_FIFO_UNDERRUN 153062306a36Sopenharmony_ci * 153162306a36Sopenharmony_ci * Indicates the host did not provide bytes to the FIFO fast enough while 153262306a36Sopenharmony_ci * a TX was in progress. 153362306a36Sopenharmony_ci * 153462306a36Sopenharmony_ci * TX_STATUS_FAIL_MGMNT_ABORT 153562306a36Sopenharmony_ci * 153662306a36Sopenharmony_ci * This status is only possible if the ABORT ON MGMT RX parameter was 153762306a36Sopenharmony_ci * set to true with the TX command. 153862306a36Sopenharmony_ci * 153962306a36Sopenharmony_ci * If the MSB of the status parameter is set then an abort sequence is 154062306a36Sopenharmony_ci * required. This sequence consists of the host activating the TX Abort 154162306a36Sopenharmony_ci * control line, and then waiting for the TX Abort command response. This 154262306a36Sopenharmony_ci * indicates that a the device is no longer in a transmit state, and that the 154362306a36Sopenharmony_ci * command FIFO has been cleared. The host must then deactivate the TX Abort 154462306a36Sopenharmony_ci * control line. Receiving is still allowed in this case. 154562306a36Sopenharmony_ci */ 154662306a36Sopenharmony_cienum { 154762306a36Sopenharmony_ci TX_3945_STATUS_SUCCESS = 0x01, 154862306a36Sopenharmony_ci TX_3945_STATUS_DIRECT_DONE = 0x02, 154962306a36Sopenharmony_ci TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82, 155062306a36Sopenharmony_ci TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83, 155162306a36Sopenharmony_ci TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 155262306a36Sopenharmony_ci TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85, 155362306a36Sopenharmony_ci TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86, 155462306a36Sopenharmony_ci TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87, 155562306a36Sopenharmony_ci TX_3945_STATUS_FAIL_DEST_PS = 0x88, 155662306a36Sopenharmony_ci TX_3945_STATUS_FAIL_ABORTED = 0x89, 155762306a36Sopenharmony_ci TX_3945_STATUS_FAIL_BT_RETRY = 0x8a, 155862306a36Sopenharmony_ci TX_3945_STATUS_FAIL_STA_INVALID = 0x8b, 155962306a36Sopenharmony_ci TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c, 156062306a36Sopenharmony_ci TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d, 156162306a36Sopenharmony_ci TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e, 156262306a36Sopenharmony_ci TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 156362306a36Sopenharmony_ci TX_3945_STATUS_FAIL_TX_LOCKED = 0x90, 156462306a36Sopenharmony_ci TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 156562306a36Sopenharmony_ci}; 156662306a36Sopenharmony_ci 156762306a36Sopenharmony_ci/* 156862306a36Sopenharmony_ci * TX command response is sent after *4965* transmission attempts. 156962306a36Sopenharmony_ci * 157062306a36Sopenharmony_ci * both postpone and abort status are expected behavior from uCode. there is 157162306a36Sopenharmony_ci * no special operation required from driver; except for RFKILL_FLUSH, 157262306a36Sopenharmony_ci * which required tx flush host command to flush all the tx frames in queues 157362306a36Sopenharmony_ci */ 157462306a36Sopenharmony_cienum { 157562306a36Sopenharmony_ci TX_STATUS_SUCCESS = 0x01, 157662306a36Sopenharmony_ci TX_STATUS_DIRECT_DONE = 0x02, 157762306a36Sopenharmony_ci /* postpone TX */ 157862306a36Sopenharmony_ci TX_STATUS_POSTPONE_DELAY = 0x40, 157962306a36Sopenharmony_ci TX_STATUS_POSTPONE_FEW_BYTES = 0x41, 158062306a36Sopenharmony_ci TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, 158162306a36Sopenharmony_ci TX_STATUS_POSTPONE_CALC_TTAK = 0x44, 158262306a36Sopenharmony_ci /* abort TX */ 158362306a36Sopenharmony_ci TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, 158462306a36Sopenharmony_ci TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 158562306a36Sopenharmony_ci TX_STATUS_FAIL_LONG_LIMIT = 0x83, 158662306a36Sopenharmony_ci TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 158762306a36Sopenharmony_ci TX_STATUS_FAIL_DRAIN_FLOW = 0x85, 158862306a36Sopenharmony_ci TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, 158962306a36Sopenharmony_ci TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 159062306a36Sopenharmony_ci TX_STATUS_FAIL_DEST_PS = 0x88, 159162306a36Sopenharmony_ci TX_STATUS_FAIL_HOST_ABORTED = 0x89, 159262306a36Sopenharmony_ci TX_STATUS_FAIL_BT_RETRY = 0x8a, 159362306a36Sopenharmony_ci TX_STATUS_FAIL_STA_INVALID = 0x8b, 159462306a36Sopenharmony_ci TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 159562306a36Sopenharmony_ci TX_STATUS_FAIL_TID_DISABLE = 0x8d, 159662306a36Sopenharmony_ci TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, 159762306a36Sopenharmony_ci TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 159862306a36Sopenharmony_ci TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, 159962306a36Sopenharmony_ci TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 160062306a36Sopenharmony_ci}; 160162306a36Sopenharmony_ci 160262306a36Sopenharmony_ci#define TX_PACKET_MODE_REGULAR 0x0000 160362306a36Sopenharmony_ci#define TX_PACKET_MODE_BURST_SEQ 0x0100 160462306a36Sopenharmony_ci#define TX_PACKET_MODE_BURST_FIRST 0x0200 160562306a36Sopenharmony_ci 160662306a36Sopenharmony_cienum { 160762306a36Sopenharmony_ci TX_POWER_PA_NOT_ACTIVE = 0x0, 160862306a36Sopenharmony_ci}; 160962306a36Sopenharmony_ci 161062306a36Sopenharmony_cienum { 161162306a36Sopenharmony_ci TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ 161262306a36Sopenharmony_ci TX_STATUS_DELAY_MSK = 0x00000040, 161362306a36Sopenharmony_ci TX_STATUS_ABORT_MSK = 0x00000080, 161462306a36Sopenharmony_ci TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ 161562306a36Sopenharmony_ci TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ 161662306a36Sopenharmony_ci TX_RESERVED = 0x00780000, /* bits 19:22 */ 161762306a36Sopenharmony_ci TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ 161862306a36Sopenharmony_ci TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 161962306a36Sopenharmony_ci}; 162062306a36Sopenharmony_ci 162162306a36Sopenharmony_ci/* ******************************* 162262306a36Sopenharmony_ci * TX aggregation status 162362306a36Sopenharmony_ci ******************************* */ 162462306a36Sopenharmony_ci 162562306a36Sopenharmony_cienum { 162662306a36Sopenharmony_ci AGG_TX_STATE_TRANSMITTED = 0x00, 162762306a36Sopenharmony_ci AGG_TX_STATE_UNDERRUN_MSK = 0x01, 162862306a36Sopenharmony_ci AGG_TX_STATE_FEW_BYTES_MSK = 0x04, 162962306a36Sopenharmony_ci AGG_TX_STATE_ABORT_MSK = 0x08, 163062306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, 163162306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, 163262306a36Sopenharmony_ci AGG_TX_STATE_SCD_QUERY_MSK = 0x80, 163362306a36Sopenharmony_ci AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, 163462306a36Sopenharmony_ci AGG_TX_STATE_RESPONSE_MSK = 0x1ff, 163562306a36Sopenharmony_ci AGG_TX_STATE_DUMP_TX_MSK = 0x200, 163662306a36Sopenharmony_ci AGG_TX_STATE_DELAY_TX_MSK = 0x400 163762306a36Sopenharmony_ci}; 163862306a36Sopenharmony_ci 163962306a36Sopenharmony_ci#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ 164062306a36Sopenharmony_ci#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ 164162306a36Sopenharmony_ci 164262306a36Sopenharmony_ci#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ 164362306a36Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK) 164462306a36Sopenharmony_ci 164562306a36Sopenharmony_ci/* # tx attempts for first frame in aggregation */ 164662306a36Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_POS 12 164762306a36Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 164862306a36Sopenharmony_ci 164962306a36Sopenharmony_ci/* Command ID and sequence number of Tx command for this frame */ 165062306a36Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_POS 16 165162306a36Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 165262306a36Sopenharmony_ci 165362306a36Sopenharmony_ci/* 165462306a36Sopenharmony_ci * C_TX = 0x1c (response) 165562306a36Sopenharmony_ci * 165662306a36Sopenharmony_ci * This response may be in one of two slightly different formats, indicated 165762306a36Sopenharmony_ci * by the frame_count field: 165862306a36Sopenharmony_ci * 165962306a36Sopenharmony_ci * 1) No aggregation (frame_count == 1). This reports Tx results for 166062306a36Sopenharmony_ci * a single frame. Multiple attempts, at various bit rates, may have 166162306a36Sopenharmony_ci * been made for this frame. 166262306a36Sopenharmony_ci * 166362306a36Sopenharmony_ci * 2) Aggregation (frame_count > 1). This reports Tx results for 166462306a36Sopenharmony_ci * 2 or more frames that used block-acknowledge. All frames were 166562306a36Sopenharmony_ci * transmitted at same rate. Rate scaling may have been used if first 166662306a36Sopenharmony_ci * frame in this new agg block failed in previous agg block(s). 166762306a36Sopenharmony_ci * 166862306a36Sopenharmony_ci * Note that, for aggregation, ACK (block-ack) status is not delivered here; 166962306a36Sopenharmony_ci * block-ack has not been received by the time the 4965 device records 167062306a36Sopenharmony_ci * this status. 167162306a36Sopenharmony_ci * This status relates to reasons the tx might have been blocked or aborted 167262306a36Sopenharmony_ci * within the sending station (this 4965 device), rather than whether it was 167362306a36Sopenharmony_ci * received successfully by the destination station. 167462306a36Sopenharmony_ci */ 167562306a36Sopenharmony_cistruct agg_tx_status { 167662306a36Sopenharmony_ci __le16 status; 167762306a36Sopenharmony_ci __le16 sequence; 167862306a36Sopenharmony_ci} __packed; 167962306a36Sopenharmony_ci 168062306a36Sopenharmony_cistruct il4965_tx_resp { 168162306a36Sopenharmony_ci u8 frame_count; /* 1 no aggregation, >1 aggregation */ 168262306a36Sopenharmony_ci u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 168362306a36Sopenharmony_ci u8 failure_rts; /* # failures due to unsuccessful RTS */ 168462306a36Sopenharmony_ci u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 168562306a36Sopenharmony_ci 168662306a36Sopenharmony_ci /* For non-agg: Rate at which frame was successful. 168762306a36Sopenharmony_ci * For agg: Rate at which all frames were transmitted. */ 168862306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 168962306a36Sopenharmony_ci 169062306a36Sopenharmony_ci /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 169162306a36Sopenharmony_ci * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 169262306a36Sopenharmony_ci __le16 wireless_media_time; /* uSecs */ 169362306a36Sopenharmony_ci 169462306a36Sopenharmony_ci __le16 reserved; 169562306a36Sopenharmony_ci __le32 pa_power1; /* RF power amplifier measurement (not used) */ 169662306a36Sopenharmony_ci __le32 pa_power2; 169762306a36Sopenharmony_ci 169862306a36Sopenharmony_ci /* 169962306a36Sopenharmony_ci * For non-agg: frame status TX_STATUS_* 170062306a36Sopenharmony_ci * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 170162306a36Sopenharmony_ci * fields follow this one, up to frame_count. 170262306a36Sopenharmony_ci * Bit fields: 170362306a36Sopenharmony_ci * 11- 0: AGG_TX_STATE_* status code 170462306a36Sopenharmony_ci * 15-12: Retry count for 1st frame in aggregation (retries 170562306a36Sopenharmony_ci * occur if tx failed for this frame when it was a 170662306a36Sopenharmony_ci * member of a previous aggregation block). If rate 170762306a36Sopenharmony_ci * scaling is used, retry count indicates the rate 170862306a36Sopenharmony_ci * table entry used for all frames in the new agg. 170962306a36Sopenharmony_ci * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 171062306a36Sopenharmony_ci */ 171162306a36Sopenharmony_ci union { 171262306a36Sopenharmony_ci __le32 status; 171362306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(struct agg_tx_status, agg_status); /* for each agg frame */ 171462306a36Sopenharmony_ci } u; 171562306a36Sopenharmony_ci} __packed; 171662306a36Sopenharmony_ci 171762306a36Sopenharmony_ci/* 171862306a36Sopenharmony_ci * N_COMPRESSED_BA = 0xc5 (response only, not a command) 171962306a36Sopenharmony_ci * 172062306a36Sopenharmony_ci * Reports Block-Acknowledge from recipient station 172162306a36Sopenharmony_ci */ 172262306a36Sopenharmony_cistruct il_compressed_ba_resp { 172362306a36Sopenharmony_ci __le32 sta_addr_lo32; 172462306a36Sopenharmony_ci __le16 sta_addr_hi16; 172562306a36Sopenharmony_ci __le16 reserved; 172662306a36Sopenharmony_ci 172762306a36Sopenharmony_ci /* Index of recipient (BA-sending) station in uCode's station table */ 172862306a36Sopenharmony_ci u8 sta_id; 172962306a36Sopenharmony_ci u8 tid; 173062306a36Sopenharmony_ci __le16 seq_ctl; 173162306a36Sopenharmony_ci __le64 bitmap; 173262306a36Sopenharmony_ci __le16 scd_flow; 173362306a36Sopenharmony_ci __le16 scd_ssn; 173462306a36Sopenharmony_ci} __packed; 173562306a36Sopenharmony_ci 173662306a36Sopenharmony_ci/* 173762306a36Sopenharmony_ci * C_TX_PWR_TBL = 0x97 (command, has simple generic response) 173862306a36Sopenharmony_ci * 173962306a36Sopenharmony_ci * See details under "TXPOWER" in 4965.h. 174062306a36Sopenharmony_ci */ 174162306a36Sopenharmony_ci 174262306a36Sopenharmony_cistruct il3945_txpowertable_cmd { 174362306a36Sopenharmony_ci u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 174462306a36Sopenharmony_ci u8 reserved; 174562306a36Sopenharmony_ci __le16 channel; 174662306a36Sopenharmony_ci struct il3945_power_per_rate power[IL_MAX_RATES]; 174762306a36Sopenharmony_ci} __packed; 174862306a36Sopenharmony_ci 174962306a36Sopenharmony_cistruct il4965_txpowertable_cmd { 175062306a36Sopenharmony_ci u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 175162306a36Sopenharmony_ci u8 reserved; 175262306a36Sopenharmony_ci __le16 channel; 175362306a36Sopenharmony_ci struct il4965_tx_power_db tx_power; 175462306a36Sopenharmony_ci} __packed; 175562306a36Sopenharmony_ci 175662306a36Sopenharmony_ci/** 175762306a36Sopenharmony_ci * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response 175862306a36Sopenharmony_ci * 175962306a36Sopenharmony_ci * C_RATE_SCALE = 0x47 (command, has simple generic response) 176062306a36Sopenharmony_ci * 176162306a36Sopenharmony_ci * NOTE: The table of rates passed to the uCode via the 176262306a36Sopenharmony_ci * RATE_SCALE command sets up the corresponding order of 176362306a36Sopenharmony_ci * rates used for all related commands, including rate 176462306a36Sopenharmony_ci * masks, etc. 176562306a36Sopenharmony_ci * 176662306a36Sopenharmony_ci * For example, if you set 9MB (PLCP 0x0f) as the first 176762306a36Sopenharmony_ci * rate in the rate table, the bit mask for that rate 176862306a36Sopenharmony_ci * when passed through ofdm_basic_rates on the C_RXON 176962306a36Sopenharmony_ci * command would be bit 0 (1 << 0) 177062306a36Sopenharmony_ci */ 177162306a36Sopenharmony_cistruct il3945_rate_scaling_info { 177262306a36Sopenharmony_ci __le16 rate_n_flags; 177362306a36Sopenharmony_ci u8 try_cnt; 177462306a36Sopenharmony_ci u8 next_rate_idx; 177562306a36Sopenharmony_ci} __packed; 177662306a36Sopenharmony_ci 177762306a36Sopenharmony_cistruct il3945_rate_scaling_cmd { 177862306a36Sopenharmony_ci u8 table_id; 177962306a36Sopenharmony_ci u8 reserved[3]; 178062306a36Sopenharmony_ci struct il3945_rate_scaling_info table[IL_MAX_RATES]; 178162306a36Sopenharmony_ci} __packed; 178262306a36Sopenharmony_ci 178362306a36Sopenharmony_ci/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 178462306a36Sopenharmony_ci#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 178562306a36Sopenharmony_ci 178662306a36Sopenharmony_ci/* # of EDCA prioritized tx fifos */ 178762306a36Sopenharmony_ci#define LINK_QUAL_AC_NUM AC_NUM 178862306a36Sopenharmony_ci 178962306a36Sopenharmony_ci/* # entries in rate scale table to support Tx retries */ 179062306a36Sopenharmony_ci#define LINK_QUAL_MAX_RETRY_NUM 16 179162306a36Sopenharmony_ci 179262306a36Sopenharmony_ci/* Tx antenna selection values */ 179362306a36Sopenharmony_ci#define LINK_QUAL_ANT_A_MSK (1 << 0) 179462306a36Sopenharmony_ci#define LINK_QUAL_ANT_B_MSK (1 << 1) 179562306a36Sopenharmony_ci#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 179662306a36Sopenharmony_ci 179762306a36Sopenharmony_ci/** 179862306a36Sopenharmony_ci * struct il_link_qual_general_params 179962306a36Sopenharmony_ci * 180062306a36Sopenharmony_ci * Used in C_TX_LINK_QUALITY_CMD 180162306a36Sopenharmony_ci */ 180262306a36Sopenharmony_cistruct il_link_qual_general_params { 180362306a36Sopenharmony_ci u8 flags; 180462306a36Sopenharmony_ci 180562306a36Sopenharmony_ci /* No entries at or above this (driver chosen) idx contain MIMO */ 180662306a36Sopenharmony_ci u8 mimo_delimiter; 180762306a36Sopenharmony_ci 180862306a36Sopenharmony_ci /* Best single antenna to use for single stream (legacy, SISO). */ 180962306a36Sopenharmony_ci u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ 181062306a36Sopenharmony_ci 181162306a36Sopenharmony_ci /* Best antennas to use for MIMO (unused for 4965, assumes both). */ 181262306a36Sopenharmony_ci u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ 181362306a36Sopenharmony_ci 181462306a36Sopenharmony_ci /* 181562306a36Sopenharmony_ci * If driver needs to use different initial rates for different 181662306a36Sopenharmony_ci * EDCA QOS access categories (as implemented by tx fifos 0-3), 181762306a36Sopenharmony_ci * this table will set that up, by indicating the idxes in the 181862306a36Sopenharmony_ci * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 181962306a36Sopenharmony_ci * Otherwise, driver should set all entries to 0. 182062306a36Sopenharmony_ci * 182162306a36Sopenharmony_ci * Entry usage: 182262306a36Sopenharmony_ci * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 182362306a36Sopenharmony_ci * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 182462306a36Sopenharmony_ci */ 182562306a36Sopenharmony_ci u8 start_rate_idx[LINK_QUAL_AC_NUM]; 182662306a36Sopenharmony_ci} __packed; 182762306a36Sopenharmony_ci 182862306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 182962306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) 183062306a36Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) 183162306a36Sopenharmony_ci 183262306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_DEF (3) 183362306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MAX (255) 183462306a36Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MIN (0) 183562306a36Sopenharmony_ci 183662306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31) 183762306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 183862306a36Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 183962306a36Sopenharmony_ci 184062306a36Sopenharmony_ci/** 184162306a36Sopenharmony_ci * struct il_link_qual_agg_params 184262306a36Sopenharmony_ci * 184362306a36Sopenharmony_ci * Used in C_TX_LINK_QUALITY_CMD 184462306a36Sopenharmony_ci */ 184562306a36Sopenharmony_cistruct il_link_qual_agg_params { 184662306a36Sopenharmony_ci 184762306a36Sopenharmony_ci /* 184862306a36Sopenharmony_ci *Maximum number of uSec in aggregation. 184962306a36Sopenharmony_ci * default set to 4000 (4 milliseconds) if not configured in .cfg 185062306a36Sopenharmony_ci */ 185162306a36Sopenharmony_ci __le16 agg_time_limit; 185262306a36Sopenharmony_ci 185362306a36Sopenharmony_ci /* 185462306a36Sopenharmony_ci * Number of Tx retries allowed for a frame, before that frame will 185562306a36Sopenharmony_ci * no longer be considered for the start of an aggregation sequence 185662306a36Sopenharmony_ci * (scheduler will then try to tx it as single frame). 185762306a36Sopenharmony_ci * Driver should set this to 3. 185862306a36Sopenharmony_ci */ 185962306a36Sopenharmony_ci u8 agg_dis_start_th; 186062306a36Sopenharmony_ci 186162306a36Sopenharmony_ci /* 186262306a36Sopenharmony_ci * Maximum number of frames in aggregation. 186362306a36Sopenharmony_ci * 0 = no limit (default). 1 = no aggregation. 186462306a36Sopenharmony_ci * Other values = max # frames in aggregation. 186562306a36Sopenharmony_ci */ 186662306a36Sopenharmony_ci u8 agg_frame_cnt_limit; 186762306a36Sopenharmony_ci 186862306a36Sopenharmony_ci __le32 reserved; 186962306a36Sopenharmony_ci} __packed; 187062306a36Sopenharmony_ci 187162306a36Sopenharmony_ci/* 187262306a36Sopenharmony_ci * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 187362306a36Sopenharmony_ci * 187462306a36Sopenharmony_ci * For 4965 devices only; 3945 uses C_RATE_SCALE. 187562306a36Sopenharmony_ci * 187662306a36Sopenharmony_ci * Each station in the 4965 device's internal station table has its own table 187762306a36Sopenharmony_ci * of 16 187862306a36Sopenharmony_ci * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when 187962306a36Sopenharmony_ci * an ACK is not received. This command replaces the entire table for 188062306a36Sopenharmony_ci * one station. 188162306a36Sopenharmony_ci * 188262306a36Sopenharmony_ci * NOTE: Station must already be in 4965 device's station table. 188362306a36Sopenharmony_ci * Use C_ADD_STA. 188462306a36Sopenharmony_ci * 188562306a36Sopenharmony_ci * The rate scaling procedures described below work well. Of course, other 188662306a36Sopenharmony_ci * procedures are possible, and may work better for particular environments. 188762306a36Sopenharmony_ci * 188862306a36Sopenharmony_ci * 188962306a36Sopenharmony_ci * FILLING THE RATE TBL 189062306a36Sopenharmony_ci * 189162306a36Sopenharmony_ci * Given a particular initial rate and mode, as determined by the rate 189262306a36Sopenharmony_ci * scaling algorithm described below, the Linux driver uses the following 189362306a36Sopenharmony_ci * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the 189462306a36Sopenharmony_ci * Link Quality command: 189562306a36Sopenharmony_ci * 189662306a36Sopenharmony_ci * 189762306a36Sopenharmony_ci * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: 189862306a36Sopenharmony_ci * a) Use this same initial rate for first 3 entries. 189962306a36Sopenharmony_ci * b) Find next lower available rate using same mode (SISO or MIMO), 190062306a36Sopenharmony_ci * use for next 3 entries. If no lower rate available, switch to 190162306a36Sopenharmony_ci * legacy mode (no HT40 channel, no MIMO, no short guard interval). 190262306a36Sopenharmony_ci * c) If using MIMO, set command's mimo_delimiter to number of entries 190362306a36Sopenharmony_ci * using MIMO (3 or 6). 190462306a36Sopenharmony_ci * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, 190562306a36Sopenharmony_ci * no MIMO, no short guard interval), at the next lower bit rate 190662306a36Sopenharmony_ci * (e.g. if second HT bit rate was 54, try 48 legacy), and follow 190762306a36Sopenharmony_ci * legacy procedure for remaining table entries. 190862306a36Sopenharmony_ci * 190962306a36Sopenharmony_ci * 2) If using legacy initial rate: 191062306a36Sopenharmony_ci * a) Use the initial rate for only one entry. 191162306a36Sopenharmony_ci * b) For each following entry, reduce the rate to next lower available 191262306a36Sopenharmony_ci * rate, until reaching the lowest available rate. 191362306a36Sopenharmony_ci * c) When reducing rate, also switch antenna selection. 191462306a36Sopenharmony_ci * d) Once lowest available rate is reached, repeat this rate until 191562306a36Sopenharmony_ci * rate table is filled (16 entries), switching antenna each entry. 191662306a36Sopenharmony_ci * 191762306a36Sopenharmony_ci * 191862306a36Sopenharmony_ci * ACCUMULATING HISTORY 191962306a36Sopenharmony_ci * 192062306a36Sopenharmony_ci * The rate scaling algorithm for 4965 devices, as implemented in Linux driver, 192162306a36Sopenharmony_ci * uses two sets of frame Tx success history: One for the current/active 192262306a36Sopenharmony_ci * modulation mode, and one for a speculative/search mode that is being 192362306a36Sopenharmony_ci * attempted. If the speculative mode turns out to be more effective (i.e. 192462306a36Sopenharmony_ci * actual transfer rate is better), then the driver continues to use the 192562306a36Sopenharmony_ci * speculative mode as the new current active mode. 192662306a36Sopenharmony_ci * 192762306a36Sopenharmony_ci * Each history set contains, separately for each possible rate, data for a 192862306a36Sopenharmony_ci * sliding win of the 62 most recent tx attempts at that rate. The data 192962306a36Sopenharmony_ci * includes a shifting bitmap of success(1)/failure(0), and sums of successful 193062306a36Sopenharmony_ci * and attempted frames, from which the driver can additionally calculate a 193162306a36Sopenharmony_ci * success ratio (success / attempted) and number of failures 193262306a36Sopenharmony_ci * (attempted - success), and control the size of the win (attempted). 193362306a36Sopenharmony_ci * The driver uses the bit map to remove successes from the success sum, as 193462306a36Sopenharmony_ci * the oldest tx attempts fall out of the win. 193562306a36Sopenharmony_ci * 193662306a36Sopenharmony_ci * When the 4965 device makes multiple tx attempts for a given frame, each 193762306a36Sopenharmony_ci * attempt might be at a different rate, and have different modulation 193862306a36Sopenharmony_ci * characteristics (e.g. antenna, fat channel, short guard interval), as set 193962306a36Sopenharmony_ci * up in the rate scaling table in the Link Quality command. The driver must 194062306a36Sopenharmony_ci * determine which rate table entry was used for each tx attempt, to determine 194162306a36Sopenharmony_ci * which rate-specific history to update, and record only those attempts that 194262306a36Sopenharmony_ci * match the modulation characteristics of the history set. 194362306a36Sopenharmony_ci * 194462306a36Sopenharmony_ci * When using block-ack (aggregation), all frames are transmitted at the same 194562306a36Sopenharmony_ci * rate, since there is no per-attempt acknowledgment from the destination 194662306a36Sopenharmony_ci * station. The Tx response struct il_tx_resp indicates the Tx rate in 194762306a36Sopenharmony_ci * rate_n_flags field. After receiving a block-ack, the driver can update 194862306a36Sopenharmony_ci * history for the entire block all at once. 194962306a36Sopenharmony_ci * 195062306a36Sopenharmony_ci * 195162306a36Sopenharmony_ci * FINDING BEST STARTING RATE: 195262306a36Sopenharmony_ci * 195362306a36Sopenharmony_ci * When working with a selected initial modulation mode (see below), the 195462306a36Sopenharmony_ci * driver attempts to find a best initial rate. The initial rate is the 195562306a36Sopenharmony_ci * first entry in the Link Quality command's rate table. 195662306a36Sopenharmony_ci * 195762306a36Sopenharmony_ci * 1) Calculate actual throughput (success ratio * expected throughput, see 195862306a36Sopenharmony_ci * table below) for current initial rate. Do this only if enough frames 195962306a36Sopenharmony_ci * have been attempted to make the value meaningful: at least 6 failed 196062306a36Sopenharmony_ci * tx attempts, or at least 8 successes. If not enough, don't try rate 196162306a36Sopenharmony_ci * scaling yet. 196262306a36Sopenharmony_ci * 196362306a36Sopenharmony_ci * 2) Find available rates adjacent to current initial rate. Available means: 196462306a36Sopenharmony_ci * a) supported by hardware && 196562306a36Sopenharmony_ci * b) supported by association && 196662306a36Sopenharmony_ci * c) within any constraints selected by user 196762306a36Sopenharmony_ci * 196862306a36Sopenharmony_ci * 3) Gather measured throughputs for adjacent rates. These might not have 196962306a36Sopenharmony_ci * enough history to calculate a throughput. That's okay, we might try 197062306a36Sopenharmony_ci * using one of them anyway! 197162306a36Sopenharmony_ci * 197262306a36Sopenharmony_ci * 4) Try decreasing rate if, for current rate: 197362306a36Sopenharmony_ci * a) success ratio is < 15% || 197462306a36Sopenharmony_ci * b) lower adjacent rate has better measured throughput || 197562306a36Sopenharmony_ci * c) higher adjacent rate has worse throughput, and lower is unmeasured 197662306a36Sopenharmony_ci * 197762306a36Sopenharmony_ci * As a sanity check, if decrease was determined above, leave rate 197862306a36Sopenharmony_ci * unchanged if: 197962306a36Sopenharmony_ci * a) lower rate unavailable 198062306a36Sopenharmony_ci * b) success ratio at current rate > 85% (very good) 198162306a36Sopenharmony_ci * c) current measured throughput is better than expected throughput 198262306a36Sopenharmony_ci * of lower rate (under perfect 100% tx conditions, see table below) 198362306a36Sopenharmony_ci * 198462306a36Sopenharmony_ci * 5) Try increasing rate if, for current rate: 198562306a36Sopenharmony_ci * a) success ratio is < 15% || 198662306a36Sopenharmony_ci * b) both adjacent rates' throughputs are unmeasured (try it!) || 198762306a36Sopenharmony_ci * b) higher adjacent rate has better measured throughput || 198862306a36Sopenharmony_ci * c) lower adjacent rate has worse throughput, and higher is unmeasured 198962306a36Sopenharmony_ci * 199062306a36Sopenharmony_ci * As a sanity check, if increase was determined above, leave rate 199162306a36Sopenharmony_ci * unchanged if: 199262306a36Sopenharmony_ci * a) success ratio at current rate < 70%. This is not particularly 199362306a36Sopenharmony_ci * good performance; higher rate is sure to have poorer success. 199462306a36Sopenharmony_ci * 199562306a36Sopenharmony_ci * 6) Re-evaluate the rate after each tx frame. If working with block- 199662306a36Sopenharmony_ci * acknowledge, history and stats may be calculated for the entire 199762306a36Sopenharmony_ci * block (including prior history that fits within the history wins), 199862306a36Sopenharmony_ci * before re-evaluation. 199962306a36Sopenharmony_ci * 200062306a36Sopenharmony_ci * FINDING BEST STARTING MODULATION MODE: 200162306a36Sopenharmony_ci * 200262306a36Sopenharmony_ci * After working with a modulation mode for a "while" (and doing rate scaling), 200362306a36Sopenharmony_ci * the driver searches for a new initial mode in an attempt to improve 200462306a36Sopenharmony_ci * throughput. The "while" is measured by numbers of attempted frames: 200562306a36Sopenharmony_ci * 200662306a36Sopenharmony_ci * For legacy mode, search for new mode after: 200762306a36Sopenharmony_ci * 480 successful frames, or 160 failed frames 200862306a36Sopenharmony_ci * For high-throughput modes (SISO or MIMO), search for new mode after: 200962306a36Sopenharmony_ci * 4500 successful frames, or 400 failed frames 201062306a36Sopenharmony_ci * 201162306a36Sopenharmony_ci * Mode switch possibilities are (3 for each mode): 201262306a36Sopenharmony_ci * 201362306a36Sopenharmony_ci * For legacy: 201462306a36Sopenharmony_ci * Change antenna, try SISO (if HT association), try MIMO (if HT association) 201562306a36Sopenharmony_ci * For SISO: 201662306a36Sopenharmony_ci * Change antenna, try MIMO, try shortened guard interval (SGI) 201762306a36Sopenharmony_ci * For MIMO: 201862306a36Sopenharmony_ci * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) 201962306a36Sopenharmony_ci * 202062306a36Sopenharmony_ci * When trying a new mode, use the same bit rate as the old/current mode when 202162306a36Sopenharmony_ci * trying antenna switches and shortened guard interval. When switching to 202262306a36Sopenharmony_ci * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate 202362306a36Sopenharmony_ci * for which the expected throughput (under perfect conditions) is about the 202462306a36Sopenharmony_ci * same or slightly better than the actual measured throughput delivered by 202562306a36Sopenharmony_ci * the old/current mode. 202662306a36Sopenharmony_ci * 202762306a36Sopenharmony_ci * Actual throughput can be estimated by multiplying the expected throughput 202862306a36Sopenharmony_ci * by the success ratio (successful / attempted tx frames). Frame size is 202962306a36Sopenharmony_ci * not considered in this calculation; it assumes that frame size will average 203062306a36Sopenharmony_ci * out to be fairly consistent over several samples. The following are 203162306a36Sopenharmony_ci * metric values for expected throughput assuming 100% success ratio. 203262306a36Sopenharmony_ci * Only G band has support for CCK rates: 203362306a36Sopenharmony_ci * 203462306a36Sopenharmony_ci * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 203562306a36Sopenharmony_ci * 203662306a36Sopenharmony_ci * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 203762306a36Sopenharmony_ci * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 203862306a36Sopenharmony_ci * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 203962306a36Sopenharmony_ci * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 204062306a36Sopenharmony_ci * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 204162306a36Sopenharmony_ci * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 204262306a36Sopenharmony_ci * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 204362306a36Sopenharmony_ci * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 204462306a36Sopenharmony_ci * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 204562306a36Sopenharmony_ci * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 204662306a36Sopenharmony_ci * 204762306a36Sopenharmony_ci * After the new mode has been tried for a short while (minimum of 6 failed 204862306a36Sopenharmony_ci * frames or 8 successful frames), compare success ratio and actual throughput 204962306a36Sopenharmony_ci * estimate of the new mode with the old. If either is better with the new 205062306a36Sopenharmony_ci * mode, continue to use the new mode. 205162306a36Sopenharmony_ci * 205262306a36Sopenharmony_ci * Continue comparing modes until all 3 possibilities have been tried. 205362306a36Sopenharmony_ci * If moving from legacy to HT, try all 3 possibilities from the new HT 205462306a36Sopenharmony_ci * mode. After trying all 3, a best mode is found. Continue to use this mode 205562306a36Sopenharmony_ci * for the longer "while" described above (e.g. 480 successful frames for 205662306a36Sopenharmony_ci * legacy), and then repeat the search process. 205762306a36Sopenharmony_ci * 205862306a36Sopenharmony_ci */ 205962306a36Sopenharmony_cistruct il_link_quality_cmd { 206062306a36Sopenharmony_ci 206162306a36Sopenharmony_ci /* Index of destination/recipient station in uCode's station table */ 206262306a36Sopenharmony_ci u8 sta_id; 206362306a36Sopenharmony_ci u8 reserved1; 206462306a36Sopenharmony_ci __le16 control; /* not used */ 206562306a36Sopenharmony_ci struct il_link_qual_general_params general_params; 206662306a36Sopenharmony_ci struct il_link_qual_agg_params agg_params; 206762306a36Sopenharmony_ci 206862306a36Sopenharmony_ci /* 206962306a36Sopenharmony_ci * Rate info; when using rate-scaling, Tx command's initial_rate_idx 207062306a36Sopenharmony_ci * specifies 1st Tx rate attempted, via idx into this table. 207162306a36Sopenharmony_ci * 4965 devices works its way through table when retrying Tx. 207262306a36Sopenharmony_ci */ 207362306a36Sopenharmony_ci struct { 207462306a36Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */ 207562306a36Sopenharmony_ci } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 207662306a36Sopenharmony_ci __le32 reserved2; 207762306a36Sopenharmony_ci} __packed; 207862306a36Sopenharmony_ci 207962306a36Sopenharmony_ci/* 208062306a36Sopenharmony_ci * BT configuration enable flags: 208162306a36Sopenharmony_ci * bit 0 - 1: BT channel announcement enabled 208262306a36Sopenharmony_ci * 0: disable 208362306a36Sopenharmony_ci * bit 1 - 1: priority of BT device enabled 208462306a36Sopenharmony_ci * 0: disable 208562306a36Sopenharmony_ci */ 208662306a36Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 208762306a36Sopenharmony_ci#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) 208862306a36Sopenharmony_ci#define BT_ENABLE_PRIORITY BIT(1) 208962306a36Sopenharmony_ci 209062306a36Sopenharmony_ci#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) 209162306a36Sopenharmony_ci 209262306a36Sopenharmony_ci#define BT_LEAD_TIME_DEF (0x1E) 209362306a36Sopenharmony_ci 209462306a36Sopenharmony_ci#define BT_MAX_KILL_DEF (0x5) 209562306a36Sopenharmony_ci 209662306a36Sopenharmony_ci/* 209762306a36Sopenharmony_ci * C_BT_CONFIG = 0x9b (command, has simple generic response) 209862306a36Sopenharmony_ci * 209962306a36Sopenharmony_ci * 3945 and 4965 devices support hardware handshake with Bluetooth device on 210062306a36Sopenharmony_ci * same platform. Bluetooth device alerts wireless device when it will Tx; 210162306a36Sopenharmony_ci * wireless device can delay or kill its own Tx to accommodate. 210262306a36Sopenharmony_ci */ 210362306a36Sopenharmony_cistruct il_bt_cmd { 210462306a36Sopenharmony_ci u8 flags; 210562306a36Sopenharmony_ci u8 lead_time; 210662306a36Sopenharmony_ci u8 max_kill; 210762306a36Sopenharmony_ci u8 reserved; 210862306a36Sopenharmony_ci __le32 kill_ack_mask; 210962306a36Sopenharmony_ci __le32 kill_cts_mask; 211062306a36Sopenharmony_ci} __packed; 211162306a36Sopenharmony_ci 211262306a36Sopenharmony_ci/****************************************************************************** 211362306a36Sopenharmony_ci * (6) 211462306a36Sopenharmony_ci * Spectrum Management (802.11h) Commands, Responses, Notifications: 211562306a36Sopenharmony_ci * 211662306a36Sopenharmony_ci *****************************************************************************/ 211762306a36Sopenharmony_ci 211862306a36Sopenharmony_ci/* 211962306a36Sopenharmony_ci * Spectrum Management 212062306a36Sopenharmony_ci */ 212162306a36Sopenharmony_ci#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ 212262306a36Sopenharmony_ci RXON_FILTER_CTL2HOST_MSK | \ 212362306a36Sopenharmony_ci RXON_FILTER_ACCEPT_GRP_MSK | \ 212462306a36Sopenharmony_ci RXON_FILTER_DIS_DECRYPT_MSK | \ 212562306a36Sopenharmony_ci RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ 212662306a36Sopenharmony_ci RXON_FILTER_ASSOC_MSK | \ 212762306a36Sopenharmony_ci RXON_FILTER_BCON_AWARE_MSK) 212862306a36Sopenharmony_ci 212962306a36Sopenharmony_cistruct il_measure_channel { 213062306a36Sopenharmony_ci __le32 duration; /* measurement duration in extended beacon 213162306a36Sopenharmony_ci * format */ 213262306a36Sopenharmony_ci u8 channel; /* channel to measure */ 213362306a36Sopenharmony_ci u8 type; /* see enum il_measure_type */ 213462306a36Sopenharmony_ci __le16 reserved; 213562306a36Sopenharmony_ci} __packed; 213662306a36Sopenharmony_ci 213762306a36Sopenharmony_ci/* 213862306a36Sopenharmony_ci * C_SPECTRUM_MEASUREMENT = 0x74 (command) 213962306a36Sopenharmony_ci */ 214062306a36Sopenharmony_cistruct il_spectrum_cmd { 214162306a36Sopenharmony_ci __le16 len; /* number of bytes starting from token */ 214262306a36Sopenharmony_ci u8 token; /* token id */ 214362306a36Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 214462306a36Sopenharmony_ci u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ 214562306a36Sopenharmony_ci u8 periodic; /* 1 = periodic */ 214662306a36Sopenharmony_ci __le16 path_loss_timeout; 214762306a36Sopenharmony_ci __le32 start_time; /* start time in extended beacon format */ 214862306a36Sopenharmony_ci __le32 reserved2; 214962306a36Sopenharmony_ci __le32 flags; /* rxon flags */ 215062306a36Sopenharmony_ci __le32 filter_flags; /* rxon filter flags */ 215162306a36Sopenharmony_ci __le16 channel_count; /* minimum 1, maximum 10 */ 215262306a36Sopenharmony_ci __le16 reserved3; 215362306a36Sopenharmony_ci struct il_measure_channel channels[10]; 215462306a36Sopenharmony_ci} __packed; 215562306a36Sopenharmony_ci 215662306a36Sopenharmony_ci/* 215762306a36Sopenharmony_ci * C_SPECTRUM_MEASUREMENT = 0x74 (response) 215862306a36Sopenharmony_ci */ 215962306a36Sopenharmony_cistruct il_spectrum_resp { 216062306a36Sopenharmony_ci u8 token; 216162306a36Sopenharmony_ci u8 id; /* id of the prior command replaced, or 0xff */ 216262306a36Sopenharmony_ci __le16 status; /* 0 - command will be handled 216362306a36Sopenharmony_ci * 1 - cannot handle (conflicts with another 216462306a36Sopenharmony_ci * measurement) */ 216562306a36Sopenharmony_ci} __packed; 216662306a36Sopenharmony_ci 216762306a36Sopenharmony_cienum il_measurement_state { 216862306a36Sopenharmony_ci IL_MEASUREMENT_START = 0, 216962306a36Sopenharmony_ci IL_MEASUREMENT_STOP = 1, 217062306a36Sopenharmony_ci}; 217162306a36Sopenharmony_ci 217262306a36Sopenharmony_cienum il_measurement_status { 217362306a36Sopenharmony_ci IL_MEASUREMENT_OK = 0, 217462306a36Sopenharmony_ci IL_MEASUREMENT_CONCURRENT = 1, 217562306a36Sopenharmony_ci IL_MEASUREMENT_CSA_CONFLICT = 2, 217662306a36Sopenharmony_ci IL_MEASUREMENT_TGH_CONFLICT = 3, 217762306a36Sopenharmony_ci /* 4-5 reserved */ 217862306a36Sopenharmony_ci IL_MEASUREMENT_STOPPED = 6, 217962306a36Sopenharmony_ci IL_MEASUREMENT_TIMEOUT = 7, 218062306a36Sopenharmony_ci IL_MEASUREMENT_PERIODIC_FAILED = 8, 218162306a36Sopenharmony_ci}; 218262306a36Sopenharmony_ci 218362306a36Sopenharmony_ci#define NUM_ELEMENTS_IN_HISTOGRAM 8 218462306a36Sopenharmony_ci 218562306a36Sopenharmony_cistruct il_measurement_histogram { 218662306a36Sopenharmony_ci __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 218762306a36Sopenharmony_ci __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 218862306a36Sopenharmony_ci} __packed; 218962306a36Sopenharmony_ci 219062306a36Sopenharmony_ci/* clear channel availability counters */ 219162306a36Sopenharmony_cistruct il_measurement_cca_counters { 219262306a36Sopenharmony_ci __le32 ofdm; 219362306a36Sopenharmony_ci __le32 cck; 219462306a36Sopenharmony_ci} __packed; 219562306a36Sopenharmony_ci 219662306a36Sopenharmony_cienum il_measure_type { 219762306a36Sopenharmony_ci IL_MEASURE_BASIC = (1 << 0), 219862306a36Sopenharmony_ci IL_MEASURE_CHANNEL_LOAD = (1 << 1), 219962306a36Sopenharmony_ci IL_MEASURE_HISTOGRAM_RPI = (1 << 2), 220062306a36Sopenharmony_ci IL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 220162306a36Sopenharmony_ci IL_MEASURE_FRAME = (1 << 4), 220262306a36Sopenharmony_ci /* bits 5:6 are reserved */ 220362306a36Sopenharmony_ci IL_MEASURE_IDLE = (1 << 7), 220462306a36Sopenharmony_ci}; 220562306a36Sopenharmony_ci 220662306a36Sopenharmony_ci/* 220762306a36Sopenharmony_ci * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command) 220862306a36Sopenharmony_ci */ 220962306a36Sopenharmony_cistruct il_spectrum_notification { 221062306a36Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 221162306a36Sopenharmony_ci u8 token; 221262306a36Sopenharmony_ci u8 channel_idx; /* idx in measurement channel list */ 221362306a36Sopenharmony_ci u8 state; /* 0 - start, 1 - stop */ 221462306a36Sopenharmony_ci __le32 start_time; /* lower 32-bits of TSF */ 221562306a36Sopenharmony_ci u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 221662306a36Sopenharmony_ci u8 channel; 221762306a36Sopenharmony_ci u8 type; /* see enum il_measurement_type */ 221862306a36Sopenharmony_ci u8 reserved1; 221962306a36Sopenharmony_ci /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 222062306a36Sopenharmony_ci * valid if applicable for measurement type requested. */ 222162306a36Sopenharmony_ci __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ 222262306a36Sopenharmony_ci __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ 222362306a36Sopenharmony_ci __le32 cca_time; /* channel load time in usecs */ 222462306a36Sopenharmony_ci u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 222562306a36Sopenharmony_ci * unidentified */ 222662306a36Sopenharmony_ci u8 reserved2[3]; 222762306a36Sopenharmony_ci struct il_measurement_histogram histogram; 222862306a36Sopenharmony_ci __le32 stop_time; /* lower 32-bits of TSF */ 222962306a36Sopenharmony_ci __le32 status; /* see il_measurement_status */ 223062306a36Sopenharmony_ci} __packed; 223162306a36Sopenharmony_ci 223262306a36Sopenharmony_ci/****************************************************************************** 223362306a36Sopenharmony_ci * (7) 223462306a36Sopenharmony_ci * Power Management Commands, Responses, Notifications: 223562306a36Sopenharmony_ci * 223662306a36Sopenharmony_ci *****************************************************************************/ 223762306a36Sopenharmony_ci 223862306a36Sopenharmony_ci/** 223962306a36Sopenharmony_ci * struct il_powertable_cmd - Power Table Command 224062306a36Sopenharmony_ci * @flags: See below: 224162306a36Sopenharmony_ci * 224262306a36Sopenharmony_ci * C_POWER_TBL = 0x77 (command, has simple generic response) 224362306a36Sopenharmony_ci * 224462306a36Sopenharmony_ci * PM allow: 224562306a36Sopenharmony_ci * bit 0 - '0' Driver not allow power management 224662306a36Sopenharmony_ci * '1' Driver allow PM (use rest of parameters) 224762306a36Sopenharmony_ci * 224862306a36Sopenharmony_ci * uCode send sleep notifications: 224962306a36Sopenharmony_ci * bit 1 - '0' Don't send sleep notification 225062306a36Sopenharmony_ci * '1' send sleep notification (SEND_PM_NOTIFICATION) 225162306a36Sopenharmony_ci * 225262306a36Sopenharmony_ci * Sleep over DTIM 225362306a36Sopenharmony_ci * bit 2 - '0' PM have to walk up every DTIM 225462306a36Sopenharmony_ci * '1' PM could sleep over DTIM till listen Interval. 225562306a36Sopenharmony_ci * 225662306a36Sopenharmony_ci * PCI power managed 225762306a36Sopenharmony_ci * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) 225862306a36Sopenharmony_ci * '1' !(PCI_CFG_LINK_CTRL & 0x1) 225962306a36Sopenharmony_ci * 226062306a36Sopenharmony_ci * Fast PD 226162306a36Sopenharmony_ci * bit 4 - '1' Put radio to sleep when receiving frame for others 226262306a36Sopenharmony_ci * 226362306a36Sopenharmony_ci * Force sleep Modes 226462306a36Sopenharmony_ci * bit 31/30- '00' use both mac/xtal sleeps 226562306a36Sopenharmony_ci * '01' force Mac sleep 226662306a36Sopenharmony_ci * '10' force xtal sleep 226762306a36Sopenharmony_ci * '11' Illegal set 226862306a36Sopenharmony_ci * 226962306a36Sopenharmony_ci * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then 227062306a36Sopenharmony_ci * ucode assume sleep over DTIM is allowed and we don't need to wake up 227162306a36Sopenharmony_ci * for every DTIM. 227262306a36Sopenharmony_ci */ 227362306a36Sopenharmony_ci#define IL_POWER_VEC_SIZE 5 227462306a36Sopenharmony_ci 227562306a36Sopenharmony_ci#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 227662306a36Sopenharmony_ci#define IL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) 227762306a36Sopenharmony_ci#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 227862306a36Sopenharmony_ci 227962306a36Sopenharmony_cistruct il3945_powertable_cmd { 228062306a36Sopenharmony_ci __le16 flags; 228162306a36Sopenharmony_ci u8 reserved[2]; 228262306a36Sopenharmony_ci __le32 rx_data_timeout; 228362306a36Sopenharmony_ci __le32 tx_data_timeout; 228462306a36Sopenharmony_ci __le32 sleep_interval[IL_POWER_VEC_SIZE]; 228562306a36Sopenharmony_ci} __packed; 228662306a36Sopenharmony_ci 228762306a36Sopenharmony_cistruct il_powertable_cmd { 228862306a36Sopenharmony_ci __le16 flags; 228962306a36Sopenharmony_ci u8 keep_alive_seconds; /* 3945 reserved */ 229062306a36Sopenharmony_ci u8 debug_flags; /* 3945 reserved */ 229162306a36Sopenharmony_ci __le32 rx_data_timeout; 229262306a36Sopenharmony_ci __le32 tx_data_timeout; 229362306a36Sopenharmony_ci __le32 sleep_interval[IL_POWER_VEC_SIZE]; 229462306a36Sopenharmony_ci __le32 keep_alive_beacons; 229562306a36Sopenharmony_ci} __packed; 229662306a36Sopenharmony_ci 229762306a36Sopenharmony_ci/* 229862306a36Sopenharmony_ci * N_PM_SLEEP = 0x7A (notification only, not a command) 229962306a36Sopenharmony_ci * all devices identical. 230062306a36Sopenharmony_ci */ 230162306a36Sopenharmony_cistruct il_sleep_notification { 230262306a36Sopenharmony_ci u8 pm_sleep_mode; 230362306a36Sopenharmony_ci u8 pm_wakeup_src; 230462306a36Sopenharmony_ci __le16 reserved; 230562306a36Sopenharmony_ci __le32 sleep_time; 230662306a36Sopenharmony_ci __le32 tsf_low; 230762306a36Sopenharmony_ci __le32 bcon_timer; 230862306a36Sopenharmony_ci} __packed; 230962306a36Sopenharmony_ci 231062306a36Sopenharmony_ci/* Sleep states. all devices identical. */ 231162306a36Sopenharmony_cienum { 231262306a36Sopenharmony_ci IL_PM_NO_SLEEP = 0, 231362306a36Sopenharmony_ci IL_PM_SLP_MAC = 1, 231462306a36Sopenharmony_ci IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 231562306a36Sopenharmony_ci IL_PM_SLP_FULL_MAC_CARD_STATE = 3, 231662306a36Sopenharmony_ci IL_PM_SLP_PHY = 4, 231762306a36Sopenharmony_ci IL_PM_SLP_REPENT = 5, 231862306a36Sopenharmony_ci IL_PM_WAKEUP_BY_TIMER = 6, 231962306a36Sopenharmony_ci IL_PM_WAKEUP_BY_DRIVER = 7, 232062306a36Sopenharmony_ci IL_PM_WAKEUP_BY_RFKILL = 8, 232162306a36Sopenharmony_ci /* 3 reserved */ 232262306a36Sopenharmony_ci IL_PM_NUM_OF_MODES = 12, 232362306a36Sopenharmony_ci}; 232462306a36Sopenharmony_ci 232562306a36Sopenharmony_ci/* 232662306a36Sopenharmony_ci * N_CARD_STATE = 0xa1 (notification only, not a command) 232762306a36Sopenharmony_ci */ 232862306a36Sopenharmony_cistruct il_card_state_notif { 232962306a36Sopenharmony_ci __le32 flags; 233062306a36Sopenharmony_ci} __packed; 233162306a36Sopenharmony_ci 233262306a36Sopenharmony_ci#define HW_CARD_DISABLED 0x01 233362306a36Sopenharmony_ci#define SW_CARD_DISABLED 0x02 233462306a36Sopenharmony_ci#define CT_CARD_DISABLED 0x04 233562306a36Sopenharmony_ci#define RXON_CARD_DISABLED 0x10 233662306a36Sopenharmony_ci 233762306a36Sopenharmony_cistruct il_ct_kill_config { 233862306a36Sopenharmony_ci __le32 reserved; 233962306a36Sopenharmony_ci __le32 critical_temperature_M; 234062306a36Sopenharmony_ci __le32 critical_temperature_R; 234162306a36Sopenharmony_ci} __packed; 234262306a36Sopenharmony_ci 234362306a36Sopenharmony_ci/****************************************************************************** 234462306a36Sopenharmony_ci * (8) 234562306a36Sopenharmony_ci * Scan Commands, Responses, Notifications: 234662306a36Sopenharmony_ci * 234762306a36Sopenharmony_ci *****************************************************************************/ 234862306a36Sopenharmony_ci 234962306a36Sopenharmony_ci#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) 235062306a36Sopenharmony_ci#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 235162306a36Sopenharmony_ci 235262306a36Sopenharmony_ci/** 235362306a36Sopenharmony_ci * struct il_scan_channel - entry in C_SCAN channel table 235462306a36Sopenharmony_ci * 235562306a36Sopenharmony_ci * One for each channel in the scan list. 235662306a36Sopenharmony_ci * Each channel can independently select: 235762306a36Sopenharmony_ci * 1) SSID for directed active scans 235862306a36Sopenharmony_ci * 2) Txpower setting (for rate specified within Tx command) 235962306a36Sopenharmony_ci * 3) How long to stay on-channel (behavior may be modified by quiet_time, 236062306a36Sopenharmony_ci * quiet_plcp_th, good_CRC_th) 236162306a36Sopenharmony_ci * 236262306a36Sopenharmony_ci * To avoid uCode errors, make sure the following are true (see comments 236362306a36Sopenharmony_ci * under struct il_scan_cmd about max_out_time and quiet_time): 236462306a36Sopenharmony_ci * 1) If using passive_dwell (i.e. passive_dwell != 0): 236562306a36Sopenharmony_ci * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 236662306a36Sopenharmony_ci * 2) quiet_time <= active_dwell 236762306a36Sopenharmony_ci * 3) If restricting off-channel time (i.e. max_out_time !=0): 236862306a36Sopenharmony_ci * passive_dwell < max_out_time 236962306a36Sopenharmony_ci * active_dwell < max_out_time 237062306a36Sopenharmony_ci */ 237162306a36Sopenharmony_cistruct il3945_scan_channel { 237262306a36Sopenharmony_ci /* 237362306a36Sopenharmony_ci * type is defined as: 237462306a36Sopenharmony_ci * 0:0 1 = active, 0 = passive 237562306a36Sopenharmony_ci * 1:4 SSID direct bit map; if a bit is set, then corresponding 237662306a36Sopenharmony_ci * SSID IE is transmitted in probe request. 237762306a36Sopenharmony_ci * 5:7 reserved 237862306a36Sopenharmony_ci */ 237962306a36Sopenharmony_ci u8 type; 238062306a36Sopenharmony_ci u8 channel; /* band is selected by il3945_scan_cmd "flags" field */ 238162306a36Sopenharmony_ci struct il3945_tx_power tpc; 238262306a36Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 238362306a36Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 238462306a36Sopenharmony_ci} __packed; 238562306a36Sopenharmony_ci 238662306a36Sopenharmony_ci/* set number of direct probes u8 type */ 238762306a36Sopenharmony_ci#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) 238862306a36Sopenharmony_ci 238962306a36Sopenharmony_cistruct il_scan_channel { 239062306a36Sopenharmony_ci /* 239162306a36Sopenharmony_ci * type is defined as: 239262306a36Sopenharmony_ci * 0:0 1 = active, 0 = passive 239362306a36Sopenharmony_ci * 1:20 SSID direct bit map; if a bit is set, then corresponding 239462306a36Sopenharmony_ci * SSID IE is transmitted in probe request. 239562306a36Sopenharmony_ci * 21:31 reserved 239662306a36Sopenharmony_ci */ 239762306a36Sopenharmony_ci __le32 type; 239862306a36Sopenharmony_ci __le16 channel; /* band is selected by il_scan_cmd "flags" field */ 239962306a36Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 240062306a36Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 240162306a36Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 240262306a36Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 240362306a36Sopenharmony_ci} __packed; 240462306a36Sopenharmony_ci 240562306a36Sopenharmony_ci/* set number of direct probes __le32 type */ 240662306a36Sopenharmony_ci#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 240762306a36Sopenharmony_ci 240862306a36Sopenharmony_ci/** 240962306a36Sopenharmony_ci * struct il_ssid_ie - directed scan network information element 241062306a36Sopenharmony_ci * 241162306a36Sopenharmony_ci * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in 241262306a36Sopenharmony_ci * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel; 241362306a36Sopenharmony_ci * each channel may select different ssids from among the 20 (4) entries. 241462306a36Sopenharmony_ci * SSID IEs get transmitted in reverse order of entry. 241562306a36Sopenharmony_ci */ 241662306a36Sopenharmony_cistruct il_ssid_ie { 241762306a36Sopenharmony_ci u8 id; 241862306a36Sopenharmony_ci u8 len; 241962306a36Sopenharmony_ci u8 ssid[32]; 242062306a36Sopenharmony_ci} __packed; 242162306a36Sopenharmony_ci 242262306a36Sopenharmony_ci#define PROBE_OPTION_MAX_3945 4 242362306a36Sopenharmony_ci#define PROBE_OPTION_MAX 20 242462306a36Sopenharmony_ci#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 242562306a36Sopenharmony_ci#define IL_GOOD_CRC_TH_DISABLED 0 242662306a36Sopenharmony_ci#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 242762306a36Sopenharmony_ci#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) 242862306a36Sopenharmony_ci#define IL_MAX_SCAN_SIZE 1024 242962306a36Sopenharmony_ci#define IL_MAX_CMD_SIZE 4096 243062306a36Sopenharmony_ci 243162306a36Sopenharmony_ci/* 243262306a36Sopenharmony_ci * C_SCAN = 0x80 (command) 243362306a36Sopenharmony_ci * 243462306a36Sopenharmony_ci * The hardware scan command is very powerful; the driver can set it up to 243562306a36Sopenharmony_ci * maintain (relatively) normal network traffic while doing a scan in the 243662306a36Sopenharmony_ci * background. The max_out_time and suspend_time control the ratio of how 243762306a36Sopenharmony_ci * long the device stays on an associated network channel ("service channel") 243862306a36Sopenharmony_ci * vs. how long it's away from the service channel, i.e. tuned to other channels 243962306a36Sopenharmony_ci * for scanning. 244062306a36Sopenharmony_ci * 244162306a36Sopenharmony_ci * max_out_time is the max time off-channel (in usec), and suspend_time 244262306a36Sopenharmony_ci * is how long (in "extended beacon" format) that the scan is "suspended" 244362306a36Sopenharmony_ci * after returning to the service channel. That is, suspend_time is the 244462306a36Sopenharmony_ci * time that we stay on the service channel, doing normal work, between 244562306a36Sopenharmony_ci * scan segments. The driver may set these parameters differently to support 244662306a36Sopenharmony_ci * scanning when associated vs. not associated, and light vs. heavy traffic 244762306a36Sopenharmony_ci * loads when associated. 244862306a36Sopenharmony_ci * 244962306a36Sopenharmony_ci * After receiving this command, the device's scan engine does the following; 245062306a36Sopenharmony_ci * 245162306a36Sopenharmony_ci * 1) Sends SCAN_START notification to driver 245262306a36Sopenharmony_ci * 2) Checks to see if it has time to do scan for one channel 245362306a36Sopenharmony_ci * 3) Sends NULL packet, with power-save (PS) bit set to 1, 245462306a36Sopenharmony_ci * to tell AP that we're going off-channel 245562306a36Sopenharmony_ci * 4) Tunes to first channel in scan list, does active or passive scan 245662306a36Sopenharmony_ci * 5) Sends SCAN_RESULT notification to driver 245762306a36Sopenharmony_ci * 6) Checks to see if it has time to do scan on *next* channel in list 245862306a36Sopenharmony_ci * 7) Repeats 4-6 until it no longer has time to scan the next channel 245962306a36Sopenharmony_ci * before max_out_time expires 246062306a36Sopenharmony_ci * 8) Returns to service channel 246162306a36Sopenharmony_ci * 9) Sends NULL packet with PS=0 to tell AP that we're back 246262306a36Sopenharmony_ci * 10) Stays on service channel until suspend_time expires 246362306a36Sopenharmony_ci * 11) Repeats entire process 2-10 until list is complete 246462306a36Sopenharmony_ci * 12) Sends SCAN_COMPLETE notification 246562306a36Sopenharmony_ci * 246662306a36Sopenharmony_ci * For fast, efficient scans, the scan command also has support for staying on 246762306a36Sopenharmony_ci * a channel for just a short time, if doing active scanning and getting no 246862306a36Sopenharmony_ci * responses to the transmitted probe request. This time is controlled by 246962306a36Sopenharmony_ci * quiet_time, and the number of received packets below which a channel is 247062306a36Sopenharmony_ci * considered "quiet" is controlled by quiet_plcp_threshold. 247162306a36Sopenharmony_ci * 247262306a36Sopenharmony_ci * For active scanning on channels that have regulatory restrictions against 247362306a36Sopenharmony_ci * blindly transmitting, the scan can listen before transmitting, to make sure 247462306a36Sopenharmony_ci * that there is already legitimate activity on the channel. If enough 247562306a36Sopenharmony_ci * packets are cleanly received on the channel (controlled by good_CRC_th, 247662306a36Sopenharmony_ci * typical value 1), the scan engine starts transmitting probe requests. 247762306a36Sopenharmony_ci * 247862306a36Sopenharmony_ci * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 247962306a36Sopenharmony_ci * 248062306a36Sopenharmony_ci * To avoid uCode errors, see timing restrictions described under 248162306a36Sopenharmony_ci * struct il_scan_channel. 248262306a36Sopenharmony_ci */ 248362306a36Sopenharmony_ci 248462306a36Sopenharmony_cistruct il3945_scan_cmd { 248562306a36Sopenharmony_ci __le16 len; 248662306a36Sopenharmony_ci u8 reserved0; 248762306a36Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 248862306a36Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 248962306a36Sopenharmony_ci * (only for active scan) */ 249062306a36Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 249162306a36Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 249262306a36Sopenharmony_ci __le16 reserved1; 249362306a36Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 249462306a36Sopenharmony_ci * channel */ 249562306a36Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 249662306a36Sopenharmony_ci * format") when returning to service channel: 249762306a36Sopenharmony_ci * 3945; 31:24 # beacons, 19:0 additional usec, 249862306a36Sopenharmony_ci * 4965; 31:22 # beacons, 21:0 additional usec. 249962306a36Sopenharmony_ci */ 250062306a36Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 250162306a36Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 250262306a36Sopenharmony_ci 250362306a36Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 250462306a36Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 250562306a36Sopenharmony_ci struct il3945_tx_cmd tx_cmd; 250662306a36Sopenharmony_ci 250762306a36Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 250862306a36Sopenharmony_ci struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; 250962306a36Sopenharmony_ci 251062306a36Sopenharmony_ci /* 251162306a36Sopenharmony_ci * Probe request frame, followed by channel list. 251262306a36Sopenharmony_ci * 251362306a36Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 251462306a36Sopenharmony_ci * Channel list follows immediately after probe request frame. 251562306a36Sopenharmony_ci * Number of channels in list is specified by channel_count. 251662306a36Sopenharmony_ci * Each channel in list is of type: 251762306a36Sopenharmony_ci * 251862306a36Sopenharmony_ci * struct il3945_scan_channel channels[0]; 251962306a36Sopenharmony_ci * 252062306a36Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 252162306a36Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 252262306a36Sopenharmony_ci * for one scan to complete (i.e. receive N_SCAN_COMPLETE) 252362306a36Sopenharmony_ci * before requesting another scan. 252462306a36Sopenharmony_ci */ 252562306a36Sopenharmony_ci u8 data[]; 252662306a36Sopenharmony_ci} __packed; 252762306a36Sopenharmony_ci 252862306a36Sopenharmony_cistruct il_scan_cmd { 252962306a36Sopenharmony_ci __le16 len; 253062306a36Sopenharmony_ci u8 reserved0; 253162306a36Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 253262306a36Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 253362306a36Sopenharmony_ci * (only for active scan) */ 253462306a36Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 253562306a36Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 253662306a36Sopenharmony_ci __le16 rx_chain; /* RXON_RX_CHAIN_* */ 253762306a36Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 253862306a36Sopenharmony_ci * channel */ 253962306a36Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 254062306a36Sopenharmony_ci * format") when returning to service chnl: 254162306a36Sopenharmony_ci * 3945; 31:24 # beacons, 19:0 additional usec, 254262306a36Sopenharmony_ci * 4965; 31:22 # beacons, 21:0 additional usec. 254362306a36Sopenharmony_ci */ 254462306a36Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 254562306a36Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 254662306a36Sopenharmony_ci 254762306a36Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 254862306a36Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 254962306a36Sopenharmony_ci struct il_tx_cmd tx_cmd; 255062306a36Sopenharmony_ci 255162306a36Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 255262306a36Sopenharmony_ci struct il_ssid_ie direct_scan[PROBE_OPTION_MAX]; 255362306a36Sopenharmony_ci 255462306a36Sopenharmony_ci /* 255562306a36Sopenharmony_ci * Probe request frame, followed by channel list. 255662306a36Sopenharmony_ci * 255762306a36Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 255862306a36Sopenharmony_ci * Channel list follows immediately after probe request frame. 255962306a36Sopenharmony_ci * Number of channels in list is specified by channel_count. 256062306a36Sopenharmony_ci * Each channel in list is of type: 256162306a36Sopenharmony_ci * 256262306a36Sopenharmony_ci * struct il_scan_channel channels[0]; 256362306a36Sopenharmony_ci * 256462306a36Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 256562306a36Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 256662306a36Sopenharmony_ci * for one scan to complete (i.e. receive N_SCAN_COMPLETE) 256762306a36Sopenharmony_ci * before requesting another scan. 256862306a36Sopenharmony_ci */ 256962306a36Sopenharmony_ci u8 data[]; 257062306a36Sopenharmony_ci} __packed; 257162306a36Sopenharmony_ci 257262306a36Sopenharmony_ci/* Can abort will notify by complete notification with abort status. */ 257362306a36Sopenharmony_ci#define CAN_ABORT_STATUS cpu_to_le32(0x1) 257462306a36Sopenharmony_ci/* complete notification statuses */ 257562306a36Sopenharmony_ci#define ABORT_STATUS 0x2 257662306a36Sopenharmony_ci 257762306a36Sopenharmony_ci/* 257862306a36Sopenharmony_ci * C_SCAN = 0x80 (response) 257962306a36Sopenharmony_ci */ 258062306a36Sopenharmony_cistruct il_scanreq_notification { 258162306a36Sopenharmony_ci __le32 status; /* 1: okay, 2: cannot fulfill request */ 258262306a36Sopenharmony_ci} __packed; 258362306a36Sopenharmony_ci 258462306a36Sopenharmony_ci/* 258562306a36Sopenharmony_ci * N_SCAN_START = 0x82 (notification only, not a command) 258662306a36Sopenharmony_ci */ 258762306a36Sopenharmony_cistruct il_scanstart_notification { 258862306a36Sopenharmony_ci __le32 tsf_low; 258962306a36Sopenharmony_ci __le32 tsf_high; 259062306a36Sopenharmony_ci __le32 beacon_timer; 259162306a36Sopenharmony_ci u8 channel; 259262306a36Sopenharmony_ci u8 band; 259362306a36Sopenharmony_ci u8 reserved[2]; 259462306a36Sopenharmony_ci __le32 status; 259562306a36Sopenharmony_ci} __packed; 259662306a36Sopenharmony_ci 259762306a36Sopenharmony_ci#define SCAN_OWNER_STATUS 0x1 259862306a36Sopenharmony_ci#define MEASURE_OWNER_STATUS 0x2 259962306a36Sopenharmony_ci 260062306a36Sopenharmony_ci#define IL_PROBE_STATUS_OK 0 260162306a36Sopenharmony_ci#define IL_PROBE_STATUS_TX_FAILED BIT(0) 260262306a36Sopenharmony_ci/* error statuses combined with TX_FAILED */ 260362306a36Sopenharmony_ci#define IL_PROBE_STATUS_FAIL_TTL BIT(1) 260462306a36Sopenharmony_ci#define IL_PROBE_STATUS_FAIL_BT BIT(2) 260562306a36Sopenharmony_ci 260662306a36Sopenharmony_ci#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */ 260762306a36Sopenharmony_ci/* 260862306a36Sopenharmony_ci * N_SCAN_RESULTS = 0x83 (notification only, not a command) 260962306a36Sopenharmony_ci */ 261062306a36Sopenharmony_cistruct il_scanresults_notification { 261162306a36Sopenharmony_ci u8 channel; 261262306a36Sopenharmony_ci u8 band; 261362306a36Sopenharmony_ci u8 probe_status; 261462306a36Sopenharmony_ci u8 num_probe_not_sent; /* not enough time to send */ 261562306a36Sopenharmony_ci __le32 tsf_low; 261662306a36Sopenharmony_ci __le32 tsf_high; 261762306a36Sopenharmony_ci __le32 stats[NUMBER_OF_STATS]; 261862306a36Sopenharmony_ci} __packed; 261962306a36Sopenharmony_ci 262062306a36Sopenharmony_ci/* 262162306a36Sopenharmony_ci * N_SCAN_COMPLETE = 0x84 (notification only, not a command) 262262306a36Sopenharmony_ci */ 262362306a36Sopenharmony_cistruct il_scancomplete_notification { 262462306a36Sopenharmony_ci u8 scanned_channels; 262562306a36Sopenharmony_ci u8 status; 262662306a36Sopenharmony_ci u8 last_channel; 262762306a36Sopenharmony_ci __le32 tsf_low; 262862306a36Sopenharmony_ci __le32 tsf_high; 262962306a36Sopenharmony_ci} __packed; 263062306a36Sopenharmony_ci 263162306a36Sopenharmony_ci/****************************************************************************** 263262306a36Sopenharmony_ci * (9) 263362306a36Sopenharmony_ci * IBSS/AP Commands and Notifications: 263462306a36Sopenharmony_ci * 263562306a36Sopenharmony_ci *****************************************************************************/ 263662306a36Sopenharmony_ci 263762306a36Sopenharmony_cienum il_ibss_manager { 263862306a36Sopenharmony_ci IL_NOT_IBSS_MANAGER = 0, 263962306a36Sopenharmony_ci IL_IBSS_MANAGER = 1, 264062306a36Sopenharmony_ci}; 264162306a36Sopenharmony_ci 264262306a36Sopenharmony_ci/* 264362306a36Sopenharmony_ci * N_BEACON = 0x90 (notification only, not a command) 264462306a36Sopenharmony_ci */ 264562306a36Sopenharmony_ci 264662306a36Sopenharmony_cistruct il3945_beacon_notif { 264762306a36Sopenharmony_ci struct il3945_tx_resp beacon_notify_hdr; 264862306a36Sopenharmony_ci __le32 low_tsf; 264962306a36Sopenharmony_ci __le32 high_tsf; 265062306a36Sopenharmony_ci __le32 ibss_mgr_status; 265162306a36Sopenharmony_ci} __packed; 265262306a36Sopenharmony_ci 265362306a36Sopenharmony_cistruct il4965_beacon_notif { 265462306a36Sopenharmony_ci struct il4965_tx_resp beacon_notify_hdr; 265562306a36Sopenharmony_ci __le32 low_tsf; 265662306a36Sopenharmony_ci __le32 high_tsf; 265762306a36Sopenharmony_ci __le32 ibss_mgr_status; 265862306a36Sopenharmony_ci} __packed; 265962306a36Sopenharmony_ci 266062306a36Sopenharmony_ci/* 266162306a36Sopenharmony_ci * C_TX_BEACON= 0x91 (command, has simple generic response) 266262306a36Sopenharmony_ci */ 266362306a36Sopenharmony_ci 266462306a36Sopenharmony_cistruct il3945_tx_beacon_cmd { 266562306a36Sopenharmony_ci struct il3945_tx_cmd tx; 266662306a36Sopenharmony_ci __le16 tim_idx; 266762306a36Sopenharmony_ci u8 tim_size; 266862306a36Sopenharmony_ci u8 reserved1; 266962306a36Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 267062306a36Sopenharmony_ci} __packed; 267162306a36Sopenharmony_ci 267262306a36Sopenharmony_cistruct il_tx_beacon_cmd { 267362306a36Sopenharmony_ci struct il_tx_cmd tx; 267462306a36Sopenharmony_ci __le16 tim_idx; 267562306a36Sopenharmony_ci u8 tim_size; 267662306a36Sopenharmony_ci u8 reserved1; 267762306a36Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 267862306a36Sopenharmony_ci} __packed; 267962306a36Sopenharmony_ci 268062306a36Sopenharmony_ci/****************************************************************************** 268162306a36Sopenharmony_ci * (10) 268262306a36Sopenharmony_ci * Statistics Commands and Notifications: 268362306a36Sopenharmony_ci * 268462306a36Sopenharmony_ci *****************************************************************************/ 268562306a36Sopenharmony_ci 268662306a36Sopenharmony_ci#define IL_TEMP_CONVERT 260 268762306a36Sopenharmony_ci 268862306a36Sopenharmony_ci#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 268962306a36Sopenharmony_ci#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 269062306a36Sopenharmony_ci#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 269162306a36Sopenharmony_ci 269262306a36Sopenharmony_ci/* Used for passing to driver number of successes and failures per rate */ 269362306a36Sopenharmony_cistruct rate_histogram { 269462306a36Sopenharmony_ci union { 269562306a36Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 269662306a36Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 269762306a36Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 269862306a36Sopenharmony_ci } success; 269962306a36Sopenharmony_ci union { 270062306a36Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 270162306a36Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 270262306a36Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 270362306a36Sopenharmony_ci } failed; 270462306a36Sopenharmony_ci} __packed; 270562306a36Sopenharmony_ci 270662306a36Sopenharmony_ci/* stats command response */ 270762306a36Sopenharmony_ci 270862306a36Sopenharmony_cistruct iwl39_stats_rx_phy { 270962306a36Sopenharmony_ci __le32 ina_cnt; 271062306a36Sopenharmony_ci __le32 fina_cnt; 271162306a36Sopenharmony_ci __le32 plcp_err; 271262306a36Sopenharmony_ci __le32 crc32_err; 271362306a36Sopenharmony_ci __le32 overrun_err; 271462306a36Sopenharmony_ci __le32 early_overrun_err; 271562306a36Sopenharmony_ci __le32 crc32_good; 271662306a36Sopenharmony_ci __le32 false_alarm_cnt; 271762306a36Sopenharmony_ci __le32 fina_sync_err_cnt; 271862306a36Sopenharmony_ci __le32 sfd_timeout; 271962306a36Sopenharmony_ci __le32 fina_timeout; 272062306a36Sopenharmony_ci __le32 unresponded_rts; 272162306a36Sopenharmony_ci __le32 rxe_frame_limit_overrun; 272262306a36Sopenharmony_ci __le32 sent_ack_cnt; 272362306a36Sopenharmony_ci __le32 sent_cts_cnt; 272462306a36Sopenharmony_ci} __packed; 272562306a36Sopenharmony_ci 272662306a36Sopenharmony_cistruct iwl39_stats_rx_non_phy { 272762306a36Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 272862306a36Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 272962306a36Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 273062306a36Sopenharmony_ci * doesn't belong to the STA BSSID */ 273162306a36Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 273262306a36Sopenharmony_ci * filtering process */ 273362306a36Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 273462306a36Sopenharmony_ci * our serving channel */ 273562306a36Sopenharmony_ci} __packed; 273662306a36Sopenharmony_ci 273762306a36Sopenharmony_cistruct iwl39_stats_rx { 273862306a36Sopenharmony_ci struct iwl39_stats_rx_phy ofdm; 273962306a36Sopenharmony_ci struct iwl39_stats_rx_phy cck; 274062306a36Sopenharmony_ci struct iwl39_stats_rx_non_phy general; 274162306a36Sopenharmony_ci} __packed; 274262306a36Sopenharmony_ci 274362306a36Sopenharmony_cistruct iwl39_stats_tx { 274462306a36Sopenharmony_ci __le32 preamble_cnt; 274562306a36Sopenharmony_ci __le32 rx_detected_cnt; 274662306a36Sopenharmony_ci __le32 bt_prio_defer_cnt; 274762306a36Sopenharmony_ci __le32 bt_prio_kill_cnt; 274862306a36Sopenharmony_ci __le32 few_bytes_cnt; 274962306a36Sopenharmony_ci __le32 cts_timeout; 275062306a36Sopenharmony_ci __le32 ack_timeout; 275162306a36Sopenharmony_ci __le32 expected_ack_cnt; 275262306a36Sopenharmony_ci __le32 actual_ack_cnt; 275362306a36Sopenharmony_ci} __packed; 275462306a36Sopenharmony_ci 275562306a36Sopenharmony_cistruct stats_dbg { 275662306a36Sopenharmony_ci __le32 burst_check; 275762306a36Sopenharmony_ci __le32 burst_count; 275862306a36Sopenharmony_ci __le32 wait_for_silence_timeout_cnt; 275962306a36Sopenharmony_ci __le32 reserved[3]; 276062306a36Sopenharmony_ci} __packed; 276162306a36Sopenharmony_ci 276262306a36Sopenharmony_cistruct iwl39_stats_div { 276362306a36Sopenharmony_ci __le32 tx_on_a; 276462306a36Sopenharmony_ci __le32 tx_on_b; 276562306a36Sopenharmony_ci __le32 exec_time; 276662306a36Sopenharmony_ci __le32 probe_time; 276762306a36Sopenharmony_ci} __packed; 276862306a36Sopenharmony_ci 276962306a36Sopenharmony_cistruct iwl39_stats_general { 277062306a36Sopenharmony_ci __le32 temperature; 277162306a36Sopenharmony_ci struct stats_dbg dbg; 277262306a36Sopenharmony_ci __le32 sleep_time; 277362306a36Sopenharmony_ci __le32 slots_out; 277462306a36Sopenharmony_ci __le32 slots_idle; 277562306a36Sopenharmony_ci __le32 ttl_timestamp; 277662306a36Sopenharmony_ci struct iwl39_stats_div div; 277762306a36Sopenharmony_ci} __packed; 277862306a36Sopenharmony_ci 277962306a36Sopenharmony_cistruct stats_rx_phy { 278062306a36Sopenharmony_ci __le32 ina_cnt; 278162306a36Sopenharmony_ci __le32 fina_cnt; 278262306a36Sopenharmony_ci __le32 plcp_err; 278362306a36Sopenharmony_ci __le32 crc32_err; 278462306a36Sopenharmony_ci __le32 overrun_err; 278562306a36Sopenharmony_ci __le32 early_overrun_err; 278662306a36Sopenharmony_ci __le32 crc32_good; 278762306a36Sopenharmony_ci __le32 false_alarm_cnt; 278862306a36Sopenharmony_ci __le32 fina_sync_err_cnt; 278962306a36Sopenharmony_ci __le32 sfd_timeout; 279062306a36Sopenharmony_ci __le32 fina_timeout; 279162306a36Sopenharmony_ci __le32 unresponded_rts; 279262306a36Sopenharmony_ci __le32 rxe_frame_limit_overrun; 279362306a36Sopenharmony_ci __le32 sent_ack_cnt; 279462306a36Sopenharmony_ci __le32 sent_cts_cnt; 279562306a36Sopenharmony_ci __le32 sent_ba_rsp_cnt; 279662306a36Sopenharmony_ci __le32 dsp_self_kill; 279762306a36Sopenharmony_ci __le32 mh_format_err; 279862306a36Sopenharmony_ci __le32 re_acq_main_rssi_sum; 279962306a36Sopenharmony_ci __le32 reserved3; 280062306a36Sopenharmony_ci} __packed; 280162306a36Sopenharmony_ci 280262306a36Sopenharmony_cistruct stats_rx_ht_phy { 280362306a36Sopenharmony_ci __le32 plcp_err; 280462306a36Sopenharmony_ci __le32 overrun_err; 280562306a36Sopenharmony_ci __le32 early_overrun_err; 280662306a36Sopenharmony_ci __le32 crc32_good; 280762306a36Sopenharmony_ci __le32 crc32_err; 280862306a36Sopenharmony_ci __le32 mh_format_err; 280962306a36Sopenharmony_ci __le32 agg_crc32_good; 281062306a36Sopenharmony_ci __le32 agg_mpdu_cnt; 281162306a36Sopenharmony_ci __le32 agg_cnt; 281262306a36Sopenharmony_ci __le32 unsupport_mcs; 281362306a36Sopenharmony_ci} __packed; 281462306a36Sopenharmony_ci 281562306a36Sopenharmony_ci#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) 281662306a36Sopenharmony_ci 281762306a36Sopenharmony_cistruct stats_rx_non_phy { 281862306a36Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 281962306a36Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 282062306a36Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 282162306a36Sopenharmony_ci * doesn't belong to the STA BSSID */ 282262306a36Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 282362306a36Sopenharmony_ci * filtering process */ 282462306a36Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 282562306a36Sopenharmony_ci * our serving channel */ 282662306a36Sopenharmony_ci __le32 channel_beacons; /* beacons with our bss id and in our 282762306a36Sopenharmony_ci * serving channel */ 282862306a36Sopenharmony_ci __le32 num_missed_bcon; /* number of missed beacons */ 282962306a36Sopenharmony_ci __le32 adc_rx_saturation_time; /* count in 0.8us units the time the 283062306a36Sopenharmony_ci * ADC was in saturation */ 283162306a36Sopenharmony_ci __le32 ina_detection_search_time; /* total time (in 0.8us) searched 283262306a36Sopenharmony_ci * for INA */ 283362306a36Sopenharmony_ci __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ 283462306a36Sopenharmony_ci __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ 283562306a36Sopenharmony_ci __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ 283662306a36Sopenharmony_ci __le32 interference_data_flag; /* flag for interference data 283762306a36Sopenharmony_ci * availability. 1 when data is 283862306a36Sopenharmony_ci * available. */ 283962306a36Sopenharmony_ci __le32 channel_load; /* counts RX Enable time in uSec */ 284062306a36Sopenharmony_ci __le32 dsp_false_alarms; /* DSP false alarm (both OFDM 284162306a36Sopenharmony_ci * and CCK) counter */ 284262306a36Sopenharmony_ci __le32 beacon_rssi_a; 284362306a36Sopenharmony_ci __le32 beacon_rssi_b; 284462306a36Sopenharmony_ci __le32 beacon_rssi_c; 284562306a36Sopenharmony_ci __le32 beacon_energy_a; 284662306a36Sopenharmony_ci __le32 beacon_energy_b; 284762306a36Sopenharmony_ci __le32 beacon_energy_c; 284862306a36Sopenharmony_ci} __packed; 284962306a36Sopenharmony_ci 285062306a36Sopenharmony_cistruct stats_rx { 285162306a36Sopenharmony_ci struct stats_rx_phy ofdm; 285262306a36Sopenharmony_ci struct stats_rx_phy cck; 285362306a36Sopenharmony_ci struct stats_rx_non_phy general; 285462306a36Sopenharmony_ci struct stats_rx_ht_phy ofdm_ht; 285562306a36Sopenharmony_ci} __packed; 285662306a36Sopenharmony_ci 285762306a36Sopenharmony_ci/** 285862306a36Sopenharmony_ci * struct stats_tx_power - current tx power 285962306a36Sopenharmony_ci * 286062306a36Sopenharmony_ci * @ant_a: current tx power on chain a in 1/2 dB step 286162306a36Sopenharmony_ci * @ant_b: current tx power on chain b in 1/2 dB step 286262306a36Sopenharmony_ci * @ant_c: current tx power on chain c in 1/2 dB step 286362306a36Sopenharmony_ci */ 286462306a36Sopenharmony_cistruct stats_tx_power { 286562306a36Sopenharmony_ci u8 ant_a; 286662306a36Sopenharmony_ci u8 ant_b; 286762306a36Sopenharmony_ci u8 ant_c; 286862306a36Sopenharmony_ci u8 reserved; 286962306a36Sopenharmony_ci} __packed; 287062306a36Sopenharmony_ci 287162306a36Sopenharmony_cistruct stats_tx_non_phy_agg { 287262306a36Sopenharmony_ci __le32 ba_timeout; 287362306a36Sopenharmony_ci __le32 ba_reschedule_frames; 287462306a36Sopenharmony_ci __le32 scd_query_agg_frame_cnt; 287562306a36Sopenharmony_ci __le32 scd_query_no_agg; 287662306a36Sopenharmony_ci __le32 scd_query_agg; 287762306a36Sopenharmony_ci __le32 scd_query_mismatch; 287862306a36Sopenharmony_ci __le32 frame_not_ready; 287962306a36Sopenharmony_ci __le32 underrun; 288062306a36Sopenharmony_ci __le32 bt_prio_kill; 288162306a36Sopenharmony_ci __le32 rx_ba_rsp_cnt; 288262306a36Sopenharmony_ci} __packed; 288362306a36Sopenharmony_ci 288462306a36Sopenharmony_cistruct stats_tx { 288562306a36Sopenharmony_ci __le32 preamble_cnt; 288662306a36Sopenharmony_ci __le32 rx_detected_cnt; 288762306a36Sopenharmony_ci __le32 bt_prio_defer_cnt; 288862306a36Sopenharmony_ci __le32 bt_prio_kill_cnt; 288962306a36Sopenharmony_ci __le32 few_bytes_cnt; 289062306a36Sopenharmony_ci __le32 cts_timeout; 289162306a36Sopenharmony_ci __le32 ack_timeout; 289262306a36Sopenharmony_ci __le32 expected_ack_cnt; 289362306a36Sopenharmony_ci __le32 actual_ack_cnt; 289462306a36Sopenharmony_ci __le32 dump_msdu_cnt; 289562306a36Sopenharmony_ci __le32 burst_abort_next_frame_mismatch_cnt; 289662306a36Sopenharmony_ci __le32 burst_abort_missing_next_frame_cnt; 289762306a36Sopenharmony_ci __le32 cts_timeout_collision; 289862306a36Sopenharmony_ci __le32 ack_or_ba_timeout_collision; 289962306a36Sopenharmony_ci struct stats_tx_non_phy_agg agg; 290062306a36Sopenharmony_ci 290162306a36Sopenharmony_ci __le32 reserved1; 290262306a36Sopenharmony_ci} __packed; 290362306a36Sopenharmony_ci 290462306a36Sopenharmony_cistruct stats_div { 290562306a36Sopenharmony_ci __le32 tx_on_a; 290662306a36Sopenharmony_ci __le32 tx_on_b; 290762306a36Sopenharmony_ci __le32 exec_time; 290862306a36Sopenharmony_ci __le32 probe_time; 290962306a36Sopenharmony_ci __le32 reserved1; 291062306a36Sopenharmony_ci __le32 reserved2; 291162306a36Sopenharmony_ci} __packed; 291262306a36Sopenharmony_ci 291362306a36Sopenharmony_cistruct stats_general_common { 291462306a36Sopenharmony_ci __le32 temperature; /* radio temperature */ 291562306a36Sopenharmony_ci struct stats_dbg dbg; 291662306a36Sopenharmony_ci __le32 sleep_time; 291762306a36Sopenharmony_ci __le32 slots_out; 291862306a36Sopenharmony_ci __le32 slots_idle; 291962306a36Sopenharmony_ci __le32 ttl_timestamp; 292062306a36Sopenharmony_ci struct stats_div div; 292162306a36Sopenharmony_ci __le32 rx_enable_counter; 292262306a36Sopenharmony_ci /* 292362306a36Sopenharmony_ci * num_of_sos_states: 292462306a36Sopenharmony_ci * count the number of times we have to re-tune 292562306a36Sopenharmony_ci * in order to get out of bad PHY status 292662306a36Sopenharmony_ci */ 292762306a36Sopenharmony_ci __le32 num_of_sos_states; 292862306a36Sopenharmony_ci} __packed; 292962306a36Sopenharmony_ci 293062306a36Sopenharmony_cistruct stats_general { 293162306a36Sopenharmony_ci struct stats_general_common common; 293262306a36Sopenharmony_ci __le32 reserved2; 293362306a36Sopenharmony_ci __le32 reserved3; 293462306a36Sopenharmony_ci} __packed; 293562306a36Sopenharmony_ci 293662306a36Sopenharmony_ci#define UCODE_STATS_CLEAR_MSK (0x1 << 0) 293762306a36Sopenharmony_ci#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1) 293862306a36Sopenharmony_ci#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2) 293962306a36Sopenharmony_ci 294062306a36Sopenharmony_ci/* 294162306a36Sopenharmony_ci * C_STATS = 0x9c, 294262306a36Sopenharmony_ci * all devices identical. 294362306a36Sopenharmony_ci * 294462306a36Sopenharmony_ci * This command triggers an immediate response containing uCode stats. 294562306a36Sopenharmony_ci * The response is in the same format as N_STATS 0x9d, below. 294662306a36Sopenharmony_ci * 294762306a36Sopenharmony_ci * If the CLEAR_STATS configuration flag is set, uCode will clear its 294862306a36Sopenharmony_ci * internal copy of the stats (counters) after issuing the response. 294962306a36Sopenharmony_ci * This flag does not affect N_STATSs after beacons (see below). 295062306a36Sopenharmony_ci * 295162306a36Sopenharmony_ci * If the DISABLE_NOTIF configuration flag is set, uCode will not issue 295262306a36Sopenharmony_ci * N_STATSs after received beacons (see below). This flag 295362306a36Sopenharmony_ci * does not affect the response to the C_STATS 0x9c itself. 295462306a36Sopenharmony_ci */ 295562306a36Sopenharmony_ci#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 295662306a36Sopenharmony_ci#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2) /* see above */ 295762306a36Sopenharmony_cistruct il_stats_cmd { 295862306a36Sopenharmony_ci __le32 configuration_flags; /* IL_STATS_CONF_* */ 295962306a36Sopenharmony_ci} __packed; 296062306a36Sopenharmony_ci 296162306a36Sopenharmony_ci/* 296262306a36Sopenharmony_ci * N_STATS = 0x9d (notification only, not a command) 296362306a36Sopenharmony_ci * 296462306a36Sopenharmony_ci * By default, uCode issues this notification after receiving a beacon 296562306a36Sopenharmony_ci * while associated. To disable this behavior, set DISABLE_NOTIF flag in the 296662306a36Sopenharmony_ci * C_STATS 0x9c, above. 296762306a36Sopenharmony_ci * 296862306a36Sopenharmony_ci * Statistics counters continue to increment beacon after beacon, but are 296962306a36Sopenharmony_ci * cleared when changing channels or when driver issues C_STATS 297062306a36Sopenharmony_ci * 0x9c with CLEAR_STATS bit set (see above). 297162306a36Sopenharmony_ci * 297262306a36Sopenharmony_ci * uCode also issues this notification during scans. uCode clears stats 297362306a36Sopenharmony_ci * appropriately so that each notification contains stats for only the 297462306a36Sopenharmony_ci * one channel that has just been scanned. 297562306a36Sopenharmony_ci */ 297662306a36Sopenharmony_ci#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 297762306a36Sopenharmony_ci#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) 297862306a36Sopenharmony_ci 297962306a36Sopenharmony_cistruct il3945_notif_stats { 298062306a36Sopenharmony_ci __le32 flag; 298162306a36Sopenharmony_ci struct iwl39_stats_rx rx; 298262306a36Sopenharmony_ci struct iwl39_stats_tx tx; 298362306a36Sopenharmony_ci struct iwl39_stats_general general; 298462306a36Sopenharmony_ci} __packed; 298562306a36Sopenharmony_ci 298662306a36Sopenharmony_cistruct il_notif_stats { 298762306a36Sopenharmony_ci __le32 flag; 298862306a36Sopenharmony_ci struct stats_rx rx; 298962306a36Sopenharmony_ci struct stats_tx tx; 299062306a36Sopenharmony_ci struct stats_general general; 299162306a36Sopenharmony_ci} __packed; 299262306a36Sopenharmony_ci 299362306a36Sopenharmony_ci/* 299462306a36Sopenharmony_ci * N_MISSED_BEACONS = 0xa2 (notification only, not a command) 299562306a36Sopenharmony_ci * 299662306a36Sopenharmony_ci * uCode send N_MISSED_BEACONS to driver when detect beacon missed 299762306a36Sopenharmony_ci * in regardless of how many missed beacons, which mean when driver receive the 299862306a36Sopenharmony_ci * notification, inside the command, it can find all the beacons information 299962306a36Sopenharmony_ci * which include number of total missed beacons, number of consecutive missed 300062306a36Sopenharmony_ci * beacons, number of beacons received and number of beacons expected to 300162306a36Sopenharmony_ci * receive. 300262306a36Sopenharmony_ci * 300362306a36Sopenharmony_ci * If uCode detected consecutive_missed_beacons > 5, it will reset the radio 300462306a36Sopenharmony_ci * in order to bring the radio/PHY back to working state; which has no relation 300562306a36Sopenharmony_ci * to when driver will perform sensitivity calibration. 300662306a36Sopenharmony_ci * 300762306a36Sopenharmony_ci * Driver should set it own missed_beacon_threshold to decide when to perform 300862306a36Sopenharmony_ci * sensitivity calibration based on number of consecutive missed beacons in 300962306a36Sopenharmony_ci * order to improve overall performance, especially in noisy environment. 301062306a36Sopenharmony_ci * 301162306a36Sopenharmony_ci */ 301262306a36Sopenharmony_ci 301362306a36Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_MIN (1) 301462306a36Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_DEF (5) 301562306a36Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF 301662306a36Sopenharmony_ci 301762306a36Sopenharmony_cistruct il_missed_beacon_notif { 301862306a36Sopenharmony_ci __le32 consecutive_missed_beacons; 301962306a36Sopenharmony_ci __le32 total_missed_becons; 302062306a36Sopenharmony_ci __le32 num_expected_beacons; 302162306a36Sopenharmony_ci __le32 num_recvd_beacons; 302262306a36Sopenharmony_ci} __packed; 302362306a36Sopenharmony_ci 302462306a36Sopenharmony_ci/****************************************************************************** 302562306a36Sopenharmony_ci * (11) 302662306a36Sopenharmony_ci * Rx Calibration Commands: 302762306a36Sopenharmony_ci * 302862306a36Sopenharmony_ci * With the uCode used for open source drivers, most Tx calibration (except 302962306a36Sopenharmony_ci * for Tx Power) and most Rx calibration is done by uCode during the 303062306a36Sopenharmony_ci * "initialize" phase of uCode boot. Driver must calibrate only: 303162306a36Sopenharmony_ci * 303262306a36Sopenharmony_ci * 1) Tx power (depends on temperature), described elsewhere 303362306a36Sopenharmony_ci * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) 303462306a36Sopenharmony_ci * 3) Receiver sensitivity (to optimize signal detection) 303562306a36Sopenharmony_ci * 303662306a36Sopenharmony_ci *****************************************************************************/ 303762306a36Sopenharmony_ci 303862306a36Sopenharmony_ci/** 303962306a36Sopenharmony_ci * C_SENSITIVITY = 0xa8 (command, has simple generic response) 304062306a36Sopenharmony_ci * 304162306a36Sopenharmony_ci * This command sets up the Rx signal detector for a sensitivity level that 304262306a36Sopenharmony_ci * is high enough to lock onto all signals within the associated network, 304362306a36Sopenharmony_ci * but low enough to ignore signals that are below a certain threshold, so as 304462306a36Sopenharmony_ci * not to have too many "false alarms". False alarms are signals that the 304562306a36Sopenharmony_ci * Rx DSP tries to lock onto, but then discards after determining that they 304662306a36Sopenharmony_ci * are noise. 304762306a36Sopenharmony_ci * 304862306a36Sopenharmony_ci * The optimum number of false alarms is between 5 and 50 per 200 TUs 304962306a36Sopenharmony_ci * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. 305062306a36Sopenharmony_ci * time listening, not transmitting). Driver must adjust sensitivity so that 305162306a36Sopenharmony_ci * the ratio of actual false alarms to actual Rx time falls within this range. 305262306a36Sopenharmony_ci * 305362306a36Sopenharmony_ci * While associated, uCode delivers N_STATSs after each 305462306a36Sopenharmony_ci * received beacon. These provide information to the driver to analyze the 305562306a36Sopenharmony_ci * sensitivity. Don't analyze stats that come in from scanning, or any 305662306a36Sopenharmony_ci * other non-associated-network source. Pertinent stats include: 305762306a36Sopenharmony_ci * 305862306a36Sopenharmony_ci * From "general" stats (struct stats_rx_non_phy): 305962306a36Sopenharmony_ci * 306062306a36Sopenharmony_ci * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) 306162306a36Sopenharmony_ci * Measure of energy of desired signal. Used for establishing a level 306262306a36Sopenharmony_ci * below which the device does not detect signals. 306362306a36Sopenharmony_ci * 306462306a36Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) 306562306a36Sopenharmony_ci * Measure of background noise in silent period after beacon. 306662306a36Sopenharmony_ci * 306762306a36Sopenharmony_ci * channel_load 306862306a36Sopenharmony_ci * uSecs of actual Rx time during beacon period (varies according to 306962306a36Sopenharmony_ci * how much time was spent transmitting). 307062306a36Sopenharmony_ci * 307162306a36Sopenharmony_ci * From "cck" and "ofdm" stats (struct stats_rx_phy), separately: 307262306a36Sopenharmony_ci * 307362306a36Sopenharmony_ci * false_alarm_cnt 307462306a36Sopenharmony_ci * Signal locks abandoned early (before phy-level header). 307562306a36Sopenharmony_ci * 307662306a36Sopenharmony_ci * plcp_err 307762306a36Sopenharmony_ci * Signal locks abandoned late (during phy-level header). 307862306a36Sopenharmony_ci * 307962306a36Sopenharmony_ci * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from 308062306a36Sopenharmony_ci * beacon to beacon, i.e. each value is an accumulation of all errors 308162306a36Sopenharmony_ci * before and including the latest beacon. Values will wrap around to 0 308262306a36Sopenharmony_ci * after counting up to 2^32 - 1. Driver must differentiate vs. 308362306a36Sopenharmony_ci * previous beacon's values to determine # false alarms in the current 308462306a36Sopenharmony_ci * beacon period. 308562306a36Sopenharmony_ci * 308662306a36Sopenharmony_ci * Total number of false alarms = false_alarms + plcp_errs 308762306a36Sopenharmony_ci * 308862306a36Sopenharmony_ci * For OFDM, adjust the following table entries in struct il_sensitivity_cmd 308962306a36Sopenharmony_ci * (notice that the start points for OFDM are at or close to settings for 309062306a36Sopenharmony_ci * maximum sensitivity): 309162306a36Sopenharmony_ci * 309262306a36Sopenharmony_ci * START / MIN / MAX 309362306a36Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120 309462306a36Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210 309562306a36Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140 309662306a36Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270 309762306a36Sopenharmony_ci * 309862306a36Sopenharmony_ci * If actual rate of OFDM false alarms (+ plcp_errors) is too high 309962306a36Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), reduce sensitivity 310062306a36Sopenharmony_ci * by *adding* 1 to all 4 of the table entries above, up to the max for 310162306a36Sopenharmony_ci * each entry. Conversely, if false alarm rate is too low (less than 5 310262306a36Sopenharmony_ci * for each 204.8 msecs listening), *subtract* 1 from each entry to 310362306a36Sopenharmony_ci * increase sensitivity. 310462306a36Sopenharmony_ci * 310562306a36Sopenharmony_ci * For CCK sensitivity, keep track of the following: 310662306a36Sopenharmony_ci * 310762306a36Sopenharmony_ci * 1). 20-beacon history of maximum background noise, indicated by 310862306a36Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the 310962306a36Sopenharmony_ci * 3 receivers. For any given beacon, the "silence reference" is 311062306a36Sopenharmony_ci * the maximum of last 60 samples (20 beacons * 3 receivers). 311162306a36Sopenharmony_ci * 311262306a36Sopenharmony_ci * 2). 10-beacon history of strongest signal level, as indicated 311362306a36Sopenharmony_ci * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, 311462306a36Sopenharmony_ci * i.e. the strength of the signal through the best receiver at the 311562306a36Sopenharmony_ci * moment. These measurements are "upside down", with lower values 311662306a36Sopenharmony_ci * for stronger signals, so max energy will be *minimum* value. 311762306a36Sopenharmony_ci * 311862306a36Sopenharmony_ci * Then for any given beacon, the driver must determine the *weakest* 311962306a36Sopenharmony_ci * of the strongest signals; this is the minimum level that needs to be 312062306a36Sopenharmony_ci * successfully detected, when using the best receiver at the moment. 312162306a36Sopenharmony_ci * "Max cck energy" is the maximum (higher value means lower energy!) 312262306a36Sopenharmony_ci * of the last 10 minima. Once this is determined, driver must add 312362306a36Sopenharmony_ci * a little margin by adding "6" to it. 312462306a36Sopenharmony_ci * 312562306a36Sopenharmony_ci * 3). Number of consecutive beacon periods with too few false alarms. 312662306a36Sopenharmony_ci * Reset this to 0 at the first beacon period that falls within the 312762306a36Sopenharmony_ci * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 312862306a36Sopenharmony_ci * 312962306a36Sopenharmony_ci * Then, adjust the following CCK table entries in struct il_sensitivity_cmd 313062306a36Sopenharmony_ci * (notice that the start points for CCK are at maximum sensitivity): 313162306a36Sopenharmony_ci * 313262306a36Sopenharmony_ci * START / MIN / MAX 313362306a36Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200 313462306a36Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400 313562306a36Sopenharmony_ci * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100 313662306a36Sopenharmony_ci * 313762306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too high 313862306a36Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), method for reducing 313962306a36Sopenharmony_ci * sensitivity is: 314062306a36Sopenharmony_ci * 314162306a36Sopenharmony_ci * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, 314262306a36Sopenharmony_ci * up to max 400. 314362306a36Sopenharmony_ci * 314462306a36Sopenharmony_ci * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160, 314562306a36Sopenharmony_ci * sensitivity has been reduced a significant amount; bring it up to 314662306a36Sopenharmony_ci * a moderate 161. Otherwise, *add* 3, up to max 200. 314762306a36Sopenharmony_ci * 314862306a36Sopenharmony_ci * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160, 314962306a36Sopenharmony_ci * sensitivity has been reduced only a moderate or small amount; 315062306a36Sopenharmony_ci * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX, 315162306a36Sopenharmony_ci * down to min 0. Otherwise (if gain has been significantly reduced), 315262306a36Sopenharmony_ci * don't change the HD_MIN_ENERGY_CCK_DET_IDX value. 315362306a36Sopenharmony_ci * 315462306a36Sopenharmony_ci * b) Save a snapshot of the "silence reference". 315562306a36Sopenharmony_ci * 315662306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too low 315762306a36Sopenharmony_ci * (less than 5 for each 204.8 msecs listening), method for increasing 315862306a36Sopenharmony_ci * sensitivity is used only if: 315962306a36Sopenharmony_ci * 316062306a36Sopenharmony_ci * 1a) Previous beacon did not have too many false alarms 316162306a36Sopenharmony_ci * 1b) AND difference between previous "silence reference" and current 316262306a36Sopenharmony_ci * "silence reference" (prev - current) is 2 or more, 316362306a36Sopenharmony_ci * OR 2) 100 or more consecutive beacon periods have had rate of 316462306a36Sopenharmony_ci * less than 5 false alarms per 204.8 milliseconds rx time. 316562306a36Sopenharmony_ci * 316662306a36Sopenharmony_ci * Method for increasing sensitivity: 316762306a36Sopenharmony_ci * 316862306a36Sopenharmony_ci * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX, 316962306a36Sopenharmony_ci * down to min 125. 317062306a36Sopenharmony_ci * 317162306a36Sopenharmony_ci * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, 317262306a36Sopenharmony_ci * down to min 200. 317362306a36Sopenharmony_ci * 317462306a36Sopenharmony_ci * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100. 317562306a36Sopenharmony_ci * 317662306a36Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is within good range 317762306a36Sopenharmony_ci * (between 5 and 50 for each 204.8 msecs listening): 317862306a36Sopenharmony_ci * 317962306a36Sopenharmony_ci * 1) Save a snapshot of the silence reference. 318062306a36Sopenharmony_ci * 318162306a36Sopenharmony_ci * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), 318262306a36Sopenharmony_ci * give some extra margin to energy threshold by *subtracting* 8 318362306a36Sopenharmony_ci * from value in HD_MIN_ENERGY_CCK_DET_IDX. 318462306a36Sopenharmony_ci * 318562306a36Sopenharmony_ci * For all cases (too few, too many, good range), make sure that the CCK 318662306a36Sopenharmony_ci * detection threshold (energy) is below the energy level for robust 318762306a36Sopenharmony_ci * detection over the past 10 beacon periods, the "Max cck energy". 318862306a36Sopenharmony_ci * Lower values mean higher energy; this means making sure that the value 318962306a36Sopenharmony_ci * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy". 319062306a36Sopenharmony_ci * 319162306a36Sopenharmony_ci */ 319262306a36Sopenharmony_ci 319362306a36Sopenharmony_ci/* 319462306a36Sopenharmony_ci * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd) 319562306a36Sopenharmony_ci */ 319662306a36Sopenharmony_ci#define HD_TBL_SIZE (11) /* number of entries */ 319762306a36Sopenharmony_ci#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */ 319862306a36Sopenharmony_ci#define HD_MIN_ENERGY_OFDM_DET_IDX (1) 319962306a36Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2) 320062306a36Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3) 320162306a36Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4) 320262306a36Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5) 320362306a36Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6) 320462306a36Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7) 320562306a36Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8) 320662306a36Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9) 320762306a36Sopenharmony_ci#define HD_OFDM_ENERGY_TH_IN_IDX (10) 320862306a36Sopenharmony_ci 320962306a36Sopenharmony_ci/* Control field in struct il_sensitivity_cmd */ 321062306a36Sopenharmony_ci#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0) 321162306a36Sopenharmony_ci#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1) 321262306a36Sopenharmony_ci 321362306a36Sopenharmony_ci/** 321462306a36Sopenharmony_ci * struct il_sensitivity_cmd 321562306a36Sopenharmony_ci * @control: (1) updates working table, (0) updates default table 321662306a36Sopenharmony_ci * @table: energy threshold values, use HD_* as idx into table 321762306a36Sopenharmony_ci * 321862306a36Sopenharmony_ci * Always use "1" in "control" to update uCode's working table and DSP. 321962306a36Sopenharmony_ci */ 322062306a36Sopenharmony_cistruct il_sensitivity_cmd { 322162306a36Sopenharmony_ci __le16 control; /* always use "1" */ 322262306a36Sopenharmony_ci __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */ 322362306a36Sopenharmony_ci} __packed; 322462306a36Sopenharmony_ci 322562306a36Sopenharmony_ci/** 322662306a36Sopenharmony_ci * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response) 322762306a36Sopenharmony_ci * 322862306a36Sopenharmony_ci * This command sets the relative gains of 4965 device's 3 radio receiver chains. 322962306a36Sopenharmony_ci * 323062306a36Sopenharmony_ci * After the first association, driver should accumulate signal and noise 323162306a36Sopenharmony_ci * stats from the N_STATSs that follow the first 20 323262306a36Sopenharmony_ci * beacons from the associated network (don't collect stats that come 323362306a36Sopenharmony_ci * in from scanning, or any other non-network source). 323462306a36Sopenharmony_ci * 323562306a36Sopenharmony_ci * DISCONNECTED ANTENNA: 323662306a36Sopenharmony_ci * 323762306a36Sopenharmony_ci * Driver should determine which antennas are actually connected, by comparing 323862306a36Sopenharmony_ci * average beacon signal levels for the 3 Rx chains. Accumulate (add) the 323962306a36Sopenharmony_ci * following values over 20 beacons, one accumulator for each of the chains 324062306a36Sopenharmony_ci * a/b/c, from struct stats_rx_non_phy: 324162306a36Sopenharmony_ci * 324262306a36Sopenharmony_ci * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) 324362306a36Sopenharmony_ci * 324462306a36Sopenharmony_ci * Find the strongest signal from among a/b/c. Compare the other two to the 324562306a36Sopenharmony_ci * strongest. If any signal is more than 15 dB (times 20, unless you 324662306a36Sopenharmony_ci * divide the accumulated values by 20) below the strongest, the driver 324762306a36Sopenharmony_ci * considers that antenna to be disconnected, and should not try to use that 324862306a36Sopenharmony_ci * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, 324962306a36Sopenharmony_ci * driver should declare the stronger one as connected, and attempt to use it 325062306a36Sopenharmony_ci * (A and B are the only 2 Tx chains!). 325162306a36Sopenharmony_ci * 325262306a36Sopenharmony_ci * 325362306a36Sopenharmony_ci * RX BALANCE: 325462306a36Sopenharmony_ci * 325562306a36Sopenharmony_ci * Driver should balance the 3 receivers (but just the ones that are connected 325662306a36Sopenharmony_ci * to antennas, see above) for gain, by comparing the average signal levels 325762306a36Sopenharmony_ci * detected during the silence after each beacon (background noise). 325862306a36Sopenharmony_ci * Accumulate (add) the following values over 20 beacons, one accumulator for 325962306a36Sopenharmony_ci * each of the chains a/b/c, from struct stats_rx_non_phy: 326062306a36Sopenharmony_ci * 326162306a36Sopenharmony_ci * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) 326262306a36Sopenharmony_ci * 326362306a36Sopenharmony_ci * Find the weakest background noise level from among a/b/c. This Rx chain 326462306a36Sopenharmony_ci * will be the reference, with 0 gain adjustment. Attenuate other channels by 326562306a36Sopenharmony_ci * finding noise difference: 326662306a36Sopenharmony_ci * 326762306a36Sopenharmony_ci * (accum_noise[i] - accum_noise[reference]) / 30 326862306a36Sopenharmony_ci * 326962306a36Sopenharmony_ci * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 327062306a36Sopenharmony_ci * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the 327162306a36Sopenharmony_ci * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 327262306a36Sopenharmony_ci * and set bit 2 to indicate "reduce gain". The value for the reference 327362306a36Sopenharmony_ci * (weakest) chain should be "0". 327462306a36Sopenharmony_ci * 327562306a36Sopenharmony_ci * diff_gain_[abc] bit fields: 327662306a36Sopenharmony_ci * 2: (1) reduce gain, (0) increase gain 327762306a36Sopenharmony_ci * 1-0: amount of gain, units of 1.5 dB 327862306a36Sopenharmony_ci */ 327962306a36Sopenharmony_ci 328062306a36Sopenharmony_ci/* Phy calibration command for series */ 328162306a36Sopenharmony_ci/* The default calibrate table size if not specified by firmware */ 328262306a36Sopenharmony_ci#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 328362306a36Sopenharmony_cienum { 328462306a36Sopenharmony_ci IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, 328562306a36Sopenharmony_ci IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, 328662306a36Sopenharmony_ci}; 328762306a36Sopenharmony_ci 328862306a36Sopenharmony_ci#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253) 328962306a36Sopenharmony_ci 329062306a36Sopenharmony_cistruct il_calib_hdr { 329162306a36Sopenharmony_ci u8 op_code; 329262306a36Sopenharmony_ci u8 first_group; 329362306a36Sopenharmony_ci u8 groups_num; 329462306a36Sopenharmony_ci u8 data_valid; 329562306a36Sopenharmony_ci} __packed; 329662306a36Sopenharmony_ci 329762306a36Sopenharmony_ci/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ 329862306a36Sopenharmony_cistruct il_calib_diff_gain_cmd { 329962306a36Sopenharmony_ci struct il_calib_hdr hdr; 330062306a36Sopenharmony_ci s8 diff_gain_a; /* see above */ 330162306a36Sopenharmony_ci s8 diff_gain_b; 330262306a36Sopenharmony_ci s8 diff_gain_c; 330362306a36Sopenharmony_ci u8 reserved1; 330462306a36Sopenharmony_ci} __packed; 330562306a36Sopenharmony_ci 330662306a36Sopenharmony_ci/****************************************************************************** 330762306a36Sopenharmony_ci * (12) 330862306a36Sopenharmony_ci * Miscellaneous Commands: 330962306a36Sopenharmony_ci * 331062306a36Sopenharmony_ci *****************************************************************************/ 331162306a36Sopenharmony_ci 331262306a36Sopenharmony_ci/* 331362306a36Sopenharmony_ci * LEDs Command & Response 331462306a36Sopenharmony_ci * C_LEDS = 0x48 (command, has simple generic response) 331562306a36Sopenharmony_ci * 331662306a36Sopenharmony_ci * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 331762306a36Sopenharmony_ci * this command turns it on or off, or sets up a periodic blinking cycle. 331862306a36Sopenharmony_ci */ 331962306a36Sopenharmony_cistruct il_led_cmd { 332062306a36Sopenharmony_ci __le32 interval; /* "interval" in uSec */ 332162306a36Sopenharmony_ci u8 id; /* 1: Activity, 2: Link, 3: Tech */ 332262306a36Sopenharmony_ci u8 off; /* # intervals off while blinking; 332362306a36Sopenharmony_ci * "0", with >0 "on" value, turns LED on */ 332462306a36Sopenharmony_ci u8 on; /* # intervals on while blinking; 332562306a36Sopenharmony_ci * "0", regardless of "off", turns LED off */ 332662306a36Sopenharmony_ci u8 reserved; 332762306a36Sopenharmony_ci} __packed; 332862306a36Sopenharmony_ci 332962306a36Sopenharmony_ci/****************************************************************************** 333062306a36Sopenharmony_ci * (13) 333162306a36Sopenharmony_ci * Union of all expected notifications/responses: 333262306a36Sopenharmony_ci * 333362306a36Sopenharmony_ci *****************************************************************************/ 333462306a36Sopenharmony_ci 333562306a36Sopenharmony_ci#define IL_RX_FRAME_SIZE_MSK 0x00003fff 333662306a36Sopenharmony_ci 333762306a36Sopenharmony_cistruct il_rx_pkt { 333862306a36Sopenharmony_ci /* 333962306a36Sopenharmony_ci * The first 4 bytes of the RX frame header contain both the RX frame 334062306a36Sopenharmony_ci * size and some flags. 334162306a36Sopenharmony_ci * Bit fields: 334262306a36Sopenharmony_ci * 31: flag flush RB request 334362306a36Sopenharmony_ci * 30: flag ignore TC (terminal counter) request 334462306a36Sopenharmony_ci * 29: flag fast IRQ request 334562306a36Sopenharmony_ci * 28-14: Reserved 334662306a36Sopenharmony_ci * 13-00: RX frame size 334762306a36Sopenharmony_ci */ 334862306a36Sopenharmony_ci __le32 len_n_flags; 334962306a36Sopenharmony_ci struct il_cmd_header hdr; 335062306a36Sopenharmony_ci union { 335162306a36Sopenharmony_ci struct il3945_rx_frame rx_frame; 335262306a36Sopenharmony_ci struct il3945_tx_resp tx_resp; 335362306a36Sopenharmony_ci struct il3945_beacon_notif beacon_status; 335462306a36Sopenharmony_ci 335562306a36Sopenharmony_ci struct il_alive_resp alive_frame; 335662306a36Sopenharmony_ci struct il_spectrum_notification spectrum_notif; 335762306a36Sopenharmony_ci struct il_csa_notification csa_notif; 335862306a36Sopenharmony_ci struct il_error_resp err_resp; 335962306a36Sopenharmony_ci struct il_card_state_notif card_state_notif; 336062306a36Sopenharmony_ci struct il_add_sta_resp add_sta; 336162306a36Sopenharmony_ci struct il_rem_sta_resp rem_sta; 336262306a36Sopenharmony_ci struct il_sleep_notification sleep_notif; 336362306a36Sopenharmony_ci struct il_spectrum_resp spectrum; 336462306a36Sopenharmony_ci struct il_notif_stats stats; 336562306a36Sopenharmony_ci struct il_compressed_ba_resp compressed_ba; 336662306a36Sopenharmony_ci struct il_missed_beacon_notif missed_beacon; 336762306a36Sopenharmony_ci __le32 status; 336862306a36Sopenharmony_ci DECLARE_FLEX_ARRAY(u8, raw); 336962306a36Sopenharmony_ci } u; 337062306a36Sopenharmony_ci} __packed; 337162306a36Sopenharmony_ci 337262306a36Sopenharmony_ci#endif /* __il_commands_h__ */ 3373