main.h 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670
  1. /*
  2. * Marvell Wireless LAN device driver: major data structures and prototypes
  3. *
  4. * Copyright (C) 2011-2014, Marvell International Ltd.
  5. *
  6. * This software file (the "File") is distributed by Marvell International
  7. * Ltd. under the terms of the GNU General Public License Version 2, June 1991
  8. * (the "License"). You may use, redistribute and/or modify this File in
  9. * accordance with the terms and conditions of the License, a copy of which
  10. * is available by writing to the Free Software Foundation, Inc.,
  11. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
  12. * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
  13. *
  14. * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
  16. * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
  17. * this warranty disclaimer.
  18. */
  19. #ifndef _MWIFIEX_MAIN_H_
  20. #define _MWIFIEX_MAIN_H_
  21. #include <linux/completion.h>
  22. #include <linux/kernel.h>
  23. #include <linux/module.h>
  24. #include <linux/sched.h>
  25. #include <linux/semaphore.h>
  26. #include <linux/ip.h>
  27. #include <linux/skbuff.h>
  28. #include <linux/if_arp.h>
  29. #include <linux/etherdevice.h>
  30. #include <net/sock.h>
  31. #include <net/lib80211.h>
  32. #include <linux/vmalloc.h>
  33. #include <linux/firmware.h>
  34. #include <linux/ctype.h>
  35. #include <linux/of.h>
  36. #include <linux/idr.h>
  37. #include <linux/inetdevice.h>
  38. #include <linux/devcoredump.h>
  39. #include <linux/err.h>
  40. #include <linux/gpio.h>
  41. #include <linux/gfp.h>
  42. #include <linux/interrupt.h>
  43. #include <linux/io.h>
  44. #include <linux/of_gpio.h>
  45. #include <linux/of_platform.h>
  46. #include <linux/platform_device.h>
  47. #include <linux/pm_runtime.h>
  48. #include <linux/slab.h>
  49. #include <linux/of_irq.h>
  50. #include "decl.h"
  51. #include "ioctl.h"
  52. #include "util.h"
  53. #include "fw.h"
  54. #include "pcie.h"
  55. #include "usb.h"
  56. #include "sdio.h"
  57. extern const char driver_version[];
  58. extern bool mfg_mode;
  59. struct mwifiex_adapter;
  60. struct mwifiex_private;
  61. enum {
  62. MWIFIEX_ASYNC_CMD,
  63. MWIFIEX_SYNC_CMD
  64. };
  65. #define MWIFIEX_DRIVER_MODE_STA BIT(0)
  66. #define MWIFIEX_DRIVER_MODE_UAP BIT(1)
  67. #define MWIFIEX_DRIVER_MODE_P2P BIT(2)
  68. #define MWIFIEX_DRIVER_MODE_BITMASK (BIT(0) | BIT(1) | BIT(2))
  69. #define MWIFIEX_MAX_AP 64
  70. #define MWIFIEX_MAX_PKTS_TXQ 16
  71. #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
  72. #define MWIFIEX_TIMER_10S 10000
  73. #define MWIFIEX_TIMER_1S 1000
  74. #define MAX_TX_PENDING 100
  75. #define LOW_TX_PENDING 80
  76. #define HIGH_RX_PENDING 50
  77. #define LOW_RX_PENDING 20
  78. #define MWIFIEX_UPLD_SIZE (2312)
  79. #define MAX_EVENT_SIZE 2048
  80. #define ARP_FILTER_MAX_BUF_SIZE 68
  81. #define MWIFIEX_KEY_BUFFER_SIZE 16
  82. #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
  83. #define MWIFIEX_MAX_REGION_CODE 9
  84. #define DEFAULT_BCN_AVG_FACTOR 8
  85. #define DEFAULT_DATA_AVG_FACTOR 8
  86. #define FIRST_VALID_CHANNEL 0xff
  87. #define DEFAULT_AD_HOC_CHANNEL 6
  88. #define DEFAULT_AD_HOC_CHANNEL_A 36
  89. #define DEFAULT_BCN_MISS_TIMEOUT 5
  90. #define MAX_SCAN_BEACON_BUFFER 8000
  91. #define SCAN_BEACON_ENTRY_PAD 6
  92. #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 110
  93. #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 40
  94. #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 40
  95. #define MWIFIEX_DEF_SCAN_CHAN_GAP_TIME 50
  96. #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
  97. #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
  98. #define RSN_GTK_OUI_OFFSET 2
  99. #define MWIFIEX_OUI_NOT_PRESENT 0
  100. #define MWIFIEX_OUI_PRESENT 1
  101. #define PKT_TYPE_MGMT 0xE5
  102. /*
  103. * Do not check for data_received for USB, as data_received
  104. * is handled in mwifiex_usb_recv for USB
  105. */
  106. #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
  107. adapter->event_received || \
  108. adapter->data_received)
  109. #define MWIFIEX_TYPE_CMD 1
  110. #define MWIFIEX_TYPE_DATA 0
  111. #define MWIFIEX_TYPE_AGGR_DATA 10
  112. #define MWIFIEX_TYPE_EVENT 3
  113. #define MAX_BITMAP_RATES_SIZE 18
  114. #define MAX_CHANNEL_BAND_BG 14
  115. #define MAX_CHANNEL_BAND_A 165
  116. #define MAX_FREQUENCY_BAND_BG 2484
  117. #define MWIFIEX_EVENT_HEADER_LEN 4
  118. #define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2
  119. #define MWIFIEX_TYPE_LEN 4
  120. #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE
  121. #define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE
  122. #define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE
  123. /* Threshold for tx_timeout_cnt before we trigger a card reset */
  124. #define TX_TIMEOUT_THRESHOLD 6
  125. #define MWIFIEX_DRV_INFO_SIZE_MAX 0x40000
  126. /* Address alignment */
  127. #define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))
  128. /**
  129. *enum mwifiex_debug_level - marvell wifi debug level
  130. */
  131. enum MWIFIEX_DEBUG_LEVEL {
  132. MWIFIEX_DBG_MSG = 0x00000001,
  133. MWIFIEX_DBG_FATAL = 0x00000002,
  134. MWIFIEX_DBG_ERROR = 0x00000004,
  135. MWIFIEX_DBG_DATA = 0x00000008,
  136. MWIFIEX_DBG_CMD = 0x00000010,
  137. MWIFIEX_DBG_EVENT = 0x00000020,
  138. MWIFIEX_DBG_INTR = 0x00000040,
  139. MWIFIEX_DBG_IOCTL = 0x00000080,
  140. MWIFIEX_DBG_MPA_D = 0x00008000,
  141. MWIFIEX_DBG_DAT_D = 0x00010000,
  142. MWIFIEX_DBG_CMD_D = 0x00020000,
  143. MWIFIEX_DBG_EVT_D = 0x00040000,
  144. MWIFIEX_DBG_FW_D = 0x00080000,
  145. MWIFIEX_DBG_IF_D = 0x00100000,
  146. MWIFIEX_DBG_ENTRY = 0x10000000,
  147. MWIFIEX_DBG_WARN = 0x20000000,
  148. MWIFIEX_DBG_INFO = 0x40000000,
  149. MWIFIEX_DBG_DUMP = 0x80000000,
  150. MWIFIEX_DBG_ANY = 0xffffffff
  151. };
  152. #define MWIFIEX_DEFAULT_DEBUG_MASK (MWIFIEX_DBG_MSG | \
  153. MWIFIEX_DBG_FATAL | \
  154. MWIFIEX_DBG_ERROR)
  155. __printf(3, 4)
  156. void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask,
  157. const char *fmt, ...);
  158. #define mwifiex_dbg(adapter, mask, fmt, ...) \
  159. _mwifiex_dbg(adapter, MWIFIEX_DBG_##mask, fmt, ##__VA_ARGS__)
  160. #define DEBUG_DUMP_DATA_MAX_LEN 128
  161. #define mwifiex_dbg_dump(adapter, dbg_mask, str, buf, len) \
  162. do { \
  163. if ((adapter)->debug_mask & MWIFIEX_DBG_##dbg_mask) \
  164. print_hex_dump(KERN_DEBUG, str, \
  165. DUMP_PREFIX_OFFSET, 16, 1, \
  166. buf, len, false); \
  167. } while (0)
  168. /** Min BGSCAN interval 15 second */
  169. #define MWIFIEX_BGSCAN_INTERVAL 15000
  170. /** default repeat count */
  171. #define MWIFIEX_BGSCAN_REPEAT_COUNT 6
  172. struct mwifiex_dbg {
  173. u32 num_cmd_host_to_card_failure;
  174. u32 num_cmd_sleep_cfm_host_to_card_failure;
  175. u32 num_tx_host_to_card_failure;
  176. u32 num_event_deauth;
  177. u32 num_event_disassoc;
  178. u32 num_event_link_lost;
  179. u32 num_cmd_deauth;
  180. u32 num_cmd_assoc_success;
  181. u32 num_cmd_assoc_failure;
  182. u32 num_tx_timeout;
  183. u16 timeout_cmd_id;
  184. u16 timeout_cmd_act;
  185. u16 last_cmd_id[DBG_CMD_NUM];
  186. u16 last_cmd_act[DBG_CMD_NUM];
  187. u16 last_cmd_index;
  188. u16 last_cmd_resp_id[DBG_CMD_NUM];
  189. u16 last_cmd_resp_index;
  190. u16 last_event[DBG_CMD_NUM];
  191. u16 last_event_index;
  192. u32 last_mp_wr_bitmap[MWIFIEX_DBG_SDIO_MP_NUM];
  193. u32 last_mp_wr_ports[MWIFIEX_DBG_SDIO_MP_NUM];
  194. u32 last_mp_wr_len[MWIFIEX_DBG_SDIO_MP_NUM];
  195. u32 last_mp_curr_wr_port[MWIFIEX_DBG_SDIO_MP_NUM];
  196. u8 last_sdio_mp_index;
  197. };
  198. enum MWIFIEX_HARDWARE_STATUS {
  199. MWIFIEX_HW_STATUS_READY,
  200. MWIFIEX_HW_STATUS_INITIALIZING,
  201. MWIFIEX_HW_STATUS_INIT_DONE,
  202. MWIFIEX_HW_STATUS_RESET,
  203. MWIFIEX_HW_STATUS_NOT_READY
  204. };
  205. enum MWIFIEX_802_11_POWER_MODE {
  206. MWIFIEX_802_11_POWER_MODE_CAM,
  207. MWIFIEX_802_11_POWER_MODE_PSP
  208. };
  209. struct mwifiex_tx_param {
  210. u32 next_pkt_len;
  211. };
  212. enum MWIFIEX_PS_STATE {
  213. PS_STATE_AWAKE,
  214. PS_STATE_PRE_SLEEP,
  215. PS_STATE_SLEEP_CFM,
  216. PS_STATE_SLEEP
  217. };
  218. enum mwifiex_iface_type {
  219. MWIFIEX_SDIO,
  220. MWIFIEX_PCIE,
  221. MWIFIEX_USB
  222. };
  223. struct mwifiex_add_ba_param {
  224. u32 tx_win_size;
  225. u32 rx_win_size;
  226. u32 timeout;
  227. u8 tx_amsdu;
  228. u8 rx_amsdu;
  229. };
  230. struct mwifiex_tx_aggr {
  231. u8 ampdu_user;
  232. u8 ampdu_ap;
  233. u8 amsdu;
  234. };
  235. enum mwifiex_ba_status {
  236. BA_SETUP_NONE = 0,
  237. BA_SETUP_INPROGRESS,
  238. BA_SETUP_COMPLETE
  239. };
  240. struct mwifiex_ra_list_tbl {
  241. struct list_head list;
  242. struct sk_buff_head skb_head;
  243. u8 ra[ETH_ALEN];
  244. u32 is_11n_enabled;
  245. u16 max_amsdu;
  246. u16 ba_pkt_count;
  247. u8 ba_packet_thr;
  248. enum mwifiex_ba_status ba_status;
  249. u8 amsdu_in_ampdu;
  250. u16 total_pkt_count;
  251. bool tdls_link;
  252. bool tx_paused;
  253. };
  254. struct mwifiex_tid_tbl {
  255. struct list_head ra_list;
  256. };
  257. #define WMM_HIGHEST_PRIORITY 7
  258. #define HIGH_PRIO_TID 7
  259. #define LOW_PRIO_TID 0
  260. #define NO_PKT_PRIO_TID -1
  261. #define MWIFIEX_WMM_DRV_DELAY_MAX 510
  262. struct mwifiex_wmm_desc {
  263. struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
  264. u32 packets_out[MAX_NUM_TID];
  265. u32 pkts_paused[MAX_NUM_TID];
  266. /* spin lock to protect ra_list */
  267. spinlock_t ra_list_spinlock;
  268. struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS];
  269. enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS];
  270. u32 drv_pkt_delay_max;
  271. u8 queue_priority[IEEE80211_NUM_ACS];
  272. u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */
  273. /* Number of transmit packets queued */
  274. atomic_t tx_pkts_queued;
  275. /* Tracks highest priority with a packet queued */
  276. atomic_t highest_queued_prio;
  277. };
  278. struct mwifiex_802_11_security {
  279. u8 wpa_enabled;
  280. u8 wpa2_enabled;
  281. u8 wapi_enabled;
  282. u8 wapi_key_on;
  283. u8 wep_enabled;
  284. u32 authentication_mode;
  285. u8 is_authtype_auto;
  286. u32 encryption_mode;
  287. };
  288. struct ieee_types_header {
  289. u8 element_id;
  290. u8 len;
  291. } __packed;
  292. struct ieee_types_vendor_specific {
  293. struct ieee_types_vendor_header vend_hdr;
  294. u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
  295. } __packed;
  296. struct ieee_types_generic {
  297. struct ieee_types_header ieee_hdr;
  298. u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
  299. } __packed;
  300. struct ieee_types_bss_co_2040 {
  301. struct ieee_types_header ieee_hdr;
  302. u8 bss_2040co;
  303. } __packed;
  304. struct ieee_types_extcap {
  305. struct ieee_types_header ieee_hdr;
  306. u8 ext_capab[8];
  307. } __packed;
  308. struct ieee_types_vht_cap {
  309. struct ieee_types_header ieee_hdr;
  310. struct ieee80211_vht_cap vhtcap;
  311. } __packed;
  312. struct ieee_types_vht_oper {
  313. struct ieee_types_header ieee_hdr;
  314. struct ieee80211_vht_operation vhtoper;
  315. } __packed;
  316. struct ieee_types_aid {
  317. struct ieee_types_header ieee_hdr;
  318. u16 aid;
  319. } __packed;
  320. struct mwifiex_bssdescriptor {
  321. u8 mac_address[ETH_ALEN];
  322. struct cfg80211_ssid ssid;
  323. u32 privacy;
  324. s32 rssi;
  325. u32 channel;
  326. u32 freq;
  327. u16 beacon_period;
  328. u8 erp_flags;
  329. u32 bss_mode;
  330. u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
  331. u8 data_rates[MWIFIEX_SUPPORTED_RATES];
  332. /* Network band.
  333. * BAND_B(0x01): 'b' band
  334. * BAND_G(0x02): 'g' band
  335. * BAND_A(0X04): 'a' band
  336. */
  337. u16 bss_band;
  338. u64 fw_tsf;
  339. u64 timestamp;
  340. union ieee_types_phy_param_set phy_param_set;
  341. union ieee_types_ss_param_set ss_param_set;
  342. u16 cap_info_bitmap;
  343. struct ieee_types_wmm_parameter wmm_ie;
  344. u8 disable_11n;
  345. struct ieee80211_ht_cap *bcn_ht_cap;
  346. u16 ht_cap_offset;
  347. struct ieee80211_ht_operation *bcn_ht_oper;
  348. u16 ht_info_offset;
  349. u8 *bcn_bss_co_2040;
  350. u16 bss_co_2040_offset;
  351. u8 *bcn_ext_cap;
  352. u16 ext_cap_offset;
  353. struct ieee80211_vht_cap *bcn_vht_cap;
  354. u16 vht_cap_offset;
  355. struct ieee80211_vht_operation *bcn_vht_oper;
  356. u16 vht_info_offset;
  357. struct ieee_types_oper_mode_ntf *oper_mode;
  358. u16 oper_mode_offset;
  359. u8 disable_11ac;
  360. struct ieee_types_vendor_specific *bcn_wpa_ie;
  361. u16 wpa_offset;
  362. struct ieee_types_generic *bcn_rsn_ie;
  363. u16 rsn_offset;
  364. struct ieee_types_generic *bcn_wapi_ie;
  365. u16 wapi_offset;
  366. u8 *beacon_buf;
  367. u32 beacon_buf_size;
  368. u8 sensed_11h;
  369. u8 local_constraint;
  370. u8 chan_sw_ie_present;
  371. };
  372. struct mwifiex_current_bss_params {
  373. struct mwifiex_bssdescriptor bss_descriptor;
  374. u8 wmm_enabled;
  375. u8 wmm_uapsd_enabled;
  376. u8 band;
  377. u32 num_of_rates;
  378. u8 data_rates[MWIFIEX_SUPPORTED_RATES];
  379. };
  380. struct mwifiex_sleep_params {
  381. u16 sp_error;
  382. u16 sp_offset;
  383. u16 sp_stable_time;
  384. u8 sp_cal_control;
  385. u8 sp_ext_sleep_clk;
  386. u16 sp_reserved;
  387. };
  388. struct mwifiex_sleep_period {
  389. u16 period;
  390. u16 reserved;
  391. };
  392. struct mwifiex_wep_key {
  393. u32 length;
  394. u32 key_index;
  395. u32 key_length;
  396. u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
  397. };
  398. #define MAX_REGION_CHANNEL_NUM 2
  399. struct mwifiex_chan_freq_power {
  400. u16 channel;
  401. u32 freq;
  402. u16 max_tx_power;
  403. u8 unsupported;
  404. };
  405. enum state_11d_t {
  406. DISABLE_11D = 0,
  407. ENABLE_11D = 1,
  408. };
  409. #define MWIFIEX_MAX_TRIPLET_802_11D 83
  410. struct mwifiex_802_11d_domain_reg {
  411. u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
  412. u8 no_of_triplet;
  413. struct ieee80211_country_ie_triplet
  414. triplet[MWIFIEX_MAX_TRIPLET_802_11D];
  415. };
  416. struct mwifiex_vendor_spec_cfg_ie {
  417. u16 mask;
  418. u16 flag;
  419. u8 ie[MWIFIEX_MAX_VSIE_LEN];
  420. };
  421. struct wps {
  422. u8 session_enable;
  423. };
  424. struct mwifiex_roc_cfg {
  425. u64 cookie;
  426. struct ieee80211_channel chan;
  427. };
  428. enum mwifiex_iface_work_flags {
  429. MWIFIEX_IFACE_WORK_DEVICE_DUMP,
  430. MWIFIEX_IFACE_WORK_CARD_RESET,
  431. };
  432. struct mwifiex_private {
  433. struct mwifiex_adapter *adapter;
  434. u8 bss_type;
  435. u8 bss_role;
  436. u8 bss_priority;
  437. u8 bss_num;
  438. u8 bss_started;
  439. u8 frame_type;
  440. u8 curr_addr[ETH_ALEN];
  441. u8 media_connected;
  442. u8 port_open;
  443. u8 usb_port;
  444. u32 num_tx_timeout;
  445. /* track consecutive timeout */
  446. u8 tx_timeout_cnt;
  447. struct net_device *netdev;
  448. struct net_device_stats stats;
  449. u32 curr_pkt_filter;
  450. u32 bss_mode;
  451. u32 pkt_tx_ctrl;
  452. u16 tx_power_level;
  453. u8 max_tx_power_level;
  454. u8 min_tx_power_level;
  455. u32 tx_ant;
  456. u32 rx_ant;
  457. u8 tx_rate;
  458. u8 tx_htinfo;
  459. u8 rxpd_htinfo;
  460. u8 rxpd_rate;
  461. u16 rate_bitmap;
  462. u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
  463. u32 data_rate;
  464. u8 is_data_rate_auto;
  465. u16 bcn_avg_factor;
  466. u16 data_avg_factor;
  467. s16 data_rssi_last;
  468. s16 data_nf_last;
  469. s16 data_rssi_avg;
  470. s16 data_nf_avg;
  471. s16 bcn_rssi_last;
  472. s16 bcn_nf_last;
  473. s16 bcn_rssi_avg;
  474. s16 bcn_nf_avg;
  475. struct mwifiex_bssdescriptor *attempted_bss_desc;
  476. struct cfg80211_ssid prev_ssid;
  477. u8 prev_bssid[ETH_ALEN];
  478. struct mwifiex_current_bss_params curr_bss_params;
  479. u16 beacon_period;
  480. u8 dtim_period;
  481. u16 listen_interval;
  482. u16 atim_window;
  483. u8 adhoc_channel;
  484. u8 adhoc_is_link_sensed;
  485. u8 adhoc_state;
  486. struct mwifiex_802_11_security sec_info;
  487. struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
  488. u16 wep_key_curr_index;
  489. u8 wpa_ie[256];
  490. u16 wpa_ie_len;
  491. u8 wpa_is_gtk_set;
  492. struct host_cmd_ds_802_11_key_material aes_key;
  493. struct host_cmd_ds_802_11_key_material_v2 aes_key_v2;
  494. u8 wapi_ie[256];
  495. u16 wapi_ie_len;
  496. u8 *wps_ie;
  497. u16 wps_ie_len;
  498. u8 wmm_required;
  499. u8 wmm_enabled;
  500. u8 wmm_qosinfo;
  501. struct mwifiex_wmm_desc wmm;
  502. atomic_t wmm_tx_pending[IEEE80211_NUM_ACS];
  503. struct list_head sta_list;
  504. /* spin lock for associated station/TDLS peers list */
  505. spinlock_t sta_list_spinlock;
  506. struct list_head auto_tdls_list;
  507. /* spin lock for auto TDLS peer list */
  508. spinlock_t auto_tdls_lock;
  509. struct list_head tx_ba_stream_tbl_ptr;
  510. /* spin lock for tx_ba_stream_tbl_ptr queue */
  511. spinlock_t tx_ba_stream_tbl_lock;
  512. struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
  513. struct mwifiex_add_ba_param add_ba_param;
  514. u16 rx_seq[MAX_NUM_TID];
  515. u8 tos_to_tid_inv[MAX_NUM_TID];
  516. struct list_head rx_reorder_tbl_ptr;
  517. /* spin lock for rx_reorder_tbl_ptr queue */
  518. spinlock_t rx_reorder_tbl_lock;
  519. /* spin lock for Rx packets */
  520. spinlock_t rx_pkt_lock;
  521. #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
  522. u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
  523. u32 assoc_rsp_size;
  524. #define MWIFIEX_GENIE_BUF_SIZE 256
  525. u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
  526. u8 gen_ie_buf_len;
  527. struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
  528. #define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
  529. u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
  530. u8 assoc_tlv_buf_len;
  531. u8 *curr_bcn_buf;
  532. u32 curr_bcn_size;
  533. /* spin lock for beacon buffer */
  534. spinlock_t curr_bcn_buf_lock;
  535. struct wireless_dev wdev;
  536. struct mwifiex_chan_freq_power cfp;
  537. u32 versionstrsel;
  538. char version_str[128];
  539. #ifdef CONFIG_DEBUG_FS
  540. struct dentry *dfs_dev_dir;
  541. #endif
  542. u16 current_key_index;
  543. struct semaphore async_sem;
  544. struct cfg80211_scan_request *scan_request;
  545. u8 cfg_bssid[6];
  546. struct wps wps;
  547. u8 scan_block;
  548. s32 cqm_rssi_thold;
  549. u32 cqm_rssi_hyst;
  550. u8 subsc_evt_rssi_state;
  551. struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage;
  552. struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX];
  553. u16 beacon_idx;
  554. u16 proberesp_idx;
  555. u16 assocresp_idx;
  556. u16 gen_idx;
  557. u8 ap_11n_enabled;
  558. u8 ap_11ac_enabled;
  559. u32 mgmt_frame_mask;
  560. struct mwifiex_roc_cfg roc_cfg;
  561. bool scan_aborting;
  562. u8 sched_scanning;
  563. u8 csa_chan;
  564. unsigned long csa_expire_time;
  565. u8 del_list_idx;
  566. bool hs2_enabled;
  567. struct mwifiex_uap_bss_param bss_cfg;
  568. struct cfg80211_chan_def bss_chandef;
  569. struct station_parameters *sta_params;
  570. struct sk_buff_head tdls_txq;
  571. u8 check_tdls_tx;
  572. struct timer_list auto_tdls_timer;
  573. bool auto_tdls_timer_active;
  574. struct idr ack_status_frames;
  575. /* spin lock for ack status */
  576. spinlock_t ack_status_lock;
  577. /** rx histogram data */
  578. struct mwifiex_histogram_data *hist_data;
  579. struct cfg80211_chan_def dfs_chandef;
  580. struct workqueue_struct *dfs_cac_workqueue;
  581. struct delayed_work dfs_cac_work;
  582. struct timer_list dfs_chan_switch_timer;
  583. struct workqueue_struct *dfs_chan_sw_workqueue;
  584. struct delayed_work dfs_chan_sw_work;
  585. struct cfg80211_beacon_data beacon_after;
  586. struct mwifiex_11h_intf_state state_11h;
  587. struct mwifiex_ds_mem_rw mem_rw;
  588. struct sk_buff_head bypass_txq;
  589. struct mwifiex_user_scan_chan hidden_chan[MWIFIEX_USER_SCAN_CHAN_MAX];
  590. u8 assoc_resp_ht_param;
  591. bool ht_param_present;
  592. u8 random_mac[ETH_ALEN];
  593. };
  594. struct mwifiex_tx_ba_stream_tbl {
  595. struct list_head list;
  596. int tid;
  597. u8 ra[ETH_ALEN];
  598. enum mwifiex_ba_status ba_status;
  599. u8 amsdu;
  600. };
  601. struct mwifiex_rx_reorder_tbl;
  602. struct reorder_tmr_cnxt {
  603. struct timer_list timer;
  604. struct mwifiex_rx_reorder_tbl *ptr;
  605. struct mwifiex_private *priv;
  606. u8 timer_is_set;
  607. };
  608. struct mwifiex_rx_reorder_tbl {
  609. struct list_head list;
  610. int tid;
  611. u8 ta[ETH_ALEN];
  612. int init_win;
  613. int start_win;
  614. int win_size;
  615. void **rx_reorder_ptr;
  616. struct reorder_tmr_cnxt timer_context;
  617. u8 amsdu;
  618. u8 flags;
  619. };
  620. struct mwifiex_bss_prio_node {
  621. struct list_head list;
  622. struct mwifiex_private *priv;
  623. };
  624. struct mwifiex_bss_prio_tbl {
  625. struct list_head bss_prio_head;
  626. /* spin lock for bss priority */
  627. spinlock_t bss_prio_lock;
  628. struct mwifiex_bss_prio_node *bss_prio_cur;
  629. };
  630. struct cmd_ctrl_node {
  631. struct list_head list;
  632. struct mwifiex_private *priv;
  633. u32 cmd_oid;
  634. u32 cmd_flag;
  635. struct sk_buff *cmd_skb;
  636. struct sk_buff *resp_skb;
  637. void *data_buf;
  638. u32 wait_q_enabled;
  639. struct sk_buff *skb;
  640. u8 *condition;
  641. u8 cmd_wait_q_woken;
  642. };
  643. struct mwifiex_bss_priv {
  644. u8 band;
  645. u64 fw_tsf;
  646. };
  647. struct mwifiex_tdls_capab {
  648. __le16 capab;
  649. u8 rates[32];
  650. u8 rates_len;
  651. u8 qos_info;
  652. u8 coex_2040;
  653. u16 aid;
  654. struct ieee80211_ht_cap ht_capb;
  655. struct ieee80211_ht_operation ht_oper;
  656. struct ieee_types_extcap extcap;
  657. struct ieee_types_generic rsn_ie;
  658. struct ieee80211_vht_cap vhtcap;
  659. struct ieee80211_vht_operation vhtoper;
  660. };
  661. struct mwifiex_station_stats {
  662. u64 last_rx;
  663. s8 rssi;
  664. u64 rx_bytes;
  665. u64 tx_bytes;
  666. u32 rx_packets;
  667. u32 tx_packets;
  668. u32 tx_failed;
  669. u8 last_tx_rate;
  670. u8 last_tx_htinfo;
  671. };
  672. /* This is AP/TDLS specific structure which stores information
  673. * about associated/peer STA
  674. */
  675. struct mwifiex_sta_node {
  676. struct list_head list;
  677. u8 mac_addr[ETH_ALEN];
  678. u8 is_wmm_enabled;
  679. u8 is_11n_enabled;
  680. u8 is_11ac_enabled;
  681. u8 ampdu_sta[MAX_NUM_TID];
  682. u16 rx_seq[MAX_NUM_TID];
  683. u16 max_amsdu;
  684. u8 tdls_status;
  685. struct mwifiex_tdls_capab tdls_cap;
  686. struct mwifiex_station_stats stats;
  687. u8 tx_pause;
  688. };
  689. struct mwifiex_auto_tdls_peer {
  690. struct list_head list;
  691. u8 mac_addr[ETH_ALEN];
  692. u8 tdls_status;
  693. int rssi;
  694. long rssi_jiffies;
  695. u8 failure_count;
  696. u8 do_discover;
  697. u8 do_setup;
  698. };
  699. struct mwifiex_if_ops {
  700. int (*init_if) (struct mwifiex_adapter *);
  701. void (*cleanup_if) (struct mwifiex_adapter *);
  702. int (*check_fw_status) (struct mwifiex_adapter *, u32);
  703. int (*check_winner_status)(struct mwifiex_adapter *);
  704. int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
  705. int (*register_dev) (struct mwifiex_adapter *);
  706. void (*unregister_dev) (struct mwifiex_adapter *);
  707. int (*enable_int) (struct mwifiex_adapter *);
  708. void (*disable_int) (struct mwifiex_adapter *);
  709. int (*process_int_status) (struct mwifiex_adapter *);
  710. int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
  711. struct mwifiex_tx_param *);
  712. int (*wakeup) (struct mwifiex_adapter *);
  713. int (*wakeup_complete) (struct mwifiex_adapter *);
  714. /* Interface specific functions */
  715. void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
  716. void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
  717. int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
  718. int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
  719. int (*init_fw_port) (struct mwifiex_adapter *);
  720. int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
  721. void (*card_reset) (struct mwifiex_adapter *);
  722. int (*reg_dump)(struct mwifiex_adapter *, char *);
  723. void (*device_dump)(struct mwifiex_adapter *);
  724. int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
  725. void (*iface_work)(struct work_struct *work);
  726. void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
  727. void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
  728. void (*multi_port_resync)(struct mwifiex_adapter *);
  729. bool (*is_port_ready)(struct mwifiex_private *);
  730. void (*down_dev)(struct mwifiex_adapter *);
  731. void (*up_dev)(struct mwifiex_adapter *);
  732. };
  733. struct mwifiex_adapter {
  734. u8 iface_type;
  735. unsigned int debug_mask;
  736. struct mwifiex_iface_comb iface_limit;
  737. struct mwifiex_iface_comb curr_iface_comb;
  738. struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
  739. u8 priv_num;
  740. const struct firmware *firmware;
  741. char fw_name[32];
  742. int winner;
  743. struct device *dev;
  744. struct wiphy *wiphy;
  745. u8 perm_addr[ETH_ALEN];
  746. bool surprise_removed;
  747. u32 fw_release_number;
  748. u16 init_wait_q_woken;
  749. wait_queue_head_t init_wait_q;
  750. void *card;
  751. struct mwifiex_if_ops if_ops;
  752. atomic_t bypass_tx_pending;
  753. atomic_t rx_pending;
  754. atomic_t tx_pending;
  755. atomic_t cmd_pending;
  756. atomic_t tx_hw_pending;
  757. struct workqueue_struct *workqueue;
  758. struct work_struct main_work;
  759. struct workqueue_struct *rx_workqueue;
  760. struct work_struct rx_work;
  761. struct workqueue_struct *dfs_workqueue;
  762. struct work_struct dfs_work;
  763. bool rx_work_enabled;
  764. bool rx_processing;
  765. bool delay_main_work;
  766. bool rx_locked;
  767. bool main_locked;
  768. struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
  769. /* spin lock for init/shutdown */
  770. spinlock_t mwifiex_lock;
  771. /* spin lock for main process */
  772. spinlock_t main_proc_lock;
  773. u32 mwifiex_processing;
  774. u8 more_task_flag;
  775. u16 tx_buf_size;
  776. u16 curr_tx_buf_size;
  777. /* sdio single port rx aggregation capability */
  778. bool host_disable_sdio_rx_aggr;
  779. bool sdio_rx_aggr_enable;
  780. u16 sdio_rx_block_size;
  781. u32 ioport;
  782. enum MWIFIEX_HARDWARE_STATUS hw_status;
  783. u16 number_of_antenna;
  784. u32 fw_cap_info;
  785. /* spin lock for interrupt handling */
  786. spinlock_t int_lock;
  787. u8 int_status;
  788. u32 event_cause;
  789. struct sk_buff *event_skb;
  790. u8 upld_buf[MWIFIEX_UPLD_SIZE];
  791. u8 data_sent;
  792. u8 cmd_sent;
  793. u8 cmd_resp_received;
  794. u8 event_received;
  795. u8 data_received;
  796. u16 seq_num;
  797. struct cmd_ctrl_node *cmd_pool;
  798. struct cmd_ctrl_node *curr_cmd;
  799. /* spin lock for command */
  800. spinlock_t mwifiex_cmd_lock;
  801. u8 is_cmd_timedout;
  802. u16 last_init_cmd;
  803. struct timer_list cmd_timer;
  804. struct list_head cmd_free_q;
  805. /* spin lock for cmd_free_q */
  806. spinlock_t cmd_free_q_lock;
  807. struct list_head cmd_pending_q;
  808. /* spin lock for cmd_pending_q */
  809. spinlock_t cmd_pending_q_lock;
  810. struct list_head scan_pending_q;
  811. /* spin lock for scan_pending_q */
  812. spinlock_t scan_pending_q_lock;
  813. /* spin lock for RX processing routine */
  814. spinlock_t rx_proc_lock;
  815. struct sk_buff_head tx_data_q;
  816. atomic_t tx_queued;
  817. u32 scan_processing;
  818. u16 region_code;
  819. struct mwifiex_802_11d_domain_reg domain_reg;
  820. u16 scan_probes;
  821. u32 scan_mode;
  822. u16 specific_scan_time;
  823. u16 active_scan_time;
  824. u16 passive_scan_time;
  825. u16 scan_chan_gap_time;
  826. u8 fw_bands;
  827. u8 adhoc_start_band;
  828. u8 config_bands;
  829. struct mwifiex_chan_scan_param_set *scan_channels;
  830. u8 tx_lock_flag;
  831. struct mwifiex_sleep_params sleep_params;
  832. struct mwifiex_sleep_period sleep_period;
  833. u16 ps_mode;
  834. u32 ps_state;
  835. u8 need_to_wakeup;
  836. u16 multiple_dtim;
  837. u16 local_listen_interval;
  838. u16 null_pkt_interval;
  839. struct sk_buff *sleep_cfm;
  840. u16 bcn_miss_time_out;
  841. u16 adhoc_awake_period;
  842. u8 is_deep_sleep;
  843. u8 delay_null_pkt;
  844. u16 delay_to_ps;
  845. u16 enhanced_ps_mode;
  846. u8 pm_wakeup_card_req;
  847. u16 gen_null_pkt;
  848. u16 pps_uapsd_mode;
  849. u32 pm_wakeup_fw_try;
  850. struct timer_list wakeup_timer;
  851. u8 is_hs_configured;
  852. struct mwifiex_hs_config_param hs_cfg;
  853. u8 hs_activated;
  854. u16 hs_activate_wait_q_woken;
  855. wait_queue_head_t hs_activate_wait_q;
  856. bool is_suspended;
  857. bool hs_enabling;
  858. u8 event_body[MAX_EVENT_SIZE];
  859. u32 hw_dot_11n_dev_cap;
  860. u8 hw_dev_mcs_support;
  861. u8 user_dev_mcs_support;
  862. u8 adhoc_11n_enabled;
  863. u8 sec_chan_offset;
  864. struct mwifiex_dbg dbg;
  865. u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
  866. u32 arp_filter_size;
  867. struct mwifiex_wait_queue cmd_wait_q;
  868. u8 scan_wait_q_woken;
  869. spinlock_t queue_lock; /* lock for tx queues */
  870. u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
  871. u16 max_mgmt_ie_index;
  872. const struct firmware *cal_data;
  873. struct device_node *dt_node;
  874. /* 11AC */
  875. u32 is_hw_11ac_capable;
  876. u32 hw_dot_11ac_dev_cap;
  877. u32 hw_dot_11ac_mcs_support;
  878. u32 usr_dot_11ac_dev_cap_bg;
  879. u32 usr_dot_11ac_dev_cap_a;
  880. u32 usr_dot_11ac_mcs_support;
  881. atomic_t pending_bridged_pkts;
  882. /* For synchronizing FW initialization with device lifecycle. */
  883. struct completion *fw_done;
  884. bool ext_scan;
  885. u8 fw_api_ver;
  886. u8 key_api_major_ver, key_api_minor_ver;
  887. struct memory_type_mapping *mem_type_mapping_tbl;
  888. u8 num_mem_types;
  889. bool scan_chan_gap_enabled;
  890. struct sk_buff_head rx_data_q;
  891. bool mfg_mode;
  892. struct mwifiex_chan_stats *chan_stats;
  893. u32 num_in_chan_stats;
  894. int survey_idx;
  895. bool auto_tdls;
  896. u8 coex_scan;
  897. u8 coex_min_scan_time;
  898. u8 coex_max_scan_time;
  899. u8 coex_win_size;
  900. u8 coex_tx_win_size;
  901. u8 coex_rx_win_size;
  902. bool drcs_enabled;
  903. u8 active_scan_triggered;
  904. bool usb_mc_status;
  905. bool usb_mc_setup;
  906. struct cfg80211_wowlan_nd_info *nd_info;
  907. struct ieee80211_regdomain *regd;
  908. /* Wake-on-WLAN (WoWLAN) */
  909. int irq_wakeup;
  910. bool wake_by_wifi;
  911. };
  912. void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
  913. int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
  914. void mwifiex_set_trans_start(struct net_device *dev);
  915. void mwifiex_stop_net_dev_queue(struct net_device *netdev,
  916. struct mwifiex_adapter *adapter);
  917. void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
  918. struct mwifiex_adapter *adapter);
  919. int mwifiex_init_priv(struct mwifiex_private *priv);
  920. void mwifiex_free_priv(struct mwifiex_private *priv);
  921. int mwifiex_init_fw(struct mwifiex_adapter *adapter);
  922. int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
  923. void mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
  924. int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
  925. int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);
  926. int mwifiex_uap_recv_packet(struct mwifiex_private *priv,
  927. struct sk_buff *skb);
  928. int mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
  929. struct sk_buff *skb);
  930. int mwifiex_process_event(struct mwifiex_adapter *adapter);
  931. int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
  932. struct cmd_ctrl_node *cmd_node);
  933. int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
  934. u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync);
  935. void mwifiex_cmd_timeout_func(unsigned long function_context);
  936. int mwifiex_get_debug_info(struct mwifiex_private *,
  937. struct mwifiex_debug_info *);
  938. int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
  939. int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
  940. void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
  941. void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
  942. void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
  943. void mwifiex_cancel_scan(struct mwifiex_adapter *adapter);
  944. void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
  945. struct cmd_ctrl_node *cmd_node);
  946. void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
  947. struct cmd_ctrl_node *cmd_node,
  948. u32 addtail);
  949. int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
  950. int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
  951. int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
  952. struct sk_buff *skb);
  953. int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
  954. struct mwifiex_tx_param *tx_param);
  955. int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
  956. int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
  957. struct sk_buff *skb, int aggr, int status);
  958. void mwifiex_clean_txrx(struct mwifiex_private *priv);
  959. u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
  960. void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
  961. void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
  962. u32);
  963. int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
  964. struct host_cmd_ds_command *cmd,
  965. u16 cmd_action, uint16_t ps_bitmap,
  966. struct mwifiex_ds_auto_ds *auto_ds);
  967. int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
  968. struct host_cmd_ds_command *resp,
  969. struct mwifiex_ds_pm_cfg *pm_cfg);
  970. void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
  971. void mwifiex_hs_activated_event(struct mwifiex_private *priv,
  972. u8 activated);
  973. int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
  974. int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
  975. int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
  976. struct host_cmd_ds_command *resp);
  977. int mwifiex_process_rx_packet(struct mwifiex_private *priv,
  978. struct sk_buff *skb);
  979. int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
  980. u16 cmd_action, u32 cmd_oid,
  981. void *data_buf, void *cmd_buf);
  982. int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
  983. u16 cmd_action, u32 cmd_oid,
  984. void *data_buf, void *cmd_buf);
  985. int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
  986. struct host_cmd_ds_command *resp);
  987. int mwifiex_process_sta_rx_packet(struct mwifiex_private *,
  988. struct sk_buff *skb);
  989. int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
  990. struct sk_buff *skb);
  991. int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
  992. struct sk_buff *skb);
  993. int mwifiex_process_sta_event(struct mwifiex_private *);
  994. int mwifiex_process_uap_event(struct mwifiex_private *);
  995. void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
  996. void mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv,
  997. const u8 *ra_addr);
  998. void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
  999. void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
  1000. int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta, bool init);
  1001. int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
  1002. struct mwifiex_scan_cmd_config *scan_cfg);
  1003. void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
  1004. struct cmd_ctrl_node *cmd_node);
  1005. int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
  1006. struct host_cmd_ds_command *resp);
  1007. s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2);
  1008. int mwifiex_associate(struct mwifiex_private *priv,
  1009. struct mwifiex_bssdescriptor *bss_desc);
  1010. int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
  1011. struct host_cmd_ds_command *cmd,
  1012. struct mwifiex_bssdescriptor *bss_desc);
  1013. int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
  1014. struct host_cmd_ds_command *resp);
  1015. void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason,
  1016. bool from_ap);
  1017. u8 mwifiex_band_to_radio_type(u8 band);
  1018. int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
  1019. void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter);
  1020. int mwifiex_adhoc_start(struct mwifiex_private *priv,
  1021. struct cfg80211_ssid *adhoc_ssid);
  1022. int mwifiex_adhoc_join(struct mwifiex_private *priv,
  1023. struct mwifiex_bssdescriptor *bss_desc);
  1024. int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
  1025. struct host_cmd_ds_command *cmd,
  1026. struct cfg80211_ssid *req_ssid);
  1027. int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
  1028. struct host_cmd_ds_command *cmd,
  1029. struct mwifiex_bssdescriptor *bss_desc);
  1030. int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
  1031. struct host_cmd_ds_command *resp);
  1032. int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
  1033. struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv,
  1034. u8 band, u16 channel, u32 freq);
  1035. u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
  1036. u8 index, u8 ht_info);
  1037. u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
  1038. u8 index, u8 ht_info);
  1039. u32 mwifiex_find_freq_from_band_chan(u8, u8);
  1040. int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
  1041. u8 **buffer);
  1042. u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
  1043. u8 *rates);
  1044. u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
  1045. u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
  1046. u8 *rates, u8 radio_type);
  1047. u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
  1048. extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
  1049. void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
  1050. void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
  1051. int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
  1052. struct host_cmd_ds_command *cmd);
  1053. int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
  1054. struct host_cmd_ds_command *resp);
  1055. int is_command_pending(struct mwifiex_adapter *adapter);
  1056. void mwifiex_init_priv_params(struct mwifiex_private *priv,
  1057. struct net_device *dev);
  1058. int mwifiex_set_secure_params(struct mwifiex_private *priv,
  1059. struct mwifiex_uap_bss_param *bss_config,
  1060. struct cfg80211_ap_settings *params);
  1061. void mwifiex_set_ht_params(struct mwifiex_private *priv,
  1062. struct mwifiex_uap_bss_param *bss_cfg,
  1063. struct cfg80211_ap_settings *params);
  1064. void mwifiex_set_vht_params(struct mwifiex_private *priv,
  1065. struct mwifiex_uap_bss_param *bss_cfg,
  1066. struct cfg80211_ap_settings *params);
  1067. void mwifiex_set_tpc_params(struct mwifiex_private *priv,
  1068. struct mwifiex_uap_bss_param *bss_cfg,
  1069. struct cfg80211_ap_settings *params);
  1070. void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
  1071. struct cfg80211_ap_settings *params);
  1072. void mwifiex_set_vht_width(struct mwifiex_private *priv,
  1073. enum nl80211_chan_width width,
  1074. bool ap_11ac_disable);
  1075. void
  1076. mwifiex_set_wmm_params(struct mwifiex_private *priv,
  1077. struct mwifiex_uap_bss_param *bss_cfg,
  1078. struct cfg80211_ap_settings *params);
  1079. void mwifiex_set_ba_params(struct mwifiex_private *priv);
  1080. void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *pmadapter);
  1081. void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
  1082. struct sk_buff *event_skb);
  1083. void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv);
  1084. int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
  1085. struct host_cmd_ds_command *cmd,
  1086. void *data_buf);
  1087. int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv,
  1088. struct host_cmd_ds_command *resp);
  1089. int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
  1090. void *buf);
  1091. int mwifiex_cmd_802_11_bg_scan_config(struct mwifiex_private *priv,
  1092. struct host_cmd_ds_command *cmd,
  1093. void *data_buf);
  1094. int mwifiex_stop_bg_scan(struct mwifiex_private *priv);
  1095. /*
  1096. * This function checks if the queuing is RA based or not.
  1097. */
  1098. static inline u8
  1099. mwifiex_queuing_ra_based(struct mwifiex_private *priv)
  1100. {
  1101. /*
  1102. * Currently we assume if we are in Infra, then DA=RA. This might not be
  1103. * true in the future
  1104. */
  1105. if ((priv->bss_mode == NL80211_IFTYPE_STATION) &&
  1106. (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
  1107. return false;
  1108. return true;
  1109. }
  1110. /*
  1111. * This function copies rates.
  1112. */
  1113. static inline u32
  1114. mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
  1115. {
  1116. int i;
  1117. for (i = 0; i < len && src[i]; i++, pos++) {
  1118. if (pos >= MWIFIEX_SUPPORTED_RATES)
  1119. break;
  1120. dest[pos] = src[i];
  1121. }
  1122. return pos;
  1123. }
  1124. /*
  1125. * This function returns the correct private structure pointer based
  1126. * upon the BSS type and BSS number.
  1127. */
  1128. static inline struct mwifiex_private *
  1129. mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
  1130. u8 bss_num, u8 bss_type)
  1131. {
  1132. int i;
  1133. for (i = 0; i < adapter->priv_num; i++) {
  1134. if (adapter->priv[i]) {
  1135. if ((adapter->priv[i]->bss_num == bss_num) &&
  1136. (adapter->priv[i]->bss_type == bss_type))
  1137. break;
  1138. }
  1139. }
  1140. return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
  1141. }
  1142. /*
  1143. * This function returns the first available private structure pointer
  1144. * based upon the BSS role.
  1145. */
  1146. static inline struct mwifiex_private *
  1147. mwifiex_get_priv(struct mwifiex_adapter *adapter,
  1148. enum mwifiex_bss_role bss_role)
  1149. {
  1150. int i;
  1151. for (i = 0; i < adapter->priv_num; i++) {
  1152. if (adapter->priv[i]) {
  1153. if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
  1154. GET_BSS_ROLE(adapter->priv[i]) == bss_role)
  1155. break;
  1156. }
  1157. }
  1158. return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
  1159. }
  1160. /*
  1161. * This function checks available bss_num when adding new interface or
  1162. * changing interface type.
  1163. */
  1164. static inline u8
  1165. mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type)
  1166. {
  1167. u8 i, j;
  1168. int index[MWIFIEX_MAX_BSS_NUM];
  1169. memset(index, 0, sizeof(index));
  1170. for (i = 0; i < adapter->priv_num; i++)
  1171. if (adapter->priv[i]) {
  1172. if (adapter->priv[i]->bss_type == bss_type &&
  1173. !(adapter->priv[i]->bss_mode ==
  1174. NL80211_IFTYPE_UNSPECIFIED)) {
  1175. index[adapter->priv[i]->bss_num] = 1;
  1176. }
  1177. }
  1178. for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++)
  1179. if (!index[j])
  1180. return j;
  1181. return -1;
  1182. }
  1183. /*
  1184. * This function returns the first available unused private structure pointer.
  1185. */
  1186. static inline struct mwifiex_private *
  1187. mwifiex_get_unused_priv_by_bss_type(struct mwifiex_adapter *adapter,
  1188. u8 bss_type)
  1189. {
  1190. u8 i;
  1191. for (i = 0; i < adapter->priv_num; i++)
  1192. if (adapter->priv[i]->bss_mode ==
  1193. NL80211_IFTYPE_UNSPECIFIED) {
  1194. adapter->priv[i]->bss_num =
  1195. mwifiex_get_unused_bss_num(adapter, bss_type);
  1196. break;
  1197. }
  1198. return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
  1199. }
  1200. /*
  1201. * This function returns the driver private structure of a network device.
  1202. */
  1203. static inline struct mwifiex_private *
  1204. mwifiex_netdev_get_priv(struct net_device *dev)
  1205. {
  1206. return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
  1207. }
  1208. /*
  1209. * This function checks if a skb holds a management frame.
  1210. */
  1211. static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb)
  1212. {
  1213. return (get_unaligned_le32(skb->data) == PKT_TYPE_MGMT);
  1214. }
  1215. /* This function retrieves channel closed for operation by Channel
  1216. * Switch Announcement.
  1217. */
  1218. static inline u8
  1219. mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv)
  1220. {
  1221. if (!priv->csa_chan)
  1222. return 0;
  1223. /* Clear csa channel, if DFS channel move time has passed */
  1224. if (time_after(jiffies, priv->csa_expire_time)) {
  1225. priv->csa_chan = 0;
  1226. priv->csa_expire_time = 0;
  1227. }
  1228. return priv->csa_chan;
  1229. }
  1230. static inline u8 mwifiex_is_any_intf_active(struct mwifiex_private *priv)
  1231. {
  1232. struct mwifiex_private *priv_num;
  1233. int i;
  1234. for (i = 0; i < priv->adapter->priv_num; i++) {
  1235. priv_num = priv->adapter->priv[i];
  1236. if (priv_num) {
  1237. if ((GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_UAP &&
  1238. priv_num->bss_started) ||
  1239. (GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_STA &&
  1240. priv_num->media_connected))
  1241. return 1;
  1242. }
  1243. }
  1244. return 0;
  1245. }
  1246. static inline u8 mwifiex_is_tdls_link_setup(u8 status)
  1247. {
  1248. switch (status) {
  1249. case TDLS_SETUP_COMPLETE:
  1250. case TDLS_CHAN_SWITCHING:
  1251. case TDLS_IN_BASE_CHAN:
  1252. case TDLS_IN_OFF_CHAN:
  1253. return true;
  1254. default:
  1255. break;
  1256. }
  1257. return false;
  1258. }
  1259. /* Disable platform specific wakeup interrupt */
  1260. static inline void mwifiex_disable_wake(struct mwifiex_adapter *adapter)
  1261. {
  1262. if (adapter->irq_wakeup >= 0) {
  1263. disable_irq_wake(adapter->irq_wakeup);
  1264. disable_irq(adapter->irq_wakeup);
  1265. if (adapter->wake_by_wifi)
  1266. /* Undo our disable, since interrupt handler already
  1267. * did this.
  1268. */
  1269. enable_irq(adapter->irq_wakeup);
  1270. }
  1271. }
  1272. /* Enable platform specific wakeup interrupt */
  1273. static inline void mwifiex_enable_wake(struct mwifiex_adapter *adapter)
  1274. {
  1275. /* Enable platform specific wakeup interrupt */
  1276. if (adapter->irq_wakeup >= 0) {
  1277. adapter->wake_by_wifi = false;
  1278. enable_irq(adapter->irq_wakeup);
  1279. enable_irq_wake(adapter->irq_wakeup);
  1280. }
  1281. }
  1282. int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
  1283. u32 func_init_shutdown);
  1284. int mwifiex_add_card(void *card, struct completion *fw_done,
  1285. struct mwifiex_if_ops *if_ops, u8 iface_type,
  1286. struct device *dev);
  1287. int mwifiex_remove_card(struct mwifiex_adapter *adapter);
  1288. void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
  1289. int maxlen);
  1290. int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
  1291. struct mwifiex_multicast_list *mcast_list);
  1292. int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
  1293. struct net_device *dev);
  1294. int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
  1295. struct cmd_ctrl_node *cmd_queued);
  1296. int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
  1297. struct cfg80211_ssid *req_ssid);
  1298. int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
  1299. int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
  1300. int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
  1301. int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
  1302. int mwifiex_request_scan(struct mwifiex_private *priv,
  1303. struct cfg80211_ssid *req_ssid);
  1304. int mwifiex_scan_networks(struct mwifiex_private *priv,
  1305. const struct mwifiex_user_scan_cfg *user_scan_in);
  1306. int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
  1307. int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
  1308. const u8 *key, int key_len, u8 key_index,
  1309. const u8 *mac_addr, int disable);
  1310. int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len);
  1311. int mwifiex_get_ver_ext(struct mwifiex_private *priv, u32 version_str_sel);
  1312. int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
  1313. struct ieee80211_channel *chan,
  1314. unsigned int duration);
  1315. int mwifiex_get_stats_info(struct mwifiex_private *priv,
  1316. struct mwifiex_ds_get_stats *log);
  1317. int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
  1318. u32 reg_offset, u32 reg_value);
  1319. int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
  1320. u32 reg_offset, u32 *value);
  1321. int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
  1322. u8 *value);
  1323. int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
  1324. int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
  1325. int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
  1326. int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
  1327. int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
  1328. int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
  1329. char *version, int max_len);
  1330. int mwifiex_set_tx_power(struct mwifiex_private *priv,
  1331. struct mwifiex_power_cfg *power_cfg);
  1332. int mwifiex_main_process(struct mwifiex_adapter *);
  1333. int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb);
  1334. int mwifiex_get_bss_info(struct mwifiex_private *,
  1335. struct mwifiex_bss_info *);
  1336. int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
  1337. struct cfg80211_bss *bss,
  1338. struct mwifiex_bssdescriptor *bss_desc);
  1339. int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
  1340. struct mwifiex_bssdescriptor *bss_entry);
  1341. int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
  1342. struct mwifiex_bssdescriptor *bss_desc);
  1343. u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type);
  1344. u8 mwifiex_sec_chan_offset_to_chan_type(u8 second_chan_offset);
  1345. struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
  1346. const char *name,
  1347. unsigned char name_assign_type,
  1348. enum nl80211_iftype type,
  1349. struct vif_params *params);
  1350. int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
  1351. void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
  1352. int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter);
  1353. int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
  1354. struct cfg80211_beacon_data *data);
  1355. int mwifiex_del_mgmt_ies(struct mwifiex_private *priv);
  1356. u8 *mwifiex_11d_code_2_region(u8 code);
  1357. void mwifiex_uap_set_channel(struct mwifiex_private *priv,
  1358. struct mwifiex_uap_bss_param *bss_cfg,
  1359. struct cfg80211_chan_def chandef);
  1360. int mwifiex_config_start_uap(struct mwifiex_private *priv,
  1361. struct mwifiex_uap_bss_param *bss_cfg);
  1362. void mwifiex_uap_del_sta_data(struct mwifiex_private *priv,
  1363. struct mwifiex_sta_node *node);
  1364. void mwifiex_init_11h_params(struct mwifiex_private *priv);
  1365. int mwifiex_is_11h_active(struct mwifiex_private *priv);
  1366. int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag);
  1367. void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
  1368. struct mwifiex_bssdescriptor *bss_desc);
  1369. int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv);
  1370. int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
  1371. struct device_node *node, const char *prefix);
  1372. void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);
  1373. extern const struct ethtool_ops mwifiex_ethtool_ops;
  1374. void mwifiex_del_all_sta_list(struct mwifiex_private *priv);
  1375. void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac);
  1376. void
  1377. mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies,
  1378. int ies_len, struct mwifiex_sta_node *node);
  1379. struct mwifiex_sta_node *
  1380. mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
  1381. struct mwifiex_sta_node *
  1382. mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
  1383. u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv);
  1384. u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv);
  1385. u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv);
  1386. int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
  1387. u8 action_code, u8 dialog_token,
  1388. u16 status_code, const u8 *extra_ies,
  1389. size_t extra_ies_len);
  1390. int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
  1391. u8 action_code, u8 dialog_token,
  1392. u16 status_code, const u8 *extra_ies,
  1393. size_t extra_ies_len);
  1394. void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
  1395. u8 *buf, int len);
  1396. int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action);
  1397. int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac);
  1398. int mwifiex_get_tdls_list(struct mwifiex_private *priv,
  1399. struct tdls_peer_info *buf);
  1400. void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv);
  1401. bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv);
  1402. u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band,
  1403. u32 pri_chan, u8 chan_bw);
  1404. int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter);
  1405. int mwifiex_tdls_check_tx(struct mwifiex_private *priv, struct sk_buff *skb);
  1406. void mwifiex_flush_auto_tdls_list(struct mwifiex_private *priv);
  1407. void mwifiex_auto_tdls_update_peer_status(struct mwifiex_private *priv,
  1408. const u8 *mac, u8 link_status);
  1409. void mwifiex_auto_tdls_update_peer_signal(struct mwifiex_private *priv,
  1410. u8 *mac, s8 snr, s8 nflr);
  1411. void mwifiex_check_auto_tdls(unsigned long context);
  1412. void mwifiex_add_auto_tdls_peer(struct mwifiex_private *priv, const u8 *mac);
  1413. void mwifiex_setup_auto_tdls_timer(struct mwifiex_private *priv);
  1414. void mwifiex_clean_auto_tdls(struct mwifiex_private *priv);
  1415. int mwifiex_config_tdls_enable(struct mwifiex_private *priv);
  1416. int mwifiex_config_tdls_disable(struct mwifiex_private *priv);
  1417. int mwifiex_config_tdls_cs_params(struct mwifiex_private *priv);
  1418. int mwifiex_stop_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac);
  1419. int mwifiex_start_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac,
  1420. u8 primary_chan, u8 second_chan_offset, u8 band);
  1421. int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv,
  1422. struct host_cmd_ds_command *cmd,
  1423. void *data_buf);
  1424. int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
  1425. struct sk_buff *skb);
  1426. void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
  1427. void *event_body);
  1428. struct sk_buff *
  1429. mwifiex_clone_skb_for_tx_status(struct mwifiex_private *priv,
  1430. struct sk_buff *skb, u8 flag, u64 *cookie);
  1431. void mwifiex_dfs_cac_work_queue(struct work_struct *work);
  1432. void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work);
  1433. void mwifiex_abort_cac(struct mwifiex_private *priv);
  1434. int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
  1435. struct cfg80211_chan_def *chandef);
  1436. int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
  1437. struct sk_buff *skb);
  1438. void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
  1439. s8 nflr);
  1440. void mwifiex_hist_data_reset(struct mwifiex_private *priv);
  1441. void mwifiex_hist_data_add(struct mwifiex_private *priv,
  1442. u8 rx_rate, s8 snr, s8 nflr);
  1443. u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
  1444. u8 rx_rate, u8 ht_info);
  1445. int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info);
  1446. void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void *drv_info,
  1447. int drv_info_size);
  1448. void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
  1449. void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
  1450. int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
  1451. int cmd_type,
  1452. struct mwifiex_ds_wakeup_reason *wakeup_reason);
  1453. int mwifiex_ret_wakeup_reason(struct mwifiex_private *priv,
  1454. struct host_cmd_ds_command *resp,
  1455. struct host_cmd_ds_wakeup_reason *wakeup_reason);
  1456. void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter);
  1457. void mwifiex_11n_delba(struct mwifiex_private *priv, int tid);
  1458. int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy);
  1459. void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
  1460. struct sk_buff *event);
  1461. void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
  1462. struct sk_buff *event_skb);
  1463. void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
  1464. #ifdef CONFIG_DEBUG_FS
  1465. void mwifiex_debugfs_init(void);
  1466. void mwifiex_debugfs_remove(void);
  1467. void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
  1468. void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
  1469. #endif
  1470. int mwifiex_reinit_sw(struct mwifiex_adapter *adapter);
  1471. int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter);
  1472. #endif /* !_MWIFIEX_MAIN_H_ */