hostcmd.h 14 KB

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