Merge tag 'pci-v5.18-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / staging / r8188eu / include / drv_types.h
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2012 Realtek Corporation. */
3
4 /*-----------------------------------------------------------------------------
5
6         For type defines and data structure defines
7
8 ------------------------------------------------------------------------------*/
9
10 #ifndef __DRV_TYPES_H__
11 #define __DRV_TYPES_H__
12
13 #define DRV_NAME "r8188eu"
14
15 #include "osdep_service.h"
16 #include "wlan_bssdef.h"
17 #include "rtw_ht.h"
18 #include "rtw_cmd.h"
19 #include "rtw_xmit.h"
20 #include "rtw_recv.h"
21 #include "hal_intf.h"
22 #include "hal_com.h"
23 #include "rtw_security.h"
24 #include "rtw_pwrctrl.h"
25 #include "rtw_io.h"
26 #include "rtw_eeprom.h"
27 #include "sta_info.h"
28 #include "rtw_mlme.h"
29 #include "rtw_debug.h"
30 #include "rtw_rf.h"
31 #include "rtw_event.h"
32 #include "rtw_led.h"
33 #include "rtw_mlme_ext.h"
34 #include "rtw_p2p.h"
35 #include "rtw_ap.h"
36 #include "rtw_br_ext.h"
37 #include "rtl8188e_hal.h"
38
39 #define DRIVERVERSION   "v4.1.4_6773.20130222"
40
41 struct registry_priv {
42         u8      chip_version;
43         u8      rfintfs;
44         u8      lbkmode;
45         u8      hci;
46         struct ndis_802_11_ssid ssid;
47         u8      network_mode;   /* infra, ad-hoc, auto */
48         u8      channel;/* ad-hoc support requirement */
49         u8      wireless_mode;/* A, B, G, auto */
50         u8      scan_mode;/* active, passive */
51         u8      radio_enable;
52         u8      preamble;/* long, short, auto */
53         u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
54         u8      vcs_type;/* RTS/CTS, CTS-to-self */
55         u16     rts_thresh;
56         u16     frag_thresh;
57         u8      adhoc_tx_pwr;
58         u8      soft_ap;
59         u8      power_mgnt;
60         u8      ips_mode;
61         u8      smart_ps;
62         u8      long_retry_lmt;
63         u8      short_retry_lmt;
64         u16     busy_thresh;
65         u8      ack_policy;
66         u8      software_encrypt;
67         u8      software_decrypt;
68         u8      acm_method;
69           /* UAPSD */
70         u8      wmm_enable;
71         u8      uapsd_enable;
72         u8      uapsd_max_sp;
73         u8      uapsd_acbk_en;
74         u8      uapsd_acbe_en;
75         u8      uapsd_acvi_en;
76         u8      uapsd_acvo_en;
77
78         u8      led_enable;
79
80         struct wlan_bssid_ex    dev_network;
81
82         u8      ht_enable;
83         u8      cbw40_enable;
84         u8      ampdu_enable;/* for tx */
85         u8      rx_stbc;
86         u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
87         u8      lowrate_two_xmit;
88
89         u8      low_power;
90
91         u8      wifi_spec;/*  !turbo_mode */
92
93         u8      channel_plan;
94         bool    bAcceptAddbaReq;
95
96         u8      antdiv_cfg;
97         u8      antdiv_type;
98
99         u8      usbss_enable;/* 0:disable,1:enable */
100         u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
101         u8      hwpwrp_detect;/* 0:disable,1:enable */
102
103         u8      hw_wps_pbc;/* 0:disable,1:enable */
104
105         u8      max_roaming_times; /*  the max number driver will try */
106
107         u8      fw_iol; /* enable iol without other concern */
108
109         u8      enable80211d;
110
111         u8      ifname[16];
112         u8      if2name[16];
113
114         u8      notch_filter;
115 };
116
117 #define MAX_CONTINUAL_URB_ERR           4
118
119 struct rt_firmware {
120         u8 *data;
121         u32 size;
122 };
123
124 struct dvobj_priv {
125         struct adapter *if1;
126
127         /* For 92D, DMDP have 2 interface. */
128         u8      InterfaceNumber;
129         u8      NumInterfaces;
130
131         /* In /Out Pipe information */
132         int     RtInPipe;
133         int     RtOutPipe[3];
134         u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
135
136         struct rt_firmware firmware;
137
138 /*-------- below is for USB INTERFACE --------*/
139
140         u8      RtNumOutPipes;
141
142         struct usb_interface *pusbintf;
143         struct usb_device *pusbdev;
144
145         atomic_t continual_urb_error;
146 };
147
148 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
149 {
150         /* todo: get interface type from dvobj and the return
151          * the dev accordingly */
152         return &dvobj->pusbintf->dev;
153 };
154
155 struct adapter {
156         int     pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
157
158         struct dvobj_priv *dvobj;
159         struct  mlme_priv mlmepriv;
160         struct  mlme_ext_priv mlmeextpriv;
161         struct  cmd_priv        cmdpriv;
162         struct  evt_priv        evtpriv;
163         struct  io_priv iopriv;
164         struct  xmit_priv       xmitpriv;
165         struct  recv_priv       recvpriv;
166         struct  sta_priv        stapriv;
167         struct  security_priv   securitypriv;
168         struct  registry_priv   registrypriv;
169         struct  pwrctrl_priv    pwrctrlpriv;
170         struct  eeprom_priv eeprompriv;
171         struct  led_priv        ledpriv;
172         struct wifidirect_info  wdinfo;
173
174         struct hal_data_8188e haldata;
175
176         s32     bDriverStopped;
177         s32     bSurpriseRemoved;
178         s32     bCardDisableWOHSM;
179
180         u8      hw_init_completed;
181         s8      signal_strength;
182
183         void *cmdThread;
184         void (*intf_start)(struct adapter *adapter);
185         void (*intf_stop)(struct adapter *adapter);
186         struct  net_device *pnetdev;
187
188         /*  used by rtw_rereg_nd_name related function */
189         struct rereg_nd_name_data {
190                 struct  net_device *old_pnetdev;
191                 char old_ifname[IFNAMSIZ];
192                 u8 old_ips_mode;
193                 u8 old_bRegUseLed;
194         } rereg_nd_name_priv;
195
196         int bup;
197         struct net_device_stats stats;
198         struct iw_statistics iwstats;
199         struct proc_dir_entry *dir_dev;/*  for proc directory */
200
201         int net_closed;
202         u8 bFWReady;
203         u8 bReadPortCancel;
204         u8 bWritePortCancel;
205         u8 bRxRSSIDisplay;
206         /* The driver will show up the desired channel number
207          * when this flag is 1. */
208         u8 bNotifyChannelChange;
209         /* The driver will show the current P2P status when the
210          * upper application reads it. */
211         u8 bShowGetP2PState;
212         struct adapter *pbuddy_adapter;
213
214         struct mutex *hw_init_mutex;
215
216         spinlock_t br_ext_lock;
217         struct nat25_network_db_entry   *nethash[NAT25_HASH_SIZE];
218         int                             pppoe_connection_in_progress;
219         unsigned char                   pppoe_addr[ETH_ALEN];
220         unsigned char                   scdb_mac[ETH_ALEN];
221         unsigned char                   scdb_ip[4];
222         struct nat25_network_db_entry   *scdb_entry;
223         unsigned char                   br_mac[ETH_ALEN];
224         unsigned char                   br_ip[4];
225         struct br_ext_info              ethBrExtInfo;
226 };
227
228 #define adapter_to_dvobj(adapter) (adapter->dvobj)
229
230 int rtw_handle_dualmac(struct adapter *adapter, bool init);
231
232 static inline u8 *myid(struct eeprom_priv *peepriv)
233 {
234         return peepriv->mac_addr;
235 }
236
237 #endif /* __DRV_TYPES_H__ */