hostcmd.h 13 KB

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