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 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | |
| 6 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 7 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 8 | #endif |
| 9 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 10 | /*BugID_5137*/ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 11 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 12 | /*****************************************************************************/ |
| 13 | /* Macros */ |
| 14 | /*****************************************************************************/ |
| 15 | |
| 16 | /* Message types of the Host IF Message Queue*/ |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 17 | #define HOST_IF_MSG_SCAN 0 |
| 18 | #define HOST_IF_MSG_CONNECT 1 |
| 19 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 20 | #define HOST_IF_MSG_KEY 3 |
| 21 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 22 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 23 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 24 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 25 | #define HOST_IF_MSG_DISCONNECT 8 |
| 26 | #define HOST_IF_MSG_GET_RSSI 9 |
| 27 | #define HOST_IF_MSG_GET_CHNL 10 |
| 28 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 29 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 30 | #define HOST_IF_MSG_ADD_STATION 13 |
| 31 | #define HOST_IF_MSG_DEL_STATION 14 |
| 32 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 33 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 34 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 35 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 36 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 37 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 38 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 39 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 40 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 41 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 42 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 43 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 44 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 45 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 46 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 47 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 48 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 49 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 50 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 51 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 52 | #define HOST_IF_MSG_Q_IDLE 35 |
| 53 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 54 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 55 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 56 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 57 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 58 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 59 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 60 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 61 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 62 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 63 | /*****************************************************************************/ |
| 64 | /* Type Definitions */ |
| 65 | /*****************************************************************************/ |
| 66 | |
| 67 | /*! |
| 68 | * @struct tstrHostIFCfgParamAttr |
| 69 | * @brief Structure to hold Host IF CFG Params Attributes |
| 70 | * @details |
| 71 | * @todo |
| 72 | * @sa |
| 73 | * @author Mai Daftedar |
| 74 | * @date 02 April 2012 |
| 75 | * @version 1.0 |
| 76 | */ |
| 77 | typedef struct _tstrHostIFCfgParamAttr { |
| 78 | tstrCfgParamVal pstrCfgParamVal; |
| 79 | |
| 80 | } tstrHostIFCfgParamAttr; |
| 81 | |
| 82 | /*! |
| 83 | * @struct tstrHostIFwpaAttr |
| 84 | * @brief Structure to hold Host IF Scan Attributes |
| 85 | * @details |
| 86 | * @todo |
| 87 | * @sa |
| 88 | * @author Mai Daftedar |
| 89 | * @date 25 March 2012 |
| 90 | * @version 1.0 |
| 91 | */ |
| 92 | typedef struct _tstrHostIFwpaAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 93 | u8 *pu8key; |
| 94 | const u8 *pu8macaddr; |
| 95 | u8 *pu8seq; |
| 96 | u8 u8seqlen; |
| 97 | u8 u8keyidx; |
| 98 | u8 u8Keylen; |
| 99 | u8 u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 100 | } tstrHostIFwpaAttr; |
| 101 | |
| 102 | |
| 103 | /*! |
| 104 | * @struct tstrHostIFwepAttr |
| 105 | * @brief Structure to hold Host IF Scan Attributes |
| 106 | * @details |
| 107 | * @todo |
| 108 | * @sa |
| 109 | * @author Mai Daftedar |
| 110 | * @date 25 March 2012 |
| 111 | * @version 1.0 |
| 112 | */ |
| 113 | typedef struct _tstrHostIFwepAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 114 | u8 *pu8WepKey; |
| 115 | u8 u8WepKeylen; |
| 116 | u8 u8Wepidx; |
| 117 | u8 u8mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 118 | AUTHTYPE_T tenuAuth_type; |
| 119 | |
| 120 | } tstrHostIFwepAttr; |
| 121 | |
| 122 | /*! |
| 123 | * @struct tuniHostIFkeyAttr |
| 124 | * @brief Structure to hold Host IF Scan Attributes |
| 125 | * @details |
| 126 | * @todo |
| 127 | * @sa |
| 128 | * @author Mai Daftedar |
| 129 | * @date 25 March 2012 |
| 130 | * @version 1.0 |
| 131 | */ |
| 132 | typedef union _tuniHostIFkeyAttr { |
| 133 | tstrHostIFwepAttr strHostIFwepAttr; |
| 134 | tstrHostIFwpaAttr strHostIFwpaAttr; |
| 135 | tstrHostIFpmkidAttr strHostIFpmkidAttr; |
| 136 | } tuniHostIFkeyAttr; |
| 137 | |
| 138 | /*! |
| 139 | * @struct tstrHostIFkeyAttr |
| 140 | * @brief Structure to hold Host IF Scan Attributes |
| 141 | * @details |
| 142 | * @todo |
| 143 | * @sa |
| 144 | * @author Mai Daftedar |
| 145 | * @date 25 March 2012 |
| 146 | * @version 1.0 |
| 147 | */ |
| 148 | typedef struct _tstrHostIFkeyAttr { |
| 149 | tenuKeyType enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 150 | u8 u8KeyAction; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 151 | tuniHostIFkeyAttr uniHostIFkeyAttr; |
| 152 | } tstrHostIFkeyAttr; |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | /*! |
| 158 | * @struct tstrHostIFscanAttr |
| 159 | * @brief Structure to hold Host IF Scan Attributes |
| 160 | * @details |
| 161 | * @todo |
| 162 | * @sa |
| 163 | * @author Mostafa Abu Bakr |
| 164 | * @date 25 March 2012 |
| 165 | * @version 1.0 |
| 166 | */ |
| 167 | typedef struct _tstrHostIFscanAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 168 | u8 u8ScanSource; |
| 169 | u8 u8ScanType; |
| 170 | u8 *pu8ChnlFreqList; |
| 171 | u8 u8ChnlListLen; |
| 172 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 173 | size_t IEsLen; |
| 174 | tWILCpfScanResult pfScanResult; |
| 175 | void *pvUserArg; |
| 176 | /*BugID_4189*/ |
| 177 | tstrHiddenNetwork strHiddenNetwork; |
| 178 | |
| 179 | } tstrHostIFscanAttr; |
| 180 | |
| 181 | /*! |
| 182 | * @struct tstrHostIFconnectAttr |
| 183 | * @brief Structure to hold Host IF Connect Attributes |
| 184 | * @details |
| 185 | * @todo |
| 186 | * @sa |
| 187 | * @author Mostafa Abu Bakr |
| 188 | * @date 25 March 2012 |
| 189 | * @version 1.0 |
| 190 | */ |
| 191 | typedef struct _tstrHostIFconnectAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 192 | u8 *pu8bssid; |
| 193 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 194 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 195 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 196 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 197 | u8 u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | tWILCpfConnectResult pfConnectResult; |
| 199 | void *pvUserArg; |
| 200 | AUTHTYPE_T tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 201 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 202 | void *pJoinParams; |
| 203 | } tstrHostIFconnectAttr; |
| 204 | |
| 205 | /*! |
| 206 | * @struct tstrRcvdGnrlAsyncInfo |
| 207 | * @brief Structure to hold Received General Asynchronous info |
| 208 | * @details |
| 209 | * @todo |
| 210 | * @sa |
| 211 | * @author Mostafa Abu Bakr |
| 212 | * @date 25 March 2012 |
| 213 | * @version 1.0 |
| 214 | */ |
| 215 | typedef struct _tstrRcvdGnrlAsyncInfo { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 216 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 217 | u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 218 | } tstrRcvdGnrlAsyncInfo; |
| 219 | |
| 220 | /*! |
| 221 | * @struct tstrHostIFSetChan |
| 222 | * @brief Set Channel message body |
| 223 | * @details |
| 224 | * @todo |
| 225 | * @sa |
| 226 | * @author Mai Daftedar |
| 227 | * @date 25 March 2012 |
| 228 | * @version 1.0 |
| 229 | */ |
| 230 | typedef struct _tstrHostIFSetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 231 | u8 u8SetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 232 | } tstrHostIFSetChan; |
| 233 | |
| 234 | /*! |
| 235 | * @struct tstrHostIFSetChan |
| 236 | * @brief Get Channel message body |
| 237 | * @details |
| 238 | * @todo |
| 239 | * @sa |
| 240 | * @author Mai Daftedar |
| 241 | * @date 01 Jule 2012 |
| 242 | * @version 1.0 |
| 243 | */ |
| 244 | typedef struct _tstrHostIFGetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 245 | u8 u8GetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 246 | } tstrHostIFGetChan; |
| 247 | |
| 248 | /*bug3819: Add Scan acomplete notification to host*/ |
| 249 | /*! |
| 250 | * @struct tstrScanComplete |
| 251 | * @brief hold received Async. Scan Complete message body |
| 252 | * @details |
| 253 | * @todo |
| 254 | * @sa |
| 255 | * @author zsalah |
| 256 | * @date 25 March 2012 |
| 257 | * @version 1.0 |
| 258 | */ |
| 259 | /*typedef struct _tstrScanComplete |
| 260 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 261 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 262 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 263 | * } tstrScanComplete;*/ |
| 264 | |
| 265 | /*! |
| 266 | * @struct tstrHostIFSetBeacon |
| 267 | * @brief Set Beacon message body |
| 268 | * @details |
| 269 | * @todo |
| 270 | * @sa |
| 271 | * @author Adham Abozaeid |
| 272 | * @date 10 July 2012 |
| 273 | * @version 1.0 |
| 274 | */ |
| 275 | typedef struct _tstrHostIFSetBeacon { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 276 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 277 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 278 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 279 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 280 | 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] | 281 | * 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] | 282 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 283 | 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] | 284 | * after the TIM inormation element */ |
| 285 | } tstrHostIFSetBeacon; |
| 286 | |
| 287 | |
| 288 | |
| 289 | /*! |
| 290 | * @struct tstrHostIFDelBeacon |
| 291 | * @brief Del Beacon message body |
| 292 | * @details |
| 293 | * @todo |
| 294 | * @sa |
| 295 | * @author Adham Abozaeid |
| 296 | * @date 15 July 2012 |
| 297 | * @version 1.0 |
| 298 | */ |
| 299 | typedef struct _tstrHostIFDelBeacon { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 300 | u8 u8dummy; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 301 | } tstrHostIFDelBeacon; |
| 302 | |
| 303 | /*! |
| 304 | * @struct tstrHostIFSetMulti |
| 305 | * @brief set Multicast filter Address |
| 306 | * @details |
| 307 | * @todo |
| 308 | * @sa |
| 309 | * @author Abdelrahman Sobhy |
| 310 | * @date 30 August 2013 |
| 311 | * @version 1.0 Description |
| 312 | */ |
| 313 | |
| 314 | typedef struct { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 315 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 316 | u32 u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 317 | } tstrHostIFSetMulti; |
| 318 | |
| 319 | /*! |
| 320 | * @struct tstrHostIFDelAllSta |
| 321 | * @brief Deauth station message body |
| 322 | * @details |
| 323 | * @todo |
| 324 | * @sa |
| 325 | * @author Mai Daftedar |
| 326 | * @date 09 April 2014 |
| 327 | * @version 1.0 Description |
| 328 | */ |
| 329 | |
| 330 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 331 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 332 | u8 u8Num_AssocSta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 333 | } tstrHostIFDelAllSta; |
| 334 | |
| 335 | /*! |
| 336 | * @struct tstrHostIFDelSta |
| 337 | * @brief Delete station message body |
| 338 | * @details |
| 339 | * @todo |
| 340 | * @sa |
| 341 | * @author Adham Abozaeid |
| 342 | * @date 15 July 2012 |
| 343 | * @version 1.0 Description |
| 344 | */ |
| 345 | |
| 346 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 347 | u8 au8MacAddr[ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 348 | } tstrHostIFDelSta; |
| 349 | |
| 350 | /*! |
| 351 | * @struct tstrTimerCb |
| 352 | * @brief Timer callback message body |
| 353 | * @details |
| 354 | * @todo |
| 355 | * @sa |
| 356 | * @author Mostafa Abu Bakr |
| 357 | * @date 25 March 2012 |
| 358 | * @version 1.0 |
| 359 | */ |
| 360 | typedef struct _tstrTimerCb { |
| 361 | void *pvUsrArg; /*!< Private data passed at timer start */ |
| 362 | } tstrTimerCb; |
| 363 | |
| 364 | /*! |
| 365 | * @struct tstrHostIfPowerMgmtParam |
| 366 | * @brief Power management message body |
| 367 | * @details |
| 368 | * @todo |
| 369 | * @sa |
| 370 | * @author Adham Abozaeid |
| 371 | * @date 24 November 2012 |
| 372 | * @version 1.0 |
| 373 | */ |
| 374 | typedef struct { |
| 375 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 376 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 377 | u32 u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 378 | } tstrHostIfPowerMgmtParam; |
| 379 | |
| 380 | /*! |
| 381 | * @struct tstrHostIFSetIPAddr |
| 382 | * @brief set IP Address message body |
| 383 | * @details |
| 384 | * @todo |
| 385 | * @sa |
| 386 | * @author Abdelrahman Sobhy |
| 387 | * @date 30 August 2013 |
| 388 | * @version 1.0 Description |
| 389 | */ |
| 390 | |
| 391 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 392 | u8 *au8IPAddr; |
| 393 | u8 idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | } tstrHostIFSetIPAddr; |
| 395 | |
| 396 | /*! |
| 397 | * @struct tstrHostIfStaInactiveT |
| 398 | * @brief Get station message body |
| 399 | * @details |
| 400 | * @todo |
| 401 | * @sa |
| 402 | * @author Mai Daftedar |
| 403 | * @date 16 April 2013 |
| 404 | * @version 1.0 |
| 405 | */ |
| 406 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 407 | u8 mac[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 408 | |
| 409 | } tstrHostIfStaInactiveT; |
| 410 | /**/ |
| 411 | /*! |
| 412 | * @union tuniHostIFmsgBody |
| 413 | * @brief Message body for the Host Interface message_q |
| 414 | * @details |
| 415 | * @todo |
| 416 | * @sa |
| 417 | * @author Mostafa Abu Bakr |
| 418 | * @date 25 March 2012 |
| 419 | * @version 1.0 |
| 420 | */ |
| 421 | typedef union _tuniHostIFmsgBody { |
| 422 | tstrHostIFscanAttr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */ |
| 423 | tstrHostIFconnectAttr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */ |
| 424 | tstrRcvdNetworkInfo strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */ |
| 425 | tstrRcvdGnrlAsyncInfo strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */ |
| 426 | tstrHostIFkeyAttr strHostIFkeyAttr; /*!<>*/ |
| 427 | tstrHostIFCfgParamAttr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */ |
| 428 | tstrHostIFSetChan strHostIFSetChan; |
| 429 | tstrHostIFGetChan strHostIFGetChan; |
| 430 | tstrHostIFSetBeacon strHostIFSetBeacon; /*!< Set beacon message body */ |
| 431 | tstrHostIFDelBeacon strHostIFDelBeacon; /*!< Del beacon message body */ |
| 432 | tstrWILC_AddStaParam strAddStaParam; /*!< Add station message body */ |
| 433 | tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */ |
| 434 | tstrWILC_AddStaParam strEditStaParam; /*!< Edit station message body */ |
| 435 | /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */ |
| 436 | tstrTimerCb strTimerCb; /*!< Timer callback message body */ |
| 437 | tstrHostIfPowerMgmtParam strPowerMgmtparam; /*!< Power Management message body */ |
| 438 | tstrHostIfStaInactiveT strHostIfStaInactiveT; |
| 439 | tstrHostIFSetIPAddr strHostIfSetIP; |
| 440 | tstrHostIfSetDrvHandler strHostIfSetDrvHandler; |
| 441 | tstrHostIFSetMulti strHostIfSetMulti; |
| 442 | tstrHostIfSetOperationMode strHostIfSetOperationMode; |
| 443 | tstrHostIfSetMacAddress strHostIfSetMacAddress; |
| 444 | tstrHostIfGetMacAddress strHostIfGetMacAddress; |
| 445 | tstrHostIfBASessionInfo strHostIfBASessionInfo; |
| 446 | #ifdef WILC_P2P |
| 447 | tstrHostIfRemainOnChan strHostIfRemainOnChan; |
| 448 | tstrHostIfRegisterFrame strHostIfRegisterFrame; |
| 449 | #endif |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 450 | char *pUserData; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 451 | tstrHostIFDelAllSta strHostIFDelAllSta; |
| 452 | } tuniHostIFmsgBody; |
| 453 | |
| 454 | /*! |
| 455 | * @struct tstrHostIFmsg |
| 456 | * @brief Host Interface message |
| 457 | * @details |
| 458 | * @todo |
| 459 | * @sa |
| 460 | * @author Mostafa Abu Bakr |
| 461 | * @date 25 March 2012 |
| 462 | * @version 1.0 |
| 463 | */ |
| 464 | typedef struct _tstrHostIFmsg { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 465 | u16 u16MsgId; /*!< Message ID */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 466 | tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 467 | tstrWILC_WFIDrv *drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 468 | } tstrHostIFmsg; |
| 469 | |
| 470 | #ifdef CONNECT_DIRECT |
| 471 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 472 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 473 | u8 u8channel; |
| 474 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 475 | } tstrWidJoinReqExt; |
| 476 | #endif |
| 477 | |
| 478 | /*Bug4218: Parsing Join Param*/ |
| 479 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 480 | /*Struct containg joinParam of each AP*/ |
| 481 | typedef struct _tstrJoinBssParam { |
| 482 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 483 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 484 | u16 beacon_period; |
| 485 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 486 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 487 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 488 | u8 ssidLen; |
| 489 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 490 | u8 ht_capable; |
| 491 | u8 wmm_cap; |
| 492 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 493 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 494 | u8 rsn_grp_policy; |
| 495 | u8 mode_802_11i; |
| 496 | u8 rsn_pcip_policy[3]; |
| 497 | u8 rsn_auth_policy[3]; |
| 498 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 499 | struct _tstrJoinParam *nextJoinBss; |
| 500 | #ifdef WILC_P2P |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 501 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 502 | u8 u8NoaEnbaled; |
| 503 | u8 u8OppEnable; |
| 504 | u8 u8CtWindow; |
| 505 | u8 u8Count; |
| 506 | u8 u8Index; |
| 507 | u8 au8Duration[4]; |
| 508 | u8 au8Interval[4]; |
| 509 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 510 | #endif |
| 511 | } tstrJoinBssParam; |
| 512 | /*Bug4218: Parsing Join Param*/ |
| 513 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 514 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 515 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 516 | tstrJoinBssParam *head; |
| 517 | tstrJoinBssParam *tail; |
| 518 | } tstrBssTable; |
| 519 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 520 | |
| 521 | typedef enum { |
| 522 | SCAN_TIMER = 0, |
| 523 | CONNECT_TIMER = 1, |
| 524 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 525 | } tenuScanConnTimer; |
| 526 | |
| 527 | /*****************************************************************************/ |
| 528 | /* */ |
| 529 | /* Global Variabls */ |
| 530 | /* */ |
| 531 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 532 | /* Zero is not used, because a zero ID means termination */ |
| 533 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 534 | tstrWILC_WFIDrv *terminated_handle; |
| 535 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 536 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 537 | bool g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 538 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 539 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 540 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 541 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 542 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 544 | struct semaphore hSemDeinitDrvHandle; |
| 545 | static struct semaphore hWaitResponse; |
| 546 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 547 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 548 | |
| 549 | |
| 550 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 551 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 552 | |
| 553 | #ifndef CONNECT_DIRECT |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 554 | static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 555 | #endif |
| 556 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 557 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 558 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 559 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 561 | static s8 gs8Rssi; |
| 562 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 563 | static u8 gu8Chnl; |
| 564 | static u8 gs8SetIP[2][4]; |
| 565 | static u8 gs8GetIP[2][4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 566 | #ifdef WILC_AP_EXTERNAL_MLME |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 567 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 568 | static u8 gu8DelBcn; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 569 | #endif |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 570 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | |
| 572 | /*BugID_5137*/ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 573 | u8 *gu8FlushedJoinReq; |
| 574 | u8 *gu8FlushedInfoElemAsoc; |
| 575 | u8 gu8Flushed11iMode; |
| 576 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 577 | u32 gu32FlushedJoinReqSize; |
| 578 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 579 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 580 | #define REAL_JOIN_REQ 0 |
| 581 | #define FLUSHED_JOIN_REQ 1 |
| 582 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 583 | |
| 584 | /*Bug4218: Parsing Join Param*/ |
| 585 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 586 | /*Bug4218: Parsing Join Param*/ |
| 587 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
| 588 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 589 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 590 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 591 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 592 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 593 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 594 | { |
| 595 | int i; |
| 596 | |
| 597 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 598 | if (!wfidrv_list[i]) { |
| 599 | wfidrv_list[i] = handler; |
| 600 | return 0; |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | return -ENOBUFS; |
| 605 | } |
| 606 | |
| 607 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) |
| 608 | { |
| 609 | int i; |
| 610 | |
| 611 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 612 | if (wfidrv_list[i] == handler) { |
| 613 | wfidrv_list[i] = NULL; |
| 614 | return 0; |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | return -EINVAL; |
| 619 | } |
| 620 | |
| 621 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 622 | { |
| 623 | int i; |
| 624 | |
| 625 | if (!handler) |
| 626 | return 0; |
| 627 | |
| 628 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 629 | if (wfidrv_list[i] == handler) |
| 630 | return i; |
| 631 | } |
| 632 | |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 637 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 638 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 639 | return NULL; |
| 640 | return wfidrv_list[id]; |
| 641 | } |
| 642 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 643 | /** |
| 644 | * @brief Handle_SetChannel |
| 645 | * @details Sending config packet to firmware to set channel |
| 646 | * @param[in] tstrHostIFSetChan* pstrHostIFSetChan |
| 647 | * @return Error code. |
| 648 | * @author |
| 649 | * @date |
| 650 | * @version 1.0 |
| 651 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 652 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 653 | { |
| 654 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 655 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | tstrWID strWID; |
| 657 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 658 | |
| 659 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 660 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 661 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 662 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 663 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 664 | |
| 665 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 666 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 667 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 668 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 669 | if (s32Error) { |
| 670 | PRINT_ER("Failed to set channel\n"); |
| 671 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 672 | } |
| 673 | WILC_CATCH(s32Error) |
| 674 | { |
| 675 | |
| 676 | } |
| 677 | |
| 678 | return s32Error; |
| 679 | } |
| 680 | /** |
| 681 | * @brief Handle_SetWfiDrvHandler |
| 682 | * @details Sending config packet to firmware to set driver handler |
| 683 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 684 | * @return Error code. |
| 685 | * @author |
| 686 | * @date |
| 687 | * @version 1.0 |
| 688 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 689 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
| 690 | tstrHostIfSetDrvHandler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 691 | { |
| 692 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 693 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 694 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 695 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 696 | |
| 697 | |
| 698 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 699 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 700 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 701 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 702 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 703 | |
| 704 | /*Sending Cfg*/ |
| 705 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 706 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 707 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 708 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 709 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 710 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 711 | |
| 712 | |
| 713 | if (s32Error) { |
| 714 | PRINT_ER("Failed to set driver handler\n"); |
| 715 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 716 | } |
| 717 | WILC_CATCH(s32Error) |
| 718 | { |
| 719 | |
| 720 | } |
| 721 | |
| 722 | return s32Error; |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * @brief Handle_SetWfiAPDrvHandler |
| 727 | * @details Sending config packet to firmware to set driver handler |
| 728 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 729 | * @return Error code. |
| 730 | * @author |
| 731 | * @date |
| 732 | * @version 1.0 |
| 733 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 734 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 735 | { |
| 736 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 737 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 738 | tstrWID strWID; |
| 739 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 740 | |
| 741 | |
| 742 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 743 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 744 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 745 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 746 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 747 | |
| 748 | /*Sending Cfg*/ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 749 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 751 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 752 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 753 | |
| 754 | |
Johnny Kim | c590b9a | 2015-09-08 17:07:59 +0900 | [diff] [blame] | 755 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 756 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 757 | |
| 758 | |
| 759 | if (s32Error) { |
| 760 | PRINT_ER("Failed to set driver handler\n"); |
| 761 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 762 | } |
| 763 | WILC_CATCH(s32Error) |
| 764 | { |
| 765 | |
| 766 | } |
| 767 | |
| 768 | return s32Error; |
| 769 | } |
| 770 | |
| 771 | /** |
| 772 | * @brief host_int_set_IPAddress |
| 773 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 774 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 775 | * @return Error code. |
| 776 | * @author |
| 777 | * @date |
| 778 | * @version 1.0 |
| 779 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 780 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 781 | { |
| 782 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 783 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 784 | tstrWID strWID; |
| 785 | char firmwareIPAddress[4] = {0}; |
| 786 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 787 | |
| 788 | if (pu8IPAddr[0] < 192) |
| 789 | pu8IPAddr[0] = 0; |
| 790 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 791 | 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] | 792 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 793 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 794 | |
| 795 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 796 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 797 | strWID.enuWIDtype = WID_STR; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 798 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 799 | strWID.s32ValueSize = IP_ALEN; |
| 800 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 801 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 802 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 803 | |
| 804 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 805 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 806 | |
| 807 | if (s32Error) { |
| 808 | PRINT_D(HOSTINF_DBG, "Failed to set IP address\n"); |
| 809 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 810 | } else { |
| 811 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
| 812 | } |
| 813 | |
| 814 | WILC_CATCH(s32Error) |
| 815 | { |
| 816 | |
| 817 | } |
| 818 | |
| 819 | return s32Error; |
| 820 | } |
| 821 | |
| 822 | |
| 823 | /** |
| 824 | * @brief Handle_get_IPAddress |
| 825 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 826 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 827 | * @return Error code. |
| 828 | * @author |
| 829 | * @date |
| 830 | * @version 1.0 |
| 831 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 832 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 833 | { |
| 834 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 835 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 836 | tstrWID strWID; |
| 837 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 838 | |
| 839 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 840 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 841 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 842 | strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 843 | strWID.s32ValueSize = IP_ALEN; |
| 844 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 845 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 846 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 847 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 848 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 849 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 850 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 851 | |
| 852 | /*get the value by searching the local copy*/ |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 853 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 854 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 855 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 856 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 857 | |
| 858 | if (s32Error != WILC_SUCCESS) { |
| 859 | PRINT_ER("Failed to get IP address\n"); |
| 860 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 861 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 862 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 863 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 864 | PRINT_INFO(HOSTINF_DBG, "\n"); |
| 865 | } |
| 866 | |
| 867 | WILC_CATCH(s32Error) |
| 868 | { |
| 869 | |
| 870 | } |
| 871 | |
| 872 | return s32Error; |
| 873 | } |
| 874 | |
| 875 | |
| 876 | /*BugId_5077*/ |
| 877 | /** |
| 878 | * @brief Handle_SetMacAddress |
| 879 | * @details Setting mac address |
| 880 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 881 | * @return Error code. |
| 882 | * @author Amr Abdel-Moghny |
| 883 | * @date November 2013 |
| 884 | * @version 7.0 |
| 885 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 886 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 887 | { |
| 888 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 889 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 890 | tstrWID strWID; |
| 891 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 892 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 893 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 894 | if (mac_buf == NULL) { |
| 895 | PRINT_ER("No buffer to send mac address\n"); |
| 896 | return WILC_FAIL; |
| 897 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 898 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 899 | |
| 900 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 901 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 902 | strWID.enuWIDtype = WID_STR; |
| 903 | strWID.ps8WidVal = mac_buf; |
| 904 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 905 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 906 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 907 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 908 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 909 | if (s32Error) { |
| 910 | PRINT_ER("Failed to set mac address\n"); |
| 911 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 912 | } |
| 913 | |
| 914 | WILC_CATCH(s32Error) |
| 915 | { |
| 916 | |
| 917 | } |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 918 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 919 | return s32Error; |
| 920 | } |
| 921 | |
| 922 | |
| 923 | /*BugID_5213*/ |
| 924 | /** |
| 925 | * @brief Handle_GetMacAddress |
| 926 | * @details Getting mac address |
| 927 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 928 | * @return Error code. |
| 929 | * @author Amr Abdel-Moghny |
| 930 | * @date JAN 2013 |
| 931 | * @version 8.0 |
| 932 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 933 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 934 | { |
| 935 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 936 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 937 | tstrWID strWID; |
| 938 | |
| 939 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 940 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 941 | strWID.enuWIDtype = WID_STR; |
| 942 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 943 | strWID.s32ValueSize = ETH_ALEN; |
| 944 | |
| 945 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 946 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, |
| 947 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | if (s32Error) { |
| 949 | PRINT_ER("Failed to get mac address\n"); |
| 950 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 951 | } |
| 952 | WILC_CATCH(s32Error) |
| 953 | { |
| 954 | |
| 955 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 956 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 957 | |
| 958 | return s32Error; |
| 959 | } |
| 960 | |
| 961 | |
| 962 | /** |
| 963 | * @brief Handle_CfgParam |
| 964 | * @details Sending config packet to firmware to set CFG params |
| 965 | * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr |
| 966 | * @return Error code. |
| 967 | * @author |
| 968 | * @date |
| 969 | * @version 1.0 |
| 970 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 971 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 972 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 973 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 975 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 976 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 977 | |
| 978 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 979 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 980 | |
| 981 | |
| 982 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 983 | |
| 984 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 985 | /*----------------------------------------------------------*/ |
| 986 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 987 | /* INDEPENDENT= 2, */ |
| 988 | /* ANY_BSS= 3 */ |
| 989 | /*----------------------------------------------------------*/ |
| 990 | /* validate input then copy>> need to check value 4 and 5 */ |
| 991 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 992 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 993 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 994 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 995 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 996 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 997 | } else { |
| 998 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 999 | } |
| 1000 | u8WidCnt++; |
| 1001 | } |
| 1002 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 1003 | /*------------------------------------------------------*/ |
| 1004 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 1005 | /* SHARED_KEY = 1, */ |
| 1006 | /* ANY = 2 */ |
| 1007 | /*------------------------------------------------------*/ |
| 1008 | /*validate Possible values*/ |
| 1009 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 1010 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1011 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1012 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1013 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1014 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1015 | } else { |
| 1016 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1017 | } |
| 1018 | u8WidCnt++; |
| 1019 | } |
| 1020 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 1021 | /* range is 1 to 65535. */ |
| 1022 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 1023 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1024 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1025 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1026 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1027 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 1028 | } else { |
| 1029 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1030 | } |
| 1031 | u8WidCnt++; |
| 1032 | } |
| 1033 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 1034 | /*-----------------------------------------------------------*/ |
| 1035 | /*Input Values: NO_POWERSAVE = 0, */ |
| 1036 | /* MIN_FAST_PS = 1, */ |
| 1037 | /* MAX_FAST_PS = 2, */ |
| 1038 | /* MIN_PSPOLL_PS = 3, */ |
| 1039 | /* MAX_PSPOLL_PS = 4 */ |
| 1040 | /*----------------------------------------------------------*/ |
| 1041 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 1042 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1043 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1044 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1045 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1046 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1047 | } else { |
| 1048 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1049 | } |
| 1050 | u8WidCnt++; |
| 1051 | } |
| 1052 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 1053 | /* range from 1 to 256 */ |
| 1054 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 1055 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1056 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1057 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1058 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1059 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 1060 | } else { |
| 1061 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1062 | } |
| 1063 | u8WidCnt++; |
| 1064 | } |
| 1065 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 1066 | /* range from 1 to 256 */ |
| 1067 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 1068 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1069 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1070 | |
| 1071 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1072 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1073 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 1074 | } else { |
| 1075 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1076 | } |
| 1077 | u8WidCnt++; |
| 1078 | } |
| 1079 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 1080 | |
| 1081 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 1082 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1083 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1084 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1085 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 1087 | } else { |
| 1088 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1089 | } |
| 1090 | u8WidCnt++; |
| 1091 | } |
| 1092 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 1093 | /* range 256 to 65535 */ |
| 1094 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1095 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1096 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1097 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1098 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1099 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1100 | } else { |
| 1101 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1102 | } |
| 1103 | u8WidCnt++; |
| 1104 | } |
| 1105 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1106 | /*-----------------------------------------------------*/ |
| 1107 | /*Input Values: Short= 0, */ |
| 1108 | /* Long= 1, */ |
| 1109 | /* Auto= 2 */ |
| 1110 | /*------------------------------------------------------*/ |
| 1111 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1112 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1113 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1114 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1115 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1116 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1117 | } else { |
| 1118 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1119 | } |
| 1120 | u8WidCnt++; |
| 1121 | } |
| 1122 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { |
| 1123 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1124 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1125 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1126 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1127 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1128 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1129 | } else { |
| 1130 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1131 | } |
| 1132 | u8WidCnt++; |
| 1133 | } |
| 1134 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1135 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1136 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1137 | /* this information is useful for external supplicant */ |
| 1138 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1139 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1140 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1141 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1142 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1143 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1144 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1145 | } else { |
| 1146 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1147 | } |
| 1148 | u8WidCnt++; |
| 1149 | } |
| 1150 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1151 | /* range is 1 to 65535. */ |
| 1152 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1153 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1154 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1155 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1156 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1157 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1158 | } else { |
| 1159 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1160 | } |
| 1161 | u8WidCnt++; |
| 1162 | } |
| 1163 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1164 | /* range is 1 to 255. */ |
| 1165 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1166 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1167 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1168 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1169 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1170 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1171 | } else { |
| 1172 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1173 | } |
| 1174 | u8WidCnt++; |
| 1175 | } |
| 1176 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1177 | /*----------------------------------------------------------------------*/ |
| 1178 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1179 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1180 | /* SITE_SURVEY_OFF = 2 */ |
| 1181 | /*----------------------------------------------------------------------*/ |
| 1182 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1183 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1184 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1185 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1186 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1187 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1188 | } else { |
| 1189 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1190 | } |
| 1191 | u8WidCnt++; |
| 1192 | } |
| 1193 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1194 | /* range is 1 to 65535. */ |
| 1195 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1196 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1197 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1198 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1199 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1200 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1201 | } else { |
| 1202 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1203 | } |
| 1204 | u8WidCnt++; |
| 1205 | } |
| 1206 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1207 | /* range is 1 to 65535. */ |
| 1208 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1209 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1210 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1211 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1212 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1213 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1214 | } else { |
| 1215 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1216 | } |
| 1217 | u8WidCnt++; |
| 1218 | } |
| 1219 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1220 | /* range is 1 to 65535. */ |
| 1221 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1222 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1223 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1224 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1225 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1226 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1227 | } else { |
| 1228 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1229 | } |
| 1230 | u8WidCnt++; |
| 1231 | } |
| 1232 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
| 1233 | CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
| 1234 | /*----------------------------------------------------------------------*/ |
| 1235 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1236 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1237 | /*----------------------------------------------------------------------*/ |
| 1238 | /* validate rate */ |
| 1239 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1240 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1241 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1242 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1243 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1244 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1245 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1246 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1247 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1248 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1249 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1250 | } else { |
| 1251 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 1252 | } |
| 1253 | u8WidCnt++; |
| 1254 | } |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1255 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1256 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1257 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1258 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1259 | PRINT_ER("Error in setting CFG params\n"); |
| 1260 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1261 | WILC_CATCH(s32Error) |
| 1262 | { |
| 1263 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1264 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1265 | return s32Error; |
| 1266 | } |
| 1267 | |
| 1268 | |
| 1269 | /** |
| 1270 | * @brief Handle_wait_msg_q_empty |
| 1271 | * @details this should be the last msg and then the msg Q becomes idle |
| 1272 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1273 | * @return Error code. |
| 1274 | * @author |
| 1275 | * @date |
| 1276 | * @version 1.0 |
| 1277 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1278 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1279 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1280 | s32 s32Error = WILC_SUCCESS; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1281 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1282 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1283 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1284 | return s32Error; |
| 1285 | } |
| 1286 | |
| 1287 | /** |
| 1288 | * @brief Handle_Scan |
| 1289 | * @details Sending config packet to firmware to set the scan params |
| 1290 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1291 | * @return Error code. |
| 1292 | * @author |
| 1293 | * @date |
| 1294 | * @version 1.0 |
| 1295 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1296 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1297 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1298 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1299 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1300 | u32 u32WidsCount = 0; |
| 1301 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1302 | u8 *pu8Buffer; |
| 1303 | u8 valuesize = 0; |
| 1304 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1305 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1306 | |
| 1307 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1308 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1309 | |
| 1310 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1311 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1312 | |
| 1313 | #ifdef WILC_P2P |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1314 | #endif |
| 1315 | |
| 1316 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1317 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1318 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate); |
| 1319 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 1320 | } |
| 1321 | |
| 1322 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 1323 | if (g_obtainingIP || connecting) { |
| 1324 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
| 1325 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 1326 | } |
| 1327 | #endif |
| 1328 | |
| 1329 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1330 | |
| 1331 | |
| 1332 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1333 | |
| 1334 | /*BugID_4189*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1335 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1336 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1337 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1338 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1339 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1340 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1341 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1342 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1343 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1344 | |
| 1345 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1346 | |
| 1347 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1348 | |
| 1349 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1350 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1351 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1352 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1353 | } |
| 1354 | |
| 1355 | |
| 1356 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1357 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1358 | u32WidsCount++; |
| 1359 | } |
| 1360 | |
| 1361 | /*filling cfg param array*/ |
| 1362 | |
| 1363 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1364 | { |
| 1365 | /* IEs to be inserted in Probe Request */ |
| 1366 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1367 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1368 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1369 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1370 | u32WidsCount++; |
| 1371 | } |
| 1372 | |
| 1373 | /*Scan Type*/ |
| 1374 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1375 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1376 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1377 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1378 | u32WidsCount++; |
| 1379 | |
| 1380 | /*list of channels to be scanned*/ |
| 1381 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1382 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1383 | |
| 1384 | /* Bug 4648: Convert channel numbers to start from 0 not 1. */ |
| 1385 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1386 | int i; |
| 1387 | |
| 1388 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1389 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1390 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1391 | } |
| 1392 | } |
| 1393 | |
| 1394 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1395 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1396 | u32WidsCount++; |
| 1397 | |
| 1398 | /*Scan Request*/ |
| 1399 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1400 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1401 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1402 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1403 | u32WidsCount++; |
| 1404 | |
| 1405 | /*keep the state as is , no need to change it*/ |
| 1406 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1407 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1408 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1409 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1410 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1411 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1412 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1413 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1414 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1415 | |
| 1416 | if (s32Error) { |
| 1417 | PRINT_ER("Failed to send scan paramters config packet\n"); |
| 1418 | WILC_ERRORREPORT(s32Error, s32Error); |
| 1419 | } else { |
| 1420 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
| 1421 | } |
| 1422 | |
| 1423 | WILC_CATCH(s32Error) |
| 1424 | { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1425 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1426 | /*if there is an ongoing scan request*/ |
| 1427 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1428 | } |
| 1429 | |
| 1430 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1431 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1432 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1433 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1434 | } |
| 1435 | |
| 1436 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1437 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1438 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1439 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1440 | } |
| 1441 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1442 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1443 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1444 | } |
| 1445 | |
| 1446 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1447 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1448 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1449 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1450 | } |
| 1451 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1452 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1453 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | |
| 1455 | return s32Error; |
| 1456 | } |
| 1457 | |
| 1458 | /** |
| 1459 | * @brief Handle_ScanDone |
| 1460 | * @details Call scan notification callback function |
| 1461 | * @param[in] NONE |
| 1462 | * @return Error code. |
| 1463 | * @author |
| 1464 | * @date |
| 1465 | * @version 1.0 |
| 1466 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1467 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1468 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1469 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1470 | |
| 1471 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1472 | |
| 1473 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1474 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1475 | tstrWID strWID; |
| 1476 | |
| 1477 | |
| 1478 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1479 | |
| 1480 | /*BugID_4978*/ |
| 1481 | /*Ask FW to abort the running scan, if any*/ |
| 1482 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1483 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1484 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1485 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1486 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1487 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1488 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1489 | |
| 1490 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1491 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 1492 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1493 | if (s32Error != WILC_SUCCESS) { |
| 1494 | PRINT_ER("Failed to set abort running scan\n"); |
| 1495 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 1496 | } |
| 1497 | WILC_CATCH(s32Error) |
| 1498 | { |
| 1499 | } |
| 1500 | } |
| 1501 | |
| 1502 | if (pstrWFIDrv == NULL) { |
| 1503 | PRINT_ER("Driver handler is NULL\n"); |
| 1504 | return s32Error; |
| 1505 | } |
| 1506 | |
| 1507 | /*if there is an ongoing scan request*/ |
| 1508 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1509 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1510 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1511 | /*delete current scan request*/ |
| 1512 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1513 | } |
| 1514 | |
| 1515 | return s32Error; |
| 1516 | } |
| 1517 | |
| 1518 | /** |
| 1519 | * @brief Handle_Connect |
| 1520 | * @details Sending config packet to firmware to starting connection |
| 1521 | * @param[in] tstrHostIFconnectAttr* pstrHostIFconnectAttr |
| 1522 | * @return Error code. |
| 1523 | * @author |
| 1524 | * @date |
| 1525 | * @version 1.0 |
| 1526 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1527 | u8 u8ConnectedSSID[6] = {0}; |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1528 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1529 | { |
| 1530 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1531 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1532 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1533 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1534 | /* char passphrase[] = "12345678"; */ |
| 1535 | #ifndef CONNECT_DIRECT |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1536 | s32 s32Err = WILC_SUCCESS; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1537 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1538 | u8 u8bssDscListIndex; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1539 | wid_site_survey_reslts_s *pstrSurveyResults = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1540 | #else |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1541 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1542 | /*Bug4218: Parsing Join Param*/ |
| 1543 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1544 | tstrJoinBssParam *ptstrJoinBssParam; |
| 1545 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1546 | |
| 1547 | #endif |
| 1548 | |
| 1549 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1550 | |
| 1551 | #ifndef CONNECT_DIRECT |
Hari Prasath Gujulan Elango | 3a79a7f | 2015-08-20 09:59:44 +0000 | [diff] [blame] | 1552 | memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | |
| 1554 | |
| 1555 | PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 1556 | s32Err = host_int_get_site_survey_results(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1557 | gapu8RcvdSurveyResults, |
| 1558 | MAX_SURVEY_RESULT_FRAG_SIZE); |
| 1559 | if (s32Err) { |
| 1560 | PRINT_ER("Failed to get site survey results\n"); |
| 1561 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 1562 | |
| 1563 | } |
| 1564 | s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults, |
| 1565 | &pstrWFIDrv->u32SurveyResultsCount); |
| 1566 | |
| 1567 | |
| 1568 | if (s32Err == WILC_SUCCESS) { |
| 1569 | /* use the parsed info in pstrSurveyResults, then deallocate it */ |
| 1570 | PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); |
| 1571 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1572 | memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1573 | sizeof(wid_site_survey_reslts_s)); |
| 1574 | } |
| 1575 | |
| 1576 | DeallocateSurveyResults(pstrSurveyResults); |
| 1577 | } else { |
| 1578 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1579 | PRINT_ER("ParseSurveyResults() Error(%d)\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1580 | } |
| 1581 | |
| 1582 | |
| 1583 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1584 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1585 | pstrHostIFconnectAttr->pu8ssid, |
| 1586 | pstrHostIFconnectAttr->ssidLen) == 0) { |
| 1587 | PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); |
| 1588 | if (pstrHostIFconnectAttr->pu8bssid == NULL) { |
| 1589 | /* BSSID is not passed from the user, so decision of matching |
| 1590 | * is done by SSID only */ |
| 1591 | PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n"); |
| 1592 | break; |
| 1593 | } else { |
| 1594 | /* BSSID is also passed from the user, so decision of matching |
| 1595 | * should consider also this passed BSSID */ |
| 1596 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1597 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1598 | pstrHostIFconnectAttr->pu8bssid, |
| 1599 | 6) == 0) { |
| 1600 | PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); |
| 1601 | break; |
| 1602 | } |
| 1603 | } |
| 1604 | } |
| 1605 | } |
| 1606 | |
| 1607 | if (i < pstrWFIDrv->u32SurveyResultsCount) { |
| 1608 | u8bssDscListIndex = i; |
| 1609 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1610 | 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] | 1611 | u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, |
| 1612 | pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); |
| 1613 | |
| 1614 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1615 | |
| 1616 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1617 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1618 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1619 | } |
| 1620 | |
| 1621 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1622 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1623 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1624 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1625 | pstrHostIFconnectAttr->ssidLen); |
| 1626 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1627 | } |
| 1628 | |
| 1629 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1630 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1631 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1632 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1633 | pstrHostIFconnectAttr->IEsLen); |
| 1634 | } |
| 1635 | |
| 1636 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1637 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1638 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1639 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1640 | |
| 1641 | |
| 1642 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1643 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1644 | { |
| 1645 | /* IEs to be inserted in Association Request */ |
| 1646 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1647 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1648 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1649 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1650 | u32WidsCount++; |
| 1651 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1652 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1653 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1654 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1655 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1656 | u32WidsCount++; |
| 1657 | |
| 1658 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1659 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1660 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1661 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1662 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1663 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | u32WidsCount++; |
| 1665 | |
| 1666 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1667 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1668 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1669 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1670 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1671 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1672 | * u32WidsCount++; |
| 1673 | */ |
| 1674 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1675 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1676 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1677 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1678 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1679 | u32WidsCount++; |
| 1680 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1681 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1682 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1683 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1684 | /* ////////////////////// */ |
| 1685 | gu32WidConnRstHack = 0; |
| 1686 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1687 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1688 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1689 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1690 | if (s32Error) { |
| 1691 | PRINT_ER("Handle_Connect()] failed to send config packet\n"); |
| 1692 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 1693 | } else { |
| 1694 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1695 | } |
| 1696 | |
| 1697 | } else { |
| 1698 | PRINT_ER("Required BSSID not found\n"); |
| 1699 | WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND); |
| 1700 | } |
| 1701 | |
| 1702 | #else |
| 1703 | |
| 1704 | /* if we try to connect to an already connected AP then discard the request */ |
| 1705 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1706 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1707 | |
| 1708 | s32Error = WILC_SUCCESS; |
| 1709 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1710 | return s32Error; |
| 1711 | } |
| 1712 | |
| 1713 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1714 | |
| 1715 | /*Bug4218: Parsing Join Param*/ |
| 1716 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1717 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1718 | if (ptstrJoinBssParam == NULL) { |
| 1719 | PRINT_ER("Required BSSID not found\n"); |
| 1720 | WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND); |
| 1721 | } |
| 1722 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1723 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1724 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1725 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1726 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1727 | } |
| 1728 | |
| 1729 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1730 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1731 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1732 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1733 | pstrHostIFconnectAttr->ssidLen); |
| 1734 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1735 | } |
| 1736 | |
| 1737 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1738 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1739 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1740 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1741 | pstrHostIFconnectAttr->IEsLen); |
| 1742 | } |
| 1743 | |
| 1744 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1745 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1746 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1747 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1748 | |
| 1749 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1750 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1751 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1752 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1753 | u32WidsCount++; |
| 1754 | |
| 1755 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1756 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1757 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1758 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1759 | u32WidsCount++; |
| 1760 | |
| 1761 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1762 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1763 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1764 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1765 | u32WidsCount++; |
| 1766 | |
| 1767 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1768 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1769 | { |
| 1770 | /* IEs to be inserted in Association Request */ |
| 1771 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1772 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1773 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1774 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1775 | u32WidsCount++; |
| 1776 | |
| 1777 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1778 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1779 | |
| 1780 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1781 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1782 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1783 | gu32FlushedInfoElemAsocSize); |
| 1784 | } |
| 1785 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1786 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1787 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1788 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1789 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1790 | u32WidsCount++; |
| 1791 | |
| 1792 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1793 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1794 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1795 | |
| 1796 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1797 | |
| 1798 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1799 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1800 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1801 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1802 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1803 | u32WidsCount++; |
| 1804 | |
| 1805 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1806 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1807 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1808 | |
| 1809 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1810 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1811 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1812 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1813 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1814 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1815 | * u32WidsCount++; |
| 1816 | */ |
| 1817 | |
| 1818 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1819 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1820 | |
| 1821 | |
| 1822 | #ifndef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1823 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1824 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1825 | strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1826 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1827 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1828 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1829 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1830 | |
| 1831 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1832 | |
| 1833 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1834 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1835 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1836 | } |
| 1837 | pu8CurrByte += MAX_SSID_LEN; |
| 1838 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1839 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1840 | } else { |
| 1841 | PRINT_ER("Channel out of range\n"); |
| 1842 | *(pu8CurrByte++) = 0xFF; |
| 1843 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1844 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1845 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1846 | pu8CurrByte += 6; |
| 1847 | |
| 1848 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1849 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1850 | |
| 1851 | #else |
| 1852 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1853 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1854 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1855 | |
| 1856 | /*Sending NoA attributes during connection*/ |
| 1857 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1858 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1859 | |
| 1860 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1861 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1862 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1863 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1864 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1865 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1866 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1867 | |
| 1868 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1869 | |
| 1870 | |
| 1871 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1872 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1873 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1874 | } |
| 1875 | pu8CurrByte += MAX_SSID_LEN; |
| 1876 | |
| 1877 | /* BSS type*/ |
| 1878 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1879 | /* Channel*/ |
| 1880 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1881 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1882 | } else { |
| 1883 | PRINT_ER("Channel out of range\n"); |
| 1884 | *(pu8CurrByte++) = 0xFF; |
| 1885 | } |
| 1886 | /* Cap Info*/ |
| 1887 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1888 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1889 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1890 | |
| 1891 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1892 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1893 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1894 | pu8CurrByte += 6; |
| 1895 | |
| 1896 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1897 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1898 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1899 | pu8CurrByte += 6; |
| 1900 | |
| 1901 | /* Beacon Period*/ |
| 1902 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1903 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1904 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1905 | /* DTIM Period*/ |
| 1906 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1907 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1908 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1909 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1910 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1911 | |
| 1912 | /* wmm cap*/ |
| 1913 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1914 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1915 | /* uapsd cap*/ |
| 1916 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1917 | |
| 1918 | /* ht cap*/ |
| 1919 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1920 | /* copy this information to the user request */ |
| 1921 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1922 | |
| 1923 | /* rsn found*/ |
| 1924 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1925 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1926 | /* rsn group policy*/ |
| 1927 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1928 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1929 | /* mode_802_11i*/ |
| 1930 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1931 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1932 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1933 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1934 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1935 | |
| 1936 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1937 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1938 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1939 | |
| 1940 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1941 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1942 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1943 | |
| 1944 | /*BugID_5137*/ |
| 1945 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1946 | |
| 1947 | #ifdef WILC_P2P |
| 1948 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1949 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1950 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1951 | |
| 1952 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1953 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1954 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1955 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1956 | |
| 1957 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1958 | |
| 1959 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1960 | |
| 1961 | if (ptstrJoinBssParam->u8OppEnable) |
| 1962 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1963 | |
| 1964 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1965 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1966 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1967 | |
| 1968 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1969 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1970 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1971 | |
| 1972 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1973 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1974 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1975 | |
| 1976 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1977 | |
| 1978 | } else |
| 1979 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
| 1980 | #endif |
| 1981 | |
| 1982 | |
| 1983 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1984 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1985 | |
| 1986 | |
| 1987 | #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ |
| 1988 | u32WidsCount++; |
| 1989 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1990 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1991 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1992 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1993 | /* ////////////////////// */ |
| 1994 | gu32WidConnRstHack = 0; |
| 1995 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1996 | |
| 1997 | /*BugID_5137*/ |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1998 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1999 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2000 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2001 | } |
| 2002 | |
| 2003 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 2004 | |
| 2005 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2006 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2007 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 2008 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 2009 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2010 | } |
| 2011 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2012 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2013 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2014 | if (s32Error) { |
| 2015 | PRINT_ER("Handle_Connect()] failed to send config packet\n"); |
| 2016 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 2017 | } else { |
| 2018 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 2019 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 2020 | } |
| 2021 | #endif |
| 2022 | |
| 2023 | WILC_CATCH(s32Error) |
| 2024 | { |
| 2025 | tstrConnectInfo strConnectInfo; |
| 2026 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2027 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2028 | |
| 2029 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 2030 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2031 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2032 | |
| 2033 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2034 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2035 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2036 | |
| 2037 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 2038 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2039 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2040 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | pstrHostIFconnectAttr->pu8IEs, |
| 2042 | pstrHostIFconnectAttr->IEsLen); |
| 2043 | } |
| 2044 | |
| 2045 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2046 | &strConnectInfo, |
| 2047 | MAC_DISCONNECTED, |
| 2048 | NULL, |
| 2049 | pstrHostIFconnectAttr->pvUserArg); |
| 2050 | /*Change state to idle*/ |
| 2051 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2052 | /* Deallocation */ |
| 2053 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2054 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2055 | strConnectInfo.pu8ReqIEs = NULL; |
| 2056 | } |
| 2057 | |
| 2058 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2059 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 2064 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 2065 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2066 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2067 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 2068 | } |
| 2069 | |
| 2070 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 2071 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2072 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2073 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 2074 | } |
| 2075 | |
| 2076 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 2077 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2078 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2079 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 2080 | } |
| 2081 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2082 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2083 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2084 | return s32Error; |
| 2085 | } |
| 2086 | |
| 2087 | /** |
| 2088 | * @brief Handle_FlushConnect |
| 2089 | * @details Sending config packet to firmware to flush an old connection |
| 2090 | * after switching FW from station one to hybrid one |
| 2091 | * @param[in] void * drvHandler |
| 2092 | * @return Error code. |
| 2093 | * @author Amr Abdel-Moghny |
| 2094 | * @date 19 DEC 2013 |
| 2095 | * @version 8.0 |
| 2096 | */ |
| 2097 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2098 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2099 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2100 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2101 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2102 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2103 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2104 | |
| 2105 | |
| 2106 | /* IEs to be inserted in Association Request */ |
| 2107 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 2108 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 2109 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 2110 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 2111 | u32WidsCount++; |
| 2112 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2113 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2114 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2115 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2116 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2117 | u32WidsCount++; |
| 2118 | |
| 2119 | |
| 2120 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2121 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2122 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2123 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2124 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2125 | u32WidsCount++; |
| 2126 | |
| 2127 | |
| 2128 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2129 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2130 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 2131 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2132 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2133 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 2134 | |
| 2135 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 2136 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 2137 | |
| 2138 | u32WidsCount++; |
| 2139 | |
| 2140 | #endif |
| 2141 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2142 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2143 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2144 | if (s32Error) { |
| 2145 | PRINT_ER("Handle_Flush_Connect()] failed to send config packet\n"); |
| 2146 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 2147 | } |
| 2148 | |
| 2149 | WILC_CATCH(s32Error) |
| 2150 | { |
| 2151 | |
| 2152 | } |
| 2153 | |
| 2154 | return s32Error; |
| 2155 | } |
| 2156 | |
| 2157 | /** |
| 2158 | * @brief Handle_ConnectTimeout |
| 2159 | * @details Call connect notification callback function indicating connection failure |
| 2160 | * @param[in] NONE |
| 2161 | * @return Error code. |
| 2162 | * @author |
| 2163 | * @date |
| 2164 | * @version 1.0 |
| 2165 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2166 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2167 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2168 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2169 | tstrConnectInfo strConnectInfo; |
| 2170 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2171 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2172 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 2173 | |
| 2174 | if (pstrWFIDrv == NULL) { |
| 2175 | PRINT_ER("Driver handler is NULL\n"); |
| 2176 | return s32Error; |
| 2177 | } |
| 2178 | |
| 2179 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2180 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2181 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2182 | |
| 2183 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2184 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2185 | |
| 2186 | |
| 2187 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 2188 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2189 | * WID_DISCONNECT} */ |
| 2190 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2191 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2192 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2193 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 2194 | } |
| 2195 | |
| 2196 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2197 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2198 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2199 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2200 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2201 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2202 | } |
| 2203 | |
| 2204 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2205 | &strConnectInfo, |
| 2206 | MAC_DISCONNECTED, |
| 2207 | NULL, |
| 2208 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2209 | |
| 2210 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 2211 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2212 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | strConnectInfo.pu8ReqIEs = NULL; |
| 2214 | } |
| 2215 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2216 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2217 | } |
| 2218 | |
| 2219 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2220 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2221 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2222 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2223 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2224 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2225 | |
| 2226 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2227 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2228 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 2229 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2230 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2231 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2232 | |
| 2233 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 2234 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2235 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2236 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2237 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2238 | } |
| 2239 | |
| 2240 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2241 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2242 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2243 | } |
| 2244 | |
| 2245 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2246 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2247 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2248 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2249 | } |
| 2250 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2251 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2252 | /*BugID_5213*/ |
| 2253 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2254 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2255 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2256 | gu8FlushedJoinReq = NULL; |
| 2257 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2258 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2259 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2260 | gu8FlushedInfoElemAsoc = NULL; |
| 2261 | } |
| 2262 | |
| 2263 | return s32Error; |
| 2264 | } |
| 2265 | |
| 2266 | /** |
| 2267 | * @brief Handle_RcvdNtwrkInfo |
| 2268 | * @details Handling received network information |
| 2269 | * @param[in] tstrRcvdNetworkInfo* pstrRcvdNetworkInfo |
| 2270 | * @return Error code. |
| 2271 | * @author |
| 2272 | * @date |
| 2273 | * @version 1.0 |
| 2274 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2275 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2276 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2277 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2278 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2279 | |
| 2280 | |
| 2281 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2282 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2283 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 2284 | void *pJoinParams = NULL; |
| 2285 | |
| 2286 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2287 | |
| 2288 | |
| 2289 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2290 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2291 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 2292 | |
| 2293 | /*if there is a an ongoing scan request*/ |
| 2294 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2295 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
| 2296 | ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
| 2297 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2298 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2299 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 2300 | } |
| 2301 | |
| 2302 | /* check whether this network is discovered before */ |
| 2303 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2304 | |
| 2305 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2306 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2307 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2308 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2309 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2310 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2311 | * send anything to the upper layer */ |
| 2312 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2313 | goto done; |
| 2314 | } else { |
| 2315 | /* here the same already found network is found again but with a better rssi, so just update |
| 2316 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2317 | * don't add a new record for it */ |
| 2318 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2319 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2320 | break; |
| 2321 | } |
| 2322 | } |
| 2323 | } |
| 2324 | } |
| 2325 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2326 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2327 | /* here it is confirmed that it is a new discovered network, |
| 2328 | * so add its record then call the User CallBack function */ |
| 2329 | |
| 2330 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2331 | |
| 2332 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2333 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2334 | |
| 2335 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2336 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2337 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2338 | pstrNetworkInfo->au8bssid, 6); |
| 2339 | |
| 2340 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2341 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2342 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2343 | /*Bug4218: Parsing Join Param*/ |
| 2344 | /* add new BSS to JoinBssTable */ |
| 2345 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2346 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
| 2347 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 2348 | |
| 2349 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2350 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2351 | pJoinParams); |
| 2352 | |
| 2353 | |
| 2354 | } |
| 2355 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2356 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2357 | } |
| 2358 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2359 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2360 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2361 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2362 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2363 | } |
| 2364 | } |
| 2365 | |
| 2366 | |
| 2367 | WILC_CATCH(s32Error) |
| 2368 | { |
| 2369 | |
| 2370 | } |
| 2371 | |
| 2372 | done: |
| 2373 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2374 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2375 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2376 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2377 | } |
| 2378 | |
| 2379 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2380 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2381 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2382 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | } |
| 2384 | |
| 2385 | return s32Error; |
| 2386 | } |
| 2387 | |
| 2388 | /** |
| 2389 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2390 | * @details Handling received asynchrous general network information |
| 2391 | * @param[in] tstrRcvdGnrlAsyncInfo* pstrRcvdGnrlAsyncInfo |
| 2392 | * @return Error code. |
| 2393 | * @author |
| 2394 | * @date |
| 2395 | * @version 1.0 |
| 2396 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2397 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2398 | { |
| 2399 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2400 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2401 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2402 | u8 u8MsgType = 0; |
| 2403 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2404 | u16 u16MsgLen = 0; |
| 2405 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2406 | u8 u8WidLen = 0; |
| 2407 | u8 u8MacStatus; |
| 2408 | u8 u8MacStatusReasonCode; |
| 2409 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2410 | tstrConnectInfo strConnectInfo; |
| 2411 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2412 | s32 s32Err = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2413 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2414 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2415 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2416 | PRINT_ER("Driver handler is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2417 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2418 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2419 | |
| 2420 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2421 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2422 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2423 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2424 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2425 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 2426 | } |
| 2427 | |
| 2428 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2429 | |
| 2430 | /* Check whether the received message type is 'I' */ |
| 2431 | if ('I' != u8MsgType) { |
| 2432 | PRINT_ER("Received Message format incorrect.\n"); |
| 2433 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 2434 | } |
| 2435 | |
| 2436 | /* Extract message ID */ |
| 2437 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2438 | |
| 2439 | /* Extract message Length */ |
| 2440 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2441 | |
| 2442 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2443 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2444 | |
| 2445 | /* Extract WID Length [expected to be = 1] */ |
| 2446 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2447 | |
| 2448 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2449 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2450 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2451 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2452 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2453 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2454 | /* 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] | 2455 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2456 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2457 | |
| 2458 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2459 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2460 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2461 | |
| 2462 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2463 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2464 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2465 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2466 | gapu8RcvdAssocResp, |
| 2467 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2468 | &u32RcvdAssocRespInfoLen); |
| 2469 | |
| 2470 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2471 | |
| 2472 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2473 | |
| 2474 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2475 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2476 | &pstrConnectRespInfo); |
| 2477 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2478 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2479 | } else { |
| 2480 | /* use the necessary parsed Info from the Received Association Response */ |
| 2481 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2482 | |
| 2483 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2484 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2485 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2486 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2487 | |
| 2488 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2489 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2490 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2491 | pstrConnectRespInfo->u16RespIEsLen); |
| 2492 | } |
| 2493 | } |
| 2494 | |
| 2495 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2496 | if (pstrConnectRespInfo != NULL) { |
| 2497 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2498 | pstrConnectRespInfo = NULL; |
| 2499 | } |
| 2500 | } |
| 2501 | } |
| 2502 | } |
| 2503 | |
| 2504 | /* The station has just received mac status and it also received assoc. response which |
| 2505 | * it was waiting for. |
| 2506 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2507 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2508 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2509 | 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] | 2510 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2511 | |
| 2512 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2513 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2514 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2515 | } |
| 2516 | |
| 2517 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2518 | /* through a structure of type tstrConnectRespInfo */ |
| 2519 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2520 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2521 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2522 | |
| 2523 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2524 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2525 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2526 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2527 | } |
| 2528 | } |
| 2529 | |
| 2530 | |
| 2531 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2532 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2533 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2534 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2535 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2536 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2537 | } |
| 2538 | |
| 2539 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2540 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2541 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2542 | &strConnectInfo, |
| 2543 | u8MacStatus, |
| 2544 | NULL, |
| 2545 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2546 | |
| 2547 | |
| 2548 | /* if received mac status is MAC_CONNECTED and |
| 2549 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2550 | * else change state to IDLE */ |
| 2551 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2552 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
| 2553 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2554 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2555 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2556 | #endif |
| 2557 | |
| 2558 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2559 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2560 | |
| 2561 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2562 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2563 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2564 | mod_timer(&hDuringIpTimer, |
| 2565 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2566 | #endif |
| 2567 | |
| 2568 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2569 | /* open a BA session if possible */ |
| 2570 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
| 2571 | |
| 2572 | #endif |
| 2573 | |
| 2574 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ |
| 2575 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2576 | } else { |
| 2577 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2578 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2579 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2580 | } |
| 2581 | |
| 2582 | /* Deallocation */ |
| 2583 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2584 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2585 | strConnectInfo.pu8RespIEs = NULL; |
| 2586 | } |
| 2587 | |
| 2588 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2589 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2590 | strConnectInfo.pu8ReqIEs = NULL; |
| 2591 | } |
| 2592 | |
| 2593 | |
| 2594 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2595 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2596 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2597 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2598 | } |
| 2599 | |
| 2600 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2601 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2602 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2603 | } |
| 2604 | |
| 2605 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2606 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2607 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2608 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2609 | } |
| 2610 | |
| 2611 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2612 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2613 | /* Disassociation or Deauthentication frame has been received */ |
| 2614 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2615 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2616 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2617 | |
| 2618 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2619 | 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] | 2620 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2622 | } |
| 2623 | |
| 2624 | strDisconnectNotifInfo.u16reason = 0; |
| 2625 | strDisconnectNotifInfo.ie = NULL; |
| 2626 | strDisconnectNotifInfo.ie_len = 0; |
| 2627 | |
| 2628 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2629 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2630 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2631 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2632 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2633 | #endif |
| 2634 | |
| 2635 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2636 | NULL, |
| 2637 | 0, |
| 2638 | &strDisconnectNotifInfo, |
| 2639 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2640 | |
| 2641 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2642 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2643 | } |
| 2644 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2645 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2646 | |
| 2647 | |
| 2648 | /* Deallocation */ |
| 2649 | |
| 2650 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2651 | * should be deallocated here */ |
| 2652 | /* |
| 2653 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2654 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2655 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2656 | * strDisconnectNotifInfo.ie = NULL; |
| 2657 | * } |
| 2658 | */ |
| 2659 | |
| 2660 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2661 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2662 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2663 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2664 | } |
| 2665 | |
| 2666 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2667 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2668 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2669 | } |
| 2670 | |
| 2671 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2672 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2673 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2675 | } |
| 2676 | |
| 2677 | /*BugID_5213*/ |
| 2678 | /*Freeing flushed join request params on receiving*/ |
| 2679 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2680 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2681 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2682 | gu8FlushedJoinReq = NULL; |
| 2683 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2684 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2685 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2686 | gu8FlushedInfoElemAsoc = NULL; |
| 2687 | } |
| 2688 | |
| 2689 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2690 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2691 | |
| 2692 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2693 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2694 | 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] | 2695 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2696 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2697 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2698 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2699 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2700 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2701 | } |
| 2702 | |
| 2703 | } |
| 2704 | |
| 2705 | WILC_CATCH(s32Error) |
| 2706 | { |
| 2707 | |
| 2708 | } |
| 2709 | |
| 2710 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2711 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2712 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2713 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2714 | } |
| 2715 | |
| 2716 | return s32Error; |
| 2717 | } |
| 2718 | |
| 2719 | /** |
| 2720 | * @brief Handle_Key |
| 2721 | * @details Sending config packet to firmware to set key |
| 2722 | * @param[in] tstrHostIFkeyAttr* pstrHostIFkeyAttr |
| 2723 | * @return Error code. |
| 2724 | * @author |
| 2725 | * @date |
| 2726 | * @version 1.0 |
| 2727 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2728 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2729 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 2730 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2731 | tstrWID strWID; |
| 2732 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2733 | tstrWID strWIDList[5]; |
| 2734 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2735 | u8 i; |
| 2736 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2737 | s8 s8idxarray[1]; |
| 2738 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2739 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2740 | |
| 2741 | |
| 2742 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2743 | |
| 2744 | |
| 2745 | case WEP: |
| 2746 | |
| 2747 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2748 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2749 | |
| 2750 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2751 | 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] | 2752 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2753 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2754 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2755 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2756 | |
| 2757 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2758 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2759 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2760 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2761 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2762 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2763 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2764 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2765 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2766 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2767 | |
| 2768 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2769 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2770 | |
| 2771 | |
| 2772 | if (pu8keybuf == NULL) { |
| 2773 | PRINT_ER("No buffer to send Key\n"); |
| 2774 | return -1; |
| 2775 | } |
| 2776 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2777 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2778 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2779 | |
| 2780 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2781 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2782 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2783 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2784 | strWIDList[3].enuWIDtype = WID_STR; |
| 2785 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2786 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2787 | |
| 2788 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2789 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, |
| 2790 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2791 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2792 | |
| 2793 | |
| 2794 | } |
| 2795 | #endif |
| 2796 | |
| 2797 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2798 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2799 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2800 | if (pu8keybuf == NULL) { |
| 2801 | PRINT_ER("No buffer to send Key\n"); |
| 2802 | return -1; |
| 2803 | } |
| 2804 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2805 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2806 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2807 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2808 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2810 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2811 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2812 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2813 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2815 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2816 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2817 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2818 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2819 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2820 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2821 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2822 | |
| 2823 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2824 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2825 | strWID.enuWIDtype = WID_STR; |
| 2826 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2827 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2828 | strWID.ps8WidVal = s8idxarray; |
| 2829 | strWID.s32ValueSize = 1; |
| 2830 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2831 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2832 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2833 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2834 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2836 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2837 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2838 | |
| 2839 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2840 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2841 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2842 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2843 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2844 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2845 | break; |
| 2846 | |
| 2847 | case WPARxGtk: |
| 2848 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2849 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2850 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2851 | if (pu8keybuf == NULL) { |
| 2852 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2853 | ret = -1; |
| 2854 | goto _WPARxGtk_end_case_; |
| 2855 | } |
| 2856 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2857 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | |
| 2859 | |
| 2860 | /*|----------------------------------------------------------------------------| |
| 2861 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2862 | * |------------|---------|-------|------------|---------------|----------------| |
| 2863 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2864 | |
| 2865 | |
| 2866 | |
| 2867 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2868 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2869 | |
| 2870 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2871 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2872 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2873 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 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 + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2876 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2877 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2878 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2879 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2880 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2881 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2882 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2883 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2884 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2885 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2886 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2887 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2888 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2889 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2890 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2891 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | |
| 2893 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2894 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2895 | /* ///////////////////////// */ |
| 2896 | } |
| 2897 | |
| 2898 | #endif |
| 2899 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2900 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2901 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2902 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2903 | if (pu8keybuf == NULL) { |
| 2904 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2905 | ret = -1; |
| 2906 | goto _WPARxGtk_end_case_; |
| 2907 | } |
| 2908 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2909 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2910 | |
| 2911 | |
| 2912 | /*|----------------------------------------------------------------------------| |
| 2913 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2914 | * |------------|---------|-------|------------|---------------|----------------| |
| 2915 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2916 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2917 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2918 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2919 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2920 | 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] | 2921 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2922 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
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 + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
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 + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2927 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2928 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2929 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2930 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2931 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2932 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2933 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2934 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2935 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2936 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2937 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2938 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2939 | |
| 2940 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2941 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2942 | /* ///////////////////////// */ |
| 2943 | } |
| 2944 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2945 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2946 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2947 | if (ret == -1) |
| 2948 | return ret; |
| 2949 | |
| 2950 | break; |
| 2951 | |
| 2952 | case WPAPtk: |
| 2953 | #ifdef WILC_AP_EXTERNAL_MLME |
| 2954 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2955 | |
| 2956 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2957 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2958 | |
| 2959 | |
| 2960 | |
| 2961 | if (pu8keybuf == NULL) { |
| 2962 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2963 | ret = -1; |
| 2964 | goto _WPAPtk_end_case_; |
| 2965 | |
| 2966 | } |
| 2967 | |
| 2968 | /*|-----------------------------------------------------------------------------| |
| 2969 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2970 | * |----------------|------------ |--------------|----------------|---------------| |
| 2971 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2972 | |-----------------------------------------------------------------------------|*/ |
| 2973 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2974 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2975 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2976 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2977 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2978 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2979 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2980 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2981 | |
| 2982 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2983 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2984 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2985 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2986 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2987 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2988 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2990 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2992 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2993 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2994 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2995 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2996 | |
| 2997 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2998 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2999 | /* ///////////////////////// */ |
| 3000 | } |
| 3001 | #endif |
| 3002 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 3003 | |
| 3004 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3005 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3006 | |
| 3007 | |
| 3008 | |
| 3009 | if (pu8keybuf == NULL) { |
| 3010 | PRINT_ER("No buffer to send PTK Key\n"); |
| 3011 | ret = -1; |
| 3012 | goto _WPAPtk_end_case_; |
| 3013 | |
| 3014 | } |
| 3015 | |
| 3016 | /*|-----------------------------------------------------------------------------| |
| 3017 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 3018 | * |----------------|------------|--------------|----------------|---------------| |
| 3019 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 3020 | |-----------------------------------------------------------------------------|*/ |
| 3021 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3022 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3023 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3024 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3026 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3027 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 3028 | |
| 3029 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3030 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3031 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3032 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3033 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 3034 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3035 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3036 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3037 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3038 | |
| 3039 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3040 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3041 | /* ///////////////////////// */ |
| 3042 | } |
| 3043 | |
| 3044 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3045 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3046 | if (ret == -1) |
| 3047 | return ret; |
| 3048 | |
| 3049 | break; |
| 3050 | |
| 3051 | |
| 3052 | case PMKSA: |
| 3053 | |
| 3054 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 3055 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3056 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3057 | if (pu8keybuf == NULL) { |
| 3058 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 3059 | return -1; |
| 3060 | } |
| 3061 | |
| 3062 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 3063 | |
| 3064 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 3065 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3066 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 3067 | 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] | 3068 | } |
| 3069 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3070 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3071 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3072 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3073 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 3074 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3075 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3076 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3077 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3078 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3079 | break; |
| 3080 | } |
| 3081 | |
| 3082 | if (s32Error) |
| 3083 | PRINT_ER("Failed to send key config packet\n"); |
| 3084 | |
| 3085 | |
| 3086 | return s32Error; |
| 3087 | } |
| 3088 | |
| 3089 | |
| 3090 | /** |
| 3091 | * @brief Handle_Disconnect |
| 3092 | * @details Sending config packet to firmware to disconnect |
| 3093 | * @param[in] NONE |
| 3094 | * @return NONE |
| 3095 | * @author |
| 3096 | * @date |
| 3097 | * @version 1.0 |
| 3098 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3099 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3100 | { |
| 3101 | tstrWID strWID; |
| 3102 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3103 | s32 s32Error = WILC_SUCCESS; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3104 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3105 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3106 | |
| 3107 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3108 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3109 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3110 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3111 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3112 | |
| 3113 | |
| 3114 | |
| 3115 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 3116 | |
| 3117 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3118 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3119 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3120 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3121 | #endif |
| 3122 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3123 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3124 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3125 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3126 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3127 | |
| 3128 | if (s32Error) { |
| 3129 | PRINT_ER("Failed to send dissconect config packet\n"); |
| 3130 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3131 | } else { |
| 3132 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 3133 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3134 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3135 | |
| 3136 | strDisconnectNotifInfo.u16reason = 0; |
| 3137 | strDisconnectNotifInfo.ie = NULL; |
| 3138 | strDisconnectNotifInfo.ie_len = 0; |
| 3139 | |
| 3140 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3141 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3142 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3143 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 3144 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3145 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3146 | } |
| 3147 | |
| 3148 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 3149 | |
| 3150 | /*BugID_5193*/ |
| 3151 | /*Stop connect timer, if connection in progress*/ |
| 3152 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3153 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3154 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3155 | } |
| 3156 | |
| 3157 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 3158 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 3159 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3160 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3161 | } |
| 3162 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3163 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3164 | |
| 3165 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 3166 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3167 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3168 | |
| 3169 | |
| 3170 | /* Deallocation */ |
| 3171 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 3172 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3173 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3174 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 3175 | } |
| 3176 | |
| 3177 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3178 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3179 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 3180 | } |
| 3181 | |
| 3182 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 3183 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3184 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3185 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 3186 | } |
| 3187 | |
| 3188 | |
| 3189 | /*BugID_5137*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3190 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3191 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3192 | gu8FlushedJoinReq = NULL; |
| 3193 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3194 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3195 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3196 | gu8FlushedInfoElemAsoc = NULL; |
| 3197 | } |
| 3198 | |
| 3199 | } |
| 3200 | |
| 3201 | WILC_CATCH(s32Error) |
| 3202 | { |
| 3203 | |
| 3204 | } |
| 3205 | |
| 3206 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3207 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3208 | /* ///////////////////////// */ |
| 3209 | |
| 3210 | } |
| 3211 | |
| 3212 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3213 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3214 | { |
| 3215 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 3216 | |
| 3217 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3218 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3219 | return; |
| 3220 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 3221 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3222 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3223 | } |
| 3224 | } |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3225 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3226 | { |
| 3227 | |
| 3228 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3229 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3230 | tstrWID strWID; |
| 3231 | static char dummy = 9; |
| 3232 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3233 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3234 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3235 | strWID.enuWIDtype = WID_CHAR; |
| 3236 | strWID.ps8WidVal = &dummy; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3237 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3238 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3239 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3240 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3241 | |
| 3242 | |
| 3243 | if (s32Error) { |
| 3244 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); |
| 3245 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 3246 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3247 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3248 | |
| 3249 | |
| 3250 | } |
| 3251 | |
| 3252 | WILC_CATCH(s32Error) |
| 3253 | { |
| 3254 | |
| 3255 | } |
| 3256 | |
| 3257 | return s32Error; |
| 3258 | } |
| 3259 | |
| 3260 | /** |
| 3261 | * @brief Handle_GetChnl |
| 3262 | * @details Sending config packet to get channel |
| 3263 | * @param[in] NONE |
| 3264 | * @return NONE |
| 3265 | * |
| 3266 | * @author |
| 3267 | * @date |
| 3268 | * @version 1.0 |
| 3269 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3270 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3271 | { |
| 3272 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3273 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3274 | tstrWID strWID; |
| 3275 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 3276 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3277 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3278 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3279 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3280 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3281 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3282 | |
| 3283 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 3284 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3285 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3286 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3287 | /*get the value by searching the local copy*/ |
| 3288 | if (s32Error) { |
| 3289 | PRINT_ER("Failed to get channel number\n"); |
| 3290 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3291 | } |
| 3292 | |
| 3293 | |
| 3294 | WILC_CATCH(s32Error) |
| 3295 | { |
| 3296 | |
| 3297 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3298 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3299 | |
| 3300 | return s32Error; |
| 3301 | |
| 3302 | |
| 3303 | |
| 3304 | } |
| 3305 | |
| 3306 | |
| 3307 | /** |
| 3308 | * @brief Handle_GetRssi |
| 3309 | * @details Sending config packet to get RSSI |
| 3310 | * @param[in] NONE |
| 3311 | * @return NONE |
| 3312 | * @author |
| 3313 | * @date |
| 3314 | * @version 1.0 |
| 3315 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3316 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3317 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3318 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3319 | tstrWID strWID; |
| 3320 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3321 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3322 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3323 | strWID.enuWIDtype = WID_CHAR; |
| 3324 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3325 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3326 | |
| 3327 | /*Sending Cfg*/ |
| 3328 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 3329 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3330 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3331 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3332 | if (s32Error) { |
| 3333 | PRINT_ER("Failed to get RSSI value\n"); |
| 3334 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3335 | } |
| 3336 | |
| 3337 | WILC_CATCH(s32Error) |
| 3338 | { |
| 3339 | |
| 3340 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3341 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3342 | |
| 3343 | |
| 3344 | } |
| 3345 | |
| 3346 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3347 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3348 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3349 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3350 | tstrWID strWID; |
| 3351 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3352 | |
| 3353 | gs8lnkspd = 0; |
| 3354 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3355 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3356 | strWID.enuWIDtype = WID_CHAR; |
| 3357 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3358 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3359 | /*Sending Cfg*/ |
| 3360 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 3361 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3362 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3363 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3364 | if (s32Error) { |
| 3365 | PRINT_ER("Failed to get LINKSPEED value\n"); |
| 3366 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3367 | } |
| 3368 | |
| 3369 | WILC_CATCH(s32Error) |
| 3370 | { |
| 3371 | |
| 3372 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3373 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3374 | |
| 3375 | |
| 3376 | } |
| 3377 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3378 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3379 | { |
| 3380 | tstrWID strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 3381 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3382 | |
| 3383 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 3384 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3385 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3386 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3387 | u32WidsCount++; |
| 3388 | |
| 3389 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3390 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3391 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3392 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3393 | u32WidsCount++; |
| 3394 | |
| 3395 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3396 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3397 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3398 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3399 | u32WidsCount++; |
| 3400 | |
| 3401 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3402 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3403 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3404 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3405 | u32WidsCount++; |
| 3406 | |
| 3407 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3408 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3409 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3410 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3411 | u32WidsCount++; |
| 3412 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3413 | s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3414 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3415 | |
| 3416 | if (s32Error) { |
| 3417 | PRINT_ER("Failed to send scan paramters config packet\n"); |
| 3418 | /* WILC_ERRORREPORT(s32Error, s32Error); */ |
| 3419 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3420 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3421 | return 0; |
| 3422 | |
| 3423 | } |
| 3424 | |
| 3425 | |
| 3426 | #ifdef WILC_AP_EXTERNAL_MLME |
| 3427 | |
| 3428 | |
| 3429 | /** |
| 3430 | * @brief Handle_Get_InActiveTime |
| 3431 | * @details Sending config packet to set mac adddress for station and |
| 3432 | * get inactive time |
| 3433 | * @param[in] NONE |
| 3434 | * @return NONE |
| 3435 | * |
| 3436 | * @author |
| 3437 | * @date |
| 3438 | * @version 1.0 |
| 3439 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3440 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3441 | { |
| 3442 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3443 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3444 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3445 | tstrWID strWID; |
| 3446 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3447 | |
| 3448 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3449 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3450 | strWID.enuWIDtype = WID_STR; |
| 3451 | strWID.s32ValueSize = ETH_ALEN; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3452 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | |
| 3454 | |
| 3455 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3456 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3457 | |
| 3458 | |
| 3459 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3460 | |
| 3461 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3462 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3463 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3464 | /*get the value by searching the local copy*/ |
| 3465 | if (s32Error) { |
| 3466 | PRINT_ER("Failed to SET incative time\n"); |
| 3467 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3468 | } |
| 3469 | |
| 3470 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3471 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3472 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3473 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3474 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3475 | |
| 3476 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3477 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3478 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3479 | /*get the value by searching the local copy*/ |
| 3480 | if (s32Error) { |
| 3481 | PRINT_ER("Failed to get incative time\n"); |
| 3482 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3483 | } |
| 3484 | |
| 3485 | |
| 3486 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3487 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3488 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3489 | WILC_CATCH(s32Error) |
| 3490 | { |
| 3491 | |
| 3492 | } |
| 3493 | |
| 3494 | |
| 3495 | return s32Error; |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | } |
| 3500 | |
| 3501 | |
| 3502 | /** |
| 3503 | * @brief Handle_AddBeacon |
| 3504 | * @details Sending config packet to add beacon |
| 3505 | * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam |
| 3506 | * @return NONE |
| 3507 | * @author |
| 3508 | * @date |
| 3509 | * @version 1.0 |
| 3510 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3511 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3512 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3513 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3514 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3515 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3517 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3518 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3519 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3520 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3521 | strWID.enuWIDtype = WID_BIN; |
| 3522 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3523 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3524 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3525 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3526 | |
| 3527 | pu8CurrByte = strWID.ps8WidVal; |
| 3528 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3529 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3530 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3531 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3532 | |
| 3533 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3534 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3535 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3536 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3537 | |
| 3538 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3539 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3540 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3541 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3542 | |
| 3543 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3544 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3545 | |
| 3546 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3547 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3548 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3549 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3550 | |
| 3551 | /* Bug 4599 : if tail length = 0 skip copying */ |
| 3552 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3553 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3554 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3555 | |
| 3556 | |
| 3557 | |
| 3558 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3559 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3560 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3561 | if (s32Error) { |
| 3562 | PRINT_ER("Failed to send add beacon config packet\n"); |
| 3563 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3564 | } |
| 3565 | |
| 3566 | WILC_CATCH(s32Error) |
| 3567 | { |
| 3568 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3569 | kfree(strWID.ps8WidVal); |
| 3570 | kfree(pstrSetBeaconParam->pu8Head); |
| 3571 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3572 | } |
| 3573 | |
| 3574 | |
| 3575 | /** |
| 3576 | * @brief Handle_AddBeacon |
| 3577 | * @details Sending config packet to delete beacon |
| 3578 | * @param[in] tstrHostIFDelBeacon* pstrDelBeacon |
| 3579 | * @return NONE |
| 3580 | * @author |
| 3581 | * @date |
| 3582 | * @version 1.0 |
| 3583 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3584 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3585 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3586 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3587 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3588 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3589 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3590 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3591 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3592 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3593 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3594 | strWID.ps8WidVal = &gu8DelBcn; |
| 3595 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3596 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3597 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3598 | |
| 3599 | pu8CurrByte = strWID.ps8WidVal; |
| 3600 | |
| 3601 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3602 | /* TODO: build del beacon message*/ |
| 3603 | |
| 3604 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3605 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3606 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3607 | if (s32Error) { |
| 3608 | |
| 3609 | PRINT_ER("Failed to send delete beacon config packet\n"); |
| 3610 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3611 | } |
| 3612 | |
| 3613 | WILC_CATCH(s32Error) |
| 3614 | { |
| 3615 | } |
| 3616 | } |
| 3617 | |
| 3618 | |
| 3619 | /** |
| 3620 | * @brief WILC_HostIf_PackStaParam |
| 3621 | * @details Handling packing of the station params in a buffer |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3622 | * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3623 | * @return NONE |
| 3624 | * @author |
| 3625 | * @date |
| 3626 | * @version 1.0 |
| 3627 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3628 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3629 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3630 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3631 | |
| 3632 | pu8CurrByte = pu8Buffer; |
| 3633 | |
| 3634 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3635 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3636 | pu8CurrByte += ETH_ALEN; |
| 3637 | |
| 3638 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3639 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3640 | |
| 3641 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3642 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3643 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3644 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3645 | |
| 3646 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3647 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3648 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3649 | |
| 3650 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3651 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3652 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3653 | |
| 3654 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3655 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3656 | |
| 3657 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3658 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3659 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3660 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3661 | |
| 3662 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3663 | |
| 3664 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3665 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3666 | |
| 3667 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3668 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3669 | |
| 3670 | return pu8CurrByte - pu8Buffer; |
| 3671 | } |
| 3672 | |
| 3673 | /** |
| 3674 | * @brief Handle_AddStation |
| 3675 | * @details Sending config packet to add station |
| 3676 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3677 | * @return NONE |
| 3678 | * @author |
| 3679 | * @date |
| 3680 | * @version 1.0 |
| 3681 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3682 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3683 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3684 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3685 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3686 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3687 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3688 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3689 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3690 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3691 | strWID.enuWIDtype = WID_BIN; |
| 3692 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3693 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3694 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3695 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3696 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3697 | |
| 3698 | pu8CurrByte = strWID.ps8WidVal; |
| 3699 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3700 | |
| 3701 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3702 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3703 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3704 | if (s32Error != WILC_SUCCESS) { |
| 3705 | |
| 3706 | PRINT_ER("Failed to send add station config packet\n"); |
| 3707 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3708 | } |
| 3709 | |
| 3710 | WILC_CATCH(s32Error) |
| 3711 | { |
| 3712 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3713 | kfree(pstrStationParam->pu8Rates); |
| 3714 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3715 | } |
| 3716 | |
| 3717 | /** |
| 3718 | * @brief Handle_DelAllSta |
| 3719 | * @details Sending config packet to delete station |
| 3720 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3721 | * @return NONE |
| 3722 | * @author |
| 3723 | * @date |
| 3724 | * @version 1.0 |
| 3725 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3726 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3727 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3728 | s32 s32Error = WILC_SUCCESS; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3729 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3730 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3731 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3732 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3733 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3734 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3735 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3736 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3737 | strWID.enuWIDtype = WID_STR; |
| 3738 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3739 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3740 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3741 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3742 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3743 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3744 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3745 | |
| 3746 | pu8CurrByte = strWID.ps8WidVal; |
| 3747 | |
| 3748 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3749 | |
| 3750 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3751 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3752 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3753 | else |
| 3754 | continue; |
| 3755 | |
| 3756 | pu8CurrByte += ETH_ALEN; |
| 3757 | } |
| 3758 | |
| 3759 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3760 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3761 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3762 | if (s32Error) { |
| 3763 | |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3764 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3765 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3766 | } |
| 3767 | |
| 3768 | WILC_CATCH(s32Error) |
| 3769 | { |
| 3770 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3771 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3772 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3773 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3774 | } |
| 3775 | |
| 3776 | |
| 3777 | /** |
| 3778 | * @brief Handle_DelStation |
| 3779 | * @details Sending config packet to delete station |
| 3780 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3781 | * @return NONE |
| 3782 | * @author |
| 3783 | * @date |
| 3784 | * @version 1.0 |
| 3785 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3786 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3787 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3788 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3789 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3790 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3792 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3793 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3794 | strWID.enuWIDtype = WID_BIN; |
| 3795 | strWID.s32ValueSize = ETH_ALEN; |
| 3796 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3797 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3798 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3799 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3800 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3801 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3802 | |
| 3803 | pu8CurrByte = strWID.ps8WidVal; |
| 3804 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3805 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3806 | |
| 3807 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3808 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3809 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3810 | if (s32Error) { |
| 3811 | |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3812 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3813 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3814 | } |
| 3815 | |
| 3816 | WILC_CATCH(s32Error) |
| 3817 | { |
| 3818 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3819 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3820 | } |
| 3821 | |
| 3822 | |
| 3823 | /** |
| 3824 | * @brief Handle_EditStation |
| 3825 | * @details Sending config packet to edit station |
| 3826 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3827 | * @return NONE |
| 3828 | * @author |
| 3829 | * @date |
| 3830 | * @version 1.0 |
| 3831 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3832 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3833 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3834 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3836 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3837 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3838 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3839 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3840 | strWID.enuWIDtype = WID_BIN; |
| 3841 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3842 | |
| 3843 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3844 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3845 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3846 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3847 | |
| 3848 | pu8CurrByte = strWID.ps8WidVal; |
| 3849 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3850 | |
| 3851 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3852 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3853 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3854 | if (s32Error) { |
| 3855 | |
| 3856 | PRINT_ER("Failed to send edit station config packet\n"); |
| 3857 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 3858 | } |
| 3859 | |
| 3860 | WILC_CATCH(s32Error) |
| 3861 | { |
| 3862 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3863 | kfree(pstrStationParam->pu8Rates); |
| 3864 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3865 | } |
| 3866 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
| 3867 | |
| 3868 | #ifdef WILC_P2P |
| 3869 | /** |
| 3870 | * @brief Handle_RemainOnChan |
| 3871 | * @details Sending config packet to edit station |
| 3872 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3873 | * @return NONE |
| 3874 | * @author |
| 3875 | * @date |
| 3876 | * @version 1.0 |
| 3877 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3878 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3879 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3880 | s32 s32Error = WILC_SUCCESS; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3881 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3882 | tstrWID strWID; |
| 3883 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3884 | |
| 3885 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3886 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3887 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3888 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3889 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3890 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3891 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3892 | } else { |
| 3893 | /*Set the channel to use it as a wid val*/ |
| 3894 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3895 | } |
| 3896 | |
| 3897 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3898 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3899 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
| 3900 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3901 | } |
| 3902 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3903 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); |
| 3904 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3905 | } |
| 3906 | |
| 3907 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3908 | if (g_obtainingIP || connecting) { |
| 3909 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
| 3910 | WILC_ERRORREPORT(s32Error, WILC_BUSY); |
| 3911 | } |
| 3912 | #endif |
| 3913 | |
| 3914 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3915 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3916 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3917 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3918 | strWID.enuWIDtype = WID_STR; |
| 3919 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3920 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3921 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3922 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3923 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3924 | |
| 3925 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3926 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3927 | |
| 3928 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3929 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3930 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3931 | if (s32Error != WILC_SUCCESS) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3932 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3933 | |
| 3934 | WILC_CATCH(-1) |
| 3935 | { |
| 3936 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3937 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3938 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3939 | jiffies + |
| 3940 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3941 | |
| 3942 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3943 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3944 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3945 | |
| 3946 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3947 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3948 | } |
| 3949 | return s32Error; |
| 3950 | } |
| 3951 | |
| 3952 | /** |
| 3953 | * @brief Handle_RegisterFrame |
| 3954 | * @details |
| 3955 | * @param[in] |
| 3956 | * @return NONE |
| 3957 | * @author |
| 3958 | * @date |
| 3959 | * @version 1.0 |
| 3960 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3961 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3962 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 3963 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3964 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3965 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3966 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3967 | |
| 3968 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3969 | |
| 3970 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3971 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3972 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3973 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3974 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3975 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3976 | |
| 3977 | pu8CurrByte = strWID.ps8WidVal; |
| 3978 | |
| 3979 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3980 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3981 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3982 | |
| 3983 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3984 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3985 | |
| 3986 | |
| 3987 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3988 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3989 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3990 | if (s32Error) { |
| 3991 | PRINT_ER("Failed to frame register config packet\n"); |
| 3992 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 3993 | } |
| 3994 | |
| 3995 | |
| 3996 | WILC_CATCH(s32Error) |
| 3997 | { |
| 3998 | } |
| 3999 | |
| 4000 | return s32Error; |
| 4001 | |
| 4002 | } |
| 4003 | |
| 4004 | /** |
| 4005 | * @brief Handle_ListenStateExpired |
| 4006 | * @details Handle of listen state expiration |
| 4007 | * @param[in] NONE |
| 4008 | * @return Error code. |
| 4009 | * @author |
| 4010 | * @date |
| 4011 | * @version 1.0 |
| 4012 | */ |
| 4013 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4014 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4015 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4016 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4017 | tstrWID strWID; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4018 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4019 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 4020 | |
| 4021 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 4022 | |
| 4023 | /*BugID_5477*/ |
| 4024 | /*Make sure we are already in listen state*/ |
| 4025 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 4026 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4027 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4028 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4029 | strWID.enuWIDtype = WID_STR; |
| 4030 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4031 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4032 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4033 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4034 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | |
| 4036 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 4037 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 4038 | |
| 4039 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4040 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4041 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4042 | if (s32Error != WILC_SUCCESS) { |
| 4043 | PRINT_ER("Failed to set remain on channel\n"); |
| 4044 | goto _done_; |
| 4045 | } |
| 4046 | |
| 4047 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 4048 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 4049 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 4050 | } |
| 4051 | P2P_LISTEN_STATE = 0; |
| 4052 | } else { |
| 4053 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
| 4054 | s32Error = WILC_FAIL; |
| 4055 | } |
| 4056 | |
| 4057 | _done_: |
| 4058 | return s32Error; |
| 4059 | } |
| 4060 | |
| 4061 | |
| 4062 | /** |
| 4063 | * @brief ListenTimerCB |
| 4064 | * @details Callback function of remain-on-channel timer |
| 4065 | * @param[in] NONE |
| 4066 | * @return Error code. |
| 4067 | * @author |
| 4068 | * @date |
| 4069 | * @version 1.0 |
| 4070 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4071 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4072 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4073 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4074 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4075 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4076 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4077 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | |
| 4079 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4080 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4081 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
| 4082 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 4083 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
| 4084 | |
| 4085 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4086 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4087 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4088 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4089 | WILC_CATCH(s32Error) |
| 4090 | { |
| 4091 | |
| 4092 | } |
| 4093 | } |
| 4094 | #endif |
| 4095 | |
| 4096 | |
| 4097 | /** |
| 4098 | * @brief Handle_EditStation |
| 4099 | * @details Sending config packet to edit station |
| 4100 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 4101 | * @return NONE |
| 4102 | * @author |
| 4103 | * @date |
| 4104 | * @version 1.0 |
| 4105 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4106 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4107 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4108 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4109 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4110 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4111 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4112 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4113 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4114 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4115 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4117 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4118 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4119 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 4120 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4121 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4122 | |
| 4123 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 4124 | |
| 4125 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4126 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4127 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4128 | if (s32Error) { |
| 4129 | PRINT_ER("Failed to send power management config packet\n"); |
| 4130 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 4131 | } |
| 4132 | |
| 4133 | WILC_CATCH(s32Error) |
| 4134 | { |
| 4135 | |
| 4136 | } |
| 4137 | } |
| 4138 | |
| 4139 | /** |
| 4140 | * @brief Handle_SetMulticastFilter |
| 4141 | * @details Set Multicast filter in firmware |
| 4142 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4143 | * @return NONE |
| 4144 | * @author asobhy |
| 4145 | * @date |
| 4146 | * @version 1.0 |
| 4147 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4148 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4149 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4150 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4151 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4152 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4153 | |
| 4154 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 4155 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4156 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4157 | strWID.enuWIDtype = WID_BIN; |
| 4158 | strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4159 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4160 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4161 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4162 | |
| 4163 | pu8CurrByte = strWID.ps8WidVal; |
| 4164 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 4165 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 4166 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 4167 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 4168 | |
| 4169 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 4170 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 4171 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 4172 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 4173 | |
| 4174 | if ((strHostIfSetMulti->u32count) > 0) |
| 4175 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 4176 | |
| 4177 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4178 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 4179 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4180 | if (s32Error) { |
| 4181 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4182 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 4183 | } |
| 4184 | |
| 4185 | WILC_CATCH(s32Error) |
| 4186 | { |
| 4187 | } |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 4188 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4189 | |
| 4190 | } |
| 4191 | |
| 4192 | |
| 4193 | /*BugID_5222*/ |
| 4194 | /** |
| 4195 | * @brief Handle_AddBASession |
| 4196 | * @details Add block ack session |
| 4197 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4198 | * @return NONE |
| 4199 | * @author Amr Abdel-Moghny |
| 4200 | * @date Feb. 2014 |
| 4201 | * @version 9.0 |
| 4202 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4203 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4204 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4205 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4206 | tstrWID strWID; |
| 4207 | int AddbaTimeout = 100; |
| 4208 | char *ptr = NULL; |
| 4209 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4210 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4211 | 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] | 4212 | strHostIfBASessionInfo->au8Bssid[0], |
| 4213 | strHostIfBASessionInfo->au8Bssid[1], |
| 4214 | strHostIfBASessionInfo->au8Bssid[2], |
| 4215 | strHostIfBASessionInfo->u16BufferSize, |
| 4216 | strHostIfBASessionInfo->u16SessionTimeout, |
| 4217 | strHostIfBASessionInfo->u8Ted); |
| 4218 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4219 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4220 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4221 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4222 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4223 | ptr = strWID.ps8WidVal; |
| 4224 | /* *ptr++ = 0x14; */ |
| 4225 | *ptr++ = 0x14; |
| 4226 | *ptr++ = 0x3; |
| 4227 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4228 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4229 | ptr += ETH_ALEN; |
| 4230 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4231 | /* BA Policy*/ |
| 4232 | *ptr++ = 1; |
| 4233 | /* Buffer size*/ |
| 4234 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4235 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 4236 | /* BA timeout*/ |
| 4237 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 4238 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4239 | /* ADDBA timeout*/ |
| 4240 | *ptr++ = (AddbaTimeout & 0xFF); |
| 4241 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 4242 | /* Group Buffer Max Frames*/ |
| 4243 | *ptr++ = 8; |
| 4244 | /* Group Buffer Timeout */ |
| 4245 | *ptr++ = 0; |
| 4246 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4247 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4248 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4249 | if (s32Error) |
| 4250 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 4251 | |
| 4252 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4253 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4254 | strWID.enuWIDtype = WID_STR; |
| 4255 | strWID.s32ValueSize = 15; |
| 4256 | ptr = strWID.ps8WidVal; |
| 4257 | /* *ptr++ = 0x14; */ |
| 4258 | *ptr++ = 15; |
| 4259 | *ptr++ = 7; |
| 4260 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4261 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4262 | ptr += ETH_ALEN; |
| 4263 | /* TID*/ |
| 4264 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4265 | /* Max Num MSDU */ |
| 4266 | *ptr++ = 8; |
| 4267 | /* BA timeout*/ |
| 4268 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4269 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4270 | /*Ack-Policy */ |
| 4271 | *ptr++ = 3; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4272 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4273 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4274 | |
| 4275 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4276 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4277 | |
| 4278 | return s32Error; |
| 4279 | |
| 4280 | } |
| 4281 | |
| 4282 | |
| 4283 | /*BugID_5222*/ |
| 4284 | /** |
| 4285 | * @brief Handle_DelBASession |
| 4286 | * @details Delete block ack session |
| 4287 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4288 | * @return NONE |
| 4289 | * @author Amr Abdel-Moghny |
| 4290 | * @date Feb. 2013 |
| 4291 | * @version 9.0 |
| 4292 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4293 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4294 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4295 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4296 | tstrWID strWID; |
| 4297 | char *ptr = NULL; |
| 4298 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4299 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4300 | 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] | 4301 | strHostIfBASessionInfo->au8Bssid[0], |
| 4302 | strHostIfBASessionInfo->au8Bssid[1], |
| 4303 | strHostIfBASessionInfo->au8Bssid[2], |
| 4304 | strHostIfBASessionInfo->u8Ted); |
| 4305 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4306 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4307 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4308 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4310 | ptr = strWID.ps8WidVal; |
| 4311 | /* *ptr++ = 0x14; */ |
| 4312 | *ptr++ = 0x14; |
| 4313 | *ptr++ = 0x3; |
| 4314 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4315 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4316 | ptr += ETH_ALEN; |
| 4317 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4318 | /* BA direction = recipent*/ |
| 4319 | *ptr++ = 0; |
| 4320 | /* Delba Reason */ |
| 4321 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4322 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4323 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4324 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | if (s32Error) |
| 4326 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4327 | |
| 4328 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4329 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4330 | strWID.enuWIDtype = WID_STR; |
| 4331 | strWID.s32ValueSize = 15; |
| 4332 | ptr = strWID.ps8WidVal; |
| 4333 | /* *ptr++ = 0x14; */ |
| 4334 | *ptr++ = 15; |
| 4335 | *ptr++ = 7; |
| 4336 | *ptr++ = 0x3; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4337 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4338 | ptr += ETH_ALEN; |
| 4339 | /* TID*/ |
| 4340 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4341 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4342 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4343 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4344 | |
| 4345 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4346 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4347 | |
| 4348 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4349 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4350 | |
| 4351 | return s32Error; |
| 4352 | |
| 4353 | } |
| 4354 | |
| 4355 | |
| 4356 | /** |
| 4357 | * @brief Handle_DelAllRxBASessions |
| 4358 | * @details Delete all Rx BA sessions |
| 4359 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4360 | * @return NONE |
| 4361 | * @author Abdelrahman Sobhy |
| 4362 | * @date Feb. 2013 |
| 4363 | * @version 9.0 |
| 4364 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4365 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4366 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4367 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4368 | tstrWID strWID; |
| 4369 | char *ptr = NULL; |
| 4370 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4371 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4372 | 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] | 4373 | strHostIfBASessionInfo->au8Bssid[0], |
| 4374 | strHostIfBASessionInfo->au8Bssid[1], |
| 4375 | strHostIfBASessionInfo->au8Bssid[2], |
| 4376 | strHostIfBASessionInfo->u8Ted); |
| 4377 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4378 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4379 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4380 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4382 | ptr = strWID.ps8WidVal; |
| 4383 | *ptr++ = 0x14; |
| 4384 | *ptr++ = 0x3; |
| 4385 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4386 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4387 | ptr += ETH_ALEN; |
| 4388 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4389 | /* BA direction = recipent*/ |
| 4390 | *ptr++ = 0; |
| 4391 | /* Delba Reason */ |
| 4392 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4393 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4394 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4395 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4396 | if (s32Error) |
| 4397 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4398 | |
| 4399 | |
| 4400 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4401 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4402 | |
| 4403 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4404 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4405 | |
| 4406 | return s32Error; |
| 4407 | |
| 4408 | } |
| 4409 | |
| 4410 | /** |
| 4411 | * @brief hostIFthread |
| 4412 | * @details Main thread to handle message queue requests |
| 4413 | * @param[in] void* pvArg |
| 4414 | * @return NONE |
| 4415 | * @author |
| 4416 | * @date |
| 4417 | * @version 1.0 |
| 4418 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4419 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4420 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4421 | u32 u32Ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4422 | tstrHostIFmsg strHostIFmsg; |
| 4423 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 4424 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4425 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4426 | |
| 4427 | while (1) { |
Chaehyun Lim | b986e33 | 2015-08-19 15:59:07 +0900 | [diff] [blame] | 4428 | wilc_mq_recv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4429 | pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler; |
| 4430 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) { |
| 4431 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 4432 | break; |
| 4433 | } |
| 4434 | |
| 4435 | |
| 4436 | /*Re-Queue HIF message*/ |
| 4437 | if ((!g_wilc_initialized)) { |
| 4438 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4439 | usleep_range(200 * 1000, 200 * 1000); |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4440 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4441 | continue; |
| 4442 | } |
| 4443 | |
| 4444 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 4445 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4446 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4447 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4448 | continue; |
| 4449 | } |
| 4450 | |
| 4451 | switch (strHostIFmsg.u16MsgId) { |
| 4452 | case HOST_IF_MSG_Q_IDLE: |
| 4453 | Handle_wait_msg_q_empty(); |
| 4454 | break; |
| 4455 | |
| 4456 | case HOST_IF_MSG_SCAN: |
| 4457 | Handle_Scan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr); |
| 4458 | break; |
| 4459 | |
| 4460 | case HOST_IF_MSG_CONNECT: |
| 4461 | Handle_Connect(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr); |
| 4462 | break; |
| 4463 | |
| 4464 | /*BugID_5137*/ |
| 4465 | case HOST_IF_MSG_FLUSH_CONNECT: |
| 4466 | Handle_FlushConnect(strHostIFmsg.drvHandler); |
| 4467 | break; |
| 4468 | |
| 4469 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
| 4470 | Handle_RcvdNtwrkInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo); |
| 4471 | break; |
| 4472 | |
| 4473 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
| 4474 | Handle_RcvdGnrlAsyncInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo); |
| 4475 | break; |
| 4476 | |
| 4477 | case HOST_IF_MSG_KEY: |
| 4478 | Handle_Key(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr); |
| 4479 | break; |
| 4480 | |
| 4481 | case HOST_IF_MSG_CFG_PARAMS: |
| 4482 | |
| 4483 | Handle_CfgParam(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr); |
| 4484 | break; |
| 4485 | |
| 4486 | case HOST_IF_MSG_SET_CHANNEL: |
| 4487 | Handle_SetChannel(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan); |
| 4488 | break; |
| 4489 | |
| 4490 | case HOST_IF_MSG_DISCONNECT: |
| 4491 | Handle_Disconnect(strHostIFmsg.drvHandler); |
| 4492 | break; |
| 4493 | |
| 4494 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4495 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 4497 | |
| 4498 | /*BugID_5213*/ |
| 4499 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4500 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4501 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4502 | |
| 4503 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE); |
| 4504 | |
| 4505 | #ifdef WILC_P2P |
| 4506 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 4507 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4508 | #endif |
| 4509 | |
| 4510 | break; |
| 4511 | |
| 4512 | case HOST_IF_MSG_GET_RSSI: |
| 4513 | Handle_GetRssi(strHostIFmsg.drvHandler); |
| 4514 | break; |
| 4515 | |
| 4516 | case HOST_IF_MSG_GET_LINKSPEED: |
| 4517 | Handle_GetLinkspeed(strHostIFmsg.drvHandler); |
| 4518 | break; |
| 4519 | |
| 4520 | case HOST_IF_MSG_GET_STATISTICS: |
| 4521 | Handle_GetStatistics(strHostIFmsg.drvHandler, (tstrStatistics *)strHostIFmsg.uniHostIFmsgBody.pUserData); |
| 4522 | break; |
| 4523 | |
| 4524 | case HOST_IF_MSG_GET_CHNL: |
| 4525 | Handle_GetChnl(strHostIFmsg.drvHandler); |
| 4526 | break; |
| 4527 | |
| 4528 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4529 | case HOST_IF_MSG_ADD_BEACON: |
| 4530 | Handle_AddBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon); |
| 4531 | break; |
| 4532 | |
| 4533 | case HOST_IF_MSG_DEL_BEACON: |
| 4534 | Handle_DelBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelBeacon); |
| 4535 | break; |
| 4536 | |
| 4537 | case HOST_IF_MSG_ADD_STATION: |
| 4538 | Handle_AddStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strAddStaParam); |
| 4539 | break; |
| 4540 | |
| 4541 | case HOST_IF_MSG_DEL_STATION: |
| 4542 | Handle_DelStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strDelStaParam); |
| 4543 | break; |
| 4544 | |
| 4545 | case HOST_IF_MSG_EDIT_STATION: |
| 4546 | Handle_EditStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strEditStaParam); |
| 4547 | break; |
| 4548 | |
| 4549 | case HOST_IF_MSG_GET_INACTIVETIME: |
| 4550 | Handle_Get_InActiveTime(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT); |
| 4551 | break; |
| 4552 | |
| 4553 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
| 4554 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4555 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4556 | |
| 4557 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_ABORTED); |
| 4558 | break; |
| 4559 | |
| 4560 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4561 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4562 | Handle_ConnectTimeout(strHostIFmsg.drvHandler); |
| 4563 | break; |
| 4564 | |
| 4565 | case HOST_IF_MSG_POWER_MGMT: |
| 4566 | Handle_PowerManagement(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam); |
| 4567 | break; |
| 4568 | |
| 4569 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 4570 | Handle_SetWfiDrvHandler(strHostIFmsg.drvHandler, |
| 4571 | &strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4572 | break; |
| 4573 | |
| 4574 | case HOST_IF_MSG_SET_OPERATION_MODE: |
| 4575 | Handle_SetOperationMode(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode); |
| 4576 | break; |
| 4577 | |
| 4578 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4579 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
| 4580 | Handle_set_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); |
| 4581 | break; |
| 4582 | |
| 4583 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4584 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
| 4585 | Handle_get_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); |
| 4586 | break; |
| 4587 | |
| 4588 | /*BugID_5077*/ |
| 4589 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
| 4590 | Handle_SetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress); |
| 4591 | break; |
| 4592 | |
| 4593 | /*BugID_5213*/ |
| 4594 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
| 4595 | Handle_GetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress); |
| 4596 | break; |
| 4597 | |
| 4598 | #ifdef WILC_P2P |
| 4599 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4600 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
| 4601 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4602 | break; |
| 4603 | |
| 4604 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4605 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
| 4606 | Handle_RegisterFrame(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame); |
| 4607 | break; |
| 4608 | |
| 4609 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
| 4610 | Handle_ListenStateExpired(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); |
| 4611 | break; |
| 4612 | |
| 4613 | #endif |
| 4614 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4615 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
| 4616 | Handle_SetMulticastFilter(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti); |
| 4617 | break; |
| 4618 | |
| 4619 | /*BugID_5222*/ |
| 4620 | case HOST_IF_MSG_ADD_BA_SESSION: |
| 4621 | Handle_AddBASession(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); |
| 4622 | break; |
| 4623 | |
| 4624 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
| 4625 | Handle_DelAllRxBASessions(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); |
| 4626 | break; |
| 4627 | |
| 4628 | case HOST_IF_MSG_DEL_ALL_STA: |
| 4629 | Handle_DelAllSta(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta); |
| 4630 | break; |
| 4631 | |
| 4632 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4633 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4634 | break; |
| 4635 | } |
| 4636 | } |
| 4637 | |
| 4638 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4639 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4640 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4641 | } |
| 4642 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4643 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4644 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4645 | void *pvArg = (void *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4646 | tstrHostIFmsg strHostIFmsg; |
| 4647 | |
| 4648 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4649 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | strHostIFmsg.drvHandler = pvArg; |
| 4651 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; |
| 4652 | |
| 4653 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4654 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4655 | } |
| 4656 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4657 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4658 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4659 | void *pvArg = (void *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | tstrHostIFmsg strHostIFmsg; |
| 4661 | |
| 4662 | /* prepare the Timer Callback message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4663 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4664 | strHostIFmsg.drvHandler = pvArg; |
| 4665 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
| 4666 | |
| 4667 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4668 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4669 | } |
| 4670 | |
| 4671 | |
| 4672 | /** |
| 4673 | * @brief removes wpa/wpa2 keys |
| 4674 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4675 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4676 | * @param[in,out] handle to the wifi driver |
| 4677 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4678 | * @return Error code indicating success/failure |
| 4679 | * @note |
| 4680 | * @author zsalah |
| 4681 | * @date 8 March 2012 |
| 4682 | * @version 1.0 |
| 4683 | */ |
| 4684 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4685 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4686 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4687 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4688 | tstrWID strWID; |
| 4689 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4690 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4691 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4692 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4693 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | strWID.s32ValueSize = 6; |
| 4695 | |
| 4696 | return s32Error; |
| 4697 | |
| 4698 | } |
| 4699 | |
| 4700 | /** |
| 4701 | * @brief removes WEP key |
| 4702 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4703 | * remove a WEP key entry from MAC HW. |
| 4704 | * The BSS Station automatically finds the index of the entry using its |
| 4705 | * BSS ID and removes that entry from the MAC hardware. |
| 4706 | * @param[in,out] handle to the wifi driver |
| 4707 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4708 | * @return Error code indicating success/failure |
| 4709 | * @note NO need for the STA add since it is not used for processing |
| 4710 | * @author zsalah |
| 4711 | * @date 8 March 2012 |
| 4712 | * @version 1.0 |
| 4713 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4714 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4715 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4716 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4717 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4718 | tstrHostIFmsg strHostIFmsg; |
| 4719 | |
| 4720 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4721 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4722 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4723 | |
| 4724 | /* prepare the Remove Wep Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4725 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4726 | |
| 4727 | |
| 4728 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4729 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4730 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = REMOVEKEY; |
| 4731 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4732 | |
| 4733 | |
| 4734 | |
| 4735 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4736 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; |
| 4737 | |
| 4738 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4739 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4740 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4741 | 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] | 4742 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4743 | |
| 4744 | WILC_CATCH(s32Error) |
| 4745 | { |
| 4746 | |
| 4747 | } |
| 4748 | return s32Error; |
| 4749 | } |
| 4750 | |
| 4751 | /** |
| 4752 | * @brief sets WEP default key |
| 4753 | * @details Sets the index of the WEP encryption key in use, |
| 4754 | * in the key table |
| 4755 | * @param[in,out] handle to the wifi driver |
| 4756 | * @param[in] key index ( 0, 1, 2, 3) |
| 4757 | * @return Error code indicating success/failure |
| 4758 | * @note |
| 4759 | * @author zsalah |
| 4760 | * @date 8 March 2012 |
| 4761 | * @version 1.0 |
| 4762 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4763 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4764 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4765 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4766 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4767 | tstrHostIFmsg strHostIFmsg; |
| 4768 | |
| 4769 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4770 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4771 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4772 | |
| 4773 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4774 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4775 | |
| 4776 | |
| 4777 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4778 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4779 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY; |
| 4780 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4781 | |
| 4782 | |
| 4783 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4784 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4785 | |
| 4786 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4787 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4788 | if (s32Error) |
| 4789 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4790 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4791 | |
| 4792 | WILC_CATCH(s32Error) |
| 4793 | { |
| 4794 | |
| 4795 | } |
| 4796 | |
| 4797 | return s32Error; |
| 4798 | } |
| 4799 | |
| 4800 | /** |
| 4801 | * @brief sets WEP deafault key |
| 4802 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4803 | * sets WEP key entry into MAC hardware when it receives the |
| 4804 | * corresponding request from NDIS. |
| 4805 | * @param[in,out] handle to the wifi driver |
| 4806 | * @param[in] message containing WEP Key in the following format |
| 4807 | *|---------------------------------------| |
| 4808 | *|Key ID Value | Key Length | Key | |
| 4809 | *|-------------|------------|------------| |
| 4810 | | 1byte | 1byte | Key Length | |
| 4811 | ||---------------------------------------| |
| 4812 | | |
| 4813 | * @return Error code indicating success/failure |
| 4814 | * @note |
| 4815 | * @author zsalah |
| 4816 | * @date 8 March 2012 |
| 4817 | * @version 1.0 |
| 4818 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4819 | 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] | 4820 | { |
| 4821 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4822 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4823 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4824 | tstrHostIFmsg strHostIFmsg; |
| 4825 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4826 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4827 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 4828 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4829 | |
| 4830 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4831 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4832 | |
| 4833 | |
| 4834 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4835 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4836 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 4837 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4838 | |
| 4839 | |
| 4840 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4841 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4842 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4843 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4844 | pu8WepKey, u8WepKeylen); |
| 4845 | |
| 4846 | |
| 4847 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4848 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4849 | |
| 4850 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4851 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4852 | |
| 4853 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4854 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4855 | if (s32Error) |
| 4856 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4857 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4858 | |
| 4859 | WILC_CATCH(s32Error) |
| 4860 | { |
| 4861 | |
| 4862 | } |
| 4863 | return s32Error; |
| 4864 | |
| 4865 | } |
| 4866 | |
| 4867 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4868 | /** |
| 4869 | * |
| 4870 | * @brief host_int_add_wep_key_bss_ap |
| 4871 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4872 | * sets WEP key entry into MAC hardware when it receives the |
| 4873 | * |
| 4874 | * corresponding request from NDIS. |
| 4875 | * @param[in,out] handle to the wifi driver |
| 4876 | * |
| 4877 | * |
| 4878 | * @return Error code indicating success/failure |
| 4879 | * @note |
| 4880 | * @author mdaftedar |
| 4881 | * @date 28 FEB 2013 |
| 4882 | * @version 1.0 |
| 4883 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4884 | 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] | 4885 | { |
| 4886 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4887 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4888 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4889 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4890 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4891 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4892 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4893 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 4894 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4895 | |
| 4896 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4897 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4898 | |
| 4899 | if (INFO) { |
| 4900 | for (i = 0; i < u8WepKeylen; i++) |
| 4901 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4902 | } |
| 4903 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4904 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; |
| 4905 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4906 | strHostIFmsg.drvHandler = hWFIDrv; |
| 4907 | |
| 4908 | |
| 4909 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4910 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4911 | |
| 4912 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4913 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4914 | pu8WepKey, (u8WepKeylen)); |
| 4915 | |
| 4916 | |
| 4917 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4918 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4919 | |
| 4920 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4921 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4922 | |
| 4923 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4924 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4925 | |
| 4926 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4927 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4928 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 4929 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4930 | |
| 4931 | if (s32Error) |
| 4932 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4933 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4934 | |
| 4935 | WILC_CATCH(s32Error) |
| 4936 | { |
| 4937 | |
| 4938 | } |
| 4939 | return s32Error; |
| 4940 | |
| 4941 | } |
| 4942 | #endif |
| 4943 | /** |
| 4944 | * @brief adds ptk Key |
| 4945 | * @details |
| 4946 | * @param[in,out] handle to the wifi driver |
| 4947 | * @param[in] message containing PTK Key in the following format |
| 4948 | *|-----------------------------------------------------------------------------| |
| 4949 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4950 | *|----------------|------------|--------------|----------------|---------------| |
| 4951 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4952 | ||-----------------------------------------------------------------------------| |
| 4953 | * @return Error code indicating success/failure |
| 4954 | * @note |
| 4955 | * @author zsalah |
| 4956 | * @date 8 March 2012 |
| 4957 | * @version 1.0 |
| 4958 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4959 | 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] | 4960 | 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] | 4961 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 4962 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4963 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 4964 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4965 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4966 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4967 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4968 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4969 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4970 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4971 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4972 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4973 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4974 | |
| 4975 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4976 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4977 | |
| 4978 | |
| 4979 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 4980 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPAPtk; |
| 4981 | #ifdef WILC_AP_EXTERNAL_MLME |
| 4982 | if (mode == AP_MODE) { |
| 4983 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4984 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 4985 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4986 | } |
| 4987 | #endif |
| 4988 | if (mode == STATION_MODE) |
| 4989 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 4990 | |
| 4991 | |
| 4992 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4993 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4994 | |
| 4995 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4996 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4997 | pu8Ptk, u8PtkKeylen); |
| 4998 | |
| 4999 | if (pu8RxMic != NULL) { |
| 5000 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5001 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5002 | pu8RxMic, RX_MIC_KEY_LEN); |
| 5003 | if (INFO) { |
| 5004 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 5005 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 5006 | } |
| 5007 | } |
| 5008 | if (pu8TxMic != NULL) { |
| 5009 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5010 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5011 | pu8TxMic, TX_MIC_KEY_LEN); |
| 5012 | if (INFO) { |
| 5013 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 5014 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 5015 | } |
| 5016 | } |
| 5017 | |
| 5018 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5019 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 5020 | |
| 5021 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5022 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
| 5023 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5024 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
| 5025 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5026 | |
| 5027 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5028 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5029 | |
| 5030 | if (s32Error) |
| 5031 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 5032 | |
| 5033 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5034 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5035 | /* /////// */ |
| 5036 | |
| 5037 | WILC_CATCH(s32Error) |
| 5038 | { |
| 5039 | |
| 5040 | } |
| 5041 | |
| 5042 | return s32Error; |
| 5043 | } |
| 5044 | |
| 5045 | /** |
| 5046 | * @brief adds Rx GTk Key |
| 5047 | * @details |
| 5048 | * @param[in,out] handle to the wifi driver |
| 5049 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 5050 | * u8GtkKeylen :The total key length |
| 5051 | * |
| 5052 | * @return Error code indicating success/failure |
| 5053 | * @note |
| 5054 | * @author zsalah |
| 5055 | * @date 8 March 2012 |
| 5056 | * @version 1.0 |
| 5057 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5058 | 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] | 5059 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5060 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5061 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5062 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5063 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5064 | tstrHostIFmsg strHostIFmsg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5065 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5066 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5067 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5068 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5069 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5070 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5071 | |
| 5072 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5073 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5074 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5075 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5076 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5077 | if (KeyRSC != NULL) { |
| 5078 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 5079 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5080 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5081 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5082 | KeyRSC, u32KeyRSClen); |
| 5083 | } |
| 5084 | |
| 5085 | |
| 5086 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 5087 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPARxGtk; |
| 5088 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5089 | |
| 5090 | #ifdef WILC_AP_EXTERNAL_MLME |
| 5091 | if (mode == AP_MODE) { |
| 5092 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 5093 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
| 5094 | } |
| 5095 | #endif |
| 5096 | if (mode == STATION_MODE) |
| 5097 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 5098 | |
| 5099 | |
| 5100 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 5101 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5102 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5103 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5104 | pu8RxGtk, u8GtkKeylen); |
| 5105 | |
| 5106 | if (pu8RxMic != NULL) { |
| 5107 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5108 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5109 | pu8RxMic, RX_MIC_KEY_LEN); |
| 5110 | |
| 5111 | } |
| 5112 | if (pu8TxMic != NULL) { |
| 5113 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5114 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5115 | pu8TxMic, TX_MIC_KEY_LEN); |
| 5116 | |
| 5117 | } |
| 5118 | |
| 5119 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5120 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
| 5121 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5122 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 5123 | |
| 5124 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. |
| 5125 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 5126 | |
| 5127 | |
| 5128 | |
| 5129 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5130 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5131 | if (s32Error) |
| 5132 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 5133 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5134 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5135 | /* /////// */ |
| 5136 | |
| 5137 | WILC_CATCH(s32Error) |
| 5138 | { |
| 5139 | |
| 5140 | } |
| 5141 | return s32Error; |
| 5142 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5143 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5144 | /** |
| 5145 | * @brief host_int_set_pmkid_info |
| 5146 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 5147 | * support is enabled. This Function sets the PMKID in firmware |
| 5148 | * when host drivr receives the corresponding request from NDIS. |
| 5149 | * The firmware then includes theset PMKID in the appropriate |
| 5150 | * management frames |
| 5151 | * @param[in,out] handle to the wifi driver |
| 5152 | * @param[in] message containing PMKID Info in the following format |
| 5153 | *|-----------------------------------------------------------------| |
| 5154 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5155 | *|-----------|------------|----------|-------|----------|----------| |
| 5156 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5157 | ||-----------------------------------------------------------------| |
| 5158 | * @return Error code indicating success/failure |
| 5159 | * @note |
| 5160 | * @author zsalah |
| 5161 | * @date 8 March 2012 |
| 5162 | * @version 1.0 |
| 5163 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5164 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5165 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5166 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5167 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5168 | tstrHostIFmsg strHostIFmsg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5169 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5170 | |
| 5171 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5172 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5173 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5174 | |
| 5175 | /* prepare the Key Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5176 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5177 | |
| 5178 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; |
| 5179 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA; |
| 5180 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
| 5181 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5182 | |
| 5183 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 5184 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5185 | 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] | 5186 | ETH_ALEN); |
| 5187 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5188 | 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] | 5189 | PMKID_LEN); |
| 5190 | } |
| 5191 | |
| 5192 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5193 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5194 | if (s32Error) |
| 5195 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 5196 | |
| 5197 | WILC_CATCH(s32Error) |
| 5198 | { |
| 5199 | |
| 5200 | } |
| 5201 | |
| 5202 | return s32Error; |
| 5203 | } |
| 5204 | |
| 5205 | /** |
| 5206 | * @brief gets the cached the pmkid info |
| 5207 | * @details valid only in BSS STA mode if External Supplicant |
| 5208 | * support is enabled. This Function sets the PMKID in firmware |
| 5209 | * when host drivr receives the corresponding request from NDIS. |
| 5210 | * The firmware then includes theset PMKID in the appropriate |
| 5211 | * management frames |
| 5212 | * @param[in,out] handle to the wifi driver, |
| 5213 | * message containing PMKID Info in the following format |
| 5214 | *|-----------------------------------------------------------------| |
| 5215 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5216 | *|-----------|------------|----------|-------|----------|----------| |
| 5217 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5218 | ||-----------------------------------------------------------------| |
| 5219 | * @param[in] |
| 5220 | * @return Error code indicating success/failure |
| 5221 | * @note |
| 5222 | * @author zsalah |
| 5223 | * @date 8 March 2012 |
| 5224 | * @version 1.0 |
| 5225 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5226 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5227 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5228 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5229 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5230 | tstrWID strWID; |
| 5231 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5232 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5233 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5234 | strWID.enuWIDtype = WID_STR; |
| 5235 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 5236 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 5237 | |
| 5238 | return s32Error; |
| 5239 | } |
| 5240 | |
| 5241 | /** |
| 5242 | * @brief sets the pass phrase |
| 5243 | * @details AP/STA mode. This function gives the pass phrase used to |
| 5244 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5245 | * The length of the field can vary from 8 to 64 bytes, |
| 5246 | * the lower layer should get the |
| 5247 | * @param[in,out] handle to the wifi driver, |
| 5248 | * @param[in] String containing PSK |
| 5249 | * @return Error code indicating success/failure |
| 5250 | * @note |
| 5251 | * @author zsalah |
| 5252 | * @date 8 March 2012 |
| 5253 | * @version 1.0 |
| 5254 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5255 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5256 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5257 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5258 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5259 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5260 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5261 | /*validating psk length*/ |
| 5262 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5263 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5264 | strWID.enuWIDtype = WID_STR; |
| 5265 | strWID.ps8WidVal = pu8PassPhrase; |
| 5266 | strWID.s32ValueSize = u8Psklength; |
| 5267 | } |
| 5268 | |
| 5269 | return s32Error; |
| 5270 | } |
| 5271 | /** |
| 5272 | * @brief host_int_get_MacAddress |
| 5273 | * @details gets mac address |
| 5274 | * @param[in,out] handle to the wifi driver, |
| 5275 | * |
| 5276 | * @return Error code indicating success/failure |
| 5277 | * @note |
| 5278 | * @author mdaftedar |
| 5279 | * @date 19 April 2012 |
| 5280 | * @version 1.0 |
| 5281 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5282 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5283 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5284 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5285 | tstrHostIFmsg strHostIFmsg; |
| 5286 | |
| 5287 | |
| 5288 | /* prepare the Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5289 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5290 | |
| 5291 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS; |
| 5292 | strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; |
| 5293 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5294 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5295 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5296 | if (s32Error) { |
| 5297 | PRINT_ER("Failed to send get mac address\n"); |
| 5298 | return WILC_FAIL; |
| 5299 | } |
| 5300 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5301 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5302 | return s32Error; |
| 5303 | } |
| 5304 | |
| 5305 | /** |
| 5306 | * @brief host_int_set_MacAddress |
| 5307 | * @details sets mac address |
| 5308 | * @param[in,out] handle to the wifi driver, |
| 5309 | * |
| 5310 | * @return Error code indicating success/failure |
| 5311 | * @note |
| 5312 | * @author mabubakr |
| 5313 | * @date 16 July 2012 |
| 5314 | * @version 1.0 |
| 5315 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5316 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5317 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5318 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5319 | tstrHostIFmsg strHostIFmsg; |
| 5320 | |
| 5321 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 5322 | |
| 5323 | /* prepare setting mac address message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5324 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5325 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5326 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5327 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5328 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5329 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5330 | if (s32Error) { |
| 5331 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
| 5332 | WILC_ERRORREPORT(s32Error, s32Error); |
| 5333 | } |
| 5334 | WILC_CATCH(s32Error) |
| 5335 | { |
| 5336 | |
| 5337 | } |
| 5338 | |
| 5339 | return s32Error; |
| 5340 | |
| 5341 | } |
| 5342 | |
| 5343 | /** |
| 5344 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 5345 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 5346 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5347 | * The length of the field can vary from 8 to 64 bytes, |
| 5348 | * the lower layer should get the |
| 5349 | * @param[in,out] handle to the wifi driver, |
| 5350 | * String containing PSK |
| 5351 | * @return Error code indicating success/failure |
| 5352 | * @note |
| 5353 | * @author zsalah |
| 5354 | * @date 8 March 2012 |
| 5355 | * @version 1.0 |
| 5356 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5357 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5358 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5359 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5360 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5361 | tstrWID strWID; |
| 5362 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5363 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5364 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5365 | strWID.enuWIDtype = WID_STR; |
| 5366 | strWID.s32ValueSize = u8Psklength; |
| 5367 | strWID.ps8WidVal = pu8PassPhrase; |
| 5368 | |
| 5369 | return s32Error; |
| 5370 | } |
| 5371 | |
| 5372 | /** |
| 5373 | * @brief host_int_get_site_survey_results |
| 5374 | * @details gets the site survey results |
| 5375 | * @param[in,out] handle to the wifi driver, |
| 5376 | * Message containing site survey results in the |
| 5377 | * following format |
| 5378 | *|---------------------------------------------------| |
| 5379 | | MsgLength | fragNo. | MsgBodyLength | MsgBody | |
| 5380 | ||-----------|-----------|---------------|-----------| |
| 5381 | | 1 | 1 | 1 | 1 | |
| 5382 | | ----------------------------------------- | ---------------- |
| 5383 | | |
| 5384 | ||---------------------------------------| |
| 5385 | | Network1 | Netweork2 | ... | Network5 | |
| 5386 | ||---------------------------------------| |
| 5387 | | 44 | 44 | ... | 44 | |
| 5388 | | -------------------------- | --------------------------------------- |
| 5389 | | |
| 5390 | ||---------------------------------------------------------------------| |
| 5391 | | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved | |
| 5392 | | |
| 5393 | | |
| 5394 | ||------|----------|---------|----------------|-------|------|---------| |
| 5395 | | 33 | 1 | 1 | 1 | 6 | 1 | 1 | |
| 5396 | ||---------------------------------------------------------------------| |
| 5397 | * @return Error code indicating success/failure |
| 5398 | * @note |
| 5399 | * @author zsalah |
| 5400 | * @date 8 March 2012 |
| 5401 | * @version 1.0 |
| 5402 | */ |
| 5403 | #ifndef CONNECT_DIRECT |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5404 | s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5405 | u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5406 | u32 u32MaxSiteSrvyFragLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5407 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5408 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5409 | tstrWID astrWIDList[2]; |
| 5410 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5411 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5412 | astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5413 | astrWIDList[0].enuWIDtype = WID_STR; |
| 5414 | astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0]; |
| 5415 | astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5416 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5417 | astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5418 | astrWIDList[1].enuWIDtype = WID_STR; |
| 5419 | astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1]; |
| 5420 | astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5421 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5422 | s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, |
| 5423 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5424 | |
| 5425 | /*get the value by searching the local copy*/ |
| 5426 | if (s32Error) { |
| 5427 | PRINT_ER("Failed to send config packet to get survey results\n"); |
| 5428 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 5429 | } |
| 5430 | |
| 5431 | WILC_CATCH(s32Error) |
| 5432 | { |
| 5433 | |
| 5434 | } |
| 5435 | |
| 5436 | return s32Error; |
| 5437 | } |
| 5438 | #endif |
| 5439 | |
| 5440 | /** |
| 5441 | * @brief sets a start scan request |
| 5442 | * @details |
| 5443 | * @param[in,out] handle to the wifi driver, |
| 5444 | * @param[in] Scan Source one of the following values |
| 5445 | * DEFAULT_SCAN 0 |
| 5446 | * USER_SCAN BIT0 |
| 5447 | * OBSS_PERIODIC_SCAN BIT1 |
| 5448 | * OBSS_ONETIME_SCAN BIT2 |
| 5449 | * @return Error code indicating success/failure |
| 5450 | * @note |
| 5451 | * @author zsalah |
| 5452 | * @date 8 March 2012 |
| 5453 | * @version 1.0 |
| 5454 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5455 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5456 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5457 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5458 | tstrWID strWID; |
| 5459 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5460 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5461 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5462 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5463 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5464 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5465 | |
| 5466 | return s32Error; |
| 5467 | } |
| 5468 | |
| 5469 | /** |
| 5470 | * @brief host_int_get_start_scan_req |
| 5471 | * @details gets a start scan request |
| 5472 | * @param[in,out] handle to the wifi driver, |
| 5473 | * @param[in] Scan Source one of the following values |
| 5474 | * DEFAULT_SCAN 0 |
| 5475 | * USER_SCAN BIT0 |
| 5476 | * OBSS_PERIODIC_SCAN BIT1 |
| 5477 | * OBSS_ONETIME_SCAN BIT2 |
| 5478 | * @return Error code indicating success/failure |
| 5479 | * @note |
| 5480 | * @author zsalah |
| 5481 | * @date 8 March 2012 |
| 5482 | * @version 1.0 |
| 5483 | */ |
| 5484 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5485 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5486 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5487 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5488 | tstrWID strWID; |
| 5489 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5490 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5491 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5492 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5493 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5494 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5495 | |
| 5496 | return s32Error; |
| 5497 | } |
| 5498 | |
| 5499 | /** |
| 5500 | * @brief host_int_set_join_req |
| 5501 | * @details sets a join request |
| 5502 | * @param[in,out] handle to the wifi driver, |
| 5503 | * @param[in] Index of the bss descriptor |
| 5504 | * @return Error code indicating success/failure |
| 5505 | * @note |
| 5506 | * @author zsalah |
| 5507 | * @date 8 March 2012 |
| 5508 | * @version 1.0 |
| 5509 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5510 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 5511 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5512 | const u8 *pu8IEs, size_t IEsLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5513 | tWILCpfConnectResult pfConnectResult, void *pvUserArg, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5514 | u8 u8security, AUTHTYPE_T tenuAuth_type, |
| 5515 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5516 | void *pJoinParams) |
| 5517 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5518 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5519 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5520 | tstrHostIFmsg strHostIFmsg; |
| 5521 | tenuScanConnTimer enuScanConnTimer; |
| 5522 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5523 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5524 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5525 | |
| 5526 | if (hWFIDrv == NULL) { |
| 5527 | PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n"); |
| 5528 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5529 | } |
| 5530 | |
| 5531 | if (pJoinParams == NULL) { |
| 5532 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
| 5533 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5534 | |
| 5535 | } |
| 5536 | /* |
| 5537 | * if(gWFiDrvHandle->strWILC_UsrScanReq.u32RcvdChCount == 0) |
| 5538 | * { |
| 5539 | * PRINT_ER("No scan results exist: Scanning should be done\n"); |
| 5540 | * WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5541 | * } |
| 5542 | */ |
| 5543 | /* prepare the Connect Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5544 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5545 | |
| 5546 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT; |
| 5547 | |
| 5548 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8security = u8security; |
| 5549 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type; |
| 5550 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8channel = u8channel; |
| 5551 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pfConnectResult = pfConnectResult; |
| 5552 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pvUserArg = pvUserArg; |
| 5553 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pJoinParams = pJoinParams; |
| 5554 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5555 | |
| 5556 | if (pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 5557 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5558 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5559 | pu8bssid, 6); |
| 5560 | } |
| 5561 | |
| 5562 | if (pu8ssid != NULL) { |
| 5563 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 5564 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5565 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5566 | |
| 5567 | pu8ssid, ssidLen); |
| 5568 | } |
| 5569 | |
| 5570 | if (pu8IEs != NULL) { |
| 5571 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 5572 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 5573 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5574 | pu8IEs, IEsLen); |
| 5575 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5576 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5577 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5578 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5579 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 5580 | |
| 5581 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5582 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5583 | if (s32Error) { |
| 5584 | PRINT_ER("Failed to send message queue: Set join request\n"); |
| 5585 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5586 | } |
| 5587 | |
| 5588 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5589 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 5590 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 5591 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5592 | |
| 5593 | WILC_CATCH(s32Error) |
| 5594 | { |
| 5595 | |
| 5596 | } |
| 5597 | |
| 5598 | return s32Error; |
| 5599 | } |
| 5600 | |
| 5601 | /** |
| 5602 | * @brief Flush a join request parameters to FW, but actual connection |
| 5603 | * @details The function is called in situation where WILC is connected to AP and |
| 5604 | * required to switch to hybrid FW for P2P connection |
| 5605 | * @param[in] handle to the wifi driver, |
| 5606 | * @return Error code indicating success/failure |
| 5607 | * @note |
| 5608 | * @author Amr Abdel-Moghny |
| 5609 | * @date 19 DEC 2013 |
| 5610 | * @version 8.0 |
| 5611 | */ |
| 5612 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5613 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5614 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5615 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5616 | tstrHostIFmsg strHostIFmsg; |
| 5617 | |
| 5618 | if (!gu8FlushedJoinReq) { |
| 5619 | s32Error = WILC_FAIL; |
| 5620 | return s32Error; |
| 5621 | } |
| 5622 | |
| 5623 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5624 | if (hWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5625 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5626 | |
| 5627 | |
| 5628 | strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT; |
| 5629 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5630 | |
| 5631 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5632 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5633 | if (s32Error) { |
| 5634 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
| 5635 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5636 | } |
| 5637 | |
| 5638 | WILC_CATCH(s32Error) |
| 5639 | { |
| 5640 | |
| 5641 | } |
| 5642 | return s32Error; |
| 5643 | } |
| 5644 | |
| 5645 | /** |
| 5646 | * @brief host_int_disconnect |
| 5647 | * @details disconnects from the currently associated network |
| 5648 | * @param[in,out] handle to the wifi driver, |
| 5649 | * @param[in] Reason Code of the Disconnection |
| 5650 | * @return Error code indicating success/failure |
| 5651 | * @note |
| 5652 | * @author zsalah |
| 5653 | * @date 8 March 2012 |
| 5654 | * @version 1.0 |
| 5655 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5656 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5657 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5658 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5659 | tstrHostIFmsg strHostIFmsg; |
| 5660 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5661 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5662 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5663 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5664 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5665 | } |
| 5666 | |
| 5667 | if (pstrWFIDrv == NULL) { |
| 5668 | PRINT_ER("gWFiDrvHandle = NULL\n"); |
| 5669 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 5670 | } |
| 5671 | |
| 5672 | /* prepare the Disconnect Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5673 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5674 | |
| 5675 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT; |
| 5676 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5677 | |
| 5678 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5679 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5680 | if (s32Error) |
| 5681 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5682 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5683 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5684 | /* /////// */ |
| 5685 | |
| 5686 | WILC_CATCH(s32Error) |
| 5687 | { |
| 5688 | |
| 5689 | } |
| 5690 | |
| 5691 | return s32Error; |
| 5692 | } |
| 5693 | |
| 5694 | /** |
| 5695 | * @brief host_int_disconnect_station |
| 5696 | * @details disconnects a sta |
| 5697 | * @param[in,out] handle to the wifi driver, |
| 5698 | * @param[in] Association Id of the station to be disconnected |
| 5699 | * @return Error code indicating success/failure |
| 5700 | * @note |
| 5701 | * @author zsalah |
| 5702 | * @date 8 March 2012 |
| 5703 | * @version 1.0 |
| 5704 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5705 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5706 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5707 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5708 | tstrWID strWID; |
| 5709 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5710 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5711 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5712 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5713 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5714 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5715 | |
| 5716 | return s32Error; |
| 5717 | } |
| 5718 | |
| 5719 | /** |
| 5720 | * @brief host_int_get_assoc_req_info |
| 5721 | * @details gets a Association request info |
| 5722 | * @param[in,out] handle to the wifi driver, |
| 5723 | * Message containg assoc. req info in the following format |
| 5724 | * ------------------------------------------------------------------------ |
| 5725 | | Management Frame Format | |
| 5726 | ||-------------------------------------------------------------------| |
| 5727 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5728 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5729 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5730 | ||-------------------------------------------------------------------| |
| 5731 | | | |
| 5732 | | Association Request Frame - Frame Body | |
| 5733 | ||-------------------------------------------------------------------| |
| 5734 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5735 | ||------------------------|-----------------|------|-----------------| |
| 5736 | | 2 | 2 | 2-34 | 3-10 | |
| 5737 | | --------------------------------------------------------------------- |
| 5738 | * @return Error code indicating success/failure |
| 5739 | * @note |
| 5740 | * @author zsalah |
| 5741 | * @date 8 March 2012 |
| 5742 | * @version 1.0 |
| 5743 | */ |
| 5744 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5745 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5746 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5747 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5748 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5749 | tstrWID strWID; |
| 5750 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5751 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5752 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5753 | strWID.enuWIDtype = WID_STR; |
| 5754 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5755 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5756 | |
| 5757 | |
| 5758 | return s32Error; |
| 5759 | } |
| 5760 | |
| 5761 | /** |
| 5762 | * @brief gets a Association Response info |
| 5763 | * @details |
| 5764 | * @param[in,out] handle to the wifi driver, |
| 5765 | * Message containg assoc. resp info |
| 5766 | * @return Error code indicating success/failure |
| 5767 | * @note |
| 5768 | * @author zsalah |
| 5769 | * @date 8 March 2012 |
| 5770 | * @version 1.0 |
| 5771 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5772 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5773 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5774 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5775 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5776 | tstrWID strWID; |
| 5777 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5778 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5779 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5780 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5781 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5782 | } |
| 5783 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5784 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5785 | strWID.enuWIDtype = WID_STR; |
| 5786 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5787 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5788 | |
| 5789 | |
| 5790 | /* Sending Configuration packet */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5791 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5792 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5793 | if (s32Error) { |
| 5794 | PRINT_ER("Failed to send association response config packet\n"); |
| 5795 | *pu32RcvdAssocRespInfoLen = 0; |
| 5796 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 5797 | } else { |
| 5798 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5799 | } |
| 5800 | |
| 5801 | WILC_CATCH(s32Error) |
| 5802 | { |
| 5803 | |
| 5804 | } |
| 5805 | return s32Error; |
| 5806 | } |
| 5807 | |
| 5808 | /** |
| 5809 | * @brief gets a Association Response info |
| 5810 | * @details Valid only in STA mode. This function gives the RSSI |
| 5811 | * values observed in all the channels at the time of scanning. |
| 5812 | * The length of the field is 1 greater that the total number of |
| 5813 | * channels supported. Byte 0 contains the number of channels while |
| 5814 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5815 | * @param[in,out] handle to the wifi driver, |
| 5816 | * array of scanned channels' RSSI |
| 5817 | * @return Error code indicating success/failure |
| 5818 | * @note |
| 5819 | * @author zsalah |
| 5820 | * @date 8 March 2012 |
| 5821 | * @version 1.0 |
| 5822 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5823 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5824 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5825 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5826 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5827 | tstrWID strWID; |
| 5828 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5829 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5830 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5831 | strWID.enuWIDtype = WID_STR; |
| 5832 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5833 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5834 | |
| 5835 | |
| 5836 | return s32Error; |
| 5837 | } |
| 5838 | |
| 5839 | /** |
| 5840 | * @brief sets a channel |
| 5841 | * @details |
| 5842 | * @param[in,out] handle to the wifi driver, |
| 5843 | * @param[in] Index of the channel to be set |
| 5844 | *|-------------------------------------------------------------------| |
| 5845 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5846 | | Input: 1 2 14 | |
| 5847 | ||-------------------------------------------------------------------| |
| 5848 | * @return Error code indicating success/failure |
| 5849 | * @note |
| 5850 | * @author zsalah |
| 5851 | * @date 8 March 2012 |
| 5852 | * @version 1.0 |
| 5853 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5854 | s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5855 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5856 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5857 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5858 | tstrHostIFmsg strHostIFmsg; |
| 5859 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5860 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5861 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5862 | |
| 5863 | /* prepare the set channel message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5864 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5865 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL; |
| 5866 | strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; |
| 5867 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5868 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5869 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5870 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5871 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5872 | WILC_CATCH(s32Error) |
| 5873 | { |
| 5874 | |
| 5875 | } |
| 5876 | |
| 5877 | return s32Error; |
| 5878 | } |
| 5879 | |
| 5880 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5881 | s32 host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5882 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5883 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | |
| 5885 | tstrHostIFmsg strHostIFmsg; |
| 5886 | |
| 5887 | /* prepare the set driver handler message */ |
| 5888 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5889 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5890 | strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5891 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5892 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5893 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5894 | WILC_CATCH(s32Error) |
| 5895 | { |
| 5896 | |
| 5897 | } |
| 5898 | |
| 5899 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5900 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5901 | |
| 5902 | return s32Error; |
| 5903 | |
| 5904 | } |
| 5905 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5906 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5907 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5908 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5909 | |
| 5910 | tstrHostIFmsg strHostIFmsg; |
| 5911 | |
| 5912 | |
| 5913 | /* prepare the set driver handler message */ |
| 5914 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5915 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5916 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5917 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = get_id_from_handler(u32address); |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 5918 | strHostIFmsg.drvHandler = u32address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5919 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5920 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5921 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5922 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5923 | WILC_CATCH(s32Error) |
| 5924 | { |
| 5925 | |
| 5926 | } |
| 5927 | |
| 5928 | return s32Error; |
| 5929 | } |
| 5930 | |
| 5931 | |
| 5932 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5933 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5934 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5935 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5936 | |
| 5937 | tstrHostIFmsg strHostIFmsg; |
| 5938 | |
| 5939 | |
| 5940 | /* prepare the set driver handler message */ |
| 5941 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5942 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5943 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE; |
| 5944 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; |
| 5945 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5946 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5947 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5948 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5949 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5950 | WILC_CATCH(s32Error) |
| 5951 | { |
| 5952 | |
| 5953 | } |
| 5954 | |
| 5955 | return s32Error; |
| 5956 | } |
| 5957 | |
| 5958 | /** |
| 5959 | * @brief gets the current channel index |
| 5960 | * @details |
| 5961 | * @param[in,out] handle to the wifi driver, |
| 5962 | * current channel index |
| 5963 | *|-----------------------------------------------------------------------| |
| 5964 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5965 | | Input: 1 2 14 | |
| 5966 | ||-----------------------------------------------------------------------| |
| 5967 | * @return Error code indicating success/failure |
| 5968 | * @note |
| 5969 | * @author zsalah |
| 5970 | * @date 8 March 2012 |
| 5971 | * @version 1.0 |
| 5972 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5973 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5974 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5975 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5976 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5977 | tstrHostIFmsg strHostIFmsg; |
| 5978 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5979 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5980 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5981 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 5982 | } |
| 5983 | |
| 5984 | /* prepare the Get Channel Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 5985 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5986 | |
| 5987 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL; |
| 5988 | strHostIFmsg.drvHandler = hWFIDrv; |
| 5989 | |
| 5990 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 5991 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5992 | if (s32Error) |
| 5993 | PRINT_ER("Failed to send get host channel param's message queue "); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5994 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5995 | /* gu8Chnl = 11; */ |
| 5996 | |
| 5997 | *pu8ChNo = gu8Chnl; |
| 5998 | |
| 5999 | WILC_CATCH(s32Error) |
| 6000 | { |
| 6001 | } |
| 6002 | |
| 6003 | return s32Error; |
| 6004 | |
| 6005 | |
| 6006 | } |
| 6007 | |
| 6008 | |
| 6009 | /** |
| 6010 | * @brief host_int_test_set_int_wid |
| 6011 | * @details Test function for setting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6012 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6013 | * @return Error code indicating success/failure |
| 6014 | * @note |
| 6015 | * @author zsalah |
| 6016 | * @date 8 March 2012 |
| 6017 | * @version 1.0 |
| 6018 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6019 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6020 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6021 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6022 | tstrWID strWID; |
| 6023 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6024 | |
| 6025 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6026 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6027 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6028 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6029 | } |
| 6030 | |
| 6031 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6032 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6033 | strWID.enuWIDtype = WID_INT; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 6034 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6035 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6036 | |
| 6037 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6038 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 6039 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6040 | if (s32Error) { |
| 6041 | PRINT_ER("Test Function: Failed to set wid value\n"); |
| 6042 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 6043 | } else { |
| 6044 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); |
| 6045 | |
| 6046 | } |
| 6047 | |
| 6048 | WILC_CATCH(s32Error) |
| 6049 | { |
| 6050 | |
| 6051 | } |
| 6052 | return s32Error; |
| 6053 | } |
| 6054 | |
| 6055 | #ifdef WILC_AP_EXTERNAL_MLME |
| 6056 | /** |
| 6057 | * @brief host_int_get_inactive_time |
| 6058 | * @details |
| 6059 | * @param[in,out] handle to the wifi driver, |
| 6060 | * current sta macaddress, inactive_time |
| 6061 | * @return |
| 6062 | * @note |
| 6063 | * @author |
| 6064 | * @date |
| 6065 | * @version 1.0 |
| 6066 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6067 | 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] | 6068 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6069 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6070 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6071 | tstrHostIFmsg strHostIFmsg; |
| 6072 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6073 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6074 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6075 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6076 | } |
| 6077 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6078 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6079 | |
| 6080 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6081 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6082 | mac, ETH_ALEN); |
| 6083 | |
| 6084 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME; |
| 6085 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6086 | |
| 6087 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6088 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6089 | if (s32Error) |
| 6090 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6091 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6092 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6093 | |
| 6094 | *pu32InactiveTime = gu32InactiveTime; |
| 6095 | |
| 6096 | WILC_CATCH(s32Error) |
| 6097 | { |
| 6098 | } |
| 6099 | |
| 6100 | return s32Error; |
| 6101 | } |
| 6102 | #endif |
| 6103 | /** |
| 6104 | * @brief host_int_test_get_int_wid |
| 6105 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6106 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6107 | * @return Error code indicating success/failure |
| 6108 | * @note |
| 6109 | * @author zsalah |
| 6110 | * @date 8 March 2012 |
| 6111 | * @version 1.0 |
| 6112 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6113 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6114 | { |
| 6115 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6116 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6117 | tstrWID strWID; |
| 6118 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6119 | |
| 6120 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6121 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6122 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6123 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6124 | } |
| 6125 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6126 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6127 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6128 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6129 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6130 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6131 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 6132 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6133 | /*get the value by searching the local copy*/ |
| 6134 | if (s32Error) { |
| 6135 | PRINT_ER("Test Function: Failed to get wid value\n"); |
| 6136 | WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); |
| 6137 | } else { |
| 6138 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 6139 | |
| 6140 | } |
| 6141 | |
| 6142 | WILC_CATCH(s32Error) |
| 6143 | { |
| 6144 | |
| 6145 | } |
| 6146 | return s32Error; |
| 6147 | } |
| 6148 | |
| 6149 | |
| 6150 | /** |
| 6151 | * @brief host_int_get_rssi |
| 6152 | * @details gets the currently maintained RSSI value for the station. |
| 6153 | * The received signal strength value in dB. |
| 6154 | * The range of valid values is -128 to 0. |
| 6155 | * @param[in,out] handle to the wifi driver, |
| 6156 | * rssi value in dB |
| 6157 | * @return Error code indicating success/failure |
| 6158 | * @note |
| 6159 | * @author zsalah |
| 6160 | * @date 8 March 2012 |
| 6161 | * @version 1.0 |
| 6162 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6163 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6164 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6165 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6166 | tstrHostIFmsg strHostIFmsg; |
| 6167 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6168 | |
| 6169 | |
| 6170 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6171 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6172 | |
| 6173 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; |
| 6174 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6175 | |
| 6176 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6177 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6178 | if (s32Error) { |
| 6179 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6180 | return WILC_FAIL; |
| 6181 | } |
| 6182 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6183 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6184 | |
| 6185 | |
| 6186 | if (ps8Rssi == NULL) { |
| 6187 | PRINT_ER("RSS pointer value is null"); |
| 6188 | return WILC_FAIL; |
| 6189 | } |
| 6190 | |
| 6191 | |
| 6192 | *ps8Rssi = gs8Rssi; |
| 6193 | |
| 6194 | |
| 6195 | return s32Error; |
| 6196 | } |
| 6197 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6198 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6199 | { |
| 6200 | tstrHostIFmsg strHostIFmsg; |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6201 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6202 | |
| 6203 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6204 | |
| 6205 | |
| 6206 | |
| 6207 | /* prepare the Get LINKSPEED Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6208 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6209 | |
| 6210 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED; |
| 6211 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6212 | |
| 6213 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6214 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6215 | if (s32Error) { |
| 6216 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
| 6217 | return WILC_FAIL; |
| 6218 | } |
| 6219 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6220 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6221 | |
| 6222 | |
| 6223 | if (ps8lnkspd == NULL) { |
| 6224 | PRINT_ER("LINKSPEED pointer value is null"); |
| 6225 | return WILC_FAIL; |
| 6226 | } |
| 6227 | |
| 6228 | |
| 6229 | *ps8lnkspd = gs8lnkspd; |
| 6230 | |
| 6231 | |
| 6232 | return s32Error; |
| 6233 | } |
| 6234 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6235 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6236 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6237 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6238 | tstrHostIFmsg strHostIFmsg; |
| 6239 | |
| 6240 | |
| 6241 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6242 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6243 | |
| 6244 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 6245 | strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6246 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6247 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6248 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6249 | if (s32Error) { |
| 6250 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6251 | return WILC_FAIL; |
| 6252 | } |
| 6253 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6254 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6255 | return s32Error; |
| 6256 | } |
| 6257 | |
| 6258 | |
| 6259 | /** |
| 6260 | * @brief host_int_scan |
| 6261 | * @details scans a set of channels |
| 6262 | * @param[in,out] handle to the wifi driver, |
| 6263 | * @param[in] Scan source |
| 6264 | * Scan Type PASSIVE_SCAN = 0, |
| 6265 | * ACTIVE_SCAN = 1 |
| 6266 | * Channels Array |
| 6267 | * Channels Array length |
| 6268 | * Scan Callback function |
| 6269 | * @return Error code indicating success/failure |
| 6270 | * @note |
| 6271 | * @author zsalah |
| 6272 | * @date 8 March 2012 |
| 6273 | * @version 1.0 |
| 6274 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6275 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6276 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 6277 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6278 | size_t IEsLen, tWILCpfScanResult ScanResult, |
| 6279 | void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork) |
| 6280 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6281 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6282 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6283 | tstrHostIFmsg strHostIFmsg; |
| 6284 | tenuScanConnTimer enuScanConnTimer; |
| 6285 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6286 | if (pstrWFIDrv == NULL || ScanResult == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6287 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6288 | |
| 6289 | |
| 6290 | /* prepare the Scan Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6291 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6292 | |
| 6293 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN; |
| 6294 | |
| 6295 | if (pstrHiddenNetwork != NULL) { |
| 6296 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 6297 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
| 6298 | |
| 6299 | } else |
| 6300 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 6301 | |
| 6302 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6303 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanSource = u8ScanSource; |
| 6304 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanType = u8ScanType; |
| 6305 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pfScanResult = ScanResult; |
| 6306 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; |
| 6307 | |
| 6308 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6309 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6310 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6311 | pu8ChnlFreqList, u8ChnlListLen); |
| 6312 | |
| 6313 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6314 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6315 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6316 | pu8IEs, IEsLen); |
| 6317 | |
| 6318 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6319 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6320 | if (s32Error) { |
| 6321 | PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error); |
| 6322 | WILC_ERRORREPORT(s32Error, WILC_FAIL); |
| 6323 | } |
| 6324 | |
| 6325 | enuScanConnTimer = SCAN_TIMER; |
| 6326 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6327 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 6328 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 6329 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6330 | |
| 6331 | WILC_CATCH(s32Error) |
| 6332 | { |
| 6333 | |
| 6334 | } |
| 6335 | return s32Error; |
| 6336 | |
| 6337 | } |
| 6338 | /** |
| 6339 | * @brief hif_set_cfg |
| 6340 | * @details sets configuration wids values |
| 6341 | * @param[in,out] handle to the wifi driver, |
| 6342 | * @param[in] WID, WID value |
| 6343 | * @return Error code indicating success/failure |
| 6344 | * @note |
| 6345 | * @author zsalah |
| 6346 | * @date 8 March 2012 |
| 6347 | * @version 1.0 |
| 6348 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6349 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6350 | { |
| 6351 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6352 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6353 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6354 | |
| 6355 | tstrHostIFmsg strHostIFmsg; |
| 6356 | |
| 6357 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6358 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6359 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6360 | /* prepare the WiphyParams Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6361 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6362 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; |
| 6363 | strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; |
| 6364 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6365 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6366 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6367 | |
| 6368 | WILC_CATCH(s32Error) |
| 6369 | { |
| 6370 | } |
| 6371 | |
| 6372 | return s32Error; |
| 6373 | |
| 6374 | } |
| 6375 | |
| 6376 | |
| 6377 | /** |
| 6378 | * @brief hif_get_cfg |
| 6379 | * @details gets configuration wids values |
| 6380 | * @param[in,out] handle to the wifi driver, |
| 6381 | * WID value |
| 6382 | * @param[in] WID, |
| 6383 | * @return Error code indicating success/failure |
| 6384 | * @note |
| 6385 | * @author zsalah |
| 6386 | * |
| 6387 | * @date 8 March 2012 |
| 6388 | * @version 1.0 |
| 6389 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6390 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6391 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6392 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6393 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6394 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6395 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6396 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6397 | if (pstrWFIDrv == NULL) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6398 | PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6399 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
| 6400 | } |
| 6401 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 6402 | switch (u16WID) { |
| 6403 | |
| 6404 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6405 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6406 | break; |
| 6407 | |
| 6408 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6409 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6410 | break; |
| 6411 | |
| 6412 | case WID_AUTH_TIMEOUT: |
| 6413 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 6414 | break; |
| 6415 | |
| 6416 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6417 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6418 | break; |
| 6419 | |
| 6420 | case WID_SHORT_RETRY_LIMIT: |
| 6421 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 6422 | break; |
| 6423 | |
| 6424 | case WID_LONG_RETRY_LIMIT: |
| 6425 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 6426 | break; |
| 6427 | |
| 6428 | case WID_FRAG_THRESHOLD: |
| 6429 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 6430 | break; |
| 6431 | |
| 6432 | case WID_RTS_THRESHOLD: |
| 6433 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 6434 | break; |
| 6435 | |
| 6436 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6437 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6438 | break; |
| 6439 | |
| 6440 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6441 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6442 | break; |
| 6443 | |
| 6444 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6445 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6446 | break; |
| 6447 | |
| 6448 | case WID_BEACON_INTERVAL: |
| 6449 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 6450 | break; |
| 6451 | |
| 6452 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6453 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6454 | break; |
| 6455 | |
| 6456 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6457 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6458 | break; |
| 6459 | |
| 6460 | case WID_SITE_SURVEY_SCAN_TIME: |
| 6461 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 6462 | break; |
| 6463 | |
| 6464 | case WID_ACTIVE_SCAN_TIME: |
| 6465 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 6466 | break; |
| 6467 | |
| 6468 | case WID_PASSIVE_SCAN_TIME: |
| 6469 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 6470 | break; |
| 6471 | |
| 6472 | case WID_CURRENT_TX_RATE: |
| 6473 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 6474 | break; |
| 6475 | |
| 6476 | default: |
| 6477 | break; |
| 6478 | } |
| 6479 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6480 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6481 | |
| 6482 | WILC_CATCH(s32Error) |
| 6483 | { |
| 6484 | } |
| 6485 | return s32Error; |
| 6486 | |
| 6487 | } |
| 6488 | |
| 6489 | /*****************************************************************************/ |
| 6490 | /* Notification Functions */ |
| 6491 | /*****************************************************************************/ |
| 6492 | /** |
| 6493 | * @brief notifies host with join and leave requests |
| 6494 | * @details This function prepares an Information frame having the |
| 6495 | * information about a joining/leaving station. |
| 6496 | * @param[in,out] handle to the wifi driver, |
| 6497 | * @param[in] 6 byte Sta Adress |
| 6498 | * Join or leave flag: |
| 6499 | * Join = 1, |
| 6500 | * Leave =0 |
| 6501 | * @return Error code indicating success/failure |
| 6502 | * @note |
| 6503 | * @author zsalah |
| 6504 | * @date 8 March 2012 |
| 6505 | * @version 1.0 |
| 6506 | */ |
| 6507 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6508 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6509 | { |
| 6510 | } |
| 6511 | /** |
| 6512 | * @brief notifies host with stations found in scan |
| 6513 | * @details sends the beacon/probe response from scan |
| 6514 | * @param[in,out] handle to the wifi driver, |
| 6515 | * @param[in] Sta Address, |
| 6516 | * Frame length, |
| 6517 | * Rssi of the Station found |
| 6518 | * @return Error code indicating success/failure |
| 6519 | * @note |
| 6520 | * @author zsalah |
| 6521 | * @date 8 March 2012 |
| 6522 | * @version 1.0 |
| 6523 | */ |
| 6524 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6525 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6526 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6527 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6528 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6529 | if (pstrWFIDrv == NULL) { |
| 6530 | PRINT_ER("Driver handler is NULL\n"); |
| 6531 | return; |
| 6532 | } |
| 6533 | |
| 6534 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6535 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6536 | tstrHostIFmsg strHostIFmsg; |
| 6537 | |
| 6538 | /* prepare the Get RSSI Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6539 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6540 | |
| 6541 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; |
| 6542 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6543 | |
| 6544 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6545 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6546 | if (s32Error) { |
| 6547 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6548 | return; |
| 6549 | } |
| 6550 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6551 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 6552 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6553 | } |
| 6554 | |
| 6555 | |
| 6556 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6557 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6558 | { |
| 6559 | } |
| 6560 | /** |
| 6561 | * @brief host_int_init |
| 6562 | * @details host interface initialization function |
| 6563 | * @param[in,out] handle to the wifi driver, |
| 6564 | * @note |
| 6565 | * @author zsalah |
| 6566 | * @date 8 March 2012 |
| 6567 | * @version 1.0 |
| 6568 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6569 | static u32 u32Intialized; |
| 6570 | static u32 msgQ_created; |
| 6571 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6572 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6573 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6574 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6575 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6576 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6577 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6578 | |
| 6579 | /*if(u32Intialized == 1) |
| 6580 | * { |
| 6581 | * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n"); |
| 6582 | * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P |
| 6583 | * return 0; |
| 6584 | * } */ |
| 6585 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 6586 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6587 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6588 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6589 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6590 | |
| 6591 | |
| 6592 | |
| 6593 | /*Allocate host interface private structure*/ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6594 | pstrWFIDrv = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6595 | if (pstrWFIDrv == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6596 | /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */ |
| 6597 | s32Error = WILC_NO_MEM; |
| 6598 | PRINT_ER("Failed to allocate memory\n"); |
| 6599 | goto _fail_timer_2; |
| 6600 | } |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6601 | memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6602 | /*return driver handle to user*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6603 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6604 | /*save into globl handle*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6605 | err = add_handler_in_list(pstrWFIDrv); |
| 6606 | if (err) { |
| 6607 | s32Error = WILC_FAIL; |
| 6608 | goto _fail_timer_2; |
| 6609 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6610 | |
| 6611 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 6612 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6613 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6614 | #endif |
| 6615 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6616 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6617 | /* /////////////////////////////////////// */ |
| 6618 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6619 | sema_init(&hSemHostIFthrdEnd, 0); |
| 6620 | sema_init(&hSemDeinitDrvHandle, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6621 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6622 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6623 | } |
| 6624 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6625 | sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0); |
| 6626 | sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0); |
| 6627 | sema_init(&(pstrWFIDrv->hSemGetRSSI), 0); |
| 6628 | sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0); |
| 6629 | sema_init(&(pstrWFIDrv->hSemGetCHNL), 0); |
| 6630 | sema_init(&(pstrWFIDrv->hSemInactiveTime), 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6631 | |
| 6632 | /* /////////////////////////////////////// */ |
| 6633 | |
| 6634 | |
| 6635 | |
| 6636 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 6637 | |
| 6638 | if (clients_count == 0) { |
Chaehyun Lim | cd08fc7 | 2015-08-19 15:59:05 +0900 | [diff] [blame] | 6639 | s32Error = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6640 | |
| 6641 | if (s32Error < 0) { |
| 6642 | PRINT_ER("Failed to creat MQ\n"); |
| 6643 | goto _fail_; |
| 6644 | } |
| 6645 | msgQ_created = 1; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6646 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 6647 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6648 | PRINT_ER("Failed to creat Thread\n"); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6649 | s32Error = WILC_FAIL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6650 | goto _fail_mq_; |
| 6651 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 6652 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 6653 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6654 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6655 | } |
| 6656 | |
| 6657 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6658 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6659 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6660 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6661 | |
| 6662 | #ifdef WILC_P2P |
| 6663 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6664 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6665 | #endif |
| 6666 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6667 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
| 6668 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6669 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6670 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6671 | /* gWFiDrvHandle->bPendingConnRequest = false; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6672 | |
| 6673 | /*Initialize CFG WIDS Defualt Values*/ |
| 6674 | |
| 6675 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 6676 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 6677 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 6678 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 6679 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 6680 | |
| 6681 | |
| 6682 | #ifdef WILC_P2P |
| 6683 | |
| 6684 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 6685 | |
| 6686 | #endif |
| 6687 | |
| 6688 | 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", |
| 6689 | |
| 6690 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 6691 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 6692 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 6693 | |
| 6694 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6695 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6696 | |
| 6697 | /*TODO Code to setup simulation to be removed later*/ |
| 6698 | /*Intialize configurator module*/ |
| 6699 | s32Error = CoreConfiguratorInit(); |
| 6700 | if (s32Error < 0) { |
| 6701 | PRINT_ER("Failed to initialize core configurator\n"); |
| 6702 | goto _fail_mem_; |
| 6703 | } |
| 6704 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6705 | u32Intialized = 1; |
| 6706 | clients_count++; /* increase number of created entities */ |
| 6707 | |
| 6708 | return s32Error; |
| 6709 | |
| 6710 | |
| 6711 | _fail_mem_: |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6712 | if (pstrWFIDrv != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6713 | kfree(pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6714 | #ifdef WILC_P2P |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6715 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6716 | #endif |
| 6717 | _fail_timer_2: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6718 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6719 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6720 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6721 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6722 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6723 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6724 | _fail_: |
| 6725 | return s32Error; |
| 6726 | |
| 6727 | |
| 6728 | } |
| 6729 | /** |
| 6730 | * @brief host_int_deinit |
| 6731 | * @details host interface initialization function |
| 6732 | * @param[in,out] handle to the wifi driver, |
| 6733 | * @note |
| 6734 | * @author zsalah |
| 6735 | * @date 8 March 2012 |
| 6736 | * @version 1.0 |
| 6737 | */ |
| 6738 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6739 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6740 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6741 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6742 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6743 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6744 | |
| 6745 | /*obtain driver handle*/ |
| 6746 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6747 | /*if(u32Intialized == 0) |
| 6748 | * { |
| 6749 | * PRINT_ER("Host Interface is not initialized\n"); |
| 6750 | * return 0; |
| 6751 | * }*/ |
| 6752 | |
| 6753 | /*BugID_5348*/ |
| 6754 | |
| 6755 | if (pstrWFIDrv == NULL) { |
| 6756 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 6757 | return 0; |
| 6758 | } |
| 6759 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6760 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6761 | |
| 6762 | terminated_handle = pstrWFIDrv; |
| 6763 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 6764 | |
| 6765 | /*BugID_5348*/ |
| 6766 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 6767 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6768 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6769 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6770 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 6771 | } |
| 6772 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6773 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6774 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6775 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6776 | } |
| 6777 | |
| 6778 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6779 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6780 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6781 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6782 | } |
| 6783 | |
| 6784 | #ifdef WILC_P2P |
| 6785 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6786 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6787 | #endif |
| 6788 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6789 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6790 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6791 | |
| 6792 | |
| 6793 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6794 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6795 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6796 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6797 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6798 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6799 | } |
| 6800 | /*deinit configurator and simulator*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6801 | CoreConfiguratorDeInit(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6802 | |
| 6803 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6804 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6805 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6806 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6807 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6808 | |
| 6809 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6810 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6811 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6812 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6813 | } |
| 6814 | strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT; |
| 6815 | strHostIFmsg.drvHandler = hWFIDrv; |
| 6816 | |
| 6817 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6818 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6819 | if (s32Error != WILC_SUCCESS) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6820 | 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] | 6821 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6822 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6823 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6824 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6825 | msgQ_created = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6826 | } |
| 6827 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6828 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6829 | |
| 6830 | /*Setting the gloabl driver handler with NULL*/ |
| 6831 | u32Intialized = 0; |
| 6832 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6833 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6834 | if (ret) |
| 6835 | s32Error = WILC_NOT_FOUND; |
| 6836 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6837 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6838 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6839 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6840 | |
| 6841 | } |
| 6842 | |
| 6843 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6844 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6845 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6846 | return s32Error; |
| 6847 | } |
| 6848 | |
| 6849 | |
| 6850 | /** |
| 6851 | * @brief NetworkInfoReceived |
| 6852 | * @details function to to be called when network info packet is received |
| 6853 | * @param[in] pu8Buffer the received packet |
| 6854 | * @param[in] u32Length length of the received packet |
| 6855 | * @return none |
| 6856 | * @note |
| 6857 | * @author |
| 6858 | * @date 1 Mar 2012 |
| 6859 | * @version 1.0 |
| 6860 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6861 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6862 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6863 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6864 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6865 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6866 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6867 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6868 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6869 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6870 | |
| 6871 | |
| 6872 | |
| 6873 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6874 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6875 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6876 | return; |
| 6877 | } |
| 6878 | |
| 6879 | /* prepare the Asynchronous Network Info message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6880 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6881 | |
| 6882 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO; |
| 6883 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6884 | |
| 6885 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6886 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6887 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6888 | pu8Buffer, u32Length); |
| 6889 | |
| 6890 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6891 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6892 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6893 | 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] | 6894 | } |
| 6895 | |
| 6896 | /** |
| 6897 | * @brief GnrlAsyncInfoReceived |
| 6898 | * @details function to be called when general Asynchronous info packet is received |
| 6899 | * @param[in] pu8Buffer the received packet |
| 6900 | * @param[in] u32Length length of the received packet |
| 6901 | * @return none |
| 6902 | * @note |
| 6903 | * @author |
| 6904 | * @date 15 Mar 2012 |
| 6905 | * @version 1.0 |
| 6906 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6907 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6908 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6909 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6910 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6911 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6912 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6913 | |
| 6914 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6915 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6916 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6917 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6918 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6919 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6920 | |
| 6921 | |
| 6922 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6923 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
| 6924 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6925 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6926 | return; |
| 6927 | } |
| 6928 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6929 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6930 | /* received mac status is not needed when there is no current Connect Request */ |
| 6931 | PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); |
| 6932 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6933 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6934 | return; |
| 6935 | } |
| 6936 | |
| 6937 | /* prepare the General Asynchronous Info message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6938 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6939 | |
| 6940 | |
| 6941 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
| 6942 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6943 | |
| 6944 | |
| 6945 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6946 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6947 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6948 | pu8Buffer, u32Length); |
| 6949 | |
| 6950 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 6951 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6952 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6953 | 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] | 6954 | |
| 6955 | /*BugID_5348*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6956 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6957 | } |
| 6958 | |
| 6959 | /** |
| 6960 | * @brief host_int_ScanCompleteReceived |
| 6961 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6962 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6963 | * @return Error code. |
| 6964 | * @author |
| 6965 | * @date |
| 6966 | * @version 1.0 |
| 6967 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6968 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6969 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 6970 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6971 | tstrHostIFmsg strHostIFmsg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6972 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6973 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6974 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6975 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6976 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6977 | |
| 6978 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6979 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6980 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6981 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6982 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6983 | |
| 6984 | /*if there is an ongoing scan request*/ |
| 6985 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6986 | /* prepare theScan Done message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6987 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6988 | |
| 6989 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
| 6990 | strHostIFmsg.drvHandler = pstrWFIDrv; |
| 6991 | |
| 6992 | |
| 6993 | /* will be deallocated by the receiving thread */ |
| 6994 | /*no need to send message body*/ |
| 6995 | |
| 6996 | /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6997 | * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6998 | * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6999 | * pu8Buffer, u32Length); */ |
| 7000 | |
| 7001 | /* send the message */ |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7002 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7003 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7004 | 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] | 7005 | } |
| 7006 | |
| 7007 | |
| 7008 | return; |
| 7009 | |
| 7010 | } |
| 7011 | |
| 7012 | #ifdef WILC_P2P |
| 7013 | /** |
| 7014 | * @brief host_int_remain_on_channel |
| 7015 | * @details |
| 7016 | * @param[in] Handle to wifi driver |
| 7017 | * Duration to remain on channel |
| 7018 | * Channel to remain on |
| 7019 | * Pointer to fn to be called on receive frames in listen state |
| 7020 | * Pointer to remain-on-channel expired fn |
| 7021 | * Priv |
| 7022 | * @return Error code. |
| 7023 | * @author |
| 7024 | * @date |
| 7025 | * @version 1.0 |
| 7026 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7027 | 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] | 7028 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7029 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7030 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7031 | tstrHostIFmsg strHostIFmsg; |
| 7032 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7033 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7034 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7035 | |
| 7036 | /* prepare the remainonchan Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7037 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7038 | |
| 7039 | /* prepare the WiphyParams Message */ |
| 7040 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN; |
| 7041 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u16Channel = chan; |
| 7042 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired; |
| 7043 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady; |
| 7044 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pVoid = pvUserArg; |
| 7045 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32duration = u32duration; |
| 7046 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
| 7047 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7048 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7049 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7050 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7051 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7052 | WILC_CATCH(s32Error) |
| 7053 | { |
| 7054 | |
| 7055 | } |
| 7056 | |
| 7057 | return s32Error; |
| 7058 | } |
| 7059 | |
| 7060 | /** |
| 7061 | * @brief host_int_ListenStateExpired |
| 7062 | * @details |
| 7063 | * @param[in] Handle to wifi driver |
| 7064 | * Duration to remain on channel |
| 7065 | * Channel to remain on |
| 7066 | * Pointer to fn to be called on receive frames in listen state |
| 7067 | * Pointer to remain-on-channel expired fn |
| 7068 | * Priv |
| 7069 | * @return Error code. |
| 7070 | * @author |
| 7071 | * @date |
| 7072 | * @version 1.0 |
| 7073 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7074 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7075 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7076 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7077 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7078 | tstrHostIFmsg strHostIFmsg; |
| 7079 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7080 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7081 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7082 | |
| 7083 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 7084 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7085 | |
| 7086 | /* prepare the timer fire Message */ |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7087 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7088 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
| 7089 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7090 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
| 7091 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7092 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7093 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7094 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7095 | WILC_CATCH(s32Error) |
| 7096 | { |
| 7097 | |
| 7098 | } |
| 7099 | return s32Error; |
| 7100 | } |
| 7101 | |
| 7102 | /** |
| 7103 | * @brief host_int_frame_register |
| 7104 | * @details |
| 7105 | * @param[in] Handle to wifi driver |
| 7106 | * @return Error code. |
| 7107 | * @author |
| 7108 | * @date |
| 7109 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7110 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7111 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7112 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7113 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7114 | tstrHostIFmsg strHostIFmsg; |
| 7115 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7116 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7117 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7118 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7119 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7120 | |
| 7121 | /* prepare the WiphyParams Message */ |
| 7122 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME; |
| 7123 | switch (u16FrameType) { |
| 7124 | case ACTION: |
| 7125 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
| 7126 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX; |
| 7127 | break; |
| 7128 | |
| 7129 | case PROBE_REQ: |
| 7130 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
| 7131 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX; |
| 7132 | break; |
| 7133 | |
| 7134 | default: |
| 7135 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 7136 | break; |
| 7137 | } |
| 7138 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u16FrameType = u16FrameType; |
| 7139 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg; |
| 7140 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7141 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7142 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7143 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7144 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7145 | WILC_CATCH(s32Error) |
| 7146 | { |
| 7147 | |
| 7148 | } |
| 7149 | |
| 7150 | return s32Error; |
| 7151 | |
| 7152 | |
| 7153 | } |
| 7154 | #endif |
| 7155 | |
| 7156 | #ifdef WILC_AP_EXTERNAL_MLME |
| 7157 | /** |
| 7158 | * @brief host_int_add_beacon |
| 7159 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7160 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 7161 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 7162 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7163 | * @return Error code. |
| 7164 | * @author |
| 7165 | * @date |
| 7166 | * @version 1.0 |
| 7167 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7168 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7169 | u32 u32DTIMPeriod, |
| 7170 | u32 u32HeadLen, u8 *pu8Head, |
| 7171 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7172 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7173 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7174 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7175 | tstrHostIFmsg strHostIFmsg; |
| 7176 | tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon; |
| 7177 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7178 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7179 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7180 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7181 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7182 | |
| 7183 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 7184 | |
| 7185 | |
| 7186 | /* prepare the WiphyParams Message */ |
| 7187 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BEACON; |
| 7188 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7189 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 7190 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 7191 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7192 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7193 | if (pstrSetBeaconParam->pu8Head == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7194 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7195 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7196 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 7197 | |
| 7198 | /* Bug 4599 : if tail length = 0 skip allocating & copying */ |
| 7199 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7200 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7201 | if (pstrSetBeaconParam->pu8Tail == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7202 | WILC_ERRORREPORT(s32Error, WILC_NO_MEM); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7203 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7204 | } else { |
| 7205 | pstrSetBeaconParam->pu8Tail = NULL; |
| 7206 | } |
| 7207 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7208 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7209 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7210 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7211 | |
| 7212 | WILC_CATCH(s32Error) |
| 7213 | { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7214 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7215 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7216 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7217 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7218 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7219 | } |
| 7220 | |
| 7221 | return s32Error; |
| 7222 | |
| 7223 | } |
| 7224 | |
| 7225 | |
| 7226 | /** |
| 7227 | * @brief host_int_del_beacon |
| 7228 | * @details Setting add beacon params in message queue |
| 7229 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 7230 | * @return Error code. |
| 7231 | * @author |
| 7232 | * @date |
| 7233 | * @version 1.0 |
| 7234 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7235 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7236 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7237 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7238 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7239 | tstrHostIFmsg strHostIFmsg; |
| 7240 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7241 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7242 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7243 | |
| 7244 | /* prepare the WiphyParams Message */ |
| 7245 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON; |
| 7246 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7247 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 7248 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7249 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame^] | 7250 | if (s32Error) |
| 7251 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7252 | |
| 7253 | WILC_CATCH(s32Error) |
| 7254 | { |
| 7255 | } |
| 7256 | return s32Error; |
| 7257 | } |
| 7258 | |
| 7259 | |
| 7260 | /** |
| 7261 | * @brief host_int_add_station |
| 7262 | * @details Setting add station params in message queue |
| 7263 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams |
| 7264 | * @return Error code. |
| 7265 | * @author |
| 7266 | * @date |
| 7267 | * @version 1.0 |
| 7268 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7269 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7270 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7271 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7272 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7273 | tstrHostIFmsg strHostIFmsg; |
| 7274 | tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; |
| 7275 | |
| 7276 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7277 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7278 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7279 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7280 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7281 | |
| 7282 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 7283 | |
| 7284 | |
| 7285 | /* prepare the WiphyParams Message */ |
| 7286 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION; |
| 7287 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7288 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7289 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7290 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7291 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7292 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7293 | if (!rates) |
| 7294 | return -ENOMEM; |
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) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7447 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7448 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7449 | if (!rates) |
| 7450 | return -ENOMEM; |
| 7451 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7452 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7453 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7454 | } |
| 7455 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7456 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7457 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7458 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7459 | WILC_CATCH(s32Error) |
| 7460 | { |
| 7461 | } |
| 7462 | return s32Error; |
| 7463 | } |
| 7464 | #endif /*WILC_AP_EXTERNAL_MLME*/ |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 7465 | u32 wilc_get_chipid(u8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7466 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7467 | 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] | 7468 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7469 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7470 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7471 | tstrHostIFmsg strHostIFmsg; |
| 7472 | tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam; |
| 7473 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7474 | 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] | 7475 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7476 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7477 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7478 | |
| 7479 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 7480 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7481 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7482 | |
| 7483 | |
| 7484 | /* prepare the WiphyParams Message */ |
| 7485 | strHostIFmsg.u16MsgId = HOST_IF_MSG_POWER_MGMT; |
| 7486 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7487 | |
| 7488 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 7489 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 7490 | |
| 7491 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7492 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7493 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7494 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7495 | WILC_CATCH(s32Error) |
| 7496 | { |
| 7497 | } |
| 7498 | return s32Error; |
| 7499 | } |
| 7500 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7501 | 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] | 7502 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7503 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7504 | |
| 7505 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7506 | tstrHostIFmsg strHostIFmsg; |
| 7507 | tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti; |
| 7508 | |
| 7509 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7510 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7511 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7512 | |
| 7513 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 7514 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7515 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7516 | |
| 7517 | |
| 7518 | /* prepare the WiphyParams Message */ |
| 7519 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MULTICAST_FILTER; |
| 7520 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7521 | |
| 7522 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 7523 | pstrMulticastFilterParam->u32count = u32count; |
| 7524 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7525 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7526 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7527 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7528 | WILC_CATCH(s32Error) |
| 7529 | { |
| 7530 | } |
| 7531 | return s32Error; |
| 7532 | } |
| 7533 | |
| 7534 | |
| 7535 | |
| 7536 | /*Bug4218: Parsing Join Param*/ |
| 7537 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 7538 | |
| 7539 | /*Bug4218: Parsing Join Param*/ |
| 7540 | /** |
| 7541 | * @brief host_int_ParseJoinBssParam |
| 7542 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 7543 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7544 | * @return |
| 7545 | * @author zsalah |
| 7546 | * @date |
| 7547 | * @version 1.0**/ |
| 7548 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 7549 | { |
| 7550 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7551 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7552 | u16 u16IEsLen; |
| 7553 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7554 | u8 suppRatesNo = 0; |
| 7555 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7556 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7557 | u8 pcipherCount; |
| 7558 | u8 authCount; |
| 7559 | u8 pcipherTotalCount = 0; |
| 7560 | u8 authTotalCount = 0; |
| 7561 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7562 | |
| 7563 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 7564 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 7565 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7566 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7567 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7568 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7569 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 7570 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 7571 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7572 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7573 | /*for(i=0; i<6;i++) |
| 7574 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7575 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7576 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7577 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 7578 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7579 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 7580 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 7581 | |
| 7582 | /* parse supported rates: */ |
| 7583 | while (index < u16IEsLen) { |
| 7584 | /* supportedRates IE */ |
| 7585 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 7586 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 7587 | suppRatesNo = pu8IEs[index + 1]; |
| 7588 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 7589 | index += 2; /* skipping ID and length bytes; */ |
| 7590 | |
| 7591 | for (i = 0; i < suppRatesNo; i++) { |
| 7592 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 7593 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 7594 | } |
| 7595 | index += suppRatesNo; |
| 7596 | continue; |
| 7597 | } |
| 7598 | /* Ext SupportedRates IE */ |
| 7599 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 7600 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 7601 | /* checking if no of ext. supp and supp rates < max limit */ |
| 7602 | extSuppRatesNo = pu8IEs[index + 1]; |
| 7603 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 7604 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 7605 | else |
| 7606 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 7607 | index += 2; |
| 7608 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 7609 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 7610 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 7611 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 7612 | } |
| 7613 | index += extSuppRatesNo; |
| 7614 | continue; |
| 7615 | } |
| 7616 | /* HT Cap. IE */ |
| 7617 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 7618 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7619 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7620 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7621 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 7622 | continue; |
| 7623 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 7624 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 7625 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 7626 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 7627 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 7628 | (pu8IEs[index + 7] == 0x01)) { |
| 7629 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7630 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7631 | |
| 7632 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7633 | if (pu8IEs[index + 8] & (1 << 7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7634 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7635 | index += pu8IEs[index + 1] + 2; |
| 7636 | continue; |
| 7637 | } |
| 7638 | #ifdef WILC_P2P |
| 7639 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 7640 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 7641 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 7642 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7643 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7644 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7645 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 7646 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 7647 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 7648 | |
| 7649 | /* Check if Bit 7 is set indicating Opss capability */ |
| 7650 | if (pu8IEs[index + 10] & (1 << 7)) { |
| 7651 | pNewJoinBssParam->u8OppEnable = 1; |
| 7652 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 7653 | } else |
| 7654 | pNewJoinBssParam->u8OppEnable = 0; |
| 7655 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7656 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7657 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7658 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7659 | |
| 7660 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 7661 | u16P2P_count = index + 12; |
| 7662 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7663 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7664 | u16P2P_count += 4; |
| 7665 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7666 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7667 | u16P2P_count += 4; |
| 7668 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7669 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7670 | |
| 7671 | index += pu8IEs[index + 1] + 2; |
| 7672 | continue; |
| 7673 | |
| 7674 | } |
| 7675 | #endif |
| 7676 | else if ((pu8IEs[index] == RSN_IE) || |
| 7677 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 7678 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 7679 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7680 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7681 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 7682 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 7683 | * { |
| 7684 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 7685 | * }*/ |
| 7686 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 7687 | pNewJoinBssParam->mode_802_11i = 2; |
| 7688 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 7689 | } else { /* check if rsn was previously parsed */ |
| 7690 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 7691 | pNewJoinBssParam->mode_802_11i = 1; |
| 7692 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 7693 | rsnIndex += 4; |
| 7694 | } |
| 7695 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 7696 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 7697 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7698 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7699 | /* initialize policies with invalid values */ |
| 7700 | |
| 7701 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 7702 | |
| 7703 | /*parsing pairwise cipher*/ |
| 7704 | |
| 7705 | /* saving 3 pcipher max. */ |
| 7706 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7707 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7708 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7709 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7710 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 7711 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7712 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7713 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 7714 | } |
| 7715 | pcipherTotalCount += pcipherCount; |
| 7716 | rsnIndex += jumpOffset; |
| 7717 | |
| 7718 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 7719 | |
| 7720 | /*parsing AKM suite (auth_policy)*/ |
| 7721 | /* saving 3 auth policies max. */ |
| 7722 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7723 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7724 | |
| 7725 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 7726 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7727 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7728 | } |
| 7729 | authTotalCount += authCount; |
| 7730 | rsnIndex += jumpOffset; |
| 7731 | /*pasring rsn cap. only if rsn IE*/ |
| 7732 | if (pu8IEs[index] == RSN_IE) { |
| 7733 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 7734 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 7735 | rsnIndex += 2; |
| 7736 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 7737 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7738 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7739 | continue; |
| 7740 | } else |
| 7741 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7742 | |
| 7743 | } |
| 7744 | |
| 7745 | |
| 7746 | } |
| 7747 | |
| 7748 | return (void *)pNewJoinBssParam; |
| 7749 | |
| 7750 | } |
| 7751 | |
| 7752 | void host_int_freeJoinParams(void *pJoinParams) |
| 7753 | { |
| 7754 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7755 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7756 | else |
| 7757 | PRINT_ER("Unable to FREE null pointer\n"); |
| 7758 | } |
| 7759 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 7760 | |
| 7761 | |
| 7762 | /** |
| 7763 | * @brief host_int_addBASession |
| 7764 | * @details Open a block Ack session with the given parameters |
| 7765 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7766 | * @return |
| 7767 | * @author anoureldin |
| 7768 | * @date |
| 7769 | * @version 1.0**/ |
| 7770 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 7771 | 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] | 7772 | short int SessionTimeout, void *drvHandler) |
| 7773 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7774 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7775 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7776 | tstrHostIFmsg strHostIFmsg; |
| 7777 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7778 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7779 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7780 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7781 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7782 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7783 | |
| 7784 | /* prepare the WiphyParams Message */ |
| 7785 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION; |
| 7786 | |
| 7787 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7788 | pBASessionInfo->u8Ted = TID; |
| 7789 | pBASessionInfo->u16BufferSize = BufferSize; |
| 7790 | pBASessionInfo->u16SessionTimeout = SessionTimeout; |
| 7791 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7792 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7793 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7794 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7795 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7796 | WILC_CATCH(s32Error) |
| 7797 | { |
| 7798 | |
| 7799 | } |
| 7800 | |
| 7801 | return s32Error; |
| 7802 | } |
| 7803 | |
| 7804 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7805 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7806 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7807 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7808 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7809 | tstrHostIFmsg strHostIFmsg; |
| 7810 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7811 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7812 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7813 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7814 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7815 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7816 | |
| 7817 | /* prepare the WiphyParams Message */ |
| 7818 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION; |
| 7819 | |
| 7820 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7821 | pBASessionInfo->u8Ted = TID; |
| 7822 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7823 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7824 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7825 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7826 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7827 | WILC_CATCH(s32Error) |
| 7828 | { |
| 7829 | |
| 7830 | } |
| 7831 | |
| 7832 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7833 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7834 | |
| 7835 | return s32Error; |
| 7836 | } |
| 7837 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7838 | 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] | 7839 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7840 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7841 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7842 | tstrHostIFmsg strHostIFmsg; |
| 7843 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; |
| 7844 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7845 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7846 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7847 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7848 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7849 | |
| 7850 | /* prepare the WiphyParams Message */ |
| 7851 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
| 7852 | |
| 7853 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7854 | pBASessionInfo->u8Ted = TID; |
| 7855 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7856 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7857 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7858 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7859 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7860 | WILC_CATCH(s32Error) |
| 7861 | { |
| 7862 | |
| 7863 | } |
| 7864 | |
| 7865 | /*BugID_5222*/ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7866 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7867 | |
| 7868 | return s32Error; |
| 7869 | } |
| 7870 | |
| 7871 | /** |
| 7872 | * @brief host_int_setup_ipaddress |
| 7873 | * @details setup IP in firmware |
| 7874 | * @param[in] Handle to wifi driver |
| 7875 | * @return Error code. |
| 7876 | * @author Abdelrahman Sobhy |
| 7877 | * @date |
| 7878 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7879 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7880 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7881 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7882 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7883 | tstrHostIFmsg strHostIFmsg; |
| 7884 | |
| 7885 | /* TODO: Enable This feature on softap firmware */ |
| 7886 | return 0; |
| 7887 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7888 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7889 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7890 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7891 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7892 | |
| 7893 | /* prepare the WiphyParams Message */ |
| 7894 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS; |
| 7895 | |
| 7896 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; |
| 7897 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7898 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; |
| 7899 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7900 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7901 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7902 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7903 | WILC_CATCH(s32Error) |
| 7904 | { |
| 7905 | |
| 7906 | } |
| 7907 | |
| 7908 | return s32Error; |
| 7909 | |
| 7910 | |
| 7911 | } |
| 7912 | |
| 7913 | /** |
| 7914 | * @brief host_int_get_ipaddress |
| 7915 | * @details Get IP from firmware |
| 7916 | * @param[in] Handle to wifi driver |
| 7917 | * @return Error code. |
| 7918 | * @author Abdelrahman Sobhy |
| 7919 | * @date |
| 7920 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7921 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7922 | { |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 7923 | s32 s32Error = WILC_SUCCESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7924 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 7925 | tstrHostIFmsg strHostIFmsg; |
| 7926 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7927 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7928 | WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7929 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7930 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7931 | |
| 7932 | /* prepare the WiphyParams Message */ |
| 7933 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; |
| 7934 | |
| 7935 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; |
Sunil Shahu | bf903c1 | 2015-06-22 19:23:01 +0530 | [diff] [blame] | 7936 | strHostIFmsg.drvHandler = hWFIDrv; |
| 7937 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7938 | |
Chaehyun Lim | 7919813 | 2015-08-19 15:59:06 +0900 | [diff] [blame] | 7939 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7940 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7941 | WILC_ERRORREPORT(s32Error, s32Error); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7942 | WILC_CATCH(s32Error) |
| 7943 | { |
| 7944 | |
| 7945 | } |
| 7946 | |
| 7947 | return s32Error; |
| 7948 | |
| 7949 | |
| 7950 | } |