18c2ecf20Sopenharmony_ci/****************************************************************************** 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 118c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 128c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 158c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178c2ecf20Sopenharmony_ci * General Public License for more details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 228c2ecf20Sopenharmony_ci * USA 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * The full GNU General Public License is included in this distribution 258c2ecf20Sopenharmony_ci * in the file called LICENSE.GPL. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * Contact Information: 288c2ecf20Sopenharmony_ci * Intel Linux Wireless <ilw@linux.intel.com> 298c2ecf20Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * BSD LICENSE 328c2ecf20Sopenharmony_ci * 338c2ecf20Sopenharmony_ci * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 348c2ecf20Sopenharmony_ci * All rights reserved. 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 378c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 388c2ecf20Sopenharmony_ci * are met: 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * * Redistributions of source code must retain the above copyright 418c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 428c2ecf20Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 438c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 448c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 458c2ecf20Sopenharmony_ci * distribution. 468c2ecf20Sopenharmony_ci * * Neither the name Intel Corporation nor the names of its 478c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 488c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 498c2ecf20Sopenharmony_ci * 508c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 518c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 528c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 538c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 548c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 558c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 568c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 578c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 588c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 598c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 608c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 618c2ecf20Sopenharmony_ci * 628c2ecf20Sopenharmony_ci *****************************************************************************/ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#ifndef __il_commands_h__ 658c2ecf20Sopenharmony_ci#define __il_commands_h__ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#include <linux/ieee80211.h> 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistruct il_priv; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci/* uCode version contains 4 values: Major/Minor/API/Serial */ 728c2ecf20Sopenharmony_ci#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) 738c2ecf20Sopenharmony_ci#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) 748c2ecf20Sopenharmony_ci#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) 758c2ecf20Sopenharmony_ci#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* Tx rates */ 788c2ecf20Sopenharmony_ci#define IL_CCK_RATES 4 798c2ecf20Sopenharmony_ci#define IL_OFDM_RATES 8 808c2ecf20Sopenharmony_ci#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cienum { 838c2ecf20Sopenharmony_ci N_ALIVE = 0x1, 848c2ecf20Sopenharmony_ci N_ERROR = 0x2, 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci /* RXON and QOS commands */ 878c2ecf20Sopenharmony_ci C_RXON = 0x10, 888c2ecf20Sopenharmony_ci C_RXON_ASSOC = 0x11, 898c2ecf20Sopenharmony_ci C_QOS_PARAM = 0x13, 908c2ecf20Sopenharmony_ci C_RXON_TIMING = 0x14, 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci /* Multi-Station support */ 938c2ecf20Sopenharmony_ci C_ADD_STA = 0x18, 948c2ecf20Sopenharmony_ci C_REM_STA = 0x19, 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* Security */ 978c2ecf20Sopenharmony_ci C_WEPKEY = 0x20, 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci /* RX, TX, LEDs */ 1008c2ecf20Sopenharmony_ci N_3945_RX = 0x1b, /* 3945 only */ 1018c2ecf20Sopenharmony_ci C_TX = 0x1c, 1028c2ecf20Sopenharmony_ci C_RATE_SCALE = 0x47, /* 3945 only */ 1038c2ecf20Sopenharmony_ci C_LEDS = 0x48, 1048c2ecf20Sopenharmony_ci C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */ 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* 802.11h related */ 1078c2ecf20Sopenharmony_ci C_CHANNEL_SWITCH = 0x72, 1088c2ecf20Sopenharmony_ci N_CHANNEL_SWITCH = 0x73, 1098c2ecf20Sopenharmony_ci C_SPECTRUM_MEASUREMENT = 0x74, 1108c2ecf20Sopenharmony_ci N_SPECTRUM_MEASUREMENT = 0x75, 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci /* Power Management */ 1138c2ecf20Sopenharmony_ci C_POWER_TBL = 0x77, 1148c2ecf20Sopenharmony_ci N_PM_SLEEP = 0x7A, 1158c2ecf20Sopenharmony_ci N_PM_DEBUG_STATS = 0x7B, 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci /* Scan commands and notifications */ 1188c2ecf20Sopenharmony_ci C_SCAN = 0x80, 1198c2ecf20Sopenharmony_ci C_SCAN_ABORT = 0x81, 1208c2ecf20Sopenharmony_ci N_SCAN_START = 0x82, 1218c2ecf20Sopenharmony_ci N_SCAN_RESULTS = 0x83, 1228c2ecf20Sopenharmony_ci N_SCAN_COMPLETE = 0x84, 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci /* IBSS/AP commands */ 1258c2ecf20Sopenharmony_ci N_BEACON = 0x90, 1268c2ecf20Sopenharmony_ci C_TX_BEACON = 0x91, 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci /* Miscellaneous commands */ 1298c2ecf20Sopenharmony_ci C_TX_PWR_TBL = 0x97, 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* Bluetooth device coexistence config command */ 1328c2ecf20Sopenharmony_ci C_BT_CONFIG = 0x9b, 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci /* Statistics */ 1358c2ecf20Sopenharmony_ci C_STATS = 0x9c, 1368c2ecf20Sopenharmony_ci N_STATS = 0x9d, 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci /* RF-KILL commands and notifications */ 1398c2ecf20Sopenharmony_ci N_CARD_STATE = 0xa1, 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci /* Missed beacons notification */ 1428c2ecf20Sopenharmony_ci N_MISSED_BEACONS = 0xa2, 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci C_CT_KILL_CONFIG = 0xa4, 1458c2ecf20Sopenharmony_ci C_SENSITIVITY = 0xa8, 1468c2ecf20Sopenharmony_ci C_PHY_CALIBRATION = 0xb0, 1478c2ecf20Sopenharmony_ci N_RX_PHY = 0xc0, 1488c2ecf20Sopenharmony_ci N_RX_MPDU = 0xc1, 1498c2ecf20Sopenharmony_ci N_RX = 0xc3, 1508c2ecf20Sopenharmony_ci N_COMPRESSED_BA = 0xc5, 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci IL_CN_MAX = 0xff 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/****************************************************************************** 1568c2ecf20Sopenharmony_ci * (0) 1578c2ecf20Sopenharmony_ci * Commonly used structures and definitions: 1588c2ecf20Sopenharmony_ci * Command header, rate_n_flags, txpower 1598c2ecf20Sopenharmony_ci * 1608c2ecf20Sopenharmony_ci *****************************************************************************/ 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci/* il_cmd_header flags value */ 1638c2ecf20Sopenharmony_ci#define IL_CMD_FAILED_MSK 0x40 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) 1668c2ecf20Sopenharmony_ci#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 1678c2ecf20Sopenharmony_ci#define SEQ_TO_IDX(s) ((s) & 0xff) 1688c2ecf20Sopenharmony_ci#define IDX_TO_SEQ(i) ((i) & 0xff) 1698c2ecf20Sopenharmony_ci#define SEQ_HUGE_FRAME cpu_to_le16(0x4000) 1708c2ecf20Sopenharmony_ci#define SEQ_RX_FRAME cpu_to_le16(0x8000) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/** 1738c2ecf20Sopenharmony_ci * struct il_cmd_header 1748c2ecf20Sopenharmony_ci * 1758c2ecf20Sopenharmony_ci * This header format appears in the beginning of each command sent from the 1768c2ecf20Sopenharmony_ci * driver, and each response/notification received from uCode. 1778c2ecf20Sopenharmony_ci */ 1788c2ecf20Sopenharmony_cistruct il_cmd_header { 1798c2ecf20Sopenharmony_ci u8 cmd; /* Command ID: C_RXON, etc. */ 1808c2ecf20Sopenharmony_ci u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ 1818c2ecf20Sopenharmony_ci /* 1828c2ecf20Sopenharmony_ci * The driver sets up the sequence number to values of its choosing. 1838c2ecf20Sopenharmony_ci * uCode does not use this value, but passes it back to the driver 1848c2ecf20Sopenharmony_ci * when sending the response to each driver-originated command, so 1858c2ecf20Sopenharmony_ci * the driver can match the response to the command. Since the values 1868c2ecf20Sopenharmony_ci * don't get used by uCode, the driver may set up an arbitrary format. 1878c2ecf20Sopenharmony_ci * 1888c2ecf20Sopenharmony_ci * There is one exception: uCode sets bit 15 when it originates 1898c2ecf20Sopenharmony_ci * the response/notification, i.e. when the response/notification 1908c2ecf20Sopenharmony_ci * is not a direct response to a command sent by the driver. For 1918c2ecf20Sopenharmony_ci * example, uCode issues N_3945_RX when it sends a received frame 1928c2ecf20Sopenharmony_ci * to the driver; it is not a direct response to any driver command. 1938c2ecf20Sopenharmony_ci * 1948c2ecf20Sopenharmony_ci * The Linux driver uses the following format: 1958c2ecf20Sopenharmony_ci * 1968c2ecf20Sopenharmony_ci * 0:7 tfd idx - position within TX queue 1978c2ecf20Sopenharmony_ci * 8:12 TX queue id 1988c2ecf20Sopenharmony_ci * 13 reserved 1998c2ecf20Sopenharmony_ci * 14 huge - driver sets this to indicate command is in the 2008c2ecf20Sopenharmony_ci * 'huge' storage at the end of the command buffers 2018c2ecf20Sopenharmony_ci * 15 unsolicited RX or uCode-originated notification 2028c2ecf20Sopenharmony_ci */ 2038c2ecf20Sopenharmony_ci __le16 sequence; 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci /* command or response/notification data follows immediately */ 2068c2ecf20Sopenharmony_ci u8 data[]; 2078c2ecf20Sopenharmony_ci} __packed; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/** 2108c2ecf20Sopenharmony_ci * struct il3945_tx_power 2118c2ecf20Sopenharmony_ci * 2128c2ecf20Sopenharmony_ci * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH 2138c2ecf20Sopenharmony_ci * 2148c2ecf20Sopenharmony_ci * Each entry contains two values: 2158c2ecf20Sopenharmony_ci * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained 2168c2ecf20Sopenharmony_ci * linear value that multiplies the output of the digital signal processor, 2178c2ecf20Sopenharmony_ci * before being sent to the analog radio. 2188c2ecf20Sopenharmony_ci * 2) Radio gain. This sets the analog gain of the radio Tx path. 2198c2ecf20Sopenharmony_ci * It is a coarser setting, and behaves in a logarithmic (dB) fashion. 2208c2ecf20Sopenharmony_ci * 2218c2ecf20Sopenharmony_ci * Driver obtains values from struct il3945_tx_power power_gain_table[][]. 2228c2ecf20Sopenharmony_ci */ 2238c2ecf20Sopenharmony_cistruct il3945_tx_power { 2248c2ecf20Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 2258c2ecf20Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 2268c2ecf20Sopenharmony_ci} __packed; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci/** 2298c2ecf20Sopenharmony_ci * struct il3945_power_per_rate 2308c2ecf20Sopenharmony_ci * 2318c2ecf20Sopenharmony_ci * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH 2328c2ecf20Sopenharmony_ci */ 2338c2ecf20Sopenharmony_cistruct il3945_power_per_rate { 2348c2ecf20Sopenharmony_ci u8 rate; /* plcp */ 2358c2ecf20Sopenharmony_ci struct il3945_tx_power tpc; 2368c2ecf20Sopenharmony_ci u8 reserved; 2378c2ecf20Sopenharmony_ci} __packed; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci/** 2408c2ecf20Sopenharmony_ci * iwl4965 rate_n_flags bit fields 2418c2ecf20Sopenharmony_ci * 2428c2ecf20Sopenharmony_ci * rate_n_flags format is used in following iwl4965 commands: 2438c2ecf20Sopenharmony_ci * N_RX (response only) 2448c2ecf20Sopenharmony_ci * N_RX_MPDU (response only) 2458c2ecf20Sopenharmony_ci * C_TX (both command and response) 2468c2ecf20Sopenharmony_ci * C_TX_LINK_QUALITY_CMD 2478c2ecf20Sopenharmony_ci * 2488c2ecf20Sopenharmony_ci * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): 2498c2ecf20Sopenharmony_ci * 2-0: 0) 6 Mbps 2508c2ecf20Sopenharmony_ci * 1) 12 Mbps 2518c2ecf20Sopenharmony_ci * 2) 18 Mbps 2528c2ecf20Sopenharmony_ci * 3) 24 Mbps 2538c2ecf20Sopenharmony_ci * 4) 36 Mbps 2548c2ecf20Sopenharmony_ci * 5) 48 Mbps 2558c2ecf20Sopenharmony_ci * 6) 54 Mbps 2568c2ecf20Sopenharmony_ci * 7) 60 Mbps 2578c2ecf20Sopenharmony_ci * 2588c2ecf20Sopenharmony_ci * 4-3: 0) Single stream (SISO) 2598c2ecf20Sopenharmony_ci * 1) Dual stream (MIMO) 2608c2ecf20Sopenharmony_ci * 2) Triple stream (MIMO) 2618c2ecf20Sopenharmony_ci * 2628c2ecf20Sopenharmony_ci * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data 2638c2ecf20Sopenharmony_ci * 2648c2ecf20Sopenharmony_ci * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): 2658c2ecf20Sopenharmony_ci * 3-0: 0xD) 6 Mbps 2668c2ecf20Sopenharmony_ci * 0xF) 9 Mbps 2678c2ecf20Sopenharmony_ci * 0x5) 12 Mbps 2688c2ecf20Sopenharmony_ci * 0x7) 18 Mbps 2698c2ecf20Sopenharmony_ci * 0x9) 24 Mbps 2708c2ecf20Sopenharmony_ci * 0xB) 36 Mbps 2718c2ecf20Sopenharmony_ci * 0x1) 48 Mbps 2728c2ecf20Sopenharmony_ci * 0x3) 54 Mbps 2738c2ecf20Sopenharmony_ci * 2748c2ecf20Sopenharmony_ci * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): 2758c2ecf20Sopenharmony_ci * 6-0: 10) 1 Mbps 2768c2ecf20Sopenharmony_ci * 20) 2 Mbps 2778c2ecf20Sopenharmony_ci * 55) 5.5 Mbps 2788c2ecf20Sopenharmony_ci * 110) 11 Mbps 2798c2ecf20Sopenharmony_ci */ 2808c2ecf20Sopenharmony_ci#define RATE_MCS_CODE_MSK 0x7 2818c2ecf20Sopenharmony_ci#define RATE_MCS_SPATIAL_POS 3 2828c2ecf20Sopenharmony_ci#define RATE_MCS_SPATIAL_MSK 0x18 2838c2ecf20Sopenharmony_ci#define RATE_MCS_HT_DUP_POS 5 2848c2ecf20Sopenharmony_ci#define RATE_MCS_HT_DUP_MSK 0x20 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ 2878c2ecf20Sopenharmony_ci#define RATE_MCS_FLAGS_POS 8 2888c2ecf20Sopenharmony_ci#define RATE_MCS_HT_POS 8 2898c2ecf20Sopenharmony_ci#define RATE_MCS_HT_MSK 0x100 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 2928c2ecf20Sopenharmony_ci#define RATE_MCS_CCK_POS 9 2938c2ecf20Sopenharmony_ci#define RATE_MCS_CCK_MSK 0x200 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* Bit 10: (1) Use Green Field preamble */ 2968c2ecf20Sopenharmony_ci#define RATE_MCS_GF_POS 10 2978c2ecf20Sopenharmony_ci#define RATE_MCS_GF_MSK 0x400 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ 3008c2ecf20Sopenharmony_ci#define RATE_MCS_HT40_POS 11 3018c2ecf20Sopenharmony_ci#define RATE_MCS_HT40_MSK 0x800 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ 3048c2ecf20Sopenharmony_ci#define RATE_MCS_DUP_POS 12 3058c2ecf20Sopenharmony_ci#define RATE_MCS_DUP_MSK 0x1000 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 3088c2ecf20Sopenharmony_ci#define RATE_MCS_SGI_POS 13 3098c2ecf20Sopenharmony_ci#define RATE_MCS_SGI_MSK 0x2000 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci/** 3128c2ecf20Sopenharmony_ci * rate_n_flags Tx antenna masks 3138c2ecf20Sopenharmony_ci * 4965 has 2 transmitters 3148c2ecf20Sopenharmony_ci * bit14:16 3158c2ecf20Sopenharmony_ci */ 3168c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_POS 14 3178c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_A_MSK 0x04000 3188c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_B_MSK 0x08000 3198c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_C_MSK 0x10000 3208c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) 3218c2ecf20Sopenharmony_ci#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) 3228c2ecf20Sopenharmony_ci#define RATE_ANT_NUM 3 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci#define POWER_TBL_NUM_ENTRIES 33 3258c2ecf20Sopenharmony_ci#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32 3268c2ecf20Sopenharmony_ci#define POWER_TBL_CCK_ENTRY 32 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci#define IL_PWR_NUM_HT_OFDM_ENTRIES 24 3298c2ecf20Sopenharmony_ci#define IL_PWR_CCK_ENTRIES 2 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci/** 3328c2ecf20Sopenharmony_ci * union il4965_tx_power_dual_stream 3338c2ecf20Sopenharmony_ci * 3348c2ecf20Sopenharmony_ci * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH 3358c2ecf20Sopenharmony_ci * Use __le32 version (struct tx_power_dual_stream) when building command. 3368c2ecf20Sopenharmony_ci * 3378c2ecf20Sopenharmony_ci * Driver provides radio gain and DSP attenuation settings to device in pairs, 3388c2ecf20Sopenharmony_ci * one value for each transmitter chain. The first value is for transmitter A, 3398c2ecf20Sopenharmony_ci * second for transmitter B. 3408c2ecf20Sopenharmony_ci * 3418c2ecf20Sopenharmony_ci * For SISO bit rates, both values in a pair should be identical. 3428c2ecf20Sopenharmony_ci * For MIMO rates, one value may be different from the other, 3438c2ecf20Sopenharmony_ci * in order to balance the Tx output between the two transmitters. 3448c2ecf20Sopenharmony_ci * 3458c2ecf20Sopenharmony_ci * See more details in doc for TXPOWER in 4965.h. 3468c2ecf20Sopenharmony_ci */ 3478c2ecf20Sopenharmony_ciunion il4965_tx_power_dual_stream { 3488c2ecf20Sopenharmony_ci struct { 3498c2ecf20Sopenharmony_ci u8 radio_tx_gain[2]; 3508c2ecf20Sopenharmony_ci u8 dsp_predis_atten[2]; 3518c2ecf20Sopenharmony_ci } s; 3528c2ecf20Sopenharmony_ci u32 dw; 3538c2ecf20Sopenharmony_ci}; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci/** 3568c2ecf20Sopenharmony_ci * struct tx_power_dual_stream 3578c2ecf20Sopenharmony_ci * 3588c2ecf20Sopenharmony_ci * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH 3598c2ecf20Sopenharmony_ci * 3608c2ecf20Sopenharmony_ci * Same format as il_tx_power_dual_stream, but __le32 3618c2ecf20Sopenharmony_ci */ 3628c2ecf20Sopenharmony_cistruct tx_power_dual_stream { 3638c2ecf20Sopenharmony_ci __le32 dw; 3648c2ecf20Sopenharmony_ci} __packed; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci/** 3678c2ecf20Sopenharmony_ci * struct il4965_tx_power_db 3688c2ecf20Sopenharmony_ci * 3698c2ecf20Sopenharmony_ci * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH 3708c2ecf20Sopenharmony_ci */ 3718c2ecf20Sopenharmony_cistruct il4965_tx_power_db { 3728c2ecf20Sopenharmony_ci struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES]; 3738c2ecf20Sopenharmony_ci} __packed; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci/****************************************************************************** 3768c2ecf20Sopenharmony_ci * (0a) 3778c2ecf20Sopenharmony_ci * Alive and Error Commands & Responses: 3788c2ecf20Sopenharmony_ci * 3798c2ecf20Sopenharmony_ci *****************************************************************************/ 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci#define UCODE_VALID_OK cpu_to_le32(0x1) 3828c2ecf20Sopenharmony_ci#define INITIALIZE_SUBTYPE (9) 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* 3858c2ecf20Sopenharmony_ci * ("Initialize") N_ALIVE = 0x1 (response only, not a command) 3868c2ecf20Sopenharmony_ci * 3878c2ecf20Sopenharmony_ci * uCode issues this "initialize alive" notification once the initialization 3888c2ecf20Sopenharmony_ci * uCode image has completed its work, and is ready to load the runtime image. 3898c2ecf20Sopenharmony_ci * This is the *first* "alive" notification that the driver will receive after 3908c2ecf20Sopenharmony_ci * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. 3918c2ecf20Sopenharmony_ci * 3928c2ecf20Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 3938c2ecf20Sopenharmony_ci * 3948c2ecf20Sopenharmony_ci * For 4965, this notification contains important calibration data for 3958c2ecf20Sopenharmony_ci * calculating txpower settings: 3968c2ecf20Sopenharmony_ci * 3978c2ecf20Sopenharmony_ci * 1) Power supply voltage indication. The voltage sensor outputs higher 3988c2ecf20Sopenharmony_ci * values for lower voltage, and vice verse. 3998c2ecf20Sopenharmony_ci * 4008c2ecf20Sopenharmony_ci * 2) Temperature measurement parameters, for each of two channel widths 4018c2ecf20Sopenharmony_ci * (20 MHz and 40 MHz) supported by the radios. Temperature sensing 4028c2ecf20Sopenharmony_ci * is done via one of the receiver chains, and channel width influences 4038c2ecf20Sopenharmony_ci * the results. 4048c2ecf20Sopenharmony_ci * 4058c2ecf20Sopenharmony_ci * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, 4068c2ecf20Sopenharmony_ci * for each of 5 frequency ranges. 4078c2ecf20Sopenharmony_ci */ 4088c2ecf20Sopenharmony_cistruct il_init_alive_resp { 4098c2ecf20Sopenharmony_ci u8 ucode_minor; 4108c2ecf20Sopenharmony_ci u8 ucode_major; 4118c2ecf20Sopenharmony_ci __le16 reserved1; 4128c2ecf20Sopenharmony_ci u8 sw_rev[8]; 4138c2ecf20Sopenharmony_ci u8 ver_type; 4148c2ecf20Sopenharmony_ci u8 ver_subtype; /* "9" for initialize alive */ 4158c2ecf20Sopenharmony_ci __le16 reserved2; 4168c2ecf20Sopenharmony_ci __le32 log_event_table_ptr; 4178c2ecf20Sopenharmony_ci __le32 error_event_table_ptr; 4188c2ecf20Sopenharmony_ci __le32 timestamp; 4198c2ecf20Sopenharmony_ci __le32 is_valid; 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci /* calibration values from "initialize" uCode */ 4228c2ecf20Sopenharmony_ci __le32 voltage; /* signed, higher value is lower voltage */ 4238c2ecf20Sopenharmony_ci __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */ 4248c2ecf20Sopenharmony_ci __le32 therm_r2[2]; /* signed */ 4258c2ecf20Sopenharmony_ci __le32 therm_r3[2]; /* signed */ 4268c2ecf20Sopenharmony_ci __le32 therm_r4[2]; /* signed */ 4278c2ecf20Sopenharmony_ci __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, 4288c2ecf20Sopenharmony_ci * 2 Tx chains */ 4298c2ecf20Sopenharmony_ci} __packed; 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci/** 4328c2ecf20Sopenharmony_ci * N_ALIVE = 0x1 (response only, not a command) 4338c2ecf20Sopenharmony_ci * 4348c2ecf20Sopenharmony_ci * uCode issues this "alive" notification once the runtime image is ready 4358c2ecf20Sopenharmony_ci * to receive commands from the driver. This is the *second* "alive" 4368c2ecf20Sopenharmony_ci * notification that the driver will receive after rebooting uCode; 4378c2ecf20Sopenharmony_ci * this "alive" is indicated by subtype field != 9. 4388c2ecf20Sopenharmony_ci * 4398c2ecf20Sopenharmony_ci * See comments documenting "BSM" (bootstrap state machine). 4408c2ecf20Sopenharmony_ci * 4418c2ecf20Sopenharmony_ci * This response includes two pointers to structures within the device's 4428c2ecf20Sopenharmony_ci * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: 4438c2ecf20Sopenharmony_ci * 4448c2ecf20Sopenharmony_ci * 1) log_event_table_ptr indicates base of the event log. This traces 4458c2ecf20Sopenharmony_ci * a 256-entry history of uCode execution within a circular buffer. 4468c2ecf20Sopenharmony_ci * Its header format is: 4478c2ecf20Sopenharmony_ci * 4488c2ecf20Sopenharmony_ci * __le32 log_size; log capacity (in number of entries) 4498c2ecf20Sopenharmony_ci * __le32 type; (1) timestamp with each entry, (0) no timestamp 4508c2ecf20Sopenharmony_ci * __le32 wraps; # times uCode has wrapped to top of circular buffer 4518c2ecf20Sopenharmony_ci * __le32 write_idx; next circular buffer entry that uCode would fill 4528c2ecf20Sopenharmony_ci * 4538c2ecf20Sopenharmony_ci * The header is followed by the circular buffer of log entries. Entries 4548c2ecf20Sopenharmony_ci * with timestamps have the following format: 4558c2ecf20Sopenharmony_ci * 4568c2ecf20Sopenharmony_ci * __le32 event_id; range 0 - 1500 4578c2ecf20Sopenharmony_ci * __le32 timestamp; low 32 bits of TSF (of network, if associated) 4588c2ecf20Sopenharmony_ci * __le32 data; event_id-specific data value 4598c2ecf20Sopenharmony_ci * 4608c2ecf20Sopenharmony_ci * Entries without timestamps contain only event_id and data. 4618c2ecf20Sopenharmony_ci * 4628c2ecf20Sopenharmony_ci * 4638c2ecf20Sopenharmony_ci * 2) error_event_table_ptr indicates base of the error log. This contains 4648c2ecf20Sopenharmony_ci * information about any uCode error that occurs. For 4965, the format 4658c2ecf20Sopenharmony_ci * of the error log is: 4668c2ecf20Sopenharmony_ci * 4678c2ecf20Sopenharmony_ci * __le32 valid; (nonzero) valid, (0) log is empty 4688c2ecf20Sopenharmony_ci * __le32 error_id; type of error 4698c2ecf20Sopenharmony_ci * __le32 pc; program counter 4708c2ecf20Sopenharmony_ci * __le32 blink1; branch link 4718c2ecf20Sopenharmony_ci * __le32 blink2; branch link 4728c2ecf20Sopenharmony_ci * __le32 ilink1; interrupt link 4738c2ecf20Sopenharmony_ci * __le32 ilink2; interrupt link 4748c2ecf20Sopenharmony_ci * __le32 data1; error-specific data 4758c2ecf20Sopenharmony_ci * __le32 data2; error-specific data 4768c2ecf20Sopenharmony_ci * __le32 line; source code line of error 4778c2ecf20Sopenharmony_ci * __le32 bcon_time; beacon timer 4788c2ecf20Sopenharmony_ci * __le32 tsf_low; network timestamp function timer 4798c2ecf20Sopenharmony_ci * __le32 tsf_hi; network timestamp function timer 4808c2ecf20Sopenharmony_ci * __le32 gp1; GP1 timer register 4818c2ecf20Sopenharmony_ci * __le32 gp2; GP2 timer register 4828c2ecf20Sopenharmony_ci * __le32 gp3; GP3 timer register 4838c2ecf20Sopenharmony_ci * __le32 ucode_ver; uCode version 4848c2ecf20Sopenharmony_ci * __le32 hw_ver; HW Silicon version 4858c2ecf20Sopenharmony_ci * __le32 brd_ver; HW board version 4868c2ecf20Sopenharmony_ci * __le32 log_pc; log program counter 4878c2ecf20Sopenharmony_ci * __le32 frame_ptr; frame pointer 4888c2ecf20Sopenharmony_ci * __le32 stack_ptr; stack pointer 4898c2ecf20Sopenharmony_ci * __le32 hcmd; last host command 4908c2ecf20Sopenharmony_ci * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag 4918c2ecf20Sopenharmony_ci * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag 4928c2ecf20Sopenharmony_ci * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag 4938c2ecf20Sopenharmony_ci * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag 4948c2ecf20Sopenharmony_ci * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt 4958c2ecf20Sopenharmony_ci * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT 4968c2ecf20Sopenharmony_ci * __le32 wait_event; wait event() caller address 4978c2ecf20Sopenharmony_ci * __le32 l2p_control; L2pControlField 4988c2ecf20Sopenharmony_ci * __le32 l2p_duration; L2pDurationField 4998c2ecf20Sopenharmony_ci * __le32 l2p_mhvalid; L2pMhValidBits 5008c2ecf20Sopenharmony_ci * __le32 l2p_addr_match; L2pAddrMatchStat 5018c2ecf20Sopenharmony_ci * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL) 5028c2ecf20Sopenharmony_ci * __le32 u_timestamp; indicate when the date and time of the compilation 5038c2ecf20Sopenharmony_ci * __le32 reserved; 5048c2ecf20Sopenharmony_ci * 5058c2ecf20Sopenharmony_ci * The Linux driver can print both logs to the system log when a uCode error 5068c2ecf20Sopenharmony_ci * occurs. 5078c2ecf20Sopenharmony_ci */ 5088c2ecf20Sopenharmony_cistruct il_alive_resp { 5098c2ecf20Sopenharmony_ci u8 ucode_minor; 5108c2ecf20Sopenharmony_ci u8 ucode_major; 5118c2ecf20Sopenharmony_ci __le16 reserved1; 5128c2ecf20Sopenharmony_ci u8 sw_rev[8]; 5138c2ecf20Sopenharmony_ci u8 ver_type; 5148c2ecf20Sopenharmony_ci u8 ver_subtype; /* not "9" for runtime alive */ 5158c2ecf20Sopenharmony_ci __le16 reserved2; 5168c2ecf20Sopenharmony_ci __le32 log_event_table_ptr; /* SRAM address for event log */ 5178c2ecf20Sopenharmony_ci __le32 error_event_table_ptr; /* SRAM address for error log */ 5188c2ecf20Sopenharmony_ci __le32 timestamp; 5198c2ecf20Sopenharmony_ci __le32 is_valid; 5208c2ecf20Sopenharmony_ci} __packed; 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci/* 5238c2ecf20Sopenharmony_ci * N_ERROR = 0x2 (response only, not a command) 5248c2ecf20Sopenharmony_ci */ 5258c2ecf20Sopenharmony_cistruct il_error_resp { 5268c2ecf20Sopenharmony_ci __le32 error_type; 5278c2ecf20Sopenharmony_ci u8 cmd_id; 5288c2ecf20Sopenharmony_ci u8 reserved1; 5298c2ecf20Sopenharmony_ci __le16 bad_cmd_seq_num; 5308c2ecf20Sopenharmony_ci __le32 error_info; 5318c2ecf20Sopenharmony_ci __le64 timestamp; 5328c2ecf20Sopenharmony_ci} __packed; 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci/****************************************************************************** 5358c2ecf20Sopenharmony_ci * (1) 5368c2ecf20Sopenharmony_ci * RXON Commands & Responses: 5378c2ecf20Sopenharmony_ci * 5388c2ecf20Sopenharmony_ci *****************************************************************************/ 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci/* 5418c2ecf20Sopenharmony_ci * Rx config defines & structure 5428c2ecf20Sopenharmony_ci */ 5438c2ecf20Sopenharmony_ci/* rx_config device types */ 5448c2ecf20Sopenharmony_cienum { 5458c2ecf20Sopenharmony_ci RXON_DEV_TYPE_AP = 1, 5468c2ecf20Sopenharmony_ci RXON_DEV_TYPE_ESS = 3, 5478c2ecf20Sopenharmony_ci RXON_DEV_TYPE_IBSS = 4, 5488c2ecf20Sopenharmony_ci RXON_DEV_TYPE_SNIFFER = 6, 5498c2ecf20Sopenharmony_ci}; 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) 5528c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) 5538c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) 5548c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_VALID_POS (1) 5558c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) 5568c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_SEL_POS (4) 5578c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) 5588c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 5598c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) 5608c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_CNT_POS (10) 5618c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) 5628c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_CNT_POS (12) 5638c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) 5648c2ecf20Sopenharmony_ci#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 5658c2ecf20Sopenharmony_ci 5668c2ecf20Sopenharmony_ci/* rx_config flags */ 5678c2ecf20Sopenharmony_ci/* band & modulation selection */ 5688c2ecf20Sopenharmony_ci#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) 5698c2ecf20Sopenharmony_ci#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) 5708c2ecf20Sopenharmony_ci/* auto detection enable */ 5718c2ecf20Sopenharmony_ci#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) 5728c2ecf20Sopenharmony_ci/* TGg protection when tx */ 5738c2ecf20Sopenharmony_ci#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) 5748c2ecf20Sopenharmony_ci/* cck short slot & preamble */ 5758c2ecf20Sopenharmony_ci#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) 5768c2ecf20Sopenharmony_ci#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) 5778c2ecf20Sopenharmony_ci/* antenna selection */ 5788c2ecf20Sopenharmony_ci#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) 5798c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) 5808c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 5818c2ecf20Sopenharmony_ci#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 5828c2ecf20Sopenharmony_ci/* radar detection enable */ 5838c2ecf20Sopenharmony_ci#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) 5848c2ecf20Sopenharmony_ci#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) 5858c2ecf20Sopenharmony_ci/* rx response to host with 8-byte TSF 5868c2ecf20Sopenharmony_ci* (according to ON_AIR deassertion) */ 5878c2ecf20Sopenharmony_ci#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci/* HT flags */ 5908c2ecf20Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) 5918c2ecf20Sopenharmony_ci#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_ci#define RXON_FLG_HT_OPERATING_MODE_POS (23) 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_ci#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) 5968c2ecf20Sopenharmony_ci#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_POS (25) 5998c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_ci/* channel mode */ 6028c2ecf20Sopenharmony_cienum { 6038c2ecf20Sopenharmony_ci CHANNEL_MODE_LEGACY = 0, 6048c2ecf20Sopenharmony_ci CHANNEL_MODE_PURE_40 = 1, 6058c2ecf20Sopenharmony_ci CHANNEL_MODE_MIXED = 2, 6068c2ecf20Sopenharmony_ci CHANNEL_MODE_RESERVED = 3, 6078c2ecf20Sopenharmony_ci}; 6088c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_LEGACY \ 6098c2ecf20Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) 6108c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_PURE_40 \ 6118c2ecf20Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) 6128c2ecf20Sopenharmony_ci#define RXON_FLG_CHANNEL_MODE_MIXED \ 6138c2ecf20Sopenharmony_ci cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci/* CTS to self (if spec allows) flag */ 6168c2ecf20Sopenharmony_ci#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci/* rx_config filter flags */ 6198c2ecf20Sopenharmony_ci/* accept all data frames */ 6208c2ecf20Sopenharmony_ci#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) 6218c2ecf20Sopenharmony_ci/* pass control & management to host */ 6228c2ecf20Sopenharmony_ci#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) 6238c2ecf20Sopenharmony_ci/* accept multi-cast */ 6248c2ecf20Sopenharmony_ci#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) 6258c2ecf20Sopenharmony_ci/* don't decrypt uni-cast frames */ 6268c2ecf20Sopenharmony_ci#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) 6278c2ecf20Sopenharmony_ci/* don't decrypt multi-cast frames */ 6288c2ecf20Sopenharmony_ci#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) 6298c2ecf20Sopenharmony_ci/* STA is associated */ 6308c2ecf20Sopenharmony_ci#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) 6318c2ecf20Sopenharmony_ci/* transfer to host non bssid beacons in associated state */ 6328c2ecf20Sopenharmony_ci#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ci/** 6358c2ecf20Sopenharmony_ci * C_RXON = 0x10 (command, has simple generic response) 6368c2ecf20Sopenharmony_ci * 6378c2ecf20Sopenharmony_ci * RXON tunes the radio tuner to a service channel, and sets up a number 6388c2ecf20Sopenharmony_ci * of parameters that are used primarily for Rx, but also for Tx operations. 6398c2ecf20Sopenharmony_ci * 6408c2ecf20Sopenharmony_ci * NOTE: When tuning to a new channel, driver must set the 6418c2ecf20Sopenharmony_ci * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent 6428c2ecf20Sopenharmony_ci * info within the device, including the station tables, tx retry 6438c2ecf20Sopenharmony_ci * rate tables, and txpower tables. Driver must build a new station 6448c2ecf20Sopenharmony_ci * table and txpower table before transmitting anything on the RXON 6458c2ecf20Sopenharmony_ci * channel. 6468c2ecf20Sopenharmony_ci * 6478c2ecf20Sopenharmony_ci * NOTE: All RXONs wipe clean the internal txpower table. Driver must 6488c2ecf20Sopenharmony_ci * issue a new C_TX_PWR_TBL after each C_RXON (0x10), 6498c2ecf20Sopenharmony_ci * regardless of whether RXON_FILTER_ASSOC_MSK is set. 6508c2ecf20Sopenharmony_ci */ 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_cistruct il3945_rxon_cmd { 6538c2ecf20Sopenharmony_ci u8 node_addr[6]; 6548c2ecf20Sopenharmony_ci __le16 reserved1; 6558c2ecf20Sopenharmony_ci u8 bssid_addr[6]; 6568c2ecf20Sopenharmony_ci __le16 reserved2; 6578c2ecf20Sopenharmony_ci u8 wlap_bssid_addr[6]; 6588c2ecf20Sopenharmony_ci __le16 reserved3; 6598c2ecf20Sopenharmony_ci u8 dev_type; 6608c2ecf20Sopenharmony_ci u8 air_propagation; 6618c2ecf20Sopenharmony_ci __le16 reserved4; 6628c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 6638c2ecf20Sopenharmony_ci u8 cck_basic_rates; 6648c2ecf20Sopenharmony_ci __le16 assoc_id; 6658c2ecf20Sopenharmony_ci __le32 flags; 6668c2ecf20Sopenharmony_ci __le32 filter_flags; 6678c2ecf20Sopenharmony_ci __le16 channel; 6688c2ecf20Sopenharmony_ci __le16 reserved5; 6698c2ecf20Sopenharmony_ci} __packed; 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_cistruct il4965_rxon_cmd { 6728c2ecf20Sopenharmony_ci u8 node_addr[6]; 6738c2ecf20Sopenharmony_ci __le16 reserved1; 6748c2ecf20Sopenharmony_ci u8 bssid_addr[6]; 6758c2ecf20Sopenharmony_ci __le16 reserved2; 6768c2ecf20Sopenharmony_ci u8 wlap_bssid_addr[6]; 6778c2ecf20Sopenharmony_ci __le16 reserved3; 6788c2ecf20Sopenharmony_ci u8 dev_type; 6798c2ecf20Sopenharmony_ci u8 air_propagation; 6808c2ecf20Sopenharmony_ci __le16 rx_chain; 6818c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 6828c2ecf20Sopenharmony_ci u8 cck_basic_rates; 6838c2ecf20Sopenharmony_ci __le16 assoc_id; 6848c2ecf20Sopenharmony_ci __le32 flags; 6858c2ecf20Sopenharmony_ci __le32 filter_flags; 6868c2ecf20Sopenharmony_ci __le16 channel; 6878c2ecf20Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 6888c2ecf20Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 6898c2ecf20Sopenharmony_ci} __packed; 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci/* Create a common rxon cmd which will be typecast into the 3945 or 4965 6928c2ecf20Sopenharmony_ci * specific rxon cmd, depending on where it is called from. 6938c2ecf20Sopenharmony_ci */ 6948c2ecf20Sopenharmony_cistruct il_rxon_cmd { 6958c2ecf20Sopenharmony_ci u8 node_addr[6]; 6968c2ecf20Sopenharmony_ci __le16 reserved1; 6978c2ecf20Sopenharmony_ci u8 bssid_addr[6]; 6988c2ecf20Sopenharmony_ci __le16 reserved2; 6998c2ecf20Sopenharmony_ci u8 wlap_bssid_addr[6]; 7008c2ecf20Sopenharmony_ci __le16 reserved3; 7018c2ecf20Sopenharmony_ci u8 dev_type; 7028c2ecf20Sopenharmony_ci u8 air_propagation; 7038c2ecf20Sopenharmony_ci __le16 rx_chain; 7048c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 7058c2ecf20Sopenharmony_ci u8 cck_basic_rates; 7068c2ecf20Sopenharmony_ci __le16 assoc_id; 7078c2ecf20Sopenharmony_ci __le32 flags; 7088c2ecf20Sopenharmony_ci __le32 filter_flags; 7098c2ecf20Sopenharmony_ci __le16 channel; 7108c2ecf20Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 7118c2ecf20Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 7128c2ecf20Sopenharmony_ci u8 reserved4; 7138c2ecf20Sopenharmony_ci u8 reserved5; 7148c2ecf20Sopenharmony_ci} __packed; 7158c2ecf20Sopenharmony_ci 7168c2ecf20Sopenharmony_ci/* 7178c2ecf20Sopenharmony_ci * C_RXON_ASSOC = 0x11 (command, has simple generic response) 7188c2ecf20Sopenharmony_ci */ 7198c2ecf20Sopenharmony_cistruct il3945_rxon_assoc_cmd { 7208c2ecf20Sopenharmony_ci __le32 flags; 7218c2ecf20Sopenharmony_ci __le32 filter_flags; 7228c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 7238c2ecf20Sopenharmony_ci u8 cck_basic_rates; 7248c2ecf20Sopenharmony_ci __le16 reserved; 7258c2ecf20Sopenharmony_ci} __packed; 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_cistruct il4965_rxon_assoc_cmd { 7288c2ecf20Sopenharmony_ci __le32 flags; 7298c2ecf20Sopenharmony_ci __le32 filter_flags; 7308c2ecf20Sopenharmony_ci u8 ofdm_basic_rates; 7318c2ecf20Sopenharmony_ci u8 cck_basic_rates; 7328c2ecf20Sopenharmony_ci u8 ofdm_ht_single_stream_basic_rates; 7338c2ecf20Sopenharmony_ci u8 ofdm_ht_dual_stream_basic_rates; 7348c2ecf20Sopenharmony_ci __le16 rx_chain_select_flags; 7358c2ecf20Sopenharmony_ci __le16 reserved; 7368c2ecf20Sopenharmony_ci} __packed; 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci#define IL_CONN_MAX_LISTEN_INTERVAL 10 7398c2ecf20Sopenharmony_ci#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ 7408c2ecf20Sopenharmony_ci#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */ 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_ci/* 7438c2ecf20Sopenharmony_ci * C_RXON_TIMING = 0x14 (command, has simple generic response) 7448c2ecf20Sopenharmony_ci */ 7458c2ecf20Sopenharmony_cistruct il_rxon_time_cmd { 7468c2ecf20Sopenharmony_ci __le64 timestamp; 7478c2ecf20Sopenharmony_ci __le16 beacon_interval; 7488c2ecf20Sopenharmony_ci __le16 atim_win; 7498c2ecf20Sopenharmony_ci __le32 beacon_init_val; 7508c2ecf20Sopenharmony_ci __le16 listen_interval; 7518c2ecf20Sopenharmony_ci u8 dtim_period; 7528c2ecf20Sopenharmony_ci u8 delta_cp_bss_tbtts; 7538c2ecf20Sopenharmony_ci} __packed; 7548c2ecf20Sopenharmony_ci 7558c2ecf20Sopenharmony_ci/* 7568c2ecf20Sopenharmony_ci * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 7578c2ecf20Sopenharmony_ci */ 7588c2ecf20Sopenharmony_cistruct il3945_channel_switch_cmd { 7598c2ecf20Sopenharmony_ci u8 band; 7608c2ecf20Sopenharmony_ci u8 expect_beacon; 7618c2ecf20Sopenharmony_ci __le16 channel; 7628c2ecf20Sopenharmony_ci __le32 rxon_flags; 7638c2ecf20Sopenharmony_ci __le32 rxon_filter_flags; 7648c2ecf20Sopenharmony_ci __le32 switch_time; 7658c2ecf20Sopenharmony_ci struct il3945_power_per_rate power[IL_MAX_RATES]; 7668c2ecf20Sopenharmony_ci} __packed; 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_cistruct il4965_channel_switch_cmd { 7698c2ecf20Sopenharmony_ci u8 band; 7708c2ecf20Sopenharmony_ci u8 expect_beacon; 7718c2ecf20Sopenharmony_ci __le16 channel; 7728c2ecf20Sopenharmony_ci __le32 rxon_flags; 7738c2ecf20Sopenharmony_ci __le32 rxon_filter_flags; 7748c2ecf20Sopenharmony_ci __le32 switch_time; 7758c2ecf20Sopenharmony_ci struct il4965_tx_power_db tx_power; 7768c2ecf20Sopenharmony_ci} __packed; 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci/* 7798c2ecf20Sopenharmony_ci * N_CHANNEL_SWITCH = 0x73 (notification only, not a command) 7808c2ecf20Sopenharmony_ci */ 7818c2ecf20Sopenharmony_cistruct il_csa_notification { 7828c2ecf20Sopenharmony_ci __le16 band; 7838c2ecf20Sopenharmony_ci __le16 channel; 7848c2ecf20Sopenharmony_ci __le32 status; /* 0 - OK, 1 - fail */ 7858c2ecf20Sopenharmony_ci} __packed; 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_ci/****************************************************************************** 7888c2ecf20Sopenharmony_ci * (2) 7898c2ecf20Sopenharmony_ci * Quality-of-Service (QOS) Commands & Responses: 7908c2ecf20Sopenharmony_ci * 7918c2ecf20Sopenharmony_ci *****************************************************************************/ 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci/** 7948c2ecf20Sopenharmony_ci * struct il_ac_qos -- QOS timing params for C_QOS_PARAM 7958c2ecf20Sopenharmony_ci * One for each of 4 EDCA access categories in struct il_qosparam_cmd 7968c2ecf20Sopenharmony_ci * 7978c2ecf20Sopenharmony_ci * @cw_min: Contention win, start value in numbers of slots. 7988c2ecf20Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x0f. 7998c2ecf20Sopenharmony_ci * @cw_max: Contention win, max value in numbers of slots. 8008c2ecf20Sopenharmony_ci * Should be a power-of-2, minus 1. Device's default is 0x3f. 8018c2ecf20Sopenharmony_ci * @aifsn: Number of slots in Arbitration Interframe Space (before 8028c2ecf20Sopenharmony_ci * performing random backoff timing prior to Tx). Device default 1. 8038c2ecf20Sopenharmony_ci * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 8048c2ecf20Sopenharmony_ci * 8058c2ecf20Sopenharmony_ci * Device will automatically increase contention win by (2*CW) + 1 for each 8068c2ecf20Sopenharmony_ci * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 8078c2ecf20Sopenharmony_ci * value, to cap the CW value. 8088c2ecf20Sopenharmony_ci */ 8098c2ecf20Sopenharmony_cistruct il_ac_qos { 8108c2ecf20Sopenharmony_ci __le16 cw_min; 8118c2ecf20Sopenharmony_ci __le16 cw_max; 8128c2ecf20Sopenharmony_ci u8 aifsn; 8138c2ecf20Sopenharmony_ci u8 reserved1; 8148c2ecf20Sopenharmony_ci __le16 edca_txop; 8158c2ecf20Sopenharmony_ci} __packed; 8168c2ecf20Sopenharmony_ci 8178c2ecf20Sopenharmony_ci/* QoS flags defines */ 8188c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) 8198c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) 8208c2ecf20Sopenharmony_ci#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci/* Number of Access Categories (AC) (EDCA), queues 0..3 */ 8238c2ecf20Sopenharmony_ci#define AC_NUM 4 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_ci/* 8268c2ecf20Sopenharmony_ci * C_QOS_PARAM = 0x13 (command, has simple generic response) 8278c2ecf20Sopenharmony_ci * 8288c2ecf20Sopenharmony_ci * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs 8298c2ecf20Sopenharmony_ci * 0: Background, 1: Best Effort, 2: Video, 3: Voice. 8308c2ecf20Sopenharmony_ci */ 8318c2ecf20Sopenharmony_cistruct il_qosparam_cmd { 8328c2ecf20Sopenharmony_ci __le32 qos_flags; 8338c2ecf20Sopenharmony_ci struct il_ac_qos ac[AC_NUM]; 8348c2ecf20Sopenharmony_ci} __packed; 8358c2ecf20Sopenharmony_ci 8368c2ecf20Sopenharmony_ci/****************************************************************************** 8378c2ecf20Sopenharmony_ci * (3) 8388c2ecf20Sopenharmony_ci * Add/Modify Stations Commands & Responses: 8398c2ecf20Sopenharmony_ci * 8408c2ecf20Sopenharmony_ci *****************************************************************************/ 8418c2ecf20Sopenharmony_ci/* 8428c2ecf20Sopenharmony_ci * Multi station support 8438c2ecf20Sopenharmony_ci */ 8448c2ecf20Sopenharmony_ci 8458c2ecf20Sopenharmony_ci/* Special, dedicated locations within device's station table */ 8468c2ecf20Sopenharmony_ci#define IL_AP_ID 0 8478c2ecf20Sopenharmony_ci#define IL_STA_ID 2 8488c2ecf20Sopenharmony_ci#define IL3945_BROADCAST_ID 24 8498c2ecf20Sopenharmony_ci#define IL3945_STATION_COUNT 25 8508c2ecf20Sopenharmony_ci#define IL4965_BROADCAST_ID 31 8518c2ecf20Sopenharmony_ci#define IL4965_STATION_COUNT 32 8528c2ecf20Sopenharmony_ci 8538c2ecf20Sopenharmony_ci#define IL_STATION_COUNT 32 /* MAX(3945,4965) */ 8548c2ecf20Sopenharmony_ci#define IL_INVALID_STATION 255 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ci#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) 8578c2ecf20Sopenharmony_ci#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) 8588c2ecf20Sopenharmony_ci#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) 8598c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) 8608c2ecf20Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_POS (19) 8618c2ecf20Sopenharmony_ci#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) 8628c2ecf20Sopenharmony_ci#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) 8638c2ecf20Sopenharmony_ci#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) 8648c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_POS (23) 8658c2ecf20Sopenharmony_ci#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ci/* Use in mode field. 1: modify existing entry, 0: add new station entry */ 8688c2ecf20Sopenharmony_ci#define STA_CONTROL_MODIFY_MSK 0x01 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci/* key flags __le16*/ 8718c2ecf20Sopenharmony_ci#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) 8728c2ecf20Sopenharmony_ci#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) 8738c2ecf20Sopenharmony_ci#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) 8748c2ecf20Sopenharmony_ci#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) 8758c2ecf20Sopenharmony_ci#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci#define STA_KEY_FLG_KEYID_POS 8 8788c2ecf20Sopenharmony_ci#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) 8798c2ecf20Sopenharmony_ci/* wep key is either from global key (0) or from station info array (1) */ 8808c2ecf20Sopenharmony_ci#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ 8838c2ecf20Sopenharmony_ci#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) 8848c2ecf20Sopenharmony_ci#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) 8858c2ecf20Sopenharmony_ci#define STA_KEY_MAX_NUM 8 8868c2ecf20Sopenharmony_ci 8878c2ecf20Sopenharmony_ci/* Flags indicate whether to modify vs. don't change various station params */ 8888c2ecf20Sopenharmony_ci#define STA_MODIFY_KEY_MASK 0x01 8898c2ecf20Sopenharmony_ci#define STA_MODIFY_TID_DISABLE_TX 0x02 8908c2ecf20Sopenharmony_ci#define STA_MODIFY_TX_RATE_MSK 0x04 8918c2ecf20Sopenharmony_ci#define STA_MODIFY_ADDBA_TID_MSK 0x08 8928c2ecf20Sopenharmony_ci#define STA_MODIFY_DELBA_TID_MSK 0x10 8938c2ecf20Sopenharmony_ci#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci/* Receiver address (actually, Rx station's idx into station table), 8968c2ecf20Sopenharmony_ci * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 8978c2ecf20Sopenharmony_ci#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_cistruct il4965_keyinfo { 9008c2ecf20Sopenharmony_ci __le16 key_flags; 9018c2ecf20Sopenharmony_ci u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ 9028c2ecf20Sopenharmony_ci u8 reserved1; 9038c2ecf20Sopenharmony_ci __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ 9048c2ecf20Sopenharmony_ci u8 key_offset; 9058c2ecf20Sopenharmony_ci u8 reserved2; 9068c2ecf20Sopenharmony_ci u8 key[16]; /* 16-byte unicast decryption key */ 9078c2ecf20Sopenharmony_ci} __packed; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci/** 9108c2ecf20Sopenharmony_ci * struct sta_id_modify 9118c2ecf20Sopenharmony_ci * @addr[ETH_ALEN]: station's MAC address 9128c2ecf20Sopenharmony_ci * @sta_id: idx of station in uCode's station table 9138c2ecf20Sopenharmony_ci * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 9148c2ecf20Sopenharmony_ci * 9158c2ecf20Sopenharmony_ci * Driver selects unused table idx when adding new station, 9168c2ecf20Sopenharmony_ci * or the idx to a pre-existing station entry when modifying that station. 9178c2ecf20Sopenharmony_ci * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP). 9188c2ecf20Sopenharmony_ci * 9198c2ecf20Sopenharmony_ci * modify_mask flags select which parameters to modify vs. leave alone. 9208c2ecf20Sopenharmony_ci */ 9218c2ecf20Sopenharmony_cistruct sta_id_modify { 9228c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 9238c2ecf20Sopenharmony_ci __le16 reserved1; 9248c2ecf20Sopenharmony_ci u8 sta_id; 9258c2ecf20Sopenharmony_ci u8 modify_mask; 9268c2ecf20Sopenharmony_ci __le16 reserved2; 9278c2ecf20Sopenharmony_ci} __packed; 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_ci/* 9308c2ecf20Sopenharmony_ci * C_ADD_STA = 0x18 (command) 9318c2ecf20Sopenharmony_ci * 9328c2ecf20Sopenharmony_ci * The device contains an internal table of per-station information, 9338c2ecf20Sopenharmony_ci * with info on security keys, aggregation parameters, and Tx rates for 9348c2ecf20Sopenharmony_ci * initial Tx attempt and any retries (4965 devices uses 9358c2ecf20Sopenharmony_ci * C_TX_LINK_QUALITY_CMD, 9368c2ecf20Sopenharmony_ci * 3945 uses C_RATE_SCALE to set up rate tables). 9378c2ecf20Sopenharmony_ci * 9388c2ecf20Sopenharmony_ci * C_ADD_STA sets up the table entry for one station, either creating 9398c2ecf20Sopenharmony_ci * a new entry, or modifying a pre-existing one. 9408c2ecf20Sopenharmony_ci * 9418c2ecf20Sopenharmony_ci * NOTE: RXON command (without "associated" bit set) wipes the station table 9428c2ecf20Sopenharmony_ci * clean. Moving into RF_KILL state does this also. Driver must set up 9438c2ecf20Sopenharmony_ci * new station table before transmitting anything on the RXON channel 9448c2ecf20Sopenharmony_ci * (except active scans or active measurements; those commands carry 9458c2ecf20Sopenharmony_ci * their own txpower/rate setup data). 9468c2ecf20Sopenharmony_ci * 9478c2ecf20Sopenharmony_ci * When getting started on a new channel, driver must set up the 9488c2ecf20Sopenharmony_ci * IL_BROADCAST_ID entry (last entry in the table). For a client 9498c2ecf20Sopenharmony_ci * station in a BSS, once an AP is selected, driver sets up the AP STA 9508c2ecf20Sopenharmony_ci * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP 9518c2ecf20Sopenharmony_ci * are all that are needed for a BSS client station. If the device is 9528c2ecf20Sopenharmony_ci * used as AP, or in an IBSS network, driver must set up station table 9538c2ecf20Sopenharmony_ci * entries for all STAs in network, starting with idx IL_STA_ID. 9548c2ecf20Sopenharmony_ci */ 9558c2ecf20Sopenharmony_ci 9568c2ecf20Sopenharmony_cistruct il3945_addsta_cmd { 9578c2ecf20Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 9588c2ecf20Sopenharmony_ci u8 reserved[3]; 9598c2ecf20Sopenharmony_ci struct sta_id_modify sta; 9608c2ecf20Sopenharmony_ci struct il4965_keyinfo key; 9618c2ecf20Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 9628c2ecf20Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 9638c2ecf20Sopenharmony_ci 9648c2ecf20Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 9658c2ecf20Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 9668c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 9678c2ecf20Sopenharmony_ci __le16 tid_disable_tx; 9688c2ecf20Sopenharmony_ci 9698c2ecf20Sopenharmony_ci __le16 rate_n_flags; 9708c2ecf20Sopenharmony_ci 9718c2ecf20Sopenharmony_ci /* TID for which to add block-ack support. 9728c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 9738c2ecf20Sopenharmony_ci u8 add_immediate_ba_tid; 9748c2ecf20Sopenharmony_ci 9758c2ecf20Sopenharmony_ci /* TID for which to remove block-ack support. 9768c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 9778c2ecf20Sopenharmony_ci u8 remove_immediate_ba_tid; 9788c2ecf20Sopenharmony_ci 9798c2ecf20Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 9808c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 9818c2ecf20Sopenharmony_ci __le16 add_immediate_ba_ssn; 9828c2ecf20Sopenharmony_ci} __packed; 9838c2ecf20Sopenharmony_ci 9848c2ecf20Sopenharmony_cistruct il4965_addsta_cmd { 9858c2ecf20Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 9868c2ecf20Sopenharmony_ci u8 reserved[3]; 9878c2ecf20Sopenharmony_ci struct sta_id_modify sta; 9888c2ecf20Sopenharmony_ci struct il4965_keyinfo key; 9898c2ecf20Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 9908c2ecf20Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 9918c2ecf20Sopenharmony_ci 9928c2ecf20Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 9938c2ecf20Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 9948c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 9958c2ecf20Sopenharmony_ci __le16 tid_disable_tx; 9968c2ecf20Sopenharmony_ci 9978c2ecf20Sopenharmony_ci __le16 reserved1; 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_ci /* TID for which to add block-ack support. 10008c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 10018c2ecf20Sopenharmony_ci u8 add_immediate_ba_tid; 10028c2ecf20Sopenharmony_ci 10038c2ecf20Sopenharmony_ci /* TID for which to remove block-ack support. 10048c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 10058c2ecf20Sopenharmony_ci u8 remove_immediate_ba_tid; 10068c2ecf20Sopenharmony_ci 10078c2ecf20Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 10088c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 10098c2ecf20Sopenharmony_ci __le16 add_immediate_ba_ssn; 10108c2ecf20Sopenharmony_ci 10118c2ecf20Sopenharmony_ci /* 10128c2ecf20Sopenharmony_ci * Number of packets OK to transmit to station even though 10138c2ecf20Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 10148c2ecf20Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 10158c2ecf20Sopenharmony_ci */ 10168c2ecf20Sopenharmony_ci __le16 sleep_tx_count; 10178c2ecf20Sopenharmony_ci 10188c2ecf20Sopenharmony_ci __le16 reserved2; 10198c2ecf20Sopenharmony_ci} __packed; 10208c2ecf20Sopenharmony_ci 10218c2ecf20Sopenharmony_ci/* Wrapper struct for 3945 and 4965 addsta_cmd structures */ 10228c2ecf20Sopenharmony_cistruct il_addsta_cmd { 10238c2ecf20Sopenharmony_ci u8 mode; /* 1: modify existing, 0: add new station */ 10248c2ecf20Sopenharmony_ci u8 reserved[3]; 10258c2ecf20Sopenharmony_ci struct sta_id_modify sta; 10268c2ecf20Sopenharmony_ci struct il4965_keyinfo key; 10278c2ecf20Sopenharmony_ci __le32 station_flags; /* STA_FLG_* */ 10288c2ecf20Sopenharmony_ci __le32 station_flags_msk; /* STA_FLG_* */ 10298c2ecf20Sopenharmony_ci 10308c2ecf20Sopenharmony_ci /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) 10318c2ecf20Sopenharmony_ci * corresponding to bit (e.g. bit 5 controls TID 5). 10328c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 10338c2ecf20Sopenharmony_ci __le16 tid_disable_tx; 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_ci __le16 rate_n_flags; /* 3945 only */ 10368c2ecf20Sopenharmony_ci 10378c2ecf20Sopenharmony_ci /* TID for which to add block-ack support. 10388c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 10398c2ecf20Sopenharmony_ci u8 add_immediate_ba_tid; 10408c2ecf20Sopenharmony_ci 10418c2ecf20Sopenharmony_ci /* TID for which to remove block-ack support. 10428c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ 10438c2ecf20Sopenharmony_ci u8 remove_immediate_ba_tid; 10448c2ecf20Sopenharmony_ci 10458c2ecf20Sopenharmony_ci /* Starting Sequence Number for added block-ack support. 10468c2ecf20Sopenharmony_ci * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 10478c2ecf20Sopenharmony_ci __le16 add_immediate_ba_ssn; 10488c2ecf20Sopenharmony_ci 10498c2ecf20Sopenharmony_ci /* 10508c2ecf20Sopenharmony_ci * Number of packets OK to transmit to station even though 10518c2ecf20Sopenharmony_ci * it is asleep -- used to synchronise PS-poll and u-APSD 10528c2ecf20Sopenharmony_ci * responses while ucode keeps track of STA sleep state. 10538c2ecf20Sopenharmony_ci */ 10548c2ecf20Sopenharmony_ci __le16 sleep_tx_count; 10558c2ecf20Sopenharmony_ci 10568c2ecf20Sopenharmony_ci __le16 reserved2; 10578c2ecf20Sopenharmony_ci} __packed; 10588c2ecf20Sopenharmony_ci 10598c2ecf20Sopenharmony_ci#define ADD_STA_SUCCESS_MSK 0x1 10608c2ecf20Sopenharmony_ci#define ADD_STA_NO_ROOM_IN_TBL 0x2 10618c2ecf20Sopenharmony_ci#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 10628c2ecf20Sopenharmony_ci#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 10638c2ecf20Sopenharmony_ci/* 10648c2ecf20Sopenharmony_ci * C_ADD_STA = 0x18 (response) 10658c2ecf20Sopenharmony_ci */ 10668c2ecf20Sopenharmony_cistruct il_add_sta_resp { 10678c2ecf20Sopenharmony_ci u8 status; /* ADD_STA_* */ 10688c2ecf20Sopenharmony_ci} __packed; 10698c2ecf20Sopenharmony_ci 10708c2ecf20Sopenharmony_ci#define REM_STA_SUCCESS_MSK 0x1 10718c2ecf20Sopenharmony_ci/* 10728c2ecf20Sopenharmony_ci * C_REM_STA = 0x19 (response) 10738c2ecf20Sopenharmony_ci */ 10748c2ecf20Sopenharmony_cistruct il_rem_sta_resp { 10758c2ecf20Sopenharmony_ci u8 status; 10768c2ecf20Sopenharmony_ci} __packed; 10778c2ecf20Sopenharmony_ci 10788c2ecf20Sopenharmony_ci/* 10798c2ecf20Sopenharmony_ci * C_REM_STA = 0x19 (command) 10808c2ecf20Sopenharmony_ci */ 10818c2ecf20Sopenharmony_cistruct il_rem_sta_cmd { 10828c2ecf20Sopenharmony_ci u8 num_sta; /* number of removed stations */ 10838c2ecf20Sopenharmony_ci u8 reserved[3]; 10848c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; /* MAC addr of the first station */ 10858c2ecf20Sopenharmony_ci u8 reserved2[2]; 10868c2ecf20Sopenharmony_ci} __packed; 10878c2ecf20Sopenharmony_ci 10888c2ecf20Sopenharmony_ci#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) 10898c2ecf20Sopenharmony_ci#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) 10908c2ecf20Sopenharmony_ci#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) 10918c2ecf20Sopenharmony_ci#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) 10928c2ecf20Sopenharmony_ci#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) 10938c2ecf20Sopenharmony_ci 10948c2ecf20Sopenharmony_ci#define IL_DROP_SINGLE 0 10958c2ecf20Sopenharmony_ci#define IL_DROP_SELECTED 1 10968c2ecf20Sopenharmony_ci#define IL_DROP_ALL 2 10978c2ecf20Sopenharmony_ci 10988c2ecf20Sopenharmony_ci/* 10998c2ecf20Sopenharmony_ci * REPLY_WEP_KEY = 0x20 11008c2ecf20Sopenharmony_ci */ 11018c2ecf20Sopenharmony_cistruct il_wep_key { 11028c2ecf20Sopenharmony_ci u8 key_idx; 11038c2ecf20Sopenharmony_ci u8 key_offset; 11048c2ecf20Sopenharmony_ci u8 reserved1[2]; 11058c2ecf20Sopenharmony_ci u8 key_size; 11068c2ecf20Sopenharmony_ci u8 reserved2[3]; 11078c2ecf20Sopenharmony_ci u8 key[16]; 11088c2ecf20Sopenharmony_ci} __packed; 11098c2ecf20Sopenharmony_ci 11108c2ecf20Sopenharmony_cistruct il_wep_cmd { 11118c2ecf20Sopenharmony_ci u8 num_keys; 11128c2ecf20Sopenharmony_ci u8 global_key_type; 11138c2ecf20Sopenharmony_ci u8 flags; 11148c2ecf20Sopenharmony_ci u8 reserved; 11158c2ecf20Sopenharmony_ci struct il_wep_key key[]; 11168c2ecf20Sopenharmony_ci} __packed; 11178c2ecf20Sopenharmony_ci 11188c2ecf20Sopenharmony_ci#define WEP_KEY_WEP_TYPE 1 11198c2ecf20Sopenharmony_ci#define WEP_KEYS_MAX 4 11208c2ecf20Sopenharmony_ci#define WEP_INVALID_OFFSET 0xff 11218c2ecf20Sopenharmony_ci#define WEP_KEY_LEN_64 5 11228c2ecf20Sopenharmony_ci#define WEP_KEY_LEN_128 13 11238c2ecf20Sopenharmony_ci 11248c2ecf20Sopenharmony_ci/****************************************************************************** 11258c2ecf20Sopenharmony_ci * (4) 11268c2ecf20Sopenharmony_ci * Rx Responses: 11278c2ecf20Sopenharmony_ci * 11288c2ecf20Sopenharmony_ci *****************************************************************************/ 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) 11318c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) 11328c2ecf20Sopenharmony_ci 11338c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) 11348c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) 11358c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) 11368c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) 11378c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 11388c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 11398c2ecf20Sopenharmony_ci#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) 11408c2ecf20Sopenharmony_ci 11418c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) 11428c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) 11438c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) 11448c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) 11458c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) 11468c2ecf20Sopenharmony_ci#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) 11478c2ecf20Sopenharmony_ci 11488c2ecf20Sopenharmony_ci#define RX_RES_STATUS_STATION_FOUND (1<<6) 11498c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) 11508c2ecf20Sopenharmony_ci 11518c2ecf20Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) 11528c2ecf20Sopenharmony_ci#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) 11538c2ecf20Sopenharmony_ci#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) 11548c2ecf20Sopenharmony_ci#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) 11558c2ecf20Sopenharmony_ci#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) 11568c2ecf20Sopenharmony_ci 11578c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_ICV_OK (0x20) 11588c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_MIC_OK (0x40) 11598c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 11608c2ecf20Sopenharmony_ci#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 11618c2ecf20Sopenharmony_ci 11628c2ecf20Sopenharmony_cistruct il3945_rx_frame_stats { 11638c2ecf20Sopenharmony_ci u8 phy_count; 11648c2ecf20Sopenharmony_ci u8 id; 11658c2ecf20Sopenharmony_ci u8 rssi; 11668c2ecf20Sopenharmony_ci u8 agc; 11678c2ecf20Sopenharmony_ci __le16 sig_avg; 11688c2ecf20Sopenharmony_ci __le16 noise_diff; 11698c2ecf20Sopenharmony_ci u8 payload[]; 11708c2ecf20Sopenharmony_ci} __packed; 11718c2ecf20Sopenharmony_ci 11728c2ecf20Sopenharmony_cistruct il3945_rx_frame_hdr { 11738c2ecf20Sopenharmony_ci __le16 channel; 11748c2ecf20Sopenharmony_ci __le16 phy_flags; 11758c2ecf20Sopenharmony_ci u8 reserved1; 11768c2ecf20Sopenharmony_ci u8 rate; 11778c2ecf20Sopenharmony_ci __le16 len; 11788c2ecf20Sopenharmony_ci u8 payload[]; 11798c2ecf20Sopenharmony_ci} __packed; 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_cistruct il3945_rx_frame_end { 11828c2ecf20Sopenharmony_ci __le32 status; 11838c2ecf20Sopenharmony_ci __le64 timestamp; 11848c2ecf20Sopenharmony_ci __le32 beacon_timestamp; 11858c2ecf20Sopenharmony_ci} __packed; 11868c2ecf20Sopenharmony_ci 11878c2ecf20Sopenharmony_ci/* 11888c2ecf20Sopenharmony_ci * N_3945_RX = 0x1b (response only, not a command) 11898c2ecf20Sopenharmony_ci * 11908c2ecf20Sopenharmony_ci * NOTE: DO NOT dereference from casts to this structure 11918c2ecf20Sopenharmony_ci * It is provided only for calculating minimum data set size. 11928c2ecf20Sopenharmony_ci * The actual offsets of the hdr and end are dynamic based on 11938c2ecf20Sopenharmony_ci * stats.phy_count 11948c2ecf20Sopenharmony_ci */ 11958c2ecf20Sopenharmony_cistruct il3945_rx_frame { 11968c2ecf20Sopenharmony_ci struct il3945_rx_frame_stats stats; 11978c2ecf20Sopenharmony_ci struct il3945_rx_frame_hdr hdr; 11988c2ecf20Sopenharmony_ci struct il3945_rx_frame_end end; 11998c2ecf20Sopenharmony_ci} __packed; 12008c2ecf20Sopenharmony_ci 12018c2ecf20Sopenharmony_ci#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame)) 12028c2ecf20Sopenharmony_ci 12038c2ecf20Sopenharmony_ci/* Fixed (non-configurable) rx data from phy */ 12048c2ecf20Sopenharmony_ci 12058c2ecf20Sopenharmony_ci#define IL49_RX_RES_PHY_CNT 14 12068c2ecf20Sopenharmony_ci#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 12078c2ecf20Sopenharmony_ci#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 12088c2ecf20Sopenharmony_ci#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 12098c2ecf20Sopenharmony_ci#define IL49_AGC_DB_POS (7) 12108c2ecf20Sopenharmony_cistruct il4965_rx_non_cfg_phy { 12118c2ecf20Sopenharmony_ci __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 12128c2ecf20Sopenharmony_ci __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 12138c2ecf20Sopenharmony_ci u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 12148c2ecf20Sopenharmony_ci u8 pad[]; 12158c2ecf20Sopenharmony_ci} __packed; 12168c2ecf20Sopenharmony_ci 12178c2ecf20Sopenharmony_ci/* 12188c2ecf20Sopenharmony_ci * N_RX = 0xc3 (response only, not a command) 12198c2ecf20Sopenharmony_ci * Used only for legacy (non 11n) frames. 12208c2ecf20Sopenharmony_ci */ 12218c2ecf20Sopenharmony_cistruct il_rx_phy_res { 12228c2ecf20Sopenharmony_ci u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 12238c2ecf20Sopenharmony_ci u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ 12248c2ecf20Sopenharmony_ci u8 stat_id; /* configurable DSP phy data set ID */ 12258c2ecf20Sopenharmony_ci u8 reserved1; 12268c2ecf20Sopenharmony_ci __le64 timestamp; /* TSF at on air rise */ 12278c2ecf20Sopenharmony_ci __le32 beacon_time_stamp; /* beacon at on-air rise */ 12288c2ecf20Sopenharmony_ci __le16 phy_flags; /* general phy flags: band, modulation, ... */ 12298c2ecf20Sopenharmony_ci __le16 channel; /* channel number */ 12308c2ecf20Sopenharmony_ci u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ 12318c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 12328c2ecf20Sopenharmony_ci __le16 byte_count; /* frame's byte-count */ 12338c2ecf20Sopenharmony_ci __le16 frame_time; /* frame's time on the air */ 12348c2ecf20Sopenharmony_ci} __packed; 12358c2ecf20Sopenharmony_ci 12368c2ecf20Sopenharmony_cistruct il_rx_mpdu_res_start { 12378c2ecf20Sopenharmony_ci __le16 byte_count; 12388c2ecf20Sopenharmony_ci __le16 reserved; 12398c2ecf20Sopenharmony_ci} __packed; 12408c2ecf20Sopenharmony_ci 12418c2ecf20Sopenharmony_ci/****************************************************************************** 12428c2ecf20Sopenharmony_ci * (5) 12438c2ecf20Sopenharmony_ci * Tx Commands & Responses: 12448c2ecf20Sopenharmony_ci * 12458c2ecf20Sopenharmony_ci * Driver must place each C_TX command into one of the prioritized Tx 12468c2ecf20Sopenharmony_ci * queues in host DRAM, shared between driver and device (see comments for 12478c2ecf20Sopenharmony_ci * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode 12488c2ecf20Sopenharmony_ci * are preparing to transmit, the device pulls the Tx command over the PCI 12498c2ecf20Sopenharmony_ci * bus via one of the device's Tx DMA channels, to fill an internal FIFO 12508c2ecf20Sopenharmony_ci * from which data will be transmitted. 12518c2ecf20Sopenharmony_ci * 12528c2ecf20Sopenharmony_ci * uCode handles all timing and protocol related to control frames 12538c2ecf20Sopenharmony_ci * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler 12548c2ecf20Sopenharmony_ci * handle reception of block-acks; uCode updates the host driver via 12558c2ecf20Sopenharmony_ci * N_COMPRESSED_BA. 12568c2ecf20Sopenharmony_ci * 12578c2ecf20Sopenharmony_ci * uCode handles retrying Tx when an ACK is expected but not received. 12588c2ecf20Sopenharmony_ci * This includes trying lower data rates than the one requested in the Tx 12598c2ecf20Sopenharmony_ci * command, as set up by the C_RATE_SCALE (for 3945) or 12608c2ecf20Sopenharmony_ci * C_TX_LINK_QUALITY_CMD (4965). 12618c2ecf20Sopenharmony_ci * 12628c2ecf20Sopenharmony_ci * Driver sets up transmit power for various rates via C_TX_PWR_TBL. 12638c2ecf20Sopenharmony_ci * This command must be executed after every RXON command, before Tx can occur. 12648c2ecf20Sopenharmony_ci *****************************************************************************/ 12658c2ecf20Sopenharmony_ci 12668c2ecf20Sopenharmony_ci/* C_TX Tx flags field */ 12678c2ecf20Sopenharmony_ci 12688c2ecf20Sopenharmony_ci/* 12698c2ecf20Sopenharmony_ci * 1: Use Request-To-Send protocol before this frame. 12708c2ecf20Sopenharmony_ci * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. 12718c2ecf20Sopenharmony_ci */ 12728c2ecf20Sopenharmony_ci#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) 12738c2ecf20Sopenharmony_ci 12748c2ecf20Sopenharmony_ci/* 12758c2ecf20Sopenharmony_ci * 1: Transmit Clear-To-Send to self before this frame. 12768c2ecf20Sopenharmony_ci * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. 12778c2ecf20Sopenharmony_ci * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. 12788c2ecf20Sopenharmony_ci */ 12798c2ecf20Sopenharmony_ci#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_ci/* 1: Expect ACK from receiving station 12828c2ecf20Sopenharmony_ci * 0: Don't expect ACK (MAC header's duration field s/b 0) 12838c2ecf20Sopenharmony_ci * Set this for unicast frames, but not broadcast/multicast. */ 12848c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) 12858c2ecf20Sopenharmony_ci 12868c2ecf20Sopenharmony_ci/* For 4965 devices: 12878c2ecf20Sopenharmony_ci * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD). 12888c2ecf20Sopenharmony_ci * Tx command's initial_rate_idx indicates first rate to try; 12898c2ecf20Sopenharmony_ci * uCode walks through table for additional Tx attempts. 12908c2ecf20Sopenharmony_ci * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 12918c2ecf20Sopenharmony_ci * This rate will be used for all Tx attempts; it will not be scaled. */ 12928c2ecf20Sopenharmony_ci#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) 12938c2ecf20Sopenharmony_ci 12948c2ecf20Sopenharmony_ci/* 1: Expect immediate block-ack. 12958c2ecf20Sopenharmony_ci * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ 12968c2ecf20Sopenharmony_ci#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) 12978c2ecf20Sopenharmony_ci 12988c2ecf20Sopenharmony_ci/* 12998c2ecf20Sopenharmony_ci * 1: Frame requires full Tx-Op protection. 13008c2ecf20Sopenharmony_ci * Set this if either RTS or CTS Tx Flag gets set. 13018c2ecf20Sopenharmony_ci */ 13028c2ecf20Sopenharmony_ci#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) 13038c2ecf20Sopenharmony_ci 13048c2ecf20Sopenharmony_ci/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices. 13058c2ecf20Sopenharmony_ci * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ 13068c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) 13078c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) 13088c2ecf20Sopenharmony_ci#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) 13098c2ecf20Sopenharmony_ci 13108c2ecf20Sopenharmony_ci/* 1: uCode overrides sequence control field in MAC header. 13118c2ecf20Sopenharmony_ci * 0: Driver provides sequence control field in MAC header. 13128c2ecf20Sopenharmony_ci * Set this for management frames, non-QOS data frames, non-unicast frames, 13138c2ecf20Sopenharmony_ci * and also in Tx command embedded in C_SCAN for active scans. */ 13148c2ecf20Sopenharmony_ci#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) 13158c2ecf20Sopenharmony_ci 13168c2ecf20Sopenharmony_ci/* 1: This frame is non-last MPDU; more fragments are coming. 13178c2ecf20Sopenharmony_ci * 0: Last fragment, or not using fragmentation. */ 13188c2ecf20Sopenharmony_ci#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) 13198c2ecf20Sopenharmony_ci 13208c2ecf20Sopenharmony_ci/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. 13218c2ecf20Sopenharmony_ci * 0: No TSF required in outgoing frame. 13228c2ecf20Sopenharmony_ci * Set this for transmitting beacons and probe responses. */ 13238c2ecf20Sopenharmony_ci#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_ci/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword 13268c2ecf20Sopenharmony_ci * alignment of frame's payload data field. 13278c2ecf20Sopenharmony_ci * 0: No pad 13288c2ecf20Sopenharmony_ci * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 13298c2ecf20Sopenharmony_ci * field (but not both). Driver must align frame data (i.e. data following 13308c2ecf20Sopenharmony_ci * MAC header) to DWORD boundary. */ 13318c2ecf20Sopenharmony_ci#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) 13328c2ecf20Sopenharmony_ci 13338c2ecf20Sopenharmony_ci/* accelerate aggregation support 13348c2ecf20Sopenharmony_ci * 0 - no CCMP encryption; 1 - CCMP encryption */ 13358c2ecf20Sopenharmony_ci#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) 13368c2ecf20Sopenharmony_ci 13378c2ecf20Sopenharmony_ci/* HCCA-AP - disable duration overwriting. */ 13388c2ecf20Sopenharmony_ci#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) 13398c2ecf20Sopenharmony_ci 13408c2ecf20Sopenharmony_ci/* 13418c2ecf20Sopenharmony_ci * TX command security control 13428c2ecf20Sopenharmony_ci */ 13438c2ecf20Sopenharmony_ci#define TX_CMD_SEC_WEP 0x01 13448c2ecf20Sopenharmony_ci#define TX_CMD_SEC_CCM 0x02 13458c2ecf20Sopenharmony_ci#define TX_CMD_SEC_TKIP 0x03 13468c2ecf20Sopenharmony_ci#define TX_CMD_SEC_MSK 0x03 13478c2ecf20Sopenharmony_ci#define TX_CMD_SEC_SHIFT 6 13488c2ecf20Sopenharmony_ci#define TX_CMD_SEC_KEY128 0x08 13498c2ecf20Sopenharmony_ci 13508c2ecf20Sopenharmony_ci/* 13518c2ecf20Sopenharmony_ci * C_TX = 0x1c (command) 13528c2ecf20Sopenharmony_ci */ 13538c2ecf20Sopenharmony_ci 13548c2ecf20Sopenharmony_cistruct il3945_tx_cmd { 13558c2ecf20Sopenharmony_ci /* 13568c2ecf20Sopenharmony_ci * MPDU byte count: 13578c2ecf20Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 13588c2ecf20Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 13598c2ecf20Sopenharmony_ci * + Data payload 13608c2ecf20Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 13618c2ecf20Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 13628c2ecf20Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 13638c2ecf20Sopenharmony_ci * Range: 14-2342 bytes. 13648c2ecf20Sopenharmony_ci */ 13658c2ecf20Sopenharmony_ci __le16 len; 13668c2ecf20Sopenharmony_ci 13678c2ecf20Sopenharmony_ci /* 13688c2ecf20Sopenharmony_ci * MPDU or MSDU byte count for next frame. 13698c2ecf20Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 13708c2ecf20Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 13718c2ecf20Sopenharmony_ci */ 13728c2ecf20Sopenharmony_ci __le16 next_frame_len; 13738c2ecf20Sopenharmony_ci 13748c2ecf20Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 13758c2ecf20Sopenharmony_ci 13768c2ecf20Sopenharmony_ci u8 rate; 13778c2ecf20Sopenharmony_ci 13788c2ecf20Sopenharmony_ci /* Index of recipient station in uCode's station table */ 13798c2ecf20Sopenharmony_ci u8 sta_id; 13808c2ecf20Sopenharmony_ci u8 tid_tspec; 13818c2ecf20Sopenharmony_ci u8 sec_ctl; 13828c2ecf20Sopenharmony_ci u8 key[16]; 13838c2ecf20Sopenharmony_ci union { 13848c2ecf20Sopenharmony_ci u8 byte[8]; 13858c2ecf20Sopenharmony_ci __le16 word[4]; 13868c2ecf20Sopenharmony_ci __le32 dw[2]; 13878c2ecf20Sopenharmony_ci } tkip_mic; 13888c2ecf20Sopenharmony_ci __le32 next_frame_info; 13898c2ecf20Sopenharmony_ci union { 13908c2ecf20Sopenharmony_ci __le32 life_time; 13918c2ecf20Sopenharmony_ci __le32 attempt; 13928c2ecf20Sopenharmony_ci } stop_time; 13938c2ecf20Sopenharmony_ci u8 supp_rates[2]; 13948c2ecf20Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 13958c2ecf20Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 13968c2ecf20Sopenharmony_ci union { 13978c2ecf20Sopenharmony_ci __le16 pm_frame_timeout; 13988c2ecf20Sopenharmony_ci __le16 attempt_duration; 13998c2ecf20Sopenharmony_ci } timeout; 14008c2ecf20Sopenharmony_ci 14018c2ecf20Sopenharmony_ci /* 14028c2ecf20Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 14038c2ecf20Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 14048c2ecf20Sopenharmony_ci */ 14058c2ecf20Sopenharmony_ci __le16 driver_txop; 14068c2ecf20Sopenharmony_ci 14078c2ecf20Sopenharmony_ci /* 14088c2ecf20Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 14098c2ecf20Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 14108c2ecf20Sopenharmony_ci */ 14118c2ecf20Sopenharmony_ci u8 payload[0]; 14128c2ecf20Sopenharmony_ci struct ieee80211_hdr hdr[]; 14138c2ecf20Sopenharmony_ci} __packed; 14148c2ecf20Sopenharmony_ci 14158c2ecf20Sopenharmony_ci/* 14168c2ecf20Sopenharmony_ci * C_TX = 0x1c (response) 14178c2ecf20Sopenharmony_ci */ 14188c2ecf20Sopenharmony_cistruct il3945_tx_resp { 14198c2ecf20Sopenharmony_ci u8 failure_rts; 14208c2ecf20Sopenharmony_ci u8 failure_frame; 14218c2ecf20Sopenharmony_ci u8 bt_kill_count; 14228c2ecf20Sopenharmony_ci u8 rate; 14238c2ecf20Sopenharmony_ci __le32 wireless_media_time; 14248c2ecf20Sopenharmony_ci __le32 status; /* TX status */ 14258c2ecf20Sopenharmony_ci} __packed; 14268c2ecf20Sopenharmony_ci 14278c2ecf20Sopenharmony_ci/* 14288c2ecf20Sopenharmony_ci * 4965 uCode updates these Tx attempt count values in host DRAM. 14298c2ecf20Sopenharmony_ci * Used for managing Tx retries when expecting block-acks. 14308c2ecf20Sopenharmony_ci * Driver should set these fields to 0. 14318c2ecf20Sopenharmony_ci */ 14328c2ecf20Sopenharmony_cistruct il_dram_scratch { 14338c2ecf20Sopenharmony_ci u8 try_cnt; /* Tx attempts */ 14348c2ecf20Sopenharmony_ci u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ 14358c2ecf20Sopenharmony_ci __le16 reserved; 14368c2ecf20Sopenharmony_ci} __packed; 14378c2ecf20Sopenharmony_ci 14388c2ecf20Sopenharmony_cistruct il_tx_cmd { 14398c2ecf20Sopenharmony_ci /* 14408c2ecf20Sopenharmony_ci * MPDU byte count: 14418c2ecf20Sopenharmony_ci * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, 14428c2ecf20Sopenharmony_ci * + 8 byte IV for CCM or TKIP (not used for WEP) 14438c2ecf20Sopenharmony_ci * + Data payload 14448c2ecf20Sopenharmony_ci * + 8-byte MIC (not used for CCM/WEP) 14458c2ecf20Sopenharmony_ci * NOTE: Does not include Tx command bytes, post-MAC pad bytes, 14468c2ecf20Sopenharmony_ci * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i 14478c2ecf20Sopenharmony_ci * Range: 14-2342 bytes. 14488c2ecf20Sopenharmony_ci */ 14498c2ecf20Sopenharmony_ci __le16 len; 14508c2ecf20Sopenharmony_ci 14518c2ecf20Sopenharmony_ci /* 14528c2ecf20Sopenharmony_ci * MPDU or MSDU byte count for next frame. 14538c2ecf20Sopenharmony_ci * Used for fragmentation and bursting, but not 11n aggregation. 14548c2ecf20Sopenharmony_ci * Same as "len", but for next frame. Set to 0 if not applicable. 14558c2ecf20Sopenharmony_ci */ 14568c2ecf20Sopenharmony_ci __le16 next_frame_len; 14578c2ecf20Sopenharmony_ci 14588c2ecf20Sopenharmony_ci __le32 tx_flags; /* TX_CMD_FLG_* */ 14598c2ecf20Sopenharmony_ci 14608c2ecf20Sopenharmony_ci /* uCode may modify this field of the Tx command (in host DRAM!). 14618c2ecf20Sopenharmony_ci * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ 14628c2ecf20Sopenharmony_ci struct il_dram_scratch scratch; 14638c2ecf20Sopenharmony_ci 14648c2ecf20Sopenharmony_ci /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ 14658c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 14668c2ecf20Sopenharmony_ci 14678c2ecf20Sopenharmony_ci /* Index of destination station in uCode's station table */ 14688c2ecf20Sopenharmony_ci u8 sta_id; 14698c2ecf20Sopenharmony_ci 14708c2ecf20Sopenharmony_ci /* Type of security encryption: CCM or TKIP */ 14718c2ecf20Sopenharmony_ci u8 sec_ctl; /* TX_CMD_SEC_* */ 14728c2ecf20Sopenharmony_ci 14738c2ecf20Sopenharmony_ci /* 14748c2ecf20Sopenharmony_ci * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial 14758c2ecf20Sopenharmony_ci * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for 14768c2ecf20Sopenharmony_ci * data frames, this field may be used to selectively reduce initial 14778c2ecf20Sopenharmony_ci * rate (via non-0 value) for special frames (e.g. management), while 14788c2ecf20Sopenharmony_ci * still supporting rate scaling for all frames. 14798c2ecf20Sopenharmony_ci */ 14808c2ecf20Sopenharmony_ci u8 initial_rate_idx; 14818c2ecf20Sopenharmony_ci u8 reserved; 14828c2ecf20Sopenharmony_ci u8 key[16]; 14838c2ecf20Sopenharmony_ci __le16 next_frame_flags; 14848c2ecf20Sopenharmony_ci __le16 reserved2; 14858c2ecf20Sopenharmony_ci union { 14868c2ecf20Sopenharmony_ci __le32 life_time; 14878c2ecf20Sopenharmony_ci __le32 attempt; 14888c2ecf20Sopenharmony_ci } stop_time; 14898c2ecf20Sopenharmony_ci 14908c2ecf20Sopenharmony_ci /* Host DRAM physical address pointer to "scratch" in this command. 14918c2ecf20Sopenharmony_ci * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ 14928c2ecf20Sopenharmony_ci __le32 dram_lsb_ptr; 14938c2ecf20Sopenharmony_ci u8 dram_msb_ptr; 14948c2ecf20Sopenharmony_ci 14958c2ecf20Sopenharmony_ci u8 rts_retry_limit; /*byte 50 */ 14968c2ecf20Sopenharmony_ci u8 data_retry_limit; /*byte 51 */ 14978c2ecf20Sopenharmony_ci u8 tid_tspec; 14988c2ecf20Sopenharmony_ci union { 14998c2ecf20Sopenharmony_ci __le16 pm_frame_timeout; 15008c2ecf20Sopenharmony_ci __le16 attempt_duration; 15018c2ecf20Sopenharmony_ci } timeout; 15028c2ecf20Sopenharmony_ci 15038c2ecf20Sopenharmony_ci /* 15048c2ecf20Sopenharmony_ci * Duration of EDCA burst Tx Opportunity, in 32-usec units. 15058c2ecf20Sopenharmony_ci * Set this if txop time is not specified by HCCA protocol (e.g. by AP). 15068c2ecf20Sopenharmony_ci */ 15078c2ecf20Sopenharmony_ci __le16 driver_txop; 15088c2ecf20Sopenharmony_ci 15098c2ecf20Sopenharmony_ci /* 15108c2ecf20Sopenharmony_ci * MAC header goes here, followed by 2 bytes padding if MAC header 15118c2ecf20Sopenharmony_ci * length is 26 or 30 bytes, followed by payload data 15128c2ecf20Sopenharmony_ci */ 15138c2ecf20Sopenharmony_ci u8 payload[0]; 15148c2ecf20Sopenharmony_ci struct ieee80211_hdr hdr[]; 15158c2ecf20Sopenharmony_ci} __packed; 15168c2ecf20Sopenharmony_ci 15178c2ecf20Sopenharmony_ci/* TX command response is sent after *3945* transmission attempts. 15188c2ecf20Sopenharmony_ci * 15198c2ecf20Sopenharmony_ci * NOTES: 15208c2ecf20Sopenharmony_ci * 15218c2ecf20Sopenharmony_ci * TX_STATUS_FAIL_NEXT_FRAG 15228c2ecf20Sopenharmony_ci * 15238c2ecf20Sopenharmony_ci * If the fragment flag in the MAC header for the frame being transmitted 15248c2ecf20Sopenharmony_ci * is set and there is insufficient time to transmit the next frame, the 15258c2ecf20Sopenharmony_ci * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. 15268c2ecf20Sopenharmony_ci * 15278c2ecf20Sopenharmony_ci * TX_STATUS_FIFO_UNDERRUN 15288c2ecf20Sopenharmony_ci * 15298c2ecf20Sopenharmony_ci * Indicates the host did not provide bytes to the FIFO fast enough while 15308c2ecf20Sopenharmony_ci * a TX was in progress. 15318c2ecf20Sopenharmony_ci * 15328c2ecf20Sopenharmony_ci * TX_STATUS_FAIL_MGMNT_ABORT 15338c2ecf20Sopenharmony_ci * 15348c2ecf20Sopenharmony_ci * This status is only possible if the ABORT ON MGMT RX parameter was 15358c2ecf20Sopenharmony_ci * set to true with the TX command. 15368c2ecf20Sopenharmony_ci * 15378c2ecf20Sopenharmony_ci * If the MSB of the status parameter is set then an abort sequence is 15388c2ecf20Sopenharmony_ci * required. This sequence consists of the host activating the TX Abort 15398c2ecf20Sopenharmony_ci * control line, and then waiting for the TX Abort command response. This 15408c2ecf20Sopenharmony_ci * indicates that a the device is no longer in a transmit state, and that the 15418c2ecf20Sopenharmony_ci * command FIFO has been cleared. The host must then deactivate the TX Abort 15428c2ecf20Sopenharmony_ci * control line. Receiving is still allowed in this case. 15438c2ecf20Sopenharmony_ci */ 15448c2ecf20Sopenharmony_cienum { 15458c2ecf20Sopenharmony_ci TX_3945_STATUS_SUCCESS = 0x01, 15468c2ecf20Sopenharmony_ci TX_3945_STATUS_DIRECT_DONE = 0x02, 15478c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82, 15488c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83, 15498c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 15508c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85, 15518c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86, 15528c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87, 15538c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_DEST_PS = 0x88, 15548c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_ABORTED = 0x89, 15558c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_BT_RETRY = 0x8a, 15568c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_STA_INVALID = 0x8b, 15578c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c, 15588c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d, 15598c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e, 15608c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 15618c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_TX_LOCKED = 0x90, 15628c2ecf20Sopenharmony_ci TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 15638c2ecf20Sopenharmony_ci}; 15648c2ecf20Sopenharmony_ci 15658c2ecf20Sopenharmony_ci/* 15668c2ecf20Sopenharmony_ci * TX command response is sent after *4965* transmission attempts. 15678c2ecf20Sopenharmony_ci * 15688c2ecf20Sopenharmony_ci * both postpone and abort status are expected behavior from uCode. there is 15698c2ecf20Sopenharmony_ci * no special operation required from driver; except for RFKILL_FLUSH, 15708c2ecf20Sopenharmony_ci * which required tx flush host command to flush all the tx frames in queues 15718c2ecf20Sopenharmony_ci */ 15728c2ecf20Sopenharmony_cienum { 15738c2ecf20Sopenharmony_ci TX_STATUS_SUCCESS = 0x01, 15748c2ecf20Sopenharmony_ci TX_STATUS_DIRECT_DONE = 0x02, 15758c2ecf20Sopenharmony_ci /* postpone TX */ 15768c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_DELAY = 0x40, 15778c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_FEW_BYTES = 0x41, 15788c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, 15798c2ecf20Sopenharmony_ci TX_STATUS_POSTPONE_CALC_TTAK = 0x44, 15808c2ecf20Sopenharmony_ci /* abort TX */ 15818c2ecf20Sopenharmony_ci TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, 15828c2ecf20Sopenharmony_ci TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 15838c2ecf20Sopenharmony_ci TX_STATUS_FAIL_LONG_LIMIT = 0x83, 15848c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, 15858c2ecf20Sopenharmony_ci TX_STATUS_FAIL_DRAIN_FLOW = 0x85, 15868c2ecf20Sopenharmony_ci TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, 15878c2ecf20Sopenharmony_ci TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 15888c2ecf20Sopenharmony_ci TX_STATUS_FAIL_DEST_PS = 0x88, 15898c2ecf20Sopenharmony_ci TX_STATUS_FAIL_HOST_ABORTED = 0x89, 15908c2ecf20Sopenharmony_ci TX_STATUS_FAIL_BT_RETRY = 0x8a, 15918c2ecf20Sopenharmony_ci TX_STATUS_FAIL_STA_INVALID = 0x8b, 15928c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 15938c2ecf20Sopenharmony_ci TX_STATUS_FAIL_TID_DISABLE = 0x8d, 15948c2ecf20Sopenharmony_ci TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, 15958c2ecf20Sopenharmony_ci TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, 15968c2ecf20Sopenharmony_ci TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, 15978c2ecf20Sopenharmony_ci TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, 15988c2ecf20Sopenharmony_ci}; 15998c2ecf20Sopenharmony_ci 16008c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_REGULAR 0x0000 16018c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_BURST_SEQ 0x0100 16028c2ecf20Sopenharmony_ci#define TX_PACKET_MODE_BURST_FIRST 0x0200 16038c2ecf20Sopenharmony_ci 16048c2ecf20Sopenharmony_cienum { 16058c2ecf20Sopenharmony_ci TX_POWER_PA_NOT_ACTIVE = 0x0, 16068c2ecf20Sopenharmony_ci}; 16078c2ecf20Sopenharmony_ci 16088c2ecf20Sopenharmony_cienum { 16098c2ecf20Sopenharmony_ci TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ 16108c2ecf20Sopenharmony_ci TX_STATUS_DELAY_MSK = 0x00000040, 16118c2ecf20Sopenharmony_ci TX_STATUS_ABORT_MSK = 0x00000080, 16128c2ecf20Sopenharmony_ci TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ 16138c2ecf20Sopenharmony_ci TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ 16148c2ecf20Sopenharmony_ci TX_RESERVED = 0x00780000, /* bits 19:22 */ 16158c2ecf20Sopenharmony_ci TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ 16168c2ecf20Sopenharmony_ci TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 16178c2ecf20Sopenharmony_ci}; 16188c2ecf20Sopenharmony_ci 16198c2ecf20Sopenharmony_ci/* ******************************* 16208c2ecf20Sopenharmony_ci * TX aggregation status 16218c2ecf20Sopenharmony_ci ******************************* */ 16228c2ecf20Sopenharmony_ci 16238c2ecf20Sopenharmony_cienum { 16248c2ecf20Sopenharmony_ci AGG_TX_STATE_TRANSMITTED = 0x00, 16258c2ecf20Sopenharmony_ci AGG_TX_STATE_UNDERRUN_MSK = 0x01, 16268c2ecf20Sopenharmony_ci AGG_TX_STATE_FEW_BYTES_MSK = 0x04, 16278c2ecf20Sopenharmony_ci AGG_TX_STATE_ABORT_MSK = 0x08, 16288c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, 16298c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, 16308c2ecf20Sopenharmony_ci AGG_TX_STATE_SCD_QUERY_MSK = 0x80, 16318c2ecf20Sopenharmony_ci AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, 16328c2ecf20Sopenharmony_ci AGG_TX_STATE_RESPONSE_MSK = 0x1ff, 16338c2ecf20Sopenharmony_ci AGG_TX_STATE_DUMP_TX_MSK = 0x200, 16348c2ecf20Sopenharmony_ci AGG_TX_STATE_DELAY_TX_MSK = 0x400 16358c2ecf20Sopenharmony_ci}; 16368c2ecf20Sopenharmony_ci 16378c2ecf20Sopenharmony_ci#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ 16388c2ecf20Sopenharmony_ci#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ 16398c2ecf20Sopenharmony_ci 16408c2ecf20Sopenharmony_ci#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ 16418c2ecf20Sopenharmony_ci AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK) 16428c2ecf20Sopenharmony_ci 16438c2ecf20Sopenharmony_ci/* # tx attempts for first frame in aggregation */ 16448c2ecf20Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_POS 12 16458c2ecf20Sopenharmony_ci#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 16468c2ecf20Sopenharmony_ci 16478c2ecf20Sopenharmony_ci/* Command ID and sequence number of Tx command for this frame */ 16488c2ecf20Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_POS 16 16498c2ecf20Sopenharmony_ci#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 16508c2ecf20Sopenharmony_ci 16518c2ecf20Sopenharmony_ci/* 16528c2ecf20Sopenharmony_ci * C_TX = 0x1c (response) 16538c2ecf20Sopenharmony_ci * 16548c2ecf20Sopenharmony_ci * This response may be in one of two slightly different formats, indicated 16558c2ecf20Sopenharmony_ci * by the frame_count field: 16568c2ecf20Sopenharmony_ci * 16578c2ecf20Sopenharmony_ci * 1) No aggregation (frame_count == 1). This reports Tx results for 16588c2ecf20Sopenharmony_ci * a single frame. Multiple attempts, at various bit rates, may have 16598c2ecf20Sopenharmony_ci * been made for this frame. 16608c2ecf20Sopenharmony_ci * 16618c2ecf20Sopenharmony_ci * 2) Aggregation (frame_count > 1). This reports Tx results for 16628c2ecf20Sopenharmony_ci * 2 or more frames that used block-acknowledge. All frames were 16638c2ecf20Sopenharmony_ci * transmitted at same rate. Rate scaling may have been used if first 16648c2ecf20Sopenharmony_ci * frame in this new agg block failed in previous agg block(s). 16658c2ecf20Sopenharmony_ci * 16668c2ecf20Sopenharmony_ci * Note that, for aggregation, ACK (block-ack) status is not delivered here; 16678c2ecf20Sopenharmony_ci * block-ack has not been received by the time the 4965 device records 16688c2ecf20Sopenharmony_ci * this status. 16698c2ecf20Sopenharmony_ci * This status relates to reasons the tx might have been blocked or aborted 16708c2ecf20Sopenharmony_ci * within the sending station (this 4965 device), rather than whether it was 16718c2ecf20Sopenharmony_ci * received successfully by the destination station. 16728c2ecf20Sopenharmony_ci */ 16738c2ecf20Sopenharmony_cistruct agg_tx_status { 16748c2ecf20Sopenharmony_ci __le16 status; 16758c2ecf20Sopenharmony_ci __le16 sequence; 16768c2ecf20Sopenharmony_ci} __packed; 16778c2ecf20Sopenharmony_ci 16788c2ecf20Sopenharmony_cistruct il4965_tx_resp { 16798c2ecf20Sopenharmony_ci u8 frame_count; /* 1 no aggregation, >1 aggregation */ 16808c2ecf20Sopenharmony_ci u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ 16818c2ecf20Sopenharmony_ci u8 failure_rts; /* # failures due to unsuccessful RTS */ 16828c2ecf20Sopenharmony_ci u8 failure_frame; /* # failures due to no ACK (unused for agg) */ 16838c2ecf20Sopenharmony_ci 16848c2ecf20Sopenharmony_ci /* For non-agg: Rate at which frame was successful. 16858c2ecf20Sopenharmony_ci * For agg: Rate at which all frames were transmitted. */ 16868c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_* */ 16878c2ecf20Sopenharmony_ci 16888c2ecf20Sopenharmony_ci /* For non-agg: RTS + CTS + frame tx attempts time + ACK. 16898c2ecf20Sopenharmony_ci * For agg: RTS + CTS + aggregation tx time + block-ack time. */ 16908c2ecf20Sopenharmony_ci __le16 wireless_media_time; /* uSecs */ 16918c2ecf20Sopenharmony_ci 16928c2ecf20Sopenharmony_ci __le16 reserved; 16938c2ecf20Sopenharmony_ci __le32 pa_power1; /* RF power amplifier measurement (not used) */ 16948c2ecf20Sopenharmony_ci __le32 pa_power2; 16958c2ecf20Sopenharmony_ci 16968c2ecf20Sopenharmony_ci /* 16978c2ecf20Sopenharmony_ci * For non-agg: frame status TX_STATUS_* 16988c2ecf20Sopenharmony_ci * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status 16998c2ecf20Sopenharmony_ci * fields follow this one, up to frame_count. 17008c2ecf20Sopenharmony_ci * Bit fields: 17018c2ecf20Sopenharmony_ci * 11- 0: AGG_TX_STATE_* status code 17028c2ecf20Sopenharmony_ci * 15-12: Retry count for 1st frame in aggregation (retries 17038c2ecf20Sopenharmony_ci * occur if tx failed for this frame when it was a 17048c2ecf20Sopenharmony_ci * member of a previous aggregation block). If rate 17058c2ecf20Sopenharmony_ci * scaling is used, retry count indicates the rate 17068c2ecf20Sopenharmony_ci * table entry used for all frames in the new agg. 17078c2ecf20Sopenharmony_ci * 31-16: Sequence # for this frame's Tx cmd (not SSN!) 17088c2ecf20Sopenharmony_ci */ 17098c2ecf20Sopenharmony_ci union { 17108c2ecf20Sopenharmony_ci __le32 status; 17118c2ecf20Sopenharmony_ci struct agg_tx_status agg_status[0]; /* for each agg frame */ 17128c2ecf20Sopenharmony_ci } u; 17138c2ecf20Sopenharmony_ci} __packed; 17148c2ecf20Sopenharmony_ci 17158c2ecf20Sopenharmony_ci/* 17168c2ecf20Sopenharmony_ci * N_COMPRESSED_BA = 0xc5 (response only, not a command) 17178c2ecf20Sopenharmony_ci * 17188c2ecf20Sopenharmony_ci * Reports Block-Acknowledge from recipient station 17198c2ecf20Sopenharmony_ci */ 17208c2ecf20Sopenharmony_cistruct il_compressed_ba_resp { 17218c2ecf20Sopenharmony_ci __le32 sta_addr_lo32; 17228c2ecf20Sopenharmony_ci __le16 sta_addr_hi16; 17238c2ecf20Sopenharmony_ci __le16 reserved; 17248c2ecf20Sopenharmony_ci 17258c2ecf20Sopenharmony_ci /* Index of recipient (BA-sending) station in uCode's station table */ 17268c2ecf20Sopenharmony_ci u8 sta_id; 17278c2ecf20Sopenharmony_ci u8 tid; 17288c2ecf20Sopenharmony_ci __le16 seq_ctl; 17298c2ecf20Sopenharmony_ci __le64 bitmap; 17308c2ecf20Sopenharmony_ci __le16 scd_flow; 17318c2ecf20Sopenharmony_ci __le16 scd_ssn; 17328c2ecf20Sopenharmony_ci} __packed; 17338c2ecf20Sopenharmony_ci 17348c2ecf20Sopenharmony_ci/* 17358c2ecf20Sopenharmony_ci * C_TX_PWR_TBL = 0x97 (command, has simple generic response) 17368c2ecf20Sopenharmony_ci * 17378c2ecf20Sopenharmony_ci * See details under "TXPOWER" in 4965.h. 17388c2ecf20Sopenharmony_ci */ 17398c2ecf20Sopenharmony_ci 17408c2ecf20Sopenharmony_cistruct il3945_txpowertable_cmd { 17418c2ecf20Sopenharmony_ci u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 17428c2ecf20Sopenharmony_ci u8 reserved; 17438c2ecf20Sopenharmony_ci __le16 channel; 17448c2ecf20Sopenharmony_ci struct il3945_power_per_rate power[IL_MAX_RATES]; 17458c2ecf20Sopenharmony_ci} __packed; 17468c2ecf20Sopenharmony_ci 17478c2ecf20Sopenharmony_cistruct il4965_txpowertable_cmd { 17488c2ecf20Sopenharmony_ci u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 17498c2ecf20Sopenharmony_ci u8 reserved; 17508c2ecf20Sopenharmony_ci __le16 channel; 17518c2ecf20Sopenharmony_ci struct il4965_tx_power_db tx_power; 17528c2ecf20Sopenharmony_ci} __packed; 17538c2ecf20Sopenharmony_ci 17548c2ecf20Sopenharmony_ci/** 17558c2ecf20Sopenharmony_ci * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response 17568c2ecf20Sopenharmony_ci * 17578c2ecf20Sopenharmony_ci * C_RATE_SCALE = 0x47 (command, has simple generic response) 17588c2ecf20Sopenharmony_ci * 17598c2ecf20Sopenharmony_ci * NOTE: The table of rates passed to the uCode via the 17608c2ecf20Sopenharmony_ci * RATE_SCALE command sets up the corresponding order of 17618c2ecf20Sopenharmony_ci * rates used for all related commands, including rate 17628c2ecf20Sopenharmony_ci * masks, etc. 17638c2ecf20Sopenharmony_ci * 17648c2ecf20Sopenharmony_ci * For example, if you set 9MB (PLCP 0x0f) as the first 17658c2ecf20Sopenharmony_ci * rate in the rate table, the bit mask for that rate 17668c2ecf20Sopenharmony_ci * when passed through ofdm_basic_rates on the C_RXON 17678c2ecf20Sopenharmony_ci * command would be bit 0 (1 << 0) 17688c2ecf20Sopenharmony_ci */ 17698c2ecf20Sopenharmony_cistruct il3945_rate_scaling_info { 17708c2ecf20Sopenharmony_ci __le16 rate_n_flags; 17718c2ecf20Sopenharmony_ci u8 try_cnt; 17728c2ecf20Sopenharmony_ci u8 next_rate_idx; 17738c2ecf20Sopenharmony_ci} __packed; 17748c2ecf20Sopenharmony_ci 17758c2ecf20Sopenharmony_cistruct il3945_rate_scaling_cmd { 17768c2ecf20Sopenharmony_ci u8 table_id; 17778c2ecf20Sopenharmony_ci u8 reserved[3]; 17788c2ecf20Sopenharmony_ci struct il3945_rate_scaling_info table[IL_MAX_RATES]; 17798c2ecf20Sopenharmony_ci} __packed; 17808c2ecf20Sopenharmony_ci 17818c2ecf20Sopenharmony_ci/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 17828c2ecf20Sopenharmony_ci#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 17838c2ecf20Sopenharmony_ci 17848c2ecf20Sopenharmony_ci/* # of EDCA prioritized tx fifos */ 17858c2ecf20Sopenharmony_ci#define LINK_QUAL_AC_NUM AC_NUM 17868c2ecf20Sopenharmony_ci 17878c2ecf20Sopenharmony_ci/* # entries in rate scale table to support Tx retries */ 17888c2ecf20Sopenharmony_ci#define LINK_QUAL_MAX_RETRY_NUM 16 17898c2ecf20Sopenharmony_ci 17908c2ecf20Sopenharmony_ci/* Tx antenna selection values */ 17918c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_A_MSK (1 << 0) 17928c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_B_MSK (1 << 1) 17938c2ecf20Sopenharmony_ci#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 17948c2ecf20Sopenharmony_ci 17958c2ecf20Sopenharmony_ci/** 17968c2ecf20Sopenharmony_ci * struct il_link_qual_general_params 17978c2ecf20Sopenharmony_ci * 17988c2ecf20Sopenharmony_ci * Used in C_TX_LINK_QUALITY_CMD 17998c2ecf20Sopenharmony_ci */ 18008c2ecf20Sopenharmony_cistruct il_link_qual_general_params { 18018c2ecf20Sopenharmony_ci u8 flags; 18028c2ecf20Sopenharmony_ci 18038c2ecf20Sopenharmony_ci /* No entries at or above this (driver chosen) idx contain MIMO */ 18048c2ecf20Sopenharmony_ci u8 mimo_delimiter; 18058c2ecf20Sopenharmony_ci 18068c2ecf20Sopenharmony_ci /* Best single antenna to use for single stream (legacy, SISO). */ 18078c2ecf20Sopenharmony_ci u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ 18088c2ecf20Sopenharmony_ci 18098c2ecf20Sopenharmony_ci /* Best antennas to use for MIMO (unused for 4965, assumes both). */ 18108c2ecf20Sopenharmony_ci u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ 18118c2ecf20Sopenharmony_ci 18128c2ecf20Sopenharmony_ci /* 18138c2ecf20Sopenharmony_ci * If driver needs to use different initial rates for different 18148c2ecf20Sopenharmony_ci * EDCA QOS access categories (as implemented by tx fifos 0-3), 18158c2ecf20Sopenharmony_ci * this table will set that up, by indicating the idxes in the 18168c2ecf20Sopenharmony_ci * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 18178c2ecf20Sopenharmony_ci * Otherwise, driver should set all entries to 0. 18188c2ecf20Sopenharmony_ci * 18198c2ecf20Sopenharmony_ci * Entry usage: 18208c2ecf20Sopenharmony_ci * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 18218c2ecf20Sopenharmony_ci * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 18228c2ecf20Sopenharmony_ci */ 18238c2ecf20Sopenharmony_ci u8 start_rate_idx[LINK_QUAL_AC_NUM]; 18248c2ecf20Sopenharmony_ci} __packed; 18258c2ecf20Sopenharmony_ci 18268c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 18278c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) 18288c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) 18298c2ecf20Sopenharmony_ci 18308c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_DEF (3) 18318c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MAX (255) 18328c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_DISABLE_START_MIN (0) 18338c2ecf20Sopenharmony_ci 18348c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31) 18358c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 18368c2ecf20Sopenharmony_ci#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 18378c2ecf20Sopenharmony_ci 18388c2ecf20Sopenharmony_ci/** 18398c2ecf20Sopenharmony_ci * struct il_link_qual_agg_params 18408c2ecf20Sopenharmony_ci * 18418c2ecf20Sopenharmony_ci * Used in C_TX_LINK_QUALITY_CMD 18428c2ecf20Sopenharmony_ci */ 18438c2ecf20Sopenharmony_cistruct il_link_qual_agg_params { 18448c2ecf20Sopenharmony_ci 18458c2ecf20Sopenharmony_ci /* 18468c2ecf20Sopenharmony_ci *Maximum number of uSec in aggregation. 18478c2ecf20Sopenharmony_ci * default set to 4000 (4 milliseconds) if not configured in .cfg 18488c2ecf20Sopenharmony_ci */ 18498c2ecf20Sopenharmony_ci __le16 agg_time_limit; 18508c2ecf20Sopenharmony_ci 18518c2ecf20Sopenharmony_ci /* 18528c2ecf20Sopenharmony_ci * Number of Tx retries allowed for a frame, before that frame will 18538c2ecf20Sopenharmony_ci * no longer be considered for the start of an aggregation sequence 18548c2ecf20Sopenharmony_ci * (scheduler will then try to tx it as single frame). 18558c2ecf20Sopenharmony_ci * Driver should set this to 3. 18568c2ecf20Sopenharmony_ci */ 18578c2ecf20Sopenharmony_ci u8 agg_dis_start_th; 18588c2ecf20Sopenharmony_ci 18598c2ecf20Sopenharmony_ci /* 18608c2ecf20Sopenharmony_ci * Maximum number of frames in aggregation. 18618c2ecf20Sopenharmony_ci * 0 = no limit (default). 1 = no aggregation. 18628c2ecf20Sopenharmony_ci * Other values = max # frames in aggregation. 18638c2ecf20Sopenharmony_ci */ 18648c2ecf20Sopenharmony_ci u8 agg_frame_cnt_limit; 18658c2ecf20Sopenharmony_ci 18668c2ecf20Sopenharmony_ci __le32 reserved; 18678c2ecf20Sopenharmony_ci} __packed; 18688c2ecf20Sopenharmony_ci 18698c2ecf20Sopenharmony_ci/* 18708c2ecf20Sopenharmony_ci * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) 18718c2ecf20Sopenharmony_ci * 18728c2ecf20Sopenharmony_ci * For 4965 devices only; 3945 uses C_RATE_SCALE. 18738c2ecf20Sopenharmony_ci * 18748c2ecf20Sopenharmony_ci * Each station in the 4965 device's internal station table has its own table 18758c2ecf20Sopenharmony_ci * of 16 18768c2ecf20Sopenharmony_ci * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when 18778c2ecf20Sopenharmony_ci * an ACK is not received. This command replaces the entire table for 18788c2ecf20Sopenharmony_ci * one station. 18798c2ecf20Sopenharmony_ci * 18808c2ecf20Sopenharmony_ci * NOTE: Station must already be in 4965 device's station table. 18818c2ecf20Sopenharmony_ci * Use C_ADD_STA. 18828c2ecf20Sopenharmony_ci * 18838c2ecf20Sopenharmony_ci * The rate scaling procedures described below work well. Of course, other 18848c2ecf20Sopenharmony_ci * procedures are possible, and may work better for particular environments. 18858c2ecf20Sopenharmony_ci * 18868c2ecf20Sopenharmony_ci * 18878c2ecf20Sopenharmony_ci * FILLING THE RATE TBL 18888c2ecf20Sopenharmony_ci * 18898c2ecf20Sopenharmony_ci * Given a particular initial rate and mode, as determined by the rate 18908c2ecf20Sopenharmony_ci * scaling algorithm described below, the Linux driver uses the following 18918c2ecf20Sopenharmony_ci * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the 18928c2ecf20Sopenharmony_ci * Link Quality command: 18938c2ecf20Sopenharmony_ci * 18948c2ecf20Sopenharmony_ci * 18958c2ecf20Sopenharmony_ci * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: 18968c2ecf20Sopenharmony_ci * a) Use this same initial rate for first 3 entries. 18978c2ecf20Sopenharmony_ci * b) Find next lower available rate using same mode (SISO or MIMO), 18988c2ecf20Sopenharmony_ci * use for next 3 entries. If no lower rate available, switch to 18998c2ecf20Sopenharmony_ci * legacy mode (no HT40 channel, no MIMO, no short guard interval). 19008c2ecf20Sopenharmony_ci * c) If using MIMO, set command's mimo_delimiter to number of entries 19018c2ecf20Sopenharmony_ci * using MIMO (3 or 6). 19028c2ecf20Sopenharmony_ci * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, 19038c2ecf20Sopenharmony_ci * no MIMO, no short guard interval), at the next lower bit rate 19048c2ecf20Sopenharmony_ci * (e.g. if second HT bit rate was 54, try 48 legacy), and follow 19058c2ecf20Sopenharmony_ci * legacy procedure for remaining table entries. 19068c2ecf20Sopenharmony_ci * 19078c2ecf20Sopenharmony_ci * 2) If using legacy initial rate: 19088c2ecf20Sopenharmony_ci * a) Use the initial rate for only one entry. 19098c2ecf20Sopenharmony_ci * b) For each following entry, reduce the rate to next lower available 19108c2ecf20Sopenharmony_ci * rate, until reaching the lowest available rate. 19118c2ecf20Sopenharmony_ci * c) When reducing rate, also switch antenna selection. 19128c2ecf20Sopenharmony_ci * d) Once lowest available rate is reached, repeat this rate until 19138c2ecf20Sopenharmony_ci * rate table is filled (16 entries), switching antenna each entry. 19148c2ecf20Sopenharmony_ci * 19158c2ecf20Sopenharmony_ci * 19168c2ecf20Sopenharmony_ci * ACCUMULATING HISTORY 19178c2ecf20Sopenharmony_ci * 19188c2ecf20Sopenharmony_ci * The rate scaling algorithm for 4965 devices, as implemented in Linux driver, 19198c2ecf20Sopenharmony_ci * uses two sets of frame Tx success history: One for the current/active 19208c2ecf20Sopenharmony_ci * modulation mode, and one for a speculative/search mode that is being 19218c2ecf20Sopenharmony_ci * attempted. If the speculative mode turns out to be more effective (i.e. 19228c2ecf20Sopenharmony_ci * actual transfer rate is better), then the driver continues to use the 19238c2ecf20Sopenharmony_ci * speculative mode as the new current active mode. 19248c2ecf20Sopenharmony_ci * 19258c2ecf20Sopenharmony_ci * Each history set contains, separately for each possible rate, data for a 19268c2ecf20Sopenharmony_ci * sliding win of the 62 most recent tx attempts at that rate. The data 19278c2ecf20Sopenharmony_ci * includes a shifting bitmap of success(1)/failure(0), and sums of successful 19288c2ecf20Sopenharmony_ci * and attempted frames, from which the driver can additionally calculate a 19298c2ecf20Sopenharmony_ci * success ratio (success / attempted) and number of failures 19308c2ecf20Sopenharmony_ci * (attempted - success), and control the size of the win (attempted). 19318c2ecf20Sopenharmony_ci * The driver uses the bit map to remove successes from the success sum, as 19328c2ecf20Sopenharmony_ci * the oldest tx attempts fall out of the win. 19338c2ecf20Sopenharmony_ci * 19348c2ecf20Sopenharmony_ci * When the 4965 device makes multiple tx attempts for a given frame, each 19358c2ecf20Sopenharmony_ci * attempt might be at a different rate, and have different modulation 19368c2ecf20Sopenharmony_ci * characteristics (e.g. antenna, fat channel, short guard interval), as set 19378c2ecf20Sopenharmony_ci * up in the rate scaling table in the Link Quality command. The driver must 19388c2ecf20Sopenharmony_ci * determine which rate table entry was used for each tx attempt, to determine 19398c2ecf20Sopenharmony_ci * which rate-specific history to update, and record only those attempts that 19408c2ecf20Sopenharmony_ci * match the modulation characteristics of the history set. 19418c2ecf20Sopenharmony_ci * 19428c2ecf20Sopenharmony_ci * When using block-ack (aggregation), all frames are transmitted at the same 19438c2ecf20Sopenharmony_ci * rate, since there is no per-attempt acknowledgment from the destination 19448c2ecf20Sopenharmony_ci * station. The Tx response struct il_tx_resp indicates the Tx rate in 19458c2ecf20Sopenharmony_ci * rate_n_flags field. After receiving a block-ack, the driver can update 19468c2ecf20Sopenharmony_ci * history for the entire block all at once. 19478c2ecf20Sopenharmony_ci * 19488c2ecf20Sopenharmony_ci * 19498c2ecf20Sopenharmony_ci * FINDING BEST STARTING RATE: 19508c2ecf20Sopenharmony_ci * 19518c2ecf20Sopenharmony_ci * When working with a selected initial modulation mode (see below), the 19528c2ecf20Sopenharmony_ci * driver attempts to find a best initial rate. The initial rate is the 19538c2ecf20Sopenharmony_ci * first entry in the Link Quality command's rate table. 19548c2ecf20Sopenharmony_ci * 19558c2ecf20Sopenharmony_ci * 1) Calculate actual throughput (success ratio * expected throughput, see 19568c2ecf20Sopenharmony_ci * table below) for current initial rate. Do this only if enough frames 19578c2ecf20Sopenharmony_ci * have been attempted to make the value meaningful: at least 6 failed 19588c2ecf20Sopenharmony_ci * tx attempts, or at least 8 successes. If not enough, don't try rate 19598c2ecf20Sopenharmony_ci * scaling yet. 19608c2ecf20Sopenharmony_ci * 19618c2ecf20Sopenharmony_ci * 2) Find available rates adjacent to current initial rate. Available means: 19628c2ecf20Sopenharmony_ci * a) supported by hardware && 19638c2ecf20Sopenharmony_ci * b) supported by association && 19648c2ecf20Sopenharmony_ci * c) within any constraints selected by user 19658c2ecf20Sopenharmony_ci * 19668c2ecf20Sopenharmony_ci * 3) Gather measured throughputs for adjacent rates. These might not have 19678c2ecf20Sopenharmony_ci * enough history to calculate a throughput. That's okay, we might try 19688c2ecf20Sopenharmony_ci * using one of them anyway! 19698c2ecf20Sopenharmony_ci * 19708c2ecf20Sopenharmony_ci * 4) Try decreasing rate if, for current rate: 19718c2ecf20Sopenharmony_ci * a) success ratio is < 15% || 19728c2ecf20Sopenharmony_ci * b) lower adjacent rate has better measured throughput || 19738c2ecf20Sopenharmony_ci * c) higher adjacent rate has worse throughput, and lower is unmeasured 19748c2ecf20Sopenharmony_ci * 19758c2ecf20Sopenharmony_ci * As a sanity check, if decrease was determined above, leave rate 19768c2ecf20Sopenharmony_ci * unchanged if: 19778c2ecf20Sopenharmony_ci * a) lower rate unavailable 19788c2ecf20Sopenharmony_ci * b) success ratio at current rate > 85% (very good) 19798c2ecf20Sopenharmony_ci * c) current measured throughput is better than expected throughput 19808c2ecf20Sopenharmony_ci * of lower rate (under perfect 100% tx conditions, see table below) 19818c2ecf20Sopenharmony_ci * 19828c2ecf20Sopenharmony_ci * 5) Try increasing rate if, for current rate: 19838c2ecf20Sopenharmony_ci * a) success ratio is < 15% || 19848c2ecf20Sopenharmony_ci * b) both adjacent rates' throughputs are unmeasured (try it!) || 19858c2ecf20Sopenharmony_ci * b) higher adjacent rate has better measured throughput || 19868c2ecf20Sopenharmony_ci * c) lower adjacent rate has worse throughput, and higher is unmeasured 19878c2ecf20Sopenharmony_ci * 19888c2ecf20Sopenharmony_ci * As a sanity check, if increase was determined above, leave rate 19898c2ecf20Sopenharmony_ci * unchanged if: 19908c2ecf20Sopenharmony_ci * a) success ratio at current rate < 70%. This is not particularly 19918c2ecf20Sopenharmony_ci * good performance; higher rate is sure to have poorer success. 19928c2ecf20Sopenharmony_ci * 19938c2ecf20Sopenharmony_ci * 6) Re-evaluate the rate after each tx frame. If working with block- 19948c2ecf20Sopenharmony_ci * acknowledge, history and stats may be calculated for the entire 19958c2ecf20Sopenharmony_ci * block (including prior history that fits within the history wins), 19968c2ecf20Sopenharmony_ci * before re-evaluation. 19978c2ecf20Sopenharmony_ci * 19988c2ecf20Sopenharmony_ci * FINDING BEST STARTING MODULATION MODE: 19998c2ecf20Sopenharmony_ci * 20008c2ecf20Sopenharmony_ci * After working with a modulation mode for a "while" (and doing rate scaling), 20018c2ecf20Sopenharmony_ci * the driver searches for a new initial mode in an attempt to improve 20028c2ecf20Sopenharmony_ci * throughput. The "while" is measured by numbers of attempted frames: 20038c2ecf20Sopenharmony_ci * 20048c2ecf20Sopenharmony_ci * For legacy mode, search for new mode after: 20058c2ecf20Sopenharmony_ci * 480 successful frames, or 160 failed frames 20068c2ecf20Sopenharmony_ci * For high-throughput modes (SISO or MIMO), search for new mode after: 20078c2ecf20Sopenharmony_ci * 4500 successful frames, or 400 failed frames 20088c2ecf20Sopenharmony_ci * 20098c2ecf20Sopenharmony_ci * Mode switch possibilities are (3 for each mode): 20108c2ecf20Sopenharmony_ci * 20118c2ecf20Sopenharmony_ci * For legacy: 20128c2ecf20Sopenharmony_ci * Change antenna, try SISO (if HT association), try MIMO (if HT association) 20138c2ecf20Sopenharmony_ci * For SISO: 20148c2ecf20Sopenharmony_ci * Change antenna, try MIMO, try shortened guard interval (SGI) 20158c2ecf20Sopenharmony_ci * For MIMO: 20168c2ecf20Sopenharmony_ci * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) 20178c2ecf20Sopenharmony_ci * 20188c2ecf20Sopenharmony_ci * When trying a new mode, use the same bit rate as the old/current mode when 20198c2ecf20Sopenharmony_ci * trying antenna switches and shortened guard interval. When switching to 20208c2ecf20Sopenharmony_ci * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate 20218c2ecf20Sopenharmony_ci * for which the expected throughput (under perfect conditions) is about the 20228c2ecf20Sopenharmony_ci * same or slightly better than the actual measured throughput delivered by 20238c2ecf20Sopenharmony_ci * the old/current mode. 20248c2ecf20Sopenharmony_ci * 20258c2ecf20Sopenharmony_ci * Actual throughput can be estimated by multiplying the expected throughput 20268c2ecf20Sopenharmony_ci * by the success ratio (successful / attempted tx frames). Frame size is 20278c2ecf20Sopenharmony_ci * not considered in this calculation; it assumes that frame size will average 20288c2ecf20Sopenharmony_ci * out to be fairly consistent over several samples. The following are 20298c2ecf20Sopenharmony_ci * metric values for expected throughput assuming 100% success ratio. 20308c2ecf20Sopenharmony_ci * Only G band has support for CCK rates: 20318c2ecf20Sopenharmony_ci * 20328c2ecf20Sopenharmony_ci * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 20338c2ecf20Sopenharmony_ci * 20348c2ecf20Sopenharmony_ci * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 20358c2ecf20Sopenharmony_ci * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 20368c2ecf20Sopenharmony_ci * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 20378c2ecf20Sopenharmony_ci * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 20388c2ecf20Sopenharmony_ci * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 20398c2ecf20Sopenharmony_ci * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 20408c2ecf20Sopenharmony_ci * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 20418c2ecf20Sopenharmony_ci * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 20428c2ecf20Sopenharmony_ci * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 20438c2ecf20Sopenharmony_ci * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 20448c2ecf20Sopenharmony_ci * 20458c2ecf20Sopenharmony_ci * After the new mode has been tried for a short while (minimum of 6 failed 20468c2ecf20Sopenharmony_ci * frames or 8 successful frames), compare success ratio and actual throughput 20478c2ecf20Sopenharmony_ci * estimate of the new mode with the old. If either is better with the new 20488c2ecf20Sopenharmony_ci * mode, continue to use the new mode. 20498c2ecf20Sopenharmony_ci * 20508c2ecf20Sopenharmony_ci * Continue comparing modes until all 3 possibilities have been tried. 20518c2ecf20Sopenharmony_ci * If moving from legacy to HT, try all 3 possibilities from the new HT 20528c2ecf20Sopenharmony_ci * mode. After trying all 3, a best mode is found. Continue to use this mode 20538c2ecf20Sopenharmony_ci * for the longer "while" described above (e.g. 480 successful frames for 20548c2ecf20Sopenharmony_ci * legacy), and then repeat the search process. 20558c2ecf20Sopenharmony_ci * 20568c2ecf20Sopenharmony_ci */ 20578c2ecf20Sopenharmony_cistruct il_link_quality_cmd { 20588c2ecf20Sopenharmony_ci 20598c2ecf20Sopenharmony_ci /* Index of destination/recipient station in uCode's station table */ 20608c2ecf20Sopenharmony_ci u8 sta_id; 20618c2ecf20Sopenharmony_ci u8 reserved1; 20628c2ecf20Sopenharmony_ci __le16 control; /* not used */ 20638c2ecf20Sopenharmony_ci struct il_link_qual_general_params general_params; 20648c2ecf20Sopenharmony_ci struct il_link_qual_agg_params agg_params; 20658c2ecf20Sopenharmony_ci 20668c2ecf20Sopenharmony_ci /* 20678c2ecf20Sopenharmony_ci * Rate info; when using rate-scaling, Tx command's initial_rate_idx 20688c2ecf20Sopenharmony_ci * specifies 1st Tx rate attempted, via idx into this table. 20698c2ecf20Sopenharmony_ci * 4965 devices works its way through table when retrying Tx. 20708c2ecf20Sopenharmony_ci */ 20718c2ecf20Sopenharmony_ci struct { 20728c2ecf20Sopenharmony_ci __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */ 20738c2ecf20Sopenharmony_ci } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 20748c2ecf20Sopenharmony_ci __le32 reserved2; 20758c2ecf20Sopenharmony_ci} __packed; 20768c2ecf20Sopenharmony_ci 20778c2ecf20Sopenharmony_ci/* 20788c2ecf20Sopenharmony_ci * BT configuration enable flags: 20798c2ecf20Sopenharmony_ci * bit 0 - 1: BT channel announcement enabled 20808c2ecf20Sopenharmony_ci * 0: disable 20818c2ecf20Sopenharmony_ci * bit 1 - 1: priority of BT device enabled 20828c2ecf20Sopenharmony_ci * 0: disable 20838c2ecf20Sopenharmony_ci */ 20848c2ecf20Sopenharmony_ci#define BT_COEX_DISABLE (0x0) 20858c2ecf20Sopenharmony_ci#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) 20868c2ecf20Sopenharmony_ci#define BT_ENABLE_PRIORITY BIT(1) 20878c2ecf20Sopenharmony_ci 20888c2ecf20Sopenharmony_ci#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) 20898c2ecf20Sopenharmony_ci 20908c2ecf20Sopenharmony_ci#define BT_LEAD_TIME_DEF (0x1E) 20918c2ecf20Sopenharmony_ci 20928c2ecf20Sopenharmony_ci#define BT_MAX_KILL_DEF (0x5) 20938c2ecf20Sopenharmony_ci 20948c2ecf20Sopenharmony_ci/* 20958c2ecf20Sopenharmony_ci * C_BT_CONFIG = 0x9b (command, has simple generic response) 20968c2ecf20Sopenharmony_ci * 20978c2ecf20Sopenharmony_ci * 3945 and 4965 devices support hardware handshake with Bluetooth device on 20988c2ecf20Sopenharmony_ci * same platform. Bluetooth device alerts wireless device when it will Tx; 20998c2ecf20Sopenharmony_ci * wireless device can delay or kill its own Tx to accommodate. 21008c2ecf20Sopenharmony_ci */ 21018c2ecf20Sopenharmony_cistruct il_bt_cmd { 21028c2ecf20Sopenharmony_ci u8 flags; 21038c2ecf20Sopenharmony_ci u8 lead_time; 21048c2ecf20Sopenharmony_ci u8 max_kill; 21058c2ecf20Sopenharmony_ci u8 reserved; 21068c2ecf20Sopenharmony_ci __le32 kill_ack_mask; 21078c2ecf20Sopenharmony_ci __le32 kill_cts_mask; 21088c2ecf20Sopenharmony_ci} __packed; 21098c2ecf20Sopenharmony_ci 21108c2ecf20Sopenharmony_ci/****************************************************************************** 21118c2ecf20Sopenharmony_ci * (6) 21128c2ecf20Sopenharmony_ci * Spectrum Management (802.11h) Commands, Responses, Notifications: 21138c2ecf20Sopenharmony_ci * 21148c2ecf20Sopenharmony_ci *****************************************************************************/ 21158c2ecf20Sopenharmony_ci 21168c2ecf20Sopenharmony_ci/* 21178c2ecf20Sopenharmony_ci * Spectrum Management 21188c2ecf20Sopenharmony_ci */ 21198c2ecf20Sopenharmony_ci#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ 21208c2ecf20Sopenharmony_ci RXON_FILTER_CTL2HOST_MSK | \ 21218c2ecf20Sopenharmony_ci RXON_FILTER_ACCEPT_GRP_MSK | \ 21228c2ecf20Sopenharmony_ci RXON_FILTER_DIS_DECRYPT_MSK | \ 21238c2ecf20Sopenharmony_ci RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ 21248c2ecf20Sopenharmony_ci RXON_FILTER_ASSOC_MSK | \ 21258c2ecf20Sopenharmony_ci RXON_FILTER_BCON_AWARE_MSK) 21268c2ecf20Sopenharmony_ci 21278c2ecf20Sopenharmony_cistruct il_measure_channel { 21288c2ecf20Sopenharmony_ci __le32 duration; /* measurement duration in extended beacon 21298c2ecf20Sopenharmony_ci * format */ 21308c2ecf20Sopenharmony_ci u8 channel; /* channel to measure */ 21318c2ecf20Sopenharmony_ci u8 type; /* see enum il_measure_type */ 21328c2ecf20Sopenharmony_ci __le16 reserved; 21338c2ecf20Sopenharmony_ci} __packed; 21348c2ecf20Sopenharmony_ci 21358c2ecf20Sopenharmony_ci/* 21368c2ecf20Sopenharmony_ci * C_SPECTRUM_MEASUREMENT = 0x74 (command) 21378c2ecf20Sopenharmony_ci */ 21388c2ecf20Sopenharmony_cistruct il_spectrum_cmd { 21398c2ecf20Sopenharmony_ci __le16 len; /* number of bytes starting from token */ 21408c2ecf20Sopenharmony_ci u8 token; /* token id */ 21418c2ecf20Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 21428c2ecf20Sopenharmony_ci u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ 21438c2ecf20Sopenharmony_ci u8 periodic; /* 1 = periodic */ 21448c2ecf20Sopenharmony_ci __le16 path_loss_timeout; 21458c2ecf20Sopenharmony_ci __le32 start_time; /* start time in extended beacon format */ 21468c2ecf20Sopenharmony_ci __le32 reserved2; 21478c2ecf20Sopenharmony_ci __le32 flags; /* rxon flags */ 21488c2ecf20Sopenharmony_ci __le32 filter_flags; /* rxon filter flags */ 21498c2ecf20Sopenharmony_ci __le16 channel_count; /* minimum 1, maximum 10 */ 21508c2ecf20Sopenharmony_ci __le16 reserved3; 21518c2ecf20Sopenharmony_ci struct il_measure_channel channels[10]; 21528c2ecf20Sopenharmony_ci} __packed; 21538c2ecf20Sopenharmony_ci 21548c2ecf20Sopenharmony_ci/* 21558c2ecf20Sopenharmony_ci * C_SPECTRUM_MEASUREMENT = 0x74 (response) 21568c2ecf20Sopenharmony_ci */ 21578c2ecf20Sopenharmony_cistruct il_spectrum_resp { 21588c2ecf20Sopenharmony_ci u8 token; 21598c2ecf20Sopenharmony_ci u8 id; /* id of the prior command replaced, or 0xff */ 21608c2ecf20Sopenharmony_ci __le16 status; /* 0 - command will be handled 21618c2ecf20Sopenharmony_ci * 1 - cannot handle (conflicts with another 21628c2ecf20Sopenharmony_ci * measurement) */ 21638c2ecf20Sopenharmony_ci} __packed; 21648c2ecf20Sopenharmony_ci 21658c2ecf20Sopenharmony_cienum il_measurement_state { 21668c2ecf20Sopenharmony_ci IL_MEASUREMENT_START = 0, 21678c2ecf20Sopenharmony_ci IL_MEASUREMENT_STOP = 1, 21688c2ecf20Sopenharmony_ci}; 21698c2ecf20Sopenharmony_ci 21708c2ecf20Sopenharmony_cienum il_measurement_status { 21718c2ecf20Sopenharmony_ci IL_MEASUREMENT_OK = 0, 21728c2ecf20Sopenharmony_ci IL_MEASUREMENT_CONCURRENT = 1, 21738c2ecf20Sopenharmony_ci IL_MEASUREMENT_CSA_CONFLICT = 2, 21748c2ecf20Sopenharmony_ci IL_MEASUREMENT_TGH_CONFLICT = 3, 21758c2ecf20Sopenharmony_ci /* 4-5 reserved */ 21768c2ecf20Sopenharmony_ci IL_MEASUREMENT_STOPPED = 6, 21778c2ecf20Sopenharmony_ci IL_MEASUREMENT_TIMEOUT = 7, 21788c2ecf20Sopenharmony_ci IL_MEASUREMENT_PERIODIC_FAILED = 8, 21798c2ecf20Sopenharmony_ci}; 21808c2ecf20Sopenharmony_ci 21818c2ecf20Sopenharmony_ci#define NUM_ELEMENTS_IN_HISTOGRAM 8 21828c2ecf20Sopenharmony_ci 21838c2ecf20Sopenharmony_cistruct il_measurement_histogram { 21848c2ecf20Sopenharmony_ci __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ 21858c2ecf20Sopenharmony_ci __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ 21868c2ecf20Sopenharmony_ci} __packed; 21878c2ecf20Sopenharmony_ci 21888c2ecf20Sopenharmony_ci/* clear channel availability counters */ 21898c2ecf20Sopenharmony_cistruct il_measurement_cca_counters { 21908c2ecf20Sopenharmony_ci __le32 ofdm; 21918c2ecf20Sopenharmony_ci __le32 cck; 21928c2ecf20Sopenharmony_ci} __packed; 21938c2ecf20Sopenharmony_ci 21948c2ecf20Sopenharmony_cienum il_measure_type { 21958c2ecf20Sopenharmony_ci IL_MEASURE_BASIC = (1 << 0), 21968c2ecf20Sopenharmony_ci IL_MEASURE_CHANNEL_LOAD = (1 << 1), 21978c2ecf20Sopenharmony_ci IL_MEASURE_HISTOGRAM_RPI = (1 << 2), 21988c2ecf20Sopenharmony_ci IL_MEASURE_HISTOGRAM_NOISE = (1 << 3), 21998c2ecf20Sopenharmony_ci IL_MEASURE_FRAME = (1 << 4), 22008c2ecf20Sopenharmony_ci /* bits 5:6 are reserved */ 22018c2ecf20Sopenharmony_ci IL_MEASURE_IDLE = (1 << 7), 22028c2ecf20Sopenharmony_ci}; 22038c2ecf20Sopenharmony_ci 22048c2ecf20Sopenharmony_ci/* 22058c2ecf20Sopenharmony_ci * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command) 22068c2ecf20Sopenharmony_ci */ 22078c2ecf20Sopenharmony_cistruct il_spectrum_notification { 22088c2ecf20Sopenharmony_ci u8 id; /* measurement id -- 0 or 1 */ 22098c2ecf20Sopenharmony_ci u8 token; 22108c2ecf20Sopenharmony_ci u8 channel_idx; /* idx in measurement channel list */ 22118c2ecf20Sopenharmony_ci u8 state; /* 0 - start, 1 - stop */ 22128c2ecf20Sopenharmony_ci __le32 start_time; /* lower 32-bits of TSF */ 22138c2ecf20Sopenharmony_ci u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 22148c2ecf20Sopenharmony_ci u8 channel; 22158c2ecf20Sopenharmony_ci u8 type; /* see enum il_measurement_type */ 22168c2ecf20Sopenharmony_ci u8 reserved1; 22178c2ecf20Sopenharmony_ci /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only 22188c2ecf20Sopenharmony_ci * valid if applicable for measurement type requested. */ 22198c2ecf20Sopenharmony_ci __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ 22208c2ecf20Sopenharmony_ci __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ 22218c2ecf20Sopenharmony_ci __le32 cca_time; /* channel load time in usecs */ 22228c2ecf20Sopenharmony_ci u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - 22238c2ecf20Sopenharmony_ci * unidentified */ 22248c2ecf20Sopenharmony_ci u8 reserved2[3]; 22258c2ecf20Sopenharmony_ci struct il_measurement_histogram histogram; 22268c2ecf20Sopenharmony_ci __le32 stop_time; /* lower 32-bits of TSF */ 22278c2ecf20Sopenharmony_ci __le32 status; /* see il_measurement_status */ 22288c2ecf20Sopenharmony_ci} __packed; 22298c2ecf20Sopenharmony_ci 22308c2ecf20Sopenharmony_ci/****************************************************************************** 22318c2ecf20Sopenharmony_ci * (7) 22328c2ecf20Sopenharmony_ci * Power Management Commands, Responses, Notifications: 22338c2ecf20Sopenharmony_ci * 22348c2ecf20Sopenharmony_ci *****************************************************************************/ 22358c2ecf20Sopenharmony_ci 22368c2ecf20Sopenharmony_ci/** 22378c2ecf20Sopenharmony_ci * struct il_powertable_cmd - Power Table Command 22388c2ecf20Sopenharmony_ci * @flags: See below: 22398c2ecf20Sopenharmony_ci * 22408c2ecf20Sopenharmony_ci * C_POWER_TBL = 0x77 (command, has simple generic response) 22418c2ecf20Sopenharmony_ci * 22428c2ecf20Sopenharmony_ci * PM allow: 22438c2ecf20Sopenharmony_ci * bit 0 - '0' Driver not allow power management 22448c2ecf20Sopenharmony_ci * '1' Driver allow PM (use rest of parameters) 22458c2ecf20Sopenharmony_ci * 22468c2ecf20Sopenharmony_ci * uCode send sleep notifications: 22478c2ecf20Sopenharmony_ci * bit 1 - '0' Don't send sleep notification 22488c2ecf20Sopenharmony_ci * '1' send sleep notification (SEND_PM_NOTIFICATION) 22498c2ecf20Sopenharmony_ci * 22508c2ecf20Sopenharmony_ci * Sleep over DTIM 22518c2ecf20Sopenharmony_ci * bit 2 - '0' PM have to walk up every DTIM 22528c2ecf20Sopenharmony_ci * '1' PM could sleep over DTIM till listen Interval. 22538c2ecf20Sopenharmony_ci * 22548c2ecf20Sopenharmony_ci * PCI power managed 22558c2ecf20Sopenharmony_ci * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) 22568c2ecf20Sopenharmony_ci * '1' !(PCI_CFG_LINK_CTRL & 0x1) 22578c2ecf20Sopenharmony_ci * 22588c2ecf20Sopenharmony_ci * Fast PD 22598c2ecf20Sopenharmony_ci * bit 4 - '1' Put radio to sleep when receiving frame for others 22608c2ecf20Sopenharmony_ci * 22618c2ecf20Sopenharmony_ci * Force sleep Modes 22628c2ecf20Sopenharmony_ci * bit 31/30- '00' use both mac/xtal sleeps 22638c2ecf20Sopenharmony_ci * '01' force Mac sleep 22648c2ecf20Sopenharmony_ci * '10' force xtal sleep 22658c2ecf20Sopenharmony_ci * '11' Illegal set 22668c2ecf20Sopenharmony_ci * 22678c2ecf20Sopenharmony_ci * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then 22688c2ecf20Sopenharmony_ci * ucode assume sleep over DTIM is allowed and we don't need to wake up 22698c2ecf20Sopenharmony_ci * for every DTIM. 22708c2ecf20Sopenharmony_ci */ 22718c2ecf20Sopenharmony_ci#define IL_POWER_VEC_SIZE 5 22728c2ecf20Sopenharmony_ci 22738c2ecf20Sopenharmony_ci#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) 22748c2ecf20Sopenharmony_ci#define IL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) 22758c2ecf20Sopenharmony_ci#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) 22768c2ecf20Sopenharmony_ci 22778c2ecf20Sopenharmony_cistruct il3945_powertable_cmd { 22788c2ecf20Sopenharmony_ci __le16 flags; 22798c2ecf20Sopenharmony_ci u8 reserved[2]; 22808c2ecf20Sopenharmony_ci __le32 rx_data_timeout; 22818c2ecf20Sopenharmony_ci __le32 tx_data_timeout; 22828c2ecf20Sopenharmony_ci __le32 sleep_interval[IL_POWER_VEC_SIZE]; 22838c2ecf20Sopenharmony_ci} __packed; 22848c2ecf20Sopenharmony_ci 22858c2ecf20Sopenharmony_cistruct il_powertable_cmd { 22868c2ecf20Sopenharmony_ci __le16 flags; 22878c2ecf20Sopenharmony_ci u8 keep_alive_seconds; /* 3945 reserved */ 22888c2ecf20Sopenharmony_ci u8 debug_flags; /* 3945 reserved */ 22898c2ecf20Sopenharmony_ci __le32 rx_data_timeout; 22908c2ecf20Sopenharmony_ci __le32 tx_data_timeout; 22918c2ecf20Sopenharmony_ci __le32 sleep_interval[IL_POWER_VEC_SIZE]; 22928c2ecf20Sopenharmony_ci __le32 keep_alive_beacons; 22938c2ecf20Sopenharmony_ci} __packed; 22948c2ecf20Sopenharmony_ci 22958c2ecf20Sopenharmony_ci/* 22968c2ecf20Sopenharmony_ci * N_PM_SLEEP = 0x7A (notification only, not a command) 22978c2ecf20Sopenharmony_ci * all devices identical. 22988c2ecf20Sopenharmony_ci */ 22998c2ecf20Sopenharmony_cistruct il_sleep_notification { 23008c2ecf20Sopenharmony_ci u8 pm_sleep_mode; 23018c2ecf20Sopenharmony_ci u8 pm_wakeup_src; 23028c2ecf20Sopenharmony_ci __le16 reserved; 23038c2ecf20Sopenharmony_ci __le32 sleep_time; 23048c2ecf20Sopenharmony_ci __le32 tsf_low; 23058c2ecf20Sopenharmony_ci __le32 bcon_timer; 23068c2ecf20Sopenharmony_ci} __packed; 23078c2ecf20Sopenharmony_ci 23088c2ecf20Sopenharmony_ci/* Sleep states. all devices identical. */ 23098c2ecf20Sopenharmony_cienum { 23108c2ecf20Sopenharmony_ci IL_PM_NO_SLEEP = 0, 23118c2ecf20Sopenharmony_ci IL_PM_SLP_MAC = 1, 23128c2ecf20Sopenharmony_ci IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, 23138c2ecf20Sopenharmony_ci IL_PM_SLP_FULL_MAC_CARD_STATE = 3, 23148c2ecf20Sopenharmony_ci IL_PM_SLP_PHY = 4, 23158c2ecf20Sopenharmony_ci IL_PM_SLP_REPENT = 5, 23168c2ecf20Sopenharmony_ci IL_PM_WAKEUP_BY_TIMER = 6, 23178c2ecf20Sopenharmony_ci IL_PM_WAKEUP_BY_DRIVER = 7, 23188c2ecf20Sopenharmony_ci IL_PM_WAKEUP_BY_RFKILL = 8, 23198c2ecf20Sopenharmony_ci /* 3 reserved */ 23208c2ecf20Sopenharmony_ci IL_PM_NUM_OF_MODES = 12, 23218c2ecf20Sopenharmony_ci}; 23228c2ecf20Sopenharmony_ci 23238c2ecf20Sopenharmony_ci/* 23248c2ecf20Sopenharmony_ci * N_CARD_STATE = 0xa1 (notification only, not a command) 23258c2ecf20Sopenharmony_ci */ 23268c2ecf20Sopenharmony_cistruct il_card_state_notif { 23278c2ecf20Sopenharmony_ci __le32 flags; 23288c2ecf20Sopenharmony_ci} __packed; 23298c2ecf20Sopenharmony_ci 23308c2ecf20Sopenharmony_ci#define HW_CARD_DISABLED 0x01 23318c2ecf20Sopenharmony_ci#define SW_CARD_DISABLED 0x02 23328c2ecf20Sopenharmony_ci#define CT_CARD_DISABLED 0x04 23338c2ecf20Sopenharmony_ci#define RXON_CARD_DISABLED 0x10 23348c2ecf20Sopenharmony_ci 23358c2ecf20Sopenharmony_cistruct il_ct_kill_config { 23368c2ecf20Sopenharmony_ci __le32 reserved; 23378c2ecf20Sopenharmony_ci __le32 critical_temperature_M; 23388c2ecf20Sopenharmony_ci __le32 critical_temperature_R; 23398c2ecf20Sopenharmony_ci} __packed; 23408c2ecf20Sopenharmony_ci 23418c2ecf20Sopenharmony_ci/****************************************************************************** 23428c2ecf20Sopenharmony_ci * (8) 23438c2ecf20Sopenharmony_ci * Scan Commands, Responses, Notifications: 23448c2ecf20Sopenharmony_ci * 23458c2ecf20Sopenharmony_ci *****************************************************************************/ 23468c2ecf20Sopenharmony_ci 23478c2ecf20Sopenharmony_ci#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) 23488c2ecf20Sopenharmony_ci#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) 23498c2ecf20Sopenharmony_ci 23508c2ecf20Sopenharmony_ci/** 23518c2ecf20Sopenharmony_ci * struct il_scan_channel - entry in C_SCAN channel table 23528c2ecf20Sopenharmony_ci * 23538c2ecf20Sopenharmony_ci * One for each channel in the scan list. 23548c2ecf20Sopenharmony_ci * Each channel can independently select: 23558c2ecf20Sopenharmony_ci * 1) SSID for directed active scans 23568c2ecf20Sopenharmony_ci * 2) Txpower setting (for rate specified within Tx command) 23578c2ecf20Sopenharmony_ci * 3) How long to stay on-channel (behavior may be modified by quiet_time, 23588c2ecf20Sopenharmony_ci * quiet_plcp_th, good_CRC_th) 23598c2ecf20Sopenharmony_ci * 23608c2ecf20Sopenharmony_ci * To avoid uCode errors, make sure the following are true (see comments 23618c2ecf20Sopenharmony_ci * under struct il_scan_cmd about max_out_time and quiet_time): 23628c2ecf20Sopenharmony_ci * 1) If using passive_dwell (i.e. passive_dwell != 0): 23638c2ecf20Sopenharmony_ci * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) 23648c2ecf20Sopenharmony_ci * 2) quiet_time <= active_dwell 23658c2ecf20Sopenharmony_ci * 3) If restricting off-channel time (i.e. max_out_time !=0): 23668c2ecf20Sopenharmony_ci * passive_dwell < max_out_time 23678c2ecf20Sopenharmony_ci * active_dwell < max_out_time 23688c2ecf20Sopenharmony_ci */ 23698c2ecf20Sopenharmony_cistruct il3945_scan_channel { 23708c2ecf20Sopenharmony_ci /* 23718c2ecf20Sopenharmony_ci * type is defined as: 23728c2ecf20Sopenharmony_ci * 0:0 1 = active, 0 = passive 23738c2ecf20Sopenharmony_ci * 1:4 SSID direct bit map; if a bit is set, then corresponding 23748c2ecf20Sopenharmony_ci * SSID IE is transmitted in probe request. 23758c2ecf20Sopenharmony_ci * 5:7 reserved 23768c2ecf20Sopenharmony_ci */ 23778c2ecf20Sopenharmony_ci u8 type; 23788c2ecf20Sopenharmony_ci u8 channel; /* band is selected by il3945_scan_cmd "flags" field */ 23798c2ecf20Sopenharmony_ci struct il3945_tx_power tpc; 23808c2ecf20Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 23818c2ecf20Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 23828c2ecf20Sopenharmony_ci} __packed; 23838c2ecf20Sopenharmony_ci 23848c2ecf20Sopenharmony_ci/* set number of direct probes u8 type */ 23858c2ecf20Sopenharmony_ci#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) 23868c2ecf20Sopenharmony_ci 23878c2ecf20Sopenharmony_cistruct il_scan_channel { 23888c2ecf20Sopenharmony_ci /* 23898c2ecf20Sopenharmony_ci * type is defined as: 23908c2ecf20Sopenharmony_ci * 0:0 1 = active, 0 = passive 23918c2ecf20Sopenharmony_ci * 1:20 SSID direct bit map; if a bit is set, then corresponding 23928c2ecf20Sopenharmony_ci * SSID IE is transmitted in probe request. 23938c2ecf20Sopenharmony_ci * 21:31 reserved 23948c2ecf20Sopenharmony_ci */ 23958c2ecf20Sopenharmony_ci __le32 type; 23968c2ecf20Sopenharmony_ci __le16 channel; /* band is selected by il_scan_cmd "flags" field */ 23978c2ecf20Sopenharmony_ci u8 tx_gain; /* gain for analog radio */ 23988c2ecf20Sopenharmony_ci u8 dsp_atten; /* gain for DSP */ 23998c2ecf20Sopenharmony_ci __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ 24008c2ecf20Sopenharmony_ci __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ 24018c2ecf20Sopenharmony_ci} __packed; 24028c2ecf20Sopenharmony_ci 24038c2ecf20Sopenharmony_ci/* set number of direct probes __le32 type */ 24048c2ecf20Sopenharmony_ci#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 24058c2ecf20Sopenharmony_ci 24068c2ecf20Sopenharmony_ci/** 24078c2ecf20Sopenharmony_ci * struct il_ssid_ie - directed scan network information element 24088c2ecf20Sopenharmony_ci * 24098c2ecf20Sopenharmony_ci * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in 24108c2ecf20Sopenharmony_ci * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel; 24118c2ecf20Sopenharmony_ci * each channel may select different ssids from among the 20 (4) entries. 24128c2ecf20Sopenharmony_ci * SSID IEs get transmitted in reverse order of entry. 24138c2ecf20Sopenharmony_ci */ 24148c2ecf20Sopenharmony_cistruct il_ssid_ie { 24158c2ecf20Sopenharmony_ci u8 id; 24168c2ecf20Sopenharmony_ci u8 len; 24178c2ecf20Sopenharmony_ci u8 ssid[32]; 24188c2ecf20Sopenharmony_ci} __packed; 24198c2ecf20Sopenharmony_ci 24208c2ecf20Sopenharmony_ci#define PROBE_OPTION_MAX_3945 4 24218c2ecf20Sopenharmony_ci#define PROBE_OPTION_MAX 20 24228c2ecf20Sopenharmony_ci#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 24238c2ecf20Sopenharmony_ci#define IL_GOOD_CRC_TH_DISABLED 0 24248c2ecf20Sopenharmony_ci#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 24258c2ecf20Sopenharmony_ci#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) 24268c2ecf20Sopenharmony_ci#define IL_MAX_SCAN_SIZE 1024 24278c2ecf20Sopenharmony_ci#define IL_MAX_CMD_SIZE 4096 24288c2ecf20Sopenharmony_ci 24298c2ecf20Sopenharmony_ci/* 24308c2ecf20Sopenharmony_ci * C_SCAN = 0x80 (command) 24318c2ecf20Sopenharmony_ci * 24328c2ecf20Sopenharmony_ci * The hardware scan command is very powerful; the driver can set it up to 24338c2ecf20Sopenharmony_ci * maintain (relatively) normal network traffic while doing a scan in the 24348c2ecf20Sopenharmony_ci * background. The max_out_time and suspend_time control the ratio of how 24358c2ecf20Sopenharmony_ci * long the device stays on an associated network channel ("service channel") 24368c2ecf20Sopenharmony_ci * vs. how long it's away from the service channel, i.e. tuned to other channels 24378c2ecf20Sopenharmony_ci * for scanning. 24388c2ecf20Sopenharmony_ci * 24398c2ecf20Sopenharmony_ci * max_out_time is the max time off-channel (in usec), and suspend_time 24408c2ecf20Sopenharmony_ci * is how long (in "extended beacon" format) that the scan is "suspended" 24418c2ecf20Sopenharmony_ci * after returning to the service channel. That is, suspend_time is the 24428c2ecf20Sopenharmony_ci * time that we stay on the service channel, doing normal work, between 24438c2ecf20Sopenharmony_ci * scan segments. The driver may set these parameters differently to support 24448c2ecf20Sopenharmony_ci * scanning when associated vs. not associated, and light vs. heavy traffic 24458c2ecf20Sopenharmony_ci * loads when associated. 24468c2ecf20Sopenharmony_ci * 24478c2ecf20Sopenharmony_ci * After receiving this command, the device's scan engine does the following; 24488c2ecf20Sopenharmony_ci * 24498c2ecf20Sopenharmony_ci * 1) Sends SCAN_START notification to driver 24508c2ecf20Sopenharmony_ci * 2) Checks to see if it has time to do scan for one channel 24518c2ecf20Sopenharmony_ci * 3) Sends NULL packet, with power-save (PS) bit set to 1, 24528c2ecf20Sopenharmony_ci * to tell AP that we're going off-channel 24538c2ecf20Sopenharmony_ci * 4) Tunes to first channel in scan list, does active or passive scan 24548c2ecf20Sopenharmony_ci * 5) Sends SCAN_RESULT notification to driver 24558c2ecf20Sopenharmony_ci * 6) Checks to see if it has time to do scan on *next* channel in list 24568c2ecf20Sopenharmony_ci * 7) Repeats 4-6 until it no longer has time to scan the next channel 24578c2ecf20Sopenharmony_ci * before max_out_time expires 24588c2ecf20Sopenharmony_ci * 8) Returns to service channel 24598c2ecf20Sopenharmony_ci * 9) Sends NULL packet with PS=0 to tell AP that we're back 24608c2ecf20Sopenharmony_ci * 10) Stays on service channel until suspend_time expires 24618c2ecf20Sopenharmony_ci * 11) Repeats entire process 2-10 until list is complete 24628c2ecf20Sopenharmony_ci * 12) Sends SCAN_COMPLETE notification 24638c2ecf20Sopenharmony_ci * 24648c2ecf20Sopenharmony_ci * For fast, efficient scans, the scan command also has support for staying on 24658c2ecf20Sopenharmony_ci * a channel for just a short time, if doing active scanning and getting no 24668c2ecf20Sopenharmony_ci * responses to the transmitted probe request. This time is controlled by 24678c2ecf20Sopenharmony_ci * quiet_time, and the number of received packets below which a channel is 24688c2ecf20Sopenharmony_ci * considered "quiet" is controlled by quiet_plcp_threshold. 24698c2ecf20Sopenharmony_ci * 24708c2ecf20Sopenharmony_ci * For active scanning on channels that have regulatory restrictions against 24718c2ecf20Sopenharmony_ci * blindly transmitting, the scan can listen before transmitting, to make sure 24728c2ecf20Sopenharmony_ci * that there is already legitimate activity on the channel. If enough 24738c2ecf20Sopenharmony_ci * packets are cleanly received on the channel (controlled by good_CRC_th, 24748c2ecf20Sopenharmony_ci * typical value 1), the scan engine starts transmitting probe requests. 24758c2ecf20Sopenharmony_ci * 24768c2ecf20Sopenharmony_ci * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. 24778c2ecf20Sopenharmony_ci * 24788c2ecf20Sopenharmony_ci * To avoid uCode errors, see timing restrictions described under 24798c2ecf20Sopenharmony_ci * struct il_scan_channel. 24808c2ecf20Sopenharmony_ci */ 24818c2ecf20Sopenharmony_ci 24828c2ecf20Sopenharmony_cistruct il3945_scan_cmd { 24838c2ecf20Sopenharmony_ci __le16 len; 24848c2ecf20Sopenharmony_ci u8 reserved0; 24858c2ecf20Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 24868c2ecf20Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 24878c2ecf20Sopenharmony_ci * (only for active scan) */ 24888c2ecf20Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 24898c2ecf20Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 24908c2ecf20Sopenharmony_ci __le16 reserved1; 24918c2ecf20Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 24928c2ecf20Sopenharmony_ci * channel */ 24938c2ecf20Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 24948c2ecf20Sopenharmony_ci * format") when returning to service channel: 24958c2ecf20Sopenharmony_ci * 3945; 31:24 # beacons, 19:0 additional usec, 24968c2ecf20Sopenharmony_ci * 4965; 31:22 # beacons, 21:0 additional usec. 24978c2ecf20Sopenharmony_ci */ 24988c2ecf20Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 24998c2ecf20Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 25008c2ecf20Sopenharmony_ci 25018c2ecf20Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 25028c2ecf20Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 25038c2ecf20Sopenharmony_ci struct il3945_tx_cmd tx_cmd; 25048c2ecf20Sopenharmony_ci 25058c2ecf20Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 25068c2ecf20Sopenharmony_ci struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; 25078c2ecf20Sopenharmony_ci 25088c2ecf20Sopenharmony_ci /* 25098c2ecf20Sopenharmony_ci * Probe request frame, followed by channel list. 25108c2ecf20Sopenharmony_ci * 25118c2ecf20Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 25128c2ecf20Sopenharmony_ci * Channel list follows immediately after probe request frame. 25138c2ecf20Sopenharmony_ci * Number of channels in list is specified by channel_count. 25148c2ecf20Sopenharmony_ci * Each channel in list is of type: 25158c2ecf20Sopenharmony_ci * 25168c2ecf20Sopenharmony_ci * struct il3945_scan_channel channels[0]; 25178c2ecf20Sopenharmony_ci * 25188c2ecf20Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 25198c2ecf20Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 25208c2ecf20Sopenharmony_ci * for one scan to complete (i.e. receive N_SCAN_COMPLETE) 25218c2ecf20Sopenharmony_ci * before requesting another scan. 25228c2ecf20Sopenharmony_ci */ 25238c2ecf20Sopenharmony_ci u8 data[]; 25248c2ecf20Sopenharmony_ci} __packed; 25258c2ecf20Sopenharmony_ci 25268c2ecf20Sopenharmony_cistruct il_scan_cmd { 25278c2ecf20Sopenharmony_ci __le16 len; 25288c2ecf20Sopenharmony_ci u8 reserved0; 25298c2ecf20Sopenharmony_ci u8 channel_count; /* # channels in channel list */ 25308c2ecf20Sopenharmony_ci __le16 quiet_time; /* dwell only this # millisecs on quiet channel 25318c2ecf20Sopenharmony_ci * (only for active scan) */ 25328c2ecf20Sopenharmony_ci __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 25338c2ecf20Sopenharmony_ci __le16 good_CRC_th; /* passive -> active promotion threshold */ 25348c2ecf20Sopenharmony_ci __le16 rx_chain; /* RXON_RX_CHAIN_* */ 25358c2ecf20Sopenharmony_ci __le32 max_out_time; /* max usec to be away from associated (service) 25368c2ecf20Sopenharmony_ci * channel */ 25378c2ecf20Sopenharmony_ci __le32 suspend_time; /* pause scan this long (in "extended beacon 25388c2ecf20Sopenharmony_ci * format") when returning to service chnl: 25398c2ecf20Sopenharmony_ci * 3945; 31:24 # beacons, 19:0 additional usec, 25408c2ecf20Sopenharmony_ci * 4965; 31:22 # beacons, 21:0 additional usec. 25418c2ecf20Sopenharmony_ci */ 25428c2ecf20Sopenharmony_ci __le32 flags; /* RXON_FLG_* */ 25438c2ecf20Sopenharmony_ci __le32 filter_flags; /* RXON_FILTER_* */ 25448c2ecf20Sopenharmony_ci 25458c2ecf20Sopenharmony_ci /* For active scans (set to all-0s for passive scans). 25468c2ecf20Sopenharmony_ci * Does not include payload. Must specify Tx rate; no rate scaling. */ 25478c2ecf20Sopenharmony_ci struct il_tx_cmd tx_cmd; 25488c2ecf20Sopenharmony_ci 25498c2ecf20Sopenharmony_ci /* For directed active scans (set to all-0s otherwise) */ 25508c2ecf20Sopenharmony_ci struct il_ssid_ie direct_scan[PROBE_OPTION_MAX]; 25518c2ecf20Sopenharmony_ci 25528c2ecf20Sopenharmony_ci /* 25538c2ecf20Sopenharmony_ci * Probe request frame, followed by channel list. 25548c2ecf20Sopenharmony_ci * 25558c2ecf20Sopenharmony_ci * Size of probe request frame is specified by byte count in tx_cmd. 25568c2ecf20Sopenharmony_ci * Channel list follows immediately after probe request frame. 25578c2ecf20Sopenharmony_ci * Number of channels in list is specified by channel_count. 25588c2ecf20Sopenharmony_ci * Each channel in list is of type: 25598c2ecf20Sopenharmony_ci * 25608c2ecf20Sopenharmony_ci * struct il_scan_channel channels[0]; 25618c2ecf20Sopenharmony_ci * 25628c2ecf20Sopenharmony_ci * NOTE: Only one band of channels can be scanned per pass. You 25638c2ecf20Sopenharmony_ci * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait 25648c2ecf20Sopenharmony_ci * for one scan to complete (i.e. receive N_SCAN_COMPLETE) 25658c2ecf20Sopenharmony_ci * before requesting another scan. 25668c2ecf20Sopenharmony_ci */ 25678c2ecf20Sopenharmony_ci u8 data[]; 25688c2ecf20Sopenharmony_ci} __packed; 25698c2ecf20Sopenharmony_ci 25708c2ecf20Sopenharmony_ci/* Can abort will notify by complete notification with abort status. */ 25718c2ecf20Sopenharmony_ci#define CAN_ABORT_STATUS cpu_to_le32(0x1) 25728c2ecf20Sopenharmony_ci/* complete notification statuses */ 25738c2ecf20Sopenharmony_ci#define ABORT_STATUS 0x2 25748c2ecf20Sopenharmony_ci 25758c2ecf20Sopenharmony_ci/* 25768c2ecf20Sopenharmony_ci * C_SCAN = 0x80 (response) 25778c2ecf20Sopenharmony_ci */ 25788c2ecf20Sopenharmony_cistruct il_scanreq_notification { 25798c2ecf20Sopenharmony_ci __le32 status; /* 1: okay, 2: cannot fulfill request */ 25808c2ecf20Sopenharmony_ci} __packed; 25818c2ecf20Sopenharmony_ci 25828c2ecf20Sopenharmony_ci/* 25838c2ecf20Sopenharmony_ci * N_SCAN_START = 0x82 (notification only, not a command) 25848c2ecf20Sopenharmony_ci */ 25858c2ecf20Sopenharmony_cistruct il_scanstart_notification { 25868c2ecf20Sopenharmony_ci __le32 tsf_low; 25878c2ecf20Sopenharmony_ci __le32 tsf_high; 25888c2ecf20Sopenharmony_ci __le32 beacon_timer; 25898c2ecf20Sopenharmony_ci u8 channel; 25908c2ecf20Sopenharmony_ci u8 band; 25918c2ecf20Sopenharmony_ci u8 reserved[2]; 25928c2ecf20Sopenharmony_ci __le32 status; 25938c2ecf20Sopenharmony_ci} __packed; 25948c2ecf20Sopenharmony_ci 25958c2ecf20Sopenharmony_ci#define SCAN_OWNER_STATUS 0x1 25968c2ecf20Sopenharmony_ci#define MEASURE_OWNER_STATUS 0x2 25978c2ecf20Sopenharmony_ci 25988c2ecf20Sopenharmony_ci#define IL_PROBE_STATUS_OK 0 25998c2ecf20Sopenharmony_ci#define IL_PROBE_STATUS_TX_FAILED BIT(0) 26008c2ecf20Sopenharmony_ci/* error statuses combined with TX_FAILED */ 26018c2ecf20Sopenharmony_ci#define IL_PROBE_STATUS_FAIL_TTL BIT(1) 26028c2ecf20Sopenharmony_ci#define IL_PROBE_STATUS_FAIL_BT BIT(2) 26038c2ecf20Sopenharmony_ci 26048c2ecf20Sopenharmony_ci#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */ 26058c2ecf20Sopenharmony_ci/* 26068c2ecf20Sopenharmony_ci * N_SCAN_RESULTS = 0x83 (notification only, not a command) 26078c2ecf20Sopenharmony_ci */ 26088c2ecf20Sopenharmony_cistruct il_scanresults_notification { 26098c2ecf20Sopenharmony_ci u8 channel; 26108c2ecf20Sopenharmony_ci u8 band; 26118c2ecf20Sopenharmony_ci u8 probe_status; 26128c2ecf20Sopenharmony_ci u8 num_probe_not_sent; /* not enough time to send */ 26138c2ecf20Sopenharmony_ci __le32 tsf_low; 26148c2ecf20Sopenharmony_ci __le32 tsf_high; 26158c2ecf20Sopenharmony_ci __le32 stats[NUMBER_OF_STATS]; 26168c2ecf20Sopenharmony_ci} __packed; 26178c2ecf20Sopenharmony_ci 26188c2ecf20Sopenharmony_ci/* 26198c2ecf20Sopenharmony_ci * N_SCAN_COMPLETE = 0x84 (notification only, not a command) 26208c2ecf20Sopenharmony_ci */ 26218c2ecf20Sopenharmony_cistruct il_scancomplete_notification { 26228c2ecf20Sopenharmony_ci u8 scanned_channels; 26238c2ecf20Sopenharmony_ci u8 status; 26248c2ecf20Sopenharmony_ci u8 last_channel; 26258c2ecf20Sopenharmony_ci __le32 tsf_low; 26268c2ecf20Sopenharmony_ci __le32 tsf_high; 26278c2ecf20Sopenharmony_ci} __packed; 26288c2ecf20Sopenharmony_ci 26298c2ecf20Sopenharmony_ci/****************************************************************************** 26308c2ecf20Sopenharmony_ci * (9) 26318c2ecf20Sopenharmony_ci * IBSS/AP Commands and Notifications: 26328c2ecf20Sopenharmony_ci * 26338c2ecf20Sopenharmony_ci *****************************************************************************/ 26348c2ecf20Sopenharmony_ci 26358c2ecf20Sopenharmony_cienum il_ibss_manager { 26368c2ecf20Sopenharmony_ci IL_NOT_IBSS_MANAGER = 0, 26378c2ecf20Sopenharmony_ci IL_IBSS_MANAGER = 1, 26388c2ecf20Sopenharmony_ci}; 26398c2ecf20Sopenharmony_ci 26408c2ecf20Sopenharmony_ci/* 26418c2ecf20Sopenharmony_ci * N_BEACON = 0x90 (notification only, not a command) 26428c2ecf20Sopenharmony_ci */ 26438c2ecf20Sopenharmony_ci 26448c2ecf20Sopenharmony_cistruct il3945_beacon_notif { 26458c2ecf20Sopenharmony_ci struct il3945_tx_resp beacon_notify_hdr; 26468c2ecf20Sopenharmony_ci __le32 low_tsf; 26478c2ecf20Sopenharmony_ci __le32 high_tsf; 26488c2ecf20Sopenharmony_ci __le32 ibss_mgr_status; 26498c2ecf20Sopenharmony_ci} __packed; 26508c2ecf20Sopenharmony_ci 26518c2ecf20Sopenharmony_cistruct il4965_beacon_notif { 26528c2ecf20Sopenharmony_ci struct il4965_tx_resp beacon_notify_hdr; 26538c2ecf20Sopenharmony_ci __le32 low_tsf; 26548c2ecf20Sopenharmony_ci __le32 high_tsf; 26558c2ecf20Sopenharmony_ci __le32 ibss_mgr_status; 26568c2ecf20Sopenharmony_ci} __packed; 26578c2ecf20Sopenharmony_ci 26588c2ecf20Sopenharmony_ci/* 26598c2ecf20Sopenharmony_ci * C_TX_BEACON= 0x91 (command, has simple generic response) 26608c2ecf20Sopenharmony_ci */ 26618c2ecf20Sopenharmony_ci 26628c2ecf20Sopenharmony_cistruct il3945_tx_beacon_cmd { 26638c2ecf20Sopenharmony_ci struct il3945_tx_cmd tx; 26648c2ecf20Sopenharmony_ci __le16 tim_idx; 26658c2ecf20Sopenharmony_ci u8 tim_size; 26668c2ecf20Sopenharmony_ci u8 reserved1; 26678c2ecf20Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 26688c2ecf20Sopenharmony_ci} __packed; 26698c2ecf20Sopenharmony_ci 26708c2ecf20Sopenharmony_cistruct il_tx_beacon_cmd { 26718c2ecf20Sopenharmony_ci struct il_tx_cmd tx; 26728c2ecf20Sopenharmony_ci __le16 tim_idx; 26738c2ecf20Sopenharmony_ci u8 tim_size; 26748c2ecf20Sopenharmony_ci u8 reserved1; 26758c2ecf20Sopenharmony_ci struct ieee80211_hdr frame[]; /* beacon frame */ 26768c2ecf20Sopenharmony_ci} __packed; 26778c2ecf20Sopenharmony_ci 26788c2ecf20Sopenharmony_ci/****************************************************************************** 26798c2ecf20Sopenharmony_ci * (10) 26808c2ecf20Sopenharmony_ci * Statistics Commands and Notifications: 26818c2ecf20Sopenharmony_ci * 26828c2ecf20Sopenharmony_ci *****************************************************************************/ 26838c2ecf20Sopenharmony_ci 26848c2ecf20Sopenharmony_ci#define IL_TEMP_CONVERT 260 26858c2ecf20Sopenharmony_ci 26868c2ecf20Sopenharmony_ci#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 26878c2ecf20Sopenharmony_ci#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 26888c2ecf20Sopenharmony_ci#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 26898c2ecf20Sopenharmony_ci 26908c2ecf20Sopenharmony_ci/* Used for passing to driver number of successes and failures per rate */ 26918c2ecf20Sopenharmony_cistruct rate_histogram { 26928c2ecf20Sopenharmony_ci union { 26938c2ecf20Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 26948c2ecf20Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 26958c2ecf20Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 26968c2ecf20Sopenharmony_ci } success; 26978c2ecf20Sopenharmony_ci union { 26988c2ecf20Sopenharmony_ci __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; 26998c2ecf20Sopenharmony_ci __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; 27008c2ecf20Sopenharmony_ci __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; 27018c2ecf20Sopenharmony_ci } failed; 27028c2ecf20Sopenharmony_ci} __packed; 27038c2ecf20Sopenharmony_ci 27048c2ecf20Sopenharmony_ci/* stats command response */ 27058c2ecf20Sopenharmony_ci 27068c2ecf20Sopenharmony_cistruct iwl39_stats_rx_phy { 27078c2ecf20Sopenharmony_ci __le32 ina_cnt; 27088c2ecf20Sopenharmony_ci __le32 fina_cnt; 27098c2ecf20Sopenharmony_ci __le32 plcp_err; 27108c2ecf20Sopenharmony_ci __le32 crc32_err; 27118c2ecf20Sopenharmony_ci __le32 overrun_err; 27128c2ecf20Sopenharmony_ci __le32 early_overrun_err; 27138c2ecf20Sopenharmony_ci __le32 crc32_good; 27148c2ecf20Sopenharmony_ci __le32 false_alarm_cnt; 27158c2ecf20Sopenharmony_ci __le32 fina_sync_err_cnt; 27168c2ecf20Sopenharmony_ci __le32 sfd_timeout; 27178c2ecf20Sopenharmony_ci __le32 fina_timeout; 27188c2ecf20Sopenharmony_ci __le32 unresponded_rts; 27198c2ecf20Sopenharmony_ci __le32 rxe_frame_limit_overrun; 27208c2ecf20Sopenharmony_ci __le32 sent_ack_cnt; 27218c2ecf20Sopenharmony_ci __le32 sent_cts_cnt; 27228c2ecf20Sopenharmony_ci} __packed; 27238c2ecf20Sopenharmony_ci 27248c2ecf20Sopenharmony_cistruct iwl39_stats_rx_non_phy { 27258c2ecf20Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 27268c2ecf20Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 27278c2ecf20Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 27288c2ecf20Sopenharmony_ci * doesn't belong to the STA BSSID */ 27298c2ecf20Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 27308c2ecf20Sopenharmony_ci * filtering process */ 27318c2ecf20Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 27328c2ecf20Sopenharmony_ci * our serving channel */ 27338c2ecf20Sopenharmony_ci} __packed; 27348c2ecf20Sopenharmony_ci 27358c2ecf20Sopenharmony_cistruct iwl39_stats_rx { 27368c2ecf20Sopenharmony_ci struct iwl39_stats_rx_phy ofdm; 27378c2ecf20Sopenharmony_ci struct iwl39_stats_rx_phy cck; 27388c2ecf20Sopenharmony_ci struct iwl39_stats_rx_non_phy general; 27398c2ecf20Sopenharmony_ci} __packed; 27408c2ecf20Sopenharmony_ci 27418c2ecf20Sopenharmony_cistruct iwl39_stats_tx { 27428c2ecf20Sopenharmony_ci __le32 preamble_cnt; 27438c2ecf20Sopenharmony_ci __le32 rx_detected_cnt; 27448c2ecf20Sopenharmony_ci __le32 bt_prio_defer_cnt; 27458c2ecf20Sopenharmony_ci __le32 bt_prio_kill_cnt; 27468c2ecf20Sopenharmony_ci __le32 few_bytes_cnt; 27478c2ecf20Sopenharmony_ci __le32 cts_timeout; 27488c2ecf20Sopenharmony_ci __le32 ack_timeout; 27498c2ecf20Sopenharmony_ci __le32 expected_ack_cnt; 27508c2ecf20Sopenharmony_ci __le32 actual_ack_cnt; 27518c2ecf20Sopenharmony_ci} __packed; 27528c2ecf20Sopenharmony_ci 27538c2ecf20Sopenharmony_cistruct stats_dbg { 27548c2ecf20Sopenharmony_ci __le32 burst_check; 27558c2ecf20Sopenharmony_ci __le32 burst_count; 27568c2ecf20Sopenharmony_ci __le32 wait_for_silence_timeout_cnt; 27578c2ecf20Sopenharmony_ci __le32 reserved[3]; 27588c2ecf20Sopenharmony_ci} __packed; 27598c2ecf20Sopenharmony_ci 27608c2ecf20Sopenharmony_cistruct iwl39_stats_div { 27618c2ecf20Sopenharmony_ci __le32 tx_on_a; 27628c2ecf20Sopenharmony_ci __le32 tx_on_b; 27638c2ecf20Sopenharmony_ci __le32 exec_time; 27648c2ecf20Sopenharmony_ci __le32 probe_time; 27658c2ecf20Sopenharmony_ci} __packed; 27668c2ecf20Sopenharmony_ci 27678c2ecf20Sopenharmony_cistruct iwl39_stats_general { 27688c2ecf20Sopenharmony_ci __le32 temperature; 27698c2ecf20Sopenharmony_ci struct stats_dbg dbg; 27708c2ecf20Sopenharmony_ci __le32 sleep_time; 27718c2ecf20Sopenharmony_ci __le32 slots_out; 27728c2ecf20Sopenharmony_ci __le32 slots_idle; 27738c2ecf20Sopenharmony_ci __le32 ttl_timestamp; 27748c2ecf20Sopenharmony_ci struct iwl39_stats_div div; 27758c2ecf20Sopenharmony_ci} __packed; 27768c2ecf20Sopenharmony_ci 27778c2ecf20Sopenharmony_cistruct stats_rx_phy { 27788c2ecf20Sopenharmony_ci __le32 ina_cnt; 27798c2ecf20Sopenharmony_ci __le32 fina_cnt; 27808c2ecf20Sopenharmony_ci __le32 plcp_err; 27818c2ecf20Sopenharmony_ci __le32 crc32_err; 27828c2ecf20Sopenharmony_ci __le32 overrun_err; 27838c2ecf20Sopenharmony_ci __le32 early_overrun_err; 27848c2ecf20Sopenharmony_ci __le32 crc32_good; 27858c2ecf20Sopenharmony_ci __le32 false_alarm_cnt; 27868c2ecf20Sopenharmony_ci __le32 fina_sync_err_cnt; 27878c2ecf20Sopenharmony_ci __le32 sfd_timeout; 27888c2ecf20Sopenharmony_ci __le32 fina_timeout; 27898c2ecf20Sopenharmony_ci __le32 unresponded_rts; 27908c2ecf20Sopenharmony_ci __le32 rxe_frame_limit_overrun; 27918c2ecf20Sopenharmony_ci __le32 sent_ack_cnt; 27928c2ecf20Sopenharmony_ci __le32 sent_cts_cnt; 27938c2ecf20Sopenharmony_ci __le32 sent_ba_rsp_cnt; 27948c2ecf20Sopenharmony_ci __le32 dsp_self_kill; 27958c2ecf20Sopenharmony_ci __le32 mh_format_err; 27968c2ecf20Sopenharmony_ci __le32 re_acq_main_rssi_sum; 27978c2ecf20Sopenharmony_ci __le32 reserved3; 27988c2ecf20Sopenharmony_ci} __packed; 27998c2ecf20Sopenharmony_ci 28008c2ecf20Sopenharmony_cistruct stats_rx_ht_phy { 28018c2ecf20Sopenharmony_ci __le32 plcp_err; 28028c2ecf20Sopenharmony_ci __le32 overrun_err; 28038c2ecf20Sopenharmony_ci __le32 early_overrun_err; 28048c2ecf20Sopenharmony_ci __le32 crc32_good; 28058c2ecf20Sopenharmony_ci __le32 crc32_err; 28068c2ecf20Sopenharmony_ci __le32 mh_format_err; 28078c2ecf20Sopenharmony_ci __le32 agg_crc32_good; 28088c2ecf20Sopenharmony_ci __le32 agg_mpdu_cnt; 28098c2ecf20Sopenharmony_ci __le32 agg_cnt; 28108c2ecf20Sopenharmony_ci __le32 unsupport_mcs; 28118c2ecf20Sopenharmony_ci} __packed; 28128c2ecf20Sopenharmony_ci 28138c2ecf20Sopenharmony_ci#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) 28148c2ecf20Sopenharmony_ci 28158c2ecf20Sopenharmony_cistruct stats_rx_non_phy { 28168c2ecf20Sopenharmony_ci __le32 bogus_cts; /* CTS received when not expecting CTS */ 28178c2ecf20Sopenharmony_ci __le32 bogus_ack; /* ACK received when not expecting ACK */ 28188c2ecf20Sopenharmony_ci __le32 non_bssid_frames; /* number of frames with BSSID that 28198c2ecf20Sopenharmony_ci * doesn't belong to the STA BSSID */ 28208c2ecf20Sopenharmony_ci __le32 filtered_frames; /* count frames that were dumped in the 28218c2ecf20Sopenharmony_ci * filtering process */ 28228c2ecf20Sopenharmony_ci __le32 non_channel_beacons; /* beacons with our bss id but not on 28238c2ecf20Sopenharmony_ci * our serving channel */ 28248c2ecf20Sopenharmony_ci __le32 channel_beacons; /* beacons with our bss id and in our 28258c2ecf20Sopenharmony_ci * serving channel */ 28268c2ecf20Sopenharmony_ci __le32 num_missed_bcon; /* number of missed beacons */ 28278c2ecf20Sopenharmony_ci __le32 adc_rx_saturation_time; /* count in 0.8us units the time the 28288c2ecf20Sopenharmony_ci * ADC was in saturation */ 28298c2ecf20Sopenharmony_ci __le32 ina_detection_search_time; /* total time (in 0.8us) searched 28308c2ecf20Sopenharmony_ci * for INA */ 28318c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ 28328c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ 28338c2ecf20Sopenharmony_ci __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ 28348c2ecf20Sopenharmony_ci __le32 interference_data_flag; /* flag for interference data 28358c2ecf20Sopenharmony_ci * availability. 1 when data is 28368c2ecf20Sopenharmony_ci * available. */ 28378c2ecf20Sopenharmony_ci __le32 channel_load; /* counts RX Enable time in uSec */ 28388c2ecf20Sopenharmony_ci __le32 dsp_false_alarms; /* DSP false alarm (both OFDM 28398c2ecf20Sopenharmony_ci * and CCK) counter */ 28408c2ecf20Sopenharmony_ci __le32 beacon_rssi_a; 28418c2ecf20Sopenharmony_ci __le32 beacon_rssi_b; 28428c2ecf20Sopenharmony_ci __le32 beacon_rssi_c; 28438c2ecf20Sopenharmony_ci __le32 beacon_energy_a; 28448c2ecf20Sopenharmony_ci __le32 beacon_energy_b; 28458c2ecf20Sopenharmony_ci __le32 beacon_energy_c; 28468c2ecf20Sopenharmony_ci} __packed; 28478c2ecf20Sopenharmony_ci 28488c2ecf20Sopenharmony_cistruct stats_rx { 28498c2ecf20Sopenharmony_ci struct stats_rx_phy ofdm; 28508c2ecf20Sopenharmony_ci struct stats_rx_phy cck; 28518c2ecf20Sopenharmony_ci struct stats_rx_non_phy general; 28528c2ecf20Sopenharmony_ci struct stats_rx_ht_phy ofdm_ht; 28538c2ecf20Sopenharmony_ci} __packed; 28548c2ecf20Sopenharmony_ci 28558c2ecf20Sopenharmony_ci/** 28568c2ecf20Sopenharmony_ci * struct stats_tx_power - current tx power 28578c2ecf20Sopenharmony_ci * 28588c2ecf20Sopenharmony_ci * @ant_a: current tx power on chain a in 1/2 dB step 28598c2ecf20Sopenharmony_ci * @ant_b: current tx power on chain b in 1/2 dB step 28608c2ecf20Sopenharmony_ci * @ant_c: current tx power on chain c in 1/2 dB step 28618c2ecf20Sopenharmony_ci */ 28628c2ecf20Sopenharmony_cistruct stats_tx_power { 28638c2ecf20Sopenharmony_ci u8 ant_a; 28648c2ecf20Sopenharmony_ci u8 ant_b; 28658c2ecf20Sopenharmony_ci u8 ant_c; 28668c2ecf20Sopenharmony_ci u8 reserved; 28678c2ecf20Sopenharmony_ci} __packed; 28688c2ecf20Sopenharmony_ci 28698c2ecf20Sopenharmony_cistruct stats_tx_non_phy_agg { 28708c2ecf20Sopenharmony_ci __le32 ba_timeout; 28718c2ecf20Sopenharmony_ci __le32 ba_reschedule_frames; 28728c2ecf20Sopenharmony_ci __le32 scd_query_agg_frame_cnt; 28738c2ecf20Sopenharmony_ci __le32 scd_query_no_agg; 28748c2ecf20Sopenharmony_ci __le32 scd_query_agg; 28758c2ecf20Sopenharmony_ci __le32 scd_query_mismatch; 28768c2ecf20Sopenharmony_ci __le32 frame_not_ready; 28778c2ecf20Sopenharmony_ci __le32 underrun; 28788c2ecf20Sopenharmony_ci __le32 bt_prio_kill; 28798c2ecf20Sopenharmony_ci __le32 rx_ba_rsp_cnt; 28808c2ecf20Sopenharmony_ci} __packed; 28818c2ecf20Sopenharmony_ci 28828c2ecf20Sopenharmony_cistruct stats_tx { 28838c2ecf20Sopenharmony_ci __le32 preamble_cnt; 28848c2ecf20Sopenharmony_ci __le32 rx_detected_cnt; 28858c2ecf20Sopenharmony_ci __le32 bt_prio_defer_cnt; 28868c2ecf20Sopenharmony_ci __le32 bt_prio_kill_cnt; 28878c2ecf20Sopenharmony_ci __le32 few_bytes_cnt; 28888c2ecf20Sopenharmony_ci __le32 cts_timeout; 28898c2ecf20Sopenharmony_ci __le32 ack_timeout; 28908c2ecf20Sopenharmony_ci __le32 expected_ack_cnt; 28918c2ecf20Sopenharmony_ci __le32 actual_ack_cnt; 28928c2ecf20Sopenharmony_ci __le32 dump_msdu_cnt; 28938c2ecf20Sopenharmony_ci __le32 burst_abort_next_frame_mismatch_cnt; 28948c2ecf20Sopenharmony_ci __le32 burst_abort_missing_next_frame_cnt; 28958c2ecf20Sopenharmony_ci __le32 cts_timeout_collision; 28968c2ecf20Sopenharmony_ci __le32 ack_or_ba_timeout_collision; 28978c2ecf20Sopenharmony_ci struct stats_tx_non_phy_agg agg; 28988c2ecf20Sopenharmony_ci 28998c2ecf20Sopenharmony_ci __le32 reserved1; 29008c2ecf20Sopenharmony_ci} __packed; 29018c2ecf20Sopenharmony_ci 29028c2ecf20Sopenharmony_cistruct stats_div { 29038c2ecf20Sopenharmony_ci __le32 tx_on_a; 29048c2ecf20Sopenharmony_ci __le32 tx_on_b; 29058c2ecf20Sopenharmony_ci __le32 exec_time; 29068c2ecf20Sopenharmony_ci __le32 probe_time; 29078c2ecf20Sopenharmony_ci __le32 reserved1; 29088c2ecf20Sopenharmony_ci __le32 reserved2; 29098c2ecf20Sopenharmony_ci} __packed; 29108c2ecf20Sopenharmony_ci 29118c2ecf20Sopenharmony_cistruct stats_general_common { 29128c2ecf20Sopenharmony_ci __le32 temperature; /* radio temperature */ 29138c2ecf20Sopenharmony_ci struct stats_dbg dbg; 29148c2ecf20Sopenharmony_ci __le32 sleep_time; 29158c2ecf20Sopenharmony_ci __le32 slots_out; 29168c2ecf20Sopenharmony_ci __le32 slots_idle; 29178c2ecf20Sopenharmony_ci __le32 ttl_timestamp; 29188c2ecf20Sopenharmony_ci struct stats_div div; 29198c2ecf20Sopenharmony_ci __le32 rx_enable_counter; 29208c2ecf20Sopenharmony_ci /* 29218c2ecf20Sopenharmony_ci * num_of_sos_states: 29228c2ecf20Sopenharmony_ci * count the number of times we have to re-tune 29238c2ecf20Sopenharmony_ci * in order to get out of bad PHY status 29248c2ecf20Sopenharmony_ci */ 29258c2ecf20Sopenharmony_ci __le32 num_of_sos_states; 29268c2ecf20Sopenharmony_ci} __packed; 29278c2ecf20Sopenharmony_ci 29288c2ecf20Sopenharmony_cistruct stats_general { 29298c2ecf20Sopenharmony_ci struct stats_general_common common; 29308c2ecf20Sopenharmony_ci __le32 reserved2; 29318c2ecf20Sopenharmony_ci __le32 reserved3; 29328c2ecf20Sopenharmony_ci} __packed; 29338c2ecf20Sopenharmony_ci 29348c2ecf20Sopenharmony_ci#define UCODE_STATS_CLEAR_MSK (0x1 << 0) 29358c2ecf20Sopenharmony_ci#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1) 29368c2ecf20Sopenharmony_ci#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2) 29378c2ecf20Sopenharmony_ci 29388c2ecf20Sopenharmony_ci/* 29398c2ecf20Sopenharmony_ci * C_STATS = 0x9c, 29408c2ecf20Sopenharmony_ci * all devices identical. 29418c2ecf20Sopenharmony_ci * 29428c2ecf20Sopenharmony_ci * This command triggers an immediate response containing uCode stats. 29438c2ecf20Sopenharmony_ci * The response is in the same format as N_STATS 0x9d, below. 29448c2ecf20Sopenharmony_ci * 29458c2ecf20Sopenharmony_ci * If the CLEAR_STATS configuration flag is set, uCode will clear its 29468c2ecf20Sopenharmony_ci * internal copy of the stats (counters) after issuing the response. 29478c2ecf20Sopenharmony_ci * This flag does not affect N_STATSs after beacons (see below). 29488c2ecf20Sopenharmony_ci * 29498c2ecf20Sopenharmony_ci * If the DISABLE_NOTIF configuration flag is set, uCode will not issue 29508c2ecf20Sopenharmony_ci * N_STATSs after received beacons (see below). This flag 29518c2ecf20Sopenharmony_ci * does not affect the response to the C_STATS 0x9c itself. 29528c2ecf20Sopenharmony_ci */ 29538c2ecf20Sopenharmony_ci#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ 29548c2ecf20Sopenharmony_ci#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2) /* see above */ 29558c2ecf20Sopenharmony_cistruct il_stats_cmd { 29568c2ecf20Sopenharmony_ci __le32 configuration_flags; /* IL_STATS_CONF_* */ 29578c2ecf20Sopenharmony_ci} __packed; 29588c2ecf20Sopenharmony_ci 29598c2ecf20Sopenharmony_ci/* 29608c2ecf20Sopenharmony_ci * N_STATS = 0x9d (notification only, not a command) 29618c2ecf20Sopenharmony_ci * 29628c2ecf20Sopenharmony_ci * By default, uCode issues this notification after receiving a beacon 29638c2ecf20Sopenharmony_ci * while associated. To disable this behavior, set DISABLE_NOTIF flag in the 29648c2ecf20Sopenharmony_ci * C_STATS 0x9c, above. 29658c2ecf20Sopenharmony_ci * 29668c2ecf20Sopenharmony_ci * Statistics counters continue to increment beacon after beacon, but are 29678c2ecf20Sopenharmony_ci * cleared when changing channels or when driver issues C_STATS 29688c2ecf20Sopenharmony_ci * 0x9c with CLEAR_STATS bit set (see above). 29698c2ecf20Sopenharmony_ci * 29708c2ecf20Sopenharmony_ci * uCode also issues this notification during scans. uCode clears stats 29718c2ecf20Sopenharmony_ci * appropriately so that each notification contains stats for only the 29728c2ecf20Sopenharmony_ci * one channel that has just been scanned. 29738c2ecf20Sopenharmony_ci */ 29748c2ecf20Sopenharmony_ci#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 29758c2ecf20Sopenharmony_ci#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) 29768c2ecf20Sopenharmony_ci 29778c2ecf20Sopenharmony_cistruct il3945_notif_stats { 29788c2ecf20Sopenharmony_ci __le32 flag; 29798c2ecf20Sopenharmony_ci struct iwl39_stats_rx rx; 29808c2ecf20Sopenharmony_ci struct iwl39_stats_tx tx; 29818c2ecf20Sopenharmony_ci struct iwl39_stats_general general; 29828c2ecf20Sopenharmony_ci} __packed; 29838c2ecf20Sopenharmony_ci 29848c2ecf20Sopenharmony_cistruct il_notif_stats { 29858c2ecf20Sopenharmony_ci __le32 flag; 29868c2ecf20Sopenharmony_ci struct stats_rx rx; 29878c2ecf20Sopenharmony_ci struct stats_tx tx; 29888c2ecf20Sopenharmony_ci struct stats_general general; 29898c2ecf20Sopenharmony_ci} __packed; 29908c2ecf20Sopenharmony_ci 29918c2ecf20Sopenharmony_ci/* 29928c2ecf20Sopenharmony_ci * N_MISSED_BEACONS = 0xa2 (notification only, not a command) 29938c2ecf20Sopenharmony_ci * 29948c2ecf20Sopenharmony_ci * uCode send N_MISSED_BEACONS to driver when detect beacon missed 29958c2ecf20Sopenharmony_ci * in regardless of how many missed beacons, which mean when driver receive the 29968c2ecf20Sopenharmony_ci * notification, inside the command, it can find all the beacons information 29978c2ecf20Sopenharmony_ci * which include number of total missed beacons, number of consecutive missed 29988c2ecf20Sopenharmony_ci * beacons, number of beacons received and number of beacons expected to 29998c2ecf20Sopenharmony_ci * receive. 30008c2ecf20Sopenharmony_ci * 30018c2ecf20Sopenharmony_ci * If uCode detected consecutive_missed_beacons > 5, it will reset the radio 30028c2ecf20Sopenharmony_ci * in order to bring the radio/PHY back to working state; which has no relation 30038c2ecf20Sopenharmony_ci * to when driver will perform sensitivity calibration. 30048c2ecf20Sopenharmony_ci * 30058c2ecf20Sopenharmony_ci * Driver should set it own missed_beacon_threshold to decide when to perform 30068c2ecf20Sopenharmony_ci * sensitivity calibration based on number of consecutive missed beacons in 30078c2ecf20Sopenharmony_ci * order to improve overall performance, especially in noisy environment. 30088c2ecf20Sopenharmony_ci * 30098c2ecf20Sopenharmony_ci */ 30108c2ecf20Sopenharmony_ci 30118c2ecf20Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_MIN (1) 30128c2ecf20Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_DEF (5) 30138c2ecf20Sopenharmony_ci#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF 30148c2ecf20Sopenharmony_ci 30158c2ecf20Sopenharmony_cistruct il_missed_beacon_notif { 30168c2ecf20Sopenharmony_ci __le32 consecutive_missed_beacons; 30178c2ecf20Sopenharmony_ci __le32 total_missed_becons; 30188c2ecf20Sopenharmony_ci __le32 num_expected_beacons; 30198c2ecf20Sopenharmony_ci __le32 num_recvd_beacons; 30208c2ecf20Sopenharmony_ci} __packed; 30218c2ecf20Sopenharmony_ci 30228c2ecf20Sopenharmony_ci/****************************************************************************** 30238c2ecf20Sopenharmony_ci * (11) 30248c2ecf20Sopenharmony_ci * Rx Calibration Commands: 30258c2ecf20Sopenharmony_ci * 30268c2ecf20Sopenharmony_ci * With the uCode used for open source drivers, most Tx calibration (except 30278c2ecf20Sopenharmony_ci * for Tx Power) and most Rx calibration is done by uCode during the 30288c2ecf20Sopenharmony_ci * "initialize" phase of uCode boot. Driver must calibrate only: 30298c2ecf20Sopenharmony_ci * 30308c2ecf20Sopenharmony_ci * 1) Tx power (depends on temperature), described elsewhere 30318c2ecf20Sopenharmony_ci * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) 30328c2ecf20Sopenharmony_ci * 3) Receiver sensitivity (to optimize signal detection) 30338c2ecf20Sopenharmony_ci * 30348c2ecf20Sopenharmony_ci *****************************************************************************/ 30358c2ecf20Sopenharmony_ci 30368c2ecf20Sopenharmony_ci/** 30378c2ecf20Sopenharmony_ci * C_SENSITIVITY = 0xa8 (command, has simple generic response) 30388c2ecf20Sopenharmony_ci * 30398c2ecf20Sopenharmony_ci * This command sets up the Rx signal detector for a sensitivity level that 30408c2ecf20Sopenharmony_ci * is high enough to lock onto all signals within the associated network, 30418c2ecf20Sopenharmony_ci * but low enough to ignore signals that are below a certain threshold, so as 30428c2ecf20Sopenharmony_ci * not to have too many "false alarms". False alarms are signals that the 30438c2ecf20Sopenharmony_ci * Rx DSP tries to lock onto, but then discards after determining that they 30448c2ecf20Sopenharmony_ci * are noise. 30458c2ecf20Sopenharmony_ci * 30468c2ecf20Sopenharmony_ci * The optimum number of false alarms is between 5 and 50 per 200 TUs 30478c2ecf20Sopenharmony_ci * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. 30488c2ecf20Sopenharmony_ci * time listening, not transmitting). Driver must adjust sensitivity so that 30498c2ecf20Sopenharmony_ci * the ratio of actual false alarms to actual Rx time falls within this range. 30508c2ecf20Sopenharmony_ci * 30518c2ecf20Sopenharmony_ci * While associated, uCode delivers N_STATSs after each 30528c2ecf20Sopenharmony_ci * received beacon. These provide information to the driver to analyze the 30538c2ecf20Sopenharmony_ci * sensitivity. Don't analyze stats that come in from scanning, or any 30548c2ecf20Sopenharmony_ci * other non-associated-network source. Pertinent stats include: 30558c2ecf20Sopenharmony_ci * 30568c2ecf20Sopenharmony_ci * From "general" stats (struct stats_rx_non_phy): 30578c2ecf20Sopenharmony_ci * 30588c2ecf20Sopenharmony_ci * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) 30598c2ecf20Sopenharmony_ci * Measure of energy of desired signal. Used for establishing a level 30608c2ecf20Sopenharmony_ci * below which the device does not detect signals. 30618c2ecf20Sopenharmony_ci * 30628c2ecf20Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) 30638c2ecf20Sopenharmony_ci * Measure of background noise in silent period after beacon. 30648c2ecf20Sopenharmony_ci * 30658c2ecf20Sopenharmony_ci * channel_load 30668c2ecf20Sopenharmony_ci * uSecs of actual Rx time during beacon period (varies according to 30678c2ecf20Sopenharmony_ci * how much time was spent transmitting). 30688c2ecf20Sopenharmony_ci * 30698c2ecf20Sopenharmony_ci * From "cck" and "ofdm" stats (struct stats_rx_phy), separately: 30708c2ecf20Sopenharmony_ci * 30718c2ecf20Sopenharmony_ci * false_alarm_cnt 30728c2ecf20Sopenharmony_ci * Signal locks abandoned early (before phy-level header). 30738c2ecf20Sopenharmony_ci * 30748c2ecf20Sopenharmony_ci * plcp_err 30758c2ecf20Sopenharmony_ci * Signal locks abandoned late (during phy-level header). 30768c2ecf20Sopenharmony_ci * 30778c2ecf20Sopenharmony_ci * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from 30788c2ecf20Sopenharmony_ci * beacon to beacon, i.e. each value is an accumulation of all errors 30798c2ecf20Sopenharmony_ci * before and including the latest beacon. Values will wrap around to 0 30808c2ecf20Sopenharmony_ci * after counting up to 2^32 - 1. Driver must differentiate vs. 30818c2ecf20Sopenharmony_ci * previous beacon's values to determine # false alarms in the current 30828c2ecf20Sopenharmony_ci * beacon period. 30838c2ecf20Sopenharmony_ci * 30848c2ecf20Sopenharmony_ci * Total number of false alarms = false_alarms + plcp_errs 30858c2ecf20Sopenharmony_ci * 30868c2ecf20Sopenharmony_ci * For OFDM, adjust the following table entries in struct il_sensitivity_cmd 30878c2ecf20Sopenharmony_ci * (notice that the start points for OFDM are at or close to settings for 30888c2ecf20Sopenharmony_ci * maximum sensitivity): 30898c2ecf20Sopenharmony_ci * 30908c2ecf20Sopenharmony_ci * START / MIN / MAX 30918c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120 30928c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210 30938c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140 30948c2ecf20Sopenharmony_ci * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270 30958c2ecf20Sopenharmony_ci * 30968c2ecf20Sopenharmony_ci * If actual rate of OFDM false alarms (+ plcp_errors) is too high 30978c2ecf20Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), reduce sensitivity 30988c2ecf20Sopenharmony_ci * by *adding* 1 to all 4 of the table entries above, up to the max for 30998c2ecf20Sopenharmony_ci * each entry. Conversely, if false alarm rate is too low (less than 5 31008c2ecf20Sopenharmony_ci * for each 204.8 msecs listening), *subtract* 1 from each entry to 31018c2ecf20Sopenharmony_ci * increase sensitivity. 31028c2ecf20Sopenharmony_ci * 31038c2ecf20Sopenharmony_ci * For CCK sensitivity, keep track of the following: 31048c2ecf20Sopenharmony_ci * 31058c2ecf20Sopenharmony_ci * 1). 20-beacon history of maximum background noise, indicated by 31068c2ecf20Sopenharmony_ci * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the 31078c2ecf20Sopenharmony_ci * 3 receivers. For any given beacon, the "silence reference" is 31088c2ecf20Sopenharmony_ci * the maximum of last 60 samples (20 beacons * 3 receivers). 31098c2ecf20Sopenharmony_ci * 31108c2ecf20Sopenharmony_ci * 2). 10-beacon history of strongest signal level, as indicated 31118c2ecf20Sopenharmony_ci * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, 31128c2ecf20Sopenharmony_ci * i.e. the strength of the signal through the best receiver at the 31138c2ecf20Sopenharmony_ci * moment. These measurements are "upside down", with lower values 31148c2ecf20Sopenharmony_ci * for stronger signals, so max energy will be *minimum* value. 31158c2ecf20Sopenharmony_ci * 31168c2ecf20Sopenharmony_ci * Then for any given beacon, the driver must determine the *weakest* 31178c2ecf20Sopenharmony_ci * of the strongest signals; this is the minimum level that needs to be 31188c2ecf20Sopenharmony_ci * successfully detected, when using the best receiver at the moment. 31198c2ecf20Sopenharmony_ci * "Max cck energy" is the maximum (higher value means lower energy!) 31208c2ecf20Sopenharmony_ci * of the last 10 minima. Once this is determined, driver must add 31218c2ecf20Sopenharmony_ci * a little margin by adding "6" to it. 31228c2ecf20Sopenharmony_ci * 31238c2ecf20Sopenharmony_ci * 3). Number of consecutive beacon periods with too few false alarms. 31248c2ecf20Sopenharmony_ci * Reset this to 0 at the first beacon period that falls within the 31258c2ecf20Sopenharmony_ci * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). 31268c2ecf20Sopenharmony_ci * 31278c2ecf20Sopenharmony_ci * Then, adjust the following CCK table entries in struct il_sensitivity_cmd 31288c2ecf20Sopenharmony_ci * (notice that the start points for CCK are at maximum sensitivity): 31298c2ecf20Sopenharmony_ci * 31308c2ecf20Sopenharmony_ci * START / MIN / MAX 31318c2ecf20Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200 31328c2ecf20Sopenharmony_ci * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400 31338c2ecf20Sopenharmony_ci * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100 31348c2ecf20Sopenharmony_ci * 31358c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too high 31368c2ecf20Sopenharmony_ci * (greater than 50 for each 204.8 msecs listening), method for reducing 31378c2ecf20Sopenharmony_ci * sensitivity is: 31388c2ecf20Sopenharmony_ci * 31398c2ecf20Sopenharmony_ci * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, 31408c2ecf20Sopenharmony_ci * up to max 400. 31418c2ecf20Sopenharmony_ci * 31428c2ecf20Sopenharmony_ci * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160, 31438c2ecf20Sopenharmony_ci * sensitivity has been reduced a significant amount; bring it up to 31448c2ecf20Sopenharmony_ci * a moderate 161. Otherwise, *add* 3, up to max 200. 31458c2ecf20Sopenharmony_ci * 31468c2ecf20Sopenharmony_ci * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160, 31478c2ecf20Sopenharmony_ci * sensitivity has been reduced only a moderate or small amount; 31488c2ecf20Sopenharmony_ci * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX, 31498c2ecf20Sopenharmony_ci * down to min 0. Otherwise (if gain has been significantly reduced), 31508c2ecf20Sopenharmony_ci * don't change the HD_MIN_ENERGY_CCK_DET_IDX value. 31518c2ecf20Sopenharmony_ci * 31528c2ecf20Sopenharmony_ci * b) Save a snapshot of the "silence reference". 31538c2ecf20Sopenharmony_ci * 31548c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is too low 31558c2ecf20Sopenharmony_ci * (less than 5 for each 204.8 msecs listening), method for increasing 31568c2ecf20Sopenharmony_ci * sensitivity is used only if: 31578c2ecf20Sopenharmony_ci * 31588c2ecf20Sopenharmony_ci * 1a) Previous beacon did not have too many false alarms 31598c2ecf20Sopenharmony_ci * 1b) AND difference between previous "silence reference" and current 31608c2ecf20Sopenharmony_ci * "silence reference" (prev - current) is 2 or more, 31618c2ecf20Sopenharmony_ci * OR 2) 100 or more consecutive beacon periods have had rate of 31628c2ecf20Sopenharmony_ci * less than 5 false alarms per 204.8 milliseconds rx time. 31638c2ecf20Sopenharmony_ci * 31648c2ecf20Sopenharmony_ci * Method for increasing sensitivity: 31658c2ecf20Sopenharmony_ci * 31668c2ecf20Sopenharmony_ci * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX, 31678c2ecf20Sopenharmony_ci * down to min 125. 31688c2ecf20Sopenharmony_ci * 31698c2ecf20Sopenharmony_ci * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, 31708c2ecf20Sopenharmony_ci * down to min 200. 31718c2ecf20Sopenharmony_ci * 31728c2ecf20Sopenharmony_ci * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100. 31738c2ecf20Sopenharmony_ci * 31748c2ecf20Sopenharmony_ci * If actual rate of CCK false alarms (+ plcp_errors) is within good range 31758c2ecf20Sopenharmony_ci * (between 5 and 50 for each 204.8 msecs listening): 31768c2ecf20Sopenharmony_ci * 31778c2ecf20Sopenharmony_ci * 1) Save a snapshot of the silence reference. 31788c2ecf20Sopenharmony_ci * 31798c2ecf20Sopenharmony_ci * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), 31808c2ecf20Sopenharmony_ci * give some extra margin to energy threshold by *subtracting* 8 31818c2ecf20Sopenharmony_ci * from value in HD_MIN_ENERGY_CCK_DET_IDX. 31828c2ecf20Sopenharmony_ci * 31838c2ecf20Sopenharmony_ci * For all cases (too few, too many, good range), make sure that the CCK 31848c2ecf20Sopenharmony_ci * detection threshold (energy) is below the energy level for robust 31858c2ecf20Sopenharmony_ci * detection over the past 10 beacon periods, the "Max cck energy". 31868c2ecf20Sopenharmony_ci * Lower values mean higher energy; this means making sure that the value 31878c2ecf20Sopenharmony_ci * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy". 31888c2ecf20Sopenharmony_ci * 31898c2ecf20Sopenharmony_ci */ 31908c2ecf20Sopenharmony_ci 31918c2ecf20Sopenharmony_ci/* 31928c2ecf20Sopenharmony_ci * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd) 31938c2ecf20Sopenharmony_ci */ 31948c2ecf20Sopenharmony_ci#define HD_TBL_SIZE (11) /* number of entries */ 31958c2ecf20Sopenharmony_ci#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */ 31968c2ecf20Sopenharmony_ci#define HD_MIN_ENERGY_OFDM_DET_IDX (1) 31978c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2) 31988c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3) 31998c2ecf20Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4) 32008c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5) 32018c2ecf20Sopenharmony_ci#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6) 32028c2ecf20Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7) 32038c2ecf20Sopenharmony_ci#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8) 32048c2ecf20Sopenharmony_ci#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9) 32058c2ecf20Sopenharmony_ci#define HD_OFDM_ENERGY_TH_IN_IDX (10) 32068c2ecf20Sopenharmony_ci 32078c2ecf20Sopenharmony_ci/* Control field in struct il_sensitivity_cmd */ 32088c2ecf20Sopenharmony_ci#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0) 32098c2ecf20Sopenharmony_ci#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1) 32108c2ecf20Sopenharmony_ci 32118c2ecf20Sopenharmony_ci/** 32128c2ecf20Sopenharmony_ci * struct il_sensitivity_cmd 32138c2ecf20Sopenharmony_ci * @control: (1) updates working table, (0) updates default table 32148c2ecf20Sopenharmony_ci * @table: energy threshold values, use HD_* as idx into table 32158c2ecf20Sopenharmony_ci * 32168c2ecf20Sopenharmony_ci * Always use "1" in "control" to update uCode's working table and DSP. 32178c2ecf20Sopenharmony_ci */ 32188c2ecf20Sopenharmony_cistruct il_sensitivity_cmd { 32198c2ecf20Sopenharmony_ci __le16 control; /* always use "1" */ 32208c2ecf20Sopenharmony_ci __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */ 32218c2ecf20Sopenharmony_ci} __packed; 32228c2ecf20Sopenharmony_ci 32238c2ecf20Sopenharmony_ci/** 32248c2ecf20Sopenharmony_ci * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response) 32258c2ecf20Sopenharmony_ci * 32268c2ecf20Sopenharmony_ci * This command sets the relative gains of 4965 device's 3 radio receiver chains. 32278c2ecf20Sopenharmony_ci * 32288c2ecf20Sopenharmony_ci * After the first association, driver should accumulate signal and noise 32298c2ecf20Sopenharmony_ci * stats from the N_STATSs that follow the first 20 32308c2ecf20Sopenharmony_ci * beacons from the associated network (don't collect stats that come 32318c2ecf20Sopenharmony_ci * in from scanning, or any other non-network source). 32328c2ecf20Sopenharmony_ci * 32338c2ecf20Sopenharmony_ci * DISCONNECTED ANTENNA: 32348c2ecf20Sopenharmony_ci * 32358c2ecf20Sopenharmony_ci * Driver should determine which antennas are actually connected, by comparing 32368c2ecf20Sopenharmony_ci * average beacon signal levels for the 3 Rx chains. Accumulate (add) the 32378c2ecf20Sopenharmony_ci * following values over 20 beacons, one accumulator for each of the chains 32388c2ecf20Sopenharmony_ci * a/b/c, from struct stats_rx_non_phy: 32398c2ecf20Sopenharmony_ci * 32408c2ecf20Sopenharmony_ci * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) 32418c2ecf20Sopenharmony_ci * 32428c2ecf20Sopenharmony_ci * Find the strongest signal from among a/b/c. Compare the other two to the 32438c2ecf20Sopenharmony_ci * strongest. If any signal is more than 15 dB (times 20, unless you 32448c2ecf20Sopenharmony_ci * divide the accumulated values by 20) below the strongest, the driver 32458c2ecf20Sopenharmony_ci * considers that antenna to be disconnected, and should not try to use that 32468c2ecf20Sopenharmony_ci * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, 32478c2ecf20Sopenharmony_ci * driver should declare the stronger one as connected, and attempt to use it 32488c2ecf20Sopenharmony_ci * (A and B are the only 2 Tx chains!). 32498c2ecf20Sopenharmony_ci * 32508c2ecf20Sopenharmony_ci * 32518c2ecf20Sopenharmony_ci * RX BALANCE: 32528c2ecf20Sopenharmony_ci * 32538c2ecf20Sopenharmony_ci * Driver should balance the 3 receivers (but just the ones that are connected 32548c2ecf20Sopenharmony_ci * to antennas, see above) for gain, by comparing the average signal levels 32558c2ecf20Sopenharmony_ci * detected during the silence after each beacon (background noise). 32568c2ecf20Sopenharmony_ci * Accumulate (add) the following values over 20 beacons, one accumulator for 32578c2ecf20Sopenharmony_ci * each of the chains a/b/c, from struct stats_rx_non_phy: 32588c2ecf20Sopenharmony_ci * 32598c2ecf20Sopenharmony_ci * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) 32608c2ecf20Sopenharmony_ci * 32618c2ecf20Sopenharmony_ci * Find the weakest background noise level from among a/b/c. This Rx chain 32628c2ecf20Sopenharmony_ci * will be the reference, with 0 gain adjustment. Attenuate other channels by 32638c2ecf20Sopenharmony_ci * finding noise difference: 32648c2ecf20Sopenharmony_ci * 32658c2ecf20Sopenharmony_ci * (accum_noise[i] - accum_noise[reference]) / 30 32668c2ecf20Sopenharmony_ci * 32678c2ecf20Sopenharmony_ci * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. 32688c2ecf20Sopenharmony_ci * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the 32698c2ecf20Sopenharmony_ci * driver should limit the difference results to a range of 0-3 (0-4.5 dB), 32708c2ecf20Sopenharmony_ci * and set bit 2 to indicate "reduce gain". The value for the reference 32718c2ecf20Sopenharmony_ci * (weakest) chain should be "0". 32728c2ecf20Sopenharmony_ci * 32738c2ecf20Sopenharmony_ci * diff_gain_[abc] bit fields: 32748c2ecf20Sopenharmony_ci * 2: (1) reduce gain, (0) increase gain 32758c2ecf20Sopenharmony_ci * 1-0: amount of gain, units of 1.5 dB 32768c2ecf20Sopenharmony_ci */ 32778c2ecf20Sopenharmony_ci 32788c2ecf20Sopenharmony_ci/* Phy calibration command for series */ 32798c2ecf20Sopenharmony_ci/* The default calibrate table size if not specified by firmware */ 32808c2ecf20Sopenharmony_ci#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 32818c2ecf20Sopenharmony_cienum { 32828c2ecf20Sopenharmony_ci IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, 32838c2ecf20Sopenharmony_ci IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, 32848c2ecf20Sopenharmony_ci}; 32858c2ecf20Sopenharmony_ci 32868c2ecf20Sopenharmony_ci#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253) 32878c2ecf20Sopenharmony_ci 32888c2ecf20Sopenharmony_cistruct il_calib_hdr { 32898c2ecf20Sopenharmony_ci u8 op_code; 32908c2ecf20Sopenharmony_ci u8 first_group; 32918c2ecf20Sopenharmony_ci u8 groups_num; 32928c2ecf20Sopenharmony_ci u8 data_valid; 32938c2ecf20Sopenharmony_ci} __packed; 32948c2ecf20Sopenharmony_ci 32958c2ecf20Sopenharmony_ci/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ 32968c2ecf20Sopenharmony_cistruct il_calib_diff_gain_cmd { 32978c2ecf20Sopenharmony_ci struct il_calib_hdr hdr; 32988c2ecf20Sopenharmony_ci s8 diff_gain_a; /* see above */ 32998c2ecf20Sopenharmony_ci s8 diff_gain_b; 33008c2ecf20Sopenharmony_ci s8 diff_gain_c; 33018c2ecf20Sopenharmony_ci u8 reserved1; 33028c2ecf20Sopenharmony_ci} __packed; 33038c2ecf20Sopenharmony_ci 33048c2ecf20Sopenharmony_ci/****************************************************************************** 33058c2ecf20Sopenharmony_ci * (12) 33068c2ecf20Sopenharmony_ci * Miscellaneous Commands: 33078c2ecf20Sopenharmony_ci * 33088c2ecf20Sopenharmony_ci *****************************************************************************/ 33098c2ecf20Sopenharmony_ci 33108c2ecf20Sopenharmony_ci/* 33118c2ecf20Sopenharmony_ci * LEDs Command & Response 33128c2ecf20Sopenharmony_ci * C_LEDS = 0x48 (command, has simple generic response) 33138c2ecf20Sopenharmony_ci * 33148c2ecf20Sopenharmony_ci * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 33158c2ecf20Sopenharmony_ci * this command turns it on or off, or sets up a periodic blinking cycle. 33168c2ecf20Sopenharmony_ci */ 33178c2ecf20Sopenharmony_cistruct il_led_cmd { 33188c2ecf20Sopenharmony_ci __le32 interval; /* "interval" in uSec */ 33198c2ecf20Sopenharmony_ci u8 id; /* 1: Activity, 2: Link, 3: Tech */ 33208c2ecf20Sopenharmony_ci u8 off; /* # intervals off while blinking; 33218c2ecf20Sopenharmony_ci * "0", with >0 "on" value, turns LED on */ 33228c2ecf20Sopenharmony_ci u8 on; /* # intervals on while blinking; 33238c2ecf20Sopenharmony_ci * "0", regardless of "off", turns LED off */ 33248c2ecf20Sopenharmony_ci u8 reserved; 33258c2ecf20Sopenharmony_ci} __packed; 33268c2ecf20Sopenharmony_ci 33278c2ecf20Sopenharmony_ci/****************************************************************************** 33288c2ecf20Sopenharmony_ci * (13) 33298c2ecf20Sopenharmony_ci * Union of all expected notifications/responses: 33308c2ecf20Sopenharmony_ci * 33318c2ecf20Sopenharmony_ci *****************************************************************************/ 33328c2ecf20Sopenharmony_ci 33338c2ecf20Sopenharmony_ci#define IL_RX_FRAME_SIZE_MSK 0x00003fff 33348c2ecf20Sopenharmony_ci 33358c2ecf20Sopenharmony_cistruct il_rx_pkt { 33368c2ecf20Sopenharmony_ci /* 33378c2ecf20Sopenharmony_ci * The first 4 bytes of the RX frame header contain both the RX frame 33388c2ecf20Sopenharmony_ci * size and some flags. 33398c2ecf20Sopenharmony_ci * Bit fields: 33408c2ecf20Sopenharmony_ci * 31: flag flush RB request 33418c2ecf20Sopenharmony_ci * 30: flag ignore TC (terminal counter) request 33428c2ecf20Sopenharmony_ci * 29: flag fast IRQ request 33438c2ecf20Sopenharmony_ci * 28-14: Reserved 33448c2ecf20Sopenharmony_ci * 13-00: RX frame size 33458c2ecf20Sopenharmony_ci */ 33468c2ecf20Sopenharmony_ci __le32 len_n_flags; 33478c2ecf20Sopenharmony_ci struct il_cmd_header hdr; 33488c2ecf20Sopenharmony_ci union { 33498c2ecf20Sopenharmony_ci struct il3945_rx_frame rx_frame; 33508c2ecf20Sopenharmony_ci struct il3945_tx_resp tx_resp; 33518c2ecf20Sopenharmony_ci struct il3945_beacon_notif beacon_status; 33528c2ecf20Sopenharmony_ci 33538c2ecf20Sopenharmony_ci struct il_alive_resp alive_frame; 33548c2ecf20Sopenharmony_ci struct il_spectrum_notification spectrum_notif; 33558c2ecf20Sopenharmony_ci struct il_csa_notification csa_notif; 33568c2ecf20Sopenharmony_ci struct il_error_resp err_resp; 33578c2ecf20Sopenharmony_ci struct il_card_state_notif card_state_notif; 33588c2ecf20Sopenharmony_ci struct il_add_sta_resp add_sta; 33598c2ecf20Sopenharmony_ci struct il_rem_sta_resp rem_sta; 33608c2ecf20Sopenharmony_ci struct il_sleep_notification sleep_notif; 33618c2ecf20Sopenharmony_ci struct il_spectrum_resp spectrum; 33628c2ecf20Sopenharmony_ci struct il_notif_stats stats; 33638c2ecf20Sopenharmony_ci struct il_compressed_ba_resp compressed_ba; 33648c2ecf20Sopenharmony_ci struct il_missed_beacon_notif missed_beacon; 33658c2ecf20Sopenharmony_ci __le32 status; 33668c2ecf20Sopenharmony_ci u8 raw[0]; 33678c2ecf20Sopenharmony_ci } u; 33688c2ecf20Sopenharmony_ci} __packed; 33698c2ecf20Sopenharmony_ci 33708c2ecf20Sopenharmony_ci#endif /* __il_commands_h__ */ 3371