core.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. * Copyright (c) 2010-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef CORE_H
  17. #define CORE_H
  18. #include <linux/etherdevice.h>
  19. #include <linux/rtnetlink.h>
  20. #include <linux/firmware.h>
  21. #include <linux/sched.h>
  22. #include <linux/circ_buf.h>
  23. #include <net/cfg80211.h>
  24. #include "htc.h"
  25. #include "wmi.h"
  26. #include "bmi.h"
  27. #include "target.h"
  28. #define MAX_ATH6KL 1
  29. #define ATH6KL_MAX_RX_BUFFERS 16
  30. #define ATH6KL_BUFFER_SIZE 1664
  31. #define ATH6KL_MAX_AMSDU_RX_BUFFERS 4
  32. #define ATH6KL_AMSDU_REFILL_THRESHOLD 3
  33. #define ATH6KL_AMSDU_BUFFER_SIZE (WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH + 128)
  34. #define MAX_MSDU_SUBFRAME_PAYLOAD_LEN 1508
  35. #define MIN_MSDU_SUBFRAME_PAYLOAD_LEN 46
  36. #define USER_SAVEDKEYS_STAT_INIT 0
  37. #define USER_SAVEDKEYS_STAT_RUN 1
  38. #define ATH6KL_TX_TIMEOUT 10
  39. #define ATH6KL_MAX_ENDPOINTS 4
  40. #define MAX_NODE_NUM 15
  41. /* Extra bytes for htc header alignment */
  42. #define ATH6KL_HTC_ALIGN_BYTES 3
  43. /* MAX_HI_COOKIE_NUM are reserved for high priority traffic */
  44. #define MAX_DEF_COOKIE_NUM 180
  45. #define MAX_HI_COOKIE_NUM 18 /* 10% of MAX_COOKIE_NUM */
  46. #define MAX_COOKIE_NUM (MAX_DEF_COOKIE_NUM + MAX_HI_COOKIE_NUM)
  47. #define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC)
  48. #define DISCON_TIMER_INTVAL 10000 /* in msec */
  49. #define A_DEFAULT_LISTEN_INTERVAL 100
  50. #define A_MAX_WOW_LISTEN_INTERVAL 1000
  51. /* includes also the null byte */
  52. #define ATH6KL_FIRMWARE_MAGIC "QCA-ATH6KL"
  53. enum ath6kl_fw_ie_type {
  54. ATH6KL_FW_IE_FW_VERSION = 0,
  55. ATH6KL_FW_IE_TIMESTAMP = 1,
  56. ATH6KL_FW_IE_OTP_IMAGE = 2,
  57. ATH6KL_FW_IE_FW_IMAGE = 3,
  58. ATH6KL_FW_IE_PATCH_IMAGE = 4,
  59. ATH6KL_FW_IE_RESERVED_RAM_SIZE = 5,
  60. ATH6KL_FW_IE_CAPABILITIES = 6,
  61. ATH6KL_FW_IE_PATCH_ADDR = 7,
  62. };
  63. enum ath6kl_fw_capability {
  64. ATH6KL_FW_CAPABILITY_HOST_P2P = 0,
  65. /* this needs to be last */
  66. ATH6KL_FW_CAPABILITY_MAX,
  67. };
  68. #define ATH6KL_CAPABILITY_LEN (ALIGN(ATH6KL_FW_CAPABILITY_MAX, 32) / 32)
  69. struct ath6kl_fw_ie {
  70. __le32 id;
  71. __le32 len;
  72. u8 data[0];
  73. };
  74. /* AR6003 1.0 definitions */
  75. #define AR6003_REV1_VERSION 0x300002ba
  76. /* AR6003 2.0 definitions */
  77. #define AR6003_REV2_VERSION 0x30000384
  78. #define AR6003_REV2_PATCH_DOWNLOAD_ADDRESS 0x57e910
  79. #define AR6003_REV2_OTP_FILE "ath6k/AR6003/hw2.0/otp.bin.z77"
  80. #define AR6003_REV2_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athwlan.bin.z77"
  81. #define AR6003_REV2_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athtcmd_ram.bin"
  82. #define AR6003_REV2_PATCH_FILE "ath6k/AR6003/hw2.0/data.patch.bin"
  83. #define AR6003_REV2_FIRMWARE_2_FILE "ath6k/AR6003/hw2.0/fw-2.bin"
  84. #define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.bin"
  85. #define AR6003_REV2_DEFAULT_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.SD31.bin"
  86. /* AR6003 3.0 definitions */
  87. #define AR6003_REV3_VERSION 0x30000582
  88. #define AR6003_REV3_OTP_FILE "ath6k/AR6003/hw2.1.1/otp.bin"
  89. #define AR6003_REV3_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan.bin"
  90. #define AR6003_REV3_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athtcmd_ram.bin"
  91. #define AR6003_REV3_PATCH_FILE "ath6k/AR6003/hw2.1.1/data.patch.bin"
  92. #define AR6003_REV3_FIRMWARE_2_FILE "ath6k/AR6003/hw2.1.1/fw-2.bin"
  93. #define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.bin"
  94. #define AR6003_REV3_DEFAULT_BOARD_DATA_FILE \
  95. "ath6k/AR6003/hw2.1.1/bdata.SD31.bin"
  96. /* AR6004 1.0 definitions */
  97. #define AR6004_REV1_VERSION 0x30000623
  98. #define AR6004_REV1_FIRMWARE_FILE "ath6k/AR6004/hw6.1/fw.ram.bin"
  99. #define AR6004_REV1_FIRMWARE_2_FILE "ath6k/AR6004/hw6.1/fw-2.bin"
  100. #define AR6004_REV1_BOARD_DATA_FILE "ath6k/AR6004/hw6.1/bdata.bin"
  101. #define AR6004_REV1_DEFAULT_BOARD_DATA_FILE "ath6k/AR6004/hw6.1/bdata.DB132.bin"
  102. #define AR6004_REV1_EPPING_FIRMWARE_FILE "ath6k/AR6004/hw6.1/endpointping.bin"
  103. /* Per STA data, used in AP mode */
  104. #define STA_PS_AWAKE BIT(0)
  105. #define STA_PS_SLEEP BIT(1)
  106. #define STA_PS_POLLED BIT(2)
  107. /* HTC TX packet tagging definitions */
  108. #define ATH6KL_CONTROL_PKT_TAG HTC_TX_PACKET_TAG_USER_DEFINED
  109. #define ATH6KL_DATA_PKT_TAG (ATH6KL_CONTROL_PKT_TAG + 1)
  110. #define AR6003_CUST_DATA_SIZE 16
  111. #define AGGR_WIN_IDX(x, y) ((x) % (y))
  112. #define AGGR_INCR_IDX(x, y) AGGR_WIN_IDX(((x) + 1), (y))
  113. #define AGGR_DCRM_IDX(x, y) AGGR_WIN_IDX(((x) - 1), (y))
  114. #define ATH6KL_MAX_SEQ_NO 0xFFF
  115. #define ATH6KL_NEXT_SEQ_NO(x) (((x) + 1) & ATH6KL_MAX_SEQ_NO)
  116. #define NUM_OF_TIDS 8
  117. #define AGGR_SZ_DEFAULT 8
  118. #define AGGR_WIN_SZ_MIN 2
  119. #define AGGR_WIN_SZ_MAX 8
  120. #define TID_WINDOW_SZ(_x) ((_x) << 1)
  121. #define AGGR_NUM_OF_FREE_NETBUFS 16
  122. #define AGGR_RX_TIMEOUT 400 /* in ms */
  123. #define WMI_TIMEOUT (2 * HZ)
  124. #define MBOX_YIELD_LIMIT 99
  125. /* configuration lags */
  126. /*
  127. * ATH6KL_CONF_IGNORE_ERP_BARKER: Ignore the barker premable in
  128. * ERP IE of beacon to determine the short premable support when
  129. * sending (Re)Assoc req.
  130. * ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN: Don't send the power
  131. * module state transition failure events which happen during
  132. * scan, to the host.
  133. */
  134. #define ATH6KL_CONF_IGNORE_ERP_BARKER BIT(0)
  135. #define ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN BIT(1)
  136. #define ATH6KL_CONF_ENABLE_11N BIT(2)
  137. #define ATH6KL_CONF_ENABLE_TX_BURST BIT(3)
  138. enum wlan_low_pwr_state {
  139. WLAN_POWER_STATE_ON,
  140. WLAN_POWER_STATE_CUT_PWR,
  141. WLAN_POWER_STATE_DEEP_SLEEP,
  142. WLAN_POWER_STATE_WOW
  143. };
  144. enum sme_state {
  145. SME_DISCONNECTED,
  146. SME_CONNECTING,
  147. SME_CONNECTED
  148. };
  149. struct skb_hold_q {
  150. struct sk_buff *skb;
  151. bool is_amsdu;
  152. u16 seq_no;
  153. };
  154. struct rxtid {
  155. bool aggr;
  156. bool progress;
  157. bool timer_mon;
  158. u16 win_sz;
  159. u16 seq_next;
  160. u32 hold_q_sz;
  161. struct skb_hold_q *hold_q;
  162. struct sk_buff_head q;
  163. spinlock_t lock;
  164. };
  165. struct rxtid_stats {
  166. u32 num_into_aggr;
  167. u32 num_dups;
  168. u32 num_oow;
  169. u32 num_mpdu;
  170. u32 num_amsdu;
  171. u32 num_delivered;
  172. u32 num_timeouts;
  173. u32 num_hole;
  174. u32 num_bar;
  175. };
  176. struct aggr_info {
  177. u8 aggr_sz;
  178. u8 timer_scheduled;
  179. struct timer_list timer;
  180. struct net_device *dev;
  181. struct rxtid rx_tid[NUM_OF_TIDS];
  182. struct sk_buff_head free_q;
  183. struct rxtid_stats stat[NUM_OF_TIDS];
  184. };
  185. struct ath6kl_wep_key {
  186. u8 key_index;
  187. u8 key_len;
  188. u8 key[64];
  189. };
  190. #define ATH6KL_KEY_SEQ_LEN 8
  191. struct ath6kl_key {
  192. u8 key[WLAN_MAX_KEY_LEN];
  193. u8 key_len;
  194. u8 seq[ATH6KL_KEY_SEQ_LEN];
  195. u8 seq_len;
  196. u32 cipher;
  197. };
  198. struct ath6kl_node_mapping {
  199. u8 mac_addr[ETH_ALEN];
  200. u8 ep_id;
  201. u8 tx_pend;
  202. };
  203. struct ath6kl_cookie {
  204. struct sk_buff *skb;
  205. u32 map_no;
  206. struct htc_packet htc_pkt;
  207. struct ath6kl_cookie *arc_list_next;
  208. };
  209. struct ath6kl_sta {
  210. u16 sta_flags;
  211. u8 mac[ETH_ALEN];
  212. u8 aid;
  213. u8 keymgmt;
  214. u8 ucipher;
  215. u8 auth;
  216. u8 wpa_ie[ATH6KL_MAX_IE];
  217. struct sk_buff_head psq;
  218. spinlock_t psq_lock;
  219. };
  220. struct ath6kl_version {
  221. u32 target_ver;
  222. u32 wlan_ver;
  223. u32 abi_ver;
  224. };
  225. struct ath6kl_bmi {
  226. u32 cmd_credits;
  227. bool done_sent;
  228. u8 *cmd_buf;
  229. };
  230. struct target_stats {
  231. u64 tx_pkt;
  232. u64 tx_byte;
  233. u64 tx_ucast_pkt;
  234. u64 tx_ucast_byte;
  235. u64 tx_mcast_pkt;
  236. u64 tx_mcast_byte;
  237. u64 tx_bcast_pkt;
  238. u64 tx_bcast_byte;
  239. u64 tx_rts_success_cnt;
  240. u64 tx_pkt_per_ac[4];
  241. u64 tx_err;
  242. u64 tx_fail_cnt;
  243. u64 tx_retry_cnt;
  244. u64 tx_mult_retry_cnt;
  245. u64 tx_rts_fail_cnt;
  246. u64 rx_pkt;
  247. u64 rx_byte;
  248. u64 rx_ucast_pkt;
  249. u64 rx_ucast_byte;
  250. u64 rx_mcast_pkt;
  251. u64 rx_mcast_byte;
  252. u64 rx_bcast_pkt;
  253. u64 rx_bcast_byte;
  254. u64 rx_frgment_pkt;
  255. u64 rx_err;
  256. u64 rx_crc_err;
  257. u64 rx_key_cache_miss;
  258. u64 rx_decrypt_err;
  259. u64 rx_dupl_frame;
  260. u64 tkip_local_mic_fail;
  261. u64 tkip_cnter_measures_invoked;
  262. u64 tkip_replays;
  263. u64 tkip_fmt_err;
  264. u64 ccmp_fmt_err;
  265. u64 ccmp_replays;
  266. u64 pwr_save_fail_cnt;
  267. u64 cs_bmiss_cnt;
  268. u64 cs_low_rssi_cnt;
  269. u64 cs_connect_cnt;
  270. u64 cs_discon_cnt;
  271. s32 tx_ucast_rate;
  272. s32 rx_ucast_rate;
  273. u32 lq_val;
  274. u32 wow_pkt_dropped;
  275. u16 wow_evt_discarded;
  276. s16 noise_floor_calib;
  277. s16 cs_rssi;
  278. s16 cs_ave_beacon_rssi;
  279. u8 cs_ave_beacon_snr;
  280. u8 cs_last_roam_msec;
  281. u8 cs_snr;
  282. u8 wow_host_pkt_wakeups;
  283. u8 wow_host_evt_wakeups;
  284. u32 arp_received;
  285. u32 arp_matched;
  286. u32 arp_replied;
  287. };
  288. struct ath6kl_mbox_info {
  289. u32 htc_addr;
  290. u32 htc_ext_addr;
  291. u32 htc_ext_sz;
  292. u32 block_size;
  293. u32 gmbox_addr;
  294. u32 gmbox_sz;
  295. };
  296. /*
  297. * 802.11i defines an extended IV for use with non-WEP ciphers.
  298. * When the EXTIV bit is set in the key id byte an additional
  299. * 4 bytes immediately follow the IV for TKIP. For CCMP the
  300. * EXTIV bit is likewise set but the 8 bytes represent the
  301. * CCMP header rather than IV+extended-IV.
  302. */
  303. #define ATH6KL_KEYBUF_SIZE 16
  304. #define ATH6KL_MICBUF_SIZE (8+8) /* space for both tx and rx */
  305. #define ATH6KL_KEY_XMIT 0x01
  306. #define ATH6KL_KEY_RECV 0x02
  307. #define ATH6KL_KEY_DEFAULT 0x80 /* default xmit key */
  308. /* Initial group key for AP mode */
  309. struct ath6kl_req_key {
  310. bool valid;
  311. u8 key_index;
  312. int key_type;
  313. u8 key[WLAN_MAX_KEY_LEN];
  314. u8 key_len;
  315. };
  316. /* Flag info */
  317. #define WMI_ENABLED 0
  318. #define WMI_READY 1
  319. #define CONNECTED 2
  320. #define STATS_UPDATE_PEND 3
  321. #define CONNECT_PEND 4
  322. #define WMM_ENABLED 5
  323. #define NETQ_STOPPED 6
  324. #define WMI_CTRL_EP_FULL 7
  325. #define DTIM_EXPIRED 8
  326. #define DESTROY_IN_PROGRESS 9
  327. #define NETDEV_REGISTERED 10
  328. #define SKIP_SCAN 11
  329. #define WLAN_ENABLED 12
  330. #define TESTMODE 13
  331. #define CLEAR_BSSFILTER_ON_BEACON 14
  332. #define DTIM_PERIOD_AVAIL 15
  333. #define ROAM_TBL_PEND 16
  334. struct ath6kl {
  335. struct device *dev;
  336. struct net_device *net_dev;
  337. struct wiphy *wiphy;
  338. struct ath6kl_bmi bmi;
  339. const struct ath6kl_hif_ops *hif_ops;
  340. struct wmi *wmi;
  341. int tx_pending[ENDPOINT_MAX];
  342. int total_tx_data_pend;
  343. struct htc_target *htc_target;
  344. void *hif_priv;
  345. spinlock_t lock;
  346. struct semaphore sem;
  347. int ssid_len;
  348. u8 ssid[IEEE80211_MAX_SSID_LEN];
  349. u8 next_mode;
  350. u8 nw_type;
  351. u8 dot11_auth_mode;
  352. u8 auth_mode;
  353. u8 prwise_crypto;
  354. u8 prwise_crypto_len;
  355. u8 grp_crypto;
  356. u8 grp_crypto_len;
  357. u8 def_txkey_index;
  358. struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
  359. u8 bssid[ETH_ALEN];
  360. u8 req_bssid[ETH_ALEN];
  361. u16 ch_hint;
  362. u16 bss_ch;
  363. u16 listen_intvl_b;
  364. u16 listen_intvl_t;
  365. u8 lrssi_roam_threshold;
  366. struct ath6kl_version version;
  367. u32 target_type;
  368. u8 tx_pwr;
  369. struct net_device_stats net_stats;
  370. struct target_stats target_stats;
  371. struct ath6kl_node_mapping node_map[MAX_NODE_NUM];
  372. u8 ibss_ps_enable;
  373. u8 node_num;
  374. u8 next_ep_id;
  375. struct ath6kl_cookie *cookie_list;
  376. u32 cookie_count;
  377. enum htc_endpoint_id ac2ep_map[WMM_NUM_AC];
  378. bool ac_stream_active[WMM_NUM_AC];
  379. u8 ac_stream_pri_map[WMM_NUM_AC];
  380. u8 hiac_stream_active_pri;
  381. u8 ep2ac_map[ENDPOINT_MAX];
  382. enum htc_endpoint_id ctrl_ep;
  383. struct htc_credit_state_info credit_state_info;
  384. u32 connect_ctrl_flags;
  385. u32 user_key_ctrl;
  386. u8 usr_bss_filter;
  387. struct ath6kl_sta sta_list[AP_MAX_NUM_STA];
  388. u8 sta_list_index;
  389. struct ath6kl_req_key ap_mode_bkey;
  390. struct sk_buff_head mcastpsq;
  391. spinlock_t mcastpsq_lock;
  392. u8 intra_bss;
  393. struct aggr_info *aggr_cntxt;
  394. struct wmi_ap_mode_stat ap_stats;
  395. u8 ap_country_code[3];
  396. struct list_head amsdu_rx_buffer_queue;
  397. struct timer_list disconnect_timer;
  398. u8 rx_meta_ver;
  399. struct wireless_dev *wdev;
  400. struct cfg80211_scan_request *scan_req;
  401. struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
  402. enum sme_state sme_state;
  403. enum wlan_low_pwr_state wlan_pwr_state;
  404. struct wmi_scan_params_cmd sc_params;
  405. #define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
  406. struct {
  407. void *rx_report;
  408. size_t rx_report_len;
  409. } tm;
  410. struct {
  411. u32 dataset_patch_addr;
  412. u32 app_load_addr;
  413. u32 app_start_override_addr;
  414. u32 board_ext_data_addr;
  415. u32 reserved_ram_size;
  416. } hw;
  417. u16 conf_flags;
  418. wait_queue_head_t event_wq;
  419. struct ath6kl_mbox_info mbox_info;
  420. struct ath6kl_cookie cookie_mem[MAX_COOKIE_NUM];
  421. int reconnect_flag;
  422. unsigned long flag;
  423. u8 *fw_board;
  424. size_t fw_board_len;
  425. u8 *fw_otp;
  426. size_t fw_otp_len;
  427. u8 *fw;
  428. size_t fw_len;
  429. u8 *fw_patch;
  430. size_t fw_patch_len;
  431. unsigned long fw_capabilities[ATH6KL_CAPABILITY_LEN];
  432. struct workqueue_struct *ath6kl_wq;
  433. struct dentry *debugfs_phy;
  434. u32 send_action_id;
  435. bool probe_req_report;
  436. u16 next_chan;
  437. bool p2p;
  438. u16 assoc_bss_beacon_int;
  439. u8 assoc_bss_dtim_period;
  440. #ifdef CONFIG_ATH6KL_DEBUG
  441. struct {
  442. struct circ_buf fwlog_buf;
  443. spinlock_t fwlog_lock;
  444. void *fwlog_tmp;
  445. u32 fwlog_mask;
  446. unsigned int dbgfs_diag_reg;
  447. u32 diag_reg_addr_wr;
  448. u32 diag_reg_val_wr;
  449. struct {
  450. unsigned int invalid_rate;
  451. } war_stats;
  452. u8 *roam_tbl;
  453. unsigned int roam_tbl_len;
  454. u8 keepalive;
  455. u8 disc_timeout;
  456. } debug;
  457. #endif /* CONFIG_ATH6KL_DEBUG */
  458. };
  459. static inline void *ath6kl_priv(struct net_device *dev)
  460. {
  461. return wdev_priv(dev->ieee80211_ptr);
  462. }
  463. static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info
  464. *cred_info,
  465. struct htc_endpoint_credit_dist
  466. *ep_dist, int credits)
  467. {
  468. ep_dist->credits += credits;
  469. ep_dist->cred_assngd += credits;
  470. cred_info->cur_free_credits -= credits;
  471. }
  472. static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
  473. u32 item_offset)
  474. {
  475. u32 addr = 0;
  476. if (ar->target_type == TARGET_TYPE_AR6003)
  477. addr = ATH6KL_AR6003_HI_START_ADDR + item_offset;
  478. else if (ar->target_type == TARGET_TYPE_AR6004)
  479. addr = ATH6KL_AR6004_HI_START_ADDR + item_offset;
  480. return addr;
  481. }
  482. void ath6kl_destroy(struct net_device *dev, unsigned int unregister);
  483. int ath6kl_configure_target(struct ath6kl *ar);
  484. void ath6kl_detect_error(unsigned long ptr);
  485. void disconnect_timer_handler(unsigned long ptr);
  486. void init_netdev(struct net_device *dev);
  487. void ath6kl_cookie_init(struct ath6kl *ar);
  488. void ath6kl_cookie_cleanup(struct ath6kl *ar);
  489. void ath6kl_rx(struct htc_target *target, struct htc_packet *packet);
  490. void ath6kl_tx_complete(void *context, struct list_head *packet_queue);
  491. enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
  492. struct htc_packet *packet);
  493. void ath6kl_stop_txrx(struct ath6kl *ar);
  494. void ath6kl_cleanup_amsdu_rxbufs(struct ath6kl *ar);
  495. int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value);
  496. int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length);
  497. int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value);
  498. int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length);
  499. int ath6kl_read_fwlogs(struct ath6kl *ar);
  500. void ath6kl_init_profile_info(struct ath6kl *ar);
  501. void ath6kl_tx_data_cleanup(struct ath6kl *ar);
  502. void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
  503. bool get_dbglogs);
  504. struct ath6kl_cookie *ath6kl_alloc_cookie(struct ath6kl *ar);
  505. void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie);
  506. int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev);
  507. struct aggr_info *aggr_init(struct net_device *dev);
  508. void ath6kl_rx_refill(struct htc_target *target,
  509. enum htc_endpoint_id endpoint);
  510. void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count);
  511. struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target,
  512. enum htc_endpoint_id endpoint,
  513. int len);
  514. void aggr_module_destroy(struct aggr_info *aggr_info);
  515. void aggr_reset_state(struct aggr_info *aggr_info);
  516. struct ath6kl_sta *ath6kl_find_sta(struct ath6kl *ar, u8 * node_addr);
  517. struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid);
  518. void ath6kl_ready_event(void *devt, u8 * datap, u32 sw_ver, u32 abi_ver);
  519. int ath6kl_control_tx(void *devt, struct sk_buff *skb,
  520. enum htc_endpoint_id eid);
  521. void ath6kl_connect_event(struct ath6kl *ar, u16 channel,
  522. u8 *bssid, u16 listen_int,
  523. u16 beacon_int, enum network_type net_type,
  524. u8 beacon_ie_len, u8 assoc_req_len,
  525. u8 assoc_resp_len, u8 *assoc_info);
  526. void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel);
  527. void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
  528. u8 keymgmt, u8 ucipher, u8 auth,
  529. u8 assoc_req_len, u8 *assoc_info);
  530. void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason,
  531. u8 *bssid, u8 assoc_resp_len,
  532. u8 *assoc_info, u16 prot_reason_status);
  533. void ath6kl_tkip_micerr_event(struct ath6kl *ar, u8 keyid, bool ismcast);
  534. void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr);
  535. void ath6kl_scan_complete_evt(struct ath6kl *ar, int status);
  536. void ath6kl_tgt_stats_event(struct ath6kl *ar, u8 *ptr, u32 len);
  537. void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active);
  538. enum htc_endpoint_id ath6kl_ac2_endpoint_id(void *devt, u8 ac);
  539. void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid);
  540. void ath6kl_dtimexpiry_event(struct ath6kl *ar);
  541. void ath6kl_disconnect(struct ath6kl *ar);
  542. void ath6kl_deep_sleep_enable(struct ath6kl *ar);
  543. void aggr_recv_delba_req_evt(struct ath6kl *ar, u8 tid);
  544. void aggr_recv_addba_req_evt(struct ath6kl *ar, u8 tid, u16 seq_no,
  545. u8 win_sz);
  546. void ath6kl_wakeup_event(void *dev);
  547. void ath6kl_target_failure(struct ath6kl *ar);
  548. void ath6kl_init_control_info(struct ath6kl *ar);
  549. void ath6kl_deinit_if_data(struct ath6kl *ar, struct net_device *ndev);
  550. void ath6kl_core_free(struct ath6kl *ar);
  551. #endif /* CORE_H */