2 *****************************************************************************
4 * FILE : unifi_native.h
6 * PURPOSE : Private header file for unifi driver support to wireless extensions.
8 * UDI = UniFi Debug Interface
10 * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
12 * Refer to LICENSE.txt included with this source code for details on
15 *****************************************************************************
17 #ifndef __LINUX_UNIFI_NATIVE_H__
18 #define __LINUX_UNIFI_NATIVE_H__ 1
20 #include <linux/kernel.h>
21 #include <linux/if_arp.h>
25 * scan.c wext.c autojoin.c
27 /* Structure to hold results of a scan */
28 typedef struct scan_info {
30 /* CSR_MLME_SCAN_INDICATION msi; */
32 unsigned char *info_elems;
38 #define IE_VECTOR_MAXLEN 1024
40 #ifdef CSR_SUPPORT_WEXT
42 * Structre to hold the wireless network configuration info.
46 /* Requested channel when setting up an adhoc network */
49 /* wireless extns mode: IW_MODE_AUTO, ADHOC, INFRA, MASTER ... MONITOR */
52 /* The capabilities of the currently joined network */
55 /* The interval between beacons if we create an IBSS */
59 * Power-save parameters
61 /* The listen interval to ask for in Associate req. */
62 int assoc_listen_interval;
63 /* Power-mode to put UniFi into */
65 unsigned char desired_ssid[UNIFI_MAX_SSID_LEN]; /* the last ESSID set by SIOCSIWESSID */
67 /* Whether to wake for broadcast packets (using DTIM interval) */
70 /* Currently selected WEP Key ID (0..3) */
73 wep_key_t wep_keys[NUM_WEPKEYS];
75 /* CSR_AUTHENTICATION_TYPE auth_type; */
78 u32 join_failure_timeout;
79 u32 auth_failure_timeout;
80 u32 assoc_failure_timeout;
82 unsigned char generic_ie[IE_VECTOR_MAXLEN];
85 struct iw_statistics wireless_stats;
88 /* the ESSID we are currently associated to */
89 unsigned char current_ssid[UNIFI_MAX_SSID_LEN];
90 /* the BSSID we are currently associated to */
91 unsigned char current_bssid[6];
94 * IW_AUTH_WPA_VERSION_DISABLED 0x00000001
95 * IW_AUTH_WPA_VERSION_WPA 0x00000002
96 * IW_AUTH_WPA_VERSION_WPA2 0x00000004
98 unsigned char wpa_version;
102 * IW_AUTH_CIPHER_NONE 0x00000001
103 * IW_AUTH_CIPHER_WEP40 0x00000002
104 * IW_AUTH_CIPHER_TKIP 0x00000004
105 * IW_AUTH_CIPHER_CCMP 0x00000008
106 * IW_AUTH_CIPHER_WEP104 0x00000010
108 unsigned char pairwise_cipher_used;
109 unsigned char group_cipher_used;
111 unsigned int frag_thresh;
112 unsigned int rts_thresh;
114 /* U-APSD value, send with Association Request to WMM Enabled APs */
115 unsigned char wmm_bss_uapsd_mask;
116 /* The WMM capabilities of the selected BSS */
117 unsigned int bss_wmm_capabilities;
119 /* Flag to prevent a join when the ssid is set */
120 int disable_join_on_ssid_set;
123 #define UNIFI_MAX_SCANS 32
124 scan_info_t scan_list[UNIFI_MAX_SCANS];
127 /* Flag on whether non-802.1x packets are allowed out */
128 /* CsrWifiRouterPortAction block_controlled_port;*/
130 /* Flag on whether we have completed an authenticate/associate process */
131 unsigned int flag_associated : 1;
132 }; /* struct wext_config */
134 #endif /* CSR_SUPPORT_WEXT */
140 /*int mlme_set_protection(unifi_priv_t *priv, unsigned char *addr,
141 CSR_PROTECT_TYPE prot, CSR_KEY_TYPE key_type);
148 void unifi_scan_indication_handler(unifi_priv_t *priv,
149 const CSR_MLME_SCAN_INDICATION *msg,
150 const unsigned char *extra,
153 void unifi_clear_scan_table(unifi_priv_t *priv);
154 scan_info_t *unifi_get_scan_report(unifi_priv_t *priv, int index);
160 const unsigned char *unifi_find_info_element(int id,
161 const unsigned char *info,
163 int unifi_add_info_element(unsigned char *info,
165 const unsigned char *ie_data,
171 /* Higher level fns */
172 int unifi_autojoin(unifi_priv_t *priv, const char *ssid);
174 int unifi_do_scan(unifi_priv_t *priv, int scantype, CSR_BSS_TYPE bsstype,
175 const char *ssid, int ssid_len);
177 int unifi_set_powermode(unifi_priv_t *priv);
178 int unifi_join_ap(unifi_priv_t *priv, scan_info_t *si);
179 int unifi_join_bss(unifi_priv_t *priv, unsigned char *macaddr);
180 int unifi_leave(unifi_priv_t *priv);
181 unsigned int unifi_get_wmm_bss_capabilities(unifi_priv_t *priv,
182 unsigned char *ie_vector,
183 int ie_len, int *ap_capabilities);
186 * Status and management.
188 int uf_init_wext_interface(unifi_priv_t *priv);
189 void uf_deinit_wext_interface(unifi_priv_t *priv);
192 * Function to reset UniFi's 802.11 state by sending MLME-RESET.req
194 int unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, unsigned char set_default_mib);
200 /* Abort an MLME operation - useful in error recovery */
201 int uf_abort_mlme(unifi_priv_t *priv);
203 int unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli,
204 CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs,
206 void unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli,
207 CSR_SIGNAL *signal, int signal_len,
208 const bulk_data_param_t *bulkdata);
213 const char *lookup_reason_code(int reason);
214 const char *lookup_result_code(int result);
220 int uf_sme_init(unifi_priv_t *priv);
221 void uf_sme_deinit(unifi_priv_t *priv);
222 int sme_sys_suspend(unifi_priv_t *priv);
223 int sme_sys_resume(unifi_priv_t *priv);
224 int sme_mgt_wifi_on(unifi_priv_t *priv);
226 /* Callback for event logging to SME clients (unifi_manager) */
227 void sme_native_log_event(ul_client_t *client,
228 const u8 *sig_packed, int sig_len,
229 const bulk_data_param_t *bulkdata,
232 void sme_native_mlme_event_handler(ul_client_t *pcli,
233 const u8 *sig_packed, int sig_len,
234 const bulk_data_param_t *bulkdata,
237 /* Task to query statistics from the MIB */
238 #define UF_SME_STATS_WQ_TIMEOUT 2000 /* in msecs */
239 void uf_sme_stats_wq(struct work_struct *work);
241 void uf_native_process_udi_signal(ul_client_t *pcli,
242 const u8 *packed_signal,
243 int packed_signal_len,
244 const bulk_data_param_t *bulkdata, int dir);
245 #ifdef UNIFI_SNIFF_ARPHRD
249 int uf_start_sniff(unifi_priv_t *priv);
251 void ma_sniffdata_ind(void *ospriv,
252 const CSR_MA_SNIFFDATA_INDICATION *ind,
253 const bulk_data_param_t *bulkdata);
255 #endif /* ARPHRD_IEEE80211_PRISM */
257 #endif /* __LINUX_UNIFI_NATIVE_H__ */