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