1 /* 2 * *************************************************************************** 3 * FILE: unifi_sme.h 4 * 5 * PURPOSE: SME related definitions. 6 * 7 * Copyright (C) 2007-2011 by Cambridge Silicon Radio Ltd. 8 * 9 * Refer to LICENSE.txt included with this source code for details on 10 * the license terms. 11 * 12 * *************************************************************************** 13 */ 14 #ifndef __LINUX_UNIFI_SME_H__ 15 #define __LINUX_UNIFI_SME_H__ 1 16 17 #include <linux/kernel.h> 18 19 #ifdef CSR_SME_USERSPACE 20 #include "sme_userspace.h" 21 #endif 22 23 #include "csr_wifi_sme_lib.h" 24 25 typedef int unifi_data_port_action; 26 27 typedef struct unifi_port_cfg 28 { 29 /* TRUE if this port entry is allocated */ 30 u8 in_use; 31 CsrWifiRouterCtrlPortAction port_action; 32 CsrWifiMacAddress mac_address; 33 } unifi_port_cfg_t; 34 35 #define UNIFI_MAX_CONNECTIONS 8 36 #define UNIFI_MAX_RETRY_LIMIT 5 37 #define UF_DATA_PORT_NOT_OVERIDE 0 38 #define UF_DATA_PORT_OVERIDE 1 39 40 typedef struct unifi_port_config 41 { 42 int entries_in_use; 43 int overide_action; 44 unifi_port_cfg_t port_cfg[UNIFI_MAX_CONNECTIONS]; 45 } unifi_port_config_t; 46 47 48 enum sme_request_status { 49 SME_REQUEST_EMPTY, 50 SME_REQUEST_PENDING, 51 SME_REQUEST_RECEIVED, 52 SME_REQUEST_TIMEDOUT, 53 SME_REQUEST_CANCELLED, 54 }; 55 56 /* Structure to hold a UDI logged signal */ 57 typedef struct { 58 59 /* The current status of the request */ 60 enum sme_request_status request_status; 61 62 /* The status the SME has passed to us */ 63 CsrResult reply_status; 64 65 /* SME's reply to a get request */ 66 CsrWifiSmeVersions versions; 67 CsrWifiSmePowerConfig powerConfig; 68 CsrWifiSmeHostConfig hostConfig; 69 CsrWifiSmeStaConfig staConfig; 70 CsrWifiSmeDeviceConfig deviceConfig; 71 CsrWifiSmeCoexInfo coexInfo; 72 CsrWifiSmeCoexConfig coexConfig; 73 CsrWifiSmeMibConfig mibConfig; 74 CsrWifiSmeConnectionInfo connectionInfo; 75 CsrWifiSmeConnectionConfig connectionConfig; 76 CsrWifiSmeConnectionStats connectionStats; 77 78 79 /* SME's reply to a scan request */ 80 u16 reply_scan_results_count; 81 CsrWifiSmeScanResult* reply_scan_results; 82 83 } sme_reply_t; 84 85 86 typedef struct { 87 u16 appHandle; 88 CsrWifiRouterEncapsulation encapsulation; 89 u16 protocol; 90 u8 oui[3]; 91 u8 in_use; 92 } sme_ma_unidata_ind_filter_t; 93 94 95 CsrWifiRouterCtrlPortAction uf_sme_port_state(unifi_priv_t *priv, 96 unsigned char *address, 97 int queue, 98 u16 interfaceTag); 99 unifi_port_cfg_t *uf_sme_port_config_handle(unifi_priv_t *priv, 100 unsigned char *address, 101 int queue, 102 u16 interfaceTag); 103 104 105 106 /* Callback for event logging to SME clients */ 107 void sme_log_event(ul_client_t *client, const u8 *signal, int signal_len, 108 const bulk_data_param_t *bulkdata, int dir); 109 110 /* The workqueue task to the set the multicast addresses list */ 111 void uf_multicast_list_wq(struct work_struct *work); 112 113 /* The workqueue task to execute the TA module */ 114 void uf_ta_wq(struct work_struct *work); 115 116 117 /* 118 * SME blocking helper functions 119 */ 120 #ifdef UNIFI_DEBUG 121 # define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, __func__) 122 #else 123 # define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, NULL) 124 #endif 125 126 void uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func); 127 void uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status); 128 129 130 /* 131 * Blocking functions using the SME SYS API. 132 */ 133 int sme_sys_suspend(unifi_priv_t *priv); 134 int sme_sys_resume(unifi_priv_t *priv); 135 136 137 /* 138 * Traffic Analysis workqueue jobs 139 */ 140 void uf_ta_ind_wq(struct work_struct *work); 141 void uf_ta_sample_ind_wq(struct work_struct *work); 142 143 /* 144 * SME config workqueue job 145 */ 146 void uf_sme_config_wq(struct work_struct *work); 147 148 /* 149 * To send M4 read to send IND 150 */ 151 void uf_send_m4_ready_wq(struct work_struct *work); 152 153 #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) 154 /* 155 * To send data pkt to Sme for encryption 156 */ 157 void uf_send_pkt_to_encrypt(struct work_struct *work); 158 #endif 159 160 int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); 161 int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); 162 int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); 163 int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); 164 int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); 165 int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); 166 int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo); 167 int sme_mgt_packet_filter_set(unifi_priv_t *priv); 168 int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, 169 u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas); 170 171 #ifdef CSR_SUPPORT_WEXT 172 /* 173 * Blocking functions using the SME MGT API. 174 */ 175 int sme_mgt_wifi_on(unifi_priv_t *priv); 176 int sme_mgt_wifi_off(unifi_priv_t *priv); 177 /*int sme_mgt_set_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); 178 int sme_mgt_get_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); 179 int sme_mgt_get_value(unifi_priv_t *priv, unifi_AppValue *app_value); 180 int sme_mgt_set_value(unifi_priv_t *priv, unifi_AppValue *app_value); 181 */ 182 int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); 183 int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); 184 int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); 185 int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); 186 187 int sme_mgt_connection_info_set(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); 188 int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); 189 int sme_mgt_connection_config_set(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); 190 int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); 191 int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats); 192 193 int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions); 194 195 196 int sme_mgt_scan_full(unifi_priv_t *priv, CsrWifiSsid *specific_ssid, 197 int num_channels, unsigned char *channel_list); 198 int sme_mgt_scan_results_get_async(unifi_priv_t *priv, 199 struct iw_request_info *info, 200 char *scan_results, 201 long scan_results_len); 202 int sme_mgt_disconnect(unifi_priv_t *priv); 203 int sme_mgt_connect(unifi_priv_t *priv); 204 int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key, 205 CsrWifiSmeListAction action); 206 int sme_mgt_pmkid(unifi_priv_t *priv, CsrWifiSmeListAction action, 207 CsrWifiSmePmkidList *pmkid_list); 208 int sme_mgt_mib_get(unifi_priv_t *priv, 209 unsigned char *varbind, int *length); 210 int sme_mgt_mib_set(unifi_priv_t *priv, 211 unsigned char *varbind, int length); 212 #ifdef CSR_SUPPORT_WEXT_AP 213 int sme_ap_start(unifi_priv_t *priv,u16 interface_tag,CsrWifiSmeApConfig_t *ap_config); 214 int sme_ap_stop(unifi_priv_t *priv,u16 interface_tag); 215 int sme_ap_config(unifi_priv_t *priv,CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config); 216 int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap); 217 #endif 218 int unifi_translate_scan(struct net_device *dev, 219 struct iw_request_info *info, 220 char *current_ev, char *end_buf, 221 CsrWifiSmeScanResult *scan_data, 222 int scan_index); 223 224 #endif /* CSR_SUPPORT_WEXT */ 225 226 int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg); 227 int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg); 228 int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg); 229 int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg); 230 int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg); 231 int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg); 232 int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg); 233 int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg); 234 int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg); 235 int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg); 236 #ifdef CSR_SUPPORT_WEXT_AP 237 int unifi_cfg_set_ap_config(unifi_priv_t * priv,unsigned char* arg); 238 #endif 239 240 241 242 int convert_sme_error(CsrResult error); 243 244 245 #endif /* __LINUX_UNIFI_SME_H__ */ 246