diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/wl_cfgp2p.h')
-rw-r--r-- | drivers/net/wireless/bcmdhd/wl_cfgp2p.h | 247 |
1 files changed, 247 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcmdhd/wl_cfgp2p.h b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h new file mode 100644 index 00000000000..5a69168c6a3 --- /dev/null +++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h | |||
@@ -0,0 +1,247 @@ | |||
1 | /* | ||
2 | * Linux cfgp2p driver | ||
3 | * | ||
4 | * Copyright (C) 1999-2011, Broadcom Corporation | ||
5 | * | ||
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: | ||
11 | * | ||
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. | ||
19 | * | ||
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. | ||
23 | * | ||
24 | * $Id: wl_cfgp2p.h,v 1.1.4.1.2.8 2011/02/09 01:37:52 Exp $ | ||
25 | */ | ||
26 | #ifndef _wl_cfgp2p_h_ | ||
27 | #define _wl_cfgp2p_h_ | ||
28 | #include <proto/802.11.h> | ||
29 | #include <proto/p2p.h> | ||
30 | |||
31 | struct wl_priv; | ||
32 | extern u32 wl_dbg_level; | ||
33 | |||
34 | /* Enumeration of the usages of the BSSCFGs used by the P2P Library. Do not | ||
35 | * confuse this with a bsscfg index. This value is an index into the | ||
36 | * saved_ie[] array of structures which in turn contains a bsscfg index field. | ||
37 | */ | ||
38 | typedef enum { | ||
39 | P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */ | ||
40 | P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */ | ||
41 | P2PAPI_BSSCFG_CONNECTION, /* maps to driver's P2P connection bsscfg */ | ||
42 | P2PAPI_BSSCFG_MAX | ||
43 | } p2p_bsscfg_type_t; | ||
44 | |||
45 | #define IE_MAX_LEN 300 | ||
46 | /* Structure to hold all saved P2P and WPS IEs for a BSSCFG */ | ||
47 | struct p2p_saved_ie { | ||
48 | u8 p2p_probe_req_ie[IE_MAX_LEN]; | ||
49 | u8 p2p_probe_res_ie[IE_MAX_LEN]; | ||
50 | u8 p2p_assoc_req_ie[IE_MAX_LEN]; | ||
51 | u8 p2p_assoc_res_ie[IE_MAX_LEN]; | ||
52 | u8 p2p_beacon_ie[IE_MAX_LEN]; | ||
53 | u32 p2p_probe_req_ie_len; | ||
54 | u32 p2p_probe_res_ie_len; | ||
55 | u32 p2p_assoc_req_ie_len; | ||
56 | u32 p2p_assoc_res_ie_len; | ||
57 | u32 p2p_beacon_ie_len; | ||
58 | }; | ||
59 | |||
60 | struct p2p_bss { | ||
61 | u32 bssidx; | ||
62 | struct net_device *dev; | ||
63 | struct p2p_saved_ie saved_ie; | ||
64 | void *private_data; | ||
65 | }; | ||
66 | |||
67 | struct p2p_info { | ||
68 | bool on; /* p2p on/off switch */ | ||
69 | bool scan; | ||
70 | bool vif_created; | ||
71 | s8 vir_ifname[IFNAMSIZ]; | ||
72 | unsigned long status; | ||
73 | struct ether_addr dev_addr; | ||
74 | struct ether_addr int_addr; | ||
75 | struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX]; | ||
76 | struct timer_list listen_timer; | ||
77 | wl_p2p_sched_t noa; | ||
78 | wl_p2p_ops_t ops; | ||
79 | wlc_ssid_t ssid; | ||
80 | spinlock_t timer_lock; | ||
81 | }; | ||
82 | |||
83 | /* dongle status */ | ||
84 | enum wl_cfgp2p_status { | ||
85 | WLP2P_STATUS_DISCOVERY_ON = 0, | ||
86 | WLP2P_STATUS_SEARCH_ENABLED, | ||
87 | WLP2P_STATUS_IF_ADD, | ||
88 | WLP2P_STATUS_IF_DEL, | ||
89 | WLP2P_STATUS_IF_DELETING, | ||
90 | WLP2P_STATUS_IF_CHANGING, | ||
91 | WLP2P_STATUS_IF_CHANGED, | ||
92 | WLP2P_STATUS_LISTEN_EXPIRED, | ||
93 | WLP2P_STATUS_ACTION_TX_COMPLETED, | ||
94 | WLP2P_STATUS_ACTION_TX_NOACK, | ||
95 | WLP2P_STATUS_SCANNING | ||
96 | }; | ||
97 | |||
98 | |||
99 | #define wl_to_p2p_bss_ndev(w, type) ((wl)->p2p->bss_idx[type].dev) | ||
100 | #define wl_to_p2p_bss_bssidx(w, type) ((wl)->p2p->bss_idx[type].bssidx) | ||
101 | #define wl_to_p2p_bss_saved_ie(w, type) ((wl)->p2p->bss_idx[type].saved_ie) | ||
102 | #define wl_to_p2p_bss_private(w, type) ((wl)->p2p->bss_idx[type].private_data) | ||
103 | #define wl_to_p2p_bss(wl, type) ((wl)->p2p->bss_idx[type]) | ||
104 | #define wl_get_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? 0 : test_bit(WLP2P_STATUS_ ## stat, \ | ||
105 | &(wl)->p2p->status)) | ||
106 | #define wl_set_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? : set_bit(WLP2P_STATUS_ ## stat, \ | ||
107 | &(wl)->p2p->status)) | ||
108 | #define wl_clr_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? : clear_bit(WLP2P_STATUS_ ## stat, \ | ||
109 | &(wl)->p2p->status)) | ||
110 | #define wl_chg_p2p_status(wl, stat) ((!(wl)->p2p_supported) ? : change_bit(WLP2P_STATUS_ ## stat, \ | ||
111 | &(wl)->p2p->status)) | ||
112 | #define p2p_on(wl) ((wl)->p2p->on) | ||
113 | #define p2p_scan(wl) ((wl)->p2p->scan) | ||
114 | #define p2p_is_on(wl) ((wl)->p2p && (wl)->p2p->on) | ||
115 | |||
116 | /* dword align allocation */ | ||
117 | #define WLC_IOCTL_MAXLEN 8192 | ||
118 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] | ||
119 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" | ||
120 | |||
121 | #define CFGP2P_ERR(args) \ | ||
122 | do { \ | ||
123 | if (wl_dbg_level & WL_DBG_ERR) { \ | ||
124 | printk(KERN_ERR "CFGP2P-ERROR) %s : ", __func__); \ | ||
125 | printk args; \ | ||
126 | } \ | ||
127 | } while (0) | ||
128 | #define CFGP2P_INFO(args) \ | ||
129 | do { \ | ||
130 | if (wl_dbg_level & WL_DBG_INFO) { \ | ||
131 | printk(KERN_ERR "CFGP2P-INFO) %s : ", __func__); \ | ||
132 | printk args; \ | ||
133 | } \ | ||
134 | } while (0) | ||
135 | #define CFGP2P_DBG(args) \ | ||
136 | do { \ | ||
137 | if (wl_dbg_level & WL_DBG_DBG) { \ | ||
138 | printk(KERN_ERR "CFGP2P-DEBUG) %s :", __func__); \ | ||
139 | printk args; \ | ||
140 | } \ | ||
141 | } while (0) | ||
142 | |||
143 | |||
144 | extern s32 | ||
145 | wl_cfgp2p_init_priv(struct wl_priv *wl); | ||
146 | extern void | ||
147 | wl_cfgp2p_deinit_priv(struct wl_priv *wl); | ||
148 | extern s32 | ||
149 | wl_cfgp2p_set_firm_p2p(struct wl_priv *wl); | ||
150 | extern s32 | ||
151 | wl_cfgp2p_set_p2p_mode(struct wl_priv *wl, u8 mode, | ||
152 | u32 channel, u16 listen_ms, int bssidx); | ||
153 | extern s32 | ||
154 | wl_cfgp2p_ifadd(struct wl_priv *wl, struct ether_addr *mac, u8 if_type, | ||
155 | chanspec_t chspec); | ||
156 | extern s32 | ||
157 | wl_cfgp2p_ifdel(struct wl_priv *wl, struct ether_addr *mac); | ||
158 | extern s32 | ||
159 | wl_cfgp2p_ifchange(struct wl_priv *wl, struct ether_addr *mac, u8 if_type, chanspec_t chspec); | ||
160 | |||
161 | extern s32 | ||
162 | wl_cfgp2p_ifidx(struct wl_priv *wl, struct ether_addr *mac, s32 *index); | ||
163 | |||
164 | extern s32 | ||
165 | wl_cfgp2p_init_discovery(struct wl_priv *wl); | ||
166 | extern s32 | ||
167 | wl_cfgp2p_enable_discovery(struct wl_priv *wl, struct net_device *dev, const u8 *ie, u32 ie_len); | ||
168 | extern s32 | ||
169 | wl_cfgp2p_disable_discovery(struct wl_priv *wl); | ||
170 | extern s32 | ||
171 | wl_cfgp2p_escan(struct wl_priv *wl, struct net_device *dev, u16 active, u32 num_chans, | ||
172 | u16 *channels, | ||
173 | s32 search_state, u16 action, u32 bssidx); | ||
174 | |||
175 | extern wpa_ie_fixed_t * | ||
176 | wl_cfgp2p_find_wpaie(u8 *parse, u32 len); | ||
177 | |||
178 | extern wpa_ie_fixed_t * | ||
179 | wl_cfgp2p_find_wpsie(u8 *parse, u32 len); | ||
180 | |||
181 | extern wifi_p2p_ie_t * | ||
182 | wl_cfgp2p_find_p2pie(u8 *parse, u32 len); | ||
183 | |||
184 | extern s32 | ||
185 | wl_cfgp2p_set_management_ie(struct wl_priv *wl, struct net_device *ndev, s32 bssidx, | ||
186 | s32 pktflag, const u8 *vndr_ie, u32 vndr_ie_len); | ||
187 | extern s32 | ||
188 | wl_cfgp2p_clear_management_ie(struct wl_priv *wl, s32 bssidx); | ||
189 | |||
190 | extern s32 | ||
191 | wl_cfgp2p_find_idx(struct wl_priv *wl, struct net_device *ndev); | ||
192 | |||
193 | |||
194 | extern s32 | ||
195 | wl_cfgp2p_listen_complete(struct wl_priv *wl, struct net_device *ndev, | ||
196 | const wl_event_msg_t *e, void *data); | ||
197 | extern s32 | ||
198 | wl_cfgp2p_discover_listen(struct wl_priv *wl, s32 channel, u32 duration_ms); | ||
199 | |||
200 | extern s32 | ||
201 | wl_cfgp2p_discover_enable_search(struct wl_priv *wl, u8 enable); | ||
202 | |||
203 | extern s32 | ||
204 | wl_cfgp2p_action_tx_complete(struct wl_priv *wl, struct net_device *ndev, | ||
205 | const wl_event_msg_t *e, void *data); | ||
206 | extern s32 | ||
207 | wl_cfgp2p_tx_action_frame(struct wl_priv *wl, struct net_device *dev, | ||
208 | wl_af_params_t *af_params, s32 bssidx); | ||
209 | |||
210 | extern void | ||
211 | wl_cfgp2p_generate_bss_mac(struct ether_addr *primary_addr, struct ether_addr *out_dev_addr, | ||
212 | struct ether_addr *out_int_addr); | ||
213 | |||
214 | extern void | ||
215 | wl_cfg80211_change_ifaddr(u8* buf, struct ether_addr *p2p_int_addr, u8 element_id); | ||
216 | extern bool | ||
217 | wl_cfgp2p_bss_isup(struct net_device *ndev, int bsscfg_idx); | ||
218 | |||
219 | extern s32 | ||
220 | wl_cfgp2p_bss(struct net_device *ndev, s32 bsscfg_idx, s32 up); | ||
221 | |||
222 | |||
223 | extern s32 | ||
224 | wl_cfgp2p_supported(struct wl_priv *wl, struct net_device *ndev); | ||
225 | |||
226 | extern s32 | ||
227 | wl_cfgp2p_down(struct wl_priv *wl); | ||
228 | |||
229 | extern s32 | ||
230 | wl_cfgp2p_set_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); | ||
231 | |||
232 | extern s32 | ||
233 | wl_cfgp2p_get_p2p_noa(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); | ||
234 | |||
235 | extern s32 | ||
236 | wl_cfgp2p_set_p2p_ps(struct wl_priv *wl, struct net_device *ndev, char* buf, int len); | ||
237 | |||
238 | /* WiFi Direct */ | ||
239 | #define SOCIAL_CHAN_1 1 | ||
240 | #define SOCIAL_CHAN_2 6 | ||
241 | #define SOCIAL_CHAN_3 11 | ||
242 | #define WL_P2P_WILDCARD_SSID "DIRECT-" | ||
243 | #define WL_P2P_WILDCARD_SSID_LEN 7 | ||
244 | #define WL_P2P_INTERFACE_PREFIX "p2p" | ||
245 | #define WL_P2P_TEMP_CHAN "11" | ||
246 | #define IS_P2P_SSID(ssid) (memcmp(ssid, WL_P2P_WILDCARD_SSID, WL_P2P_WILDCARD_SSID_LEN) == 0) | ||
247 | #endif /* _wl_cfgp2p_h_ */ | ||