main.h 50 KB

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