Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / mwifiex / main.h
1 /*
2  * Marvell Wireless LAN device driver: major data structures and prototypes
3  *
4  * Copyright (C) 2011, 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
20 #ifndef _MWIFIEX_MAIN_H_
21 #define _MWIFIEX_MAIN_H_
22
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/sched.h>
26 #include <linux/semaphore.h>
27 #include <linux/ip.h>
28 #include <linux/skbuff.h>
29 #include <linux/if_arp.h>
30 #include <linux/etherdevice.h>
31 #include <net/sock.h>
32 #include <net/lib80211.h>
33 #include <linux/firmware.h>
34 #include <linux/ctype.h>
35
36 #include "decl.h"
37 #include "ioctl.h"
38 #include "util.h"
39 #include "fw.h"
40 #include "pcie.h"
41
42 extern const char driver_version[];
43
44 enum {
45         MWIFIEX_ASYNC_CMD,
46         MWIFIEX_SYNC_CMD
47 };
48
49 #define MWIFIEX_MAX_AP                          64
50
51 #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT        (5 * HZ)
52
53 #define MWIFIEX_TIMER_10S                       10000
54 #define MWIFIEX_TIMER_1S                        1000
55
56 #define MAX_TX_PENDING      100
57 #define LOW_TX_PENDING      80
58
59 #define MWIFIEX_UPLD_SIZE               (2312)
60
61 #define MAX_EVENT_SIZE                  1024
62
63 #define ARP_FILTER_MAX_BUF_SIZE         68
64
65 #define MWIFIEX_KEY_BUFFER_SIZE                 16
66 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
67 #define MWIFIEX_MAX_REGION_CODE         7
68
69 #define DEFAULT_BCN_AVG_FACTOR          8
70 #define DEFAULT_DATA_AVG_FACTOR         8
71
72 #define FIRST_VALID_CHANNEL                             0xff
73 #define DEFAULT_AD_HOC_CHANNEL                  6
74 #define DEFAULT_AD_HOC_CHANNEL_A                36
75
76 #define DEFAULT_BCN_MISS_TIMEOUT                5
77
78 #define MAX_SCAN_BEACON_BUFFER                  8000
79
80 #define SCAN_BEACON_ENTRY_PAD                   6
81
82 #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME  110
83 #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME   30
84 #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 30
85
86 #define SCAN_RSSI(RSSI)                                 (0x100 - ((u8)(RSSI)))
87
88 #define MWIFIEX_MAX_TOTAL_SCAN_TIME     (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
89
90 #define MWIFIEX_MAX_SCAN_DELAY_CNT                      50
91 #define MWIFIEX_MAX_EMPTY_TX_Q_CNT                      10
92 #define MWIFIEX_SCAN_DELAY_MSEC                         20
93
94 #define MWIFIEX_MIN_TX_PENDING_TO_CANCEL_SCAN           2
95
96 #define RSN_GTK_OUI_OFFSET                              2
97
98 #define MWIFIEX_OUI_NOT_PRESENT                 0
99 #define MWIFIEX_OUI_PRESENT                             1
100
101 #define PKT_TYPE_MGMT   0xE5
102
103 /*
104  * Do not check for data_received for USB, as data_received
105  * is handled in mwifiex_usb_recv for USB
106  */
107 #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
108                                 adapter->event_received || \
109                                 ((adapter->iface_type != MWIFIEX_USB) && \
110                                 adapter->data_received) || \
111                                 ((adapter->iface_type == MWIFIEX_USB) && \
112                                 !skb_queue_empty(&adapter->usb_rx_data_q)))
113
114 #define MWIFIEX_TYPE_CMD                                1
115 #define MWIFIEX_TYPE_DATA                               0
116 #define MWIFIEX_TYPE_EVENT                              3
117
118 #define MAX_BITMAP_RATES_SIZE                   10
119
120 #define MAX_CHANNEL_BAND_BG     14
121 #define MAX_CHANNEL_BAND_A      165
122
123 #define MAX_FREQUENCY_BAND_BG   2484
124
125 #define MWIFIEX_EVENT_HEADER_LEN           4
126 #define MWIFIEX_UAP_EVENT_EXTRA_HEADER     2
127
128 #define MWIFIEX_TYPE_LEN                        4
129 #define MWIFIEX_USB_TYPE_CMD                    0xF00DFACE
130 #define MWIFIEX_USB_TYPE_DATA                   0xBEADC0DE
131 #define MWIFIEX_USB_TYPE_EVENT                  0xBEEFFACE
132
133 /* Threshold for tx_timeout_cnt before we trigger a card reset */
134 #define TX_TIMEOUT_THRESHOLD    6
135
136 struct mwifiex_dbg {
137         u32 num_cmd_host_to_card_failure;
138         u32 num_cmd_sleep_cfm_host_to_card_failure;
139         u32 num_tx_host_to_card_failure;
140         u32 num_event_deauth;
141         u32 num_event_disassoc;
142         u32 num_event_link_lost;
143         u32 num_cmd_deauth;
144         u32 num_cmd_assoc_success;
145         u32 num_cmd_assoc_failure;
146         u32 num_tx_timeout;
147         u32 num_cmd_timeout;
148         u16 timeout_cmd_id;
149         u16 timeout_cmd_act;
150         u16 last_cmd_id[DBG_CMD_NUM];
151         u16 last_cmd_act[DBG_CMD_NUM];
152         u16 last_cmd_index;
153         u16 last_cmd_resp_id[DBG_CMD_NUM];
154         u16 last_cmd_resp_index;
155         u16 last_event[DBG_CMD_NUM];
156         u16 last_event_index;
157 };
158
159 enum MWIFIEX_HARDWARE_STATUS {
160         MWIFIEX_HW_STATUS_READY,
161         MWIFIEX_HW_STATUS_INITIALIZING,
162         MWIFIEX_HW_STATUS_FW_READY,
163         MWIFIEX_HW_STATUS_INIT_DONE,
164         MWIFIEX_HW_STATUS_RESET,
165         MWIFIEX_HW_STATUS_CLOSING,
166         MWIFIEX_HW_STATUS_NOT_READY
167 };
168
169 enum MWIFIEX_802_11_POWER_MODE {
170         MWIFIEX_802_11_POWER_MODE_CAM,
171         MWIFIEX_802_11_POWER_MODE_PSP
172 };
173
174 struct mwifiex_tx_param {
175         u32 next_pkt_len;
176 };
177
178 enum MWIFIEX_PS_STATE {
179         PS_STATE_AWAKE,
180         PS_STATE_PRE_SLEEP,
181         PS_STATE_SLEEP_CFM,
182         PS_STATE_SLEEP
183 };
184
185 enum mwifiex_iface_type {
186         MWIFIEX_SDIO,
187         MWIFIEX_PCIE,
188         MWIFIEX_USB
189 };
190
191 struct mwifiex_add_ba_param {
192         u32 tx_win_size;
193         u32 rx_win_size;
194         u32 timeout;
195 };
196
197 struct mwifiex_tx_aggr {
198         u8 ampdu_user;
199         u8 ampdu_ap;
200         u8 amsdu;
201 };
202
203 struct mwifiex_ra_list_tbl {
204         struct list_head list;
205         struct sk_buff_head skb_head;
206         u8 ra[ETH_ALEN];
207         u32 total_pkts_size;
208         u32 is_11n_enabled;
209         u16 max_amsdu;
210         u16 pkt_count;
211         u8 ba_packet_thr;
212 };
213
214 struct mwifiex_tid_tbl {
215         struct list_head ra_list;
216         /* spin lock for tid table */
217         spinlock_t tid_tbl_lock;
218         struct mwifiex_ra_list_tbl *ra_list_curr;
219 };
220
221 #define WMM_HIGHEST_PRIORITY            7
222 #define HIGH_PRIO_TID                           7
223 #define LOW_PRIO_TID                            0
224 #define NO_PKT_PRIO_TID                         (-1)
225
226 struct mwifiex_wmm_desc {
227         struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
228         u32 packets_out[MAX_NUM_TID];
229         /* spin lock to protect ra_list */
230         spinlock_t ra_list_spinlock;
231         struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS];
232         enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS];
233         u32 drv_pkt_delay_max;
234         u8 queue_priority[IEEE80211_NUM_ACS];
235         u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1];     /* UP: 0 to 7 */
236         /* Number of transmit packets queued */
237         atomic_t tx_pkts_queued;
238         /* Tracks highest priority with a packet queued */
239         atomic_t highest_queued_prio;
240 };
241
242 struct mwifiex_802_11_security {
243         u8 wpa_enabled;
244         u8 wpa2_enabled;
245         u8 wapi_enabled;
246         u8 wapi_key_on;
247         u8 wep_enabled;
248         u32 authentication_mode;
249         u8 is_authtype_auto;
250         u32 encryption_mode;
251 };
252
253 struct ieee_types_header {
254         u8 element_id;
255         u8 len;
256 } __packed;
257
258 struct ieee_types_vendor_specific {
259         struct ieee_types_vendor_header vend_hdr;
260         u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
261 } __packed;
262
263 struct ieee_types_generic {
264         struct ieee_types_header ieee_hdr;
265         u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
266 } __packed;
267
268 struct mwifiex_bssdescriptor {
269         u8 mac_address[ETH_ALEN];
270         struct cfg80211_ssid ssid;
271         u32 privacy;
272         s32 rssi;
273         u32 channel;
274         u32 freq;
275         u16 beacon_period;
276         u8 erp_flags;
277         u32 bss_mode;
278         u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
279         u8 data_rates[MWIFIEX_SUPPORTED_RATES];
280         /* Network band.
281          * BAND_B(0x01): 'b' band
282          * BAND_G(0x02): 'g' band
283          * BAND_A(0X04): 'a' band
284          */
285         u16 bss_band;
286         u64 fw_tsf;
287         u64 timestamp;
288         union ieee_types_phy_param_set phy_param_set;
289         union ieee_types_ss_param_set ss_param_set;
290         u16 cap_info_bitmap;
291         struct ieee_types_wmm_parameter wmm_ie;
292         u8  disable_11n;
293         struct ieee80211_ht_cap *bcn_ht_cap;
294         u16 ht_cap_offset;
295         struct ieee80211_ht_operation *bcn_ht_oper;
296         u16 ht_info_offset;
297         u8 *bcn_bss_co_2040;
298         u16 bss_co_2040_offset;
299         u8 *bcn_ext_cap;
300         u16 ext_cap_offset;
301         struct ieee80211_vht_cap *bcn_vht_cap;
302         u16 vht_cap_offset;
303         struct ieee80211_vht_operation *bcn_vht_oper;
304         u16 vht_info_offset;
305         struct ieee_types_oper_mode_ntf *oper_mode;
306         u16 oper_mode_offset;
307         u8 disable_11ac;
308         struct ieee_types_vendor_specific *bcn_wpa_ie;
309         u16 wpa_offset;
310         struct ieee_types_generic *bcn_rsn_ie;
311         u16 rsn_offset;
312         struct ieee_types_generic *bcn_wapi_ie;
313         u16 wapi_offset;
314         u8 *beacon_buf;
315         u32 beacon_buf_size;
316 };
317
318 struct mwifiex_current_bss_params {
319         struct mwifiex_bssdescriptor bss_descriptor;
320         u8 wmm_enabled;
321         u8 wmm_uapsd_enabled;
322         u8 band;
323         u32 num_of_rates;
324         u8 data_rates[MWIFIEX_SUPPORTED_RATES];
325 };
326
327 struct mwifiex_sleep_params {
328         u16 sp_error;
329         u16 sp_offset;
330         u16 sp_stable_time;
331         u8 sp_cal_control;
332         u8 sp_ext_sleep_clk;
333         u16 sp_reserved;
334 };
335
336 struct mwifiex_sleep_period {
337         u16 period;
338         u16 reserved;
339 };
340
341 struct mwifiex_wep_key {
342         u32 length;
343         u32 key_index;
344         u32 key_length;
345         u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
346 };
347
348 #define MAX_REGION_CHANNEL_NUM  2
349
350 struct mwifiex_chan_freq_power {
351         u16 channel;
352         u32 freq;
353         u16 max_tx_power;
354         u8 unsupported;
355 };
356
357 enum state_11d_t {
358         DISABLE_11D = 0,
359         ENABLE_11D = 1,
360 };
361
362 #define MWIFIEX_MAX_TRIPLET_802_11D             83
363
364 struct mwifiex_802_11d_domain_reg {
365         u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
366         u8 no_of_triplet;
367         struct ieee80211_country_ie_triplet
368                 triplet[MWIFIEX_MAX_TRIPLET_802_11D];
369 };
370
371 struct mwifiex_vendor_spec_cfg_ie {
372         u16 mask;
373         u16 flag;
374         u8 ie[MWIFIEX_MAX_VSIE_LEN];
375 };
376
377 struct wps {
378         u8 session_enable;
379 };
380
381 struct mwifiex_roc_cfg {
382         u64 cookie;
383         struct ieee80211_channel chan;
384 };
385
386 struct mwifiex_adapter;
387 struct mwifiex_private;
388
389 struct mwifiex_private {
390         struct mwifiex_adapter *adapter;
391         u8 bss_type;
392         u8 bss_role;
393         u8 bss_priority;
394         u8 bss_num;
395         u8 bss_started;
396         u8 frame_type;
397         u8 curr_addr[ETH_ALEN];
398         u8 media_connected;
399         u32 num_tx_timeout;
400         /* track consecutive timeout */
401         u8 tx_timeout_cnt;
402         struct net_device *netdev;
403         struct net_device_stats stats;
404         u16 curr_pkt_filter;
405         u32 bss_mode;
406         u32 pkt_tx_ctrl;
407         u16 tx_power_level;
408         u8 max_tx_power_level;
409         u8 min_tx_power_level;
410         u8 tx_rate;
411         u8 tx_htinfo;
412         u8 rxpd_htinfo;
413         u8 rxpd_rate;
414         u16 rate_bitmap;
415         u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
416         u32 data_rate;
417         u8 is_data_rate_auto;
418         u16 bcn_avg_factor;
419         u16 data_avg_factor;
420         s16 data_rssi_last;
421         s16 data_nf_last;
422         s16 data_rssi_avg;
423         s16 data_nf_avg;
424         s16 bcn_rssi_last;
425         s16 bcn_nf_last;
426         s16 bcn_rssi_avg;
427         s16 bcn_nf_avg;
428         struct mwifiex_bssdescriptor *attempted_bss_desc;
429         struct cfg80211_ssid prev_ssid;
430         u8 prev_bssid[ETH_ALEN];
431         struct mwifiex_current_bss_params curr_bss_params;
432         u16 beacon_period;
433         u8 dtim_period;
434         u16 listen_interval;
435         u16 atim_window;
436         u8 adhoc_channel;
437         u8 adhoc_is_link_sensed;
438         u8 adhoc_state;
439         struct mwifiex_802_11_security sec_info;
440         struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
441         u16 wep_key_curr_index;
442         u8 wpa_ie[256];
443         u8 wpa_ie_len;
444         u8 wpa_is_gtk_set;
445         struct host_cmd_ds_802_11_key_material aes_key;
446         u8 wapi_ie[256];
447         u8 wapi_ie_len;
448         u8 *wps_ie;
449         u8 wps_ie_len;
450         u8 wmm_required;
451         u8 wmm_enabled;
452         u8 wmm_qosinfo;
453         struct mwifiex_wmm_desc wmm;
454         atomic_t wmm_tx_pending[IEEE80211_NUM_ACS];
455         struct list_head sta_list;
456         /* spin lock for associated station list */
457         spinlock_t sta_list_spinlock;
458         struct list_head tx_ba_stream_tbl_ptr;
459         /* spin lock for tx_ba_stream_tbl_ptr queue */
460         spinlock_t tx_ba_stream_tbl_lock;
461         struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
462         struct mwifiex_add_ba_param add_ba_param;
463         u16 rx_seq[MAX_NUM_TID];
464         struct list_head rx_reorder_tbl_ptr;
465         /* spin lock for rx_reorder_tbl_ptr queue */
466         spinlock_t rx_reorder_tbl_lock;
467         /* spin lock for Rx packets */
468         spinlock_t rx_pkt_lock;
469
470 #define MWIFIEX_ASSOC_RSP_BUF_SIZE  500
471         u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
472         u32 assoc_rsp_size;
473
474 #define MWIFIEX_GENIE_BUF_SIZE      256
475         u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
476         u8 gen_ie_buf_len;
477
478         struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
479
480 #define MWIFIEX_ASSOC_TLV_BUF_SIZE  256
481         u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
482         u8 assoc_tlv_buf_len;
483
484         u8 *curr_bcn_buf;
485         u32 curr_bcn_size;
486         /* spin lock for beacon buffer */
487         spinlock_t curr_bcn_buf_lock;
488         struct wireless_dev *wdev;
489         struct mwifiex_chan_freq_power cfp;
490         char version_str[128];
491 #ifdef CONFIG_DEBUG_FS
492         struct dentry *dfs_dev_dir;
493 #endif
494         u8 nick_name[16];
495         u16 current_key_index;
496         struct semaphore async_sem;
497         u8 report_scan_result;
498         struct cfg80211_scan_request *scan_request;
499         struct mwifiex_user_scan_cfg *user_scan_cfg;
500         u8 cfg_bssid[6];
501         struct wps wps;
502         u8 scan_block;
503         s32 cqm_rssi_thold;
504         u32 cqm_rssi_hyst;
505         u8 subsc_evt_rssi_state;
506         struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage;
507         struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX];
508         u16 beacon_idx;
509         u16 proberesp_idx;
510         u16 assocresp_idx;
511         u16 rsn_idx;
512         struct timer_list scan_delay_timer;
513         u8 ap_11n_enabled;
514         u8 ap_11ac_enabled;
515         u32 mgmt_frame_mask;
516         struct mwifiex_roc_cfg roc_cfg;
517 };
518
519 enum mwifiex_ba_status {
520         BA_SETUP_NONE = 0,
521         BA_SETUP_INPROGRESS,
522         BA_SETUP_COMPLETE
523 };
524
525 struct mwifiex_tx_ba_stream_tbl {
526         struct list_head list;
527         int tid;
528         u8 ra[ETH_ALEN];
529         enum mwifiex_ba_status ba_status;
530 };
531
532 struct mwifiex_rx_reorder_tbl;
533
534 struct reorder_tmr_cnxt {
535         struct timer_list timer;
536         struct mwifiex_rx_reorder_tbl *ptr;
537         struct mwifiex_private *priv;
538 };
539
540 struct mwifiex_rx_reorder_tbl {
541         struct list_head list;
542         int tid;
543         u8 ta[ETH_ALEN];
544         int start_win;
545         int win_size;
546         void **rx_reorder_ptr;
547         struct reorder_tmr_cnxt timer_context;
548         u8 flags;
549 };
550
551 struct mwifiex_bss_prio_node {
552         struct list_head list;
553         struct mwifiex_private *priv;
554 };
555
556 struct mwifiex_bss_prio_tbl {
557         struct list_head bss_prio_head;
558         /* spin lock for bss priority  */
559         spinlock_t bss_prio_lock;
560         struct mwifiex_bss_prio_node *bss_prio_cur;
561 };
562
563 struct cmd_ctrl_node {
564         struct list_head list;
565         struct mwifiex_private *priv;
566         u32 cmd_oid;
567         u32 cmd_flag;
568         struct sk_buff *cmd_skb;
569         struct sk_buff *resp_skb;
570         void *data_buf;
571         u32 wait_q_enabled;
572         struct sk_buff *skb;
573         u8 *condition;
574         u8 cmd_wait_q_woken;
575 };
576
577 struct mwifiex_bss_priv {
578         u8 band;
579         u64 fw_tsf;
580 };
581
582 /* This is AP specific structure which stores information
583  * about associated STA
584  */
585 struct mwifiex_sta_node {
586         struct list_head list;
587         u8 mac_addr[ETH_ALEN];
588         u8 is_wmm_enabled;
589         u8 is_11n_enabled;
590         u8 ampdu_sta[MAX_NUM_TID];
591         u16 rx_seq[MAX_NUM_TID];
592         u16 max_amsdu;
593 };
594
595 struct mwifiex_if_ops {
596         int (*init_if) (struct mwifiex_adapter *);
597         void (*cleanup_if) (struct mwifiex_adapter *);
598         int (*check_fw_status) (struct mwifiex_adapter *, u32);
599         int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
600         int (*register_dev) (struct mwifiex_adapter *);
601         void (*unregister_dev) (struct mwifiex_adapter *);
602         int (*enable_int) (struct mwifiex_adapter *);
603         int (*process_int_status) (struct mwifiex_adapter *);
604         int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
605                              struct mwifiex_tx_param *);
606         int (*wakeup) (struct mwifiex_adapter *);
607         int (*wakeup_complete) (struct mwifiex_adapter *);
608
609         /* Interface specific functions */
610         void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
611         void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
612         int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
613         int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
614         int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
615         int (*init_fw_port) (struct mwifiex_adapter *);
616         int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
617         void (*card_reset) (struct mwifiex_adapter *);
618         int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
619 };
620
621 struct mwifiex_adapter {
622         u8 iface_type;
623         struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
624         u8 priv_num;
625         const struct firmware *firmware;
626         char fw_name[32];
627         int winner;
628         struct device *dev;
629         struct wiphy *wiphy;
630         bool surprise_removed;
631         u32 fw_release_number;
632         u16 init_wait_q_woken;
633         wait_queue_head_t init_wait_q;
634         void *card;
635         struct mwifiex_if_ops if_ops;
636         atomic_t rx_pending;
637         atomic_t tx_pending;
638         atomic_t cmd_pending;
639         struct workqueue_struct *workqueue;
640         struct work_struct main_work;
641         struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
642         /* spin lock for init/shutdown */
643         spinlock_t mwifiex_lock;
644         /* spin lock for main process */
645         spinlock_t main_proc_lock;
646         u32 mwifiex_processing;
647         u16 tx_buf_size;
648         u16 curr_tx_buf_size;
649         u32 ioport;
650         enum MWIFIEX_HARDWARE_STATUS hw_status;
651         u16 number_of_antenna;
652         u32 fw_cap_info;
653         /* spin lock for interrupt handling */
654         spinlock_t int_lock;
655         u8 int_status;
656         u32 event_cause;
657         struct sk_buff *event_skb;
658         u8 upld_buf[MWIFIEX_UPLD_SIZE];
659         u8 data_sent;
660         u8 cmd_sent;
661         u8 cmd_resp_received;
662         u8 event_received;
663         u8 data_received;
664         u16 seq_num;
665         struct cmd_ctrl_node *cmd_pool;
666         struct cmd_ctrl_node *curr_cmd;
667         /* spin lock for command */
668         spinlock_t mwifiex_cmd_lock;
669         u32 num_cmd_timeout;
670         u16 last_init_cmd;
671         struct timer_list cmd_timer;
672         struct list_head cmd_free_q;
673         /* spin lock for cmd_free_q */
674         spinlock_t cmd_free_q_lock;
675         struct list_head cmd_pending_q;
676         /* spin lock for cmd_pending_q */
677         spinlock_t cmd_pending_q_lock;
678         struct list_head scan_pending_q;
679         /* spin lock for scan_pending_q */
680         spinlock_t scan_pending_q_lock;
681         struct sk_buff_head usb_rx_data_q;
682         u32 scan_processing;
683         u16 region_code;
684         struct mwifiex_802_11d_domain_reg domain_reg;
685         u16 scan_probes;
686         u32 scan_mode;
687         u16 specific_scan_time;
688         u16 active_scan_time;
689         u16 passive_scan_time;
690         u8 fw_bands;
691         u8 adhoc_start_band;
692         u8 config_bands;
693         struct mwifiex_chan_scan_param_set *scan_channels;
694         u8 tx_lock_flag;
695         struct mwifiex_sleep_params sleep_params;
696         struct mwifiex_sleep_period sleep_period;
697         u16 ps_mode;
698         u32 ps_state;
699         u8 need_to_wakeup;
700         u16 multiple_dtim;
701         u16 local_listen_interval;
702         u16 null_pkt_interval;
703         struct sk_buff *sleep_cfm;
704         u16 bcn_miss_time_out;
705         u16 adhoc_awake_period;
706         u8 is_deep_sleep;
707         u8 delay_null_pkt;
708         u16 delay_to_ps;
709         u16 enhanced_ps_mode;
710         u8 pm_wakeup_card_req;
711         u16 gen_null_pkt;
712         u16 pps_uapsd_mode;
713         u32 pm_wakeup_fw_try;
714         u8 is_hs_configured;
715         struct mwifiex_hs_config_param hs_cfg;
716         u8 hs_activated;
717         u16 hs_activate_wait_q_woken;
718         wait_queue_head_t hs_activate_wait_q;
719         bool is_suspended;
720         u8 event_body[MAX_EVENT_SIZE];
721         u32 hw_dot_11n_dev_cap;
722         u8 hw_dev_mcs_support;
723         u8 adhoc_11n_enabled;
724         u8 sec_chan_offset;
725         struct mwifiex_dbg dbg;
726         u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
727         u32 arp_filter_size;
728         u16 cmd_wait_q_required;
729         struct mwifiex_wait_queue cmd_wait_q;
730         u8 scan_wait_q_woken;
731         struct cmd_ctrl_node *cmd_queued;
732         spinlock_t queue_lock;          /* lock for tx queues */
733         struct completion fw_load;
734         u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
735         u16 max_mgmt_ie_index;
736         u8 scan_delay_cnt;
737         u8 empty_tx_q_cnt;
738
739         /* 11AC */
740         u32 is_hw_11ac_capable;
741         u32 hw_dot_11ac_dev_cap;
742         u32 hw_dot_11ac_mcs_support;
743         u32 usr_dot_11ac_dev_cap_bg;
744         u32 usr_dot_11ac_dev_cap_a;
745         u32 usr_dot_11ac_mcs_support;
746
747         atomic_t is_tx_received;
748         atomic_t pending_bridged_pkts;
749 };
750
751 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
752
753 void mwifiex_set_trans_start(struct net_device *dev);
754
755 void mwifiex_stop_net_dev_queue(struct net_device *netdev,
756                 struct mwifiex_adapter *adapter);
757
758 void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
759                 struct mwifiex_adapter *adapter);
760
761 int mwifiex_init_priv(struct mwifiex_private *priv);
762 void mwifiex_free_priv(struct mwifiex_private *priv);
763
764 int mwifiex_init_fw(struct mwifiex_adapter *adapter);
765
766 int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
767
768 int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
769
770 int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter);
771
772 int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
773
774 int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);
775
776 int mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
777                                 struct sk_buff *skb);
778
779 int mwifiex_process_event(struct mwifiex_adapter *adapter);
780
781 int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
782                          struct cmd_ctrl_node *cmd_node);
783
784 int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
785                            u16 cmd_action, u32 cmd_oid, void *data_buf);
786
787 int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
788                           u16 cmd_action, u32 cmd_oid, void *data_buf);
789
790 void mwifiex_cmd_timeout_func(unsigned long function_context);
791
792 int mwifiex_get_debug_info(struct mwifiex_private *,
793                            struct mwifiex_debug_info *);
794
795 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
796 int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
797 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
798 void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
799
800 void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
801                                   struct cmd_ctrl_node *cmd_node);
802
803 void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
804                                      struct cmd_ctrl_node *cmd_node,
805                                      u32 addtail);
806
807 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
808 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
809 int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
810                              struct sk_buff *skb);
811 int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
812                        struct mwifiex_tx_param *tx_param);
813 int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
814 int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
815                                 struct sk_buff *skb, int aggr, int status);
816 void mwifiex_clean_txrx(struct mwifiex_private *priv);
817 u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
818 void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
819 void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
820                                         u32);
821 int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
822                                struct host_cmd_ds_command *cmd,
823                                u16 cmd_action, uint16_t ps_bitmap,
824                                struct mwifiex_ds_auto_ds *auto_ds);
825 int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
826                                struct host_cmd_ds_command *resp,
827                                struct mwifiex_ds_pm_cfg *pm_cfg);
828 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
829 void mwifiex_hs_activated_event(struct mwifiex_private *priv,
830                                         u8 activated);
831 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
832                               struct host_cmd_ds_command *resp);
833 int mwifiex_process_rx_packet(struct mwifiex_private *priv,
834                               struct sk_buff *skb);
835 int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
836                             u16 cmd_action, u32 cmd_oid,
837                             void *data_buf, void *cmd_buf);
838 int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
839                             u16 cmd_action, u32 cmd_oid,
840                             void *data_buf, void *cmd_buf);
841 int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
842                                 struct host_cmd_ds_command *resp);
843 int mwifiex_process_sta_rx_packet(struct mwifiex_private *,
844                                   struct sk_buff *skb);
845 int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
846                                   struct sk_buff *skb);
847 int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
848                                   struct sk_buff *skb);
849 int mwifiex_process_sta_event(struct mwifiex_private *);
850 int mwifiex_process_uap_event(struct mwifiex_private *);
851 struct mwifiex_sta_node *
852 mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac);
853 void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
854 void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
855 void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
856 int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta);
857 int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
858                             struct mwifiex_scan_cmd_config *scan_cfg);
859 void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
860                             struct cmd_ctrl_node *cmd_node);
861 int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
862                             struct host_cmd_ds_command *resp);
863 s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2);
864 int mwifiex_associate(struct mwifiex_private *priv,
865                       struct mwifiex_bssdescriptor *bss_desc);
866 int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
867                                  struct host_cmd_ds_command *cmd,
868                                  struct mwifiex_bssdescriptor *bss_desc);
869 int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
870                                  struct host_cmd_ds_command *resp);
871 void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
872 u8 mwifiex_band_to_radio_type(u8 band);
873 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
874 int mwifiex_adhoc_start(struct mwifiex_private *priv,
875                         struct cfg80211_ssid *adhoc_ssid);
876 int mwifiex_adhoc_join(struct mwifiex_private *priv,
877                        struct mwifiex_bssdescriptor *bss_desc);
878 int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
879                                     struct host_cmd_ds_command *cmd,
880                                     struct cfg80211_ssid *req_ssid);
881 int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
882                                    struct host_cmd_ds_command *cmd,
883                                    struct mwifiex_bssdescriptor *bss_desc);
884 int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
885                               struct host_cmd_ds_command *resp);
886 int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
887 struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv,
888                                                 u8 band, u16 channel, u32 freq);
889 u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
890                                u8 index, u8 ht_info);
891 u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
892                                    u8 index, u8 ht_info);
893 u32 mwifiex_find_freq_from_band_chan(u8, u8);
894 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
895                                 u8 **buffer);
896 u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
897                                     u8 *rates);
898 u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
899 u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
900 extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
901 void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
902 void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
903 int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
904                             struct host_cmd_ds_command *cmd);
905 int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
906                             struct host_cmd_ds_command *resp);
907 int is_command_pending(struct mwifiex_adapter *adapter);
908 void mwifiex_init_priv_params(struct mwifiex_private *priv,
909                                                 struct net_device *dev);
910 int mwifiex_set_secure_params(struct mwifiex_private *priv,
911                               struct mwifiex_uap_bss_param *bss_config,
912                               struct cfg80211_ap_settings *params);
913 void mwifiex_set_ht_params(struct mwifiex_private *priv,
914                            struct mwifiex_uap_bss_param *bss_cfg,
915                            struct cfg80211_ap_settings *params);
916 void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
917                            struct cfg80211_ap_settings *params);
918 void
919 mwifiex_set_wmm_params(struct mwifiex_private *priv,
920                        struct mwifiex_uap_bss_param *bss_cfg,
921                        struct cfg80211_ap_settings *params);
922
923 /*
924  * This function checks if the queuing is RA based or not.
925  */
926 static inline u8
927 mwifiex_queuing_ra_based(struct mwifiex_private *priv)
928 {
929         /*
930          * Currently we assume if we are in Infra, then DA=RA. This might not be
931          * true in the future
932          */
933         if ((priv->bss_mode == NL80211_IFTYPE_STATION) &&
934             (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
935                 return false;
936
937         return true;
938 }
939
940 /*
941  * This function copies rates.
942  */
943 static inline u32
944 mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
945 {
946         int i;
947
948         for (i = 0; i < len && src[i]; i++, pos++) {
949                 if (pos >= MWIFIEX_SUPPORTED_RATES)
950                         break;
951                 dest[pos] = src[i];
952         }
953
954         return pos;
955 }
956
957 /*
958  * This function returns the correct private structure pointer based
959  * upon the BSS type and BSS number.
960  */
961 static inline struct mwifiex_private *
962 mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
963                        u8 bss_num, u8 bss_type)
964 {
965         int i;
966
967         for (i = 0; i < adapter->priv_num; i++) {
968                 if (adapter->priv[i]) {
969                         if ((adapter->priv[i]->bss_num == bss_num) &&
970                             (adapter->priv[i]->bss_type == bss_type))
971                                 break;
972                 }
973         }
974         return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
975 }
976
977 /*
978  * This function returns the first available private structure pointer
979  * based upon the BSS role.
980  */
981 static inline struct mwifiex_private *
982 mwifiex_get_priv(struct mwifiex_adapter *adapter,
983                  enum mwifiex_bss_role bss_role)
984 {
985         int i;
986
987         for (i = 0; i < adapter->priv_num; i++) {
988                 if (adapter->priv[i]) {
989                         if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
990                             GET_BSS_ROLE(adapter->priv[i]) == bss_role)
991                                 break;
992                 }
993         }
994
995         return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
996 }
997
998 /*
999  * This function returns the driver private structure of a network device.
1000  */
1001 static inline struct mwifiex_private *
1002 mwifiex_netdev_get_priv(struct net_device *dev)
1003 {
1004         return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
1005 }
1006
1007 /*
1008  * This function checks if a skb holds a management frame.
1009  */
1010 static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb)
1011 {
1012         return (*(u32 *)skb->data == PKT_TYPE_MGMT);
1013 }
1014
1015 int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
1016                              u32 func_init_shutdown);
1017 int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
1018 int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *);
1019
1020 void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
1021                          int maxlen);
1022 int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
1023                         struct mwifiex_multicast_list *mcast_list);
1024 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
1025                             struct net_device *dev);
1026 int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter);
1027 int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
1028                       struct cfg80211_ssid *req_ssid);
1029 int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
1030 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
1031 int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
1032 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
1033 int mwifiex_request_scan(struct mwifiex_private *priv,
1034                          struct cfg80211_ssid *req_ssid);
1035 int mwifiex_scan_networks(struct mwifiex_private *priv,
1036                           const struct mwifiex_user_scan_cfg *user_scan_in);
1037 int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1038
1039 int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
1040                        const u8 *key, int key_len, u8 key_index,
1041                        const u8 *mac_addr, int disable);
1042
1043 int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len);
1044
1045 int mwifiex_get_ver_ext(struct mwifiex_private *priv);
1046
1047 int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1048                                struct ieee80211_channel *chan,
1049                                unsigned int duration);
1050
1051 int mwifiex_set_bss_role(struct mwifiex_private *priv, u8 bss_role);
1052
1053 int mwifiex_get_stats_info(struct mwifiex_private *priv,
1054                            struct mwifiex_ds_get_stats *log);
1055
1056 int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1057                       u32 reg_offset, u32 reg_value);
1058
1059 int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
1060                      u32 reg_offset, u32 *value);
1061
1062 int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
1063                         u8 *value);
1064
1065 int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
1066
1067 int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
1068
1069 int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
1070
1071 int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
1072
1073 int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
1074
1075 int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
1076                                    char *version, int max_len);
1077
1078 int mwifiex_set_tx_power(struct mwifiex_private *priv,
1079                          struct mwifiex_power_cfg *power_cfg);
1080
1081 int mwifiex_main_process(struct mwifiex_adapter *);
1082
1083 int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb);
1084
1085 int mwifiex_get_bss_info(struct mwifiex_private *,
1086                          struct mwifiex_bss_info *);
1087 int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
1088                               struct cfg80211_bss *bss,
1089                               struct mwifiex_bssdescriptor *bss_desc);
1090 int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1091                                     struct mwifiex_bssdescriptor *bss_entry);
1092 int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1093                                         struct mwifiex_bssdescriptor *bss_desc);
1094
1095 u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type);
1096
1097 struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1098                                               const char *name,
1099                                               enum nl80211_iftype type,
1100                                               u32 *flags,
1101                                               struct vif_params *params);
1102 int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
1103
1104 void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
1105
1106 int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter);
1107
1108 int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
1109                          struct cfg80211_beacon_data *data);
1110 int mwifiex_del_mgmt_ies(struct mwifiex_private *priv);
1111 u8 *mwifiex_11d_code_2_region(u8 code);
1112
1113 extern const struct ethtool_ops mwifiex_ethtool_ops;
1114
1115 #ifdef CONFIG_DEBUG_FS
1116 void mwifiex_debugfs_init(void);
1117 void mwifiex_debugfs_remove(void);
1118
1119 void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1120 void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1121 #endif
1122 #endif /* !_MWIFIEX_MAIN_H_ */