18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * WSM host interface (HI) interface for ST-Ericsson CW1200 mac80211 drivers
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2010, ST-Ericsson
68c2ecf20Sopenharmony_ci * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Based on CW1200 UMAC WSM API, which is
98c2ecf20Sopenharmony_ci * Copyright (C) ST-Ericsson SA 2010
108c2ecf20Sopenharmony_ci * Author: Stewart Mathers <stewart.mathers@stericsson.com>
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef CW1200_WSM_H_INCLUDED
148c2ecf20Sopenharmony_ci#define CW1200_WSM_H_INCLUDED
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct cw1200_common;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* Bands */
218c2ecf20Sopenharmony_ci/* Radio band 2.412 -2.484 GHz. */
228c2ecf20Sopenharmony_ci#define WSM_PHY_BAND_2_4G		(0)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* Radio band 4.9375-5.8250 GHz. */
258c2ecf20Sopenharmony_ci#define WSM_PHY_BAND_5G			(1)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* Transmit rates */
288c2ecf20Sopenharmony_ci/* 1   Mbps            ERP-DSSS */
298c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_1		(0)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* 2   Mbps            ERP-DSSS */
328c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_2		(1)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* 5.5 Mbps            ERP-CCK */
358c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_5		(2)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* 11  Mbps            ERP-CCK */
388c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_11		(3)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* 22  Mbps            ERP-PBCC (Not supported) */
418c2ecf20Sopenharmony_ci/* #define WSM_TRANSMIT_RATE_22		(4) */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* 33  Mbps            ERP-PBCC (Not supported) */
448c2ecf20Sopenharmony_ci/* #define WSM_TRANSMIT_RATE_33		(5) */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* 6   Mbps   (3 Mbps) ERP-OFDM, BPSK coding rate 1/2 */
478c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_6		(6)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* 9   Mbps (4.5 Mbps) ERP-OFDM, BPSK coding rate 3/4 */
508c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_9		(7)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* 12  Mbps  (6 Mbps)  ERP-OFDM, QPSK coding rate 1/2 */
538c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_12		(8)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* 18  Mbps  (9 Mbps)  ERP-OFDM, QPSK coding rate 3/4 */
568c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_18		(9)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* 24  Mbps (12 Mbps)  ERP-OFDM, 16QAM coding rate 1/2 */
598c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_24		(10)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* 36  Mbps (18 Mbps)  ERP-OFDM, 16QAM coding rate 3/4 */
628c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_36		(11)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/* 48  Mbps (24 Mbps)  ERP-OFDM, 64QAM coding rate 1/2 */
658c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_48		(12)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* 54  Mbps (27 Mbps)  ERP-OFDM, 64QAM coding rate 3/4 */
688c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_54		(13)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* 6.5 Mbps            HT-OFDM, BPSK coding rate 1/2 */
718c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_6		(14)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* 13  Mbps            HT-OFDM, QPSK coding rate 1/2 */
748c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_13		(15)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* 19.5 Mbps           HT-OFDM, QPSK coding rate 3/4 */
778c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_19		(16)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* 26  Mbps            HT-OFDM, 16QAM coding rate 1/2 */
808c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_26		(17)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* 39  Mbps            HT-OFDM, 16QAM coding rate 3/4 */
838c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_39		(18)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* 52  Mbps            HT-OFDM, 64QAM coding rate 2/3 */
868c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_52		(19)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* 58.5 Mbps           HT-OFDM, 64QAM coding rate 3/4 */
898c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_58		(20)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* 65  Mbps            HT-OFDM, 64QAM coding rate 5/6 */
928c2ecf20Sopenharmony_ci#define WSM_TRANSMIT_RATE_HT_65		(21)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* Scan types */
958c2ecf20Sopenharmony_ci/* Foreground scan */
968c2ecf20Sopenharmony_ci#define WSM_SCAN_TYPE_FOREGROUND	(0)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Background scan */
998c2ecf20Sopenharmony_ci#define WSM_SCAN_TYPE_BACKGROUND	(1)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* Auto scan */
1028c2ecf20Sopenharmony_ci#define WSM_SCAN_TYPE_AUTO		(2)
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Scan flags */
1058c2ecf20Sopenharmony_ci/* Forced background scan means if the station cannot */
1068c2ecf20Sopenharmony_ci/* enter the power-save mode, it shall force to perform a */
1078c2ecf20Sopenharmony_ci/* background scan. Only valid when ScanType is */
1088c2ecf20Sopenharmony_ci/* background scan. */
1098c2ecf20Sopenharmony_ci#define WSM_SCAN_FLAG_FORCE_BACKGROUND	(BIT(0))
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/* The WLAN device scans one channel at a time so */
1128c2ecf20Sopenharmony_ci/* that disturbance to the data traffic is minimized. */
1138c2ecf20Sopenharmony_ci#define WSM_SCAN_FLAG_SPLIT_METHOD	(BIT(1))
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* Preamble Type. Long if not set. */
1168c2ecf20Sopenharmony_ci#define WSM_SCAN_FLAG_SHORT_PREAMBLE	(BIT(2))
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* 11n Tx Mode. Mixed if not set. */
1198c2ecf20Sopenharmony_ci#define WSM_SCAN_FLAG_11N_GREENFIELD	(BIT(3))
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/* Scan constraints */
1228c2ecf20Sopenharmony_ci/* Maximum number of channels to be scanned. */
1238c2ecf20Sopenharmony_ci#define WSM_SCAN_MAX_NUM_OF_CHANNELS	(48)
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* The maximum number of SSIDs that the device can scan for. */
1268c2ecf20Sopenharmony_ci#define WSM_SCAN_MAX_NUM_OF_SSIDS	(2)
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* Power management modes */
1298c2ecf20Sopenharmony_ci/* 802.11 Active mode */
1308c2ecf20Sopenharmony_ci#define WSM_PSM_ACTIVE			(0)
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci/* 802.11 PS mode */
1338c2ecf20Sopenharmony_ci#define WSM_PSM_PS			BIT(0)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* Fast Power Save bit */
1368c2ecf20Sopenharmony_ci#define WSM_PSM_FAST_PS_FLAG		BIT(7)
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* Dynamic aka Fast power save */
1398c2ecf20Sopenharmony_ci#define WSM_PSM_FAST_PS			(BIT(0) | BIT(7))
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* Undetermined */
1428c2ecf20Sopenharmony_ci/* Note : Undetermined status is reported when the */
1438c2ecf20Sopenharmony_ci/* NULL data frame used to advertise the PM mode to */
1448c2ecf20Sopenharmony_ci/* the AP at Pre or Post Background Scan is not Acknowledged */
1458c2ecf20Sopenharmony_ci#define WSM_PSM_UNKNOWN			BIT(1)
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* Queue IDs */
1488c2ecf20Sopenharmony_ci/* best effort/legacy */
1498c2ecf20Sopenharmony_ci#define WSM_QUEUE_BEST_EFFORT		(0)
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci/* background */
1528c2ecf20Sopenharmony_ci#define WSM_QUEUE_BACKGROUND		(1)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* video */
1558c2ecf20Sopenharmony_ci#define WSM_QUEUE_VIDEO			(2)
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* voice */
1588c2ecf20Sopenharmony_ci#define WSM_QUEUE_VOICE			(3)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* HT TX parameters */
1618c2ecf20Sopenharmony_ci/* Non-HT */
1628c2ecf20Sopenharmony_ci#define WSM_HT_TX_NON_HT		(0)
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/* Mixed format */
1658c2ecf20Sopenharmony_ci#define WSM_HT_TX_MIXED			(1)
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* Greenfield format */
1688c2ecf20Sopenharmony_ci#define WSM_HT_TX_GREENFIELD		(2)
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/* STBC allowed */
1718c2ecf20Sopenharmony_ci#define WSM_HT_TX_STBC			(BIT(7))
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/* EPTA prioirty flags for BT Coex */
1748c2ecf20Sopenharmony_ci/* default epta priority */
1758c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_DEFAULT	4
1768c2ecf20Sopenharmony_ci/* use for normal data */
1778c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_DATA		4
1788c2ecf20Sopenharmony_ci/* use for connect/disconnect/roaming*/
1798c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_MGT		5
1808c2ecf20Sopenharmony_ci/* use for action frames */
1818c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_ACTION	5
1828c2ecf20Sopenharmony_ci/* use for AC_VI data */
1838c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_VIDEO		5
1848c2ecf20Sopenharmony_ci/* use for AC_VO data */
1858c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_VOICE		6
1868c2ecf20Sopenharmony_ci/* use for EAPOL exchange */
1878c2ecf20Sopenharmony_ci#define WSM_EPTA_PRIORITY_EAPOL		7
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* TX status */
1908c2ecf20Sopenharmony_ci/* Frame was sent aggregated */
1918c2ecf20Sopenharmony_ci/* Only valid for WSM_SUCCESS status. */
1928c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_AGGREGATION	(BIT(0))
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* Host should requeue this frame later. */
1958c2ecf20Sopenharmony_ci/* Valid only when status is WSM_REQUEUE. */
1968c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_REQUEUE		(BIT(1))
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* Normal Ack */
1998c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_NORMAL_ACK	(0<<2)
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci/* No Ack */
2028c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_NO_ACK		(1<<2)
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* No explicit acknowledgement */
2058c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_NO_EXPLICIT_ACK	(2<<2)
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* Block Ack */
2088c2ecf20Sopenharmony_ci/* Only valid for WSM_SUCCESS status. */
2098c2ecf20Sopenharmony_ci#define WSM_TX_STATUS_BLOCK_ACK		(3<<2)
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci/* RX status */
2128c2ecf20Sopenharmony_ci/* Unencrypted */
2138c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_UNENCRYPTED	(0<<0)
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/* WEP */
2168c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_WEP		(1<<0)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* TKIP */
2198c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_TKIP		(2<<0)
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* AES */
2228c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_AES		(3<<0)
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci/* WAPI */
2258c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_WAPI		(4<<0)
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/* Macro to fetch encryption subfield. */
2288c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_ENCRYPTION(status) ((status) & 0x07)
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* Frame was part of an aggregation */
2318c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_AGGREGATE		(BIT(3))
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci/* Frame was first in the aggregation */
2348c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_AGGREGATE_FIRST	(BIT(4))
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/* Frame was last in the aggregation */
2378c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_AGGREGATE_LAST	(BIT(5))
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci/* Indicates a defragmented frame */
2408c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_DEFRAGMENTED	(BIT(6))
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/* Indicates a Beacon frame */
2438c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_BEACON		(BIT(7))
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/* Indicates STA bit beacon TIM field */
2468c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_TIM		(BIT(8))
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/* Indicates Beacon frame's virtual bitmap contains multicast bit */
2498c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_MULTICAST		(BIT(9))
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci/* Indicates frame contains a matching SSID */
2528c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_MATCHING_SSID	(BIT(10))
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* Indicates frame contains a matching BSSI */
2558c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_MATCHING_BSSI	(BIT(11))
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci/* Indicates More bit set in Framectl field */
2588c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_MORE_DATA		(BIT(12))
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/* Indicates frame received during a measurement process */
2618c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_MEASUREMENT	(BIT(13))
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/* Indicates frame received as an HT packet */
2648c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_HT		(BIT(14))
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/* Indicates frame received with STBC */
2678c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_STBC		(BIT(15))
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* Indicates Address 1 field matches dot11StationId */
2708c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_ADDRESS1		(BIT(16))
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci/* Indicates Group address present in the Address 1 field */
2738c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_GROUP		(BIT(17))
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* Indicates Broadcast address present in the Address 1 field */
2768c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_BROADCAST		(BIT(18))
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/* Indicates group key used with encrypted frames */
2798c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_GROUP_KEY		(BIT(19))
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci/* Macro to fetch encryption key index. */
2828c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_KEY_IDX(status)	(((status >> 20)) & 0x0F)
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci/* Indicates TSF inclusion after 802.11 frame body */
2858c2ecf20Sopenharmony_ci#define WSM_RX_STATUS_TSF_INCLUDED	(BIT(24))
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/* Frame Control field starts at Frame offset + 2 */
2888c2ecf20Sopenharmony_ci#define WSM_TX_2BYTES_SHIFT		(BIT(7))
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci/* Join mode */
2918c2ecf20Sopenharmony_ci/* IBSS */
2928c2ecf20Sopenharmony_ci#define WSM_JOIN_MODE_IBSS		(0)
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/* BSS */
2958c2ecf20Sopenharmony_ci#define WSM_JOIN_MODE_BSS		(1)
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci/* PLCP preamble type */
2988c2ecf20Sopenharmony_ci/* For long preamble */
2998c2ecf20Sopenharmony_ci#define WSM_JOIN_PREAMBLE_LONG		(0)
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/* For short preamble (Long for 1Mbps) */
3028c2ecf20Sopenharmony_ci#define WSM_JOIN_PREAMBLE_SHORT		(1)
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* For short preamble (Long for 1 and 2Mbps) */
3058c2ecf20Sopenharmony_ci#define WSM_JOIN_PREAMBLE_SHORT_2	(2)
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/* Join flags */
3088c2ecf20Sopenharmony_ci/* Unsynchronized */
3098c2ecf20Sopenharmony_ci#define WSM_JOIN_FLAGS_UNSYNCRONIZED	BIT(0)
3108c2ecf20Sopenharmony_ci/* The BSS owner is a P2P GO */
3118c2ecf20Sopenharmony_ci#define WSM_JOIN_FLAGS_P2P_GO		BIT(1)
3128c2ecf20Sopenharmony_ci/* Force to join BSS with the BSSID and the
3138c2ecf20Sopenharmony_ci * SSID specified without waiting for beacons. The
3148c2ecf20Sopenharmony_ci * ProbeForJoin parameter is ignored.
3158c2ecf20Sopenharmony_ci */
3168c2ecf20Sopenharmony_ci#define WSM_JOIN_FLAGS_FORCE		BIT(2)
3178c2ecf20Sopenharmony_ci/* Give probe request/response higher
3188c2ecf20Sopenharmony_ci * priority over the BT traffic
3198c2ecf20Sopenharmony_ci */
3208c2ecf20Sopenharmony_ci#define WSM_JOIN_FLAGS_PRIO		BIT(3)
3218c2ecf20Sopenharmony_ci/* Issue immediate join confirmation and use
3228c2ecf20Sopenharmony_ci * join complete to notify about completion
3238c2ecf20Sopenharmony_ci */
3248c2ecf20Sopenharmony_ci#define WSM_JOIN_FLAGS_FORCE_WITH_COMPLETE_IND BIT(5)
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci/* Key types */
3278c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_WEP_DEFAULT	(0)
3288c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_WEP_PAIRWISE	(1)
3298c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_TKIP_GROUP		(2)
3308c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_TKIP_PAIRWISE	(3)
3318c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_AES_GROUP		(4)
3328c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_AES_PAIRWISE	(5)
3338c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_WAPI_GROUP		(6)
3348c2ecf20Sopenharmony_ci#define WSM_KEY_TYPE_WAPI_PAIRWISE	(7)
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci/* Key indexes */
3378c2ecf20Sopenharmony_ci#define WSM_KEY_MAX_INDEX		(10)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/* ACK policy */
3408c2ecf20Sopenharmony_ci#define WSM_ACK_POLICY_NORMAL		(0)
3418c2ecf20Sopenharmony_ci#define WSM_ACK_POLICY_NO_ACK		(1)
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/* Start modes */
3448c2ecf20Sopenharmony_ci#define WSM_START_MODE_AP		(0)	/* Mini AP */
3458c2ecf20Sopenharmony_ci#define WSM_START_MODE_P2P_GO		(1)	/* P2P GO */
3468c2ecf20Sopenharmony_ci#define WSM_START_MODE_P2P_DEV		(2)	/* P2P device */
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/* SetAssociationMode MIB flags */
3498c2ecf20Sopenharmony_ci#define WSM_ASSOCIATION_MODE_USE_PREAMBLE_TYPE		(BIT(0))
3508c2ecf20Sopenharmony_ci#define WSM_ASSOCIATION_MODE_USE_HT_MODE		(BIT(1))
3518c2ecf20Sopenharmony_ci#define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET		(BIT(2))
3528c2ecf20Sopenharmony_ci#define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING	(BIT(3))
3538c2ecf20Sopenharmony_ci#define WSM_ASSOCIATION_MODE_SNOOP_ASSOC_FRAMES		(BIT(4))
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci/* RcpiRssiThreshold MIB flags */
3568c2ecf20Sopenharmony_ci#define WSM_RCPI_RSSI_THRESHOLD_ENABLE	(BIT(0))
3578c2ecf20Sopenharmony_ci#define WSM_RCPI_RSSI_USE_RSSI		(BIT(1))
3588c2ecf20Sopenharmony_ci#define WSM_RCPI_RSSI_DONT_USE_UPPER	(BIT(2))
3598c2ecf20Sopenharmony_ci#define WSM_RCPI_RSSI_DONT_USE_LOWER	(BIT(3))
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci/* Update-ie constants */
3628c2ecf20Sopenharmony_ci#define WSM_UPDATE_IE_BEACON		(BIT(0))
3638c2ecf20Sopenharmony_ci#define WSM_UPDATE_IE_PROBE_RESP	(BIT(1))
3648c2ecf20Sopenharmony_ci#define WSM_UPDATE_IE_PROBE_REQ		(BIT(2))
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/* WSM events */
3678c2ecf20Sopenharmony_ci/* Error */
3688c2ecf20Sopenharmony_ci#define WSM_EVENT_ERROR			(0)
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci/* BSS lost */
3718c2ecf20Sopenharmony_ci#define WSM_EVENT_BSS_LOST		(1)
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/* BSS regained */
3748c2ecf20Sopenharmony_ci#define WSM_EVENT_BSS_REGAINED		(2)
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci/* Radar detected */
3778c2ecf20Sopenharmony_ci#define WSM_EVENT_RADAR_DETECTED	(3)
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci/* RCPI or RSSI threshold triggered */
3808c2ecf20Sopenharmony_ci#define WSM_EVENT_RCPI_RSSI		(4)
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci/* BT inactive */
3838c2ecf20Sopenharmony_ci#define WSM_EVENT_BT_INACTIVE		(5)
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci/* BT active */
3868c2ecf20Sopenharmony_ci#define WSM_EVENT_BT_ACTIVE		(6)
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* MIB IDs */
3898c2ecf20Sopenharmony_ci/* 4.1  dot11StationId */
3908c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_STATION_ID		0x0000
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* 4.2  dot11MaxtransmitMsduLifeTime */
3938c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME	0x0001
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci/* 4.3  dot11MaxReceiveLifeTime */
3968c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME	0x0002
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/* 4.4  dot11SlotTime */
3998c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_SLOT_TIME		0x0003
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/* 4.5  dot11GroupAddressesTable */
4028c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE	0x0004
4038c2ecf20Sopenharmony_ci#define WSM_MAX_GRP_ADDRTABLE_ENTRIES		8
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci/* 4.6  dot11WepDefaultKeyId */
4068c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID	0x0005
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci/* 4.7  dot11CurrentTxPowerLevel */
4098c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL	0x0006
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci/* 4.8  dot11RTSThreshold */
4128c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DOT11_RTS_THRESHOLD		0x0007
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci/* 4.9  NonErpProtection */
4158c2ecf20Sopenharmony_ci#define WSM_MIB_ID_NON_ERP_PROTECTION		0x1000
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci/* 4.10 ArpIpAddressesTable */
4188c2ecf20Sopenharmony_ci#define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE	0x1001
4198c2ecf20Sopenharmony_ci#define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES	1
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/* 4.11 TemplateFrame */
4228c2ecf20Sopenharmony_ci#define WSM_MIB_ID_TEMPLATE_FRAME		0x1002
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/* 4.12 RxFilter */
4258c2ecf20Sopenharmony_ci#define WSM_MIB_ID_RX_FILTER			0x1003
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/* 4.13 BeaconFilterTable */
4288c2ecf20Sopenharmony_ci#define WSM_MIB_ID_BEACON_FILTER_TABLE		0x1004
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* 4.14 BeaconFilterEnable */
4318c2ecf20Sopenharmony_ci#define WSM_MIB_ID_BEACON_FILTER_ENABLE		0x1005
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/* 4.15 OperationalPowerMode */
4348c2ecf20Sopenharmony_ci#define WSM_MIB_ID_OPERATIONAL_POWER_MODE	0x1006
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/* 4.16 BeaconWakeUpPeriod */
4378c2ecf20Sopenharmony_ci#define WSM_MIB_ID_BEACON_WAKEUP_PERIOD		0x1007
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci/* 4.17 RcpiRssiThreshold */
4408c2ecf20Sopenharmony_ci#define WSM_MIB_ID_RCPI_RSSI_THRESHOLD		0x1009
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/* 4.18 StatisticsTable */
4438c2ecf20Sopenharmony_ci#define WSM_MIB_ID_STATISTICS_TABLE		0x100A
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/* 4.19 IbssPsConfig */
4468c2ecf20Sopenharmony_ci#define WSM_MIB_ID_IBSS_PS_CONFIG		0x100B
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/* 4.20 CountersTable */
4498c2ecf20Sopenharmony_ci#define WSM_MIB_ID_COUNTERS_TABLE		0x100C
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci/* 4.21 BlockAckPolicy */
4528c2ecf20Sopenharmony_ci#define WSM_MIB_ID_BLOCK_ACK_POLICY		0x100E
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/* 4.22 OverrideInternalTxRate */
4558c2ecf20Sopenharmony_ci#define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE	0x100F
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci/* 4.23 SetAssociationMode */
4588c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_ASSOCIATION_MODE		0x1010
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/* 4.24 UpdateEptaConfigData */
4618c2ecf20Sopenharmony_ci#define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA	0x1011
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/* 4.25 SelectCcaMethod */
4648c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SELECT_CCA_METHOD		0x1012
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* 4.26 SetUpasdInformation */
4678c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_UAPSD_INFORMATION	0x1013
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci/* 4.27 SetAutoCalibrationMode  WBF00004073 */
4708c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE	0x1015
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci/* 4.28 SetTxRateRetryPolicy */
4738c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY	0x1016
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/* 4.29 SetHostMessageTypeFilter */
4768c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER	0x1017
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci/* 4.30 P2PFindInfo */
4798c2ecf20Sopenharmony_ci#define WSM_MIB_ID_P2P_FIND_INFO		0x1018
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci/* 4.31 P2PPsModeInfo */
4828c2ecf20Sopenharmony_ci#define WSM_MIB_ID_P2P_PS_MODE_INFO		0x1019
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/* 4.32 SetEtherTypeDataFrameFilter */
4858c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci/* 4.33 SetUDPPortDataFrameFilter */
4888c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER	0x101B
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci/* 4.34 SetMagicDataFrameFilter */
4918c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER	0x101C
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci/* 4.35 P2PDeviceInfo */
4948c2ecf20Sopenharmony_ci#define WSM_MIB_ID_P2P_DEVICE_INFO		0x101D
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/* 4.36 SetWCDMABand */
4978c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_WCDMA_BAND		0x101E
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci/* 4.37 GroupTxSequenceCounter */
5008c2ecf20Sopenharmony_ci#define WSM_MIB_ID_GRP_SEQ_COUNTER		0x101F
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci/* 4.38 ProtectedMgmtPolicy */
5038c2ecf20Sopenharmony_ci#define WSM_MIB_ID_PROTECTED_MGMT_POLICY	0x1020
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci/* 4.39 SetHtProtection */
5068c2ecf20Sopenharmony_ci#define WSM_MIB_ID_SET_HT_PROTECTION		0x1021
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci/* 4.40 GPIO Command */
5098c2ecf20Sopenharmony_ci#define WSM_MIB_ID_GPIO_COMMAND			0x1022
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci/* 4.41 TSF Counter Value */
5128c2ecf20Sopenharmony_ci#define WSM_MIB_ID_TSF_COUNTER			0x1023
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci/* Test Purposes Only */
5158c2ecf20Sopenharmony_ci#define WSM_MIB_ID_BLOCK_ACK_INFO		0x100D
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/* 4.42 UseMultiTxConfMessage */
5188c2ecf20Sopenharmony_ci#define WSM_MIB_USE_MULTI_TX_CONF		0x1024
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci/* 4.43 Keep-alive period */
5218c2ecf20Sopenharmony_ci#define WSM_MIB_ID_KEEP_ALIVE_PERIOD		0x1025
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_ci/* 4.44 Disable BSSID filter */
5248c2ecf20Sopenharmony_ci#define WSM_MIB_ID_DISABLE_BSSID_FILTER		0x1026
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci/* Frame template types */
5278c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_PROBE_REQUEST	(0)
5288c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_BEACON		(1)
5298c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_NULL		(2)
5308c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_QOS_NULL		(3)
5318c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_PS_POLL		(4)
5328c2ecf20Sopenharmony_ci#define WSM_FRAME_TYPE_PROBE_RESPONSE	(5)
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci#define WSM_FRAME_GREENFIELD		(0x80)	/* See 4.11 */
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/* Status */
5378c2ecf20Sopenharmony_ci/* The WSM firmware has completed a request */
5388c2ecf20Sopenharmony_ci/* successfully. */
5398c2ecf20Sopenharmony_ci#define WSM_STATUS_SUCCESS              (0)
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_ci/* This is a generic failure code if other error codes do */
5428c2ecf20Sopenharmony_ci/* not apply. */
5438c2ecf20Sopenharmony_ci#define WSM_STATUS_FAILURE              (1)
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci/* A request contains one or more invalid parameters. */
5468c2ecf20Sopenharmony_ci#define WSM_INVALID_PARAMETER           (2)
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/* The request cannot perform because the device is in */
5498c2ecf20Sopenharmony_ci/* an inappropriate mode. */
5508c2ecf20Sopenharmony_ci#define WSM_ACCESS_DENIED               (3)
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/* The frame received includes a decryption error. */
5538c2ecf20Sopenharmony_ci#define WSM_STATUS_DECRYPTFAILURE       (4)
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci/* A MIC failure is detected in the received packets. */
5568c2ecf20Sopenharmony_ci#define WSM_STATUS_MICFAILURE           (5)
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci/* The transmit request failed due to retry limit being */
5598c2ecf20Sopenharmony_ci/* exceeded. */
5608c2ecf20Sopenharmony_ci#define WSM_STATUS_RETRY_EXCEEDED       (6)
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci/* The transmit request failed due to MSDU life time */
5638c2ecf20Sopenharmony_ci/* being exceeded. */
5648c2ecf20Sopenharmony_ci#define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci/* The link to the AP is lost. */
5678c2ecf20Sopenharmony_ci#define WSM_STATUS_LINK_LOST            (8)
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci/* No key was found for the encrypted frame */
5708c2ecf20Sopenharmony_ci#define WSM_STATUS_NO_KEY_FOUND         (9)
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci/* Jammer was detected when transmitting this frame */
5738c2ecf20Sopenharmony_ci#define WSM_STATUS_JAMMER_DETECTED      (10)
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci/* The message should be requeued later. */
5768c2ecf20Sopenharmony_ci/* This is applicable only to Transmit */
5778c2ecf20Sopenharmony_ci#define WSM_REQUEUE                     (11)
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci/* Advanced filtering options */
5808c2ecf20Sopenharmony_ci#define WSM_MAX_FILTER_ELEMENTS		(4)
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci#define WSM_FILTER_ACTION_IGNORE	(0)
5838c2ecf20Sopenharmony_ci#define WSM_FILTER_ACTION_FILTER_IN	(1)
5848c2ecf20Sopenharmony_ci#define WSM_FILTER_ACTION_FILTER_OUT	(2)
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci#define WSM_FILTER_PORT_TYPE_DST	(0)
5878c2ecf20Sopenharmony_ci#define WSM_FILTER_PORT_TYPE_SRC	(1)
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ci/* Actual header of WSM messages */
5908c2ecf20Sopenharmony_cistruct wsm_hdr {
5918c2ecf20Sopenharmony_ci	__le16 len;
5928c2ecf20Sopenharmony_ci	__le16 id;
5938c2ecf20Sopenharmony_ci};
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci#define WSM_TX_SEQ_MAX			(7)
5968c2ecf20Sopenharmony_ci#define WSM_TX_SEQ(seq)			\
5978c2ecf20Sopenharmony_ci		((seq & WSM_TX_SEQ_MAX) << 13)
5988c2ecf20Sopenharmony_ci#define WSM_TX_LINK_ID_MAX		(0x0F)
5998c2ecf20Sopenharmony_ci#define WSM_TX_LINK_ID(link_id)		\
6008c2ecf20Sopenharmony_ci		((link_id & WSM_TX_LINK_ID_MAX) << 6)
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci#define MAX_BEACON_SKIP_TIME_MS 1000
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci#define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 3 / 2)
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci/* ******************************************************************** */
6078c2ecf20Sopenharmony_ci/* WSM capability							*/
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci#define WSM_STARTUP_IND_ID 0x0801
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_cistruct wsm_startup_ind {
6128c2ecf20Sopenharmony_ci	u16 input_buffers;
6138c2ecf20Sopenharmony_ci	u16 input_buffer_size;
6148c2ecf20Sopenharmony_ci	u16 status;
6158c2ecf20Sopenharmony_ci	u16 hw_id;
6168c2ecf20Sopenharmony_ci	u16 hw_subid;
6178c2ecf20Sopenharmony_ci	u16 fw_cap;
6188c2ecf20Sopenharmony_ci	u16 fw_type;
6198c2ecf20Sopenharmony_ci	u16 fw_api;
6208c2ecf20Sopenharmony_ci	u16 fw_build;
6218c2ecf20Sopenharmony_ci	u16 fw_ver;
6228c2ecf20Sopenharmony_ci	char fw_label[128];
6238c2ecf20Sopenharmony_ci	u32 config[4];
6248c2ecf20Sopenharmony_ci};
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci/* ******************************************************************** */
6278c2ecf20Sopenharmony_ci/* WSM commands								*/
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/* 3.1 */
6308c2ecf20Sopenharmony_ci#define WSM_CONFIGURATION_REQ_ID 0x0009
6318c2ecf20Sopenharmony_ci#define WSM_CONFIGURATION_RESP_ID 0x0409
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_cistruct wsm_tx_power_range {
6348c2ecf20Sopenharmony_ci	int min_power_level;
6358c2ecf20Sopenharmony_ci	int max_power_level;
6368c2ecf20Sopenharmony_ci	u32 stepping;
6378c2ecf20Sopenharmony_ci};
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_cistruct wsm_configuration {
6408c2ecf20Sopenharmony_ci	/* [in] */ u32 dot11MaxTransmitMsduLifeTime;
6418c2ecf20Sopenharmony_ci	/* [in] */ u32 dot11MaxReceiveLifeTime;
6428c2ecf20Sopenharmony_ci	/* [in] */ u32 dot11RtsThreshold;
6438c2ecf20Sopenharmony_ci	/* [in, out] */ u8 *dot11StationId;
6448c2ecf20Sopenharmony_ci	/* [in] */ const void *dpdData;
6458c2ecf20Sopenharmony_ci	/* [in] */ size_t dpdData_size;
6468c2ecf20Sopenharmony_ci	/* [out] */ u8 dot11FrequencyBandsSupported;
6478c2ecf20Sopenharmony_ci	/* [out] */ u32 supportedRateMask;
6488c2ecf20Sopenharmony_ci	/* [out] */ struct wsm_tx_power_range txPowerRange[2];
6498c2ecf20Sopenharmony_ci};
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_ciint wsm_configuration(struct cw1200_common *priv,
6528c2ecf20Sopenharmony_ci		      struct wsm_configuration *arg);
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci/* 3.3 */
6558c2ecf20Sopenharmony_ci#define WSM_RESET_REQ_ID 0x000A
6568c2ecf20Sopenharmony_ci#define WSM_RESET_RESP_ID 0x040A
6578c2ecf20Sopenharmony_cistruct wsm_reset {
6588c2ecf20Sopenharmony_ci	/* [in] */ int link_id;
6598c2ecf20Sopenharmony_ci	/* [in] */ bool reset_statistics;
6608c2ecf20Sopenharmony_ci};
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ciint wsm_reset(struct cw1200_common *priv, const struct wsm_reset *arg);
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci/* 3.5 */
6658c2ecf20Sopenharmony_ci#define WSM_READ_MIB_REQ_ID 0x0005
6668c2ecf20Sopenharmony_ci#define WSM_READ_MIB_RESP_ID 0x0405
6678c2ecf20Sopenharmony_ciint wsm_read_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
6688c2ecf20Sopenharmony_ci		 size_t buf_size);
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci/* 3.7 */
6718c2ecf20Sopenharmony_ci#define WSM_WRITE_MIB_REQ_ID 0x0006
6728c2ecf20Sopenharmony_ci#define WSM_WRITE_MIB_RESP_ID 0x0406
6738c2ecf20Sopenharmony_ciint wsm_write_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
6748c2ecf20Sopenharmony_ci		  size_t buf_size);
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci/* 3.9 */
6778c2ecf20Sopenharmony_ci#define WSM_START_SCAN_REQ_ID 0x0007
6788c2ecf20Sopenharmony_ci#define WSM_START_SCAN_RESP_ID 0x0407
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_cistruct wsm_ssid {
6818c2ecf20Sopenharmony_ci	u8 ssid[32];
6828c2ecf20Sopenharmony_ci	u32 length;
6838c2ecf20Sopenharmony_ci};
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_cistruct wsm_scan_ch {
6868c2ecf20Sopenharmony_ci	u16 number;
6878c2ecf20Sopenharmony_ci	u32 min_chan_time;
6888c2ecf20Sopenharmony_ci	u32 max_chan_time;
6898c2ecf20Sopenharmony_ci	u32 tx_power_level;
6908c2ecf20Sopenharmony_ci};
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistruct wsm_scan {
6938c2ecf20Sopenharmony_ci	/* WSM_PHY_BAND_... */
6948c2ecf20Sopenharmony_ci	u8 band;
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci	/* WSM_SCAN_TYPE_... */
6978c2ecf20Sopenharmony_ci	u8 type;
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_ci	/* WSM_SCAN_FLAG_... */
7008c2ecf20Sopenharmony_ci	u8 flags;
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_ci	/* WSM_TRANSMIT_RATE_... */
7038c2ecf20Sopenharmony_ci	u8 max_tx_rate;
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci	/* Interval period in TUs that the device shall the re- */
7068c2ecf20Sopenharmony_ci	/* execute the requested scan. Max value supported by the device */
7078c2ecf20Sopenharmony_ci	/* is 256s. */
7088c2ecf20Sopenharmony_ci	u32 auto_scan_interval;
7098c2ecf20Sopenharmony_ci
7108c2ecf20Sopenharmony_ci	/* Number of probe requests (per SSID) sent to one (1) */
7118c2ecf20Sopenharmony_ci	/* channel. Zero (0) means that none is send, which */
7128c2ecf20Sopenharmony_ci	/* means that a passive scan is to be done. Value */
7138c2ecf20Sopenharmony_ci	/* greater than zero (0) means that an active scan is to */
7148c2ecf20Sopenharmony_ci	/* be done. */
7158c2ecf20Sopenharmony_ci	u32 num_probes;
7168c2ecf20Sopenharmony_ci
7178c2ecf20Sopenharmony_ci	/* Number of channels to be scanned. */
7188c2ecf20Sopenharmony_ci	/* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
7198c2ecf20Sopenharmony_ci	u8 num_channels;
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci	/* Number of SSID provided in the scan command (this */
7228c2ecf20Sopenharmony_ci	/* is zero (0) in broadcast scan) */
7238c2ecf20Sopenharmony_ci	/* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
7248c2ecf20Sopenharmony_ci	u8 num_ssids;
7258c2ecf20Sopenharmony_ci
7268c2ecf20Sopenharmony_ci	/* The delay time (in microseconds) period */
7278c2ecf20Sopenharmony_ci	/* before sending a probe-request. */
7288c2ecf20Sopenharmony_ci	u8 probe_delay;
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci	/* SSIDs to be scanned [numOfSSIDs]; */
7318c2ecf20Sopenharmony_ci	struct wsm_ssid *ssids;
7328c2ecf20Sopenharmony_ci
7338c2ecf20Sopenharmony_ci	/* Channels to be scanned [numOfChannels]; */
7348c2ecf20Sopenharmony_ci	struct wsm_scan_ch *ch;
7358c2ecf20Sopenharmony_ci};
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ciint wsm_scan(struct cw1200_common *priv, const struct wsm_scan *arg);
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci/* 3.11 */
7408c2ecf20Sopenharmony_ci#define WSM_STOP_SCAN_REQ_ID 0x0008
7418c2ecf20Sopenharmony_ci#define WSM_STOP_SCAN_RESP_ID 0x0408
7428c2ecf20Sopenharmony_ciint wsm_stop_scan(struct cw1200_common *priv);
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci/* 3.13 */
7458c2ecf20Sopenharmony_ci#define WSM_SCAN_COMPLETE_IND_ID 0x0806
7468c2ecf20Sopenharmony_cistruct wsm_scan_complete {
7478c2ecf20Sopenharmony_ci	/* WSM_STATUS_... */
7488c2ecf20Sopenharmony_ci	u32 status;
7498c2ecf20Sopenharmony_ci
7508c2ecf20Sopenharmony_ci	/* WSM_PSM_... */
7518c2ecf20Sopenharmony_ci	u8 psm;
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci	/* Number of channels that the scan operation completed. */
7548c2ecf20Sopenharmony_ci	u8 num_channels;
7558c2ecf20Sopenharmony_ci};
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_ci/* 3.14 */
7588c2ecf20Sopenharmony_ci#define WSM_TX_CONFIRM_IND_ID 0x0404
7598c2ecf20Sopenharmony_ci#define WSM_MULTI_TX_CONFIRM_ID 0x041E
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_cistruct wsm_tx_confirm {
7628c2ecf20Sopenharmony_ci	/* Packet identifier used in wsm_tx. */
7638c2ecf20Sopenharmony_ci	u32 packet_id;
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci	/* WSM_STATUS_... */
7668c2ecf20Sopenharmony_ci	u32 status;
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci	/* WSM_TRANSMIT_RATE_... */
7698c2ecf20Sopenharmony_ci	u8 tx_rate;
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci	/* The number of times the frame was transmitted */
7728c2ecf20Sopenharmony_ci	/* without receiving an acknowledgement. */
7738c2ecf20Sopenharmony_ci	u8 ack_failures;
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci	/* WSM_TX_STATUS_... */
7768c2ecf20Sopenharmony_ci	u16 flags;
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci	/* The total time in microseconds that the frame spent in */
7798c2ecf20Sopenharmony_ci	/* the WLAN device before transmission as completed. */
7808c2ecf20Sopenharmony_ci	u32 media_delay;
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_ci	/* The total time in microseconds that the frame spent in */
7838c2ecf20Sopenharmony_ci	/* the WLAN device before transmission was started. */
7848c2ecf20Sopenharmony_ci	u32 tx_queue_delay;
7858c2ecf20Sopenharmony_ci};
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci/* 3.15 */
7888c2ecf20Sopenharmony_citypedef void (*wsm_tx_confirm_cb) (struct cw1200_common *priv,
7898c2ecf20Sopenharmony_ci				   struct wsm_tx_confirm *arg);
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci/* Note that ideology of wsm_tx struct is different against the rest of
7928c2ecf20Sopenharmony_ci * WSM API. wsm_hdr is /not/ a caller-adapted struct to be used as an input
7938c2ecf20Sopenharmony_ci * argument for WSM call, but a prepared bytestream to be sent to firmware.
7948c2ecf20Sopenharmony_ci * It is filled partly in cw1200_tx, partly in low-level WSM code.
7958c2ecf20Sopenharmony_ci * Please pay attention once again: ideology is different.
7968c2ecf20Sopenharmony_ci *
7978c2ecf20Sopenharmony_ci * Legend:
7988c2ecf20Sopenharmony_ci * - [in]: cw1200_tx must fill this field.
7998c2ecf20Sopenharmony_ci * - [wsm]: the field is filled by low-level WSM.
8008c2ecf20Sopenharmony_ci */
8018c2ecf20Sopenharmony_cistruct wsm_tx {
8028c2ecf20Sopenharmony_ci	/* common WSM header */
8038c2ecf20Sopenharmony_ci	struct wsm_hdr hdr;
8048c2ecf20Sopenharmony_ci
8058c2ecf20Sopenharmony_ci	/* Packet identifier that meant to be used in completion. */
8068c2ecf20Sopenharmony_ci	u32 packet_id;  /* Note this is actually a cookie */
8078c2ecf20Sopenharmony_ci
8088c2ecf20Sopenharmony_ci	/* WSM_TRANSMIT_RATE_... */
8098c2ecf20Sopenharmony_ci	u8 max_tx_rate;
8108c2ecf20Sopenharmony_ci
8118c2ecf20Sopenharmony_ci	/* WSM_QUEUE_... */
8128c2ecf20Sopenharmony_ci	u8 queue_id;
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci	/* True: another packet is pending on the host for transmission. */
8158c2ecf20Sopenharmony_ci	u8 more;
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci	/* Bit 0 = 0 - Start expiry time from first Tx attempt (default) */
8188c2ecf20Sopenharmony_ci	/* Bit 0 = 1 - Start expiry time from receipt of Tx Request */
8198c2ecf20Sopenharmony_ci	/* Bits 3:1  - PTA Priority */
8208c2ecf20Sopenharmony_ci	/* Bits 6:4  - Tx Rate Retry Policy */
8218c2ecf20Sopenharmony_ci	/* Bit 7 - Reserved */
8228c2ecf20Sopenharmony_ci	u8 flags;
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_ci	/* Should be 0. */
8258c2ecf20Sopenharmony_ci	u32 reserved;
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci	/* The elapsed time in TUs, after the initial transmission */
8288c2ecf20Sopenharmony_ci	/* of an MSDU, after which further attempts to transmit */
8298c2ecf20Sopenharmony_ci	/* the MSDU shall be terminated. Overrides the global */
8308c2ecf20Sopenharmony_ci	/* dot11MaxTransmitMsduLifeTime setting [optional] */
8318c2ecf20Sopenharmony_ci	/* Device will set the default value if this is 0. */
8328c2ecf20Sopenharmony_ci	__le32 expire_time;
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_ci	/* WSM_HT_TX_... */
8358c2ecf20Sopenharmony_ci	__le32 ht_tx_parameters;
8368c2ecf20Sopenharmony_ci} __packed;
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ci/* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
8398c2ecf20Sopenharmony_ci#define WSM_TX_EXTRA_HEADROOM (28)
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci/* 3.16 */
8428c2ecf20Sopenharmony_ci#define WSM_RECEIVE_IND_ID 0x0804
8438c2ecf20Sopenharmony_ci
8448c2ecf20Sopenharmony_cistruct wsm_rx {
8458c2ecf20Sopenharmony_ci	/* WSM_STATUS_... */
8468c2ecf20Sopenharmony_ci	u32 status;
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ci	/* Specifies the channel of the received packet. */
8498c2ecf20Sopenharmony_ci	u16 channel_number;
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci	/* WSM_TRANSMIT_RATE_... */
8528c2ecf20Sopenharmony_ci	u8 rx_rate;
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_ci	/* This value is expressed in signed Q8.0 format for */
8558c2ecf20Sopenharmony_ci	/* RSSI and unsigned Q7.1 format for RCPI. */
8568c2ecf20Sopenharmony_ci	u8 rcpi_rssi;
8578c2ecf20Sopenharmony_ci
8588c2ecf20Sopenharmony_ci	/* WSM_RX_STATUS_... */
8598c2ecf20Sopenharmony_ci	u32 flags;
8608c2ecf20Sopenharmony_ci};
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci/* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
8638c2ecf20Sopenharmony_ci#define WSM_RX_EXTRA_HEADROOM (16)
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_citypedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
8668c2ecf20Sopenharmony_ci			   struct sk_buff **skb_p);
8678c2ecf20Sopenharmony_ci
8688c2ecf20Sopenharmony_ci/* 3.17 */
8698c2ecf20Sopenharmony_cistruct wsm_event {
8708c2ecf20Sopenharmony_ci	/* WSM_STATUS_... */
8718c2ecf20Sopenharmony_ci	/* [out] */ u32 id;
8728c2ecf20Sopenharmony_ci
8738c2ecf20Sopenharmony_ci	/* Indication parameters. */
8748c2ecf20Sopenharmony_ci	/* For error indication, this shall be a 32-bit WSM status. */
8758c2ecf20Sopenharmony_ci	/* For RCPI or RSSI indication, this should be an 8-bit */
8768c2ecf20Sopenharmony_ci	/* RCPI or RSSI value. */
8778c2ecf20Sopenharmony_ci	/* [out] */ u32 data;
8788c2ecf20Sopenharmony_ci};
8798c2ecf20Sopenharmony_ci
8808c2ecf20Sopenharmony_cistruct cw1200_wsm_event {
8818c2ecf20Sopenharmony_ci	struct list_head link;
8828c2ecf20Sopenharmony_ci	struct wsm_event evt;
8838c2ecf20Sopenharmony_ci};
8848c2ecf20Sopenharmony_ci
8858c2ecf20Sopenharmony_ci/* 3.18 - 3.22 */
8868c2ecf20Sopenharmony_ci/* Measurement. Skipped for now. Irrelevent. */
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_citypedef void (*wsm_event_cb) (struct cw1200_common *priv,
8898c2ecf20Sopenharmony_ci			      struct wsm_event *arg);
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci/* 3.23 */
8928c2ecf20Sopenharmony_ci#define WSM_JOIN_REQ_ID 0x000B
8938c2ecf20Sopenharmony_ci#define WSM_JOIN_RESP_ID 0x040B
8948c2ecf20Sopenharmony_ci
8958c2ecf20Sopenharmony_cistruct wsm_join {
8968c2ecf20Sopenharmony_ci	/* WSM_JOIN_MODE_... */
8978c2ecf20Sopenharmony_ci	u8 mode;
8988c2ecf20Sopenharmony_ci
8998c2ecf20Sopenharmony_ci	/* WSM_PHY_BAND_... */
9008c2ecf20Sopenharmony_ci	u8 band;
9018c2ecf20Sopenharmony_ci
9028c2ecf20Sopenharmony_ci	/* Specifies the channel number to join. The channel */
9038c2ecf20Sopenharmony_ci	/* number will be mapped to an actual frequency */
9048c2ecf20Sopenharmony_ci	/* according to the band */
9058c2ecf20Sopenharmony_ci	u16 channel_number;
9068c2ecf20Sopenharmony_ci
9078c2ecf20Sopenharmony_ci	/* Specifies the BSSID of the BSS or IBSS to be joined */
9088c2ecf20Sopenharmony_ci	/* or the IBSS to be started. */
9098c2ecf20Sopenharmony_ci	u8 bssid[6];
9108c2ecf20Sopenharmony_ci
9118c2ecf20Sopenharmony_ci	/* ATIM window of IBSS */
9128c2ecf20Sopenharmony_ci	/* When ATIM window is zero the initiated IBSS does */
9138c2ecf20Sopenharmony_ci	/* not support power saving. */
9148c2ecf20Sopenharmony_ci	u16 atim_window;
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_ci	/* WSM_JOIN_PREAMBLE_... */
9178c2ecf20Sopenharmony_ci	u8 preamble_type;
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci	/* Specifies if a probe request should be send with the */
9208c2ecf20Sopenharmony_ci	/* specified SSID when joining to the network. */
9218c2ecf20Sopenharmony_ci	u8 probe_for_join;
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ci	/* DTIM Period (In multiples of beacon interval) */
9248c2ecf20Sopenharmony_ci	u8 dtim_period;
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ci	/* WSM_JOIN_FLAGS_... */
9278c2ecf20Sopenharmony_ci	u8 flags;
9288c2ecf20Sopenharmony_ci
9298c2ecf20Sopenharmony_ci	/* Length of the SSID */
9308c2ecf20Sopenharmony_ci	u32 ssid_len;
9318c2ecf20Sopenharmony_ci
9328c2ecf20Sopenharmony_ci	/* Specifies the SSID of the IBSS to join or start */
9338c2ecf20Sopenharmony_ci	u8 ssid[32];
9348c2ecf20Sopenharmony_ci
9358c2ecf20Sopenharmony_ci	/* Specifies the time between TBTTs in TUs */
9368c2ecf20Sopenharmony_ci	u32 beacon_interval;
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_ci	/* A bit mask that defines the BSS basic rate set. */
9398c2ecf20Sopenharmony_ci	u32 basic_rate_set;
9408c2ecf20Sopenharmony_ci};
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_cistruct wsm_join_cnf {
9438c2ecf20Sopenharmony_ci	u32 status;
9448c2ecf20Sopenharmony_ci
9458c2ecf20Sopenharmony_ci	/* Minimum transmission power level in units of 0.1dBm */
9468c2ecf20Sopenharmony_ci	u32 min_power_level;
9478c2ecf20Sopenharmony_ci
9488c2ecf20Sopenharmony_ci	/* Maximum transmission power level in units of 0.1dBm */
9498c2ecf20Sopenharmony_ci	u32 max_power_level;
9508c2ecf20Sopenharmony_ci};
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ciint wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci/* 3.24 */
9558c2ecf20Sopenharmony_cistruct wsm_join_complete {
9568c2ecf20Sopenharmony_ci	/* WSM_STATUS_... */
9578c2ecf20Sopenharmony_ci	u32 status;
9588c2ecf20Sopenharmony_ci};
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci/* 3.25 */
9618c2ecf20Sopenharmony_ci#define WSM_SET_PM_REQ_ID 0x0010
9628c2ecf20Sopenharmony_ci#define WSM_SET_PM_RESP_ID 0x0410
9638c2ecf20Sopenharmony_cistruct wsm_set_pm {
9648c2ecf20Sopenharmony_ci	/* WSM_PSM_... */
9658c2ecf20Sopenharmony_ci	u8 mode;
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci	/* in unit of 500us; 0 to use default */
9688c2ecf20Sopenharmony_ci	u8 fast_psm_idle_period;
9698c2ecf20Sopenharmony_ci
9708c2ecf20Sopenharmony_ci	/* in unit of 500us; 0 to use default */
9718c2ecf20Sopenharmony_ci	u8 ap_psm_change_period;
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci	/* in unit of 500us; 0 to disable auto-pspoll */
9748c2ecf20Sopenharmony_ci	u8 min_auto_pspoll_period;
9758c2ecf20Sopenharmony_ci};
9768c2ecf20Sopenharmony_ci
9778c2ecf20Sopenharmony_ciint wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_ci/* 3.27 */
9808c2ecf20Sopenharmony_cistruct wsm_set_pm_complete {
9818c2ecf20Sopenharmony_ci	u8 psm;			/* WSM_PSM_... */
9828c2ecf20Sopenharmony_ci};
9838c2ecf20Sopenharmony_ci
9848c2ecf20Sopenharmony_ci/* 3.28 */
9858c2ecf20Sopenharmony_ci#define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
9868c2ecf20Sopenharmony_ci#define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
9878c2ecf20Sopenharmony_cistruct wsm_set_bss_params {
9888c2ecf20Sopenharmony_ci	/* This resets the beacon loss counters only */
9898c2ecf20Sopenharmony_ci	u8 reset_beacon_loss;
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci	/* The number of lost consecutive beacons after which */
9928c2ecf20Sopenharmony_ci	/* the WLAN device should indicate the BSS-Lost event */
9938c2ecf20Sopenharmony_ci	/* to the WLAN host driver. */
9948c2ecf20Sopenharmony_ci	u8 beacon_lost_count;
9958c2ecf20Sopenharmony_ci
9968c2ecf20Sopenharmony_ci	/* The AID received during the association process. */
9978c2ecf20Sopenharmony_ci	u16 aid;
9988c2ecf20Sopenharmony_ci
9998c2ecf20Sopenharmony_ci	/* The operational rate set mask */
10008c2ecf20Sopenharmony_ci	u32 operational_rate_set;
10018c2ecf20Sopenharmony_ci};
10028c2ecf20Sopenharmony_ci
10038c2ecf20Sopenharmony_ciint wsm_set_bss_params(struct cw1200_common *priv,
10048c2ecf20Sopenharmony_ci		       const struct wsm_set_bss_params *arg);
10058c2ecf20Sopenharmony_ci
10068c2ecf20Sopenharmony_ci/* 3.30 */
10078c2ecf20Sopenharmony_ci#define WSM_ADD_KEY_REQ_ID         0x000C
10088c2ecf20Sopenharmony_ci#define WSM_ADD_KEY_RESP_ID        0x040C
10098c2ecf20Sopenharmony_cistruct wsm_add_key {
10108c2ecf20Sopenharmony_ci	u8 type;		/* WSM_KEY_TYPE_... */
10118c2ecf20Sopenharmony_ci	u8 index;		/* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
10128c2ecf20Sopenharmony_ci	u16 reserved;
10138c2ecf20Sopenharmony_ci	union {
10148c2ecf20Sopenharmony_ci		struct {
10158c2ecf20Sopenharmony_ci			u8 peer[6];	/* MAC address of the peer station */
10168c2ecf20Sopenharmony_ci			u8 reserved;
10178c2ecf20Sopenharmony_ci			u8 keylen;		/* Key length in bytes */
10188c2ecf20Sopenharmony_ci			u8 keydata[16];		/* Key data */
10198c2ecf20Sopenharmony_ci		} __packed wep_pairwise;
10208c2ecf20Sopenharmony_ci		struct {
10218c2ecf20Sopenharmony_ci			u8 keyid;	/* Unique per key identifier (0..3) */
10228c2ecf20Sopenharmony_ci			u8 keylen;		/* Key length in bytes */
10238c2ecf20Sopenharmony_ci			u16 reserved;
10248c2ecf20Sopenharmony_ci			u8 keydata[16];		/* Key data */
10258c2ecf20Sopenharmony_ci		} __packed wep_group;
10268c2ecf20Sopenharmony_ci		struct {
10278c2ecf20Sopenharmony_ci			u8 peer[6];	/* MAC address of the peer station */
10288c2ecf20Sopenharmony_ci			u16 reserved;
10298c2ecf20Sopenharmony_ci			u8 keydata[16];	/* TKIP key data */
10308c2ecf20Sopenharmony_ci			u8 rx_mic_key[8];		/* Rx MIC key */
10318c2ecf20Sopenharmony_ci			u8 tx_mic_key[8];		/* Tx MIC key */
10328c2ecf20Sopenharmony_ci		} __packed tkip_pairwise;
10338c2ecf20Sopenharmony_ci		struct {
10348c2ecf20Sopenharmony_ci			u8 keydata[16];	/* TKIP key data */
10358c2ecf20Sopenharmony_ci			u8 rx_mic_key[8];		/* Rx MIC key */
10368c2ecf20Sopenharmony_ci			u8 keyid;		/* Key ID */
10378c2ecf20Sopenharmony_ci			u8 reserved[3];
10388c2ecf20Sopenharmony_ci			u8 rx_seqnum[8];	/* Receive Sequence Counter */
10398c2ecf20Sopenharmony_ci		} __packed tkip_group;
10408c2ecf20Sopenharmony_ci		struct {
10418c2ecf20Sopenharmony_ci			u8 peer[6];	/* MAC address of the peer station */
10428c2ecf20Sopenharmony_ci			u16 reserved;
10438c2ecf20Sopenharmony_ci			u8 keydata[16];	/* AES key data */
10448c2ecf20Sopenharmony_ci		} __packed aes_pairwise;
10458c2ecf20Sopenharmony_ci		struct {
10468c2ecf20Sopenharmony_ci			u8 keydata[16];	/* AES key data */
10478c2ecf20Sopenharmony_ci			u8 keyid;		/* Key ID */
10488c2ecf20Sopenharmony_ci			u8 reserved[3];
10498c2ecf20Sopenharmony_ci			u8 rx_seqnum[8];	/* Receive Sequence Counter */
10508c2ecf20Sopenharmony_ci		} __packed aes_group;
10518c2ecf20Sopenharmony_ci		struct {
10528c2ecf20Sopenharmony_ci			u8 peer[6];	/* MAC address of the peer station */
10538c2ecf20Sopenharmony_ci			u8 keyid;		/* Key ID */
10548c2ecf20Sopenharmony_ci			u8 reserved;
10558c2ecf20Sopenharmony_ci			u8 keydata[16];	/* WAPI key data */
10568c2ecf20Sopenharmony_ci			u8 mic_key[16];	/* MIC key data */
10578c2ecf20Sopenharmony_ci		} __packed wapi_pairwise;
10588c2ecf20Sopenharmony_ci		struct {
10598c2ecf20Sopenharmony_ci			u8 keydata[16];	/* WAPI key data */
10608c2ecf20Sopenharmony_ci			u8 mic_key[16];	/* MIC key data */
10618c2ecf20Sopenharmony_ci			u8 keyid;		/* Key ID */
10628c2ecf20Sopenharmony_ci			u8 reserved[3];
10638c2ecf20Sopenharmony_ci		} __packed wapi_group;
10648c2ecf20Sopenharmony_ci	} __packed;
10658c2ecf20Sopenharmony_ci} __packed;
10668c2ecf20Sopenharmony_ci
10678c2ecf20Sopenharmony_ciint wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci/* 3.32 */
10708c2ecf20Sopenharmony_ci#define WSM_REMOVE_KEY_REQ_ID         0x000D
10718c2ecf20Sopenharmony_ci#define WSM_REMOVE_KEY_RESP_ID        0x040D
10728c2ecf20Sopenharmony_cistruct wsm_remove_key {
10738c2ecf20Sopenharmony_ci	u8 index; /* Key entry index : 0-10 */
10748c2ecf20Sopenharmony_ci};
10758c2ecf20Sopenharmony_ci
10768c2ecf20Sopenharmony_ciint wsm_remove_key(struct cw1200_common *priv,
10778c2ecf20Sopenharmony_ci		   const struct wsm_remove_key *arg);
10788c2ecf20Sopenharmony_ci
10798c2ecf20Sopenharmony_ci/* 3.34 */
10808c2ecf20Sopenharmony_cistruct wsm_set_tx_queue_params {
10818c2ecf20Sopenharmony_ci	/* WSM_ACK_POLICY_... */
10828c2ecf20Sopenharmony_ci	u8 ackPolicy;
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_ci	/* Medium Time of TSPEC (in 32us units) allowed per */
10858c2ecf20Sopenharmony_ci	/* One Second Averaging Period for this queue. */
10868c2ecf20Sopenharmony_ci	u16 allowedMediumTime;
10878c2ecf20Sopenharmony_ci
10888c2ecf20Sopenharmony_ci	/* dot11MaxTransmitMsduLifetime to be used for the */
10898c2ecf20Sopenharmony_ci	/* specified queue. */
10908c2ecf20Sopenharmony_ci	u32 maxTransmitLifetime;
10918c2ecf20Sopenharmony_ci};
10928c2ecf20Sopenharmony_ci
10938c2ecf20Sopenharmony_cistruct wsm_tx_queue_params {
10948c2ecf20Sopenharmony_ci	/* NOTE: index is a linux queue id. */
10958c2ecf20Sopenharmony_ci	struct wsm_set_tx_queue_params params[4];
10968c2ecf20Sopenharmony_ci};
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci#define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
11008c2ecf20Sopenharmony_ci		max_life_time)	\
11018c2ecf20Sopenharmony_cido {							\
11028c2ecf20Sopenharmony_ci	struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
11038c2ecf20Sopenharmony_ci	p->ackPolicy = (ack_policy);				\
11048c2ecf20Sopenharmony_ci	p->allowedMediumTime = (allowed_time);				\
11058c2ecf20Sopenharmony_ci	p->maxTransmitLifetime = (max_life_time);			\
11068c2ecf20Sopenharmony_ci} while (0)
11078c2ecf20Sopenharmony_ci
11088c2ecf20Sopenharmony_ciint wsm_set_tx_queue_params(struct cw1200_common *priv,
11098c2ecf20Sopenharmony_ci			    const struct wsm_set_tx_queue_params *arg, u8 id);
11108c2ecf20Sopenharmony_ci
11118c2ecf20Sopenharmony_ci/* 3.36 */
11128c2ecf20Sopenharmony_ci#define WSM_EDCA_PARAMS_REQ_ID 0x0013
11138c2ecf20Sopenharmony_ci#define WSM_EDCA_PARAMS_RESP_ID 0x0413
11148c2ecf20Sopenharmony_cistruct wsm_edca_queue_params {
11158c2ecf20Sopenharmony_ci	/* CWmin (in slots) for the access class. */
11168c2ecf20Sopenharmony_ci	u16 cwmin;
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_ci	/* CWmax (in slots) for the access class. */
11198c2ecf20Sopenharmony_ci	u16 cwmax;
11208c2ecf20Sopenharmony_ci
11218c2ecf20Sopenharmony_ci	/* AIFS (in slots) for the access class. */
11228c2ecf20Sopenharmony_ci	u16 aifns;
11238c2ecf20Sopenharmony_ci
11248c2ecf20Sopenharmony_ci	/* TX OP Limit (in microseconds) for the access class. */
11258c2ecf20Sopenharmony_ci	u16 txop_limit;
11268c2ecf20Sopenharmony_ci
11278c2ecf20Sopenharmony_ci	/* dot11MaxReceiveLifetime to be used for the specified */
11288c2ecf20Sopenharmony_ci	/* the access class. Overrides the global */
11298c2ecf20Sopenharmony_ci	/* dot11MaxReceiveLifetime value */
11308c2ecf20Sopenharmony_ci	u32 max_rx_lifetime;
11318c2ecf20Sopenharmony_ci};
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_cistruct wsm_edca_params {
11348c2ecf20Sopenharmony_ci	/* NOTE: index is a linux queue id. */
11358c2ecf20Sopenharmony_ci	struct wsm_edca_queue_params params[4];
11368c2ecf20Sopenharmony_ci	bool uapsd_enable[4];
11378c2ecf20Sopenharmony_ci};
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci#define TXOP_UNIT 32
11408c2ecf20Sopenharmony_ci#define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
11418c2ecf20Sopenharmony_ci		     __uapsd) \
11428c2ecf20Sopenharmony_ci	do {							\
11438c2ecf20Sopenharmony_ci		struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
11448c2ecf20Sopenharmony_ci		p->cwmin = __cw_min;					\
11458c2ecf20Sopenharmony_ci		p->cwmax = __cw_max;					\
11468c2ecf20Sopenharmony_ci		p->aifns = __aifs;					\
11478c2ecf20Sopenharmony_ci		p->txop_limit = ((__txop) * TXOP_UNIT);			\
11488c2ecf20Sopenharmony_ci		p->max_rx_lifetime = __lifetime;			\
11498c2ecf20Sopenharmony_ci		(__edca)->uapsd_enable[__queue] = (__uapsd);		\
11508c2ecf20Sopenharmony_ci	} while (0)
11518c2ecf20Sopenharmony_ci
11528c2ecf20Sopenharmony_ciint wsm_set_edca_params(struct cw1200_common *priv,
11538c2ecf20Sopenharmony_ci			const struct wsm_edca_params *arg);
11548c2ecf20Sopenharmony_ci
11558c2ecf20Sopenharmony_ciint wsm_set_uapsd_param(struct cw1200_common *priv,
11568c2ecf20Sopenharmony_ci			const struct wsm_edca_params *arg);
11578c2ecf20Sopenharmony_ci
11588c2ecf20Sopenharmony_ci/* 3.38 */
11598c2ecf20Sopenharmony_ci/* Set-System info. Skipped for now. Irrelevent. */
11608c2ecf20Sopenharmony_ci
11618c2ecf20Sopenharmony_ci/* 3.40 */
11628c2ecf20Sopenharmony_ci#define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
11638c2ecf20Sopenharmony_ci#define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
11648c2ecf20Sopenharmony_ci
11658c2ecf20Sopenharmony_cistruct wsm_switch_channel {
11668c2ecf20Sopenharmony_ci	/* 1 - means the STA shall not transmit any further */
11678c2ecf20Sopenharmony_ci	/* frames until the channel switch has completed */
11688c2ecf20Sopenharmony_ci	u8 mode;
11698c2ecf20Sopenharmony_ci
11708c2ecf20Sopenharmony_ci	/* Number of TBTTs until channel switch occurs. */
11718c2ecf20Sopenharmony_ci	/* 0 - indicates switch shall occur at any time */
11728c2ecf20Sopenharmony_ci	/* 1 - occurs immediately before the next TBTT */
11738c2ecf20Sopenharmony_ci	u8 switch_count;
11748c2ecf20Sopenharmony_ci
11758c2ecf20Sopenharmony_ci	/* The new channel number to switch to. */
11768c2ecf20Sopenharmony_ci	/* Note this is defined as per section 2.7. */
11778c2ecf20Sopenharmony_ci	u16 channel_number;
11788c2ecf20Sopenharmony_ci};
11798c2ecf20Sopenharmony_ci
11808c2ecf20Sopenharmony_ciint wsm_switch_channel(struct cw1200_common *priv,
11818c2ecf20Sopenharmony_ci		       const struct wsm_switch_channel *arg);
11828c2ecf20Sopenharmony_ci
11838c2ecf20Sopenharmony_citypedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
11848c2ecf20Sopenharmony_ci
11858c2ecf20Sopenharmony_ci#define WSM_START_REQ_ID 0x0017
11868c2ecf20Sopenharmony_ci#define WSM_START_RESP_ID 0x0417
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_cistruct wsm_start {
11898c2ecf20Sopenharmony_ci	/* WSM_START_MODE_... */
11908c2ecf20Sopenharmony_ci	/* [in] */ u8 mode;
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci	/* WSM_PHY_BAND_... */
11938c2ecf20Sopenharmony_ci	/* [in] */ u8 band;
11948c2ecf20Sopenharmony_ci
11958c2ecf20Sopenharmony_ci	/* Channel number */
11968c2ecf20Sopenharmony_ci	/* [in] */ u16 channel_number;
11978c2ecf20Sopenharmony_ci
11988c2ecf20Sopenharmony_ci	/* Client Traffic window in units of TU */
11998c2ecf20Sopenharmony_ci	/* Valid only when mode == ..._P2P */
12008c2ecf20Sopenharmony_ci	/* [in] */ u32 ct_window;
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci	/* Interval between two consecutive */
12038c2ecf20Sopenharmony_ci	/* beacon transmissions in TU. */
12048c2ecf20Sopenharmony_ci	/* [in] */ u32 beacon_interval;
12058c2ecf20Sopenharmony_ci
12068c2ecf20Sopenharmony_ci	/* DTIM period in terms of beacon intervals */
12078c2ecf20Sopenharmony_ci	/* [in] */ u8 dtim_period;
12088c2ecf20Sopenharmony_ci
12098c2ecf20Sopenharmony_ci	/* WSM_JOIN_PREAMBLE_... */
12108c2ecf20Sopenharmony_ci	/* [in] */ u8 preamble;
12118c2ecf20Sopenharmony_ci
12128c2ecf20Sopenharmony_ci	/* The delay time (in microseconds) period */
12138c2ecf20Sopenharmony_ci	/* before sending a probe-request. */
12148c2ecf20Sopenharmony_ci	/* [in] */ u8 probe_delay;
12158c2ecf20Sopenharmony_ci
12168c2ecf20Sopenharmony_ci	/* Length of the SSID */
12178c2ecf20Sopenharmony_ci	/* [in] */ u8 ssid_len;
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ci	/* SSID of the BSS or P2P_GO to be started now. */
12208c2ecf20Sopenharmony_ci	/* [in] */ u8 ssid[32];
12218c2ecf20Sopenharmony_ci
12228c2ecf20Sopenharmony_ci	/* The basic supported rates for the MiniAP. */
12238c2ecf20Sopenharmony_ci	/* [in] */ u32 basic_rate_set;
12248c2ecf20Sopenharmony_ci};
12258c2ecf20Sopenharmony_ci
12268c2ecf20Sopenharmony_ciint wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
12278c2ecf20Sopenharmony_ci
12288c2ecf20Sopenharmony_ci#define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
12298c2ecf20Sopenharmony_ci#define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
12308c2ecf20Sopenharmony_ci
12318c2ecf20Sopenharmony_cistruct wsm_beacon_transmit {
12328c2ecf20Sopenharmony_ci	/* 1: enable; 0: disable */
12338c2ecf20Sopenharmony_ci	/* [in] */ u8 enable_beaconing;
12348c2ecf20Sopenharmony_ci};
12358c2ecf20Sopenharmony_ci
12368c2ecf20Sopenharmony_ciint wsm_beacon_transmit(struct cw1200_common *priv,
12378c2ecf20Sopenharmony_ci			const struct wsm_beacon_transmit *arg);
12388c2ecf20Sopenharmony_ci
12398c2ecf20Sopenharmony_ciint wsm_start_find(struct cw1200_common *priv);
12408c2ecf20Sopenharmony_ci
12418c2ecf20Sopenharmony_ciint wsm_stop_find(struct cw1200_common *priv);
12428c2ecf20Sopenharmony_ci
12438c2ecf20Sopenharmony_citypedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
12448c2ecf20Sopenharmony_ci
12458c2ecf20Sopenharmony_cistruct wsm_suspend_resume {
12468c2ecf20Sopenharmony_ci	/* See 3.52 */
12478c2ecf20Sopenharmony_ci	/* Link ID */
12488c2ecf20Sopenharmony_ci	/* [out] */ int link_id;
12498c2ecf20Sopenharmony_ci	/* Stop sending further Tx requests down to device for this link */
12508c2ecf20Sopenharmony_ci	/* [out] */ bool stop;
12518c2ecf20Sopenharmony_ci	/* Transmit multicast Frames */
12528c2ecf20Sopenharmony_ci	/* [out] */ bool multicast;
12538c2ecf20Sopenharmony_ci	/* The AC on which Tx to be suspended /resumed. */
12548c2ecf20Sopenharmony_ci	/* This is applicable only for U-APSD */
12558c2ecf20Sopenharmony_ci	/* WSM_QUEUE_... */
12568c2ecf20Sopenharmony_ci	/* [out] */ int queue;
12578c2ecf20Sopenharmony_ci};
12588c2ecf20Sopenharmony_ci
12598c2ecf20Sopenharmony_citypedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
12608c2ecf20Sopenharmony_ci				       struct wsm_suspend_resume *arg);
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_ci/* 3.54 Update-IE request. */
12638c2ecf20Sopenharmony_cistruct wsm_update_ie {
12648c2ecf20Sopenharmony_ci	/* WSM_UPDATE_IE_... */
12658c2ecf20Sopenharmony_ci	/* [in] */ u16 what;
12668c2ecf20Sopenharmony_ci	/* [in] */ u16 count;
12678c2ecf20Sopenharmony_ci	/* [in] */ u8 *ies;
12688c2ecf20Sopenharmony_ci	/* [in] */ size_t length;
12698c2ecf20Sopenharmony_ci};
12708c2ecf20Sopenharmony_ci
12718c2ecf20Sopenharmony_ciint wsm_update_ie(struct cw1200_common *priv,
12728c2ecf20Sopenharmony_ci		  const struct wsm_update_ie *arg);
12738c2ecf20Sopenharmony_ci
12748c2ecf20Sopenharmony_ci/* 3.56 */
12758c2ecf20Sopenharmony_cistruct wsm_map_link {
12768c2ecf20Sopenharmony_ci	/* MAC address of the remote device */
12778c2ecf20Sopenharmony_ci	/* [in] */ u8 mac_addr[6];
12788c2ecf20Sopenharmony_ci	/* [in] */ u8 link_id;
12798c2ecf20Sopenharmony_ci};
12808c2ecf20Sopenharmony_ci
12818c2ecf20Sopenharmony_ciint wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci/* ******************************************************************** */
12848c2ecf20Sopenharmony_ci/* MIB shortcats							*/
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_cistatic inline int wsm_set_output_power(struct cw1200_common *priv,
12878c2ecf20Sopenharmony_ci				       int power_level)
12888c2ecf20Sopenharmony_ci{
12898c2ecf20Sopenharmony_ci	__le32 val = __cpu_to_le32(power_level);
12908c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
12918c2ecf20Sopenharmony_ci			     &val, sizeof(val));
12928c2ecf20Sopenharmony_ci}
12938c2ecf20Sopenharmony_ci
12948c2ecf20Sopenharmony_cistatic inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
12958c2ecf20Sopenharmony_ci					       unsigned dtim_interval,
12968c2ecf20Sopenharmony_ci					       unsigned listen_interval)
12978c2ecf20Sopenharmony_ci{
12988c2ecf20Sopenharmony_ci	struct {
12998c2ecf20Sopenharmony_ci		u8 numBeaconPeriods;
13008c2ecf20Sopenharmony_ci		u8 reserved;
13018c2ecf20Sopenharmony_ci		__le16 listenInterval;
13028c2ecf20Sopenharmony_ci	} val = {
13038c2ecf20Sopenharmony_ci		dtim_interval, 0, __cpu_to_le16(listen_interval)
13048c2ecf20Sopenharmony_ci	};
13058c2ecf20Sopenharmony_ci
13068c2ecf20Sopenharmony_ci	if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
13078c2ecf20Sopenharmony_ci		return -EINVAL;
13088c2ecf20Sopenharmony_ci	else
13098c2ecf20Sopenharmony_ci		return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
13108c2ecf20Sopenharmony_ci				     &val, sizeof(val));
13118c2ecf20Sopenharmony_ci}
13128c2ecf20Sopenharmony_ci
13138c2ecf20Sopenharmony_cistruct wsm_rcpi_rssi_threshold {
13148c2ecf20Sopenharmony_ci	u8 rssiRcpiMode;	/* WSM_RCPI_RSSI_... */
13158c2ecf20Sopenharmony_ci	u8 lowerThreshold;
13168c2ecf20Sopenharmony_ci	u8 upperThreshold;
13178c2ecf20Sopenharmony_ci	u8 rollingAverageCount;
13188c2ecf20Sopenharmony_ci};
13198c2ecf20Sopenharmony_ci
13208c2ecf20Sopenharmony_cistatic inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
13218c2ecf20Sopenharmony_ci					struct wsm_rcpi_rssi_threshold *arg)
13228c2ecf20Sopenharmony_ci{
13238c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
13248c2ecf20Sopenharmony_ci			     sizeof(*arg));
13258c2ecf20Sopenharmony_ci}
13268c2ecf20Sopenharmony_ci
13278c2ecf20Sopenharmony_cistruct wsm_mib_counters_table {
13288c2ecf20Sopenharmony_ci	__le32 plcp_errors;
13298c2ecf20Sopenharmony_ci	__le32 fcs_errors;
13308c2ecf20Sopenharmony_ci	__le32 tx_packets;
13318c2ecf20Sopenharmony_ci	__le32 rx_packets;
13328c2ecf20Sopenharmony_ci	__le32 rx_packet_errors;
13338c2ecf20Sopenharmony_ci	__le32 rx_decryption_failures;
13348c2ecf20Sopenharmony_ci	__le32 rx_mic_failures;
13358c2ecf20Sopenharmony_ci	__le32 rx_no_key_failures;
13368c2ecf20Sopenharmony_ci	__le32 tx_multicast_frames;
13378c2ecf20Sopenharmony_ci	__le32 tx_frames_success;
13388c2ecf20Sopenharmony_ci	__le32 tx_frame_failures;
13398c2ecf20Sopenharmony_ci	__le32 tx_frames_retried;
13408c2ecf20Sopenharmony_ci	__le32 tx_frames_multi_retried;
13418c2ecf20Sopenharmony_ci	__le32 rx_frame_duplicates;
13428c2ecf20Sopenharmony_ci	__le32 rts_success;
13438c2ecf20Sopenharmony_ci	__le32 rts_failures;
13448c2ecf20Sopenharmony_ci	__le32 ack_failures;
13458c2ecf20Sopenharmony_ci	__le32 rx_multicast_frames;
13468c2ecf20Sopenharmony_ci	__le32 rx_frames_success;
13478c2ecf20Sopenharmony_ci	__le32 rx_cmac_icv_errors;
13488c2ecf20Sopenharmony_ci	__le32 rx_cmac_replays;
13498c2ecf20Sopenharmony_ci	__le32 rx_mgmt_ccmp_replays;
13508c2ecf20Sopenharmony_ci} __packed;
13518c2ecf20Sopenharmony_ci
13528c2ecf20Sopenharmony_cistatic inline int wsm_get_counters_table(struct cw1200_common *priv,
13538c2ecf20Sopenharmony_ci					 struct wsm_mib_counters_table *arg)
13548c2ecf20Sopenharmony_ci{
13558c2ecf20Sopenharmony_ci	return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
13568c2ecf20Sopenharmony_ci			    arg, sizeof(*arg));
13578c2ecf20Sopenharmony_ci}
13588c2ecf20Sopenharmony_ci
13598c2ecf20Sopenharmony_cistatic inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
13608c2ecf20Sopenharmony_ci{
13618c2ecf20Sopenharmony_ci	return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
13628c2ecf20Sopenharmony_ci}
13638c2ecf20Sopenharmony_ci
13648c2ecf20Sopenharmony_cistruct wsm_rx_filter {
13658c2ecf20Sopenharmony_ci	bool promiscuous;
13668c2ecf20Sopenharmony_ci	bool bssid;
13678c2ecf20Sopenharmony_ci	bool fcs;
13688c2ecf20Sopenharmony_ci	bool probeResponder;
13698c2ecf20Sopenharmony_ci};
13708c2ecf20Sopenharmony_ci
13718c2ecf20Sopenharmony_cistatic inline int wsm_set_rx_filter(struct cw1200_common *priv,
13728c2ecf20Sopenharmony_ci				    const struct wsm_rx_filter *arg)
13738c2ecf20Sopenharmony_ci{
13748c2ecf20Sopenharmony_ci	__le32 val = 0;
13758c2ecf20Sopenharmony_ci	if (arg->promiscuous)
13768c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(0));
13778c2ecf20Sopenharmony_ci	if (arg->bssid)
13788c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(1));
13798c2ecf20Sopenharmony_ci	if (arg->fcs)
13808c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(2));
13818c2ecf20Sopenharmony_ci	if (arg->probeResponder)
13828c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(3));
13838c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
13848c2ecf20Sopenharmony_ci}
13858c2ecf20Sopenharmony_ci
13868c2ecf20Sopenharmony_ciint wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ci#define WSM_BEACON_FILTER_IE_HAS_CHANGED	BIT(0)
13898c2ecf20Sopenharmony_ci#define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT	BIT(1)
13908c2ecf20Sopenharmony_ci#define WSM_BEACON_FILTER_IE_HAS_APPEARED	BIT(2)
13918c2ecf20Sopenharmony_ci
13928c2ecf20Sopenharmony_cistruct wsm_beacon_filter_table_entry {
13938c2ecf20Sopenharmony_ci	u8	ie_id;
13948c2ecf20Sopenharmony_ci	u8	flags;
13958c2ecf20Sopenharmony_ci	u8	oui[3];
13968c2ecf20Sopenharmony_ci	u8	match_data[3];
13978c2ecf20Sopenharmony_ci} __packed;
13988c2ecf20Sopenharmony_ci
13998c2ecf20Sopenharmony_cistruct wsm_mib_beacon_filter_table {
14008c2ecf20Sopenharmony_ci	__le32 num;
14018c2ecf20Sopenharmony_ci	struct wsm_beacon_filter_table_entry entry[10];
14028c2ecf20Sopenharmony_ci} __packed;
14038c2ecf20Sopenharmony_ci
14048c2ecf20Sopenharmony_cistatic inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
14058c2ecf20Sopenharmony_ci					      struct wsm_mib_beacon_filter_table *ft)
14068c2ecf20Sopenharmony_ci{
14078c2ecf20Sopenharmony_ci	size_t size = __le32_to_cpu(ft->num) *
14088c2ecf20Sopenharmony_ci		     sizeof(struct wsm_beacon_filter_table_entry) +
14098c2ecf20Sopenharmony_ci		     sizeof(__le32);
14108c2ecf20Sopenharmony_ci
14118c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
14128c2ecf20Sopenharmony_ci}
14138c2ecf20Sopenharmony_ci
14148c2ecf20Sopenharmony_ci#define WSM_BEACON_FILTER_ENABLE	BIT(0) /* Enable/disable beacon filtering */
14158c2ecf20Sopenharmony_ci#define WSM_BEACON_FILTER_AUTO_ERP	BIT(1) /* If 1 FW will handle ERP IE changes internally */
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_cistruct wsm_beacon_filter_control {
14188c2ecf20Sopenharmony_ci	int enabled;
14198c2ecf20Sopenharmony_ci	int bcn_count;
14208c2ecf20Sopenharmony_ci};
14218c2ecf20Sopenharmony_ci
14228c2ecf20Sopenharmony_cistatic inline int wsm_beacon_filter_control(struct cw1200_common *priv,
14238c2ecf20Sopenharmony_ci					struct wsm_beacon_filter_control *arg)
14248c2ecf20Sopenharmony_ci{
14258c2ecf20Sopenharmony_ci	struct {
14268c2ecf20Sopenharmony_ci		__le32 enabled;
14278c2ecf20Sopenharmony_ci		__le32 bcn_count;
14288c2ecf20Sopenharmony_ci	} val;
14298c2ecf20Sopenharmony_ci	val.enabled = __cpu_to_le32(arg->enabled);
14308c2ecf20Sopenharmony_ci	val.bcn_count = __cpu_to_le32(arg->bcn_count);
14318c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
14328c2ecf20Sopenharmony_ci			     sizeof(val));
14338c2ecf20Sopenharmony_ci}
14348c2ecf20Sopenharmony_ci
14358c2ecf20Sopenharmony_cienum wsm_power_mode {
14368c2ecf20Sopenharmony_ci	wsm_power_mode_active = 0,
14378c2ecf20Sopenharmony_ci	wsm_power_mode_doze = 1,
14388c2ecf20Sopenharmony_ci	wsm_power_mode_quiescent = 2,
14398c2ecf20Sopenharmony_ci};
14408c2ecf20Sopenharmony_ci
14418c2ecf20Sopenharmony_cistruct wsm_operational_mode {
14428c2ecf20Sopenharmony_ci	enum wsm_power_mode power_mode;
14438c2ecf20Sopenharmony_ci	int disable_more_flag_usage;
14448c2ecf20Sopenharmony_ci	int perform_ant_diversity;
14458c2ecf20Sopenharmony_ci};
14468c2ecf20Sopenharmony_ci
14478c2ecf20Sopenharmony_cistatic inline int wsm_set_operational_mode(struct cw1200_common *priv,
14488c2ecf20Sopenharmony_ci					const struct wsm_operational_mode *arg)
14498c2ecf20Sopenharmony_ci{
14508c2ecf20Sopenharmony_ci	u8 val = arg->power_mode;
14518c2ecf20Sopenharmony_ci	if (arg->disable_more_flag_usage)
14528c2ecf20Sopenharmony_ci		val |= BIT(4);
14538c2ecf20Sopenharmony_ci	if (arg->perform_ant_diversity)
14548c2ecf20Sopenharmony_ci		val |= BIT(5);
14558c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
14568c2ecf20Sopenharmony_ci			     sizeof(val));
14578c2ecf20Sopenharmony_ci}
14588c2ecf20Sopenharmony_ci
14598c2ecf20Sopenharmony_cistruct wsm_template_frame {
14608c2ecf20Sopenharmony_ci	u8 frame_type;
14618c2ecf20Sopenharmony_ci	u8 rate;
14628c2ecf20Sopenharmony_ci	struct sk_buff *skb;
14638c2ecf20Sopenharmony_ci};
14648c2ecf20Sopenharmony_ci
14658c2ecf20Sopenharmony_cistatic inline int wsm_set_template_frame(struct cw1200_common *priv,
14668c2ecf20Sopenharmony_ci					 struct wsm_template_frame *arg)
14678c2ecf20Sopenharmony_ci{
14688c2ecf20Sopenharmony_ci	int ret;
14698c2ecf20Sopenharmony_ci	u8 *p = skb_push(arg->skb, 4);
14708c2ecf20Sopenharmony_ci	p[0] = arg->frame_type;
14718c2ecf20Sopenharmony_ci	p[1] = arg->rate;
14728c2ecf20Sopenharmony_ci	((__le16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
14738c2ecf20Sopenharmony_ci	ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
14748c2ecf20Sopenharmony_ci	skb_pull(arg->skb, 4);
14758c2ecf20Sopenharmony_ci	return ret;
14768c2ecf20Sopenharmony_ci}
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_ci
14798c2ecf20Sopenharmony_cistruct wsm_protected_mgmt_policy {
14808c2ecf20Sopenharmony_ci	bool protectedMgmtEnable;
14818c2ecf20Sopenharmony_ci	bool unprotectedMgmtFramesAllowed;
14828c2ecf20Sopenharmony_ci	bool encryptionForAuthFrame;
14838c2ecf20Sopenharmony_ci};
14848c2ecf20Sopenharmony_ci
14858c2ecf20Sopenharmony_cistatic inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
14868c2ecf20Sopenharmony_ci		struct wsm_protected_mgmt_policy *arg)
14878c2ecf20Sopenharmony_ci{
14888c2ecf20Sopenharmony_ci	__le32 val = 0;
14898c2ecf20Sopenharmony_ci	int ret;
14908c2ecf20Sopenharmony_ci	if (arg->protectedMgmtEnable)
14918c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(0));
14928c2ecf20Sopenharmony_ci	if (arg->unprotectedMgmtFramesAllowed)
14938c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(1));
14948c2ecf20Sopenharmony_ci	if (arg->encryptionForAuthFrame)
14958c2ecf20Sopenharmony_ci		val |= __cpu_to_le32(BIT(2));
14968c2ecf20Sopenharmony_ci	ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
14978c2ecf20Sopenharmony_ci			&val, sizeof(val));
14988c2ecf20Sopenharmony_ci	return ret;
14998c2ecf20Sopenharmony_ci}
15008c2ecf20Sopenharmony_ci
15018c2ecf20Sopenharmony_cistruct wsm_mib_block_ack_policy {
15028c2ecf20Sopenharmony_ci	u8 tx_tid;
15038c2ecf20Sopenharmony_ci	u8 reserved1;
15048c2ecf20Sopenharmony_ci	u8 rx_tid;
15058c2ecf20Sopenharmony_ci	u8 reserved2;
15068c2ecf20Sopenharmony_ci} __packed;
15078c2ecf20Sopenharmony_ci
15088c2ecf20Sopenharmony_cistatic inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
15098c2ecf20Sopenharmony_ci					   u8 tx_tid_policy,
15108c2ecf20Sopenharmony_ci					   u8 rx_tid_policy)
15118c2ecf20Sopenharmony_ci{
15128c2ecf20Sopenharmony_ci	struct wsm_mib_block_ack_policy val = {
15138c2ecf20Sopenharmony_ci		.tx_tid = tx_tid_policy,
15148c2ecf20Sopenharmony_ci		.rx_tid = rx_tid_policy,
15158c2ecf20Sopenharmony_ci	};
15168c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
15178c2ecf20Sopenharmony_ci			     sizeof(val));
15188c2ecf20Sopenharmony_ci}
15198c2ecf20Sopenharmony_ci
15208c2ecf20Sopenharmony_cistruct wsm_mib_association_mode {
15218c2ecf20Sopenharmony_ci	u8 flags;		/* WSM_ASSOCIATION_MODE_... */
15228c2ecf20Sopenharmony_ci	u8 preamble;	/* WSM_JOIN_PREAMBLE_... */
15238c2ecf20Sopenharmony_ci	u8 greenfield;	/* 1 for greenfield */
15248c2ecf20Sopenharmony_ci	u8 mpdu_start_spacing;
15258c2ecf20Sopenharmony_ci	__le32 basic_rate_set;
15268c2ecf20Sopenharmony_ci} __packed;
15278c2ecf20Sopenharmony_ci
15288c2ecf20Sopenharmony_cistatic inline int wsm_set_association_mode(struct cw1200_common *priv,
15298c2ecf20Sopenharmony_ci					   struct wsm_mib_association_mode *arg)
15308c2ecf20Sopenharmony_ci{
15318c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
15328c2ecf20Sopenharmony_ci			     sizeof(*arg));
15338c2ecf20Sopenharmony_ci}
15348c2ecf20Sopenharmony_ci
15358c2ecf20Sopenharmony_ci#define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
15368c2ecf20Sopenharmony_ci#define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
15378c2ecf20Sopenharmony_cistruct wsm_tx_rate_retry_policy {
15388c2ecf20Sopenharmony_ci	u8 index;
15398c2ecf20Sopenharmony_ci	u8 short_retries;
15408c2ecf20Sopenharmony_ci	u8 long_retries;
15418c2ecf20Sopenharmony_ci	/* BIT(2) - Terminate retries when Tx rate retry policy
15428c2ecf20Sopenharmony_ci	 *          finishes.
15438c2ecf20Sopenharmony_ci	 * BIT(3) - Count initial frame transmission as part of
15448c2ecf20Sopenharmony_ci	 *          rate retry counting but not as a retry
15458c2ecf20Sopenharmony_ci	 *          attempt
15468c2ecf20Sopenharmony_ci	 */
15478c2ecf20Sopenharmony_ci	u8 flags;
15488c2ecf20Sopenharmony_ci	u8 rate_recoveries;
15498c2ecf20Sopenharmony_ci	u8 reserved[3];
15508c2ecf20Sopenharmony_ci	__le32 rate_count_indices[3];
15518c2ecf20Sopenharmony_ci} __packed;
15528c2ecf20Sopenharmony_ci
15538c2ecf20Sopenharmony_cistruct wsm_set_tx_rate_retry_policy {
15548c2ecf20Sopenharmony_ci	u8 num;
15558c2ecf20Sopenharmony_ci	u8 reserved[3];
15568c2ecf20Sopenharmony_ci	struct wsm_tx_rate_retry_policy tbl[8];
15578c2ecf20Sopenharmony_ci} __packed;
15588c2ecf20Sopenharmony_ci
15598c2ecf20Sopenharmony_cistatic inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
15608c2ecf20Sopenharmony_ci				struct wsm_set_tx_rate_retry_policy *arg)
15618c2ecf20Sopenharmony_ci{
15628c2ecf20Sopenharmony_ci	size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
15638c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
15648c2ecf20Sopenharmony_ci			     size);
15658c2ecf20Sopenharmony_ci}
15668c2ecf20Sopenharmony_ci
15678c2ecf20Sopenharmony_ci/* 4.32 SetEtherTypeDataFrameFilter */
15688c2ecf20Sopenharmony_cistruct wsm_ether_type_filter_hdr {
15698c2ecf20Sopenharmony_ci	u8 num;		/* Up to WSM_MAX_FILTER_ELEMENTS */
15708c2ecf20Sopenharmony_ci	u8 reserved[3];
15718c2ecf20Sopenharmony_ci} __packed;
15728c2ecf20Sopenharmony_ci
15738c2ecf20Sopenharmony_cistruct wsm_ether_type_filter {
15748c2ecf20Sopenharmony_ci	u8 action;	/* WSM_FILTER_ACTION_XXX */
15758c2ecf20Sopenharmony_ci	u8 reserved;
15768c2ecf20Sopenharmony_ci	__le16 type;	/* Type of ethernet frame */
15778c2ecf20Sopenharmony_ci} __packed;
15788c2ecf20Sopenharmony_ci
15798c2ecf20Sopenharmony_cistatic inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
15808c2ecf20Sopenharmony_ci				struct wsm_ether_type_filter_hdr *arg)
15818c2ecf20Sopenharmony_ci{
15828c2ecf20Sopenharmony_ci	size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
15838c2ecf20Sopenharmony_ci		arg->num * sizeof(struct wsm_ether_type_filter);
15848c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
15858c2ecf20Sopenharmony_ci		arg, size);
15868c2ecf20Sopenharmony_ci}
15878c2ecf20Sopenharmony_ci
15888c2ecf20Sopenharmony_ci/* 4.33 SetUDPPortDataFrameFilter */
15898c2ecf20Sopenharmony_cistruct wsm_udp_port_filter_hdr {
15908c2ecf20Sopenharmony_ci	u8 num;		/* Up to WSM_MAX_FILTER_ELEMENTS */
15918c2ecf20Sopenharmony_ci	u8 reserved[3];
15928c2ecf20Sopenharmony_ci} __packed;
15938c2ecf20Sopenharmony_ci
15948c2ecf20Sopenharmony_cistruct wsm_udp_port_filter {
15958c2ecf20Sopenharmony_ci	u8 action;	/* WSM_FILTER_ACTION_XXX */
15968c2ecf20Sopenharmony_ci	u8 type;		/* WSM_FILTER_PORT_TYPE_XXX */
15978c2ecf20Sopenharmony_ci	__le16 port;		/* Port number */
15988c2ecf20Sopenharmony_ci} __packed;
15998c2ecf20Sopenharmony_ci
16008c2ecf20Sopenharmony_cistatic inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
16018c2ecf20Sopenharmony_ci				struct wsm_udp_port_filter_hdr *arg)
16028c2ecf20Sopenharmony_ci{
16038c2ecf20Sopenharmony_ci	size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
16048c2ecf20Sopenharmony_ci		arg->num * sizeof(struct wsm_udp_port_filter);
16058c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
16068c2ecf20Sopenharmony_ci		arg, size);
16078c2ecf20Sopenharmony_ci}
16088c2ecf20Sopenharmony_ci
16098c2ecf20Sopenharmony_ci/* Undocumented MIBs: */
16108c2ecf20Sopenharmony_ci/* 4.35 P2PDeviceInfo */
16118c2ecf20Sopenharmony_ci#define D11_MAX_SSID_LEN		(32)
16128c2ecf20Sopenharmony_ci
16138c2ecf20Sopenharmony_cistruct wsm_p2p_device_type {
16148c2ecf20Sopenharmony_ci	__le16 category_id;
16158c2ecf20Sopenharmony_ci	u8 oui[4];
16168c2ecf20Sopenharmony_ci	__le16 subcategory_id;
16178c2ecf20Sopenharmony_ci} __packed;
16188c2ecf20Sopenharmony_ci
16198c2ecf20Sopenharmony_cistruct wsm_p2p_device_info {
16208c2ecf20Sopenharmony_ci	struct wsm_p2p_device_type primaryDevice;
16218c2ecf20Sopenharmony_ci	u8 reserved1[3];
16228c2ecf20Sopenharmony_ci	u8 devname_size;
16238c2ecf20Sopenharmony_ci	u8 local_devname[D11_MAX_SSID_LEN];
16248c2ecf20Sopenharmony_ci	u8 reserved2[3];
16258c2ecf20Sopenharmony_ci	u8 num_secdev_supported;
16268c2ecf20Sopenharmony_ci	struct wsm_p2p_device_type secdevs[];
16278c2ecf20Sopenharmony_ci} __packed;
16288c2ecf20Sopenharmony_ci
16298c2ecf20Sopenharmony_ci/* 4.36 SetWCDMABand - WO */
16308c2ecf20Sopenharmony_cistruct wsm_cdma_band {
16318c2ecf20Sopenharmony_ci	u8 wcdma_band;
16328c2ecf20Sopenharmony_ci	u8 reserved[3];
16338c2ecf20Sopenharmony_ci} __packed;
16348c2ecf20Sopenharmony_ci
16358c2ecf20Sopenharmony_ci/* 4.37 GroupTxSequenceCounter - RO */
16368c2ecf20Sopenharmony_cistruct wsm_group_tx_seq {
16378c2ecf20Sopenharmony_ci	__le32 bits_47_16;
16388c2ecf20Sopenharmony_ci	__le16 bits_15_00;
16398c2ecf20Sopenharmony_ci	__le16 reserved;
16408c2ecf20Sopenharmony_ci} __packed;
16418c2ecf20Sopenharmony_ci
16428c2ecf20Sopenharmony_ci/* 4.39 SetHtProtection - WO */
16438c2ecf20Sopenharmony_ci#define WSM_DUAL_CTS_PROT_ENB		(1 << 0)
16448c2ecf20Sopenharmony_ci#define WSM_NON_GREENFIELD_STA_PRESENT  (1 << 1)
16458c2ecf20Sopenharmony_ci#define WSM_HT_PROT_MODE__NO_PROT	(0 << 2)
16468c2ecf20Sopenharmony_ci#define WSM_HT_PROT_MODE__NON_MEMBER	(1 << 2)
16478c2ecf20Sopenharmony_ci#define WSM_HT_PROT_MODE__20_MHZ	(2 << 2)
16488c2ecf20Sopenharmony_ci#define WSM_HT_PROT_MODE__NON_HT_MIXED	(3 << 2)
16498c2ecf20Sopenharmony_ci#define WSM_LSIG_TXOP_PROT_FULL		(1 << 4)
16508c2ecf20Sopenharmony_ci#define WSM_LARGE_L_LENGTH_PROT		(1 << 5)
16518c2ecf20Sopenharmony_ci
16528c2ecf20Sopenharmony_cistruct wsm_ht_protection {
16538c2ecf20Sopenharmony_ci	__le32 flags;
16548c2ecf20Sopenharmony_ci} __packed;
16558c2ecf20Sopenharmony_ci
16568c2ecf20Sopenharmony_ci/* 4.40 GPIO Command - R/W */
16578c2ecf20Sopenharmony_ci#define WSM_GPIO_COMMAND_SETUP	0
16588c2ecf20Sopenharmony_ci#define WSM_GPIO_COMMAND_READ	1
16598c2ecf20Sopenharmony_ci#define WSM_GPIO_COMMAND_WRITE	2
16608c2ecf20Sopenharmony_ci#define WSM_GPIO_COMMAND_RESET	3
16618c2ecf20Sopenharmony_ci#define WSM_GPIO_ALL_PINS	0xFF
16628c2ecf20Sopenharmony_ci
16638c2ecf20Sopenharmony_cistruct wsm_gpio_command {
16648c2ecf20Sopenharmony_ci	u8 command;
16658c2ecf20Sopenharmony_ci	u8 pin;
16668c2ecf20Sopenharmony_ci	__le16 config;
16678c2ecf20Sopenharmony_ci} __packed;
16688c2ecf20Sopenharmony_ci
16698c2ecf20Sopenharmony_ci/* 4.41 TSFCounter - RO */
16708c2ecf20Sopenharmony_cistruct wsm_tsf_counter {
16718c2ecf20Sopenharmony_ci	__le64 tsf_counter;
16728c2ecf20Sopenharmony_ci} __packed;
16738c2ecf20Sopenharmony_ci
16748c2ecf20Sopenharmony_ci/* 4.43 Keep alive period */
16758c2ecf20Sopenharmony_cistruct wsm_keep_alive_period {
16768c2ecf20Sopenharmony_ci	__le16 period;
16778c2ecf20Sopenharmony_ci	u8 reserved[2];
16788c2ecf20Sopenharmony_ci} __packed;
16798c2ecf20Sopenharmony_ci
16808c2ecf20Sopenharmony_cistatic inline int wsm_keep_alive_period(struct cw1200_common *priv,
16818c2ecf20Sopenharmony_ci					int period)
16828c2ecf20Sopenharmony_ci{
16838c2ecf20Sopenharmony_ci	struct wsm_keep_alive_period arg = {
16848c2ecf20Sopenharmony_ci		.period = __cpu_to_le16(period),
16858c2ecf20Sopenharmony_ci	};
16868c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
16878c2ecf20Sopenharmony_ci			&arg, sizeof(arg));
16888c2ecf20Sopenharmony_ci};
16898c2ecf20Sopenharmony_ci
16908c2ecf20Sopenharmony_ci/* BSSID filtering */
16918c2ecf20Sopenharmony_cistruct wsm_set_bssid_filtering {
16928c2ecf20Sopenharmony_ci	u8 filter;
16938c2ecf20Sopenharmony_ci	u8 reserved[3];
16948c2ecf20Sopenharmony_ci} __packed;
16958c2ecf20Sopenharmony_ci
16968c2ecf20Sopenharmony_cistatic inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
16978c2ecf20Sopenharmony_ci					  bool enabled)
16988c2ecf20Sopenharmony_ci{
16998c2ecf20Sopenharmony_ci	struct wsm_set_bssid_filtering arg = {
17008c2ecf20Sopenharmony_ci		.filter = !enabled,
17018c2ecf20Sopenharmony_ci	};
17028c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
17038c2ecf20Sopenharmony_ci			&arg, sizeof(arg));
17048c2ecf20Sopenharmony_ci}
17058c2ecf20Sopenharmony_ci
17068c2ecf20Sopenharmony_ci/* Multicast filtering - 4.5 */
17078c2ecf20Sopenharmony_cistruct wsm_mib_multicast_filter {
17088c2ecf20Sopenharmony_ci	__le32 enable;
17098c2ecf20Sopenharmony_ci	__le32 num_addrs;
17108c2ecf20Sopenharmony_ci	u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
17118c2ecf20Sopenharmony_ci} __packed;
17128c2ecf20Sopenharmony_ci
17138c2ecf20Sopenharmony_cistatic inline int wsm_set_multicast_filter(struct cw1200_common *priv,
17148c2ecf20Sopenharmony_ci					   struct wsm_mib_multicast_filter *fp)
17158c2ecf20Sopenharmony_ci{
17168c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
17178c2ecf20Sopenharmony_ci			     fp, sizeof(*fp));
17188c2ecf20Sopenharmony_ci}
17198c2ecf20Sopenharmony_ci
17208c2ecf20Sopenharmony_ci/* ARP IPv4 filtering - 4.10 */
17218c2ecf20Sopenharmony_cistruct wsm_mib_arp_ipv4_filter {
17228c2ecf20Sopenharmony_ci	__le32 enable;
17238c2ecf20Sopenharmony_ci	__be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
17248c2ecf20Sopenharmony_ci} __packed;
17258c2ecf20Sopenharmony_ci
17268c2ecf20Sopenharmony_cistatic inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
17278c2ecf20Sopenharmony_ci					  struct wsm_mib_arp_ipv4_filter *fp)
17288c2ecf20Sopenharmony_ci{
17298c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
17308c2ecf20Sopenharmony_ci			    fp, sizeof(*fp));
17318c2ecf20Sopenharmony_ci}
17328c2ecf20Sopenharmony_ci
17338c2ecf20Sopenharmony_ci/* P2P Power Save Mode Info - 4.31 */
17348c2ecf20Sopenharmony_cistruct wsm_p2p_ps_modeinfo {
17358c2ecf20Sopenharmony_ci	u8	opp_ps_ct_window;
17368c2ecf20Sopenharmony_ci	u8	count;
17378c2ecf20Sopenharmony_ci	u8	reserved;
17388c2ecf20Sopenharmony_ci	u8	dtim_count;
17398c2ecf20Sopenharmony_ci	__le32	duration;
17408c2ecf20Sopenharmony_ci	__le32	interval;
17418c2ecf20Sopenharmony_ci	__le32	start_time;
17428c2ecf20Sopenharmony_ci} __packed;
17438c2ecf20Sopenharmony_ci
17448c2ecf20Sopenharmony_cistatic inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
17458c2ecf20Sopenharmony_ci					  struct wsm_p2p_ps_modeinfo *mi)
17468c2ecf20Sopenharmony_ci{
17478c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
17488c2ecf20Sopenharmony_ci			     mi, sizeof(*mi));
17498c2ecf20Sopenharmony_ci}
17508c2ecf20Sopenharmony_ci
17518c2ecf20Sopenharmony_cistatic inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
17528c2ecf20Sopenharmony_ci					  struct wsm_p2p_ps_modeinfo *mi)
17538c2ecf20Sopenharmony_ci{
17548c2ecf20Sopenharmony_ci	return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
17558c2ecf20Sopenharmony_ci			    mi, sizeof(*mi));
17568c2ecf20Sopenharmony_ci}
17578c2ecf20Sopenharmony_ci
17588c2ecf20Sopenharmony_ci/* UseMultiTxConfMessage */
17598c2ecf20Sopenharmony_ci
17608c2ecf20Sopenharmony_cistatic inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
17618c2ecf20Sopenharmony_ci					bool enabled)
17628c2ecf20Sopenharmony_ci{
17638c2ecf20Sopenharmony_ci	__le32 arg = enabled ? __cpu_to_le32(1) : 0;
17648c2ecf20Sopenharmony_ci
17658c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
17668c2ecf20Sopenharmony_ci			&arg, sizeof(arg));
17678c2ecf20Sopenharmony_ci}
17688c2ecf20Sopenharmony_ci
17698c2ecf20Sopenharmony_ci
17708c2ecf20Sopenharmony_ci/* 4.26 SetUpasdInformation */
17718c2ecf20Sopenharmony_cistruct wsm_uapsd_info {
17728c2ecf20Sopenharmony_ci	__le16 uapsd_flags;
17738c2ecf20Sopenharmony_ci	__le16 min_auto_trigger_interval;
17748c2ecf20Sopenharmony_ci	__le16 max_auto_trigger_interval;
17758c2ecf20Sopenharmony_ci	__le16 auto_trigger_step;
17768c2ecf20Sopenharmony_ci};
17778c2ecf20Sopenharmony_ci
17788c2ecf20Sopenharmony_cistatic inline int wsm_set_uapsd_info(struct cw1200_common *priv,
17798c2ecf20Sopenharmony_ci				     struct wsm_uapsd_info *arg)
17808c2ecf20Sopenharmony_ci{
17818c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
17828c2ecf20Sopenharmony_ci				arg, sizeof(*arg));
17838c2ecf20Sopenharmony_ci}
17848c2ecf20Sopenharmony_ci
17858c2ecf20Sopenharmony_ci/* 4.22 OverrideInternalTxRate */
17868c2ecf20Sopenharmony_cistruct wsm_override_internal_txrate {
17878c2ecf20Sopenharmony_ci	u8 internalTxRate;
17888c2ecf20Sopenharmony_ci	u8 nonErpInternalTxRate;
17898c2ecf20Sopenharmony_ci	u8 reserved[2];
17908c2ecf20Sopenharmony_ci} __packed;
17918c2ecf20Sopenharmony_ci
17928c2ecf20Sopenharmony_cistatic inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
17938c2ecf20Sopenharmony_ci				     struct wsm_override_internal_txrate *arg)
17948c2ecf20Sopenharmony_ci{
17958c2ecf20Sopenharmony_ci	return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
17968c2ecf20Sopenharmony_ci				arg, sizeof(*arg));
17978c2ecf20Sopenharmony_ci}
17988c2ecf20Sopenharmony_ci
17998c2ecf20Sopenharmony_ci/* ******************************************************************** */
18008c2ecf20Sopenharmony_ci/* WSM TX port control							*/
18018c2ecf20Sopenharmony_ci
18028c2ecf20Sopenharmony_civoid wsm_lock_tx(struct cw1200_common *priv);
18038c2ecf20Sopenharmony_civoid wsm_lock_tx_async(struct cw1200_common *priv);
18048c2ecf20Sopenharmony_cibool wsm_flush_tx(struct cw1200_common *priv);
18058c2ecf20Sopenharmony_civoid wsm_unlock_tx(struct cw1200_common *priv);
18068c2ecf20Sopenharmony_ci
18078c2ecf20Sopenharmony_ci/* ******************************************************************** */
18088c2ecf20Sopenharmony_ci/* WSM / BH API								*/
18098c2ecf20Sopenharmony_ci
18108c2ecf20Sopenharmony_ciint wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
18118c2ecf20Sopenharmony_ciint wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
18128c2ecf20Sopenharmony_ci		  struct sk_buff **skb_p);
18138c2ecf20Sopenharmony_ci
18148c2ecf20Sopenharmony_ci/* ******************************************************************** */
18158c2ecf20Sopenharmony_ci/* wsm_buf API								*/
18168c2ecf20Sopenharmony_ci
18178c2ecf20Sopenharmony_cistruct wsm_buf {
18188c2ecf20Sopenharmony_ci	u8 *begin;
18198c2ecf20Sopenharmony_ci	u8 *data;
18208c2ecf20Sopenharmony_ci	u8 *end;
18218c2ecf20Sopenharmony_ci};
18228c2ecf20Sopenharmony_ci
18238c2ecf20Sopenharmony_civoid wsm_buf_init(struct wsm_buf *buf);
18248c2ecf20Sopenharmony_civoid wsm_buf_deinit(struct wsm_buf *buf);
18258c2ecf20Sopenharmony_ci
18268c2ecf20Sopenharmony_ci/* ******************************************************************** */
18278c2ecf20Sopenharmony_ci/* wsm_cmd API								*/
18288c2ecf20Sopenharmony_ci
18298c2ecf20Sopenharmony_cistruct wsm_cmd {
18308c2ecf20Sopenharmony_ci	spinlock_t lock; /* Protect structure from multiple access */
18318c2ecf20Sopenharmony_ci	int done;
18328c2ecf20Sopenharmony_ci	u8 *ptr;
18338c2ecf20Sopenharmony_ci	size_t len;
18348c2ecf20Sopenharmony_ci	void *arg;
18358c2ecf20Sopenharmony_ci	int ret;
18368c2ecf20Sopenharmony_ci	u16 cmd;
18378c2ecf20Sopenharmony_ci};
18388c2ecf20Sopenharmony_ci
18398c2ecf20Sopenharmony_ci/* ******************************************************************** */
18408c2ecf20Sopenharmony_ci/* WSM TX buffer access							*/
18418c2ecf20Sopenharmony_ci
18428c2ecf20Sopenharmony_ciint wsm_get_tx(struct cw1200_common *priv, u8 **data,
18438c2ecf20Sopenharmony_ci	       size_t *tx_len, int *burst);
18448c2ecf20Sopenharmony_civoid wsm_txed(struct cw1200_common *priv, u8 *data);
18458c2ecf20Sopenharmony_ci
18468c2ecf20Sopenharmony_ci/* ******************************************************************** */
18478c2ecf20Sopenharmony_ci/* Queue mapping: WSM <---> linux					*/
18488c2ecf20Sopenharmony_ci/* Linux: VO VI BE BK							*/
18498c2ecf20Sopenharmony_ci/* WSM:   BE BK VI VO							*/
18508c2ecf20Sopenharmony_ci
18518c2ecf20Sopenharmony_cistatic inline u8 wsm_queue_id_to_linux(u8 queue_id)
18528c2ecf20Sopenharmony_ci{
18538c2ecf20Sopenharmony_ci	static const u8 queue_mapping[] = {
18548c2ecf20Sopenharmony_ci		2, 3, 1, 0
18558c2ecf20Sopenharmony_ci	};
18568c2ecf20Sopenharmony_ci	return queue_mapping[queue_id];
18578c2ecf20Sopenharmony_ci}
18588c2ecf20Sopenharmony_ci
18598c2ecf20Sopenharmony_cistatic inline u8 wsm_queue_id_to_wsm(u8 queue_id)
18608c2ecf20Sopenharmony_ci{
18618c2ecf20Sopenharmony_ci	static const u8 queue_mapping[] = {
18628c2ecf20Sopenharmony_ci		3, 2, 0, 1
18638c2ecf20Sopenharmony_ci	};
18648c2ecf20Sopenharmony_ci	return queue_mapping[queue_id];
18658c2ecf20Sopenharmony_ci}
18668c2ecf20Sopenharmony_ci
18678c2ecf20Sopenharmony_ci#endif /* CW1200_HWIO_H_INCLUDED */
1868