hostcmd.h 13 KB

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