Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * This file function prototypes, data structure
0004  * and  definitions for all the host/station commands
0005  */
0006 
0007 #ifndef _LBS_HOST_H_
0008 #define _LBS_HOST_H_
0009 
0010 #include "types.h"
0011 #include "defs.h"
0012 
0013 #define DEFAULT_AD_HOC_CHANNEL                  6
0014 
0015 #define CMD_OPTION_WAITFORRSP                   0x0002
0016 
0017 /* Host command IDs */
0018 
0019 /*
0020  * Return command are almost always the same as the host command, but with
0021  * bit 15 set high.  There are a few exceptions, though...
0022  */
0023 #define CMD_RET(cmd)                            (0x8000 | cmd)
0024 
0025 /* Return command convention exceptions: */
0026 #define CMD_RET_802_11_ASSOCIATE                0x8012
0027 
0028 /* Command codes */
0029 #define CMD_GET_HW_SPEC                         0x0003
0030 #define CMD_EEPROM_UPDATE                       0x0004
0031 #define CMD_802_11_RESET                        0x0005
0032 #define CMD_802_11_SCAN                         0x0006
0033 #define CMD_802_11_GET_LOG                      0x000b
0034 #define CMD_MAC_MULTICAST_ADR                   0x0010
0035 #define CMD_802_11_AUTHENTICATE                 0x0011
0036 #define CMD_802_11_EEPROM_ACCESS                0x0059
0037 #define CMD_802_11_ASSOCIATE                    0x0050
0038 #define CMD_802_11_SET_WEP                      0x0013
0039 #define CMD_802_11_GET_STAT                     0x0014
0040 #define CMD_802_3_GET_STAT                      0x0015
0041 #define CMD_802_11_SNMP_MIB                     0x0016
0042 #define CMD_MAC_REG_MAP                         0x0017
0043 #define CMD_BBP_REG_MAP                         0x0018
0044 #define CMD_MAC_REG_ACCESS                      0x0019
0045 #define CMD_BBP_REG_ACCESS                      0x001a
0046 #define CMD_RF_REG_ACCESS                       0x001b
0047 #define CMD_802_11_RADIO_CONTROL                0x001c
0048 #define CMD_802_11_RF_CHANNEL                   0x001d
0049 #define CMD_802_11_RF_TX_POWER                  0x001e
0050 #define CMD_802_11_RSSI                         0x001f
0051 #define CMD_802_11_RF_ANTENNA                   0x0020
0052 #define CMD_802_11_PS_MODE                      0x0021
0053 #define CMD_802_11_DATA_RATE                    0x0022
0054 #define CMD_RF_REG_MAP                          0x0023
0055 #define CMD_802_11_DEAUTHENTICATE               0x0024
0056 #define CMD_802_11_REASSOCIATE                  0x0025
0057 #define CMD_MAC_CONTROL                         0x0028
0058 #define CMD_802_11_AD_HOC_START                 0x002b
0059 #define CMD_802_11_AD_HOC_JOIN                  0x002c
0060 #define CMD_802_11_QUERY_TKIP_REPLY_CNTRS       0x002e
0061 #define CMD_802_11_ENABLE_RSN                   0x002f
0062 #define CMD_802_11_SET_AFC                      0x003c
0063 #define CMD_802_11_GET_AFC                      0x003d
0064 #define CMD_802_11_DEEP_SLEEP                   0x003e
0065 #define CMD_802_11_AD_HOC_STOP                  0x0040
0066 #define CMD_802_11_HOST_SLEEP_CFG               0x0043
0067 #define CMD_802_11_WAKEUP_CONFIRM               0x0044
0068 #define CMD_802_11_HOST_SLEEP_ACTIVATE          0x0045
0069 #define CMD_802_11_BEACON_STOP                  0x0049
0070 #define CMD_802_11_MAC_ADDRESS                  0x004d
0071 #define CMD_802_11_LED_GPIO_CTRL                0x004e
0072 #define CMD_802_11_BAND_CONFIG                  0x0058
0073 #define CMD_GSPI_BUS_CONFIG                     0x005a
0074 #define CMD_802_11D_DOMAIN_INFO                 0x005b
0075 #define CMD_802_11_KEY_MATERIAL                 0x005e
0076 #define CMD_802_11_SLEEP_PARAMS                 0x0066
0077 #define CMD_802_11_INACTIVITY_TIMEOUT           0x0067
0078 #define CMD_802_11_SLEEP_PERIOD                 0x0068
0079 #define CMD_802_11_TPC_CFG                      0x0072
0080 #define CMD_802_11_PA_CFG                       0x0073
0081 #define CMD_802_11_FW_WAKE_METHOD               0x0074
0082 #define CMD_802_11_SUBSCRIBE_EVENT              0x0075
0083 #define CMD_802_11_RATE_ADAPT_RATESET           0x0076
0084 #define CMD_802_11_TX_RATE_QUERY                0x007f
0085 #define CMD_GET_TSF                             0x0080
0086 #define CMD_BT_ACCESS                           0x0087
0087 #define CMD_FWT_ACCESS                          0x0095
0088 #define CMD_802_11_MONITOR_MODE                 0x0098
0089 #define CMD_MESH_ACCESS                         0x009b
0090 #define CMD_MESH_CONFIG_OLD                     0x00a3
0091 #define CMD_MESH_CONFIG                         0x00ac
0092 #define CMD_SET_BOOT2_VER                       0x00a5
0093 #define CMD_FUNC_INIT                           0x00a9
0094 #define CMD_FUNC_SHUTDOWN                       0x00aa
0095 #define CMD_802_11_BEACON_CTRL                  0x00b0
0096 
0097 /* For the IEEE Power Save */
0098 #define PS_MODE_ACTION_ENTER_PS                 0x0030
0099 #define PS_MODE_ACTION_EXIT_PS                  0x0031
0100 #define PS_MODE_ACTION_SLEEP_CONFIRMED          0x0034
0101 
0102 #define CMD_ENABLE_RSN                          0x0001
0103 #define CMD_DISABLE_RSN                         0x0000
0104 
0105 #define CMD_ACT_GET                             0x0000
0106 #define CMD_ACT_SET                             0x0001
0107 
0108 /* Define action or option for CMD_802_11_SET_WEP */
0109 #define CMD_ACT_ADD                             0x0002
0110 #define CMD_ACT_REMOVE                          0x0004
0111 
0112 #define CMD_TYPE_WEP_40_BIT                     0x01
0113 #define CMD_TYPE_WEP_104_BIT                    0x02
0114 
0115 #define CMD_NUM_OF_WEP_KEYS                     4
0116 
0117 #define CMD_WEP_KEY_INDEX_MASK                  0x3fff
0118 
0119 /* Define action or option for CMD_802_11_SCAN */
0120 #define CMD_BSS_TYPE_BSS                        0x0001
0121 #define CMD_BSS_TYPE_IBSS                       0x0002
0122 #define CMD_BSS_TYPE_ANY                        0x0003
0123 
0124 /* Define action or option for CMD_802_11_SCAN */
0125 #define CMD_SCAN_TYPE_ACTIVE                    0x0000
0126 #define CMD_SCAN_TYPE_PASSIVE                   0x0001
0127 
0128 #define CMD_SCAN_RADIO_TYPE_BG                  0
0129 
0130 #define CMD_SCAN_PROBE_DELAY_TIME               0
0131 
0132 /* Define action or option for CMD_MAC_CONTROL */
0133 #define CMD_ACT_MAC_RX_ON                       0x0001
0134 #define CMD_ACT_MAC_TX_ON                       0x0002
0135 #define CMD_ACT_MAC_LOOPBACK_ON                 0x0004
0136 #define CMD_ACT_MAC_WEP_ENABLE                  0x0008
0137 #define CMD_ACT_MAC_INT_ENABLE                  0x0010
0138 #define CMD_ACT_MAC_MULTICAST_ENABLE            0x0020
0139 #define CMD_ACT_MAC_BROADCAST_ENABLE            0x0040
0140 #define CMD_ACT_MAC_PROMISCUOUS_ENABLE          0x0080
0141 #define CMD_ACT_MAC_ALL_MULTICAST_ENABLE        0x0100
0142 #define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE    0x0400
0143 
0144 /* Event flags for CMD_802_11_SUBSCRIBE_EVENT */
0145 #define CMD_SUBSCRIBE_RSSI_LOW                  0x0001
0146 #define CMD_SUBSCRIBE_SNR_LOW                   0x0002
0147 #define CMD_SUBSCRIBE_FAILCOUNT                 0x0004
0148 #define CMD_SUBSCRIBE_BCNMISS                   0x0008
0149 #define CMD_SUBSCRIBE_RSSI_HIGH                 0x0010
0150 #define CMD_SUBSCRIBE_SNR_HIGH                  0x0020
0151 
0152 #define RADIO_PREAMBLE_LONG                     0x00
0153 #define RADIO_PREAMBLE_SHORT                    0x02
0154 #define RADIO_PREAMBLE_AUTO                     0x04
0155 
0156 /* Define action or option for CMD_802_11_RF_CHANNEL */
0157 #define CMD_OPT_802_11_RF_CHANNEL_GET           0x00
0158 #define CMD_OPT_802_11_RF_CHANNEL_SET           0x01
0159 
0160 /* Define action or option for CMD_802_11_DATA_RATE */
0161 #define CMD_ACT_SET_TX_AUTO                     0x0000
0162 #define CMD_ACT_SET_TX_FIX_RATE                 0x0001
0163 #define CMD_ACT_GET_TX_RATE                     0x0002
0164 
0165 /* Options for CMD_802_11_FW_WAKE_METHOD */
0166 #define CMD_WAKE_METHOD_UNCHANGED               0x0000
0167 #define CMD_WAKE_METHOD_COMMAND_INT             0x0001
0168 #define CMD_WAKE_METHOD_GPIO                    0x0002
0169 
0170 /* Object IDs for CMD_802_11_SNMP_MIB */
0171 #define SNMP_MIB_OID_BSS_TYPE                   0x0000
0172 #define SNMP_MIB_OID_OP_RATE_SET                0x0001
0173 #define SNMP_MIB_OID_BEACON_PERIOD              0x0002  /* Reserved on v9+ */
0174 #define SNMP_MIB_OID_DTIM_PERIOD                0x0003  /* Reserved on v9+ */
0175 #define SNMP_MIB_OID_ASSOC_TIMEOUT              0x0004  /* Reserved on v9+ */
0176 #define SNMP_MIB_OID_RTS_THRESHOLD              0x0005
0177 #define SNMP_MIB_OID_SHORT_RETRY_LIMIT          0x0006
0178 #define SNMP_MIB_OID_LONG_RETRY_LIMIT           0x0007
0179 #define SNMP_MIB_OID_FRAG_THRESHOLD             0x0008
0180 #define SNMP_MIB_OID_11D_ENABLE                 0x0009
0181 #define SNMP_MIB_OID_11H_ENABLE                 0x000A
0182 
0183 /* Define action or option for CMD_BT_ACCESS */
0184 enum cmd_bt_access_opts {
0185     /* The bt commands start at 5 instead of 1 because the old dft commands
0186      * are mapped to 1-4.  These old commands are no longer maintained and
0187      * should not be called.
0188      */
0189     CMD_ACT_BT_ACCESS_ADD = 5,
0190     CMD_ACT_BT_ACCESS_DEL,
0191     CMD_ACT_BT_ACCESS_LIST,
0192     CMD_ACT_BT_ACCESS_RESET,
0193     CMD_ACT_BT_ACCESS_SET_INVERT,
0194     CMD_ACT_BT_ACCESS_GET_INVERT
0195 };
0196 
0197 /* Define action or option for CMD_FWT_ACCESS */
0198 enum cmd_fwt_access_opts {
0199     CMD_ACT_FWT_ACCESS_ADD = 1,
0200     CMD_ACT_FWT_ACCESS_DEL,
0201     CMD_ACT_FWT_ACCESS_LOOKUP,
0202     CMD_ACT_FWT_ACCESS_LIST,
0203     CMD_ACT_FWT_ACCESS_LIST_ROUTE,
0204     CMD_ACT_FWT_ACCESS_LIST_NEIGHBOR,
0205     CMD_ACT_FWT_ACCESS_RESET,
0206     CMD_ACT_FWT_ACCESS_CLEANUP,
0207     CMD_ACT_FWT_ACCESS_TIME,
0208 };
0209 
0210 /* Define action or option for CMD_802_11_HOST_SLEEP_CFG */
0211 enum cmd_wol_cfg_opts {
0212     CMD_ACT_ACTION_NONE = 0,
0213     CMD_ACT_SET_WOL_RULE,
0214     CMD_ACT_GET_WOL_RULE,
0215     CMD_ACT_RESET_WOL_RULE,
0216 };
0217 
0218 /* Define action or option for CMD_MESH_ACCESS */
0219 enum cmd_mesh_access_opts {
0220     CMD_ACT_MESH_GET_TTL = 1,
0221     CMD_ACT_MESH_SET_TTL,
0222     CMD_ACT_MESH_GET_STATS,
0223     CMD_ACT_MESH_GET_ANYCAST,
0224     CMD_ACT_MESH_SET_ANYCAST,
0225     CMD_ACT_MESH_SET_LINK_COSTS,
0226     CMD_ACT_MESH_GET_LINK_COSTS,
0227     CMD_ACT_MESH_SET_BCAST_RATE,
0228     CMD_ACT_MESH_GET_BCAST_RATE,
0229     CMD_ACT_MESH_SET_RREQ_DELAY,
0230     CMD_ACT_MESH_GET_RREQ_DELAY,
0231     CMD_ACT_MESH_SET_ROUTE_EXP,
0232     CMD_ACT_MESH_GET_ROUTE_EXP,
0233     CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
0234     CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
0235     CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17,
0236 };
0237 
0238 /* Define actions and types for CMD_MESH_CONFIG */
0239 enum cmd_mesh_config_actions {
0240     CMD_ACT_MESH_CONFIG_STOP = 0,
0241     CMD_ACT_MESH_CONFIG_START,
0242     CMD_ACT_MESH_CONFIG_SET,
0243     CMD_ACT_MESH_CONFIG_GET,
0244 };
0245 
0246 enum cmd_mesh_config_types {
0247     CMD_TYPE_MESH_SET_BOOTFLAG = 1,
0248     CMD_TYPE_MESH_SET_BOOTTIME,
0249     CMD_TYPE_MESH_SET_DEF_CHANNEL,
0250     CMD_TYPE_MESH_SET_MESH_IE,
0251     CMD_TYPE_MESH_GET_DEFAULTS,
0252     CMD_TYPE_MESH_GET_MESH_IE, /* GET_DEFAULTS is superset of GET_MESHIE */
0253 };
0254 
0255 /* Card Event definition */
0256 #define MACREG_INT_CODE_TX_PPA_FREE     0
0257 #define MACREG_INT_CODE_TX_DMA_DONE     1
0258 #define MACREG_INT_CODE_LINK_LOST_W_SCAN    2
0259 #define MACREG_INT_CODE_LINK_LOST_NO_SCAN   3
0260 #define MACREG_INT_CODE_LINK_SENSED     4
0261 #define MACREG_INT_CODE_CMD_FINISHED        5
0262 #define MACREG_INT_CODE_MIB_CHANGED     6
0263 #define MACREG_INT_CODE_INIT_DONE       7
0264 #define MACREG_INT_CODE_DEAUTHENTICATED     8
0265 #define MACREG_INT_CODE_DISASSOCIATED       9
0266 #define MACREG_INT_CODE_PS_AWAKE        10
0267 #define MACREG_INT_CODE_PS_SLEEP        11
0268 #define MACREG_INT_CODE_MIC_ERR_MULTICAST   13
0269 #define MACREG_INT_CODE_MIC_ERR_UNICAST     14
0270 #define MACREG_INT_CODE_WM_AWAKE        15
0271 #define MACREG_INT_CODE_DEEP_SLEEP_AWAKE    16
0272 #define MACREG_INT_CODE_ADHOC_BCN_LOST      17
0273 #define MACREG_INT_CODE_HOST_AWAKE      18
0274 #define MACREG_INT_CODE_STOP_TX         19
0275 #define MACREG_INT_CODE_START_TX        20
0276 #define MACREG_INT_CODE_CHANNEL_SWITCH      21
0277 #define MACREG_INT_CODE_MEASUREMENT_RDY     22
0278 #define MACREG_INT_CODE_WMM_CHANGE      23
0279 #define MACREG_INT_CODE_BG_SCAN_REPORT      24
0280 #define MACREG_INT_CODE_RSSI_LOW        25
0281 #define MACREG_INT_CODE_SNR_LOW         26
0282 #define MACREG_INT_CODE_MAX_FAIL        27
0283 #define MACREG_INT_CODE_RSSI_HIGH       28
0284 #define MACREG_INT_CODE_SNR_HIGH        29
0285 #define MACREG_INT_CODE_MESH_AUTO_STARTED   35
0286 #define MACREG_INT_CODE_FIRMWARE_READY      48
0287 
0288 
0289 /* 802.11-related definitions */
0290 
0291 /* TxPD descriptor */
0292 struct txpd {
0293     /* union to cope up with later FW revisions */
0294     union {
0295         /* Current Tx packet status */
0296         __le32 tx_status;
0297         struct {
0298             /* BSS type: client, AP, etc. */
0299             u8 bss_type;
0300             /* BSS number */
0301             u8 bss_num;
0302             /* Reserved */
0303             __le16 reserved;
0304         } bss;
0305     } u;
0306     /* Tx control */
0307     __le32 tx_control;
0308     __le32 tx_packet_location;
0309     /* Tx packet length */
0310     __le16 tx_packet_length;
0311     struct_group_attr(tx_dest_addr, __packed,
0312         /* First 2 byte of destination MAC address */
0313         u8 tx_dest_addr_high[2];
0314         /* Last 4 byte of destination MAC address */
0315         u8 tx_dest_addr_low[4];
0316     );
0317     /* Pkt Priority */
0318     u8 priority;
0319     /* Pkt Trasnit Power control */
0320     u8 powermgmt;
0321     /* Amount of time the packet has been queued (units = 2ms) */
0322     u8 pktdelay_2ms;
0323     /* reserved */
0324     u8 reserved1;
0325 } __packed;
0326 
0327 /* RxPD Descriptor */
0328 struct rxpd {
0329     /* union to cope up with later FW revisions */
0330     union {
0331         /* Current Rx packet status */
0332         __le16 status;
0333         struct {
0334             /* BSS type: client, AP, etc. */
0335             u8 bss_type;
0336             /* BSS number */
0337             u8 bss_num;
0338         } __packed bss;
0339     } __packed u;
0340 
0341     /* SNR */
0342     u8 snr;
0343 
0344     /* Tx control */
0345     u8 rx_control;
0346 
0347     /* Pkt length */
0348     __le16 pkt_len;
0349 
0350     /* Noise Floor */
0351     u8 nf;
0352 
0353     /* Rx Packet Rate */
0354     u8 rx_rate;
0355 
0356     /* Pkt addr */
0357     __le32 pkt_ptr;
0358 
0359     /* Next Rx RxPD addr */
0360     __le32 next_rxpd_ptr;
0361 
0362     /* Pkt Priority */
0363     u8 priority;
0364     u8 reserved[3];
0365 } __packed;
0366 
0367 struct cmd_header {
0368     __le16 command;
0369     __le16 size;
0370     __le16 seqnum;
0371     __le16 result;
0372 } __packed;
0373 
0374 /* Generic structure to hold all key types. */
0375 struct enc_key {
0376     u16 len;
0377     u16 flags;  /* KEY_INFO_* from defs.h */
0378     u16 type; /* KEY_TYPE_* from defs.h */
0379     u8 key[32];
0380 };
0381 
0382 /* lbs_offset_value */
0383 struct lbs_offset_value {
0384     u32 offset;
0385     u32 value;
0386 } __packed;
0387 
0388 #define MAX_11D_TRIPLETS    83
0389 
0390 struct mrvl_ie_domain_param_set {
0391     struct mrvl_ie_header header;
0392 
0393     u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
0394     struct ieee80211_country_ie_triplet triplet[MAX_11D_TRIPLETS];
0395 } __packed;
0396 
0397 struct cmd_ds_802_11d_domain_info {
0398     struct cmd_header hdr;
0399 
0400     __le16 action;
0401     struct mrvl_ie_domain_param_set domain;
0402 } __packed;
0403 
0404 /*
0405  * Define data structure for CMD_GET_HW_SPEC
0406  * This structure defines the response for the GET_HW_SPEC command
0407  */
0408 struct cmd_ds_get_hw_spec {
0409     struct cmd_header hdr;
0410 
0411     /* HW Interface version number */
0412     __le16 hwifversion;
0413     /* HW version number */
0414     __le16 version;
0415     /* Max number of TxPD FW can handle */
0416     __le16 nr_txpd;
0417     /* Max no of Multicast address */
0418     __le16 nr_mcast_adr;
0419     /* MAC address */
0420     u8 permanentaddr[6];
0421 
0422     /* region Code */
0423     __le16 regioncode;
0424 
0425     /* Number of antenna used */
0426     __le16 nr_antenna;
0427 
0428     /* FW release number, example 0x01030304 = 2.3.4p1 */
0429     __le32 fwrelease;
0430 
0431     /* Base Address of TxPD queue */
0432     __le32 wcb_base;
0433     /* Read Pointer of RxPd queue */
0434     __le32 rxpd_rdptr;
0435 
0436     /* Write Pointer of RxPd queue */
0437     __le32 rxpd_wrptr;
0438 
0439     /*FW/HW capability */
0440     __le32 fwcapinfo;
0441 } __packed;
0442 
0443 struct cmd_ds_802_11_subscribe_event {
0444     struct cmd_header hdr;
0445 
0446     __le16 action;
0447     __le16 events;
0448 
0449     /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
0450      * number of TLVs. From the v5.1 manual, those TLVs would add up to
0451      * 40 bytes. However, future firmware might add additional TLVs, so I
0452      * bump this up a bit.
0453      */
0454     uint8_t tlv[128];
0455 } __packed;
0456 
0457 /*
0458  * This scan handle Country Information IE(802.11d compliant)
0459  * Define data structure for CMD_802_11_SCAN
0460  */
0461 struct cmd_ds_802_11_scan {
0462     struct cmd_header hdr;
0463 
0464     uint8_t bsstype;
0465     uint8_t bssid[ETH_ALEN];
0466     uint8_t tlvbuffer[];
0467 } __packed;
0468 
0469 struct cmd_ds_802_11_scan_rsp {
0470     struct cmd_header hdr;
0471 
0472     __le16 bssdescriptsize;
0473     uint8_t nr_sets;
0474     uint8_t bssdesc_and_tlvbuffer[];
0475 } __packed;
0476 
0477 struct cmd_ds_802_11_get_log {
0478     struct cmd_header hdr;
0479 
0480     __le32 mcasttxframe;
0481     __le32 failed;
0482     __le32 retry;
0483     __le32 multiretry;
0484     __le32 framedup;
0485     __le32 rtssuccess;
0486     __le32 rtsfailure;
0487     __le32 ackfailure;
0488     __le32 rxfrag;
0489     __le32 mcastrxframe;
0490     __le32 fcserror;
0491     __le32 txframe;
0492     __le32 wepundecryptable;
0493 } __packed;
0494 
0495 struct cmd_ds_mac_control {
0496     struct cmd_header hdr;
0497     __le16 action;
0498     u16 reserved;
0499 } __packed;
0500 
0501 struct cmd_ds_mac_multicast_adr {
0502     struct cmd_header hdr;
0503     __le16 action;
0504     __le16 nr_of_adrs;
0505     u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
0506 } __packed;
0507 
0508 struct cmd_ds_802_11_authenticate {
0509     struct cmd_header hdr;
0510 
0511     u8 bssid[ETH_ALEN];
0512     u8 authtype;
0513     u8 reserved[10];
0514 } __packed;
0515 
0516 struct cmd_ds_802_11_deauthenticate {
0517     struct cmd_header hdr;
0518 
0519     u8 macaddr[ETH_ALEN];
0520     __le16 reasoncode;
0521 } __packed;
0522 
0523 struct cmd_ds_802_11_associate {
0524     struct cmd_header hdr;
0525 
0526     u8 bssid[6];
0527     __le16 capability;
0528     __le16 listeninterval;
0529     __le16 bcnperiod;
0530     u8 dtimperiod;
0531     /* 512 permitted - enough for required and most optional IEs */
0532     u8 iebuf[];
0533 } __packed;
0534 
0535 struct cmd_ds_802_11_associate_response {
0536     struct cmd_header hdr;
0537 
0538     __le16 capability;
0539     __le16 statuscode;
0540     __le16 aid;
0541     /* max 512 */
0542     u8 iebuf[];
0543 } __packed;
0544 
0545 struct cmd_ds_802_11_set_wep {
0546     struct cmd_header hdr;
0547 
0548     /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
0549     __le16 action;
0550 
0551     /* key Index selected for Tx */
0552     __le16 keyindex;
0553 
0554     /* 40, 128bit or TXWEP */
0555     uint8_t keytype[4];
0556     uint8_t keymaterial[4][16];
0557 } __packed;
0558 
0559 struct cmd_ds_802_11_snmp_mib {
0560     struct cmd_header hdr;
0561 
0562     __le16 action;
0563     __le16 oid;
0564     __le16 bufsize;
0565     u8 value[128];
0566 } __packed;
0567 
0568 struct cmd_ds_reg_access {
0569     struct cmd_header hdr;
0570 
0571     __le16 action;
0572     __le16 offset;
0573     union {
0574         u8 bbp_rf;  /* for BBP and RF registers */
0575         __le32 mac; /* for MAC registers */
0576     } value;
0577 } __packed;
0578 
0579 struct cmd_ds_802_11_radio_control {
0580     struct cmd_header hdr;
0581 
0582     __le16 action;
0583     __le16 control;
0584 } __packed;
0585 
0586 struct cmd_ds_802_11_beacon_control {
0587     struct cmd_header hdr;
0588 
0589     __le16 action;
0590     __le16 beacon_enable;
0591     __le16 beacon_period;
0592 } __packed;
0593 
0594 struct cmd_ds_802_11_sleep_params {
0595     struct cmd_header hdr;
0596 
0597     /* ACT_GET/ACT_SET */
0598     __le16 action;
0599 
0600     /* Sleep clock error in ppm */
0601     __le16 error;
0602 
0603     /* Wakeup offset in usec */
0604     __le16 offset;
0605 
0606     /* Clock stabilization time in usec */
0607     __le16 stabletime;
0608 
0609     /* control periodic calibration */
0610     uint8_t calcontrol;
0611 
0612     /* control the use of external sleep clock */
0613     uint8_t externalsleepclk;
0614 
0615     /* reserved field, should be set to zero */
0616     __le16 reserved;
0617 } __packed;
0618 
0619 struct cmd_ds_802_11_rf_channel {
0620     struct cmd_header hdr;
0621 
0622     __le16 action;
0623     __le16 channel;
0624     __le16 rftype;      /* unused */
0625     __le16 reserved;    /* unused */
0626     u8 channellist[32]; /* unused */
0627 } __packed;
0628 
0629 struct cmd_ds_802_11_rssi {
0630     struct cmd_header hdr;
0631 
0632     /*
0633      * request:  number of beacons (N) to average the SNR and NF over
0634      * response: SNR of most recent beacon
0635      */
0636     __le16 n_or_snr;
0637 
0638     /*
0639      * The following fields are only set in the response.
0640      * In the request these are reserved and should be set to 0.
0641      */
0642     __le16 nf;       /* most recent beacon noise floor */
0643     __le16 avg_snr;  /* average SNR weighted by N from request */
0644     __le16 avg_nf;   /* average noise floor weighted by N from request */
0645 } __packed;
0646 
0647 struct cmd_ds_802_11_mac_address {
0648     struct cmd_header hdr;
0649 
0650     __le16 action;
0651     u8 macadd[ETH_ALEN];
0652 } __packed;
0653 
0654 struct cmd_ds_802_11_rf_tx_power {
0655     struct cmd_header hdr;
0656 
0657     __le16 action;
0658     __le16 curlevel;
0659     s8 maxlevel;
0660     s8 minlevel;
0661 } __packed;
0662 
0663 /* MONITOR_MODE only exists in OLPC v5 firmware */
0664 struct cmd_ds_802_11_monitor_mode {
0665     struct cmd_header hdr;
0666 
0667     __le16 action;
0668     __le16 mode;
0669 } __packed;
0670 
0671 struct cmd_ds_set_boot2_ver {
0672     struct cmd_header hdr;
0673 
0674     __le16 action;
0675     __le16 version;
0676 } __packed;
0677 
0678 struct cmd_ds_802_11_fw_wake_method {
0679     struct cmd_header hdr;
0680 
0681     __le16 action;
0682     __le16 method;
0683 } __packed;
0684 
0685 struct cmd_ds_802_11_ps_mode {
0686     struct cmd_header hdr;
0687 
0688     __le16 action;
0689 
0690     /*
0691      * Interval for keepalive in PS mode:
0692      * 0x0000 = don't change
0693      * 0x001E = firmware default
0694      * 0xFFFF = disable
0695      */
0696     __le16 nullpktinterval;
0697 
0698     /*
0699      * Number of DTIM intervals to wake up for:
0700      * 0 = don't change
0701      * 1 = firmware default
0702      * 5 = max
0703      */
0704     __le16 multipledtim;
0705 
0706     __le16 reserved;
0707     __le16 locallisteninterval;
0708 
0709     /*
0710      * AdHoc awake period (FW v9+ only):
0711      * 0 = don't change
0712      * 1 = always awake (IEEE standard behavior)
0713      * 2 - 31 = sleep for (n - 1) periods and awake for 1 period
0714      * 32 - 254 = invalid
0715      * 255 = sleep at each ATIM
0716      */
0717     __le16 adhoc_awake_period;
0718 } __packed;
0719 
0720 struct cmd_confirm_sleep {
0721     struct cmd_header hdr;
0722 
0723     __le16 action;
0724     __le16 nullpktinterval;
0725     __le16 multipledtim;
0726     __le16 reserved;
0727     __le16 locallisteninterval;
0728 } __packed;
0729 
0730 struct cmd_ds_802_11_data_rate {
0731     struct cmd_header hdr;
0732 
0733     __le16 action;
0734     __le16 reserved;
0735     u8 rates[MAX_RATES];
0736 } __packed;
0737 
0738 struct cmd_ds_802_11_rate_adapt_rateset {
0739     struct cmd_header hdr;
0740     __le16 action;
0741     __le16 enablehwauto;
0742     __le16 bitmap;
0743 } __packed;
0744 
0745 struct cmd_ds_802_11_ad_hoc_start {
0746     struct cmd_header hdr;
0747 
0748     u8 ssid[IEEE80211_MAX_SSID_LEN];
0749     u8 bsstype;
0750     __le16 beaconperiod;
0751     u8 dtimperiod;   /* Reserved on v9 and later */
0752     struct ieee_ie_ibss_param_set ibss;
0753     u8 reserved1[4];
0754     struct ieee_ie_ds_param_set ds;
0755     u8 reserved2[4];
0756     __le16 probedelay;  /* Reserved on v9 and later */
0757     __le16 capability;
0758     u8 rates[MAX_RATES];
0759     u8 tlv_memory_size_pad[100];
0760 } __packed;
0761 
0762 struct cmd_ds_802_11_ad_hoc_result {
0763     struct cmd_header hdr;
0764 
0765     u8 pad[3];
0766     u8 bssid[ETH_ALEN];
0767 } __packed;
0768 
0769 struct adhoc_bssdesc {
0770     u8 bssid[ETH_ALEN];
0771     u8 ssid[IEEE80211_MAX_SSID_LEN];
0772     u8 type;
0773     __le16 beaconperiod;
0774     u8 dtimperiod;
0775     __le64 timestamp;
0776     __le64 localtime;
0777     struct ieee_ie_ds_param_set ds;
0778     u8 reserved1[4];
0779     struct ieee_ie_ibss_param_set ibss;
0780     u8 reserved2[4];
0781     __le16 capability;
0782     u8 rates[MAX_RATES];
0783 
0784     /*
0785      * DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
0786      * Adhoc join command and will cause a binary layout mismatch with
0787      * the firmware
0788      */
0789 } __packed;
0790 
0791 struct cmd_ds_802_11_ad_hoc_join {
0792     struct cmd_header hdr;
0793 
0794     struct adhoc_bssdesc bss;
0795     __le16 failtimeout;   /* Reserved on v9 and later */
0796     __le16 probedelay;    /* Reserved on v9 and later */
0797 } __packed;
0798 
0799 struct cmd_ds_802_11_ad_hoc_stop {
0800     struct cmd_header hdr;
0801 } __packed;
0802 
0803 struct cmd_ds_802_11_enable_rsn {
0804     struct cmd_header hdr;
0805 
0806     __le16 action;
0807     __le16 enable;
0808 } __packed;
0809 
0810 struct MrvlIEtype_keyParamSet {
0811     /* type ID */
0812     __le16 type;
0813 
0814     /* length of Payload */
0815     __le16 length;
0816 
0817     /* type of key: WEP=0, TKIP=1, AES=2 */
0818     __le16 keytypeid;
0819 
0820     /* key control Info specific to a keytypeid */
0821     __le16 keyinfo;
0822 
0823     /* length of key */
0824     __le16 keylen;
0825 
0826     /* key material of size keylen */
0827     u8 key[32];
0828 } __packed;
0829 
0830 #define MAX_WOL_RULES       16
0831 
0832 struct host_wol_rule {
0833     uint8_t rule_no;
0834     uint8_t rule_ops;
0835     __le16 sig_offset;
0836     __le16 sig_length;
0837     __le16 reserve;
0838     __be32 sig_mask;
0839     __be32 signature;
0840 } __packed;
0841 
0842 struct wol_config {
0843     uint8_t action;
0844     uint8_t pattern;
0845     uint8_t no_rules_in_cmd;
0846     uint8_t result;
0847     struct host_wol_rule rule[MAX_WOL_RULES];
0848 } __packed;
0849 
0850 struct cmd_ds_host_sleep {
0851     struct cmd_header hdr;
0852     __le32 criteria;
0853     uint8_t gpio;
0854     uint16_t gap;
0855     struct wol_config wol_conf;
0856 } __packed;
0857 
0858 
0859 
0860 struct cmd_ds_802_11_key_material {
0861     struct cmd_header hdr;
0862 
0863     __le16 action;
0864     struct MrvlIEtype_keyParamSet keyParamSet[2];
0865 } __packed;
0866 
0867 struct cmd_ds_802_11_eeprom_access {
0868     struct cmd_header hdr;
0869     __le16 action;
0870     __le16 offset;
0871     __le16 len;
0872     /* firmware says it returns a maximum of 20 bytes */
0873 #define LBS_EEPROM_READ_LEN 20
0874     u8 value[LBS_EEPROM_READ_LEN];
0875 } __packed;
0876 
0877 struct cmd_ds_802_11_tpc_cfg {
0878     struct cmd_header hdr;
0879 
0880     __le16 action;
0881     uint8_t enable;
0882     int8_t P0;
0883     int8_t P1;
0884     int8_t P2;
0885     uint8_t usesnr;
0886 } __packed;
0887 
0888 
0889 struct cmd_ds_802_11_pa_cfg {
0890     struct cmd_header hdr;
0891 
0892     __le16 action;
0893     uint8_t enable;
0894     int8_t P0;
0895     int8_t P1;
0896     int8_t P2;
0897 } __packed;
0898 
0899 
0900 struct cmd_ds_802_11_led_ctrl {
0901     struct cmd_header hdr;
0902 
0903     __le16 action;
0904     __le16 numled;
0905     u8 data[256];
0906 } __packed;
0907 
0908 /* Automatic Frequency Control */
0909 struct cmd_ds_802_11_afc {
0910     struct cmd_header hdr;
0911 
0912     __le16 afc_auto;
0913     union {
0914         struct {
0915             __le16 threshold;
0916             __le16 period;
0917         };
0918         struct {
0919             __le16 timing_offset; /* signed */
0920             __le16 carrier_offset; /* signed */
0921         };
0922     };
0923 } __packed;
0924 
0925 struct cmd_tx_rate_query {
0926     __le16 txrate;
0927 } __packed;
0928 
0929 struct cmd_ds_get_tsf {
0930     __le64 tsfvalue;
0931 } __packed;
0932 
0933 struct cmd_ds_bt_access {
0934     struct cmd_header hdr;
0935 
0936     __le16 action;
0937     __le32 id;
0938     u8 addr1[ETH_ALEN];
0939     u8 addr2[ETH_ALEN];
0940 } __packed;
0941 
0942 struct cmd_ds_fwt_access {
0943     struct cmd_header hdr;
0944 
0945     __le16 action;
0946     __le32 id;
0947     u8 valid;
0948     u8 da[ETH_ALEN];
0949     u8 dir;
0950     u8 ra[ETH_ALEN];
0951     __le32 ssn;
0952     __le32 dsn;
0953     __le32 metric;
0954     u8 rate;
0955     u8 hopcount;
0956     u8 ttl;
0957     __le32 expiration;
0958     u8 sleepmode;
0959     __le32 snr;
0960     __le32 references;
0961     u8 prec[ETH_ALEN];
0962 } __packed;
0963 
0964 struct cmd_ds_mesh_config {
0965     struct cmd_header hdr;
0966 
0967     __le16 action;
0968     __le16 channel;
0969     __le16 type;
0970     __le16 length;
0971     u8 data[128];   /* last position reserved */
0972 } __packed;
0973 
0974 struct cmd_ds_mesh_access {
0975     struct cmd_header hdr;
0976 
0977     __le16 action;
0978     __le32 data[32];    /* last position reserved */
0979 } __packed;
0980 
0981 /* Number of stats counters returned by the firmware */
0982 #define MESH_STATS_NUM 8
0983 #endif