• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef _wl_android_ext_
3 #define _wl_android_ext_
4 typedef struct bcol_gtk_para {
5     int enable;
6     int ptk_len;
7     char ptk[64];
8     char replay[8];
9 } bcol_gtk_para_t;
10 #define ACS_FW_BIT (1 << 0)
11 #define ACS_DRV_BIT (1 << 1)
12 int wl_ext_autochannel(struct net_device *dev, uint acs, uint32 band);
13 int wl_android_ext_priv_cmd(struct net_device *net, char *command,
14                             int total_len, int *bytes_written);
15 void wl_ext_get_sec(struct net_device *dev, int ifmode, char *sec,
16                     int total_len, bool dump);
17 bool wl_ext_check_scan(struct net_device *dev, dhd_pub_t *dhdp);
18 int wl_ext_set_scan_time(struct net_device *dev, int scan_time, uint32 scan_get,
19                          uint32 scan_set);
20 void wl_ext_wait_event_complete(struct dhd_pub *dhd, int ifidx);
21 int wl_ext_add_del_ie(struct net_device *dev, uint pktflag, char *ie_data,
22                       const char *add_del_cmd);
23 #ifdef WL_ESCAN
24 int wl_ext_drv_scan(struct net_device *dev, uint band, bool fast_scan);
25 #endif
26 #ifdef WL_EXT_GENL
27 int wl_ext_genl_init(struct net_device *net);
28 void wl_ext_genl_deinit(struct net_device *net);
29 #endif
30 #ifdef WL_EXT_IAPSTA
31 #ifndef strtoul
32 #define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
33 #endif
34 int wl_ext_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len, u32 set);
35 int wl_ext_iovar_getint(struct net_device *dev, s8 *iovar, s32 *val);
36 int wl_ext_iovar_setint(struct net_device *dev, s8 *iovar, s32 val);
37 int wl_ext_iovar_getbuf(struct net_device *dev, s8 *iovar_name, void *param,
38                         s32 paramlen, void *buf, s32 buflen,
39                         struct mutex *buf_sync);
40 int wl_ext_iovar_setbuf(struct net_device *dev, s8 *iovar_name, void *param,
41                         s32 paramlen, void *buf, s32 buflen,
42                         struct mutex *buf_sync);
43 int wl_ext_iovar_setbuf_bsscfg(struct net_device *dev, s8 *iovar_name,
44                                void *param, s32 paramlen, void *buf, s32 buflen,
45                                s32 bsscfg_idx, struct mutex *buf_sync);
46 chanspec_t wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec);
47 chanspec_t wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec);
48 bool wl_ext_dfs_chan(uint16 chan);
49 uint16 wl_ext_get_default_chan(struct net_device *dev, uint16 *chan_2g,
50                                uint16 *chan_5g, bool nodfs);
51 int wl_ext_set_chanspec(struct net_device *dev, int ioctl_ver, uint16 channel,
52                         chanspec_t *ret_chspec);
53 int wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver);
54 #endif
55 #if defined(WL_CFG80211) || defined(WL_ESCAN)
56 void wl_ext_user_sync(struct dhd_pub *dhd, int ifidx, bool lock);
57 #endif
58 #if defined(WL_CFG80211)
59 bool wl_legacy_chip_check(struct net_device *net);
60 bool wl_new_chip_check(struct net_device *net);
61 bool wl_extsae_chip(struct dhd_pub *dhd);
62 #ifdef WL_EXT_IAPSTA
63 void wl_ext_war(struct net_device *dev);
64 #endif
65 #endif
66 #if defined(WL_EXT_IAPSTA) || defined(WL_CFG80211)
67 void wl_ext_bss_iovar_war(struct net_device *dev, s32 *val);
68 #endif /* WL_EXT_IAPSTA ||WL_CFG80211 */
69 
70 typedef struct wl_conn_info {
71     uint8 bssidx;
72     wlc_ssid_t ssid;
73     struct ether_addr bssid;
74     uint16 channel;
75 } wl_conn_info_t;
76 #if defined(WL_EXT_IAPSTA) || defined(USE_IW)
77 s32 wl_ext_connect(struct net_device *dev, wl_conn_info_t *conn_info);
78 #endif /* WL_EXT_IAPSTA || USE_IW */
79 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
80 #define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len))
81 #endif
82 
83 #define RSSI_MAXVAL -2
84 #define RSSI_MINVAL -200
85 
86 #if defined(ESCAN_RESULT_PATCH)
87 #define REPEATED_SCAN_RESULT_CNT 2
88 #else
89 #define REPEATED_SCAN_RESULT_CNT 1
90 #endif
91 
92 #if defined(RSSIAVG) || defined(RSSIOFFSET)
93 extern int g_wifi_on;
94 #endif
95 
96 #if defined(RSSIAVG)
97 #define RSSIAVG_LEN (4 * REPEATED_SCAN_RESULT_CNT)
98 #define RSSICACHE_TIMEOUT 15
99 
100 typedef struct wl_rssi_cache {
101     struct wl_rssi_cache *next;
102     int dirty;
103     struct osl_timespec tv;
104     struct ether_addr BSSID;
105     int16 RSSI[RSSIAVG_LEN];
106 } wl_rssi_cache_t;
107 
108 typedef struct wl_rssi_cache_ctrl {
109     wl_rssi_cache_t *m_cache_head;
110 } wl_rssi_cache_ctrl_t;
111 
112 void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
113 void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
114 void wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
115                                        u8 *bssid);
116 void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
117 void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
118                           wl_scan_results_t *ss_list);
119 int wl_update_connected_rssi_cache(struct net_device *net,
120                                    wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
121                                    int *rssi_avg);
122 int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr);
123 #endif
124 
125 #if defined(RSSIOFFSET)
126 #define RSSI_OFFSET 5
127 #if defined(RSSIOFFSET_NEW)
128 #define RSSI_OFFSET_MAXVAL -80
129 #define RSSI_OFFSET_MINVAL -94
130 #define RSSI_OFFSET_INTVAL                                                     \
131     ((RSSI_OFFSET_MAXVAL - RSSI_OFFSET_MINVAL) / RSSI_OFFSET)
132 #endif
133 #define BCM4330_CHIP_ID 0x4330
134 #define BCM4330B2_CHIP_REV 4
135 int wl_update_rssi_offset(struct net_device *net, int rssi);
136 #endif
137 
138 #if defined(BSSCACHE)
139 #define BSSCACHE_TIMEOUT 30
140 #define BSSCACHE_MAXCNT 20
141 #define SORT_BSS_CHANNEL
142 
143 typedef struct wl_bss_cache {
144     struct wl_bss_cache *next;
145     int dirty;
146     struct osl_timespec tv;
147     wl_scan_results_t results;
148 } wl_bss_cache_t;
149 
150 typedef struct wl_bss_cache_ctrl {
151     wl_bss_cache_t *m_cache_head;
152 } wl_bss_cache_ctrl_t;
153 
154 void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
155 void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
156 void wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl,
157                                       u8 *bssid);
158 int wl_bss_cache_size(wl_bss_cache_ctrl_t *bss_cache_ctrl);
159 void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
160 void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl,
161 #if defined(RSSIAVG)
162                          wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
163 #endif
164                          wl_scan_results_t *ss_list);
165 void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
166 #endif
167 int wl_ext_get_best_channel(struct net_device *net,
168 #if defined(BSSCACHE)
169                             wl_bss_cache_ctrl_t *bss_cache_ctrl,
170 #else
171                             wl_scan_results_t *bss_list,
172 #endif
173                             int ioctl_ver, int *best_2g_ch, int *best_5g_ch);
174 #endif
175