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