hostcmd.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /*
  2. * This file contains the function prototypes, data structure
  3. * and defines for all the host/station commands
  4. */
  5. #ifndef _LBS_HOSTCMD_H
  6. #define _LBS_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 defs.h */
  76. u16 type; /* KEY_TYPE_* from defs.h */
  77. u8 key[32];
  78. };
  79. /* lbs_offset_value */
  80. struct lbs_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. /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
  130. * number of TLVs. From the v5.1 manual, those TLVs would add up to
  131. * 40 bytes. However, future firmware might add additional TLVs, so I
  132. * bump this up a bit.
  133. */
  134. u8 tlv[128];
  135. };
  136. /*
  137. * This scan handle Country Information IE(802.11d compliant)
  138. * Define data structure for CMD_802_11_SCAN
  139. */
  140. struct cmd_ds_802_11_scan {
  141. u8 bsstype;
  142. u8 bssid[ETH_ALEN];
  143. u8 tlvbuffer[1];
  144. #if 0
  145. mrvlietypes_ssidparamset_t ssidParamSet;
  146. mrvlietypes_chanlistparamset_t ChanListParamSet;
  147. mrvlietypes_ratesparamset_t OpRateSet;
  148. #endif
  149. };
  150. struct cmd_ds_802_11_scan_rsp {
  151. __le16 bssdescriptsize;
  152. u8 nr_sets;
  153. u8 bssdesc_and_tlvbuffer[1];
  154. };
  155. struct cmd_ds_802_11_get_log {
  156. __le32 mcasttxframe;
  157. __le32 failed;
  158. __le32 retry;
  159. __le32 multiretry;
  160. __le32 framedup;
  161. __le32 rtssuccess;
  162. __le32 rtsfailure;
  163. __le32 ackfailure;
  164. __le32 rxfrag;
  165. __le32 mcastrxframe;
  166. __le32 fcserror;
  167. __le32 txframe;
  168. __le32 wepundecryptable;
  169. };
  170. struct cmd_ds_mac_control {
  171. __le16 action;
  172. __le16 reserved;
  173. };
  174. struct cmd_ds_mac_multicast_adr {
  175. __le16 action;
  176. __le16 nr_of_adrs;
  177. u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
  178. };
  179. struct cmd_ds_802_11_authenticate {
  180. u8 macaddr[ETH_ALEN];
  181. u8 authtype;
  182. u8 reserved[10];
  183. };
  184. struct cmd_ds_802_11_deauthenticate {
  185. u8 macaddr[6];
  186. __le16 reasoncode;
  187. };
  188. struct cmd_ds_802_11_associate {
  189. u8 peerstaaddr[6];
  190. __le16 capability;
  191. __le16 listeninterval;
  192. __le16 bcnperiod;
  193. u8 dtimperiod;
  194. #if 0
  195. mrvlietypes_ssidparamset_t ssidParamSet;
  196. mrvlietypes_phyparamset_t phyparamset;
  197. mrvlietypes_ssparamset_t ssparamset;
  198. mrvlietypes_ratesparamset_t ratesParamSet;
  199. #endif
  200. } __attribute__ ((packed));
  201. struct cmd_ds_802_11_disassociate {
  202. u8 destmacaddr[6];
  203. __le16 reasoncode;
  204. };
  205. struct cmd_ds_802_11_associate_rsp {
  206. struct ieeetypes_assocrsp assocRsp;
  207. };
  208. struct cmd_ds_802_11_ad_hoc_result {
  209. u8 pad[3];
  210. u8 bssid[ETH_ALEN];
  211. };
  212. struct cmd_ds_802_11_set_wep {
  213. /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
  214. __le16 action;
  215. /* key Index selected for Tx */
  216. __le16 keyindex;
  217. /* 40, 128bit or TXWEP */
  218. u8 keytype[4];
  219. u8 keymaterial[4][16];
  220. };
  221. struct cmd_ds_802_3_get_stat {
  222. __le32 xmitok;
  223. __le32 rcvok;
  224. __le32 xmiterror;
  225. __le32 rcverror;
  226. __le32 rcvnobuffer;
  227. __le32 rcvcrcerror;
  228. };
  229. struct cmd_ds_802_11_get_stat {
  230. __le32 txfragmentcnt;
  231. __le32 mcasttxframecnt;
  232. __le32 failedcnt;
  233. __le32 retrycnt;
  234. __le32 Multipleretrycnt;
  235. __le32 rtssuccesscnt;
  236. __le32 rtsfailurecnt;
  237. __le32 ackfailurecnt;
  238. __le32 frameduplicatecnt;
  239. __le32 rxfragmentcnt;
  240. __le32 mcastrxframecnt;
  241. __le32 fcserrorcnt;
  242. __le32 bcasttxframecnt;
  243. __le32 bcastrxframecnt;
  244. __le32 txbeacon;
  245. __le32 rxbeacon;
  246. __le32 wepundecryptable;
  247. };
  248. struct cmd_ds_802_11_snmp_mib {
  249. __le16 querytype;
  250. __le16 oid;
  251. __le16 bufsize;
  252. u8 value[128];
  253. };
  254. struct cmd_ds_mac_reg_map {
  255. __le16 buffersize;
  256. u8 regmap[128];
  257. __le16 reserved;
  258. };
  259. struct cmd_ds_bbp_reg_map {
  260. __le16 buffersize;
  261. u8 regmap[128];
  262. __le16 reserved;
  263. };
  264. struct cmd_ds_rf_reg_map {
  265. __le16 buffersize;
  266. u8 regmap[64];
  267. __le16 reserved;
  268. };
  269. struct cmd_ds_mac_reg_access {
  270. __le16 action;
  271. __le16 offset;
  272. __le32 value;
  273. };
  274. struct cmd_ds_bbp_reg_access {
  275. __le16 action;
  276. __le16 offset;
  277. u8 value;
  278. u8 reserved[3];
  279. };
  280. struct cmd_ds_rf_reg_access {
  281. __le16 action;
  282. __le16 offset;
  283. u8 value;
  284. u8 reserved[3];
  285. };
  286. struct cmd_ds_802_11_radio_control {
  287. __le16 action;
  288. __le16 control;
  289. };
  290. struct cmd_ds_802_11_beacon_control {
  291. __le16 action;
  292. __le16 beacon_enable;
  293. __le16 beacon_period;
  294. };
  295. struct cmd_ds_802_11_sleep_params {
  296. /* ACT_GET/ACT_SET */
  297. __le16 action;
  298. /* Sleep clock error in ppm */
  299. __le16 error;
  300. /* Wakeup offset in usec */
  301. __le16 offset;
  302. /* Clock stabilization time in usec */
  303. __le16 stabletime;
  304. /* control periodic calibration */
  305. u8 calcontrol;
  306. /* control the use of external sleep clock */
  307. u8 externalsleepclk;
  308. /* reserved field, should be set to zero */
  309. __le16 reserved;
  310. };
  311. struct cmd_ds_802_11_inactivity_timeout {
  312. /* ACT_GET/ACT_SET */
  313. __le16 action;
  314. /* Inactivity timeout in msec */
  315. __le16 timeout;
  316. };
  317. struct cmd_ds_802_11_rf_channel {
  318. __le16 action;
  319. __le16 currentchannel;
  320. __le16 rftype;
  321. __le16 reserved;
  322. u8 channellist[32];
  323. };
  324. struct cmd_ds_802_11_rssi {
  325. /* weighting factor */
  326. __le16 N;
  327. __le16 reserved_0;
  328. __le16 reserved_1;
  329. __le16 reserved_2;
  330. };
  331. struct cmd_ds_802_11_rssi_rsp {
  332. __le16 SNR;
  333. __le16 noisefloor;
  334. __le16 avgSNR;
  335. __le16 avgnoisefloor;
  336. };
  337. struct cmd_ds_802_11_mac_address {
  338. __le16 action;
  339. u8 macadd[ETH_ALEN];
  340. };
  341. struct cmd_ds_802_11_rf_tx_power {
  342. __le16 action;
  343. __le16 currentlevel;
  344. };
  345. struct cmd_ds_802_11_rf_antenna {
  346. __le16 action;
  347. /* Number of antennas or 0xffff(diversity) */
  348. __le16 antennamode;
  349. };
  350. struct cmd_ds_802_11_monitor_mode {
  351. u16 action;
  352. u16 mode;
  353. };
  354. struct cmd_ds_set_boot2_ver {
  355. u16 action;
  356. u16 version;
  357. };
  358. struct cmd_ds_802_11_ps_mode {
  359. __le16 action;
  360. __le16 nullpktinterval;
  361. __le16 multipledtim;
  362. __le16 reserved;
  363. __le16 locallisteninterval;
  364. };
  365. struct PS_CMD_ConfirmSleep {
  366. __le16 command;
  367. __le16 size;
  368. __le16 seqnum;
  369. __le16 result;
  370. __le16 action;
  371. __le16 reserved1;
  372. __le16 multipledtim;
  373. __le16 reserved;
  374. __le16 locallisteninterval;
  375. };
  376. struct cmd_ds_802_11_data_rate {
  377. __le16 action;
  378. __le16 reserved;
  379. u8 rates[MAX_RATES];
  380. };
  381. struct cmd_ds_802_11_rate_adapt_rateset {
  382. __le16 action;
  383. __le16 enablehwauto;
  384. __le16 bitmap;
  385. };
  386. struct cmd_ds_802_11_ad_hoc_start {
  387. u8 ssid[IW_ESSID_MAX_SIZE];
  388. u8 bsstype;
  389. __le16 beaconperiod;
  390. u8 dtimperiod;
  391. union IEEEtypes_ssparamset ssparamset;
  392. union ieeetypes_phyparamset phyparamset;
  393. __le16 probedelay;
  394. __le16 capability;
  395. u8 rates[MAX_RATES];
  396. u8 tlv_memory_size_pad[100];
  397. } __attribute__ ((packed));
  398. struct adhoc_bssdesc {
  399. u8 bssid[6];
  400. u8 ssid[32];
  401. u8 type;
  402. __le16 beaconperiod;
  403. u8 dtimperiod;
  404. __le64 timestamp;
  405. __le64 localtime;
  406. union ieeetypes_phyparamset phyparamset;
  407. union IEEEtypes_ssparamset ssparamset;
  408. __le16 capability;
  409. u8 rates[MAX_RATES];
  410. /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
  411. * Adhoc join command and will cause a binary layout mismatch with
  412. * the firmware
  413. */
  414. } __attribute__ ((packed));
  415. struct cmd_ds_802_11_ad_hoc_join {
  416. struct adhoc_bssdesc bss;
  417. __le16 failtimeout;
  418. __le16 probedelay;
  419. } __attribute__ ((packed));
  420. struct cmd_ds_802_11_enable_rsn {
  421. __le16 action;
  422. __le16 enable;
  423. } __attribute__ ((packed));
  424. struct MrvlIEtype_keyParamSet {
  425. /* type ID */
  426. __le16 type;
  427. /* length of Payload */
  428. __le16 length;
  429. /* type of key: WEP=0, TKIP=1, AES=2 */
  430. __le16 keytypeid;
  431. /* key control Info specific to a keytypeid */
  432. __le16 keyinfo;
  433. /* length of key */
  434. __le16 keylen;
  435. /* key material of size keylen */
  436. u8 key[32];
  437. };
  438. struct cmd_ds_802_11_key_material {
  439. __le16 action;
  440. struct MrvlIEtype_keyParamSet keyParamSet[2];
  441. } __attribute__ ((packed));
  442. struct cmd_ds_802_11_eeprom_access {
  443. __le16 action;
  444. /* multiple 4 */
  445. __le16 offset;
  446. __le16 bytecount;
  447. u8 value;
  448. } __attribute__ ((packed));
  449. struct cmd_ds_802_11_tpc_cfg {
  450. __le16 action;
  451. u8 enable;
  452. s8 P0;
  453. s8 P1;
  454. s8 P2;
  455. u8 usesnr;
  456. } __attribute__ ((packed));
  457. struct cmd_ds_802_11_led_ctrl {
  458. __le16 action;
  459. __le16 numled;
  460. u8 data[256];
  461. } __attribute__ ((packed));
  462. struct cmd_ds_802_11_pwr_cfg {
  463. __le16 action;
  464. u8 enable;
  465. s8 PA_P0;
  466. s8 PA_P1;
  467. s8 PA_P2;
  468. } __attribute__ ((packed));
  469. struct cmd_ds_802_11_afc {
  470. __le16 afc_auto;
  471. union {
  472. struct {
  473. __le16 threshold;
  474. __le16 period;
  475. };
  476. struct {
  477. __le16 timing_offset; /* signed */
  478. __le16 carrier_offset; /* signed */
  479. };
  480. };
  481. } __attribute__ ((packed));
  482. struct cmd_tx_rate_query {
  483. __le16 txrate;
  484. } __attribute__ ((packed));
  485. struct cmd_ds_get_tsf {
  486. __le64 tsfvalue;
  487. } __attribute__ ((packed));
  488. struct cmd_ds_bt_access {
  489. __le16 action;
  490. __le32 id;
  491. u8 addr1[ETH_ALEN];
  492. u8 addr2[ETH_ALEN];
  493. } __attribute__ ((packed));
  494. struct cmd_ds_fwt_access {
  495. __le16 action;
  496. __le32 id;
  497. u8 valid;
  498. u8 da[ETH_ALEN];
  499. u8 dir;
  500. u8 ra[ETH_ALEN];
  501. __le32 ssn;
  502. __le32 dsn;
  503. __le32 metric;
  504. u8 rate;
  505. u8 hopcount;
  506. u8 ttl;
  507. __le32 expiration;
  508. u8 sleepmode;
  509. __le32 snr;
  510. __le32 references;
  511. u8 prec[ETH_ALEN];
  512. } __attribute__ ((packed));
  513. struct cmd_ds_mesh_access {
  514. __le16 action;
  515. __le32 data[32]; /* last position reserved */
  516. } __attribute__ ((packed));
  517. /* Number of stats counters returned by the firmware */
  518. #define MESH_STATS_NUM 8
  519. struct cmd_ds_command {
  520. /* command header */
  521. __le16 command;
  522. __le16 size;
  523. __le16 seqnum;
  524. __le16 result;
  525. /* command Body */
  526. union {
  527. struct cmd_ds_get_hw_spec hwspec;
  528. struct cmd_ds_802_11_ps_mode psmode;
  529. struct cmd_ds_802_11_scan scan;
  530. struct cmd_ds_802_11_scan_rsp scanresp;
  531. struct cmd_ds_mac_control macctrl;
  532. struct cmd_ds_802_11_associate associate;
  533. struct cmd_ds_802_11_deauthenticate deauth;
  534. struct cmd_ds_802_11_set_wep wep;
  535. struct cmd_ds_802_11_ad_hoc_start ads;
  536. struct cmd_ds_802_11_reset reset;
  537. struct cmd_ds_802_11_ad_hoc_result result;
  538. struct cmd_ds_802_11_get_log glog;
  539. struct cmd_ds_802_11_authenticate auth;
  540. struct cmd_ds_802_11_get_stat gstat;
  541. struct cmd_ds_802_3_get_stat gstat_8023;
  542. struct cmd_ds_802_11_snmp_mib smib;
  543. struct cmd_ds_802_11_rf_tx_power txp;
  544. struct cmd_ds_802_11_rf_antenna rant;
  545. struct cmd_ds_802_11_monitor_mode monitor;
  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_set_boot2_ver boot2_ver;
  575. struct cmd_ds_get_tsf gettsf;
  576. struct cmd_ds_802_11_subscribe_event subscribe_event;
  577. struct cmd_ds_802_11_beacon_control bcn_ctrl;
  578. } params;
  579. } __attribute__ ((packed));
  580. #endif