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