hostcmd.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  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 0x01030304 = 2.3.4p1 */
  116. __le32 fwrelease;
  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_subscribe_event {
  127. struct cmd_header hdr;
  128. __le16 action;
  129. __le16 events;
  130. /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
  131. * number of TLVs. From the v5.1 manual, those TLVs would add up to
  132. * 40 bytes. However, future firmware might add additional TLVs, so I
  133. * bump this up a bit.
  134. */
  135. uint8_t tlv[128];
  136. };
  137. /*
  138. * This scan handle Country Information IE(802.11d compliant)
  139. * Define data structure for CMD_802_11_SCAN
  140. */
  141. struct cmd_ds_802_11_scan {
  142. struct cmd_header hdr;
  143. uint8_t bsstype;
  144. uint8_t bssid[ETH_ALEN];
  145. uint8_t tlvbuffer[0];
  146. #if 0
  147. mrvlietypes_ssidparamset_t ssidParamSet;
  148. mrvlietypes_chanlistparamset_t ChanListParamSet;
  149. mrvlietypes_ratesparamset_t OpRateSet;
  150. #endif
  151. };
  152. struct cmd_ds_802_11_scan_rsp {
  153. struct cmd_header hdr;
  154. __le16 bssdescriptsize;
  155. uint8_t nr_sets;
  156. uint8_t bssdesc_and_tlvbuffer[0];
  157. };
  158. struct cmd_ds_802_11_get_log {
  159. struct cmd_header hdr;
  160. __le32 mcasttxframe;
  161. __le32 failed;
  162. __le32 retry;
  163. __le32 multiretry;
  164. __le32 framedup;
  165. __le32 rtssuccess;
  166. __le32 rtsfailure;
  167. __le32 ackfailure;
  168. __le32 rxfrag;
  169. __le32 mcastrxframe;
  170. __le32 fcserror;
  171. __le32 txframe;
  172. __le32 wepundecryptable;
  173. };
  174. struct cmd_ds_mac_control {
  175. struct cmd_header hdr;
  176. __le16 action;
  177. u16 reserved;
  178. };
  179. struct cmd_ds_mac_multicast_adr {
  180. struct cmd_header hdr;
  181. __le16 action;
  182. __le16 nr_of_adrs;
  183. u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
  184. };
  185. struct cmd_ds_802_11_authenticate {
  186. u8 macaddr[ETH_ALEN];
  187. u8 authtype;
  188. u8 reserved[10];
  189. };
  190. struct cmd_ds_802_11_deauthenticate {
  191. struct cmd_header hdr;
  192. u8 macaddr[ETH_ALEN];
  193. __le16 reasoncode;
  194. };
  195. struct cmd_ds_802_11_associate {
  196. u8 peerstaaddr[6];
  197. __le16 capability;
  198. __le16 listeninterval;
  199. __le16 bcnperiod;
  200. u8 dtimperiod;
  201. #if 0
  202. mrvlietypes_ssidparamset_t ssidParamSet;
  203. mrvlietypes_phyparamset_t phyparamset;
  204. mrvlietypes_ssparamset_t ssparamset;
  205. mrvlietypes_ratesparamset_t ratesParamSet;
  206. #endif
  207. } __attribute__ ((packed));
  208. struct cmd_ds_802_11_associate_rsp {
  209. struct ieeetypes_assocrsp assocRsp;
  210. };
  211. struct cmd_ds_802_11_set_wep {
  212. struct cmd_header hdr;
  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. uint8_t keytype[4];
  219. uint8_t 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. struct cmd_header hdr;
  250. __le16 action;
  251. __le16 oid;
  252. __le16 bufsize;
  253. u8 value[128];
  254. };
  255. struct cmd_ds_mac_reg_map {
  256. __le16 buffersize;
  257. u8 regmap[128];
  258. __le16 reserved;
  259. };
  260. struct cmd_ds_bbp_reg_map {
  261. __le16 buffersize;
  262. u8 regmap[128];
  263. __le16 reserved;
  264. };
  265. struct cmd_ds_rf_reg_map {
  266. __le16 buffersize;
  267. u8 regmap[64];
  268. __le16 reserved;
  269. };
  270. struct cmd_ds_mac_reg_access {
  271. __le16 action;
  272. __le16 offset;
  273. __le32 value;
  274. };
  275. struct cmd_ds_bbp_reg_access {
  276. __le16 action;
  277. __le16 offset;
  278. u8 value;
  279. u8 reserved[3];
  280. };
  281. struct cmd_ds_rf_reg_access {
  282. __le16 action;
  283. __le16 offset;
  284. u8 value;
  285. u8 reserved[3];
  286. };
  287. struct cmd_ds_802_11_radio_control {
  288. struct cmd_header hdr;
  289. __le16 action;
  290. __le16 control;
  291. };
  292. struct cmd_ds_802_11_beacon_control {
  293. __le16 action;
  294. __le16 beacon_enable;
  295. __le16 beacon_period;
  296. };
  297. struct cmd_ds_802_11_sleep_params {
  298. struct cmd_header hdr;
  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. uint8_t calcontrol;
  309. /* control the use of external sleep clock */
  310. uint8_t externalsleepclk;
  311. /* reserved field, should be set to zero */
  312. __le16 reserved;
  313. };
  314. struct cmd_ds_802_11_inactivity_timeout {
  315. struct cmd_header hdr;
  316. /* ACT_GET/ACT_SET */
  317. __le16 action;
  318. /* Inactivity timeout in msec */
  319. __le16 timeout;
  320. };
  321. struct cmd_ds_802_11_rf_channel {
  322. struct cmd_header hdr;
  323. __le16 action;
  324. __le16 channel;
  325. __le16 rftype; /* unused */
  326. __le16 reserved; /* unused */
  327. u8 channellist[32]; /* unused */
  328. };
  329. struct cmd_ds_802_11_rssi {
  330. /* weighting factor */
  331. __le16 N;
  332. __le16 reserved_0;
  333. __le16 reserved_1;
  334. __le16 reserved_2;
  335. };
  336. struct cmd_ds_802_11_rssi_rsp {
  337. __le16 SNR;
  338. __le16 noisefloor;
  339. __le16 avgSNR;
  340. __le16 avgnoisefloor;
  341. };
  342. struct cmd_ds_802_11_mac_address {
  343. struct cmd_header hdr;
  344. __le16 action;
  345. u8 macadd[ETH_ALEN];
  346. };
  347. struct cmd_ds_802_11_rf_tx_power {
  348. struct cmd_header hdr;
  349. __le16 action;
  350. __le16 curlevel;
  351. s8 maxlevel;
  352. s8 minlevel;
  353. };
  354. struct cmd_ds_802_11_rf_antenna {
  355. __le16 action;
  356. /* Number of antennas or 0xffff(diversity) */
  357. __le16 antennamode;
  358. };
  359. struct cmd_ds_802_11_monitor_mode {
  360. __le16 action;
  361. __le16 mode;
  362. };
  363. struct cmd_ds_set_boot2_ver {
  364. struct cmd_header hdr;
  365. __le16 action;
  366. __le16 version;
  367. };
  368. struct cmd_ds_802_11_fw_wake_method {
  369. struct cmd_header hdr;
  370. __le16 action;
  371. __le16 method;
  372. };
  373. struct cmd_ds_802_11_sleep_period {
  374. struct cmd_header hdr;
  375. __le16 action;
  376. __le16 period;
  377. };
  378. struct cmd_ds_802_11_ps_mode {
  379. __le16 action;
  380. __le16 nullpktinterval;
  381. __le16 multipledtim;
  382. __le16 reserved;
  383. __le16 locallisteninterval;
  384. };
  385. struct cmd_confirm_sleep {
  386. struct cmd_header hdr;
  387. __le16 action;
  388. __le16 nullpktinterval;
  389. __le16 multipledtim;
  390. __le16 reserved;
  391. __le16 locallisteninterval;
  392. };
  393. struct cmd_ds_802_11_data_rate {
  394. struct cmd_header hdr;
  395. __le16 action;
  396. __le16 reserved;
  397. u8 rates[MAX_RATES];
  398. };
  399. struct cmd_ds_802_11_rate_adapt_rateset {
  400. struct cmd_header hdr;
  401. __le16 action;
  402. __le16 enablehwauto;
  403. __le16 bitmap;
  404. };
  405. struct cmd_ds_802_11_ad_hoc_start {
  406. struct cmd_header hdr;
  407. u8 ssid[IW_ESSID_MAX_SIZE];
  408. u8 bsstype;
  409. __le16 beaconperiod;
  410. u8 dtimperiod; /* Reserved on v9 and later */
  411. union IEEEtypes_ssparamset ssparamset;
  412. union ieeetypes_phyparamset phyparamset;
  413. __le16 probedelay;
  414. __le16 capability;
  415. u8 rates[MAX_RATES];
  416. u8 tlv_memory_size_pad[100];
  417. } __attribute__ ((packed));
  418. struct cmd_ds_802_11_ad_hoc_result {
  419. struct cmd_header hdr;
  420. u8 pad[3];
  421. u8 bssid[ETH_ALEN];
  422. };
  423. struct adhoc_bssdesc {
  424. u8 bssid[ETH_ALEN];
  425. u8 ssid[IW_ESSID_MAX_SIZE];
  426. u8 type;
  427. __le16 beaconperiod;
  428. u8 dtimperiod;
  429. __le64 timestamp;
  430. __le64 localtime;
  431. union ieeetypes_phyparamset phyparamset;
  432. union IEEEtypes_ssparamset ssparamset;
  433. __le16 capability;
  434. u8 rates[MAX_RATES];
  435. /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
  436. * Adhoc join command and will cause a binary layout mismatch with
  437. * the firmware
  438. */
  439. } __attribute__ ((packed));
  440. struct cmd_ds_802_11_ad_hoc_join {
  441. struct cmd_header hdr;
  442. struct adhoc_bssdesc bss;
  443. __le16 failtimeout; /* Reserved on v9 and later */
  444. __le16 probedelay; /* Reserved on v9 and later */
  445. } __attribute__ ((packed));
  446. struct cmd_ds_802_11_ad_hoc_stop {
  447. struct cmd_header hdr;
  448. } __attribute__ ((packed));
  449. struct cmd_ds_802_11_enable_rsn {
  450. struct cmd_header hdr;
  451. __le16 action;
  452. __le16 enable;
  453. } __attribute__ ((packed));
  454. struct MrvlIEtype_keyParamSet {
  455. /* type ID */
  456. __le16 type;
  457. /* length of Payload */
  458. __le16 length;
  459. /* type of key: WEP=0, TKIP=1, AES=2 */
  460. __le16 keytypeid;
  461. /* key control Info specific to a keytypeid */
  462. __le16 keyinfo;
  463. /* length of key */
  464. __le16 keylen;
  465. /* key material of size keylen */
  466. u8 key[32];
  467. };
  468. #define MAX_WOL_RULES 16
  469. struct host_wol_rule {
  470. uint8_t rule_no;
  471. uint8_t rule_ops;
  472. __le16 sig_offset;
  473. __le16 sig_length;
  474. __le16 reserve;
  475. __be32 sig_mask;
  476. __be32 signature;
  477. };
  478. struct wol_config {
  479. uint8_t action;
  480. uint8_t pattern;
  481. uint8_t no_rules_in_cmd;
  482. uint8_t result;
  483. struct host_wol_rule rule[MAX_WOL_RULES];
  484. };
  485. struct cmd_ds_host_sleep {
  486. struct cmd_header hdr;
  487. __le32 criteria;
  488. uint8_t gpio;
  489. uint16_t gap;
  490. struct wol_config wol_conf;
  491. } __attribute__ ((packed));
  492. struct cmd_ds_802_11_key_material {
  493. struct cmd_header hdr;
  494. __le16 action;
  495. struct MrvlIEtype_keyParamSet keyParamSet[2];
  496. } __attribute__ ((packed));
  497. struct cmd_ds_802_11_eeprom_access {
  498. struct cmd_header hdr;
  499. __le16 action;
  500. __le16 offset;
  501. __le16 len;
  502. /* firmware says it returns a maximum of 20 bytes */
  503. #define LBS_EEPROM_READ_LEN 20
  504. u8 value[LBS_EEPROM_READ_LEN];
  505. } __attribute__ ((packed));
  506. struct cmd_ds_802_11_tpc_cfg {
  507. struct cmd_header hdr;
  508. __le16 action;
  509. uint8_t enable;
  510. int8_t P0;
  511. int8_t P1;
  512. int8_t P2;
  513. uint8_t usesnr;
  514. } __attribute__ ((packed));
  515. struct cmd_ds_802_11_pa_cfg {
  516. struct cmd_header hdr;
  517. __le16 action;
  518. uint8_t enable;
  519. int8_t P0;
  520. int8_t P1;
  521. int8_t P2;
  522. } __attribute__ ((packed));
  523. struct cmd_ds_802_11_led_ctrl {
  524. __le16 action;
  525. __le16 numled;
  526. u8 data[256];
  527. } __attribute__ ((packed));
  528. struct cmd_ds_802_11_afc {
  529. __le16 afc_auto;
  530. union {
  531. struct {
  532. __le16 threshold;
  533. __le16 period;
  534. };
  535. struct {
  536. __le16 timing_offset; /* signed */
  537. __le16 carrier_offset; /* signed */
  538. };
  539. };
  540. } __attribute__ ((packed));
  541. struct cmd_tx_rate_query {
  542. __le16 txrate;
  543. } __attribute__ ((packed));
  544. struct cmd_ds_get_tsf {
  545. __le64 tsfvalue;
  546. } __attribute__ ((packed));
  547. struct cmd_ds_bt_access {
  548. __le16 action;
  549. __le32 id;
  550. u8 addr1[ETH_ALEN];
  551. u8 addr2[ETH_ALEN];
  552. } __attribute__ ((packed));
  553. struct cmd_ds_fwt_access {
  554. __le16 action;
  555. __le32 id;
  556. u8 valid;
  557. u8 da[ETH_ALEN];
  558. u8 dir;
  559. u8 ra[ETH_ALEN];
  560. __le32 ssn;
  561. __le32 dsn;
  562. __le32 metric;
  563. u8 rate;
  564. u8 hopcount;
  565. u8 ttl;
  566. __le32 expiration;
  567. u8 sleepmode;
  568. __le32 snr;
  569. __le32 references;
  570. u8 prec[ETH_ALEN];
  571. } __attribute__ ((packed));
  572. struct cmd_ds_mesh_config {
  573. struct cmd_header hdr;
  574. __le16 action;
  575. __le16 channel;
  576. __le16 type;
  577. __le16 length;
  578. u8 data[128]; /* last position reserved */
  579. } __attribute__ ((packed));
  580. struct cmd_ds_mesh_access {
  581. struct cmd_header hdr;
  582. __le16 action;
  583. __le32 data[32]; /* last position reserved */
  584. } __attribute__ ((packed));
  585. /* Number of stats counters returned by the firmware */
  586. #define MESH_STATS_NUM 8
  587. struct cmd_ds_command {
  588. /* command header */
  589. __le16 command;
  590. __le16 size;
  591. __le16 seqnum;
  592. __le16 result;
  593. /* command Body */
  594. union {
  595. struct cmd_ds_802_11_ps_mode psmode;
  596. struct cmd_ds_802_11_associate associate;
  597. struct cmd_ds_802_11_authenticate auth;
  598. struct cmd_ds_802_11_get_stat gstat;
  599. struct cmd_ds_802_3_get_stat gstat_8023;
  600. struct cmd_ds_802_11_rf_antenna rant;
  601. struct cmd_ds_802_11_monitor_mode monitor;
  602. struct cmd_ds_802_11_rssi rssi;
  603. struct cmd_ds_802_11_rssi_rsp rssirsp;
  604. struct cmd_ds_mac_reg_access macreg;
  605. struct cmd_ds_bbp_reg_access bbpreg;
  606. struct cmd_ds_rf_reg_access rfreg;
  607. struct cmd_ds_802_11d_domain_info domaininfo;
  608. struct cmd_ds_802_11d_domain_info domaininforesp;
  609. struct cmd_ds_802_11_tpc_cfg tpccfg;
  610. struct cmd_ds_802_11_afc afc;
  611. struct cmd_ds_802_11_led_ctrl ledgpio;
  612. struct cmd_tx_rate_query txrate;
  613. struct cmd_ds_bt_access bt;
  614. struct cmd_ds_fwt_access fwt;
  615. struct cmd_ds_get_tsf gettsf;
  616. struct cmd_ds_802_11_beacon_control bcn_ctrl;
  617. } params;
  618. } __attribute__ ((packed));
  619. #endif