hostcmd.h 13 KB

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