2 * Linux cfg80211 driver - Android related functions
4 * Copyright (C) 1999-2016, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
25 * <<Broadcom-WL-IPTag/Open:>>
27 * $Id: wl_android.h 608194 2015-12-24 04:34:35Z $
33 #include <linux/module.h>
34 #include <linux/netdevice.h>
35 #include <wldev_common.h>
37 /* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
40 #if defined(BT_WIFI_HANDOVER) || defined(WL_NAN)
47 * Android platform dependent functions, feel free to add Android specific functions here
48 * (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd
49 * or cfg, define them as static in wl_android.c
53 * wl_android_init will be called from module init function (dhd_module_init now), similarly
54 * wl_android_exit will be called from module exit function (dhd_module_cleanup now)
56 int wl_android_init(void);
57 int wl_android_exit(void);
58 void wl_android_post_init(void);
59 int wl_android_wifi_on(struct net_device *dev);
60 int wl_android_wifi_off(struct net_device *dev, bool on_failure);
61 int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd);
63 s32 wl_netlink_send_msg(int pid, int type, int seq, void *data, size_t size);
66 #define MACLIST_MODE_DISABLED 0
67 #define MACLIST_MODE_DENY 1
68 #define MACLIST_MODE_ALLOW 2
70 /* max number of assoc list */
71 #define MAX_NUM_OF_ASSOCLIST 64
74 #define WL_CH_BANDWIDTH_20MHZ 20
75 #define WL_CH_BANDWIDTH_40MHZ 40
76 #define WL_CH_BANDWIDTH_80MHZ 80
77 /* max number of mac filter list
78 * restrict max number to 10 as maximum cmd string size is 255
80 #define MAX_NUM_MAC_FILT 10
82 int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist);
83 int wl_android_set_roam_offload_bssid_list(struct net_device *dev, const char *cmd);
86 * BSSCACHE: Cache bss list
87 * RSSAVG: Average RSSI of BSS list
88 * RSSIOFFSET: RSSI offset
89 * SORT_BSS_BY_RSSI: Sort BSS by RSSI
94 //#define RSSIOFFSET_NEW
95 //#define SORT_BSS_BY_RSSI
97 #define RSSI_MAXVAL -2
98 #define RSSI_MINVAL -200
100 #if defined(ESCAN_RESULT_PATCH)
101 #define REPEATED_SCAN_RESULT_CNT 2
103 #define REPEATED_SCAN_RESULT_CNT 1
107 #define RSSIAVG_LEN (4*REPEATED_SCAN_RESULT_CNT)
108 #define RSSICACHE_TIMEOUT 15
110 typedef struct wl_rssi_cache {
111 struct wl_rssi_cache *next;
114 struct ether_addr BSSID;
115 int16 RSSI[RSSIAVG_LEN];
118 typedef struct wl_rssi_cache_ctrl {
119 wl_rssi_cache_t *m_cache_head;
120 } wl_rssi_cache_ctrl_t;
122 void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
123 void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
124 void wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid);
125 void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
126 void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list);
127 int wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg);
128 int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr);
131 #if defined(RSSIOFFSET)
132 #define RSSI_OFFSET 5
133 #if defined(RSSIOFFSET_NEW)
134 #define RSSI_OFFSET_MAXVAL -80
135 #define RSSI_OFFSET_MINVAL -94
136 #define RSSI_OFFSET_INTVAL ((RSSI_OFFSET_MAXVAL-RSSI_OFFSET_MINVAL)/RSSI_OFFSET)
138 #define BCM4330_CHIP_ID 0x4330
139 #define BCM4330B2_CHIP_REV 4
140 int wl_update_rssi_offset(struct net_device *net, int rssi);
143 #if defined(BSSCACHE)
144 #define BSSCACHE_TIMEOUT 15
146 typedef struct wl_bss_cache {
147 struct wl_bss_cache *next;
150 wl_scan_results_t results;
153 typedef struct wl_bss_cache_ctrl {
154 wl_bss_cache_t *m_cache_head;
155 } wl_bss_cache_ctrl_t;
157 void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
158 void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
159 void wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid);
160 void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
161 void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl,
163 wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
165 wl_scan_results_t *ss_list);
166 void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
168 #endif /* _wl_android_ */