79021711de65b3f44764df97f2f97f52ccd15a03
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_dhd-driver.git] / bcmdhd.100.10.315.x / dhd_config.h
1
2 #ifndef _dhd_config_
3 #define _dhd_config_
4
5 #include <bcmdevs.h>
6 #include <siutils.h>
7 #include <dngl_stats.h>
8 #include <dhd.h>
9 #include <wlioctl.h>
10 #include <802.11.h>
11
12 #define FW_TYPE_STA 0
13 #define FW_TYPE_APSTA 1
14 #define FW_TYPE_P2P 2
15 #define FW_TYPE_MESH 3
16 #define FW_TYPE_ES 4
17 #define FW_TYPE_MFG 5
18 #define FW_TYPE_G 0
19 #define FW_TYPE_AG 1
20
21 #define FW_PATH_AUTO_SELECT 1
22 //#define CONFIG_PATH_AUTO_SELECT
23 extern char firmware_path[MOD_PARAM_PATHLEN];
24 #if defined(BCMSDIO) || defined(BCMPCIE)
25 extern uint dhd_rxbound;
26 extern uint dhd_txbound;
27 #endif
28 #ifdef BCMSDIO
29 #define TXGLOM_RECV_OFFSET 8
30 extern uint dhd_doflow;
31 extern uint dhd_slpauto;
32 #endif
33
34 typedef struct wl_mac_range {
35 uint32 oui;
36 uint32 nic_start;
37 uint32 nic_end;
38 } wl_mac_range_t;
39
40 typedef struct wl_mac_list {
41 int count;
42 wl_mac_range_t *mac;
43 char name[MOD_PARAM_PATHLEN];
44 } wl_mac_list_t;
45
46 typedef struct wl_mac_list_ctrl {
47 int count;
48 struct wl_mac_list *m_mac_list_head;
49 } wl_mac_list_ctrl_t;
50
51 typedef struct wl_chip_nv_path {
52 uint chip;
53 uint chiprev;
54 char name[MOD_PARAM_PATHLEN];
55 } wl_chip_nv_path_t;
56
57 typedef struct wl_chip_nv_path_list_ctrl {
58 int count;
59 struct wl_chip_nv_path *m_chip_nv_path_head;
60 } wl_chip_nv_path_list_ctrl_t;
61
62 typedef struct wl_channel_list {
63 uint32 count;
64 uint32 channel[WL_NUMCHANNELS];
65 } wl_channel_list_t;
66
67 typedef struct wmes_param {
68 int aifsn[AC_COUNT];
69 int ecwmin[AC_COUNT];
70 int ecwmax[AC_COUNT];
71 int txop[AC_COUNT];
72 } wme_param_t;
73
74 #ifdef PKT_FILTER_SUPPORT
75 #define DHD_CONF_FILTER_MAX 8
76 #define PKT_FILTER_LEN 300
77 #define MAGIC_PKT_FILTER_LEN 450
78 typedef struct conf_pkt_filter_add {
79 uint32 count;
80 char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN];
81 } conf_pkt_filter_add_t;
82
83 typedef struct conf_pkt_filter_del {
84 uint32 count;
85 uint32 id[DHD_CONF_FILTER_MAX];
86 } conf_pkt_filter_del_t;
87 #endif
88
89 #define CONFIG_COUNTRY_LIST_SIZE 100
90 typedef struct conf_country_list {
91 wl_country_t *cspec[CONFIG_COUNTRY_LIST_SIZE];
92 } conf_country_list_t;
93
94 /* mchan_params */
95 #define MCHAN_MAX_NUM 4
96 #define MIRACAST_SOURCE 1
97 #define MIRACAST_SINK 2
98 typedef struct mchan_params {
99 int bw;
100 int p2p_mode;
101 int miracast_mode;
102 } mchan_params_t;
103
104 enum in4way_flags {
105 NO_SCAN_IN4WAY = (1 << (0)),
106 NO_BTC_IN4WAY = (1 << (1)),
107 DONT_DELETE_GC_AFTER_WPS = (1 << (2)),
108 WAIT_DISCONNECTED = (1 << (3)),
109 };
110
111 enum in_suspend_flags {
112 NO_EVENT_IN_SUSPEND = (1 << (0)),
113 NO_TXDATA_IN_SUSPEND = (1 << (1)),
114 NO_TXCTL_IN_SUSPEND = (1 << (2)),
115 AP_DOWN_IN_SUSPEND = (1 << (3)),
116 ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)),
117 AP_FILTER_IN_SUSPEND = (1 << (5)),
118 WOWL_IN_SUSPEND = (1 << (6)),
119 ALL_IN_SUSPEND = 0xFFFFFFFF,
120 };
121
122 enum eapol_status {
123 EAPOL_STATUS_NONE = 0,
124 EAPOL_STATUS_REQID = 1,
125 EAPOL_STATUS_RSPID = 2,
126 EAPOL_STATUS_WSC_START = 3,
127 EAPOL_STATUS_WPS_M1 = 4,
128 EAPOL_STATUS_WPS_M2 = 5,
129 EAPOL_STATUS_WPS_M3 = 6,
130 EAPOL_STATUS_WPS_M4 = 7,
131 EAPOL_STATUS_WPS_M5 = 8,
132 EAPOL_STATUS_WPS_M6 = 9,
133 EAPOL_STATUS_WPS_M7 = 10,
134 EAPOL_STATUS_WPS_M8 = 11,
135 EAPOL_STATUS_WSC_DONE = 12,
136 EAPOL_STATUS_4WAY_START = 13,
137 EAPOL_STATUS_4WAY_M1 = 14,
138 EAPOL_STATUS_4WAY_M2 = 15,
139 EAPOL_STATUS_4WAY_M3 = 16,
140 EAPOL_STATUS_4WAY_M4 = 17,
141 EAPOL_STATUS_GROUPKEY_M1 = 18,
142 EAPOL_STATUS_GROUPKEY_M2 = 19,
143 EAPOL_STATUS_4WAY_DONE = 20
144 };
145
146 typedef struct dhd_conf {
147 uint chip;
148 uint chiprev;
149 int fw_type;
150 #ifdef BCMSDIO
151 wl_mac_list_ctrl_t fw_by_mac;
152 wl_mac_list_ctrl_t nv_by_mac;
153 #endif
154 wl_chip_nv_path_list_ctrl_t nv_by_chip;
155 conf_country_list_t country_list;
156 int band;
157 int bw_cap[2];
158 wl_country_t cspec;
159 wl_channel_list_t channels;
160 uint roam_off;
161 uint roam_off_suspend;
162 int roam_trigger[2];
163 int roam_scan_period[2];
164 int roam_delta[2];
165 int fullroamperiod;
166 uint keep_alive_period;
167 #ifdef ARP_OFFLOAD_SUPPORT
168 bool garp;
169 #endif
170 int force_wme_ac;
171 wme_param_t wme_sta;
172 wme_param_t wme_ap;
173 #ifdef PKT_FILTER_SUPPORT
174 conf_pkt_filter_add_t pkt_filter_add;
175 conf_pkt_filter_del_t pkt_filter_del;
176 char *magic_pkt_filter_add;
177 #endif
178 int srl;
179 int lrl;
180 uint bcn_timeout;
181 int disable_proptx;
182 int dhd_poll;
183 #ifdef BCMSDIO
184 int use_rxchain;
185 bool bus_rxglom;
186 bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */
187 /* terence 20161011:
188 1) conf->tx_max_offset = 1 to fix credict issue in adaptivity testing
189 2) conf->tx_max_offset = 1 will cause to UDP Tx not work in rxglom supported,
190 but not happened in sw txglom
191 */
192 int tx_max_offset;
193 uint txglomsize;
194 int txctl_tmo_fix;
195 bool txglom_mode;
196 uint deferred_tx_len;
197 /*txglom_bucket_size:
198 * 43362/4330: 1680
199 * 43340/43341/43241: 1684
200 */
201 int txglom_bucket_size;
202 int txinrx_thres;
203 int dhd_txminmax; // -1=DATABUFCNT(bus)
204 bool oob_enabled_later;
205 #if defined(SDIO_ISR_THREAD)
206 bool intr_extn;
207 #endif
208 #ifdef BCMSDIO_RXLIM_POST
209 bool rxlim_en;
210 #endif
211 #endif
212 #ifdef BCMPCIE
213 int bus_deepsleep_disable;
214 #endif
215 int dpc_cpucore;
216 int rxf_cpucore;
217 int frameburst;
218 bool deepsleep;
219 int pm;
220 int pm_in_suspend;
221 int suspend_bcn_li_dtim;
222 #ifdef DHDTCPACK_SUPPRESS
223 uint8 tcpack_sup_mode;
224 #endif
225 int pktprio8021x;
226 uint insuspend;
227 bool suspended;
228 #ifdef SUSPEND_EVENT
229 char resume_eventmask[WL_EVENTING_MASK_LEN];
230 struct ether_addr bssid_insuspend;
231 bool wlfc;
232 #endif
233 #ifdef IDHCP
234 int dhcpc_enable;
235 int dhcpd_enable;
236 struct ipv4_addr dhcpd_ip_addr;
237 struct ipv4_addr dhcpd_ip_mask;
238 struct ipv4_addr dhcpd_ip_start;
239 struct ipv4_addr dhcpd_ip_end;
240 #endif
241 #ifdef ISAM_PREINIT
242 char isam_init[50];
243 char isam_config[300];
244 char isam_enable[50];
245 #endif
246 int ctrl_resched;
247 struct mchan_params mchan[MCHAN_MAX_NUM];
248 char *wl_preinit;
249 int tsq;
250 int orphan_move;
251 uint eapol_status;
252 uint in4way;
253 #ifdef WL_EXT_WOWL
254 uint wowl;
255 #endif
256 #ifdef GET_CUSTOM_MAC_FROM_CONFIG
257 char hw_ether[62];
258 #endif
259 } dhd_conf_t;
260
261 #ifdef BCMSDIO
262 int dhd_conf_get_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih, uint8 *mac);
263 #if defined(HW_OOB) || defined(FORCE_WOWLAN)
264 void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih);
265 #endif
266 void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable);
267 int dhd_conf_set_blksize(bcmsdh_info_t *sdh);
268 #endif
269 void dhd_conf_set_path_params(dhd_pub_t *dhd, void *sdh, void *sih,
270 char *fw_path, char *nv_path);
271 int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val,
272 int def, bool down);
273 int dhd_conf_get_band(dhd_pub_t *dhd);
274 int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec);
275 int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
276 int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
277 int dhd_conf_fix_country(dhd_pub_t *dhd);
278 bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);
279 void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode);
280 void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source);
281 void dhd_conf_add_pkt_filter(dhd_pub_t *dhd);
282 bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id);
283 void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd);
284 int dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path);
285 int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev);
286 uint dhd_conf_get_chip(void *context);
287 uint dhd_conf_get_chiprev(void *context);
288 int dhd_conf_get_pm(dhd_pub_t *dhd);
289 int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len,
290 int *hostsleep_set, int *hostsleep_val, int *ret);
291 void dhd_conf_get_hostsleep(dhd_pub_t *dhd,
292 int hostsleep_set, int hostsleep_val, int ret);
293 int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period,
294 char *packet, bool bcast);
295 #ifdef ARP_OFFLOAD_SUPPORT
296 void dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable);
297 #endif
298 #ifdef PROP_TXSTATUS
299 int dhd_conf_get_disable_proptx(dhd_pub_t *dhd);
300 #endif
301 uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask);
302 int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend);
303 void dhd_conf_postinit_ioctls(dhd_pub_t *dhd);
304 int dhd_conf_preinit(dhd_pub_t *dhd);
305 int dhd_conf_reset(dhd_pub_t *dhd);
306 int dhd_conf_attach(dhd_pub_t *dhd);
307 void dhd_conf_detach(dhd_pub_t *dhd);
308 void *dhd_get_pub(struct net_device *dev);
309 int wl_pattern_atoh(char *src, char *dst);
310 #endif /* _dhd_config_ */