Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2 | #include "coreconfigurator.h" |
| 3 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4 | extern s32 TransportInit(void); |
| 5 | extern s32 TransportDeInit(void); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7 | |
| 8 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 9 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 10 | #endif |
| 11 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 12 | /*BugID_5137*/ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 13 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 14 | /*****************************************************************************/ |
| 15 | /* Macros */ |
| 16 | /*****************************************************************************/ |
| 17 | |
| 18 | /* Message types of the Host IF Message Queue*/ |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 19 | #define HOST_IF_MSG_SCAN 0 |
| 20 | #define HOST_IF_MSG_CONNECT 1 |
| 21 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 22 | #define HOST_IF_MSG_KEY 3 |
| 23 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 24 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 25 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 26 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 27 | #define HOST_IF_MSG_DISCONNECT 8 |
| 28 | #define HOST_IF_MSG_GET_RSSI 9 |
| 29 | #define HOST_IF_MSG_GET_CHNL 10 |
| 30 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 31 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 32 | #define HOST_IF_MSG_ADD_STATION 13 |
| 33 | #define HOST_IF_MSG_DEL_STATION 14 |
| 34 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 35 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 36 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 37 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 38 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 39 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 40 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 41 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 42 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 43 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 44 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 45 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 46 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 47 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 48 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 49 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 50 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 51 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 52 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 53 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 54 | #define HOST_IF_MSG_Q_IDLE 35 |
| 55 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 56 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 57 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 58 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 59 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 60 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 61 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 62 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 63 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 64 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 65 | /*****************************************************************************/ |
| 66 | /* Type Definitions */ |
| 67 | /*****************************************************************************/ |
| 68 | |
| 69 | /*! |
| 70 | * @struct tstrHostIFCfgParamAttr |
| 71 | * @brief Structure to hold Host IF CFG Params Attributes |
| 72 | * @details |
| 73 | * @todo |
| 74 | * @sa |
| 75 | * @author Mai Daftedar |
| 76 | * @date 02 April 2012 |
| 77 | * @version 1.0 |
| 78 | */ |
| 79 | typedef struct _tstrHostIFCfgParamAttr { |
| 80 | tstrCfgParamVal pstrCfgParamVal; |
| 81 | |
| 82 | } tstrHostIFCfgParamAttr; |
| 83 | |
| 84 | /*! |
| 85 | * @struct tstrHostIFwpaAttr |
| 86 | * @brief Structure to hold Host IF Scan Attributes |
| 87 | * @details |
| 88 | * @todo |
| 89 | * @sa |
| 90 | * @author Mai Daftedar |
| 91 | * @date 25 March 2012 |
| 92 | * @version 1.0 |
| 93 | */ |
| 94 | typedef struct _tstrHostIFwpaAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 95 | u8 *pu8key; |
| 96 | const u8 *pu8macaddr; |
| 97 | u8 *pu8seq; |
| 98 | u8 u8seqlen; |
| 99 | u8 u8keyidx; |
| 100 | u8 u8Keylen; |
| 101 | u8 u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 102 | } tstrHostIFwpaAttr; |
| 103 | |
| 104 | |
| 105 | /*! |
| 106 | * @struct tstrHostIFwepAttr |
| 107 | * @brief Structure to hold Host IF Scan Attributes |
| 108 | * @details |
| 109 | * @todo |
| 110 | * @sa |
| 111 | * @author Mai Daftedar |
| 112 | * @date 25 March 2012 |
| 113 | * @version 1.0 |
| 114 | */ |
| 115 | typedef struct _tstrHostIFwepAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 116 | u8 *pu8WepKey; |
| 117 | u8 u8WepKeylen; |
| 118 | u8 u8Wepidx; |
| 119 | u8 u8mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 120 | AUTHTYPE_T tenuAuth_type; |
| 121 | |
| 122 | } tstrHostIFwepAttr; |
| 123 | |
| 124 | /*! |
| 125 | * @struct tuniHostIFkeyAttr |
| 126 | * @brief Structure to hold Host IF Scan Attributes |
| 127 | * @details |
| 128 | * @todo |
| 129 | * @sa |
| 130 | * @author Mai Daftedar |
| 131 | * @date 25 March 2012 |
| 132 | * @version 1.0 |
| 133 | */ |
| 134 | typedef union _tuniHostIFkeyAttr { |
| 135 | tstrHostIFwepAttr strHostIFwepAttr; |
| 136 | tstrHostIFwpaAttr strHostIFwpaAttr; |
| 137 | tstrHostIFpmkidAttr strHostIFpmkidAttr; |
| 138 | } tuniHostIFkeyAttr; |
| 139 | |
| 140 | /*! |
| 141 | * @struct tstrHostIFkeyAttr |
| 142 | * @brief Structure to hold Host IF Scan Attributes |
| 143 | * @details |
| 144 | * @todo |
| 145 | * @sa |
| 146 | * @author Mai Daftedar |
| 147 | * @date 25 March 2012 |
| 148 | * @version 1.0 |
| 149 | */ |
| 150 | typedef struct _tstrHostIFkeyAttr { |
| 151 | tenuKeyType enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 152 | u8 u8KeyAction; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 153 | tuniHostIFkeyAttr uniHostIFkeyAttr; |
| 154 | } tstrHostIFkeyAttr; |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | /*! |
| 160 | * @struct tstrHostIFscanAttr |
| 161 | * @brief Structure to hold Host IF Scan Attributes |
| 162 | * @details |
| 163 | * @todo |
| 164 | * @sa |
| 165 | * @author Mostafa Abu Bakr |
| 166 | * @date 25 March 2012 |
| 167 | * @version 1.0 |
| 168 | */ |
| 169 | typedef struct _tstrHostIFscanAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 170 | u8 u8ScanSource; |
| 171 | u8 u8ScanType; |
| 172 | u8 *pu8ChnlFreqList; |
| 173 | u8 u8ChnlListLen; |
| 174 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 175 | size_t IEsLen; |
| 176 | tWILCpfScanResult pfScanResult; |
| 177 | void *pvUserArg; |
| 178 | /*BugID_4189*/ |
| 179 | tstrHiddenNetwork strHiddenNetwork; |
| 180 | |
| 181 | } tstrHostIFscanAttr; |
| 182 | |
| 183 | /*! |
| 184 | * @struct tstrHostIFconnectAttr |
| 185 | * @brief Structure to hold Host IF Connect Attributes |
| 186 | * @details |
| 187 | * @todo |
| 188 | * @sa |
| 189 | * @author Mostafa Abu Bakr |
| 190 | * @date 25 March 2012 |
| 191 | * @version 1.0 |
| 192 | */ |
| 193 | typedef struct _tstrHostIFconnectAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 194 | u8 *pu8bssid; |
| 195 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 196 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 197 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 199 | u8 u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 200 | tWILCpfConnectResult pfConnectResult; |
| 201 | void *pvUserArg; |
| 202 | AUTHTYPE_T tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 203 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 204 | void *pJoinParams; |
| 205 | } tstrHostIFconnectAttr; |
| 206 | |
| 207 | /*! |
| 208 | * @struct tstrRcvdGnrlAsyncInfo |
| 209 | * @brief Structure to hold Received General Asynchronous info |
| 210 | * @details |
| 211 | * @todo |
| 212 | * @sa |
| 213 | * @author Mostafa Abu Bakr |
| 214 | * @date 25 March 2012 |
| 215 | * @version 1.0 |
| 216 | */ |
| 217 | typedef struct _tstrRcvdGnrlAsyncInfo { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 218 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 219 | u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 220 | } tstrRcvdGnrlAsyncInfo; |
| 221 | |
| 222 | /*! |
| 223 | * @struct tstrHostIFSetChan |
| 224 | * @brief Set Channel message body |
| 225 | * @details |
| 226 | * @todo |
| 227 | * @sa |
| 228 | * @author Mai Daftedar |
| 229 | * @date 25 March 2012 |
| 230 | * @version 1.0 |
| 231 | */ |
| 232 | typedef struct _tstrHostIFSetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 233 | u8 u8SetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 234 | } tstrHostIFSetChan; |
| 235 | |
| 236 | /*! |
| 237 | * @struct tstrHostIFSetChan |
| 238 | * @brief Get Channel message body |
| 239 | * @details |
| 240 | * @todo |
| 241 | * @sa |
| 242 | * @author Mai Daftedar |
| 243 | * @date 01 Jule 2012 |
| 244 | * @version 1.0 |
| 245 | */ |
| 246 | typedef struct _tstrHostIFGetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 247 | u8 u8GetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 248 | } tstrHostIFGetChan; |
| 249 | |
| 250 | /*bug3819: Add Scan acomplete notification to host*/ |
| 251 | /*! |
| 252 | * @struct tstrScanComplete |
| 253 | * @brief hold received Async. Scan Complete message body |
| 254 | * @details |
| 255 | * @todo |
| 256 | * @sa |
| 257 | * @author zsalah |
| 258 | * @date 25 March 2012 |
| 259 | * @version 1.0 |
| 260 | */ |
| 261 | /*typedef struct _tstrScanComplete |
| 262 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 263 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 264 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 265 | * } tstrScanComplete;*/ |
| 266 | |
| 267 | /*! |
| 268 | * @struct tstrHostIFSetBeacon |
| 269 | * @brief Set Beacon message body |
| 270 | * @details |
| 271 | * @todo |
| 272 | * @sa |
| 273 | * @author Adham Abozaeid |
| 274 | * @date 10 July 2012 |
| 275 | * @version 1.0 |
| 276 | */ |
| 277 | typedef struct _tstrHostIFSetBeacon { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 278 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 279 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 280 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 281 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 282 | u8 *pu8Head; /*!< Pointer to the beacon's head buffer. Beacon's head is the part |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 283 | * from the beacon's start till the TIM element, NOT including the TIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 284 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 285 | u8 *pu8Tail; /*!< Pointer to the beacon's tail buffer. Beacon's tail starts just |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 286 | * after the TIM inormation element */ |
| 287 | } tstrHostIFSetBeacon; |
| 288 | |
| 289 | |
| 290 | |
| 291 | /*! |
| 292 | * @struct tstrHostIFDelBeacon |
| 293 | * @brief Del Beacon message body |
| 294 | * @details |
| 295 | * @todo |
| 296 | * @sa |
| 297 | * @author Adham Abozaeid |
| 298 | * @date 15 July 2012 |
| 299 | * @version 1.0 |
| 300 | */ |
| 301 | typedef struct _tstrHostIFDelBeacon { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 302 | u8 u8dummy; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 303 | } tstrHostIFDelBeacon; |
| 304 | |
| 305 | /*! |
| 306 | * @struct tstrHostIFSetMulti |
| 307 | * @brief set Multicast filter Address |
| 308 | * @details |
| 309 | * @todo |
| 310 | * @sa |
| 311 | * @author Abdelrahman Sobhy |
| 312 | * @date 30 August 2013 |
| 313 | * @version 1.0 Description |
| 314 | */ |
| 315 | |
| 316 | typedef struct { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 317 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 318 | u32 u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 319 | } tstrHostIFSetMulti; |
| 320 | |
| 321 | /*! |
| 322 | * @struct tstrHostIFDelAllSta |
| 323 | * @brief Deauth station message body |
| 324 | * @details |
| 325 | * @todo |
| 326 | * @sa |
| 327 | * @author Mai Daftedar |
| 328 | * @date 09 April 2014 |
| 329 | * @version 1.0 Description |
| 330 | */ |
| 331 | |
| 332 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 333 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 334 | u8 u8Num_AssocSta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 335 | } tstrHostIFDelAllSta; |
| 336 | |
| 337 | /*! |
| 338 | * @struct tstrHostIFDelSta |
| 339 | * @brief Delete station message body |
| 340 | * @details |
| 341 | * @todo |
| 342 | * @sa |
| 343 | * @author Adham Abozaeid |
| 344 | * @date 15 July 2012 |
| 345 | * @version 1.0 Description |
| 346 | */ |
| 347 | |
| 348 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 349 | u8 au8MacAddr[ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 350 | } tstrHostIFDelSta; |
| 351 | |
| 352 | /*! |
| 353 | * @struct tstrTimerCb |
| 354 | * @brief Timer callback message body |
| 355 | * @details |
| 356 | * @todo |
| 357 | * @sa |
| 358 | * @author Mostafa Abu Bakr |
| 359 | * @date 25 March 2012 |
| 360 | * @version 1.0 |
| 361 | */ |
| 362 | typedef struct _tstrTimerCb { |
| 363 | void *pvUsrArg; /*!< Private data passed at timer start */ |
| 364 | } tstrTimerCb; |
| 365 | |
| 366 | /*! |
| 367 | * @struct tstrHostIfPowerMgmtParam |
| 368 | * @brief Power management message body |
| 369 | * @details |
| 370 | * @todo |
| 371 | * @sa |
| 372 | * @author Adham Abozaeid |
| 373 | * @date 24 November 2012 |
| 374 | * @version 1.0 |
| 375 | */ |
| 376 | typedef struct { |
| 377 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 378 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 379 | u32 u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 380 | } tstrHostIfPowerMgmtParam; |
| 381 | |
| 382 | /*! |
| 383 | * @struct tstrHostIFSetIPAddr |
| 384 | * @brief set IP Address message body |
| 385 | * @details |
| 386 | * @todo |
| 387 | * @sa |
| 388 | * @author Abdelrahman Sobhy |
| 389 | * @date 30 August 2013 |
| 390 | * @version 1.0 Description |
| 391 | */ |
| 392 | |
| 393 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 394 | u8 *au8IPAddr; |
| 395 | u8 idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 396 | } tstrHostIFSetIPAddr; |
| 397 | |
| 398 | /*! |
| 399 | * @struct tstrHostIfStaInactiveT |
| 400 | * @brief Get station message body |
| 401 | * @details |
| 402 | * @todo |
| 403 | * @sa |
| 404 | * @author Mai Daftedar |
| 405 | * @date 16 April 2013 |
| 406 | * @version 1.0 |
| 407 | */ |
| 408 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 409 | u8 mac[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 410 | |
| 411 | } tstrHostIfStaInactiveT; |
| 412 | /**/ |
| 413 | /*! |
| 414 | * @union tuniHostIFmsgBody |
| 415 | * @brief Message body for the Host Interface message_q |
| 416 | * @details |
| 417 | * @todo |
| 418 | * @sa |
| 419 | * @author Mostafa Abu Bakr |
| 420 | * @date 25 March 2012 |
| 421 | * @version 1.0 |
| 422 | */ |
| 423 | typedef union _tuniHostIFmsgBody { |
| 424 | tstrHostIFscanAttr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */ |
| 425 | tstrHostIFconnectAttr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */ |
| 426 | tstrRcvdNetworkInfo strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */ |
| 427 | tstrRcvdGnrlAsyncInfo strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */ |
| 428 | tstrHostIFkeyAttr strHostIFkeyAttr; /*!<>*/ |
| 429 | tstrHostIFCfgParamAttr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */ |
| 430 | tstrHostIFSetChan strHostIFSetChan; |
| 431 | tstrHostIFGetChan strHostIFGetChan; |
| 432 | tstrHostIFSetBeacon strHostIFSetBeacon; /*!< Set beacon message body */ |
| 433 | tstrHostIFDelBeacon strHostIFDelBeacon; /*!< Del beacon message body */ |
| 434 | tstrWILC_AddStaParam strAddStaParam; /*!< Add station message body */ |
| 435 | tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */ |
| 436 | tstrWILC_AddStaParam strEditStaParam; /*!< Edit station message body */ |
| 437 | /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */ |
| 438 | tstrTimerCb strTimerCb; /*!< Timer callback message body */ |
| 439 | tstrHostIfPowerMgmtParam strPowerMgmtparam; /*!< Power Management message body */ |
| 440 | tstrHostIfStaInactiveT strHostIfStaInactiveT; |
| 441 | tstrHostIFSetIPAddr strHostIfSetIP; |
| 442 | tstrHostIfSetDrvHandler strHostIfSetDrvHandler; |
| 443 | tstrHostIFSetMulti strHostIfSetMulti; |
| 444 | tstrHostIfSetOperationMode strHostIfSetOperationMode; |
| 445 | tstrHostIfSetMacAddress strHostIfSetMacAddress; |
| 446 | tstrHostIfGetMacAddress strHostIfGetMacAddress; |
| 447 | tstrHostIfBASessionInfo strHostIfBASessionInfo; |
| 448 | #ifdef WILC_P2P |
| 449 | tstrHostIfRemainOnChan strHostIfRemainOnChan; |
| 450 | tstrHostIfRegisterFrame strHostIfRegisterFrame; |
| 451 | #endif |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 452 | char *pUserData; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 453 | tstrHostIFDelAllSta strHostIFDelAllSta; |
| 454 | } tuniHostIFmsgBody; |
| 455 | |
| 456 | /*! |
| 457 | * @struct tstrHostIFmsg |
| 458 | * @brief Host Interface message |
| 459 | * @details |
| 460 | * @todo |
| 461 | * @sa |
| 462 | * @author Mostafa Abu Bakr |
| 463 | * @date 25 March 2012 |
| 464 | * @version 1.0 |
| 465 | */ |
| 466 | typedef struct _tstrHostIFmsg { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 467 | u16 u16MsgId; /*!< Message ID */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 468 | tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 469 | tstrWILC_WFIDrv *drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | } tstrHostIFmsg; |
| 471 | |
| 472 | #ifdef CONNECT_DIRECT |
| 473 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 474 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 475 | u8 u8channel; |
| 476 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 477 | } tstrWidJoinReqExt; |
| 478 | #endif |
| 479 | |
| 480 | /*Bug4218: Parsing Join Param*/ |
| 481 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 482 | /*Struct containg joinParam of each AP*/ |
| 483 | typedef struct _tstrJoinBssParam { |
| 484 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 485 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 486 | u16 beacon_period; |
| 487 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 488 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 489 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 490 | u8 ssidLen; |
| 491 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 492 | u8 ht_capable; |
| 493 | u8 wmm_cap; |
| 494 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 495 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 496 | u8 rsn_grp_policy; |
| 497 | u8 mode_802_11i; |
| 498 | u8 rsn_pcip_policy[3]; |
| 499 | u8 rsn_auth_policy[3]; |
| 500 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 501 | struct _tstrJoinParam *nextJoinBss; |
| 502 | #ifdef WILC_P2P |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 503 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 504 | u8 u8NoaEnbaled; |
| 505 | u8 u8OppEnable; |
| 506 | u8 u8CtWindow; |
| 507 | u8 u8Count; |
| 508 | u8 u8Index; |
| 509 | u8 au8Duration[4]; |
| 510 | u8 au8Interval[4]; |
| 511 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 512 | #endif |
| 513 | } tstrJoinBssParam; |
| 514 | /*Bug4218: Parsing Join Param*/ |
| 515 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 516 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 517 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 518 | tstrJoinBssParam *head; |
| 519 | tstrJoinBssParam *tail; |
| 520 | } tstrBssTable; |
| 521 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 522 | |
| 523 | typedef enum { |
| 524 | SCAN_TIMER = 0, |
| 525 | CONNECT_TIMER = 1, |
| 526 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 527 | } tenuScanConnTimer; |
| 528 | |
| 529 | /*****************************************************************************/ |
| 530 | /* */ |
| 531 | /* Global Variabls */ |
| 532 | /* */ |
| 533 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 534 | /* Zero is not used, because a zero ID means termination */ |
| 535 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 536 | tstrWILC_WFIDrv *terminated_handle; |
| 537 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 538 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 539 | bool g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 540 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 541 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 542 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 544 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 545 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 546 | struct semaphore hSemDeinitDrvHandle; |
| 547 | static struct semaphore hWaitResponse; |
| 548 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 549 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 550 | |
| 551 | |
| 552 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 553 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 554 | |
| 555 | #ifndef CONNECT_DIRECT |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 556 | static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 557 | #endif |
| 558 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 559 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 561 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 562 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 563 | static s8 gs8Rssi; |
| 564 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 565 | static u8 gu8Chnl; |
| 566 | static u8 gs8SetIP[2][4]; |
| 567 | static u8 gs8GetIP[2][4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 568 | #ifdef WILC_AP_EXTERNAL_MLME |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 569 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 570 | static u8 gu8DelBcn; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | #endif |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 572 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 573 | |
| 574 | /*BugID_5137*/ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 575 | u8 *gu8FlushedJoinReq; |
| 576 | u8 *gu8FlushedInfoElemAsoc; |
| 577 | u8 gu8Flushed11iMode; |
| 578 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 579 | u32 gu32FlushedJoinReqSize; |
| 580 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 581 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 582 | #define REAL_JOIN_REQ 0 |
| 583 | #define FLUSHED_JOIN_REQ 1 |
| 584 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 585 | |
| 586 | /*Bug4218: Parsing Join Param*/ |
| 587 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 588 | /*Bug4218: Parsing Join Param*/ |
| 589 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
| 590 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 591 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 592 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 593 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 594 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 595 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 596 | { |
| 597 | int i; |
| 598 | |
| 599 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 600 | if (!wfidrv_list[i]) { |
| 601 | wfidrv_list[i] = handler; |
| 602 | return 0; |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | return -ENOBUFS; |
| 607 | } |
| 608 | |
| 609 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) |
| 610 | { |
| 611 | int i; |
| 612 | |
| 613 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 614 | if (wfidrv_list[i] == handler) { |
| 615 | wfidrv_list[i] = NULL; |
| 616 | return 0; |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | return -EINVAL; |
| 621 | } |
| 622 | |
| 623 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 624 | { |
| 625 | int i; |
| 626 | |
| 627 | if (!handler) |
| 628 | return 0; |
| 629 | |
| 630 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 631 | if (wfidrv_list[i] == handler) |
| 632 | return i; |
| 633 | } |
| 634 | |
| 635 | return 0; |
| 636 | } |
| 637 | |
| 638 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 639 | { |
| 640 | if (id <= 0 || id > ARRAY_SIZE(wfidrv_list)) |
| 641 | return NULL; |
| 642 | return wfidrv_list[id]; |
| 643 | } |
| 644 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 645 | /** |
| 646 | * @brief Handle_SetChannel |
| 647 | * @details Sending config packet to firmware to set channel |
| 648 | * @param[in] tstrHostIFSetChan* pstrHostIFSetChan |
| 649 | * @return Error code. |
| 650 | * @author |
| 651 | * @date |
| 652 | * @version 1.0 |
| 653 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 654 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 655 | { |
| 656 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 657 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 658 | tstrWID strWID; |
| 659 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 660 | |
| 661 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 662 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 663 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 664 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 665 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 666 | |
| 667 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 668 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 669 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 670 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 671 | if (s32Error) { |
| 672 | PRINT_ER("Failed to set channel\n"); |
| 673 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 674 | } |
| 675 | WILC_CATCH(s32Error) |
| 676 | { |
| 677 | |
| 678 | } |
| 679 | |
| 680 | return s32Error; |
| 681 | } |
| 682 | /** |
| 683 | * @brief Handle_SetWfiDrvHandler |
| 684 | * @details Sending config packet to firmware to set driver handler |
| 685 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 686 | * @return Error code. |
| 687 | * @author |
| 688 | * @date |
| 689 | * @version 1.0 |
| 690 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 691 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
| 692 | tstrHostIfSetDrvHandler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 693 | { |
| 694 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 695 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 696 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 697 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 698 | |
| 699 | |
| 700 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 701 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 702 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 703 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 704 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 705 | |
| 706 | /*Sending Cfg*/ |
| 707 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 708 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 709 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 710 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 711 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 712 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 713 | |
| 714 | |
| 715 | if (s32Error) { |
| 716 | PRINT_ER("Failed to set driver handler\n"); |
| 717 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 718 | } |
| 719 | WILC_CATCH(s32Error) |
| 720 | { |
| 721 | |
| 722 | } |
| 723 | |
| 724 | return s32Error; |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * @brief Handle_SetWfiAPDrvHandler |
| 729 | * @details Sending config packet to firmware to set driver handler |
| 730 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 731 | * @return Error code. |
| 732 | * @author |
| 733 | * @date |
| 734 | * @version 1.0 |
| 735 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 736 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 737 | { |
| 738 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 739 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 740 | tstrWID strWID; |
| 741 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 742 | |
| 743 | |
| 744 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 745 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 746 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 747 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 748 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 749 | |
| 750 | /*Sending Cfg*/ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 751 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 752 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 753 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 754 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 755 | |
| 756 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 757 | if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 758 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 759 | |
| 760 | |
| 761 | if (s32Error) { |
| 762 | PRINT_ER("Failed to set driver handler\n"); |
| 763 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 764 | } |
| 765 | WILC_CATCH(s32Error) |
| 766 | { |
| 767 | |
| 768 | } |
| 769 | |
| 770 | return s32Error; |
| 771 | } |
| 772 | |
| 773 | /** |
| 774 | * @brief host_int_set_IPAddress |
| 775 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 776 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 777 | * @return Error code. |
| 778 | * @author |
| 779 | * @date |
| 780 | * @version 1.0 |
| 781 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 782 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 783 | { |
| 784 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 785 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 786 | tstrWID strWID; |
| 787 | char firmwareIPAddress[4] = {0}; |
| 788 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 789 | |
| 790 | if (pu8IPAddr[0] < 192) |
| 791 | pu8IPAddr[0] = 0; |
| 792 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 793 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 794 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 795 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 796 | |
| 797 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 798 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 799 | strWID.enuWIDtype = WID_STR; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 800 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 801 | strWID.s32ValueSize = IP_ALEN; |
| 802 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 803 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 804 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | |
| 806 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 807 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 808 | |
| 809 | if (s32Error) { |
| 810 | PRINT_D(HOSTINF_DBG, "Failed to set IP address\n"); |
| 811 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 812 | } else { |
| 813 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
| 814 | } |
| 815 | |
| 816 | WILC_CATCH(s32Error) |
| 817 | { |
| 818 | |
| 819 | } |
| 820 | |
| 821 | return s32Error; |
| 822 | } |
| 823 | |
| 824 | |
| 825 | /** |
| 826 | * @brief Handle_get_IPAddress |
| 827 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 828 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 829 | * @return Error code. |
| 830 | * @author |
| 831 | * @date |
| 832 | * @version 1.0 |
| 833 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 834 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | { |
| 836 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 837 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 838 | tstrWID strWID; |
| 839 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 840 | |
| 841 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 842 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 843 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 844 | strWID.ps8WidVal = WILC_MALLOC(IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 845 | strWID.s32ValueSize = IP_ALEN; |
| 846 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 847 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 848 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 849 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 850 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 851 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 852 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 853 | |
| 854 | /*get the value by searching the local copy*/ |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 855 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 856 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 857 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 858 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 859 | |
| 860 | if (s32Error != WILC_SUCCESS) { |
| 861 | PRINT_ER("Failed to get IP address\n"); |
| 862 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 863 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 864 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 865 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 866 | PRINT_INFO(HOSTINF_DBG, "\n"); |
| 867 | } |
| 868 | |
| 869 | WILC_CATCH(s32Error) |
| 870 | { |
| 871 | |
| 872 | } |
| 873 | |
| 874 | return s32Error; |
| 875 | } |
| 876 | |
| 877 | |
| 878 | /*BugId_5077*/ |
| 879 | /** |
| 880 | * @brief Handle_SetMacAddress |
| 881 | * @details Setting mac address |
| 882 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 883 | * @return Error code. |
| 884 | * @author Amr Abdel-Moghny |
| 885 | * @date November 2013 |
| 886 | * @version 7.0 |
| 887 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 888 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 889 | { |
| 890 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 891 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 892 | tstrWID strWID; |
| 893 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 894 | u8 *mac_buf = WILC_MALLOC(ETH_ALEN); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 895 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 896 | if (mac_buf == NULL) { |
| 897 | PRINT_ER("No buffer to send mac address\n"); |
| 898 | return WILC_FAIL; |
| 899 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 900 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 901 | |
| 902 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 903 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 904 | strWID.enuWIDtype = WID_STR; |
| 905 | strWID.ps8WidVal = mac_buf; |
| 906 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 907 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 908 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 909 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 910 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 911 | if (s32Error) { |
| 912 | PRINT_ER("Failed to set mac address\n"); |
| 913 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 914 | } |
| 915 | |
| 916 | WILC_CATCH(s32Error) |
| 917 | { |
| 918 | |
| 919 | } |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 920 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 921 | return s32Error; |
| 922 | } |
| 923 | |
| 924 | |
| 925 | /*BugID_5213*/ |
| 926 | /** |
| 927 | * @brief Handle_GetMacAddress |
| 928 | * @details Getting mac address |
| 929 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 930 | * @return Error code. |
| 931 | * @author Amr Abdel-Moghny |
| 932 | * @date JAN 2013 |
| 933 | * @version 8.0 |
| 934 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 935 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 936 | { |
| 937 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 938 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 939 | tstrWID strWID; |
| 940 | |
| 941 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 942 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 943 | strWID.enuWIDtype = WID_STR; |
| 944 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 945 | strWID.s32ValueSize = ETH_ALEN; |
| 946 | |
| 947 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 948 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, |
| 949 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 950 | if (s32Error) { |
| 951 | PRINT_ER("Failed to get mac address\n"); |
| 952 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 953 | } |
| 954 | WILC_CATCH(s32Error) |
| 955 | { |
| 956 | |
| 957 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 958 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 959 | |
| 960 | return s32Error; |
| 961 | } |
| 962 | |
| 963 | |
| 964 | /** |
| 965 | * @brief Handle_CfgParam |
| 966 | * @details Sending config packet to firmware to set CFG params |
| 967 | * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr |
| 968 | * @return Error code. |
| 969 | * @author |
| 970 | * @date |
| 971 | * @version 1.0 |
| 972 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 973 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 975 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 976 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 977 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 978 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 979 | |
| 980 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 981 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 982 | |
| 983 | |
| 984 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 985 | |
| 986 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 987 | /*----------------------------------------------------------*/ |
| 988 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 989 | /* INDEPENDENT= 2, */ |
| 990 | /* ANY_BSS= 3 */ |
| 991 | /*----------------------------------------------------------*/ |
| 992 | /* validate input then copy>> need to check value 4 and 5 */ |
| 993 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 994 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 995 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 996 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 997 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 998 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 999 | } else { |
| 1000 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1001 | } |
| 1002 | u8WidCnt++; |
| 1003 | } |
| 1004 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 1005 | /*------------------------------------------------------*/ |
| 1006 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 1007 | /* SHARED_KEY = 1, */ |
| 1008 | /* ANY = 2 */ |
| 1009 | /*------------------------------------------------------*/ |
| 1010 | /*validate Possible values*/ |
| 1011 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 1012 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1013 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1014 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1015 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1016 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1017 | } else { |
| 1018 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1019 | } |
| 1020 | u8WidCnt++; |
| 1021 | } |
| 1022 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 1023 | /* range is 1 to 65535. */ |
| 1024 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 1025 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1026 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1027 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1028 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1029 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 1030 | } else { |
| 1031 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1032 | } |
| 1033 | u8WidCnt++; |
| 1034 | } |
| 1035 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 1036 | /*-----------------------------------------------------------*/ |
| 1037 | /*Input Values: NO_POWERSAVE = 0, */ |
| 1038 | /* MIN_FAST_PS = 1, */ |
| 1039 | /* MAX_FAST_PS = 2, */ |
| 1040 | /* MIN_PSPOLL_PS = 3, */ |
| 1041 | /* MAX_PSPOLL_PS = 4 */ |
| 1042 | /*----------------------------------------------------------*/ |
| 1043 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 1044 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1045 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1046 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1047 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1048 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1049 | } else { |
| 1050 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1051 | } |
| 1052 | u8WidCnt++; |
| 1053 | } |
| 1054 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 1055 | /* range from 1 to 256 */ |
| 1056 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 1057 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1058 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1059 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1060 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1061 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 1062 | } else { |
| 1063 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1064 | } |
| 1065 | u8WidCnt++; |
| 1066 | } |
| 1067 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 1068 | /* range from 1 to 256 */ |
| 1069 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 1070 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1071 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1072 | |
| 1073 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1074 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 1076 | } else { |
| 1077 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1078 | } |
| 1079 | u8WidCnt++; |
| 1080 | } |
| 1081 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 1082 | |
| 1083 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 1084 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1085 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1087 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1088 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 1089 | } else { |
| 1090 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1091 | } |
| 1092 | u8WidCnt++; |
| 1093 | } |
| 1094 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 1095 | /* range 256 to 65535 */ |
| 1096 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1097 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1098 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1099 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1100 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1101 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1102 | } else { |
| 1103 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1104 | } |
| 1105 | u8WidCnt++; |
| 1106 | } |
| 1107 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1108 | /*-----------------------------------------------------*/ |
| 1109 | /*Input Values: Short= 0, */ |
| 1110 | /* Long= 1, */ |
| 1111 | /* Auto= 2 */ |
| 1112 | /*------------------------------------------------------*/ |
| 1113 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1114 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1115 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1116 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1117 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1118 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1119 | } else { |
| 1120 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1121 | } |
| 1122 | u8WidCnt++; |
| 1123 | } |
| 1124 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { |
| 1125 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1126 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1127 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1128 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1129 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1130 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1131 | } else { |
| 1132 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1133 | } |
| 1134 | u8WidCnt++; |
| 1135 | } |
| 1136 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1137 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1138 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1139 | /* this information is useful for external supplicant */ |
| 1140 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1141 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1142 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1143 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1144 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1145 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1146 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1147 | } else { |
| 1148 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1149 | } |
| 1150 | u8WidCnt++; |
| 1151 | } |
| 1152 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1153 | /* range is 1 to 65535. */ |
| 1154 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1155 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1156 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1157 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1158 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1160 | } else { |
| 1161 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1162 | } |
| 1163 | u8WidCnt++; |
| 1164 | } |
| 1165 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1166 | /* range is 1 to 255. */ |
| 1167 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1168 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1169 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1170 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1171 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1172 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1173 | } else { |
| 1174 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1175 | } |
| 1176 | u8WidCnt++; |
| 1177 | } |
| 1178 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1179 | /*----------------------------------------------------------------------*/ |
| 1180 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1181 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1182 | /* SITE_SURVEY_OFF = 2 */ |
| 1183 | /*----------------------------------------------------------------------*/ |
| 1184 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1185 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1186 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1187 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1188 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1189 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1190 | } else { |
| 1191 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1192 | } |
| 1193 | u8WidCnt++; |
| 1194 | } |
| 1195 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1196 | /* range is 1 to 65535. */ |
| 1197 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1198 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1199 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1200 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1201 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1202 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1203 | } else { |
| 1204 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1205 | } |
| 1206 | u8WidCnt++; |
| 1207 | } |
| 1208 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1209 | /* range is 1 to 65535. */ |
| 1210 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1211 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1212 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1213 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1214 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1215 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1216 | } else { |
| 1217 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1218 | } |
| 1219 | u8WidCnt++; |
| 1220 | } |
| 1221 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1222 | /* range is 1 to 65535. */ |
| 1223 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1224 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1225 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1226 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1227 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1228 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1229 | } else { |
| 1230 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1231 | } |
| 1232 | u8WidCnt++; |
| 1233 | } |
| 1234 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
| 1235 | CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
| 1236 | /*----------------------------------------------------------------------*/ |
| 1237 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1238 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1239 | /*----------------------------------------------------------------------*/ |
| 1240 | /* validate rate */ |
| 1241 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1242 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1243 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1244 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1245 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1246 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1247 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1248 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1249 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1250 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1251 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1252 | } else { |
| 1253 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1254 | } |
| 1255 | u8WidCnt++; |
| 1256 | } |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 1257 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1258 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1259 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1260 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1261 | PRINT_ER("Error in setting CFG params\n"); |
| 1262 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1263 | WILC_CATCH(s32Error) |
| 1264 | { |
| 1265 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1266 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1267 | return s32Error; |
| 1268 | } |
| 1269 | |
| 1270 | |
| 1271 | /** |
| 1272 | * @brief Handle_wait_msg_q_empty |
| 1273 | * @details this should be the last msg and then the msg Q becomes idle |
| 1274 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1275 | * @return Error code. |
| 1276 | * @author |
| 1277 | * @date |
| 1278 | * @version 1.0 |
| 1279 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1280 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1281 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1282 | s32 s32Error = WILC_SUCCESS; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1283 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1284 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1285 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1286 | return s32Error; |
| 1287 | } |
| 1288 | |
| 1289 | /** |
| 1290 | * @brief Handle_Scan |
| 1291 | * @details Sending config packet to firmware to set the scan params |
| 1292 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1293 | * @return Error code. |
| 1294 | * @author |
| 1295 | * @date |
| 1296 | * @version 1.0 |
| 1297 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1298 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1299 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1300 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1301 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1302 | u32 u32WidsCount = 0; |
| 1303 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1304 | u8 *pu8Buffer; |
| 1305 | u8 valuesize = 0; |
| 1306 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1307 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1308 | |
| 1309 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1310 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1311 | |
| 1312 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1313 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1314 | |
| 1315 | #ifdef WILC_P2P |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1316 | #endif |
| 1317 | |
| 1318 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1319 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1320 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate); |
| 1321 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 1322 | } |
| 1323 | |
| 1324 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 1325 | if (g_obtainingIP || connecting) { |
| 1326 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
| 1327 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 1328 | } |
| 1329 | #endif |
| 1330 | |
| 1331 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1332 | |
| 1333 | |
| 1334 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1335 | |
| 1336 | /*BugID_4189*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1337 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1338 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1339 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1340 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1341 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1342 | pu8HdnNtwrksWidVal = WILC_MALLOC(valuesize + 1); |
| 1343 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1344 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1345 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1346 | |
| 1347 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1348 | |
| 1349 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1350 | |
| 1351 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1352 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1353 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1354 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1355 | } |
| 1356 | |
| 1357 | |
| 1358 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1359 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1360 | u32WidsCount++; |
| 1361 | } |
| 1362 | |
| 1363 | /*filling cfg param array*/ |
| 1364 | |
| 1365 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1366 | { |
| 1367 | /* IEs to be inserted in Probe Request */ |
| 1368 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1369 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1370 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1371 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1372 | u32WidsCount++; |
| 1373 | } |
| 1374 | |
| 1375 | /*Scan Type*/ |
| 1376 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1377 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1378 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1379 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1380 | u32WidsCount++; |
| 1381 | |
| 1382 | /*list of channels to be scanned*/ |
| 1383 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1384 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1385 | |
| 1386 | /* Bug 4648: Convert channel numbers to start from 0 not 1. */ |
| 1387 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1388 | int i; |
| 1389 | |
| 1390 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1391 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1392 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1397 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1398 | u32WidsCount++; |
| 1399 | |
| 1400 | /*Scan Request*/ |
| 1401 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1402 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1403 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1404 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1405 | u32WidsCount++; |
| 1406 | |
| 1407 | /*keep the state as is , no need to change it*/ |
| 1408 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1409 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1410 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1411 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1412 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1413 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1414 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 1415 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1416 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1417 | |
| 1418 | if (s32Error) { |
| 1419 | PRINT_ER("Failed to send scan paramters config packet\n"); |
| 1420 | WILC_ERRORREPORT(s32Error, s32Error); |
| 1421 | } else { |
| 1422 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
| 1423 | } |
| 1424 | |
| 1425 | WILC_CATCH(s32Error) |
| 1426 | { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1427 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1428 | /*if there is an ongoing scan request*/ |
| 1429 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1430 | } |
| 1431 | |
| 1432 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1433 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1434 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1435 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1436 | } |
| 1437 | |
| 1438 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1439 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1440 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1441 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1442 | } |
| 1443 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1444 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1445 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1446 | } |
| 1447 | |
| 1448 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1449 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1450 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1451 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1452 | } |
| 1453 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1454 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1455 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1456 | |
| 1457 | return s32Error; |
| 1458 | } |
| 1459 | |
| 1460 | /** |
| 1461 | * @brief Handle_ScanDone |
| 1462 | * @details Call scan notification callback function |
| 1463 | * @param[in] NONE |
| 1464 | * @return Error code. |
| 1465 | * @author |
| 1466 | * @date |
| 1467 | * @version 1.0 |
| 1468 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1469 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1470 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1471 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1472 | |
| 1473 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1474 | |
| 1475 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1476 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1477 | tstrWID strWID; |
| 1478 | |
| 1479 | |
| 1480 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1481 | |
| 1482 | /*BugID_4978*/ |
| 1483 | /*Ask FW to abort the running scan, if any*/ |
| 1484 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1485 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1486 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1487 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1488 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1489 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1490 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1491 | |
| 1492 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 1493 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 1494 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1495 | if (s32Error != WILC_SUCCESS) { |
| 1496 | PRINT_ER("Failed to set abort running scan\n"); |
| 1497 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 1498 | } |
| 1499 | WILC_CATCH(s32Error) |
| 1500 | { |
| 1501 | } |
| 1502 | } |
| 1503 | |
| 1504 | if (pstrWFIDrv == NULL) { |
| 1505 | PRINT_ER("Driver handler is NULL\n"); |
| 1506 | return s32Error; |
| 1507 | } |
| 1508 | |
| 1509 | /*if there is an ongoing scan request*/ |
| 1510 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1511 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1512 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1513 | /*delete current scan request*/ |
| 1514 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1515 | } |
| 1516 | |
| 1517 | return s32Error; |
| 1518 | } |
| 1519 | |
| 1520 | /** |
| 1521 | * @brief Handle_Connect |
| 1522 | * @details Sending config packet to firmware to starting connection |
| 1523 | * @param[in] tstrHostIFconnectAttr* pstrHostIFconnectAttr |
| 1524 | * @return Error code. |
| 1525 | * @author |
| 1526 | * @date |
| 1527 | * @version 1.0 |
| 1528 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1529 | u8 u8ConnectedSSID[6] = {0}; |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1530 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1531 | { |
| 1532 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1533 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1534 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1535 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1536 | /* char passphrase[] = "12345678"; */ |
| 1537 | #ifndef CONNECT_DIRECT |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1538 | s32 s32Err = WILC_SUCCESS; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1539 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1540 | u8 u8bssDscListIndex; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1541 | wid_site_survey_reslts_s *pstrSurveyResults = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1542 | #else |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1543 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | /*Bug4218: Parsing Join Param*/ |
| 1545 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1546 | tstrJoinBssParam *ptstrJoinBssParam; |
| 1547 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1548 | |
| 1549 | #endif |
| 1550 | |
| 1551 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1552 | |
| 1553 | #ifndef CONNECT_DIRECT |
Hari Prasath Gujulan Elango | 3a79a7f | 2015-08-20 09:59:44 +0000 | [diff] [blame] | 1554 | memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1555 | |
| 1556 | |
| 1557 | PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 1558 | s32Err = host_int_get_site_survey_results(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1559 | gapu8RcvdSurveyResults, |
| 1560 | MAX_SURVEY_RESULT_FRAG_SIZE); |
| 1561 | if (s32Err) { |
| 1562 | PRINT_ER("Failed to get site survey results\n"); |
| 1563 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 1564 | |
| 1565 | } |
| 1566 | s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults, |
| 1567 | &pstrWFIDrv->u32SurveyResultsCount); |
| 1568 | |
| 1569 | |
| 1570 | if (s32Err == WILC_SUCCESS) { |
| 1571 | /* use the parsed info in pstrSurveyResults, then deallocate it */ |
| 1572 | PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); |
| 1573 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1574 | memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1575 | sizeof(wid_site_survey_reslts_s)); |
| 1576 | } |
| 1577 | |
| 1578 | DeallocateSurveyResults(pstrSurveyResults); |
| 1579 | } else { |
| 1580 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1581 | PRINT_ER("ParseSurveyResults() Error(%d)\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1582 | } |
| 1583 | |
| 1584 | |
| 1585 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1586 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1587 | pstrHostIFconnectAttr->pu8ssid, |
| 1588 | pstrHostIFconnectAttr->ssidLen) == 0) { |
| 1589 | PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); |
| 1590 | if (pstrHostIFconnectAttr->pu8bssid == NULL) { |
| 1591 | /* BSSID is not passed from the user, so decision of matching |
| 1592 | * is done by SSID only */ |
| 1593 | PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n"); |
| 1594 | break; |
| 1595 | } else { |
| 1596 | /* BSSID is also passed from the user, so decision of matching |
| 1597 | * should consider also this passed BSSID */ |
| 1598 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1599 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1600 | pstrHostIFconnectAttr->pu8bssid, |
| 1601 | 6) == 0) { |
| 1602 | PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); |
| 1603 | break; |
| 1604 | } |
| 1605 | } |
| 1606 | } |
| 1607 | } |
| 1608 | |
| 1609 | if (i < pstrWFIDrv->u32SurveyResultsCount) { |
| 1610 | u8bssDscListIndex = i; |
| 1611 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1612 | PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx%d and SSID %s and channel%d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1613 | u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, |
| 1614 | pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); |
| 1615 | |
| 1616 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1617 | |
| 1618 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1619 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1620 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1621 | } |
| 1622 | |
| 1623 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1624 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1625 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1626 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1627 | pstrHostIFconnectAttr->ssidLen); |
| 1628 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1629 | } |
| 1630 | |
| 1631 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1632 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1633 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1634 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1635 | pstrHostIFconnectAttr->IEsLen); |
| 1636 | } |
| 1637 | |
| 1638 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1639 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1640 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1641 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1642 | |
| 1643 | |
| 1644 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1645 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1646 | { |
| 1647 | /* IEs to be inserted in Association Request */ |
| 1648 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1649 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1650 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1651 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1652 | u32WidsCount++; |
| 1653 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1654 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1655 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1656 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1657 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1658 | u32WidsCount++; |
| 1659 | |
| 1660 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1661 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1662 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1663 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1664 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1665 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1666 | u32WidsCount++; |
| 1667 | |
| 1668 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1669 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1670 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1671 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1672 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1673 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1674 | * u32WidsCount++; |
| 1675 | */ |
| 1676 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1677 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1678 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1679 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1680 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1681 | u32WidsCount++; |
| 1682 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1683 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1684 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1685 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1686 | /* ////////////////////// */ |
| 1687 | gu32WidConnRstHack = 0; |
| 1688 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1689 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 1690 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1691 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1692 | if (s32Error) { |
| 1693 | PRINT_ER("Handle_Connect()] failed to send config packet\n"); |
| 1694 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 1695 | } else { |
| 1696 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1697 | } |
| 1698 | |
| 1699 | } else { |
| 1700 | PRINT_ER("Required BSSID not found\n"); |
| 1701 | WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND); |
| 1702 | } |
| 1703 | |
| 1704 | #else |
| 1705 | |
| 1706 | /* if we try to connect to an already connected AP then discard the request */ |
| 1707 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1708 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1709 | |
| 1710 | s32Error = WILC_SUCCESS; |
| 1711 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1712 | return s32Error; |
| 1713 | } |
| 1714 | |
| 1715 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1716 | |
| 1717 | /*Bug4218: Parsing Join Param*/ |
| 1718 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1719 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1720 | if (ptstrJoinBssParam == NULL) { |
| 1721 | PRINT_ER("Required BSSID not found\n"); |
| 1722 | WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND); |
| 1723 | } |
| 1724 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1725 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1726 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1727 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1728 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1729 | } |
| 1730 | |
| 1731 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1732 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1733 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1734 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1735 | pstrHostIFconnectAttr->ssidLen); |
| 1736 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1737 | } |
| 1738 | |
| 1739 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1740 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 1741 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1742 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1743 | pstrHostIFconnectAttr->IEsLen); |
| 1744 | } |
| 1745 | |
| 1746 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1747 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1748 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1749 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1750 | |
| 1751 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1752 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1753 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1754 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1755 | u32WidsCount++; |
| 1756 | |
| 1757 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1758 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1759 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1760 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1761 | u32WidsCount++; |
| 1762 | |
| 1763 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1764 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1765 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1766 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1767 | u32WidsCount++; |
| 1768 | |
| 1769 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1770 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1771 | { |
| 1772 | /* IEs to be inserted in Association Request */ |
| 1773 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1774 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1775 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1776 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1777 | u32WidsCount++; |
| 1778 | |
| 1779 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1780 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1781 | |
| 1782 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1783 | gu8FlushedInfoElemAsoc = WILC_MALLOC(gu32FlushedInfoElemAsocSize); |
| 1784 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1785 | gu32FlushedInfoElemAsocSize); |
| 1786 | } |
| 1787 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1788 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1789 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1790 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1791 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1792 | u32WidsCount++; |
| 1793 | |
| 1794 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1795 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1796 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1797 | |
| 1798 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1799 | |
| 1800 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1801 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1802 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1803 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1804 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1805 | u32WidsCount++; |
| 1806 | |
| 1807 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1808 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1809 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1810 | |
| 1811 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1812 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1813 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1815 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1816 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1817 | * u32WidsCount++; |
| 1818 | */ |
| 1819 | |
| 1820 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1821 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1822 | |
| 1823 | |
| 1824 | #ifndef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1825 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1826 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1827 | strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; |
| 1828 | strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); |
| 1829 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1830 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1831 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1832 | |
| 1833 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1834 | |
| 1835 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1836 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1837 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1838 | } |
| 1839 | pu8CurrByte += MAX_SSID_LEN; |
| 1840 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1841 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1842 | } else { |
| 1843 | PRINT_ER("Channel out of range\n"); |
| 1844 | *(pu8CurrByte++) = 0xFF; |
| 1845 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1846 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1847 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1848 | pu8CurrByte += 6; |
| 1849 | |
| 1850 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1851 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1852 | |
| 1853 | #else |
| 1854 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1855 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1856 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1857 | |
| 1858 | /*Sending NoA attributes during connection*/ |
| 1859 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
| 1860 | strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); |
| 1861 | |
| 1862 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1863 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1864 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
| 1865 | gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize); |
| 1866 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1867 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1868 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1869 | |
| 1870 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1871 | |
| 1872 | |
| 1873 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1874 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1875 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1876 | } |
| 1877 | pu8CurrByte += MAX_SSID_LEN; |
| 1878 | |
| 1879 | /* BSS type*/ |
| 1880 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1881 | /* Channel*/ |
| 1882 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1883 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1884 | } else { |
| 1885 | PRINT_ER("Channel out of range\n"); |
| 1886 | *(pu8CurrByte++) = 0xFF; |
| 1887 | } |
| 1888 | /* Cap Info*/ |
| 1889 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1890 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1891 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1892 | |
| 1893 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1894 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1895 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1896 | pu8CurrByte += 6; |
| 1897 | |
| 1898 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1899 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1900 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1901 | pu8CurrByte += 6; |
| 1902 | |
| 1903 | /* Beacon Period*/ |
| 1904 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1905 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1906 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1907 | /* DTIM Period*/ |
| 1908 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1909 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1910 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1911 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1912 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1913 | |
| 1914 | /* wmm cap*/ |
| 1915 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1916 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1917 | /* uapsd cap*/ |
| 1918 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1919 | |
| 1920 | /* ht cap*/ |
| 1921 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1922 | /* copy this information to the user request */ |
| 1923 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1924 | |
| 1925 | /* rsn found*/ |
| 1926 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1927 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1928 | /* rsn group policy*/ |
| 1929 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1930 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1931 | /* mode_802_11i*/ |
| 1932 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1933 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1934 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1935 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1936 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1937 | |
| 1938 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1939 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1940 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1941 | |
| 1942 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1943 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1944 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1945 | |
| 1946 | /*BugID_5137*/ |
| 1947 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1948 | |
| 1949 | #ifdef WILC_P2P |
| 1950 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1951 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1952 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1953 | |
| 1954 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1955 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1956 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1957 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1958 | |
| 1959 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1960 | |
| 1961 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1962 | |
| 1963 | if (ptstrJoinBssParam->u8OppEnable) |
| 1964 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1965 | |
| 1966 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1967 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1968 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1969 | |
| 1970 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1971 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1972 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1973 | |
| 1974 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1975 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1976 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1977 | |
| 1978 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1979 | |
| 1980 | } else |
| 1981 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
| 1982 | #endif |
| 1983 | |
| 1984 | |
| 1985 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1986 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1987 | |
| 1988 | |
| 1989 | #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ |
| 1990 | u32WidsCount++; |
| 1991 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1992 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1993 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1994 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1995 | /* ////////////////////// */ |
| 1996 | gu32WidConnRstHack = 0; |
| 1997 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1998 | |
| 1999 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2000 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2001 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2002 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2003 | } |
| 2004 | |
| 2005 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 2006 | |
| 2007 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2008 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2009 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 2010 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 2011 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2012 | } |
| 2013 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2014 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2015 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2016 | if (s32Error) { |
| 2017 | PRINT_ER("Handle_Connect()] failed to send config packet\n"); |
| 2018 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 2019 | } else { |
| 2020 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 2021 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 2022 | } |
| 2023 | #endif |
| 2024 | |
| 2025 | WILC_CATCH(s32Error) |
| 2026 | { |
| 2027 | tstrConnectInfo strConnectInfo; |
| 2028 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2029 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2030 | |
| 2031 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 2032 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2033 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2034 | |
| 2035 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2036 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2037 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2038 | |
| 2039 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 2040 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2041 | strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2042 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2043 | pstrHostIFconnectAttr->pu8IEs, |
| 2044 | pstrHostIFconnectAttr->IEsLen); |
| 2045 | } |
| 2046 | |
| 2047 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2048 | &strConnectInfo, |
| 2049 | MAC_DISCONNECTED, |
| 2050 | NULL, |
| 2051 | pstrHostIFconnectAttr->pvUserArg); |
| 2052 | /*Change state to idle*/ |
| 2053 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2054 | /* Deallocation */ |
| 2055 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2056 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | strConnectInfo.pu8ReqIEs = NULL; |
| 2058 | } |
| 2059 | |
| 2060 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2061 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2062 | } |
| 2063 | } |
| 2064 | |
| 2065 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 2066 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 2067 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2068 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2069 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 2070 | } |
| 2071 | |
| 2072 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 2073 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2074 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2075 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 2076 | } |
| 2077 | |
| 2078 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 2079 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2080 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2081 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 2082 | } |
| 2083 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2084 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2085 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2086 | return s32Error; |
| 2087 | } |
| 2088 | |
| 2089 | /** |
| 2090 | * @brief Handle_FlushConnect |
| 2091 | * @details Sending config packet to firmware to flush an old connection |
| 2092 | * after switching FW from station one to hybrid one |
| 2093 | * @param[in] void * drvHandler |
| 2094 | * @return Error code. |
| 2095 | * @author Amr Abdel-Moghny |
| 2096 | * @date 19 DEC 2013 |
| 2097 | * @version 8.0 |
| 2098 | */ |
| 2099 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2100 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2101 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2102 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2103 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2104 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2105 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2106 | |
| 2107 | |
| 2108 | /* IEs to be inserted in Association Request */ |
| 2109 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 2110 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 2111 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 2112 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 2113 | u32WidsCount++; |
| 2114 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2115 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2116 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2117 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2118 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2119 | u32WidsCount++; |
| 2120 | |
| 2121 | |
| 2122 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2123 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2124 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2125 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2126 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2127 | u32WidsCount++; |
| 2128 | |
| 2129 | |
| 2130 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2131 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2132 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 2133 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2134 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2135 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 2136 | |
| 2137 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 2138 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 2139 | |
| 2140 | u32WidsCount++; |
| 2141 | |
| 2142 | #endif |
| 2143 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2144 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2145 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2146 | if (s32Error) { |
| 2147 | PRINT_ER("Handle_Flush_Connect()] failed to send config packet\n"); |
| 2148 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 2149 | } |
| 2150 | |
| 2151 | WILC_CATCH(s32Error) |
| 2152 | { |
| 2153 | |
| 2154 | } |
| 2155 | |
| 2156 | return s32Error; |
| 2157 | } |
| 2158 | |
| 2159 | /** |
| 2160 | * @brief Handle_ConnectTimeout |
| 2161 | * @details Call connect notification callback function indicating connection failure |
| 2162 | * @param[in] NONE |
| 2163 | * @return Error code. |
| 2164 | * @author |
| 2165 | * @date |
| 2166 | * @version 1.0 |
| 2167 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2168 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2169 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2170 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2171 | tstrConnectInfo strConnectInfo; |
| 2172 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2173 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2174 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 2175 | |
| 2176 | if (pstrWFIDrv == NULL) { |
| 2177 | PRINT_ER("Driver handler is NULL\n"); |
| 2178 | return s32Error; |
| 2179 | } |
| 2180 | |
| 2181 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2182 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2183 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2184 | |
| 2185 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2186 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2187 | |
| 2188 | |
| 2189 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 2190 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2191 | * WID_DISCONNECT} */ |
| 2192 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2193 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2194 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 2196 | } |
| 2197 | |
| 2198 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2199 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2200 | strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2201 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2202 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2203 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2204 | } |
| 2205 | |
| 2206 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2207 | &strConnectInfo, |
| 2208 | MAC_DISCONNECTED, |
| 2209 | NULL, |
| 2210 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2211 | |
| 2212 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 2213 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2214 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2215 | strConnectInfo.pu8ReqIEs = NULL; |
| 2216 | } |
| 2217 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2218 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2219 | } |
| 2220 | |
| 2221 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2222 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2223 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2225 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2226 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2227 | |
| 2228 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2229 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2230 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 2231 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2232 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2233 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2234 | |
| 2235 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 2236 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2237 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2238 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2239 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2240 | } |
| 2241 | |
| 2242 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2243 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2244 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2245 | } |
| 2246 | |
| 2247 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2248 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2249 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2250 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2251 | } |
| 2252 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2253 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2254 | /*BugID_5213*/ |
| 2255 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2256 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2257 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2258 | gu8FlushedJoinReq = NULL; |
| 2259 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2260 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2261 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2262 | gu8FlushedInfoElemAsoc = NULL; |
| 2263 | } |
| 2264 | |
| 2265 | return s32Error; |
| 2266 | } |
| 2267 | |
| 2268 | /** |
| 2269 | * @brief Handle_RcvdNtwrkInfo |
| 2270 | * @details Handling received network information |
| 2271 | * @param[in] tstrRcvdNetworkInfo* pstrRcvdNetworkInfo |
| 2272 | * @return Error code. |
| 2273 | * @author |
| 2274 | * @date |
| 2275 | * @version 1.0 |
| 2276 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2277 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2278 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2279 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2280 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2281 | |
| 2282 | |
| 2283 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2284 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2285 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 2286 | void *pJoinParams = NULL; |
| 2287 | |
| 2288 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2289 | |
| 2290 | |
| 2291 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2292 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2293 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 2294 | |
| 2295 | /*if there is a an ongoing scan request*/ |
| 2296 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2297 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
| 2298 | ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
| 2299 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2300 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2301 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 2302 | } |
| 2303 | |
| 2304 | /* check whether this network is discovered before */ |
| 2305 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2306 | |
| 2307 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2308 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2309 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2310 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2311 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2312 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2313 | * send anything to the upper layer */ |
| 2314 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2315 | goto done; |
| 2316 | } else { |
| 2317 | /* here the same already found network is found again but with a better rssi, so just update |
| 2318 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2319 | * don't add a new record for it */ |
| 2320 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2321 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2322 | break; |
| 2323 | } |
| 2324 | } |
| 2325 | } |
| 2326 | } |
| 2327 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2328 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2329 | /* here it is confirmed that it is a new discovered network, |
| 2330 | * so add its record then call the User CallBack function */ |
| 2331 | |
| 2332 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2333 | |
| 2334 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2335 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2336 | |
| 2337 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2338 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2339 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2340 | pstrNetworkInfo->au8bssid, 6); |
| 2341 | |
| 2342 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2343 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2344 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2345 | /*Bug4218: Parsing Join Param*/ |
| 2346 | /* add new BSS to JoinBssTable */ |
| 2347 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2348 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
| 2349 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 2350 | |
| 2351 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2352 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2353 | pJoinParams); |
| 2354 | |
| 2355 | |
| 2356 | } |
| 2357 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2358 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2359 | } |
| 2360 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2361 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2362 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2363 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2364 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2365 | } |
| 2366 | } |
| 2367 | |
| 2368 | |
| 2369 | WILC_CATCH(s32Error) |
| 2370 | { |
| 2371 | |
| 2372 | } |
| 2373 | |
| 2374 | done: |
| 2375 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2376 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2377 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2378 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2379 | } |
| 2380 | |
| 2381 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2382 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2384 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | } |
| 2386 | |
| 2387 | return s32Error; |
| 2388 | } |
| 2389 | |
| 2390 | /** |
| 2391 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2392 | * @details Handling received asynchrous general network information |
| 2393 | * @param[in] tstrRcvdGnrlAsyncInfo* pstrRcvdGnrlAsyncInfo |
| 2394 | * @return Error code. |
| 2395 | * @author |
| 2396 | * @date |
| 2397 | * @version 1.0 |
| 2398 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2399 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2400 | { |
| 2401 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2402 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2403 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2404 | u8 u8MsgType = 0; |
| 2405 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2406 | u16 u16MsgLen = 0; |
| 2407 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2408 | u8 u8WidLen = 0; |
| 2409 | u8 u8MacStatus; |
| 2410 | u8 u8MacStatusReasonCode; |
| 2411 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | tstrConnectInfo strConnectInfo; |
| 2413 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2414 | s32 s32Err = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2415 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2416 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2417 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2418 | PRINT_ER("Driver handler is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2419 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2420 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2421 | |
| 2422 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2423 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2424 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2425 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2426 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2427 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 2428 | } |
| 2429 | |
| 2430 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2431 | |
| 2432 | /* Check whether the received message type is 'I' */ |
| 2433 | if ('I' != u8MsgType) { |
| 2434 | PRINT_ER("Received Message format incorrect.\n"); |
| 2435 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 2436 | } |
| 2437 | |
| 2438 | /* Extract message ID */ |
| 2439 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2440 | |
| 2441 | /* Extract message Length */ |
| 2442 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2443 | |
| 2444 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2445 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2446 | |
| 2447 | /* Extract WID Length [expected to be = 1] */ |
| 2448 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2449 | |
| 2450 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2451 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2452 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2453 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2454 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2455 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2456 | /* our station had sent Association Request frame, so here it will get the Association Response frame then parse it */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2457 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2458 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2459 | |
| 2460 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2461 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2462 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2463 | |
| 2464 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2465 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2466 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2467 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2468 | gapu8RcvdAssocResp, |
| 2469 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2470 | &u32RcvdAssocRespInfoLen); |
| 2471 | |
| 2472 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2473 | |
| 2474 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2475 | |
| 2476 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2477 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2478 | &pstrConnectRespInfo); |
| 2479 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2480 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2481 | } else { |
| 2482 | /* use the necessary parsed Info from the Received Association Response */ |
| 2483 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2484 | |
| 2485 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2486 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2487 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2488 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2489 | |
| 2490 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2491 | strConnectInfo.pu8RespIEs = WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2492 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2493 | pstrConnectRespInfo->u16RespIEsLen); |
| 2494 | } |
| 2495 | } |
| 2496 | |
| 2497 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2498 | if (pstrConnectRespInfo != NULL) { |
| 2499 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2500 | pstrConnectRespInfo = NULL; |
| 2501 | } |
| 2502 | } |
| 2503 | } |
| 2504 | } |
| 2505 | |
| 2506 | /* The station has just received mac status and it also received assoc. response which |
| 2507 | * it was waiting for. |
| 2508 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2509 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2510 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2511 | PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2512 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2513 | |
| 2514 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2515 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2516 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2517 | } |
| 2518 | |
| 2519 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2520 | /* through a structure of type tstrConnectRespInfo */ |
| 2521 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2522 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2523 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2524 | |
| 2525 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2526 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2527 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2528 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2529 | } |
| 2530 | } |
| 2531 | |
| 2532 | |
| 2533 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2534 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2535 | strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2536 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2537 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2538 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2539 | } |
| 2540 | |
| 2541 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2542 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2543 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2544 | &strConnectInfo, |
| 2545 | u8MacStatus, |
| 2546 | NULL, |
| 2547 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2548 | |
| 2549 | |
| 2550 | /* if received mac status is MAC_CONNECTED and |
| 2551 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2552 | * else change state to IDLE */ |
| 2553 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2554 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
| 2555 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2556 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2557 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2558 | #endif |
| 2559 | |
| 2560 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2561 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2562 | |
| 2563 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2564 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2565 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2566 | mod_timer(&hDuringIpTimer, |
| 2567 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2568 | #endif |
| 2569 | |
| 2570 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2571 | /* open a BA session if possible */ |
| 2572 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
| 2573 | |
| 2574 | #endif |
| 2575 | |
| 2576 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ |
| 2577 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2578 | } else { |
| 2579 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2580 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2581 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2582 | } |
| 2583 | |
| 2584 | /* Deallocation */ |
| 2585 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2586 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2587 | strConnectInfo.pu8RespIEs = NULL; |
| 2588 | } |
| 2589 | |
| 2590 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2591 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2592 | strConnectInfo.pu8ReqIEs = NULL; |
| 2593 | } |
| 2594 | |
| 2595 | |
| 2596 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2597 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2598 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2599 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2600 | } |
| 2601 | |
| 2602 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2603 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2604 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2605 | } |
| 2606 | |
| 2607 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2608 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2609 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2610 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2611 | } |
| 2612 | |
| 2613 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2614 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2615 | /* Disassociation or Deauthentication frame has been received */ |
| 2616 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2617 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2618 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2619 | |
| 2620 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2621 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2622 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2623 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2624 | } |
| 2625 | |
| 2626 | strDisconnectNotifInfo.u16reason = 0; |
| 2627 | strDisconnectNotifInfo.ie = NULL; |
| 2628 | strDisconnectNotifInfo.ie_len = 0; |
| 2629 | |
| 2630 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2631 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2632 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2633 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2634 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2635 | #endif |
| 2636 | |
| 2637 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2638 | NULL, |
| 2639 | 0, |
| 2640 | &strDisconnectNotifInfo, |
| 2641 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2642 | |
| 2643 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2644 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2645 | } |
| 2646 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2647 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2648 | |
| 2649 | |
| 2650 | /* Deallocation */ |
| 2651 | |
| 2652 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2653 | * should be deallocated here */ |
| 2654 | /* |
| 2655 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2656 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2657 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2658 | * strDisconnectNotifInfo.ie = NULL; |
| 2659 | * } |
| 2660 | */ |
| 2661 | |
| 2662 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2663 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2664 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2665 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2666 | } |
| 2667 | |
| 2668 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2669 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2671 | } |
| 2672 | |
| 2673 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2674 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2675 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2676 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2677 | } |
| 2678 | |
| 2679 | /*BugID_5213*/ |
| 2680 | /*Freeing flushed join request params on receiving*/ |
| 2681 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2682 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2683 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2684 | gu8FlushedJoinReq = NULL; |
| 2685 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2686 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2687 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2688 | gu8FlushedInfoElemAsoc = NULL; |
| 2689 | } |
| 2690 | |
| 2691 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2692 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2693 | |
| 2694 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2695 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2696 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2697 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2698 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2699 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2700 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2701 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2702 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2703 | } |
| 2704 | |
| 2705 | } |
| 2706 | |
| 2707 | WILC_CATCH(s32Error) |
| 2708 | { |
| 2709 | |
| 2710 | } |
| 2711 | |
| 2712 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2713 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2714 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2715 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2716 | } |
| 2717 | |
| 2718 | return s32Error; |
| 2719 | } |
| 2720 | |
| 2721 | /** |
| 2722 | * @brief Handle_Key |
| 2723 | * @details Sending config packet to firmware to set key |
| 2724 | * @param[in] tstrHostIFkeyAttr* pstrHostIFkeyAttr |
| 2725 | * @return Error code. |
| 2726 | * @author |
| 2727 | * @date |
| 2728 | * @version 1.0 |
| 2729 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2730 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2731 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2732 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2733 | tstrWID strWID; |
| 2734 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2735 | tstrWID strWIDList[5]; |
| 2736 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2737 | u8 i; |
| 2738 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2739 | s8 s8idxarray[1]; |
| 2740 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2741 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2742 | |
| 2743 | |
| 2744 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2745 | |
| 2746 | |
| 2747 | case WEP: |
| 2748 | |
| 2749 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2750 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2751 | |
| 2752 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2753 | PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2754 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2755 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2756 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2757 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2758 | |
| 2759 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2760 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2761 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2762 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2763 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2764 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2765 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2766 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2767 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2768 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2769 | |
| 2770 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2771 | pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2772 | |
| 2773 | |
| 2774 | if (pu8keybuf == NULL) { |
| 2775 | PRINT_ER("No buffer to send Key\n"); |
| 2776 | return -1; |
| 2777 | } |
| 2778 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2779 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2780 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2781 | |
| 2782 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2783 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2784 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2785 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2786 | strWIDList[3].enuWIDtype = WID_STR; |
| 2787 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2788 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2789 | |
| 2790 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2791 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, |
| 2792 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2793 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2794 | |
| 2795 | |
| 2796 | } |
| 2797 | #endif |
| 2798 | |
| 2799 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2800 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2801 | pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2802 | if (pu8keybuf == NULL) { |
| 2803 | PRINT_ER("No buffer to send Key\n"); |
| 2804 | return -1; |
| 2805 | } |
| 2806 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2807 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2808 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2810 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2811 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2812 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2813 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2815 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2816 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2817 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2818 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2819 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2820 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2821 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2822 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2823 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2824 | |
| 2825 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2826 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2827 | strWID.enuWIDtype = WID_STR; |
| 2828 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2829 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2830 | strWID.ps8WidVal = s8idxarray; |
| 2831 | strWID.s32ValueSize = 1; |
| 2832 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2833 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2834 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2836 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2837 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2838 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2839 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2840 | |
| 2841 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2842 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2843 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2844 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2845 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2846 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2847 | break; |
| 2848 | |
| 2849 | case WPARxGtk: |
| 2850 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2851 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2852 | pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2853 | if (pu8keybuf == NULL) { |
| 2854 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2855 | ret = -1; |
| 2856 | goto _WPARxGtk_end_case_; |
| 2857 | } |
| 2858 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2859 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2860 | |
| 2861 | |
| 2862 | /*|----------------------------------------------------------------------------| |
| 2863 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2864 | * |------------|---------|-------|------------|---------------|----------------| |
| 2865 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2866 | |
| 2867 | |
| 2868 | |
| 2869 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2870 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2871 | |
| 2872 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2873 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2874 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2875 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2876 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2877 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2878 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2879 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2880 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2881 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2882 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2883 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2884 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2885 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2886 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2887 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2888 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2889 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2890 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2891 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2893 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2894 | |
| 2895 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2896 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2897 | /* ///////////////////////// */ |
| 2898 | } |
| 2899 | |
| 2900 | #endif |
| 2901 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2902 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2903 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2904 | pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2905 | if (pu8keybuf == NULL) { |
| 2906 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2907 | ret = -1; |
| 2908 | goto _WPARxGtk_end_case_; |
| 2909 | } |
| 2910 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2911 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2912 | |
| 2913 | |
| 2914 | /*|----------------------------------------------------------------------------| |
| 2915 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2916 | * |------------|---------|-------|------------|---------------|----------------| |
| 2917 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2918 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2919 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2920 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2921 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2922 | PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2923 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2924 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2925 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2926 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2927 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2928 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2929 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2930 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2931 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2932 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2933 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2934 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2935 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2936 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2937 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2938 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2939 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2940 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | |
| 2942 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2943 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2944 | /* ///////////////////////// */ |
| 2945 | } |
| 2946 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2947 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2948 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2949 | if (ret == -1) |
| 2950 | return ret; |
| 2951 | |
| 2952 | break; |
| 2953 | |
| 2954 | case WPAPtk: |
| 2955 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2956 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2957 | |
| 2958 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 2959 | pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2960 | |
| 2961 | |
| 2962 | |
| 2963 | if (pu8keybuf == NULL) { |
| 2964 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2965 | ret = -1; |
| 2966 | goto _WPAPtk_end_case_; |
| 2967 | |
| 2968 | } |
| 2969 | |
| 2970 | /*|-----------------------------------------------------------------------------| |
| 2971 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2972 | * |----------------|------------ |--------------|----------------|---------------| |
| 2973 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2974 | |-----------------------------------------------------------------------------|*/ |
| 2975 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2976 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2978 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2979 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2980 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2981 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2982 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2983 | |
| 2984 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2985 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2986 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2987 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2988 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2990 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2992 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2994 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 2995 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2996 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2997 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2998 | |
| 2999 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3000 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3001 | /* ///////////////////////// */ |
| 3002 | } |
| 3003 | #endif |
| 3004 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 3005 | |
| 3006 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 3007 | pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3008 | |
| 3009 | |
| 3010 | |
| 3011 | if (pu8keybuf == NULL) { |
| 3012 | PRINT_ER("No buffer to send PTK Key\n"); |
| 3013 | ret = -1; |
| 3014 | goto _WPAPtk_end_case_; |
| 3015 | |
| 3016 | } |
| 3017 | |
| 3018 | /*|-----------------------------------------------------------------------------| |
| 3019 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 3020 | * |----------------|------------|--------------|----------------|---------------| |
| 3021 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 3022 | |-----------------------------------------------------------------------------|*/ |
| 3023 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3024 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3026 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3027 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3028 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3029 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 3030 | |
| 3031 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3032 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3033 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3034 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3035 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 3036 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3037 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3038 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3039 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3040 | |
| 3041 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3042 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3043 | /* ///////////////////////// */ |
| 3044 | } |
| 3045 | |
| 3046 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3047 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3048 | if (ret == -1) |
| 3049 | return ret; |
| 3050 | |
| 3051 | break; |
| 3052 | |
| 3053 | |
| 3054 | case PMKSA: |
| 3055 | |
| 3056 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 3057 | |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 3058 | pu8keybuf = WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3059 | if (pu8keybuf == NULL) { |
| 3060 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 3061 | return -1; |
| 3062 | } |
| 3063 | |
| 3064 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 3065 | |
| 3066 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 3067 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3068 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 3069 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3070 | } |
| 3071 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3072 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3073 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3074 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3075 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 3076 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3077 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3078 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3079 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3080 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3081 | break; |
| 3082 | } |
| 3083 | |
| 3084 | if (s32Error) |
| 3085 | PRINT_ER("Failed to send key config packet\n"); |
| 3086 | |
| 3087 | |
| 3088 | return s32Error; |
| 3089 | } |
| 3090 | |
| 3091 | |
| 3092 | /** |
| 3093 | * @brief Handle_Disconnect |
| 3094 | * @details Sending config packet to firmware to disconnect |
| 3095 | * @param[in] NONE |
| 3096 | * @return NONE |
| 3097 | * @author |
| 3098 | * @date |
| 3099 | * @version 1.0 |
| 3100 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3101 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3102 | { |
| 3103 | tstrWID strWID; |
| 3104 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3105 | s32 s32Error = WILC_SUCCESS; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3106 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3107 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3108 | |
| 3109 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3110 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3111 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3112 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3113 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3114 | |
| 3115 | |
| 3116 | |
| 3117 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 3118 | |
| 3119 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3120 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3121 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3122 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3123 | #endif |
| 3124 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3125 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3126 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3127 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3128 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3129 | |
| 3130 | if (s32Error) { |
| 3131 | PRINT_ER("Failed to send dissconect config packet\n"); |
| 3132 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3133 | } else { |
| 3134 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 3135 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3136 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3137 | |
| 3138 | strDisconnectNotifInfo.u16reason = 0; |
| 3139 | strDisconnectNotifInfo.ie = NULL; |
| 3140 | strDisconnectNotifInfo.ie_len = 0; |
| 3141 | |
| 3142 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3143 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3144 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3145 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 3146 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3147 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3148 | } |
| 3149 | |
| 3150 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 3151 | |
| 3152 | /*BugID_5193*/ |
| 3153 | /*Stop connect timer, if connection in progress*/ |
| 3154 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3155 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3156 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3157 | } |
| 3158 | |
| 3159 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 3160 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 3161 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3162 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3163 | } |
| 3164 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3165 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3166 | |
| 3167 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 3168 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3169 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3170 | |
| 3171 | |
| 3172 | /* Deallocation */ |
| 3173 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 3174 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3175 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3176 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 3177 | } |
| 3178 | |
| 3179 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3180 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3181 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 3182 | } |
| 3183 | |
| 3184 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 3185 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3186 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 3188 | } |
| 3189 | |
| 3190 | |
| 3191 | /*BugID_5137*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3192 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3193 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3194 | gu8FlushedJoinReq = NULL; |
| 3195 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3196 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3197 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3198 | gu8FlushedInfoElemAsoc = NULL; |
| 3199 | } |
| 3200 | |
| 3201 | } |
| 3202 | |
| 3203 | WILC_CATCH(s32Error) |
| 3204 | { |
| 3205 | |
| 3206 | } |
| 3207 | |
| 3208 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3209 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3210 | /* ///////////////////////// */ |
| 3211 | |
| 3212 | } |
| 3213 | |
| 3214 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3215 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3216 | { |
| 3217 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 3218 | |
| 3219 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3220 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3221 | return; |
| 3222 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 3223 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3224 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3225 | } |
| 3226 | } |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3227 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3228 | { |
| 3229 | |
| 3230 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3231 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3232 | tstrWID strWID; |
| 3233 | static char dummy = 9; |
| 3234 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3235 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3236 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3237 | strWID.enuWIDtype = WID_CHAR; |
| 3238 | strWID.ps8WidVal = &dummy; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3239 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3240 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3241 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3242 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3243 | |
| 3244 | |
| 3245 | if (s32Error) { |
| 3246 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); |
| 3247 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 3248 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3249 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3250 | |
| 3251 | |
| 3252 | } |
| 3253 | |
| 3254 | WILC_CATCH(s32Error) |
| 3255 | { |
| 3256 | |
| 3257 | } |
| 3258 | |
| 3259 | return s32Error; |
| 3260 | } |
| 3261 | |
| 3262 | /** |
| 3263 | * @brief Handle_GetChnl |
| 3264 | * @details Sending config packet to get channel |
| 3265 | * @param[in] NONE |
| 3266 | * @return NONE |
| 3267 | * |
| 3268 | * @author |
| 3269 | * @date |
| 3270 | * @version 1.0 |
| 3271 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3272 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3273 | { |
| 3274 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3275 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3276 | tstrWID strWID; |
| 3277 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 3278 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3279 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3280 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3281 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3282 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3283 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3284 | |
| 3285 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 3286 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3287 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3288 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3289 | /*get the value by searching the local copy*/ |
| 3290 | if (s32Error) { |
| 3291 | PRINT_ER("Failed to get channel number\n"); |
| 3292 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3293 | } |
| 3294 | |
| 3295 | |
| 3296 | WILC_CATCH(s32Error) |
| 3297 | { |
| 3298 | |
| 3299 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3300 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3301 | |
| 3302 | return s32Error; |
| 3303 | |
| 3304 | |
| 3305 | |
| 3306 | } |
| 3307 | |
| 3308 | |
| 3309 | /** |
| 3310 | * @brief Handle_GetRssi |
| 3311 | * @details Sending config packet to get RSSI |
| 3312 | * @param[in] NONE |
| 3313 | * @return NONE |
| 3314 | * @author |
| 3315 | * @date |
| 3316 | * @version 1.0 |
| 3317 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3318 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3319 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3320 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3321 | tstrWID strWID; |
| 3322 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3323 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3324 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3325 | strWID.enuWIDtype = WID_CHAR; |
| 3326 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3327 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3328 | |
| 3329 | /*Sending Cfg*/ |
| 3330 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 3331 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3332 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3333 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3334 | if (s32Error) { |
| 3335 | PRINT_ER("Failed to get RSSI value\n"); |
| 3336 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3337 | } |
| 3338 | |
| 3339 | WILC_CATCH(s32Error) |
| 3340 | { |
| 3341 | |
| 3342 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3343 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3344 | |
| 3345 | |
| 3346 | } |
| 3347 | |
| 3348 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3349 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3350 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3351 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3352 | tstrWID strWID; |
| 3353 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3354 | |
| 3355 | gs8lnkspd = 0; |
| 3356 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3357 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3358 | strWID.enuWIDtype = WID_CHAR; |
| 3359 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3360 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3361 | /*Sending Cfg*/ |
| 3362 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 3363 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3364 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3365 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3366 | if (s32Error) { |
| 3367 | PRINT_ER("Failed to get LINKSPEED value\n"); |
| 3368 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3369 | } |
| 3370 | |
| 3371 | WILC_CATCH(s32Error) |
| 3372 | { |
| 3373 | |
| 3374 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3375 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3376 | |
| 3377 | |
| 3378 | } |
| 3379 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3380 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3381 | { |
| 3382 | tstrWID strWIDList[5]; |
| 3383 | uint32_t u32WidsCount = 0, s32Error = 0; |
| 3384 | |
| 3385 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 3386 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3387 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3388 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3389 | u32WidsCount++; |
| 3390 | |
| 3391 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3392 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3393 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3394 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3395 | u32WidsCount++; |
| 3396 | |
| 3397 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3398 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3399 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3400 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3401 | u32WidsCount++; |
| 3402 | |
| 3403 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3404 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3405 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3406 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3407 | u32WidsCount++; |
| 3408 | |
| 3409 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3410 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3411 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3412 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3413 | u32WidsCount++; |
| 3414 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3415 | s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3416 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3417 | |
| 3418 | if (s32Error) { |
| 3419 | PRINT_ER("Failed to send scan paramters config packet\n"); |
| 3420 | /* WILC_ERRORREPORT(s32Error, s32Error); */ |
| 3421 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3422 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3423 | return 0; |
| 3424 | |
| 3425 | } |
| 3426 | |
| 3427 | |
| 3428 | #ifdef WILC_AP_EXTERNAL_MLME |
| 3429 | |
| 3430 | |
| 3431 | /** |
| 3432 | * @brief Handle_Get_InActiveTime |
| 3433 | * @details Sending config packet to set mac adddress for station and |
| 3434 | * get inactive time |
| 3435 | * @param[in] NONE |
| 3436 | * @return NONE |
| 3437 | * |
| 3438 | * @author |
| 3439 | * @date |
| 3440 | * @version 1.0 |
| 3441 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3442 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3443 | { |
| 3444 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3445 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3446 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3447 | tstrWID strWID; |
| 3448 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3449 | |
| 3450 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3451 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3452 | strWID.enuWIDtype = WID_STR; |
| 3453 | strWID.s32ValueSize = ETH_ALEN; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 3454 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3455 | |
| 3456 | |
| 3457 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3458 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3459 | |
| 3460 | |
| 3461 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3462 | |
| 3463 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3464 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3465 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3466 | /*get the value by searching the local copy*/ |
| 3467 | if (s32Error) { |
| 3468 | PRINT_ER("Failed to SET incative time\n"); |
| 3469 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3470 | } |
| 3471 | |
| 3472 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3473 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3474 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3475 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3476 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3477 | |
| 3478 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3479 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3480 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3481 | /*get the value by searching the local copy*/ |
| 3482 | if (s32Error) { |
| 3483 | PRINT_ER("Failed to get incative time\n"); |
| 3484 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3485 | } |
| 3486 | |
| 3487 | |
| 3488 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3489 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3490 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3491 | WILC_CATCH(s32Error) |
| 3492 | { |
| 3493 | |
| 3494 | } |
| 3495 | |
| 3496 | |
| 3497 | return s32Error; |
| 3498 | |
| 3499 | |
| 3500 | |
| 3501 | } |
| 3502 | |
| 3503 | |
| 3504 | /** |
| 3505 | * @brief Handle_AddBeacon |
| 3506 | * @details Sending config packet to add beacon |
| 3507 | * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam |
| 3508 | * @return NONE |
| 3509 | * @author |
| 3510 | * @date |
| 3511 | * @version 1.0 |
| 3512 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3513 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3514 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3515 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3517 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3518 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3519 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3520 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3521 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3522 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3523 | strWID.enuWIDtype = WID_BIN; |
| 3524 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
| 3525 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3526 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3527 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3528 | |
| 3529 | pu8CurrByte = strWID.ps8WidVal; |
| 3530 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3531 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3532 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3533 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3534 | |
| 3535 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3536 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3537 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3538 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3539 | |
| 3540 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3541 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3542 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3543 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3544 | |
| 3545 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3546 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3547 | |
| 3548 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3549 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3550 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3551 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3552 | |
| 3553 | /* Bug 4599 : if tail length = 0 skip copying */ |
| 3554 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3555 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3556 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3557 | |
| 3558 | |
| 3559 | |
| 3560 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3561 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3562 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3563 | if (s32Error) { |
| 3564 | PRINT_ER("Failed to send add beacon config packet\n"); |
| 3565 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3566 | } |
| 3567 | |
| 3568 | WILC_CATCH(s32Error) |
| 3569 | { |
| 3570 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3571 | kfree(strWID.ps8WidVal); |
| 3572 | kfree(pstrSetBeaconParam->pu8Head); |
| 3573 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3574 | } |
| 3575 | |
| 3576 | |
| 3577 | /** |
| 3578 | * @brief Handle_AddBeacon |
| 3579 | * @details Sending config packet to delete beacon |
| 3580 | * @param[in] tstrHostIFDelBeacon* pstrDelBeacon |
| 3581 | * @return NONE |
| 3582 | * @author |
| 3583 | * @date |
| 3584 | * @version 1.0 |
| 3585 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3586 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3587 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3588 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3589 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3590 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3591 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3592 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3593 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3594 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3595 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3596 | strWID.ps8WidVal = &gu8DelBcn; |
| 3597 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3598 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3599 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3600 | |
| 3601 | pu8CurrByte = strWID.ps8WidVal; |
| 3602 | |
| 3603 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3604 | /* TODO: build del beacon message*/ |
| 3605 | |
| 3606 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3607 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3608 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3609 | if (s32Error) { |
| 3610 | |
| 3611 | PRINT_ER("Failed to send delete beacon config packet\n"); |
| 3612 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3613 | } |
| 3614 | |
| 3615 | WILC_CATCH(s32Error) |
| 3616 | { |
| 3617 | } |
| 3618 | } |
| 3619 | |
| 3620 | |
| 3621 | /** |
| 3622 | * @brief WILC_HostIf_PackStaParam |
| 3623 | * @details Handling packing of the station params in a buffer |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3624 | * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3625 | * @return NONE |
| 3626 | * @author |
| 3627 | * @date |
| 3628 | * @version 1.0 |
| 3629 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3630 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3631 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3632 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3633 | |
| 3634 | pu8CurrByte = pu8Buffer; |
| 3635 | |
| 3636 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3637 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3638 | pu8CurrByte += ETH_ALEN; |
| 3639 | |
| 3640 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3641 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3642 | |
| 3643 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3644 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3645 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3646 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3647 | |
| 3648 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3649 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3650 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3651 | |
| 3652 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3653 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3654 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3655 | |
| 3656 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3657 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3658 | |
| 3659 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3660 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3661 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3662 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3663 | |
| 3664 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3665 | |
| 3666 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3667 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3668 | |
| 3669 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3670 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3671 | |
| 3672 | return pu8CurrByte - pu8Buffer; |
| 3673 | } |
| 3674 | |
| 3675 | /** |
| 3676 | * @brief Handle_AddStation |
| 3677 | * @details Sending config packet to add station |
| 3678 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3679 | * @return NONE |
| 3680 | * @author |
| 3681 | * @date |
| 3682 | * @version 1.0 |
| 3683 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3684 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3685 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3686 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3687 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3688 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3689 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3690 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3691 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3692 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3693 | strWID.enuWIDtype = WID_BIN; |
| 3694 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3695 | |
| 3696 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3697 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3698 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3699 | |
| 3700 | pu8CurrByte = strWID.ps8WidVal; |
| 3701 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3702 | |
| 3703 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3704 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3705 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3706 | if (s32Error != WILC_SUCCESS) { |
| 3707 | |
| 3708 | PRINT_ER("Failed to send add station config packet\n"); |
| 3709 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3710 | } |
| 3711 | |
| 3712 | WILC_CATCH(s32Error) |
| 3713 | { |
| 3714 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3715 | kfree(pstrStationParam->pu8Rates); |
| 3716 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3717 | } |
| 3718 | |
| 3719 | /** |
| 3720 | * @brief Handle_DelAllSta |
| 3721 | * @details Sending config packet to delete station |
| 3722 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3723 | * @return NONE |
| 3724 | * @author |
| 3725 | * @date |
| 3726 | * @version 1.0 |
| 3727 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3728 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3729 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3730 | s32 s32Error = WILC_SUCCESS; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3731 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3732 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3733 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3734 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3735 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3736 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3737 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3738 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3739 | strWID.enuWIDtype = WID_STR; |
| 3740 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3741 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3742 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3743 | |
| 3744 | strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3745 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3746 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3747 | |
| 3748 | pu8CurrByte = strWID.ps8WidVal; |
| 3749 | |
| 3750 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3751 | |
| 3752 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3753 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3754 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3755 | else |
| 3756 | continue; |
| 3757 | |
| 3758 | pu8CurrByte += ETH_ALEN; |
| 3759 | } |
| 3760 | |
| 3761 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3762 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3763 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3764 | if (s32Error) { |
| 3765 | |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3766 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3767 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3768 | } |
| 3769 | |
| 3770 | WILC_CATCH(s32Error) |
| 3771 | { |
| 3772 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3773 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3774 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3775 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3776 | } |
| 3777 | |
| 3778 | |
| 3779 | /** |
| 3780 | * @brief Handle_DelStation |
| 3781 | * @details Sending config packet to delete station |
| 3782 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3783 | * @return NONE |
| 3784 | * @author |
| 3785 | * @date |
| 3786 | * @version 1.0 |
| 3787 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3788 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3789 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3790 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3792 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3793 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3794 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3795 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3796 | strWID.enuWIDtype = WID_BIN; |
| 3797 | strWID.s32ValueSize = ETH_ALEN; |
| 3798 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3799 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3800 | |
| 3801 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3802 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3803 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3804 | |
| 3805 | pu8CurrByte = strWID.ps8WidVal; |
| 3806 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3807 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3808 | |
| 3809 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3810 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3811 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3812 | if (s32Error) { |
| 3813 | |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3814 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3815 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3816 | } |
| 3817 | |
| 3818 | WILC_CATCH(s32Error) |
| 3819 | { |
| 3820 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3821 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3822 | } |
| 3823 | |
| 3824 | |
| 3825 | /** |
| 3826 | * @brief Handle_EditStation |
| 3827 | * @details Sending config packet to edit station |
| 3828 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3829 | * @return NONE |
| 3830 | * @author |
| 3831 | * @date |
| 3832 | * @version 1.0 |
| 3833 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3834 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3836 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3837 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3838 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3839 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3840 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3841 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3842 | strWID.enuWIDtype = WID_BIN; |
| 3843 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3844 | |
| 3845 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
| 3846 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3847 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3848 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3849 | |
| 3850 | pu8CurrByte = strWID.ps8WidVal; |
| 3851 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3852 | |
| 3853 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3854 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3855 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3856 | if (s32Error) { |
| 3857 | |
| 3858 | PRINT_ER("Failed to send edit station config packet\n"); |
| 3859 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3860 | } |
| 3861 | |
| 3862 | WILC_CATCH(s32Error) |
| 3863 | { |
| 3864 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3865 | kfree(pstrStationParam->pu8Rates); |
| 3866 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3867 | } |
| 3868 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
| 3869 | |
| 3870 | #ifdef WILC_P2P |
| 3871 | /** |
| 3872 | * @brief Handle_RemainOnChan |
| 3873 | * @details Sending config packet to edit station |
| 3874 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3875 | * @return NONE |
| 3876 | * @author |
| 3877 | * @date |
| 3878 | * @version 1.0 |
| 3879 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3880 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3881 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3882 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3883 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3884 | tstrWID strWID; |
| 3885 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3886 | |
| 3887 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3888 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3889 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3890 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3891 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3892 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3893 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3894 | } else { |
| 3895 | /*Set the channel to use it as a wid val*/ |
| 3896 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3897 | } |
| 3898 | |
| 3899 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3900 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3901 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
| 3902 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3903 | } |
| 3904 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3905 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); |
| 3906 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3907 | } |
| 3908 | |
| 3909 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3910 | if (g_obtainingIP || connecting) { |
| 3911 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
| 3912 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3913 | } |
| 3914 | #endif |
| 3915 | |
| 3916 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3917 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3918 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3919 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3920 | strWID.enuWIDtype = WID_STR; |
| 3921 | strWID.s32ValueSize = 2; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 3922 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3923 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3924 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3925 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3926 | |
| 3927 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3928 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | |
| 3930 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3931 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3932 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3933 | if (s32Error != WILC_SUCCESS) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3934 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3935 | |
| 3936 | WILC_CATCH(-1) |
| 3937 | { |
| 3938 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3939 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3940 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3941 | jiffies + |
| 3942 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3943 | |
| 3944 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3945 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3946 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3947 | |
| 3948 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3949 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3950 | } |
| 3951 | return s32Error; |
| 3952 | } |
| 3953 | |
| 3954 | /** |
| 3955 | * @brief Handle_RegisterFrame |
| 3956 | * @details |
| 3957 | * @param[in] |
| 3958 | * @return NONE |
| 3959 | * @author |
| 3960 | * @date |
| 3961 | * @version 1.0 |
| 3962 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3963 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3964 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3965 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3966 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3967 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3968 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3969 | |
| 3970 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3971 | |
| 3972 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3973 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3974 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3975 | strWID.ps8WidVal = WILC_MALLOC(sizeof(u16) + 2); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3976 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3977 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3978 | |
| 3979 | pu8CurrByte = strWID.ps8WidVal; |
| 3980 | |
| 3981 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3982 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3983 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3984 | |
| 3985 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3986 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3987 | |
| 3988 | |
| 3989 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 3990 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3991 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3992 | if (s32Error) { |
| 3993 | PRINT_ER("Failed to frame register config packet\n"); |
| 3994 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 3995 | } |
| 3996 | |
| 3997 | |
| 3998 | WILC_CATCH(s32Error) |
| 3999 | { |
| 4000 | } |
| 4001 | |
| 4002 | return s32Error; |
| 4003 | |
| 4004 | } |
| 4005 | |
| 4006 | /** |
| 4007 | * @brief Handle_ListenStateExpired |
| 4008 | * @details Handle of listen state expiration |
| 4009 | * @param[in] NONE |
| 4010 | * @return Error code. |
| 4011 | * @author |
| 4012 | * @date |
| 4013 | * @version 1.0 |
| 4014 | */ |
| 4015 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4016 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4017 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4018 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4019 | tstrWID strWID; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4020 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4021 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 4022 | |
| 4023 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 4024 | |
| 4025 | /*BugID_5477*/ |
| 4026 | /*Make sure we are already in listen state*/ |
| 4027 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 4028 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4029 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4030 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4031 | strWID.enuWIDtype = WID_STR; |
| 4032 | strWID.s32ValueSize = 2; |
| 4033 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
| 4034 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4035 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4036 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4037 | |
| 4038 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 4039 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 4040 | |
| 4041 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4042 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4043 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4044 | if (s32Error != WILC_SUCCESS) { |
| 4045 | PRINT_ER("Failed to set remain on channel\n"); |
| 4046 | goto _done_; |
| 4047 | } |
| 4048 | |
| 4049 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 4050 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 4051 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 4052 | } |
| 4053 | P2P_LISTEN_STATE = 0; |
| 4054 | } else { |
| 4055 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
| 4056 | s32Error = WILC_FAIL; |
| 4057 | } |
| 4058 | |
| 4059 | _done_: |
| 4060 | return s32Error; |
| 4061 | } |
| 4062 | |
| 4063 | |
| 4064 | /** |
| 4065 | * @brief ListenTimerCB |
| 4066 | * @details Callback function of remain-on-channel timer |
| 4067 | * @param[in] NONE |
| 4068 | * @return Error code. |
| 4069 | * @author |
| 4070 | * @date |
| 4071 | * @version 1.0 |
| 4072 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4073 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4074 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4075 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4076 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4077 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4079 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4080 | |
| 4081 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4082 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4083 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
| 4084 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 4085 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
| 4086 | |
| 4087 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4088 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4089 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4090 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4091 | WILC_CATCH(s32Error) |
| 4092 | { |
| 4093 | |
| 4094 | } |
| 4095 | } |
| 4096 | #endif |
| 4097 | |
| 4098 | |
| 4099 | /** |
| 4100 | * @brief Handle_EditStation |
| 4101 | * @details Sending config packet to edit station |
| 4102 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 4103 | * @return NONE |
| 4104 | * @author |
| 4105 | * @date |
| 4106 | * @version 1.0 |
| 4107 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4108 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4109 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4110 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4111 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4112 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4113 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4114 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4115 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4117 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4118 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4119 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4120 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4121 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 4122 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4123 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | |
| 4125 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 4126 | |
| 4127 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4128 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4129 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4130 | if (s32Error) { |
| 4131 | PRINT_ER("Failed to send power management config packet\n"); |
| 4132 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 4133 | } |
| 4134 | |
| 4135 | WILC_CATCH(s32Error) |
| 4136 | { |
| 4137 | |
| 4138 | } |
| 4139 | } |
| 4140 | |
| 4141 | /** |
| 4142 | * @brief Handle_SetMulticastFilter |
| 4143 | * @details Set Multicast filter in firmware |
| 4144 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4145 | * @return NONE |
| 4146 | * @author asobhy |
| 4147 | * @date |
| 4148 | * @version 1.0 |
| 4149 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4150 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4151 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4152 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4153 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4154 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4155 | |
| 4156 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 4157 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4158 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4159 | strWID.enuWIDtype = WID_BIN; |
| 4160 | strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
| 4161 | strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4162 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4164 | |
| 4165 | pu8CurrByte = strWID.ps8WidVal; |
| 4166 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 4167 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 4168 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 4169 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 4170 | |
| 4171 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 4172 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 4173 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 4174 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 4175 | |
| 4176 | if ((strHostIfSetMulti->u32count) > 0) |
| 4177 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 4178 | |
| 4179 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4180 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 4181 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4182 | if (s32Error) { |
| 4183 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4184 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 4185 | } |
| 4186 | |
| 4187 | WILC_CATCH(s32Error) |
| 4188 | { |
| 4189 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 4190 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4191 | |
| 4192 | } |
| 4193 | |
| 4194 | |
| 4195 | /*BugID_5222*/ |
| 4196 | /** |
| 4197 | * @brief Handle_AddBASession |
| 4198 | * @details Add block ack session |
| 4199 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4200 | * @return NONE |
| 4201 | * @author Amr Abdel-Moghny |
| 4202 | * @date Feb. 2014 |
| 4203 | * @version 9.0 |
| 4204 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4205 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4206 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4207 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4208 | tstrWID strWID; |
| 4209 | int AddbaTimeout = 100; |
| 4210 | char *ptr = NULL; |
| 4211 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4212 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4213 | PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4214 | strHostIfBASessionInfo->au8Bssid[0], |
| 4215 | strHostIfBASessionInfo->au8Bssid[1], |
| 4216 | strHostIfBASessionInfo->au8Bssid[2], |
| 4217 | strHostIfBASessionInfo->u16BufferSize, |
| 4218 | strHostIfBASessionInfo->u16SessionTimeout, |
| 4219 | strHostIfBASessionInfo->u8Ted); |
| 4220 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4221 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4222 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4223 | strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4224 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4225 | ptr = strWID.ps8WidVal; |
| 4226 | /* *ptr++ = 0x14; */ |
| 4227 | *ptr++ = 0x14; |
| 4228 | *ptr++ = 0x3; |
| 4229 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4230 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4231 | ptr += ETH_ALEN; |
| 4232 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4233 | /* BA Policy*/ |
| 4234 | *ptr++ = 1; |
| 4235 | /* Buffer size*/ |
| 4236 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4237 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 4238 | /* BA timeout*/ |
| 4239 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 4240 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4241 | /* ADDBA timeout*/ |
| 4242 | *ptr++ = (AddbaTimeout & 0xFF); |
| 4243 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 4244 | /* Group Buffer Max Frames*/ |
| 4245 | *ptr++ = 8; |
| 4246 | /* Group Buffer Timeout */ |
| 4247 | *ptr++ = 0; |
| 4248 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4249 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4250 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4251 | if (s32Error) |
| 4252 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 4253 | |
| 4254 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4255 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4256 | strWID.enuWIDtype = WID_STR; |
| 4257 | strWID.s32ValueSize = 15; |
| 4258 | ptr = strWID.ps8WidVal; |
| 4259 | /* *ptr++ = 0x14; */ |
| 4260 | *ptr++ = 15; |
| 4261 | *ptr++ = 7; |
| 4262 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4263 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4264 | ptr += ETH_ALEN; |
| 4265 | /* TID*/ |
| 4266 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4267 | /* Max Num MSDU */ |
| 4268 | *ptr++ = 8; |
| 4269 | /* BA timeout*/ |
| 4270 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4271 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4272 | /*Ack-Policy */ |
| 4273 | *ptr++ = 3; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4274 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4275 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4276 | |
| 4277 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4278 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4279 | |
| 4280 | return s32Error; |
| 4281 | |
| 4282 | } |
| 4283 | |
| 4284 | |
| 4285 | /*BugID_5222*/ |
| 4286 | /** |
| 4287 | * @brief Handle_DelBASession |
| 4288 | * @details Delete block ack session |
| 4289 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4290 | * @return NONE |
| 4291 | * @author Amr Abdel-Moghny |
| 4292 | * @date Feb. 2013 |
| 4293 | * @version 9.0 |
| 4294 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4295 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4296 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4297 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4298 | tstrWID strWID; |
| 4299 | char *ptr = NULL; |
| 4300 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4301 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4302 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4303 | strHostIfBASessionInfo->au8Bssid[0], |
| 4304 | strHostIfBASessionInfo->au8Bssid[1], |
| 4305 | strHostIfBASessionInfo->au8Bssid[2], |
| 4306 | strHostIfBASessionInfo->u8Ted); |
| 4307 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4308 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4310 | strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4311 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4312 | ptr = strWID.ps8WidVal; |
| 4313 | /* *ptr++ = 0x14; */ |
| 4314 | *ptr++ = 0x14; |
| 4315 | *ptr++ = 0x3; |
| 4316 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4317 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4318 | ptr += ETH_ALEN; |
| 4319 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4320 | /* BA direction = recipent*/ |
| 4321 | *ptr++ = 0; |
| 4322 | /* Delba Reason */ |
| 4323 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4324 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4325 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4326 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4327 | if (s32Error) |
| 4328 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4329 | |
| 4330 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4331 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4332 | strWID.enuWIDtype = WID_STR; |
| 4333 | strWID.s32ValueSize = 15; |
| 4334 | ptr = strWID.ps8WidVal; |
| 4335 | /* *ptr++ = 0x14; */ |
| 4336 | *ptr++ = 15; |
| 4337 | *ptr++ = 7; |
| 4338 | *ptr++ = 0x3; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4339 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4340 | ptr += ETH_ALEN; |
| 4341 | /* TID*/ |
| 4342 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4343 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4344 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4345 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4346 | |
| 4347 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4348 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4349 | |
| 4350 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4351 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4352 | |
| 4353 | return s32Error; |
| 4354 | |
| 4355 | } |
| 4356 | |
| 4357 | |
| 4358 | /** |
| 4359 | * @brief Handle_DelAllRxBASessions |
| 4360 | * @details Delete all Rx BA sessions |
| 4361 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4362 | * @return NONE |
| 4363 | * @author Abdelrahman Sobhy |
| 4364 | * @date Feb. 2013 |
| 4365 | * @version 9.0 |
| 4366 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4367 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4368 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4369 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4370 | tstrWID strWID; |
| 4371 | char *ptr = NULL; |
| 4372 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4373 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4374 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4375 | strHostIfBASessionInfo->au8Bssid[0], |
| 4376 | strHostIfBASessionInfo->au8Bssid[1], |
| 4377 | strHostIfBASessionInfo->au8Bssid[2], |
| 4378 | strHostIfBASessionInfo->u8Ted); |
| 4379 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4380 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4382 | strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4383 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4384 | ptr = strWID.ps8WidVal; |
| 4385 | *ptr++ = 0x14; |
| 4386 | *ptr++ = 0x3; |
| 4387 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4388 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4389 | ptr += ETH_ALEN; |
| 4390 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4391 | /* BA direction = recipent*/ |
| 4392 | *ptr++ = 0; |
| 4393 | /* Delba Reason */ |
| 4394 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4395 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 4396 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4397 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4398 | if (s32Error) |
| 4399 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4400 | |
| 4401 | |
| 4402 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4403 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4404 | |
| 4405 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4406 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4407 | |
| 4408 | return s32Error; |
| 4409 | |
| 4410 | } |
| 4411 | |
| 4412 | /** |
| 4413 | * @brief hostIFthread |
| 4414 | * @details Main thread to handle message queue requests |
| 4415 | * @param[in] void* pvArg |
| 4416 | * @return NONE |
| 4417 | * @author |
| 4418 | * @date |
| 4419 | * @version 1.0 |
| 4420 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4421 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4422 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4423 | u32 u32Ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4424 | tstrHostIFmsg strHostIFmsg; |
| 4425 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 4426 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4427 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4428 | |
| 4429 | while (1) { |
Chaehyun Lim | b986e33 | 2015-08-19 15:59:07 +0900 | [diff] [blame] | 4430 | wilc_mq_recv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4431 | pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler; |
| 4432 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) { |
| 4433 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 4434 | break; |
| 4435 | } |
| 4436 | |
| 4437 | |
| 4438 | /*Re-Queue HIF message*/ |
| 4439 | if ((!g_wilc_initialized)) { |
| 4440 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4441 | usleep_range(200 * 1000, 200 * 1000); |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4442 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4443 | continue; |
| 4444 | } |
| 4445 | |
| 4446 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 4447 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4448 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4449 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4450 | continue; |
| 4451 | } |
| 4452 | |
| 4453 | switch (strHostIFmsg.u16MsgId) { |
| 4454 | case HOST_IF_MSG_Q_IDLE: |
| 4455 | Handle_wait_msg_q_empty(); |
| 4456 | break; |
| 4457 | |
| 4458 | case HOST_IF_MSG_SCAN: |
| 4459 | Handle_Scan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr); |
| 4460 | break; |
| 4461 | |
| 4462 | case HOST_IF_MSG_CONNECT: |
| 4463 | Handle_Connect(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr); |
| 4464 | break; |
| 4465 | |
| 4466 | /*BugID_5137*/ |
| 4467 | case HOST_IF_MSG_FLUSH_CONNECT: |
| 4468 | Handle_FlushConnect(strHostIFmsg.drvHandler); |
| 4469 | break; |
| 4470 | |
| 4471 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
| 4472 | Handle_RcvdNtwrkInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo); |
| 4473 | break; |
| 4474 | |
| 4475 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
| 4476 | Handle_RcvdGnrlAsyncInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo); |
| 4477 | break; |
| 4478 | |
| 4479 | case HOST_IF_MSG_KEY: |
| 4480 | Handle_Key(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr); |
| 4481 | break; |
| 4482 | |
| 4483 | case HOST_IF_MSG_CFG_PARAMS: |
| 4484 | |
| 4485 | Handle_CfgParam(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr); |
| 4486 | break; |
| 4487 | |
| 4488 | case HOST_IF_MSG_SET_CHANNEL: |
| 4489 | Handle_SetChannel(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan); |
| 4490 | break; |
| 4491 | |
| 4492 | case HOST_IF_MSG_DISCONNECT: |
| 4493 | Handle_Disconnect(strHostIFmsg.drvHandler); |
| 4494 | break; |
| 4495 | |
| 4496 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4497 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4498 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 4499 | |
| 4500 | /*BugID_5213*/ |
| 4501 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4502 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4503 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4504 | |
| 4505 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE); |
| 4506 | |
| 4507 | #ifdef WILC_P2P |
| 4508 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 4509 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4510 | #endif |
| 4511 | |
| 4512 | break; |
| 4513 | |
| 4514 | case HOST_IF_MSG_GET_RSSI: |
| 4515 | Handle_GetRssi(strHostIFmsg.drvHandler); |
| 4516 | break; |
| 4517 | |
| 4518 | case HOST_IF_MSG_GET_LINKSPEED: |
| 4519 | Handle_GetLinkspeed(strHostIFmsg.drvHandler); |
| 4520 | break; |
| 4521 | |
| 4522 | case HOST_IF_MSG_GET_STATISTICS: |
| 4523 | Handle_GetStatistics(strHostIFmsg.drvHandler, (tstrStatistics *)strHostIFmsg.uniHostIFmsgBody.pUserData); |
| 4524 | break; |
| 4525 | |
| 4526 | case HOST_IF_MSG_GET_CHNL: |
| 4527 | Handle_GetChnl(strHostIFmsg.drvHandler); |
| 4528 | break; |
| 4529 | |
| 4530 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4531 | case HOST_IF_MSG_ADD_BEACON: |
| 4532 | Handle_AddBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon); |
| 4533 | break; |
| 4534 | |
| 4535 | case HOST_IF_MSG_DEL_BEACON: |
| 4536 | Handle_DelBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelBeacon); |
| 4537 | break; |
| 4538 | |
| 4539 | case HOST_IF_MSG_ADD_STATION: |
| 4540 | Handle_AddStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strAddStaParam); |
| 4541 | break; |
| 4542 | |
| 4543 | case HOST_IF_MSG_DEL_STATION: |
| 4544 | Handle_DelStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strDelStaParam); |
| 4545 | break; |
| 4546 | |
| 4547 | case HOST_IF_MSG_EDIT_STATION: |
| 4548 | Handle_EditStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strEditStaParam); |
| 4549 | break; |
| 4550 | |
| 4551 | case HOST_IF_MSG_GET_INACTIVETIME: |
| 4552 | Handle_Get_InActiveTime(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT); |
| 4553 | break; |
| 4554 | |
| 4555 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
| 4556 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4557 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4558 | |
| 4559 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_ABORTED); |
| 4560 | break; |
| 4561 | |
| 4562 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4563 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4564 | Handle_ConnectTimeout(strHostIFmsg.drvHandler); |
| 4565 | break; |
| 4566 | |
| 4567 | case HOST_IF_MSG_POWER_MGMT: |
| 4568 | Handle_PowerManagement(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam); |
| 4569 | break; |
| 4570 | |
| 4571 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 4572 | Handle_SetWfiDrvHandler(strHostIFmsg.drvHandler, |
| 4573 | &strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4574 | break; |
| 4575 | |
| 4576 | case HOST_IF_MSG_SET_OPERATION_MODE: |
| 4577 | Handle_SetOperationMode(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode); |
| 4578 | break; |
| 4579 | |
| 4580 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4581 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
| 4582 | Handle_set_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); |
| 4583 | break; |
| 4584 | |
| 4585 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4586 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
| 4587 | Handle_get_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); |
| 4588 | break; |
| 4589 | |
| 4590 | /*BugID_5077*/ |
| 4591 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
| 4592 | Handle_SetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress); |
| 4593 | break; |
| 4594 | |
| 4595 | /*BugID_5213*/ |
| 4596 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
| 4597 | Handle_GetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress); |
| 4598 | break; |
| 4599 | |
| 4600 | #ifdef WILC_P2P |
| 4601 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4602 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
| 4603 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4604 | break; |
| 4605 | |
| 4606 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4607 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
| 4608 | Handle_RegisterFrame(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame); |
| 4609 | break; |
| 4610 | |
| 4611 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
| 4612 | Handle_ListenStateExpired(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4613 | break; |
| 4614 | |
| 4615 | #endif |
| 4616 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4617 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
| 4618 | Handle_SetMulticastFilter(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti); |
| 4619 | break; |
| 4620 | |
| 4621 | /*BugID_5222*/ |
| 4622 | case HOST_IF_MSG_ADD_BA_SESSION: |
| 4623 | Handle_AddBASession(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); |
| 4624 | break; |
| 4625 | |
| 4626 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
| 4627 | Handle_DelAllRxBASessions(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); |
| 4628 | break; |
| 4629 | |
| 4630 | case HOST_IF_MSG_DEL_ALL_STA: |
| 4631 | Handle_DelAllSta(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta); |
| 4632 | break; |
| 4633 | |
| 4634 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4635 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4636 | break; |
| 4637 | } |
| 4638 | } |
| 4639 | |
| 4640 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4641 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4642 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4643 | } |
| 4644 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4645 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4646 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4647 | void *pvArg = (void *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4648 | tstrHostIFmsg strHostIFmsg; |
| 4649 | |
| 4650 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4651 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4652 | strHostIFmsg.drvHandler = pvArg; |
| 4653 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; |
| 4654 | |
| 4655 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4656 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4657 | } |
| 4658 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4659 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4661 | void *pvArg = (void *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4662 | tstrHostIFmsg strHostIFmsg; |
| 4663 | |
| 4664 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4665 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4666 | strHostIFmsg.drvHandler = pvArg; |
| 4667 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
| 4668 | |
| 4669 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4670 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4671 | } |
| 4672 | |
| 4673 | |
| 4674 | /** |
| 4675 | * @brief removes wpa/wpa2 keys |
| 4676 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4677 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4678 | * @param[in,out] handle to the wifi driver |
| 4679 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4680 | * @return Error code indicating success/failure |
| 4681 | * @note |
| 4682 | * @author zsalah |
| 4683 | * @date 8 March 2012 |
| 4684 | * @version 1.0 |
| 4685 | */ |
| 4686 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4687 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4688 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4689 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | tstrWID strWID; |
| 4691 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4692 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4693 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4695 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4696 | strWID.s32ValueSize = 6; |
| 4697 | |
| 4698 | return s32Error; |
| 4699 | |
| 4700 | } |
| 4701 | |
| 4702 | /** |
| 4703 | * @brief removes WEP key |
| 4704 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4705 | * remove a WEP key entry from MAC HW. |
| 4706 | * The BSS Station automatically finds the index of the entry using its |
| 4707 | * BSS ID and removes that entry from the MAC hardware. |
| 4708 | * @param[in,out] handle to the wifi driver |
| 4709 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4710 | * @return Error code indicating success/failure |
| 4711 | * @note NO need for the STA add since it is not used for processing |
| 4712 | * @author zsalah |
| 4713 | * @date 8 March 2012 |
| 4714 | * @version 1.0 |
| 4715 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4716 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4717 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4718 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4720 | tstrHostIFmsg strHostIFmsg; |
| 4721 | |
| 4722 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4723 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4724 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4725 | |
| 4726 | /* prepare the Remove Wep Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4727 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4728 | |
| 4729 | |
| 4730 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4731 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4732 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = REMOVEKEY; |
| 4733 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4734 | |
| 4735 | |
| 4736 | |
| 4737 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4738 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; |
| 4739 | |
| 4740 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4741 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4742 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4743 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4744 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4745 | |
| 4746 | WILC_CATCH(s32Error) |
| 4747 | { |
| 4748 | |
| 4749 | } |
| 4750 | return s32Error; |
| 4751 | } |
| 4752 | |
| 4753 | /** |
| 4754 | * @brief sets WEP default key |
| 4755 | * @details Sets the index of the WEP encryption key in use, |
| 4756 | * in the key table |
| 4757 | * @param[in,out] handle to the wifi driver |
| 4758 | * @param[in] key index ( 0, 1, 2, 3) |
| 4759 | * @return Error code indicating success/failure |
| 4760 | * @note |
| 4761 | * @author zsalah |
| 4762 | * @date 8 March 2012 |
| 4763 | * @version 1.0 |
| 4764 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4765 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4766 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4767 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4768 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4769 | tstrHostIFmsg strHostIFmsg; |
| 4770 | |
| 4771 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4772 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4773 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4774 | |
| 4775 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4776 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4777 | |
| 4778 | |
| 4779 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4780 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4781 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY; |
| 4782 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4783 | |
| 4784 | |
| 4785 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4786 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4787 | |
| 4788 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4789 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4790 | if (s32Error) |
| 4791 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4792 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4793 | |
| 4794 | WILC_CATCH(s32Error) |
| 4795 | { |
| 4796 | |
| 4797 | } |
| 4798 | |
| 4799 | return s32Error; |
| 4800 | } |
| 4801 | |
| 4802 | /** |
| 4803 | * @brief sets WEP deafault key |
| 4804 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4805 | * sets WEP key entry into MAC hardware when it receives the |
| 4806 | * corresponding request from NDIS. |
| 4807 | * @param[in,out] handle to the wifi driver |
| 4808 | * @param[in] message containing WEP Key in the following format |
| 4809 | *|---------------------------------------| |
| 4810 | *|Key ID Value | Key Length | Key | |
| 4811 | *|-------------|------------|------------| |
| 4812 | | 1byte | 1byte | Key Length | |
| 4813 | ||---------------------------------------| |
| 4814 | | |
| 4815 | * @return Error code indicating success/failure |
| 4816 | * @note |
| 4817 | * @author zsalah |
| 4818 | * @date 8 March 2012 |
| 4819 | * @version 1.0 |
| 4820 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4821 | s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4822 | { |
| 4823 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4824 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4825 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4826 | tstrHostIFmsg strHostIFmsg; |
| 4827 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4828 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4829 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 4830 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4831 | |
| 4832 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4833 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4834 | |
| 4835 | |
| 4836 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4837 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4838 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 4839 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4840 | |
| 4841 | |
| 4842 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4843 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC(u8WepKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4844 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4845 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4846 | pu8WepKey, u8WepKeylen); |
| 4847 | |
| 4848 | |
| 4849 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4850 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4851 | |
| 4852 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4853 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4854 | |
| 4855 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4856 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4857 | if (s32Error) |
| 4858 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4859 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4860 | |
| 4861 | WILC_CATCH(s32Error) |
| 4862 | { |
| 4863 | |
| 4864 | } |
| 4865 | return s32Error; |
| 4866 | |
| 4867 | } |
| 4868 | |
| 4869 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4870 | /** |
| 4871 | * |
| 4872 | * @brief host_int_add_wep_key_bss_ap |
| 4873 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4874 | * sets WEP key entry into MAC hardware when it receives the |
| 4875 | * |
| 4876 | * corresponding request from NDIS. |
| 4877 | * @param[in,out] handle to the wifi driver |
| 4878 | * |
| 4879 | * |
| 4880 | * @return Error code indicating success/failure |
| 4881 | * @note |
| 4882 | * @author mdaftedar |
| 4883 | * @date 28 FEB 2013 |
| 4884 | * @version 1.0 |
| 4885 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4886 | s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4887 | { |
| 4888 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4889 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4890 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4891 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4892 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4893 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4894 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4895 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 4896 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4897 | |
| 4898 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4899 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4900 | |
| 4901 | if (INFO) { |
| 4902 | for (i = 0; i < u8WepKeylen; i++) |
| 4903 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4904 | } |
| 4905 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4906 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4907 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4908 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4909 | |
| 4910 | |
| 4911 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4912 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC((u8WepKeylen)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4913 | |
| 4914 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4915 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4916 | pu8WepKey, (u8WepKeylen)); |
| 4917 | |
| 4918 | |
| 4919 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4920 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4921 | |
| 4922 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4923 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4924 | |
| 4925 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4926 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4927 | |
| 4928 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4929 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4930 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4931 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4932 | |
| 4933 | if (s32Error) |
| 4934 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4935 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4936 | |
| 4937 | WILC_CATCH(s32Error) |
| 4938 | { |
| 4939 | |
| 4940 | } |
| 4941 | return s32Error; |
| 4942 | |
| 4943 | } |
| 4944 | #endif |
| 4945 | /** |
| 4946 | * @brief adds ptk Key |
| 4947 | * @details |
| 4948 | * @param[in,out] handle to the wifi driver |
| 4949 | * @param[in] message containing PTK Key in the following format |
| 4950 | *|-----------------------------------------------------------------------------| |
| 4951 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4952 | *|----------------|------------|--------------|----------------|---------------| |
| 4953 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4954 | ||-----------------------------------------------------------------------------| |
| 4955 | * @return Error code indicating success/failure |
| 4956 | * @note |
| 4957 | * @author zsalah |
| 4958 | * @date 8 March 2012 |
| 4959 | * @version 1.0 |
| 4960 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4961 | s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4962 | const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4963 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4964 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4965 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4966 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4967 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4968 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4969 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4970 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4971 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4972 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4973 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4974 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4976 | |
| 4977 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4978 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4979 | |
| 4980 | |
| 4981 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4982 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPAPtk; |
| 4983 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4984 | if (mode == AP_MODE) { |
| 4985 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4986 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4987 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4988 | } |
| 4989 | #endif |
| 4990 | if (mode == STATION_MODE) |
| 4991 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 4992 | |
| 4993 | |
| 4994 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 4995 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8PtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4996 | |
| 4997 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4998 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4999 | pu8Ptk, u8PtkKeylen); |
| 5000 | |
| 5001 | if (pu8RxMic != NULL) { |
| 5002 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5003 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5004 | pu8RxMic, RX_MIC_KEY_LEN); |
| 5005 | if (INFO) { |
| 5006 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 5007 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 5008 | } |
| 5009 | } |
| 5010 | if (pu8TxMic != NULL) { |
| 5011 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5012 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5013 | pu8TxMic, TX_MIC_KEY_LEN); |
| 5014 | if (INFO) { |
| 5015 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 5016 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 5017 | } |
| 5018 | } |
| 5019 | |
| 5020 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5021 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 5022 | |
| 5023 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5024 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
| 5025 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5026 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
| 5027 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5028 | |
| 5029 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5030 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5031 | |
| 5032 | if (s32Error) |
| 5033 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 5034 | |
| 5035 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5036 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5037 | /* /////// */ |
| 5038 | |
| 5039 | WILC_CATCH(s32Error) |
| 5040 | { |
| 5041 | |
| 5042 | } |
| 5043 | |
| 5044 | return s32Error; |
| 5045 | } |
| 5046 | |
| 5047 | /** |
| 5048 | * @brief adds Rx GTk Key |
| 5049 | * @details |
| 5050 | * @param[in,out] handle to the wifi driver |
| 5051 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 5052 | * u8GtkKeylen :The total key length |
| 5053 | * |
| 5054 | * @return Error code indicating success/failure |
| 5055 | * @note |
| 5056 | * @author zsalah |
| 5057 | * @date 8 March 2012 |
| 5058 | * @version 1.0 |
| 5059 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5060 | s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5061 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5062 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5063 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5064 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5065 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5066 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5067 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5068 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5069 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5070 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5071 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5072 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5073 | |
| 5074 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5075 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5076 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5077 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5078 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5079 | if (KeyRSC != NULL) { |
| 5080 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 5081 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = WILC_MALLOC(u32KeyRSClen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5082 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5083 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5084 | KeyRSC, u32KeyRSClen); |
| 5085 | } |
| 5086 | |
| 5087 | |
| 5088 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 5089 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPARxGtk; |
| 5090 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5091 | |
| 5092 | #ifdef WILC_AP_EXTERNAL_MLME |
| 5093 | if (mode == AP_MODE) { |
| 5094 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 5095 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
| 5096 | } |
| 5097 | #endif |
| 5098 | if (mode == STATION_MODE) |
| 5099 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 5100 | |
| 5101 | |
| 5102 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 5103 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8KeyLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5104 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5105 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5106 | pu8RxGtk, u8GtkKeylen); |
| 5107 | |
| 5108 | if (pu8RxMic != NULL) { |
| 5109 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5110 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5111 | pu8RxMic, RX_MIC_KEY_LEN); |
| 5112 | |
| 5113 | } |
| 5114 | if (pu8TxMic != NULL) { |
| 5115 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5116 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5117 | pu8TxMic, TX_MIC_KEY_LEN); |
| 5118 | |
| 5119 | } |
| 5120 | |
| 5121 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5122 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
| 5123 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5124 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 5125 | |
| 5126 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5127 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 5128 | |
| 5129 | |
| 5130 | |
| 5131 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5132 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5133 | if (s32Error) |
| 5134 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 5135 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5136 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5137 | /* /////// */ |
| 5138 | |
| 5139 | WILC_CATCH(s32Error) |
| 5140 | { |
| 5141 | |
| 5142 | } |
| 5143 | return s32Error; |
| 5144 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5145 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5146 | /** |
| 5147 | * @brief host_int_set_pmkid_info |
| 5148 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 5149 | * support is enabled. This Function sets the PMKID in firmware |
| 5150 | * when host drivr receives the corresponding request from NDIS. |
| 5151 | * The firmware then includes theset PMKID in the appropriate |
| 5152 | * management frames |
| 5153 | * @param[in,out] handle to the wifi driver |
| 5154 | * @param[in] message containing PMKID Info in the following format |
| 5155 | *|-----------------------------------------------------------------| |
| 5156 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5157 | *|-----------|------------|----------|-------|----------|----------| |
| 5158 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5159 | ||-----------------------------------------------------------------| |
| 5160 | * @return Error code indicating success/failure |
| 5161 | * @note |
| 5162 | * @author zsalah |
| 5163 | * @date 8 March 2012 |
| 5164 | * @version 1.0 |
| 5165 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5166 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5167 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5168 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5169 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5170 | tstrHostIFmsg strHostIFmsg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5171 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5172 | |
| 5173 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5174 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5175 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5176 | |
| 5177 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5178 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5179 | |
| 5180 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 5181 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA; |
| 5182 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 5183 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5184 | |
| 5185 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 5186 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5187 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5188 | ETH_ALEN); |
| 5189 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5190 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5191 | PMKID_LEN); |
| 5192 | } |
| 5193 | |
| 5194 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5195 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5196 | if (s32Error) |
| 5197 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 5198 | |
| 5199 | WILC_CATCH(s32Error) |
| 5200 | { |
| 5201 | |
| 5202 | } |
| 5203 | |
| 5204 | return s32Error; |
| 5205 | } |
| 5206 | |
| 5207 | /** |
| 5208 | * @brief gets the cached the pmkid info |
| 5209 | * @details valid only in BSS STA mode if External Supplicant |
| 5210 | * support is enabled. This Function sets the PMKID in firmware |
| 5211 | * when host drivr receives the corresponding request from NDIS. |
| 5212 | * The firmware then includes theset PMKID in the appropriate |
| 5213 | * management frames |
| 5214 | * @param[in,out] handle to the wifi driver, |
| 5215 | * message containing PMKID Info in the following format |
| 5216 | *|-----------------------------------------------------------------| |
| 5217 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5218 | *|-----------|------------|----------|-------|----------|----------| |
| 5219 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5220 | ||-----------------------------------------------------------------| |
| 5221 | * @param[in] |
| 5222 | * @return Error code indicating success/failure |
| 5223 | * @note |
| 5224 | * @author zsalah |
| 5225 | * @date 8 March 2012 |
| 5226 | * @version 1.0 |
| 5227 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5228 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5229 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5230 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5231 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5232 | tstrWID strWID; |
| 5233 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5234 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5235 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5236 | strWID.enuWIDtype = WID_STR; |
| 5237 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 5238 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 5239 | |
| 5240 | return s32Error; |
| 5241 | } |
| 5242 | |
| 5243 | /** |
| 5244 | * @brief sets the pass phrase |
| 5245 | * @details AP/STA mode. This function gives the pass phrase used to |
| 5246 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5247 | * The length of the field can vary from 8 to 64 bytes, |
| 5248 | * the lower layer should get the |
| 5249 | * @param[in,out] handle to the wifi driver, |
| 5250 | * @param[in] String containing PSK |
| 5251 | * @return Error code indicating success/failure |
| 5252 | * @note |
| 5253 | * @author zsalah |
| 5254 | * @date 8 March 2012 |
| 5255 | * @version 1.0 |
| 5256 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5257 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5258 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5259 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5260 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5261 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5262 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5263 | /*validating psk length*/ |
| 5264 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5265 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5266 | strWID.enuWIDtype = WID_STR; |
| 5267 | strWID.ps8WidVal = pu8PassPhrase; |
| 5268 | strWID.s32ValueSize = u8Psklength; |
| 5269 | } |
| 5270 | |
| 5271 | return s32Error; |
| 5272 | } |
| 5273 | /** |
| 5274 | * @brief host_int_get_MacAddress |
| 5275 | * @details gets mac address |
| 5276 | * @param[in,out] handle to the wifi driver, |
| 5277 | * |
| 5278 | * @return Error code indicating success/failure |
| 5279 | * @note |
| 5280 | * @author mdaftedar |
| 5281 | * @date 19 April 2012 |
| 5282 | * @version 1.0 |
| 5283 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5284 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5285 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5286 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5287 | tstrHostIFmsg strHostIFmsg; |
| 5288 | |
| 5289 | |
| 5290 | /* prepare the Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5291 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5292 | |
| 5293 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS; |
| 5294 | strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; |
| 5295 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5296 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5297 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5298 | if (s32Error) { |
| 5299 | PRINT_ER("Failed to send get mac address\n"); |
| 5300 | return WILC_FAIL; |
| 5301 | } |
| 5302 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5303 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5304 | return s32Error; |
| 5305 | } |
| 5306 | |
| 5307 | /** |
| 5308 | * @brief host_int_set_MacAddress |
| 5309 | * @details sets mac address |
| 5310 | * @param[in,out] handle to the wifi driver, |
| 5311 | * |
| 5312 | * @return Error code indicating success/failure |
| 5313 | * @note |
| 5314 | * @author mabubakr |
| 5315 | * @date 16 July 2012 |
| 5316 | * @version 1.0 |
| 5317 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5318 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5319 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5320 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5321 | tstrHostIFmsg strHostIFmsg; |
| 5322 | |
| 5323 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 5324 | |
| 5325 | /* prepare setting mac address message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5326 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5327 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5328 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5329 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5330 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5331 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5332 | if (s32Error) { |
| 5333 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
| 5334 | WILC_ERRORREPORT(s32Error, s32Error); |
| 5335 | } |
| 5336 | WILC_CATCH(s32Error) |
| 5337 | { |
| 5338 | |
| 5339 | } |
| 5340 | |
| 5341 | return s32Error; |
| 5342 | |
| 5343 | } |
| 5344 | |
| 5345 | /** |
| 5346 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 5347 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 5348 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5349 | * The length of the field can vary from 8 to 64 bytes, |
| 5350 | * the lower layer should get the |
| 5351 | * @param[in,out] handle to the wifi driver, |
| 5352 | * String containing PSK |
| 5353 | * @return Error code indicating success/failure |
| 5354 | * @note |
| 5355 | * @author zsalah |
| 5356 | * @date 8 March 2012 |
| 5357 | * @version 1.0 |
| 5358 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5359 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5360 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5361 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5362 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5363 | tstrWID strWID; |
| 5364 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5365 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5366 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5367 | strWID.enuWIDtype = WID_STR; |
| 5368 | strWID.s32ValueSize = u8Psklength; |
| 5369 | strWID.ps8WidVal = pu8PassPhrase; |
| 5370 | |
| 5371 | return s32Error; |
| 5372 | } |
| 5373 | |
| 5374 | /** |
| 5375 | * @brief host_int_get_site_survey_results |
| 5376 | * @details gets the site survey results |
| 5377 | * @param[in,out] handle to the wifi driver, |
| 5378 | * Message containing site survey results in the |
| 5379 | * following format |
| 5380 | *|---------------------------------------------------| |
| 5381 | | MsgLength | fragNo. | MsgBodyLength | MsgBody | |
| 5382 | ||-----------|-----------|---------------|-----------| |
| 5383 | | 1 | 1 | 1 | 1 | |
| 5384 | | ----------------------------------------- | ---------------- |
| 5385 | | |
| 5386 | ||---------------------------------------| |
| 5387 | | Network1 | Netweork2 | ... | Network5 | |
| 5388 | ||---------------------------------------| |
| 5389 | | 44 | 44 | ... | 44 | |
| 5390 | | -------------------------- | --------------------------------------- |
| 5391 | | |
| 5392 | ||---------------------------------------------------------------------| |
| 5393 | | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved | |
| 5394 | | |
| 5395 | | |
| 5396 | ||------|----------|---------|----------------|-------|------|---------| |
| 5397 | | 33 | 1 | 1 | 1 | 6 | 1 | 1 | |
| 5398 | ||---------------------------------------------------------------------| |
| 5399 | * @return Error code indicating success/failure |
| 5400 | * @note |
| 5401 | * @author zsalah |
| 5402 | * @date 8 March 2012 |
| 5403 | * @version 1.0 |
| 5404 | */ |
| 5405 | #ifndef CONNECT_DIRECT |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5406 | s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5407 | u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5408 | u32 u32MaxSiteSrvyFragLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5409 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5410 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5411 | tstrWID astrWIDList[2]; |
| 5412 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5413 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5414 | astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5415 | astrWIDList[0].enuWIDtype = WID_STR; |
| 5416 | astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0]; |
| 5417 | astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5418 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5419 | astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5420 | astrWIDList[1].enuWIDtype = WID_STR; |
| 5421 | astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1]; |
| 5422 | astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5423 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 5424 | s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, |
| 5425 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5426 | |
| 5427 | /*get the value by searching the local copy*/ |
| 5428 | if (s32Error) { |
| 5429 | PRINT_ER("Failed to send config packet to get survey results\n"); |
| 5430 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 5431 | } |
| 5432 | |
| 5433 | WILC_CATCH(s32Error) |
| 5434 | { |
| 5435 | |
| 5436 | } |
| 5437 | |
| 5438 | return s32Error; |
| 5439 | } |
| 5440 | #endif |
| 5441 | |
| 5442 | /** |
| 5443 | * @brief sets a start scan request |
| 5444 | * @details |
| 5445 | * @param[in,out] handle to the wifi driver, |
| 5446 | * @param[in] Scan Source one of the following values |
| 5447 | * DEFAULT_SCAN 0 |
| 5448 | * USER_SCAN BIT0 |
| 5449 | * OBSS_PERIODIC_SCAN BIT1 |
| 5450 | * OBSS_ONETIME_SCAN BIT2 |
| 5451 | * @return Error code indicating success/failure |
| 5452 | * @note |
| 5453 | * @author zsalah |
| 5454 | * @date 8 March 2012 |
| 5455 | * @version 1.0 |
| 5456 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5457 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5458 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5459 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5460 | tstrWID strWID; |
| 5461 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5462 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5463 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5464 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5465 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5466 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5467 | |
| 5468 | return s32Error; |
| 5469 | } |
| 5470 | |
| 5471 | /** |
| 5472 | * @brief host_int_get_start_scan_req |
| 5473 | * @details gets a start scan request |
| 5474 | * @param[in,out] handle to the wifi driver, |
| 5475 | * @param[in] Scan Source one of the following values |
| 5476 | * DEFAULT_SCAN 0 |
| 5477 | * USER_SCAN BIT0 |
| 5478 | * OBSS_PERIODIC_SCAN BIT1 |
| 5479 | * OBSS_ONETIME_SCAN BIT2 |
| 5480 | * @return Error code indicating success/failure |
| 5481 | * @note |
| 5482 | * @author zsalah |
| 5483 | * @date 8 March 2012 |
| 5484 | * @version 1.0 |
| 5485 | */ |
| 5486 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5487 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5488 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5489 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5490 | tstrWID strWID; |
| 5491 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5492 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5493 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5494 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5495 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5496 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5497 | |
| 5498 | return s32Error; |
| 5499 | } |
| 5500 | |
| 5501 | /** |
| 5502 | * @brief host_int_set_join_req |
| 5503 | * @details sets a join request |
| 5504 | * @param[in,out] handle to the wifi driver, |
| 5505 | * @param[in] Index of the bss descriptor |
| 5506 | * @return Error code indicating success/failure |
| 5507 | * @note |
| 5508 | * @author zsalah |
| 5509 | * @date 8 March 2012 |
| 5510 | * @version 1.0 |
| 5511 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5512 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 5513 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5514 | const u8 *pu8IEs, size_t IEsLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5515 | tWILCpfConnectResult pfConnectResult, void *pvUserArg, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5516 | u8 u8security, AUTHTYPE_T tenuAuth_type, |
| 5517 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5518 | void *pJoinParams) |
| 5519 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5520 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5521 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5522 | tstrHostIFmsg strHostIFmsg; |
| 5523 | tenuScanConnTimer enuScanConnTimer; |
| 5524 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5525 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5526 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5527 | |
| 5528 | if (hWFIDrv == NULL) { |
| 5529 | PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n"); |
| 5530 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5531 | } |
| 5532 | |
| 5533 | if (pJoinParams == NULL) { |
| 5534 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
| 5535 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5536 | |
| 5537 | } |
| 5538 | /* |
| 5539 | * if(gWFiDrvHandle->strWILC_UsrScanReq.u32RcvdChCount == 0) |
| 5540 | * { |
| 5541 | * PRINT_ER("No scan results exist: Scanning should be done\n"); |
| 5542 | * WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5543 | * } |
| 5544 | */ |
| 5545 | /* prepare the Connect Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5546 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5547 | |
| 5548 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT; |
| 5549 | |
| 5550 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8security = u8security; |
| 5551 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type; |
| 5552 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8channel = u8channel; |
| 5553 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pfConnectResult = pfConnectResult; |
| 5554 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pvUserArg = pvUserArg; |
| 5555 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pJoinParams = pJoinParams; |
| 5556 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5557 | |
| 5558 | if (pu8bssid != NULL) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 5559 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = WILC_MALLOC(6); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5560 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5561 | pu8bssid, 6); |
| 5562 | } |
| 5563 | |
| 5564 | if (pu8ssid != NULL) { |
| 5565 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 5566 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5567 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5568 | |
| 5569 | pu8ssid, ssidLen); |
| 5570 | } |
| 5571 | |
| 5572 | if (pu8IEs != NULL) { |
| 5573 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 5574 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5575 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5576 | pu8IEs, IEsLen); |
| 5577 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5578 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5579 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5580 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5581 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 5582 | |
| 5583 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5584 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5585 | if (s32Error) { |
| 5586 | PRINT_ER("Failed to send message queue: Set join request\n"); |
| 5587 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5588 | } |
| 5589 | |
| 5590 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5591 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 5592 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 5593 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5594 | |
| 5595 | WILC_CATCH(s32Error) |
| 5596 | { |
| 5597 | |
| 5598 | } |
| 5599 | |
| 5600 | return s32Error; |
| 5601 | } |
| 5602 | |
| 5603 | /** |
| 5604 | * @brief Flush a join request parameters to FW, but actual connection |
| 5605 | * @details The function is called in situation where WILC is connected to AP and |
| 5606 | * required to switch to hybrid FW for P2P connection |
| 5607 | * @param[in] handle to the wifi driver, |
| 5608 | * @return Error code indicating success/failure |
| 5609 | * @note |
| 5610 | * @author Amr Abdel-Moghny |
| 5611 | * @date 19 DEC 2013 |
| 5612 | * @version 8.0 |
| 5613 | */ |
| 5614 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5615 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5616 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5617 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5618 | tstrHostIFmsg strHostIFmsg; |
| 5619 | |
| 5620 | if (!gu8FlushedJoinReq) { |
| 5621 | s32Error = WILC_FAIL; |
| 5622 | return s32Error; |
| 5623 | } |
| 5624 | |
| 5625 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5626 | if (hWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5627 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5628 | |
| 5629 | |
| 5630 | strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT; |
| 5631 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5632 | |
| 5633 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5634 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5635 | if (s32Error) { |
| 5636 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
| 5637 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5638 | } |
| 5639 | |
| 5640 | WILC_CATCH(s32Error) |
| 5641 | { |
| 5642 | |
| 5643 | } |
| 5644 | return s32Error; |
| 5645 | } |
| 5646 | |
| 5647 | /** |
| 5648 | * @brief host_int_disconnect |
| 5649 | * @details disconnects from the currently associated network |
| 5650 | * @param[in,out] handle to the wifi driver, |
| 5651 | * @param[in] Reason Code of the Disconnection |
| 5652 | * @return Error code indicating success/failure |
| 5653 | * @note |
| 5654 | * @author zsalah |
| 5655 | * @date 8 March 2012 |
| 5656 | * @version 1.0 |
| 5657 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5658 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5659 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5660 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5661 | tstrHostIFmsg strHostIFmsg; |
| 5662 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5663 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5664 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5665 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5666 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5667 | } |
| 5668 | |
| 5669 | if (pstrWFIDrv == NULL) { |
| 5670 | PRINT_ER("gWFiDrvHandle = NULL\n"); |
| 5671 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5672 | } |
| 5673 | |
| 5674 | /* prepare the Disconnect Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5675 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5676 | |
| 5677 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT; |
| 5678 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5679 | |
| 5680 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5681 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5682 | if (s32Error) |
| 5683 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5684 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5685 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5686 | /* /////// */ |
| 5687 | |
| 5688 | WILC_CATCH(s32Error) |
| 5689 | { |
| 5690 | |
| 5691 | } |
| 5692 | |
| 5693 | return s32Error; |
| 5694 | } |
| 5695 | |
| 5696 | /** |
| 5697 | * @brief host_int_disconnect_station |
| 5698 | * @details disconnects a sta |
| 5699 | * @param[in,out] handle to the wifi driver, |
| 5700 | * @param[in] Association Id of the station to be disconnected |
| 5701 | * @return Error code indicating success/failure |
| 5702 | * @note |
| 5703 | * @author zsalah |
| 5704 | * @date 8 March 2012 |
| 5705 | * @version 1.0 |
| 5706 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5707 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5708 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5709 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5710 | tstrWID strWID; |
| 5711 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5712 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5713 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5714 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5715 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5716 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5717 | |
| 5718 | return s32Error; |
| 5719 | } |
| 5720 | |
| 5721 | /** |
| 5722 | * @brief host_int_get_assoc_req_info |
| 5723 | * @details gets a Association request info |
| 5724 | * @param[in,out] handle to the wifi driver, |
| 5725 | * Message containg assoc. req info in the following format |
| 5726 | * ------------------------------------------------------------------------ |
| 5727 | | Management Frame Format | |
| 5728 | ||-------------------------------------------------------------------| |
| 5729 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5730 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5731 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5732 | ||-------------------------------------------------------------------| |
| 5733 | | | |
| 5734 | | Association Request Frame - Frame Body | |
| 5735 | ||-------------------------------------------------------------------| |
| 5736 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5737 | ||------------------------|-----------------|------|-----------------| |
| 5738 | | 2 | 2 | 2-34 | 3-10 | |
| 5739 | | --------------------------------------------------------------------- |
| 5740 | * @return Error code indicating success/failure |
| 5741 | * @note |
| 5742 | * @author zsalah |
| 5743 | * @date 8 March 2012 |
| 5744 | * @version 1.0 |
| 5745 | */ |
| 5746 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5747 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5748 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5749 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5750 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5751 | tstrWID strWID; |
| 5752 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5753 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5754 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5755 | strWID.enuWIDtype = WID_STR; |
| 5756 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5757 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5758 | |
| 5759 | |
| 5760 | return s32Error; |
| 5761 | } |
| 5762 | |
| 5763 | /** |
| 5764 | * @brief gets a Association Response info |
| 5765 | * @details |
| 5766 | * @param[in,out] handle to the wifi driver, |
| 5767 | * Message containg assoc. resp info |
| 5768 | * @return Error code indicating success/failure |
| 5769 | * @note |
| 5770 | * @author zsalah |
| 5771 | * @date 8 March 2012 |
| 5772 | * @version 1.0 |
| 5773 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5774 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5775 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5776 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5777 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5778 | tstrWID strWID; |
| 5779 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5780 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5781 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5782 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5783 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5784 | } |
| 5785 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5786 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5787 | strWID.enuWIDtype = WID_STR; |
| 5788 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5789 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5790 | |
| 5791 | |
| 5792 | /* Sending Configuration packet */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 5793 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5794 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5795 | if (s32Error) { |
| 5796 | PRINT_ER("Failed to send association response config packet\n"); |
| 5797 | *pu32RcvdAssocRespInfoLen = 0; |
| 5798 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 5799 | } else { |
| 5800 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5801 | } |
| 5802 | |
| 5803 | WILC_CATCH(s32Error) |
| 5804 | { |
| 5805 | |
| 5806 | } |
| 5807 | return s32Error; |
| 5808 | } |
| 5809 | |
| 5810 | /** |
| 5811 | * @brief gets a Association Response info |
| 5812 | * @details Valid only in STA mode. This function gives the RSSI |
| 5813 | * values observed in all the channels at the time of scanning. |
| 5814 | * The length of the field is 1 greater that the total number of |
| 5815 | * channels supported. Byte 0 contains the number of channels while |
| 5816 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5817 | * @param[in,out] handle to the wifi driver, |
| 5818 | * array of scanned channels' RSSI |
| 5819 | * @return Error code indicating success/failure |
| 5820 | * @note |
| 5821 | * @author zsalah |
| 5822 | * @date 8 March 2012 |
| 5823 | * @version 1.0 |
| 5824 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5825 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5826 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5827 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5828 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5829 | tstrWID strWID; |
| 5830 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5831 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5832 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5833 | strWID.enuWIDtype = WID_STR; |
| 5834 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5835 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5836 | |
| 5837 | |
| 5838 | return s32Error; |
| 5839 | } |
| 5840 | |
| 5841 | /** |
| 5842 | * @brief sets a channel |
| 5843 | * @details |
| 5844 | * @param[in,out] handle to the wifi driver, |
| 5845 | * @param[in] Index of the channel to be set |
| 5846 | *|-------------------------------------------------------------------| |
| 5847 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5848 | | Input: 1 2 14 | |
| 5849 | ||-------------------------------------------------------------------| |
| 5850 | * @return Error code indicating success/failure |
| 5851 | * @note |
| 5852 | * @author zsalah |
| 5853 | * @date 8 March 2012 |
| 5854 | * @version 1.0 |
| 5855 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5856 | s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5857 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5858 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5859 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5860 | tstrHostIFmsg strHostIFmsg; |
| 5861 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5862 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5863 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5864 | |
| 5865 | /* prepare the set channel message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5866 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5867 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL; |
| 5868 | strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; |
| 5869 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5870 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5871 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5872 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5873 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5874 | WILC_CATCH(s32Error) |
| 5875 | { |
| 5876 | |
| 5877 | } |
| 5878 | |
| 5879 | return s32Error; |
| 5880 | } |
| 5881 | |
| 5882 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5883 | s32 host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5885 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5886 | |
| 5887 | tstrHostIFmsg strHostIFmsg; |
| 5888 | |
| 5889 | /* prepare the set driver handler message */ |
| 5890 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5891 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5892 | strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5893 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5894 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5895 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5896 | WILC_CATCH(s32Error) |
| 5897 | { |
| 5898 | |
| 5899 | } |
| 5900 | |
| 5901 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5902 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5903 | |
| 5904 | return s32Error; |
| 5905 | |
| 5906 | } |
| 5907 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5908 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5909 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5910 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5911 | |
| 5912 | tstrHostIFmsg strHostIFmsg; |
| 5913 | |
| 5914 | |
| 5915 | /* prepare the set driver handler message */ |
| 5916 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5917 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5918 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 5919 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = get_id_from_handler(u32address); |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 5920 | strHostIFmsg.drvHandler = u32address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5921 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5922 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5923 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5924 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5925 | WILC_CATCH(s32Error) |
| 5926 | { |
| 5927 | |
| 5928 | } |
| 5929 | |
| 5930 | return s32Error; |
| 5931 | } |
| 5932 | |
| 5933 | |
| 5934 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5935 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5936 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5937 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5938 | |
| 5939 | tstrHostIFmsg strHostIFmsg; |
| 5940 | |
| 5941 | |
| 5942 | /* prepare the set driver handler message */ |
| 5943 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5944 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5945 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE; |
| 5946 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; |
| 5947 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5948 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5949 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5950 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5951 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5952 | WILC_CATCH(s32Error) |
| 5953 | { |
| 5954 | |
| 5955 | } |
| 5956 | |
| 5957 | return s32Error; |
| 5958 | } |
| 5959 | |
| 5960 | /** |
| 5961 | * @brief gets the current channel index |
| 5962 | * @details |
| 5963 | * @param[in,out] handle to the wifi driver, |
| 5964 | * current channel index |
| 5965 | *|-----------------------------------------------------------------------| |
| 5966 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5967 | | Input: 1 2 14 | |
| 5968 | ||-----------------------------------------------------------------------| |
| 5969 | * @return Error code indicating success/failure |
| 5970 | * @note |
| 5971 | * @author zsalah |
| 5972 | * @date 8 March 2012 |
| 5973 | * @version 1.0 |
| 5974 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5975 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5976 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5977 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5978 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5979 | tstrHostIFmsg strHostIFmsg; |
| 5980 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5981 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5982 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5983 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5984 | } |
| 5985 | |
| 5986 | /* prepare the Get Channel Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5987 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5988 | |
| 5989 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL; |
| 5990 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5991 | |
| 5992 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5993 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5994 | if (s32Error) |
| 5995 | PRINT_ER("Failed to send get host channel param's message queue "); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5996 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5997 | /* gu8Chnl = 11; */ |
| 5998 | |
| 5999 | *pu8ChNo = gu8Chnl; |
| 6000 | |
| 6001 | WILC_CATCH(s32Error) |
| 6002 | { |
| 6003 | } |
| 6004 | |
| 6005 | return s32Error; |
| 6006 | |
| 6007 | |
| 6008 | } |
| 6009 | |
| 6010 | |
| 6011 | /** |
| 6012 | * @brief host_int_test_set_int_wid |
| 6013 | * @details Test function for setting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6014 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6015 | * @return Error code indicating success/failure |
| 6016 | * @note |
| 6017 | * @author zsalah |
| 6018 | * @date 8 March 2012 |
| 6019 | * @version 1.0 |
| 6020 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6021 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6022 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6023 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6024 | tstrWID strWID; |
| 6025 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6026 | |
| 6027 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6028 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6029 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6030 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6031 | } |
| 6032 | |
| 6033 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6034 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6035 | strWID.enuWIDtype = WID_INT; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 6036 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6037 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6038 | |
| 6039 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6040 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 6041 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6042 | if (s32Error) { |
| 6043 | PRINT_ER("Test Function: Failed to set wid value\n"); |
| 6044 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 6045 | } else { |
| 6046 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); |
| 6047 | |
| 6048 | } |
| 6049 | |
| 6050 | WILC_CATCH(s32Error) |
| 6051 | { |
| 6052 | |
| 6053 | } |
| 6054 | return s32Error; |
| 6055 | } |
| 6056 | |
| 6057 | #ifdef WILC_AP_EXTERNAL_MLME |
| 6058 | /** |
| 6059 | * @brief host_int_get_inactive_time |
| 6060 | * @details |
| 6061 | * @param[in,out] handle to the wifi driver, |
| 6062 | * current sta macaddress, inactive_time |
| 6063 | * @return |
| 6064 | * @note |
| 6065 | * @author |
| 6066 | * @date |
| 6067 | * @version 1.0 |
| 6068 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6069 | s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6070 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6071 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6072 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6073 | tstrHostIFmsg strHostIFmsg; |
| 6074 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6075 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6076 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6077 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6078 | } |
| 6079 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6080 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6081 | |
| 6082 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6083 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6084 | mac, ETH_ALEN); |
| 6085 | |
| 6086 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME; |
| 6087 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6088 | |
| 6089 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6090 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6091 | if (s32Error) |
| 6092 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6093 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6094 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6095 | |
| 6096 | *pu32InactiveTime = gu32InactiveTime; |
| 6097 | |
| 6098 | WILC_CATCH(s32Error) |
| 6099 | { |
| 6100 | } |
| 6101 | |
| 6102 | return s32Error; |
| 6103 | } |
| 6104 | #endif |
| 6105 | /** |
| 6106 | * @brief host_int_test_get_int_wid |
| 6107 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6108 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6109 | * @return Error code indicating success/failure |
| 6110 | * @note |
| 6111 | * @author zsalah |
| 6112 | * @date 8 March 2012 |
| 6113 | * @version 1.0 |
| 6114 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6115 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6116 | { |
| 6117 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6118 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6119 | tstrWID strWID; |
| 6120 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6121 | |
| 6122 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6123 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6124 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6125 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6126 | } |
| 6127 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6128 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6129 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6130 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6131 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6132 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6133 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 6134 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6135 | /*get the value by searching the local copy*/ |
| 6136 | if (s32Error) { |
| 6137 | PRINT_ER("Test Function: Failed to get wid value\n"); |
| 6138 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 6139 | } else { |
| 6140 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 6141 | |
| 6142 | } |
| 6143 | |
| 6144 | WILC_CATCH(s32Error) |
| 6145 | { |
| 6146 | |
| 6147 | } |
| 6148 | return s32Error; |
| 6149 | } |
| 6150 | |
| 6151 | |
| 6152 | /** |
| 6153 | * @brief host_int_get_rssi |
| 6154 | * @details gets the currently maintained RSSI value for the station. |
| 6155 | * The received signal strength value in dB. |
| 6156 | * The range of valid values is -128 to 0. |
| 6157 | * @param[in,out] handle to the wifi driver, |
| 6158 | * rssi value in dB |
| 6159 | * @return Error code indicating success/failure |
| 6160 | * @note |
| 6161 | * @author zsalah |
| 6162 | * @date 8 March 2012 |
| 6163 | * @version 1.0 |
| 6164 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6165 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6166 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6167 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6168 | tstrHostIFmsg strHostIFmsg; |
| 6169 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6170 | |
| 6171 | |
| 6172 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6173 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6174 | |
| 6175 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; |
| 6176 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6177 | |
| 6178 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6179 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6180 | if (s32Error) { |
| 6181 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6182 | return WILC_FAIL; |
| 6183 | } |
| 6184 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6185 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6186 | |
| 6187 | |
| 6188 | if (ps8Rssi == NULL) { |
| 6189 | PRINT_ER("RSS pointer value is null"); |
| 6190 | return WILC_FAIL; |
| 6191 | } |
| 6192 | |
| 6193 | |
| 6194 | *ps8Rssi = gs8Rssi; |
| 6195 | |
| 6196 | |
| 6197 | return s32Error; |
| 6198 | } |
| 6199 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6200 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6201 | { |
| 6202 | tstrHostIFmsg strHostIFmsg; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6203 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6204 | |
| 6205 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6206 | |
| 6207 | |
| 6208 | |
| 6209 | /* prepare the Get LINKSPEED Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6210 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6211 | |
| 6212 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED; |
| 6213 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6214 | |
| 6215 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6216 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6217 | if (s32Error) { |
| 6218 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
| 6219 | return WILC_FAIL; |
| 6220 | } |
| 6221 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6222 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6223 | |
| 6224 | |
| 6225 | if (ps8lnkspd == NULL) { |
| 6226 | PRINT_ER("LINKSPEED pointer value is null"); |
| 6227 | return WILC_FAIL; |
| 6228 | } |
| 6229 | |
| 6230 | |
| 6231 | *ps8lnkspd = gs8lnkspd; |
| 6232 | |
| 6233 | |
| 6234 | return s32Error; |
| 6235 | } |
| 6236 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6237 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6238 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6239 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6240 | tstrHostIFmsg strHostIFmsg; |
| 6241 | |
| 6242 | |
| 6243 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6244 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6245 | |
| 6246 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 6247 | strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6248 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6249 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6250 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6251 | if (s32Error) { |
| 6252 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6253 | return WILC_FAIL; |
| 6254 | } |
| 6255 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6256 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6257 | return s32Error; |
| 6258 | } |
| 6259 | |
| 6260 | |
| 6261 | /** |
| 6262 | * @brief host_int_scan |
| 6263 | * @details scans a set of channels |
| 6264 | * @param[in,out] handle to the wifi driver, |
| 6265 | * @param[in] Scan source |
| 6266 | * Scan Type PASSIVE_SCAN = 0, |
| 6267 | * ACTIVE_SCAN = 1 |
| 6268 | * Channels Array |
| 6269 | * Channels Array length |
| 6270 | * Scan Callback function |
| 6271 | * @return Error code indicating success/failure |
| 6272 | * @note |
| 6273 | * @author zsalah |
| 6274 | * @date 8 March 2012 |
| 6275 | * @version 1.0 |
| 6276 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6277 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6278 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 6279 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6280 | size_t IEsLen, tWILCpfScanResult ScanResult, |
| 6281 | void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork) |
| 6282 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6283 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6284 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6285 | tstrHostIFmsg strHostIFmsg; |
| 6286 | tenuScanConnTimer enuScanConnTimer; |
| 6287 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6288 | if (pstrWFIDrv == NULL || ScanResult == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6289 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6290 | |
| 6291 | |
| 6292 | /* prepare the Scan Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6293 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6294 | |
| 6295 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN; |
| 6296 | |
| 6297 | if (pstrHiddenNetwork != NULL) { |
| 6298 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 6299 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
| 6300 | |
| 6301 | } else |
| 6302 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 6303 | |
| 6304 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6305 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanSource = u8ScanSource; |
| 6306 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanType = u8ScanType; |
| 6307 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pfScanResult = ScanResult; |
| 6308 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; |
| 6309 | |
| 6310 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 6311 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6312 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6313 | pu8ChnlFreqList, u8ChnlListLen); |
| 6314 | |
| 6315 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 6316 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6317 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6318 | pu8IEs, IEsLen); |
| 6319 | |
| 6320 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6321 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6322 | if (s32Error) { |
| 6323 | PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error); |
| 6324 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 6325 | } |
| 6326 | |
| 6327 | enuScanConnTimer = SCAN_TIMER; |
| 6328 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6329 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 6330 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 6331 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6332 | |
| 6333 | WILC_CATCH(s32Error) |
| 6334 | { |
| 6335 | |
| 6336 | } |
| 6337 | return s32Error; |
| 6338 | |
| 6339 | } |
| 6340 | /** |
| 6341 | * @brief hif_set_cfg |
| 6342 | * @details sets configuration wids values |
| 6343 | * @param[in,out] handle to the wifi driver, |
| 6344 | * @param[in] WID, WID value |
| 6345 | * @return Error code indicating success/failure |
| 6346 | * @note |
| 6347 | * @author zsalah |
| 6348 | * @date 8 March 2012 |
| 6349 | * @version 1.0 |
| 6350 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6351 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6352 | { |
| 6353 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6354 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6355 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6356 | |
| 6357 | tstrHostIFmsg strHostIFmsg; |
| 6358 | |
| 6359 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6360 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6361 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6362 | /* prepare the WiphyParams Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6363 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6364 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; |
| 6365 | strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; |
| 6366 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6367 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6368 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6369 | |
| 6370 | WILC_CATCH(s32Error) |
| 6371 | { |
| 6372 | } |
| 6373 | |
| 6374 | return s32Error; |
| 6375 | |
| 6376 | } |
| 6377 | |
| 6378 | |
| 6379 | /** |
| 6380 | * @brief hif_get_cfg |
| 6381 | * @details gets configuration wids values |
| 6382 | * @param[in,out] handle to the wifi driver, |
| 6383 | * WID value |
| 6384 | * @param[in] WID, |
| 6385 | * @return Error code indicating success/failure |
| 6386 | * @note |
| 6387 | * @author zsalah |
| 6388 | * |
| 6389 | * @date 8 March 2012 |
| 6390 | * @version 1.0 |
| 6391 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6392 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6393 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6394 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6395 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6396 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6397 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6398 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6399 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6400 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6401 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6402 | } |
| 6403 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 6404 | switch (u16WID) { |
| 6405 | |
| 6406 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6407 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6408 | break; |
| 6409 | |
| 6410 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6411 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6412 | break; |
| 6413 | |
| 6414 | case WID_AUTH_TIMEOUT: |
| 6415 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 6416 | break; |
| 6417 | |
| 6418 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6419 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6420 | break; |
| 6421 | |
| 6422 | case WID_SHORT_RETRY_LIMIT: |
| 6423 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 6424 | break; |
| 6425 | |
| 6426 | case WID_LONG_RETRY_LIMIT: |
| 6427 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 6428 | break; |
| 6429 | |
| 6430 | case WID_FRAG_THRESHOLD: |
| 6431 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 6432 | break; |
| 6433 | |
| 6434 | case WID_RTS_THRESHOLD: |
| 6435 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 6436 | break; |
| 6437 | |
| 6438 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6439 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6440 | break; |
| 6441 | |
| 6442 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6443 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6444 | break; |
| 6445 | |
| 6446 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6447 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6448 | break; |
| 6449 | |
| 6450 | case WID_BEACON_INTERVAL: |
| 6451 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 6452 | break; |
| 6453 | |
| 6454 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6455 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6456 | break; |
| 6457 | |
| 6458 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6459 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6460 | break; |
| 6461 | |
| 6462 | case WID_SITE_SURVEY_SCAN_TIME: |
| 6463 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 6464 | break; |
| 6465 | |
| 6466 | case WID_ACTIVE_SCAN_TIME: |
| 6467 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 6468 | break; |
| 6469 | |
| 6470 | case WID_PASSIVE_SCAN_TIME: |
| 6471 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 6472 | break; |
| 6473 | |
| 6474 | case WID_CURRENT_TX_RATE: |
| 6475 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 6476 | break; |
| 6477 | |
| 6478 | default: |
| 6479 | break; |
| 6480 | } |
| 6481 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6482 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6483 | |
| 6484 | WILC_CATCH(s32Error) |
| 6485 | { |
| 6486 | } |
| 6487 | return s32Error; |
| 6488 | |
| 6489 | } |
| 6490 | |
| 6491 | /*****************************************************************************/ |
| 6492 | /* Notification Functions */ |
| 6493 | /*****************************************************************************/ |
| 6494 | /** |
| 6495 | * @brief notifies host with join and leave requests |
| 6496 | * @details This function prepares an Information frame having the |
| 6497 | * information about a joining/leaving station. |
| 6498 | * @param[in,out] handle to the wifi driver, |
| 6499 | * @param[in] 6 byte Sta Adress |
| 6500 | * Join or leave flag: |
| 6501 | * Join = 1, |
| 6502 | * Leave =0 |
| 6503 | * @return Error code indicating success/failure |
| 6504 | * @note |
| 6505 | * @author zsalah |
| 6506 | * @date 8 March 2012 |
| 6507 | * @version 1.0 |
| 6508 | */ |
| 6509 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6510 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6511 | { |
| 6512 | } |
| 6513 | /** |
| 6514 | * @brief notifies host with stations found in scan |
| 6515 | * @details sends the beacon/probe response from scan |
| 6516 | * @param[in,out] handle to the wifi driver, |
| 6517 | * @param[in] Sta Address, |
| 6518 | * Frame length, |
| 6519 | * Rssi of the Station found |
| 6520 | * @return Error code indicating success/failure |
| 6521 | * @note |
| 6522 | * @author zsalah |
| 6523 | * @date 8 March 2012 |
| 6524 | * @version 1.0 |
| 6525 | */ |
| 6526 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6527 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6528 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6529 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6530 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6531 | if (pstrWFIDrv == NULL) { |
| 6532 | PRINT_ER("Driver handler is NULL\n"); |
| 6533 | return; |
| 6534 | } |
| 6535 | |
| 6536 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6537 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6538 | tstrHostIFmsg strHostIFmsg; |
| 6539 | |
| 6540 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6541 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6542 | |
| 6543 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; |
| 6544 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6545 | |
| 6546 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6547 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6548 | if (s32Error) { |
| 6549 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6550 | return; |
| 6551 | } |
| 6552 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6553 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 6554 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6555 | } |
| 6556 | |
| 6557 | |
| 6558 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6559 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6560 | { |
| 6561 | } |
| 6562 | /** |
| 6563 | * @brief host_int_init |
| 6564 | * @details host interface initialization function |
| 6565 | * @param[in,out] handle to the wifi driver, |
| 6566 | * @note |
| 6567 | * @author zsalah |
| 6568 | * @date 8 March 2012 |
| 6569 | * @version 1.0 |
| 6570 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6571 | static u32 u32Intialized; |
| 6572 | static u32 msgQ_created; |
| 6573 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6574 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6575 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6576 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6577 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6578 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6579 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6580 | |
| 6581 | /*if(u32Intialized == 1) |
| 6582 | * { |
| 6583 | * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n"); |
| 6584 | * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P |
| 6585 | * return 0; |
| 6586 | * } */ |
| 6587 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 6588 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6589 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6590 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6591 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6592 | |
| 6593 | |
| 6594 | |
| 6595 | /*Allocate host interface private structure*/ |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 6596 | pstrWFIDrv = WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6597 | if (pstrWFIDrv == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6598 | /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */ |
| 6599 | s32Error = WILC_NO_MEM; |
| 6600 | PRINT_ER("Failed to allocate memory\n"); |
| 6601 | goto _fail_timer_2; |
| 6602 | } |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6603 | memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6604 | /*return driver handle to user*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6605 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6606 | /*save into globl handle*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6607 | err = add_handler_in_list(pstrWFIDrv); |
| 6608 | if (err) { |
| 6609 | s32Error = WILC_FAIL; |
| 6610 | goto _fail_timer_2; |
| 6611 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6612 | |
| 6613 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 6614 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6615 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6616 | #endif |
| 6617 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6618 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6619 | /* /////////////////////////////////////// */ |
| 6620 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6621 | sema_init(&hSemHostIFthrdEnd, 0); |
| 6622 | sema_init(&hSemDeinitDrvHandle, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6623 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6624 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6625 | } |
| 6626 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6627 | sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0); |
| 6628 | sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0); |
| 6629 | sema_init(&(pstrWFIDrv->hSemGetRSSI), 0); |
| 6630 | sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0); |
| 6631 | sema_init(&(pstrWFIDrv->hSemGetCHNL), 0); |
| 6632 | sema_init(&(pstrWFIDrv->hSemInactiveTime), 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6633 | |
| 6634 | /* /////////////////////////////////////// */ |
| 6635 | |
| 6636 | |
| 6637 | |
| 6638 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 6639 | |
| 6640 | if (clients_count == 0) { |
Chaehyun Lim | cd08fc7 | 2015-08-19 15:59:05 +0900 | [diff] [blame] | 6641 | s32Error = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6642 | |
| 6643 | if (s32Error < 0) { |
| 6644 | PRINT_ER("Failed to creat MQ\n"); |
| 6645 | goto _fail_; |
| 6646 | } |
| 6647 | msgQ_created = 1; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6648 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 6649 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6650 | PRINT_ER("Failed to creat Thread\n"); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6651 | s32Error = WILC_FAIL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6652 | goto _fail_mq_; |
| 6653 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 6654 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 6655 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6656 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6657 | } |
| 6658 | |
| 6659 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6660 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6661 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6662 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6663 | |
| 6664 | #ifdef WILC_P2P |
| 6665 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6666 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6667 | #endif |
| 6668 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6669 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
| 6670 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6671 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6672 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6673 | /* gWFiDrvHandle->bPendingConnRequest = false; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6674 | |
| 6675 | /*Initialize CFG WIDS Defualt Values*/ |
| 6676 | |
| 6677 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 6678 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 6679 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 6680 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 6681 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 6682 | |
| 6683 | |
| 6684 | #ifdef WILC_P2P |
| 6685 | |
| 6686 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 6687 | |
| 6688 | #endif |
| 6689 | |
| 6690 | PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n", |
| 6691 | |
| 6692 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 6693 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 6694 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 6695 | |
| 6696 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6697 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6698 | |
| 6699 | /*TODO Code to setup simulation to be removed later*/ |
| 6700 | /*Intialize configurator module*/ |
| 6701 | s32Error = CoreConfiguratorInit(); |
| 6702 | if (s32Error < 0) { |
| 6703 | PRINT_ER("Failed to initialize core configurator\n"); |
| 6704 | goto _fail_mem_; |
| 6705 | } |
| 6706 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6707 | u32Intialized = 1; |
| 6708 | clients_count++; /* increase number of created entities */ |
| 6709 | |
| 6710 | return s32Error; |
| 6711 | |
| 6712 | |
| 6713 | _fail_mem_: |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6714 | if (pstrWFIDrv != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6715 | kfree(pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6716 | #ifdef WILC_P2P |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6717 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6718 | #endif |
| 6719 | _fail_timer_2: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6720 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6721 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6722 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6723 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6724 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6725 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6726 | _fail_: |
| 6727 | return s32Error; |
| 6728 | |
| 6729 | |
| 6730 | } |
| 6731 | /** |
| 6732 | * @brief host_int_deinit |
| 6733 | * @details host interface initialization function |
| 6734 | * @param[in,out] handle to the wifi driver, |
| 6735 | * @note |
| 6736 | * @author zsalah |
| 6737 | * @date 8 March 2012 |
| 6738 | * @version 1.0 |
| 6739 | */ |
| 6740 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6741 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6742 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6743 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6744 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6745 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6746 | |
| 6747 | /*obtain driver handle*/ |
| 6748 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6749 | /*if(u32Intialized == 0) |
| 6750 | * { |
| 6751 | * PRINT_ER("Host Interface is not initialized\n"); |
| 6752 | * return 0; |
| 6753 | * }*/ |
| 6754 | |
| 6755 | /*BugID_5348*/ |
| 6756 | |
| 6757 | if (pstrWFIDrv == NULL) { |
| 6758 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 6759 | return 0; |
| 6760 | } |
| 6761 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6762 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6763 | |
| 6764 | terminated_handle = pstrWFIDrv; |
| 6765 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 6766 | |
| 6767 | /*BugID_5348*/ |
| 6768 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 6769 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6770 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6771 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6772 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 6773 | } |
| 6774 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6775 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6776 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6777 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6778 | } |
| 6779 | |
| 6780 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6781 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6782 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6783 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6784 | } |
| 6785 | |
| 6786 | #ifdef WILC_P2P |
| 6787 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6788 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6789 | #endif |
| 6790 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6791 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6792 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6793 | |
| 6794 | |
| 6795 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6796 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6797 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6798 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6799 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6800 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6801 | } |
| 6802 | /*deinit configurator and simulator*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6803 | CoreConfiguratorDeInit(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6804 | |
| 6805 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6806 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6807 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6808 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6809 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6810 | |
| 6811 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6812 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6813 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6814 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6815 | } |
| 6816 | strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT; |
| 6817 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6818 | |
| 6819 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6820 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6821 | if (s32Error != WILC_SUCCESS) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6822 | PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6823 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6824 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6825 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6826 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6827 | msgQ_created = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6828 | } |
| 6829 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6830 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6831 | |
| 6832 | /*Setting the gloabl driver handler with NULL*/ |
| 6833 | u32Intialized = 0; |
| 6834 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6835 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6836 | if (ret) |
| 6837 | s32Error = WILC_NOT_FOUND; |
| 6838 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6839 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6840 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6841 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6842 | |
| 6843 | } |
| 6844 | |
| 6845 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6846 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6847 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6848 | return s32Error; |
| 6849 | } |
| 6850 | |
| 6851 | |
| 6852 | /** |
| 6853 | * @brief NetworkInfoReceived |
| 6854 | * @details function to to be called when network info packet is received |
| 6855 | * @param[in] pu8Buffer the received packet |
| 6856 | * @param[in] u32Length length of the received packet |
| 6857 | * @return none |
| 6858 | * @note |
| 6859 | * @author |
| 6860 | * @date 1 Mar 2012 |
| 6861 | * @version 1.0 |
| 6862 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6863 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6864 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6865 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6866 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6867 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6868 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6869 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6870 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6871 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6872 | |
| 6873 | |
| 6874 | |
| 6875 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6876 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6877 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6878 | return; |
| 6879 | } |
| 6880 | |
| 6881 | /* prepare the Asynchronous Network Info message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6882 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6883 | |
| 6884 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO; |
| 6885 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6886 | |
| 6887 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 6888 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6889 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6890 | pu8Buffer, u32Length); |
| 6891 | |
| 6892 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6893 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6894 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6895 | PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6896 | } |
| 6897 | |
| 6898 | /** |
| 6899 | * @brief GnrlAsyncInfoReceived |
| 6900 | * @details function to be called when general Asynchronous info packet is received |
| 6901 | * @param[in] pu8Buffer the received packet |
| 6902 | * @param[in] u32Length length of the received packet |
| 6903 | * @return none |
| 6904 | * @note |
| 6905 | * @author |
| 6906 | * @date 15 Mar 2012 |
| 6907 | * @version 1.0 |
| 6908 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6909 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6910 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6911 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6912 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6913 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6914 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6915 | |
| 6916 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6917 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6918 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6919 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6920 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6921 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6922 | |
| 6923 | |
| 6924 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6925 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
| 6926 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6927 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6928 | return; |
| 6929 | } |
| 6930 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6931 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6932 | /* received mac status is not needed when there is no current Connect Request */ |
| 6933 | PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); |
| 6934 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6935 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6936 | return; |
| 6937 | } |
| 6938 | |
| 6939 | /* prepare the General Asynchronous Info message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6940 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6941 | |
| 6942 | |
| 6943 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
| 6944 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6945 | |
| 6946 | |
| 6947 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 6948 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6949 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6950 | pu8Buffer, u32Length); |
| 6951 | |
| 6952 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6953 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6954 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6955 | PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6956 | |
| 6957 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6958 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6959 | } |
| 6960 | |
| 6961 | /** |
| 6962 | * @brief host_int_ScanCompleteReceived |
| 6963 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6964 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6965 | * @return Error code. |
| 6966 | * @author |
| 6967 | * @date |
| 6968 | * @version 1.0 |
| 6969 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6970 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6971 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6972 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6973 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6974 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6975 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6976 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame^] | 6977 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6978 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6979 | |
| 6980 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6981 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6982 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6983 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6984 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6985 | |
| 6986 | /*if there is an ongoing scan request*/ |
| 6987 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6988 | /* prepare theScan Done message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6989 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6990 | |
| 6991 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
| 6992 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6993 | |
| 6994 | |
| 6995 | /* will be deallocated by the receiving thread */ |
| 6996 | /*no need to send message body*/ |
| 6997 | |
| 6998 | /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6999 | * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7000 | * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7001 | * pu8Buffer, u32Length); */ |
| 7002 | |
| 7003 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7004 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7005 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7006 | PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7007 | } |
| 7008 | |
| 7009 | |
| 7010 | return; |
| 7011 | |
| 7012 | } |
| 7013 | |
| 7014 | #ifdef WILC_P2P |
| 7015 | /** |
| 7016 | * @brief host_int_remain_on_channel |
| 7017 | * @details |
| 7018 | * @param[in] Handle to wifi driver |
| 7019 | * Duration to remain on channel |
| 7020 | * Channel to remain on |
| 7021 | * Pointer to fn to be called on receive frames in listen state |
| 7022 | * Pointer to remain-on-channel expired fn |
| 7023 | * Priv |
| 7024 | * @return Error code. |
| 7025 | * @author |
| 7026 | * @date |
| 7027 | * @version 1.0 |
| 7028 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7029 | s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7030 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7031 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7032 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7033 | tstrHostIFmsg strHostIFmsg; |
| 7034 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7035 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7036 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7037 | |
| 7038 | /* prepare the remainonchan Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7039 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7040 | |
| 7041 | /* prepare the WiphyParams Message */ |
| 7042 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN; |
| 7043 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u16Channel = chan; |
| 7044 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired; |
| 7045 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady; |
| 7046 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pVoid = pvUserArg; |
| 7047 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32duration = u32duration; |
| 7048 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
| 7049 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7050 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7051 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7052 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7053 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7054 | WILC_CATCH(s32Error) |
| 7055 | { |
| 7056 | |
| 7057 | } |
| 7058 | |
| 7059 | return s32Error; |
| 7060 | } |
| 7061 | |
| 7062 | /** |
| 7063 | * @brief host_int_ListenStateExpired |
| 7064 | * @details |
| 7065 | * @param[in] Handle to wifi driver |
| 7066 | * Duration to remain on channel |
| 7067 | * Channel to remain on |
| 7068 | * Pointer to fn to be called on receive frames in listen state |
| 7069 | * Pointer to remain-on-channel expired fn |
| 7070 | * Priv |
| 7071 | * @return Error code. |
| 7072 | * @author |
| 7073 | * @date |
| 7074 | * @version 1.0 |
| 7075 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7076 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7077 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7078 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7079 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7080 | tstrHostIFmsg strHostIFmsg; |
| 7081 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7082 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7083 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7084 | |
| 7085 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 7086 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7087 | |
| 7088 | /* prepare the timer fire Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7089 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7090 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
| 7091 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7092 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
| 7093 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7094 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7095 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7096 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7097 | WILC_CATCH(s32Error) |
| 7098 | { |
| 7099 | |
| 7100 | } |
| 7101 | return s32Error; |
| 7102 | } |
| 7103 | |
| 7104 | /** |
| 7105 | * @brief host_int_frame_register |
| 7106 | * @details |
| 7107 | * @param[in] Handle to wifi driver |
| 7108 | * @return Error code. |
| 7109 | * @author |
| 7110 | * @date |
| 7111 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7112 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7113 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7114 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7115 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7116 | tstrHostIFmsg strHostIFmsg; |
| 7117 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7118 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7119 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7120 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7121 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7122 | |
| 7123 | /* prepare the WiphyParams Message */ |
| 7124 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME; |
| 7125 | switch (u16FrameType) { |
| 7126 | case ACTION: |
| 7127 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
| 7128 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX; |
| 7129 | break; |
| 7130 | |
| 7131 | case PROBE_REQ: |
| 7132 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
| 7133 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX; |
| 7134 | break; |
| 7135 | |
| 7136 | default: |
| 7137 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 7138 | break; |
| 7139 | } |
| 7140 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u16FrameType = u16FrameType; |
| 7141 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg; |
| 7142 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7143 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7144 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7145 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7146 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7147 | WILC_CATCH(s32Error) |
| 7148 | { |
| 7149 | |
| 7150 | } |
| 7151 | |
| 7152 | return s32Error; |
| 7153 | |
| 7154 | |
| 7155 | } |
| 7156 | #endif |
| 7157 | |
| 7158 | #ifdef WILC_AP_EXTERNAL_MLME |
| 7159 | /** |
| 7160 | * @brief host_int_add_beacon |
| 7161 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7162 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 7163 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 7164 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7165 | * @return Error code. |
| 7166 | * @author |
| 7167 | * @date |
| 7168 | * @version 1.0 |
| 7169 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7170 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7171 | u32 u32DTIMPeriod, |
| 7172 | u32 u32HeadLen, u8 *pu8Head, |
| 7173 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7174 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7175 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7176 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7177 | tstrHostIFmsg strHostIFmsg; |
| 7178 | tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon; |
| 7179 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7180 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7181 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7182 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7183 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7184 | |
| 7185 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 7186 | |
| 7187 | |
| 7188 | /* prepare the WiphyParams Message */ |
| 7189 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BEACON; |
| 7190 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7191 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 7192 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 7193 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 7194 | pstrSetBeaconParam->pu8Head = WILC_MALLOC(u32HeadLen); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7195 | if (pstrSetBeaconParam->pu8Head == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7196 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7197 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7198 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 7199 | |
| 7200 | /* Bug 4599 : if tail length = 0 skip allocating & copying */ |
| 7201 | if (u32TailLen > 0) { |
Chaehyun Lim | dc0ad74 | 2015-08-17 11:05:12 +0900 | [diff] [blame] | 7202 | pstrSetBeaconParam->pu8Tail = WILC_MALLOC(u32TailLen); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7203 | if (pstrSetBeaconParam->pu8Tail == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7204 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7205 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7206 | } else { |
| 7207 | pstrSetBeaconParam->pu8Tail = NULL; |
| 7208 | } |
| 7209 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7210 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7211 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7212 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7213 | |
| 7214 | WILC_CATCH(s32Error) |
| 7215 | { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7216 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7217 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7218 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7219 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7220 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7221 | } |
| 7222 | |
| 7223 | return s32Error; |
| 7224 | |
| 7225 | } |
| 7226 | |
| 7227 | |
| 7228 | /** |
| 7229 | * @brief host_int_del_beacon |
| 7230 | * @details Setting add beacon params in message queue |
| 7231 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 7232 | * @return Error code. |
| 7233 | * @author |
| 7234 | * @date |
| 7235 | * @version 1.0 |
| 7236 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7237 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7238 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7239 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7240 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7241 | tstrHostIFmsg strHostIFmsg; |
| 7242 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7243 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7244 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7245 | |
| 7246 | /* prepare the WiphyParams Message */ |
| 7247 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON; |
| 7248 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7249 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 7250 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7251 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7252 | WILC_ERRORCHECK(s32Error); |
| 7253 | |
| 7254 | WILC_CATCH(s32Error) |
| 7255 | { |
| 7256 | } |
| 7257 | return s32Error; |
| 7258 | } |
| 7259 | |
| 7260 | |
| 7261 | /** |
| 7262 | * @brief host_int_add_station |
| 7263 | * @details Setting add station params in message queue |
| 7264 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams |
| 7265 | * @return Error code. |
| 7266 | * @author |
| 7267 | * @date |
| 7268 | * @version 1.0 |
| 7269 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7270 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7271 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7272 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7273 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7274 | tstrHostIFmsg strHostIFmsg; |
| 7275 | tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; |
| 7276 | |
| 7277 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7278 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7279 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7280 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7281 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7282 | |
| 7283 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 7284 | |
| 7285 | |
| 7286 | /* prepare the WiphyParams Message */ |
| 7287 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION; |
| 7288 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7289 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7290 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7291 | if (pstrAddStationMsg->u8NumRates > 0) { |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7292 | u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7293 | |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7294 | WILC_NULLCHECK(s32Error, rates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7295 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7296 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7297 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7298 | } |
| 7299 | |
| 7300 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7301 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7302 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7303 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7304 | |
| 7305 | WILC_CATCH(s32Error) |
| 7306 | { |
| 7307 | } |
| 7308 | return s32Error; |
| 7309 | } |
| 7310 | |
| 7311 | /** |
| 7312 | * @brief host_int_del_station |
| 7313 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7314 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7315 | * @return Error code. |
| 7316 | * @author |
| 7317 | * @date |
| 7318 | * @version 1.0 |
| 7319 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7320 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7321 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7322 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7323 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7324 | tstrHostIFmsg strHostIFmsg; |
| 7325 | tstrHostIFDelSta *pstrDelStationMsg = &strHostIFmsg.uniHostIFmsgBody.strDelStaParam; |
| 7326 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7327 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7328 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7329 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7330 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7331 | |
| 7332 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 7333 | |
| 7334 | |
| 7335 | |
| 7336 | /* prepare the WiphyParams Message */ |
| 7337 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_STATION; |
| 7338 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7339 | |
| 7340 | /*BugID_4795: Handling situation of deleting all stations*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 7341 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7342 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7343 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7344 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7345 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7346 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7347 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7348 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7349 | |
| 7350 | WILC_CATCH(s32Error) |
| 7351 | { |
| 7352 | } |
| 7353 | return s32Error; |
| 7354 | } |
| 7355 | /** |
| 7356 | * @brief host_int_del_allstation |
| 7357 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7358 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7359 | * @return Error code. |
| 7360 | * @author |
| 7361 | * @date |
| 7362 | * @version 1.0 |
| 7363 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7364 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7365 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7366 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7367 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7368 | tstrHostIFmsg strHostIFmsg; |
| 7369 | tstrHostIFDelAllSta *pstrDelAllStationMsg = &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7370 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7371 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7372 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7373 | |
| 7374 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7375 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7376 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7377 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7378 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7379 | |
| 7380 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 7381 | |
| 7382 | /* prepare the WiphyParams Message */ |
| 7383 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_STA; |
| 7384 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7385 | |
| 7386 | /* Handling situation of deauthenticing all associated stations*/ |
| 7387 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 7388 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7389 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7390 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4], |
| 7391 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 7392 | u8AssocNumb++; |
| 7393 | } |
| 7394 | } |
| 7395 | if (!u8AssocNumb) { |
| 7396 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 7397 | return s32Error; |
| 7398 | } |
| 7399 | |
| 7400 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7401 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7402 | |
| 7403 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7404 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7405 | WILC_ERRORREPORT(s32Error, s32Error); |
| 7406 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7407 | WILC_CATCH(s32Error) |
| 7408 | { |
| 7409 | |
| 7410 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7411 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7412 | |
| 7413 | return s32Error; |
| 7414 | |
| 7415 | } |
| 7416 | |
| 7417 | /** |
| 7418 | * @brief host_int_edit_station |
| 7419 | * @details Setting edit station params in message queue |
| 7420 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams |
| 7421 | * @return Error code. |
| 7422 | * @author |
| 7423 | * @date |
| 7424 | * @version 1.0 |
| 7425 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7426 | s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7427 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7428 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7429 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7430 | tstrHostIFmsg strHostIFmsg; |
| 7431 | tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; |
| 7432 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7433 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7434 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7435 | |
| 7436 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 7437 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7438 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7439 | |
| 7440 | |
| 7441 | /* prepare the WiphyParams Message */ |
| 7442 | strHostIFmsg.u16MsgId = HOST_IF_MSG_EDIT_STATION; |
| 7443 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7444 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7445 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7446 | if (pstrAddStationMsg->u8NumRates > 0) { |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7447 | u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7448 | |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7449 | WILC_NULLCHECK(s32Error, rates); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7450 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7451 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7452 | } |
| 7453 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7454 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7455 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7456 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7457 | WILC_CATCH(s32Error) |
| 7458 | { |
| 7459 | } |
| 7460 | return s32Error; |
| 7461 | } |
| 7462 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
| 7463 | uint32_t wilc_get_chipid(uint8_t); |
| 7464 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7465 | s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7466 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7467 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7468 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7469 | tstrHostIFmsg strHostIFmsg; |
| 7470 | tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam; |
| 7471 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7472 | PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7473 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7474 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7475 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7476 | |
| 7477 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 7478 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7479 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7480 | |
| 7481 | |
| 7482 | /* prepare the WiphyParams Message */ |
| 7483 | strHostIFmsg.u16MsgId = HOST_IF_MSG_POWER_MGMT; |
| 7484 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7485 | |
| 7486 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 7487 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 7488 | |
| 7489 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7490 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7491 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7492 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7493 | WILC_CATCH(s32Error) |
| 7494 | { |
| 7495 | } |
| 7496 | return s32Error; |
| 7497 | } |
| 7498 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7499 | s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7500 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7501 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7502 | |
| 7503 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7504 | tstrHostIFmsg strHostIFmsg; |
| 7505 | tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti; |
| 7506 | |
| 7507 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7508 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7509 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7510 | |
| 7511 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 7512 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7513 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7514 | |
| 7515 | |
| 7516 | /* prepare the WiphyParams Message */ |
| 7517 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MULTICAST_FILTER; |
| 7518 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7519 | |
| 7520 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 7521 | pstrMulticastFilterParam->u32count = u32count; |
| 7522 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7523 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7524 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7525 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7526 | WILC_CATCH(s32Error) |
| 7527 | { |
| 7528 | } |
| 7529 | return s32Error; |
| 7530 | } |
| 7531 | |
| 7532 | |
| 7533 | |
| 7534 | /*Bug4218: Parsing Join Param*/ |
| 7535 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 7536 | |
| 7537 | /*Bug4218: Parsing Join Param*/ |
| 7538 | /** |
| 7539 | * @brief host_int_ParseJoinBssParam |
| 7540 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 7541 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7542 | * @return |
| 7543 | * @author zsalah |
| 7544 | * @date |
| 7545 | * @version 1.0**/ |
| 7546 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 7547 | { |
| 7548 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7549 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7550 | u16 u16IEsLen; |
| 7551 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7552 | u8 suppRatesNo = 0; |
| 7553 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7554 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7555 | u8 pcipherCount; |
| 7556 | u8 authCount; |
| 7557 | u8 pcipherTotalCount = 0; |
| 7558 | u8 authTotalCount = 0; |
| 7559 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7560 | |
| 7561 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 7562 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 7563 | |
| 7564 | pNewJoinBssParam = WILC_MALLOC(sizeof(tstrJoinBssParam)); |
| 7565 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7566 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7567 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 7568 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 7569 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7570 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7571 | /*for(i=0; i<6;i++) |
| 7572 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7573 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7574 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7575 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 7576 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7577 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 7578 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 7579 | |
| 7580 | /* parse supported rates: */ |
| 7581 | while (index < u16IEsLen) { |
| 7582 | /* supportedRates IE */ |
| 7583 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 7584 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 7585 | suppRatesNo = pu8IEs[index + 1]; |
| 7586 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 7587 | index += 2; /* skipping ID and length bytes; */ |
| 7588 | |
| 7589 | for (i = 0; i < suppRatesNo; i++) { |
| 7590 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 7591 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 7592 | } |
| 7593 | index += suppRatesNo; |
| 7594 | continue; |
| 7595 | } |
| 7596 | /* Ext SupportedRates IE */ |
| 7597 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 7598 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 7599 | /* checking if no of ext. supp and supp rates < max limit */ |
| 7600 | extSuppRatesNo = pu8IEs[index + 1]; |
| 7601 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 7602 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 7603 | else |
| 7604 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 7605 | index += 2; |
| 7606 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 7607 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 7608 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 7609 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 7610 | } |
| 7611 | index += extSuppRatesNo; |
| 7612 | continue; |
| 7613 | } |
| 7614 | /* HT Cap. IE */ |
| 7615 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 7616 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7617 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7618 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7619 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 7620 | continue; |
| 7621 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 7622 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 7623 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 7624 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 7625 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 7626 | (pu8IEs[index + 7] == 0x01)) { |
| 7627 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7628 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7629 | |
| 7630 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7631 | if (pu8IEs[index + 8] & (1 << 7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7632 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7633 | index += pu8IEs[index + 1] + 2; |
| 7634 | continue; |
| 7635 | } |
| 7636 | #ifdef WILC_P2P |
| 7637 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 7638 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 7639 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 7640 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7641 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7642 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7643 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 7644 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 7645 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 7646 | |
| 7647 | /* Check if Bit 7 is set indicating Opss capability */ |
| 7648 | if (pu8IEs[index + 10] & (1 << 7)) { |
| 7649 | pNewJoinBssParam->u8OppEnable = 1; |
| 7650 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 7651 | } else |
| 7652 | pNewJoinBssParam->u8OppEnable = 0; |
| 7653 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7654 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7655 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7656 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7657 | |
| 7658 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 7659 | u16P2P_count = index + 12; |
| 7660 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7661 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7662 | u16P2P_count += 4; |
| 7663 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7664 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7665 | u16P2P_count += 4; |
| 7666 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7667 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7668 | |
| 7669 | index += pu8IEs[index + 1] + 2; |
| 7670 | continue; |
| 7671 | |
| 7672 | } |
| 7673 | #endif |
| 7674 | else if ((pu8IEs[index] == RSN_IE) || |
| 7675 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 7676 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 7677 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7678 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7679 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 7680 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 7681 | * { |
| 7682 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 7683 | * }*/ |
| 7684 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 7685 | pNewJoinBssParam->mode_802_11i = 2; |
| 7686 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 7687 | } else { /* check if rsn was previously parsed */ |
| 7688 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 7689 | pNewJoinBssParam->mode_802_11i = 1; |
| 7690 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 7691 | rsnIndex += 4; |
| 7692 | } |
| 7693 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 7694 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 7695 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7696 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7697 | /* initialize policies with invalid values */ |
| 7698 | |
| 7699 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 7700 | |
| 7701 | /*parsing pairwise cipher*/ |
| 7702 | |
| 7703 | /* saving 3 pcipher max. */ |
| 7704 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7705 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7706 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7707 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7708 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 7709 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7710 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7711 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 7712 | } |
| 7713 | pcipherTotalCount += pcipherCount; |
| 7714 | rsnIndex += jumpOffset; |
| 7715 | |
| 7716 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 7717 | |
| 7718 | /*parsing AKM suite (auth_policy)*/ |
| 7719 | /* saving 3 auth policies max. */ |
| 7720 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7721 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7722 | |
| 7723 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 7724 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7725 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7726 | } |
| 7727 | authTotalCount += authCount; |
| 7728 | rsnIndex += jumpOffset; |
| 7729 | /*pasring rsn cap. only if rsn IE*/ |
| 7730 | if (pu8IEs[index] == RSN_IE) { |
| 7731 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 7732 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 7733 | rsnIndex += 2; |
| 7734 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 7735 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7736 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7737 | continue; |
| 7738 | } else |
| 7739 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7740 | |
| 7741 | } |
| 7742 | |
| 7743 | |
| 7744 | } |
| 7745 | |
| 7746 | return (void *)pNewJoinBssParam; |
| 7747 | |
| 7748 | } |
| 7749 | |
| 7750 | void host_int_freeJoinParams(void *pJoinParams) |
| 7751 | { |
| 7752 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7753 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7754 | else |
| 7755 | PRINT_ER("Unable to FREE null pointer\n"); |
| 7756 | } |
| 7757 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 7758 | |
| 7759 | |
| 7760 | /** |
| 7761 | * @brief host_int_addBASession |
| 7762 | * @details Open a block Ack session with the given parameters |
| 7763 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7764 | * @return |
| 7765 | * @author anoureldin |
| 7766 | * @date |
| 7767 | * @version 1.0**/ |
| 7768 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 7769 | static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7770 | short int SessionTimeout, void *drvHandler) |
| 7771 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7772 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7773 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7774 | tstrHostIFmsg strHostIFmsg; |
| 7775 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7776 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7777 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7778 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7779 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7780 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7781 | |
| 7782 | /* prepare the WiphyParams Message */ |
| 7783 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION; |
| 7784 | |
| 7785 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7786 | pBASessionInfo->u8Ted = TID; |
| 7787 | pBASessionInfo->u16BufferSize = BufferSize; |
| 7788 | pBASessionInfo->u16SessionTimeout = SessionTimeout; |
| 7789 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7790 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7791 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7792 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7793 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7794 | WILC_CATCH(s32Error) |
| 7795 | { |
| 7796 | |
| 7797 | } |
| 7798 | |
| 7799 | return s32Error; |
| 7800 | } |
| 7801 | |
| 7802 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7803 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7804 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7805 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7806 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7807 | tstrHostIFmsg strHostIFmsg; |
| 7808 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7809 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7810 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7811 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7812 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7813 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7814 | |
| 7815 | /* prepare the WiphyParams Message */ |
| 7816 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION; |
| 7817 | |
| 7818 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7819 | pBASessionInfo->u8Ted = TID; |
| 7820 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7821 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7822 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7823 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7824 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7825 | WILC_CATCH(s32Error) |
| 7826 | { |
| 7827 | |
| 7828 | } |
| 7829 | |
| 7830 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7831 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7832 | |
| 7833 | return s32Error; |
| 7834 | } |
| 7835 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7836 | s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7837 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7838 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7839 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7840 | tstrHostIFmsg strHostIFmsg; |
| 7841 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7842 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7843 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7844 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7845 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7846 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7847 | |
| 7848 | /* prepare the WiphyParams Message */ |
| 7849 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
| 7850 | |
| 7851 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7852 | pBASessionInfo->u8Ted = TID; |
| 7853 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7854 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7855 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7856 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7857 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7858 | WILC_CATCH(s32Error) |
| 7859 | { |
| 7860 | |
| 7861 | } |
| 7862 | |
| 7863 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7864 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7865 | |
| 7866 | return s32Error; |
| 7867 | } |
| 7868 | |
| 7869 | /** |
| 7870 | * @brief host_int_setup_ipaddress |
| 7871 | * @details setup IP in firmware |
| 7872 | * @param[in] Handle to wifi driver |
| 7873 | * @return Error code. |
| 7874 | * @author Abdelrahman Sobhy |
| 7875 | * @date |
| 7876 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7877 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7878 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7879 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7880 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7881 | tstrHostIFmsg strHostIFmsg; |
| 7882 | |
| 7883 | /* TODO: Enable This feature on softap firmware */ |
| 7884 | return 0; |
| 7885 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7886 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7887 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7888 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7889 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7890 | |
| 7891 | /* prepare the WiphyParams Message */ |
| 7892 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS; |
| 7893 | |
| 7894 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; |
| 7895 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7896 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; |
| 7897 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7898 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7899 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7900 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7901 | WILC_CATCH(s32Error) |
| 7902 | { |
| 7903 | |
| 7904 | } |
| 7905 | |
| 7906 | return s32Error; |
| 7907 | |
| 7908 | |
| 7909 | } |
| 7910 | |
| 7911 | /** |
| 7912 | * @brief host_int_get_ipaddress |
| 7913 | * @details Get IP from firmware |
| 7914 | * @param[in] Handle to wifi driver |
| 7915 | * @return Error code. |
| 7916 | * @author Abdelrahman Sobhy |
| 7917 | * @date |
| 7918 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7919 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7920 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7921 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7922 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7923 | tstrHostIFmsg strHostIFmsg; |
| 7924 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7925 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7926 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7927 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7928 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7929 | |
| 7930 | /* prepare the WiphyParams Message */ |
| 7931 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; |
| 7932 | |
| 7933 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; |
Sunil Shahu | bf903c1 | 2015-06-22 19:23:01 +0530 | [diff] [blame] | 7934 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7935 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7936 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7937 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7938 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7939 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7940 | WILC_CATCH(s32Error) |
| 7941 | { |
| 7942 | |
| 7943 | } |
| 7944 | |
| 7945 | return s32Error; |
| 7946 | |
| 7947 | |
| 7948 | } |