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_rf.h"
30 #include "rtw_event.h"
31 #include "rtw_led.h"
32 #include "rtw_mlme_ext.h"
33 #include "rtw_p2p.h"
34 #include "rtw_ap.h"
35 #include "rtw_br_ext.h"
36 #include "rtl8188e_hal.h"
37 #include "rtw_fw.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 dvobj_priv {
120 struct adapter *if1;
121
122 /* For 92D, DMDP have 2 interface. */
123 u8 InterfaceNumber;
124 u8 NumInterfaces;
125
126 /* In /Out Pipe information */
127 int RtInPipe;
128 int RtOutPipe[3];
129 u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
130
131 struct rt_firmware firmware;
132
133 /*-------- below is for USB INTERFACE --------*/
134
135 u8 RtNumOutPipes;
136
137 struct usb_interface *pusbintf;
138 struct usb_device *pusbdev;
139
140 atomic_t continual_urb_error;
141 };
142
dvobj_to_dev(struct dvobj_priv * dvobj)143 static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
144 {
145 /* todo: get interface type from dvobj and the return
146 * the dev accordingly */
147 return &dvobj->pusbintf->dev;
148 };
149
150 struct adapter {
151 int pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
152
153 struct dvobj_priv *dvobj;
154 struct mlme_priv mlmepriv;
155 struct mlme_ext_priv mlmeextpriv;
156 struct cmd_priv cmdpriv;
157 struct evt_priv evtpriv;
158 struct io_priv iopriv;
159 struct xmit_priv xmitpriv;
160 struct recv_priv recvpriv;
161 struct sta_priv stapriv;
162 struct security_priv securitypriv;
163 struct registry_priv registrypriv;
164 struct pwrctrl_priv pwrctrlpriv;
165 struct eeprom_priv eeprompriv;
166 struct led_priv ledpriv;
167 struct wifidirect_info wdinfo;
168
169 struct hal_data_8188e haldata;
170
171 s32 bDriverStopped;
172 s32 bSurpriseRemoved;
173 s32 bCardDisableWOHSM;
174
175 u8 hw_init_completed;
176 s8 signal_strength;
177
178 void *cmdThread;
179 void (*intf_start)(struct adapter *adapter);
180 void (*intf_stop)(struct adapter *adapter);
181 struct net_device *pnetdev;
182
183 /* used by rtw_rereg_nd_name related function */
184 struct rereg_nd_name_data {
185 struct net_device *old_pnetdev;
186 char old_ifname[IFNAMSIZ];
187 u8 old_ips_mode;
188 u8 old_bRegUseLed;
189 } rereg_nd_name_priv;
190
191 int bup;
192 struct net_device_stats stats;
193 struct iw_statistics iwstats;
194 struct proc_dir_entry *dir_dev;/* for proc directory */
195
196 int net_closed;
197 u8 bFWReady;
198 u8 bReadPortCancel;
199 u8 bWritePortCancel;
200 u8 bRxRSSIDisplay;
201 /* The driver will show up the desired channel number
202 * when this flag is 1. */
203 u8 bNotifyChannelChange;
204 /* The driver will show the current P2P status when the
205 * upper application reads it. */
206 u8 bShowGetP2PState;
207 struct adapter *pbuddy_adapter;
208
209 struct mutex *hw_init_mutex;
210
211 spinlock_t br_ext_lock;
212 struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
213 int pppoe_connection_in_progress;
214 unsigned char pppoe_addr[ETH_ALEN];
215 unsigned char scdb_mac[ETH_ALEN];
216 unsigned char scdb_ip[4];
217 struct nat25_network_db_entry *scdb_entry;
218 unsigned char br_mac[ETH_ALEN];
219 unsigned char br_ip[4];
220 struct br_ext_info ethBrExtInfo;
221 };
222
223 #define adapter_to_dvobj(adapter) (adapter->dvobj)
224
225 int rtw_handle_dualmac(struct adapter *adapter, bool init);
226
myid(struct eeprom_priv * peepriv)227 static inline u8 *myid(struct eeprom_priv *peepriv)
228 {
229 return peepriv->mac_addr;
230 }
231
232 #endif /* __DRV_TYPES_H__ */
233