hostcmd.h 14 KB

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