hostcmd.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. /*
  2. * This file contains the function prototypes, data structure
  3. * and defines for all the host/station commands
  4. */
  5. #ifndef __HOSTCMD__H
  6. #define __HOSTCMD__H
  7. #include <linux/wireless.h>
  8. #include "11d.h"
  9. #include "types.h"
  10. /* 802.11-related definitions */
  11. /* TxPD descriptor */
  12. struct txpd {
  13. /* Current Tx packet status */
  14. __le32 tx_status;
  15. /* Tx control */
  16. __le32 tx_control;
  17. __le32 tx_packet_location;
  18. /* Tx packet length */
  19. __le16 tx_packet_length;
  20. /* First 2 byte of destination MAC address */
  21. u8 tx_dest_addr_high[2];
  22. /* Last 4 byte of destination MAC address */
  23. u8 tx_dest_addr_low[4];
  24. /* Pkt Priority */
  25. u8 priority;
  26. /* Pkt Trasnit Power control */
  27. u8 powermgmt;
  28. /* Amount of time the packet has been queued in the driver (units = 2ms) */
  29. u8 pktdelay_2ms;
  30. /* reserved */
  31. u8 reserved1;
  32. };
  33. /* RxPD Descriptor */
  34. struct rxpd {
  35. /* Current Rx packet status */
  36. __le16 status;
  37. /* SNR */
  38. u8 snr;
  39. /* Tx control */
  40. u8 rx_control;
  41. /* Pkt length */
  42. __le16 pkt_len;
  43. /* Noise Floor */
  44. u8 nf;
  45. /* Rx Packet Rate */
  46. u8 rx_rate;
  47. /* Pkt addr */
  48. __le32 pkt_ptr;
  49. /* Next Rx RxPD addr */
  50. __le32 next_rxpd_ptr;
  51. /* Pkt Priority */
  52. u8 priority;
  53. u8 reserved[3];
  54. };
  55. struct cmd_ctrl_node {
  56. /* CMD link list */
  57. struct list_head list;
  58. u32 status;
  59. /* CMD ID */
  60. u32 cmd_oid;
  61. /*CMD wait option: wait for finish or no wait */
  62. u16 wait_option;
  63. /* command parameter */
  64. void *pdata_buf;
  65. /*command data */
  66. u8 *bufvirtualaddr;
  67. u16 cmdflags;
  68. /* wait queue */
  69. u16 cmdwaitqwoken;
  70. wait_queue_head_t cmdwait_q;
  71. };
  72. /* WLAN_802_11_KEY
  73. *
  74. * Generic structure to hold all key types. key type (WEP40, WEP104, TKIP, AES)
  75. * is determined from the keylength field.
  76. */
  77. struct WLAN_802_11_KEY {
  78. __le32 len;
  79. __le32 flags; /* KEY_INFO_* from wlan_defs.h */
  80. u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
  81. __le16 type; /* KEY_TYPE_* from wlan_defs.h */
  82. };
  83. struct IE_WPA {
  84. u8 elementid;
  85. u8 len;
  86. u8 oui[4];
  87. __le16 version;
  88. };
  89. /* wlan_offset_value */
  90. struct wlan_offset_value {
  91. u32 offset;
  92. u32 value;
  93. };
  94. struct WLAN_802_11_FIXED_IEs {
  95. __le64 timestamp;
  96. __le16 beaconinterval;
  97. u16 capabilities; /* Actually struct ieeetypes_capinfo */
  98. };
  99. struct WLAN_802_11_VARIABLE_IEs {
  100. u8 elementid;
  101. u8 length;
  102. u8 data[1];
  103. };
  104. /* Define general data structure */
  105. /* cmd_DS_GEN */
  106. struct cmd_ds_gen {
  107. __le16 command;
  108. __le16 size;
  109. __le16 seqnum;
  110. __le16 result;
  111. };
  112. #define S_DS_GEN sizeof(struct cmd_ds_gen)
  113. /*
  114. * Define data structure for cmd_get_hw_spec
  115. * This structure defines the response for the GET_HW_SPEC command
  116. */
  117. struct cmd_ds_get_hw_spec {
  118. /* HW Interface version number */
  119. __le16 hwifversion;
  120. /* HW version number */
  121. __le16 version;
  122. /* Max number of TxPD FW can handle */
  123. __le16 nr_txpd;
  124. /* Max no of Multicast address */
  125. __le16 nr_mcast_adr;
  126. /* MAC address */
  127. u8 permanentaddr[6];
  128. /* region Code */
  129. __le16 regioncode;
  130. /* Number of antenna used */
  131. __le16 nr_antenna;
  132. /* FW release number, example 1,2,3,4 = 3.2.1p4 */
  133. u8 fwreleasenumber[4];
  134. /* Base Address of TxPD queue */
  135. __le32 wcb_base;
  136. /* Read Pointer of RxPd queue */
  137. __le32 rxpd_rdptr;
  138. /* Write Pointer of RxPd queue */
  139. __le32 rxpd_wrptr;
  140. /*FW/HW capability */
  141. __le32 fwcapinfo;
  142. } __attribute__ ((packed));
  143. struct cmd_ds_802_11_reset {
  144. __le16 action;
  145. };
  146. struct cmd_ds_802_11_subscribe_event {
  147. __le16 action;
  148. __le16 events;
  149. };
  150. /*
  151. * This scan handle Country Information IE(802.11d compliant)
  152. * Define data structure for cmd_802_11_scan
  153. */
  154. struct cmd_ds_802_11_scan {
  155. u8 bsstype;
  156. u8 BSSID[ETH_ALEN];
  157. u8 tlvbuffer[1];
  158. #if 0
  159. mrvlietypes_ssidparamset_t ssidParamSet;
  160. mrvlietypes_chanlistparamset_t ChanListParamSet;
  161. mrvlietypes_ratesparamset_t OpRateSet;
  162. #endif
  163. };
  164. struct cmd_ds_802_11_scan_rsp {
  165. __le16 bssdescriptsize;
  166. u8 nr_sets;
  167. u8 bssdesc_and_tlvbuffer[1];
  168. };
  169. struct cmd_ds_802_11_get_log {
  170. __le32 mcasttxframe;
  171. __le32 failed;
  172. __le32 retry;
  173. __le32 multiretry;
  174. __le32 framedup;
  175. __le32 rtssuccess;
  176. __le32 rtsfailure;
  177. __le32 ackfailure;
  178. __le32 rxfrag;
  179. __le32 mcastrxframe;
  180. __le32 fcserror;
  181. __le32 txframe;
  182. __le32 wepundecryptable;
  183. };
  184. struct cmd_ds_mac_control {
  185. __le16 action;
  186. __le16 reserved;
  187. };
  188. struct cmd_ds_mac_multicast_adr {
  189. __le16 action;
  190. __le16 nr_of_adrs;
  191. u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
  192. };
  193. struct cmd_ds_802_11_authenticate {
  194. u8 macaddr[ETH_ALEN];
  195. u8 authtype;
  196. u8 reserved[10];
  197. };
  198. struct cmd_ds_802_11_deauthenticate {
  199. u8 macaddr[6];
  200. __le16 reasoncode;
  201. };
  202. struct cmd_ds_802_11_associate {
  203. u8 peerstaaddr[6];
  204. struct ieeetypes_capinfo capinfo;
  205. __le16 listeninterval;
  206. __le16 bcnperiod;
  207. u8 dtimperiod;
  208. #if 0
  209. mrvlietypes_ssidparamset_t ssidParamSet;
  210. mrvlietypes_phyparamset_t phyparamset;
  211. mrvlietypes_ssparamset_t ssparamset;
  212. mrvlietypes_ratesparamset_t ratesParamSet;
  213. #endif
  214. } __attribute__ ((packed));
  215. struct cmd_ds_802_11_disassociate {
  216. u8 destmacaddr[6];
  217. __le16 reasoncode;
  218. };
  219. struct cmd_ds_802_11_associate_rsp {
  220. struct ieeetypes_assocrsp assocRsp;
  221. };
  222. struct cmd_ds_802_11_ad_hoc_result {
  223. u8 PAD[3];
  224. u8 BSSID[ETH_ALEN];
  225. };
  226. struct cmd_ds_802_11_set_wep {
  227. /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
  228. __le16 action;
  229. /* key Index selected for Tx */
  230. __le16 keyindex;
  231. /* 40, 128bit or TXWEP */
  232. u8 keytype[4];
  233. u8 keymaterial[4][16];
  234. };
  235. struct cmd_ds_802_3_get_stat {
  236. __le32 xmitok;
  237. __le32 rcvok;
  238. __le32 xmiterror;
  239. __le32 rcverror;
  240. __le32 rcvnobuffer;
  241. __le32 rcvcrcerror;
  242. };
  243. struct cmd_ds_802_11_get_stat {
  244. __le32 txfragmentcnt;
  245. __le32 mcasttxframecnt;
  246. __le32 failedcnt;
  247. __le32 retrycnt;
  248. __le32 Multipleretrycnt;
  249. __le32 rtssuccesscnt;
  250. __le32 rtsfailurecnt;
  251. __le32 ackfailurecnt;
  252. __le32 frameduplicatecnt;
  253. __le32 rxfragmentcnt;
  254. __le32 mcastrxframecnt;
  255. __le32 fcserrorcnt;
  256. __le32 bcasttxframecnt;
  257. __le32 bcastrxframecnt;
  258. __le32 txbeacon;
  259. __le32 rxbeacon;
  260. __le32 wepundecryptable;
  261. };
  262. struct cmd_ds_802_11_snmp_mib {
  263. __le16 querytype;
  264. __le16 oid;
  265. __le16 bufsize;
  266. u8 value[128];
  267. };
  268. struct cmd_ds_mac_reg_map {
  269. __le16 buffersize;
  270. u8 regmap[128];
  271. __le16 reserved;
  272. };
  273. struct cmd_ds_bbp_reg_map {
  274. __le16 buffersize;
  275. u8 regmap[128];
  276. __le16 reserved;
  277. };
  278. struct cmd_ds_rf_reg_map {
  279. __le16 buffersize;
  280. u8 regmap[64];
  281. __le16 reserved;
  282. };
  283. struct cmd_ds_mac_reg_access {
  284. __le16 action;
  285. __le16 offset;
  286. __le32 value;
  287. };
  288. struct cmd_ds_bbp_reg_access {
  289. __le16 action;
  290. __le16 offset;
  291. u8 value;
  292. u8 reserved[3];
  293. };
  294. struct cmd_ds_rf_reg_access {
  295. __le16 action;
  296. __le16 offset;
  297. u8 value;
  298. u8 reserved[3];
  299. };
  300. struct cmd_ds_802_11_radio_control {
  301. __le16 action;
  302. __le16 control;
  303. };
  304. struct cmd_ds_802_11_sleep_params {
  305. /* ACT_GET/ACT_SET */
  306. __le16 action;
  307. /* Sleep clock error in ppm */
  308. __le16 error;
  309. /* Wakeup offset in usec */
  310. __le16 offset;
  311. /* Clock stabilization time in usec */
  312. __le16 stabletime;
  313. /* control periodic calibration */
  314. u8 calcontrol;
  315. /* control the use of external sleep clock */
  316. u8 externalsleepclk;
  317. /* reserved field, should be set to zero */
  318. __le16 reserved;
  319. };
  320. struct cmd_ds_802_11_inactivity_timeout {
  321. /* ACT_GET/ACT_SET */
  322. __le16 action;
  323. /* Inactivity timeout in msec */
  324. __le16 timeout;
  325. };
  326. struct cmd_ds_802_11_rf_channel {
  327. __le16 action;
  328. __le16 currentchannel;
  329. __le16 rftype;
  330. __le16 reserved;
  331. u8 channellist[32];
  332. };
  333. struct cmd_ds_802_11_rssi {
  334. /* weighting factor */
  335. __le16 N;
  336. __le16 reserved_0;
  337. __le16 reserved_1;
  338. __le16 reserved_2;
  339. };
  340. struct cmd_ds_802_11_rssi_rsp {
  341. __le16 SNR;
  342. __le16 noisefloor;
  343. __le16 avgSNR;
  344. __le16 avgnoisefloor;
  345. };
  346. struct cmd_ds_802_11_mac_address {
  347. __le16 action;
  348. u8 macadd[ETH_ALEN];
  349. };
  350. struct cmd_ds_802_11_rf_tx_power {
  351. __le16 action;
  352. __le16 currentlevel;
  353. };
  354. struct cmd_ds_802_11_rf_antenna {
  355. __le16 action;
  356. /* Number of antennas or 0xffff(diversity) */
  357. __le16 antennamode;
  358. };
  359. struct cmd_ds_802_11_ps_mode {
  360. __le16 action;
  361. __le16 nullpktinterval;
  362. __le16 multipledtim;
  363. __le16 reserved;
  364. __le16 locallisteninterval;
  365. };
  366. struct PS_CMD_ConfirmSleep {
  367. __le16 command;
  368. __le16 size;
  369. __le16 seqnum;
  370. __le16 result;
  371. __le16 action;
  372. __le16 reserved1;
  373. __le16 multipledtim;
  374. __le16 reserved;
  375. __le16 locallisteninterval;
  376. };
  377. struct cmd_ds_802_11_data_rate {
  378. __le16 action;
  379. __le16 reserverd;
  380. u8 datarate[G_SUPPORTED_RATES];
  381. };
  382. struct cmd_ds_802_11_rate_adapt_rateset {
  383. __le16 action;
  384. __le16 enablehwauto;
  385. __le16 bitmap;
  386. };
  387. struct cmd_ds_802_11_ad_hoc_start {
  388. u8 SSID[IW_ESSID_MAX_SIZE];
  389. u8 bsstype;
  390. __le16 beaconperiod;
  391. u8 dtimperiod;
  392. union IEEEtypes_ssparamset ssparamset;
  393. union ieeetypes_phyparamset phyparamset;
  394. __le16 probedelay;
  395. struct ieeetypes_capinfo cap;
  396. u8 datarate[G_SUPPORTED_RATES];
  397. u8 tlv_memory_size_pad[100];
  398. } __attribute__ ((packed));
  399. struct adhoc_bssdesc {
  400. u8 BSSID[6];
  401. u8 SSID[32];
  402. u8 bsstype;
  403. __le16 beaconperiod;
  404. u8 dtimperiod;
  405. __le64 timestamp;
  406. __le64 localtime;
  407. union ieeetypes_phyparamset phyparamset;
  408. union IEEEtypes_ssparamset ssparamset;
  409. struct ieeetypes_capinfo cap;
  410. u8 datarates[G_SUPPORTED_RATES];
  411. /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
  412. * Adhoc join command and will cause a binary layout mismatch with
  413. * the firmware
  414. */
  415. } __attribute__ ((packed));
  416. struct cmd_ds_802_11_ad_hoc_join {
  417. struct adhoc_bssdesc bssdescriptor;
  418. __le16 failtimeout;
  419. __le16 probedelay;
  420. } __attribute__ ((packed));
  421. struct cmd_ds_802_11_enable_rsn {
  422. __le16 action;
  423. __le16 enable;
  424. } __attribute__ ((packed));
  425. struct MrvlIEtype_keyParamSet {
  426. /* type ID */
  427. __le16 type;
  428. /* length of Payload */
  429. __le16 length;
  430. /* type of key: WEP=0, TKIP=1, AES=2 */
  431. __le16 keytypeid;
  432. /* key control Info specific to a keytypeid */
  433. __le16 keyinfo;
  434. /* length of key */
  435. __le16 keylen;
  436. /* key material of size keylen */
  437. u8 key[32];
  438. };
  439. struct cmd_ds_802_11_key_material {
  440. __le16 action;
  441. struct MrvlIEtype_keyParamSet keyParamSet[2];
  442. } __attribute__ ((packed));
  443. struct cmd_ds_802_11_eeprom_access {
  444. __le16 action;
  445. /* multiple 4 */
  446. __le16 offset;
  447. __le16 bytecount;
  448. u8 value;
  449. } __attribute__ ((packed));
  450. struct cmd_ds_802_11_tpc_cfg {
  451. __le16 action;
  452. u8 enable;
  453. s8 P0;
  454. s8 P1;
  455. s8 P2;
  456. u8 usesnr;
  457. } __attribute__ ((packed));
  458. struct cmd_ds_802_11_led_ctrl {
  459. __le16 action;
  460. __le16 numled;
  461. u8 data[256];
  462. } __attribute__ ((packed));
  463. struct cmd_ds_802_11_pwr_cfg {
  464. __le16 action;
  465. u8 enable;
  466. s8 PA_P0;
  467. s8 PA_P1;
  468. s8 PA_P2;
  469. } __attribute__ ((packed));
  470. struct cmd_ds_802_11_afc {
  471. __le16 afc_auto;
  472. union {
  473. struct {
  474. __le16 threshold;
  475. __le16 period;
  476. };
  477. struct {
  478. __le16 timing_offset; /* signed */
  479. __le16 carrier_offset; /* signed */
  480. };
  481. };
  482. } __attribute__ ((packed));
  483. struct cmd_tx_rate_query {
  484. __le16 txrate;
  485. } __attribute__ ((packed));
  486. struct cmd_ds_get_tsf {
  487. __le64 tsfvalue;
  488. } __attribute__ ((packed));
  489. struct cmd_ds_bt_access {
  490. __le16 action;
  491. __le32 id;
  492. u8 addr1[ETH_ALEN];
  493. u8 addr2[ETH_ALEN];
  494. } __attribute__ ((packed));
  495. struct cmd_ds_fwt_access {
  496. __le16 action;
  497. __le32 id;
  498. u8 valid;
  499. u8 da[ETH_ALEN];
  500. u8 dir;
  501. u8 ra[ETH_ALEN];
  502. __le32 ssn;
  503. __le32 dsn;
  504. __le32 metric;
  505. u8 rate;
  506. u8 hopcount;
  507. u8 ttl;
  508. __le32 expiration;
  509. u8 sleepmode;
  510. __le32 snr;
  511. __le32 references;
  512. u8 prec[ETH_ALEN];
  513. } __attribute__ ((packed));
  514. struct cmd_ds_mesh_access {
  515. __le16 action;
  516. __le32 data[32]; /* last position reserved */
  517. } __attribute__ ((packed));
  518. /* Number of stats counters returned by the firmware */
  519. #define MESH_STATS_NUM 8
  520. struct cmd_ds_command {
  521. /* command header */
  522. __le16 command;
  523. __le16 size;
  524. __le16 seqnum;
  525. __le16 result;
  526. /* command Body */
  527. union {
  528. struct cmd_ds_get_hw_spec hwspec;
  529. struct cmd_ds_802_11_ps_mode psmode;
  530. struct cmd_ds_802_11_scan scan;
  531. struct cmd_ds_802_11_scan_rsp scanresp;
  532. struct cmd_ds_mac_control macctrl;
  533. struct cmd_ds_802_11_associate associate;
  534. struct cmd_ds_802_11_deauthenticate deauth;
  535. struct cmd_ds_802_11_set_wep wep;
  536. struct cmd_ds_802_11_ad_hoc_start ads;
  537. struct cmd_ds_802_11_reset reset;
  538. struct cmd_ds_802_11_ad_hoc_result result;
  539. struct cmd_ds_802_11_get_log glog;
  540. struct cmd_ds_802_11_authenticate auth;
  541. struct cmd_ds_802_11_get_stat gstat;
  542. struct cmd_ds_802_3_get_stat gstat_8023;
  543. struct cmd_ds_802_11_snmp_mib smib;
  544. struct cmd_ds_802_11_rf_tx_power txp;
  545. struct cmd_ds_802_11_rf_antenna rant;
  546. struct cmd_ds_802_11_data_rate drate;
  547. struct cmd_ds_802_11_rate_adapt_rateset rateset;
  548. struct cmd_ds_mac_multicast_adr madr;
  549. struct cmd_ds_802_11_ad_hoc_join adj;
  550. struct cmd_ds_802_11_radio_control radio;
  551. struct cmd_ds_802_11_rf_channel rfchannel;
  552. struct cmd_ds_802_11_rssi rssi;
  553. struct cmd_ds_802_11_rssi_rsp rssirsp;
  554. struct cmd_ds_802_11_disassociate dassociate;
  555. struct cmd_ds_802_11_mac_address macadd;
  556. struct cmd_ds_802_11_enable_rsn enbrsn;
  557. struct cmd_ds_802_11_key_material keymaterial;
  558. struct cmd_ds_mac_reg_access macreg;
  559. struct cmd_ds_bbp_reg_access bbpreg;
  560. struct cmd_ds_rf_reg_access rfreg;
  561. struct cmd_ds_802_11_eeprom_access rdeeprom;
  562. struct cmd_ds_802_11d_domain_info domaininfo;
  563. struct cmd_ds_802_11d_domain_info domaininforesp;
  564. struct cmd_ds_802_11_sleep_params sleep_params;
  565. struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
  566. struct cmd_ds_802_11_tpc_cfg tpccfg;
  567. struct cmd_ds_802_11_pwr_cfg pwrcfg;
  568. struct cmd_ds_802_11_afc afc;
  569. struct cmd_ds_802_11_led_ctrl ledgpio;
  570. struct cmd_tx_rate_query txrate;
  571. struct cmd_ds_bt_access bt;
  572. struct cmd_ds_fwt_access fwt;
  573. struct cmd_ds_mesh_access mesh;
  574. struct cmd_ds_get_tsf gettsf;
  575. struct cmd_ds_802_11_subscribe_event subscribe_event;
  576. } params;
  577. } __attribute__ ((packed));
  578. #endif